Git Product home page Git Product logo

vim-scriptease's Introduction

scriptease.vim

I make so many Vim plugins I had to make a Vim plugin for making Vim plugins.

Features

  • :PP: Pretty print. With no argument, acts as a REPL.
  • :Runtime: Reload runtime files. Like :runtime!, but it unlets any include guards first.
  • :Disarm: Remove a runtime file's maps, commands, and autocommands, effectively disabling it.
  • :Scriptnames: Load :scriptnames into the quickfix list.
  • :Messages: Load :messages into the quickfix list, with stack trace parsing.
  • :Verbose: Capture the output of a :verbose invocation into the preview window.
  • :Time: Measure how long a command takes.
  • :Breakadd: Like its lowercase cousin, but makes it much easier to set breakpoints inside functions. Also :Breakdel.
  • :Vedit: Edit a file relative the runtime path. For example, :Vedit plugin/scriptease.vim. Also, :Vsplit, :Vtabedit, etc. Extracted from pathogen.vim.
  • K: Look up the :help for the VimL construct under the cursor.
  • zS: Show the active syntax highlighting groups under the cursor.
  • g=: Eval a motion or selection as VimL and replace it with the result. This is handy for doing math, even outside of VimL.
  • Projections for projectionist.vim.

See the :help for details.

Installation

Install using your favorite package manager, or use Vim's built-in package support:

mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/scriptease.git
vim -u NONE -c "helptags scriptease/doc" -c q

Once help tags have been generated, you can view the manual with :help scriptease.

Contributing

See the contribution guidelines for pathogen.vim.

Self-Promotion

Like scriptease.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.

License

Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. See :help license.

vim-scriptease's People

Contributors

blueyed avatar dag avatar emilyst avatar jamessan avatar janko avatar jonjonsonjr avatar lervag avatar peeja avatar sodapopcan avatar tpope avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-scriptease's Issues

Sort results by length with runtime_globpath, e.g. for `Vedit`?

I wonder if using s:lencompare on the list from s:find / s:runtime_globpath would make sense.

I am having an issue with neobundle where it adds itself to the &rtp and has a copy of all help files in a doc directory therein (Shougo/neobundle.vim#269).

Then I've tried to use :Vedit doc/foo.txt to get to the original help file as a workaround, and noticed that it does not appear to prefer the shorter path.

No manual entry for...

Unfortunately, when navigating to any link to another vim manual entry and uppercase K doesn't work. But a usual :h %entry% works. What am I doing wrong?

Might not work for one-line guards

I prefer to use screenspace conservatively, so I use a single-line guard.
For example, I do the following in Node.js for Vim's node.vim file:

if exists("g:loaded_node") || &cp || v:version < 700 | finish | endif
let g:loaded_node = 1

I have a feeling Scriptease doesn't unlet that Guard and thereby fails to reload the code.

:Vfind – an extended :Vedit

I think it would be even more convenient to have a command (something in the spirit of :Vfind or $ which -a vim) which searches all vim recognized subfolders:

This is a list of directories which will be searched for runtime
files:
  filetype.vim  filetypes by file name |new-filetype|
  scripts.vim   filetypes by file contents |new-filetype-scripts|
  autoload/ automatically loaded scripts |autoload-functions|
  colors/   color scheme files |:colorscheme|
  compiler/ compiler files |:compiler|
  doc/      documentation |write-local-help|
  ftplugin/ filetype plugins |write-filetype-plugin|
  indent/   indent scripts |indent-expression|
  keymap/   key mapping files |mbyte-keymap|
  lang/     menu translations |:menutrans|
  menu.vim  GUI menus |menu.vim|
  plugin/   plugin scripts |write-plugin|
  print/    files for printing |postscript-print-encoding|
  spell/    spell checking files |spell|
  syntax/   syntax files |mysyntaxfile|
  tutor/    files for vimtutor |tutor|

Occasionally, it is not clear whether the file you have in mind is in ftplugin, plugin, autoload or you know that there is only a scriptease.vim in the folder plugin so you do not have to prepend the expected foldername. Instead of typing :Ve plugin/scriptease.vim you can enter :Vf scriptease.vim.

dictionary function support for :Breakadd

Do you have a plan for supporting dictionary functions for :Breakadd?
Script using dictionary functions is often long and difficult to understand, so adding this feature will be incredibly helpful for us.

Jump to :verb output files

I often :verb map or :verb set to find out which file is responsible for configuration – but need to manually go the file itself. :Verbose map is better – at least I can jump to the file – but still have to handle the line number manually.

It would be great if :Verb map and :Verb set loaded results in the quickfix list.

Could not determine script id when setting breakpoint inside s: function

Consider the following simple foo.vim file:

function! s:Foo()
    let x = 2
    return x + 1
endfunction

echo s:Foo()

Now if I open nvim and do Breakadd here inside the s:Foo function I get and error saying

Could not determine script id

If I now run :Runtime on that file and repeat the process of setting the breakpoint inside the function then the breakpoint is correctly set. So my question is: is it possible to set a breakpoint within an s: function without having to run :Runtime first? I guess the answer is no but any pointer/explanation is appreciated. Thanks in advance.

Feature request/idea: a helper command for redirecting to a buffer

I found myself wanting to look through all my autocmds and the only way I could think to do it was redirecting the output of autocmds to a register and pasting that into a new buffer. Any chance you'd consider adding a command to handle that more easily for arbitrary commands? Something like :Redir autocmds. I think it matches the intent of e.g. :Messages.

Using defined projections inside vim plugin projects

Hi,
when I saw vim-scriptease supports projections I thought they would automatically work for any vim project. Here's the use-case:

$ cd vim-ruby
$ vim
:Eftp<tab> # doesn't work ??

This scenario works:

:Vedit ftplugin/ruby
:Esyntax ruby

Are there plans for supporting the first use case?

Thanks!

.vim debug reference

Ok, I have dived (diven? dove?) headfirst into pimping [g]Vim into the code editor I need it to be. I do node/javascript. I have the start of a javascript.vim indent module from https://github.com/nikmartin/vim-javascript. But it has bugs. I want to fix those bugs. You appear to be a Vim god among men. Do you have a recommendation for a reference on getting started debugging vim scripts? I got :help debug-scripts but there has to be something better than step step step step to wade through an indent script every f-ing time I hit a right bracket to try to debug why my brackets indenting sucks. Any suggestions?

`:{count}Verbose` doesn't work in an empty buffer

Hello,

Some commands in vim-scriptease are defined with the -range=N attribute, and can be prefixed with a count. This is the case, as an example, for the :Verbose command, to temporarily increase Vim's verbosity level.

Since Vim's patch 8.1.1241, the command doesn't always work anymore. That is, if you prefix :Verbose with a count greater than 1, in an empty buffer, Vim complains with the error E16: Invalid range.

I think that's because the range is interpreted as the line of an address, and there's no line whose address is greater than 1 in an empty buffer.

Here's a MWE:

com! -range=1 Cmd echo 'test'

Run :3Cmd in an empty buffer, and E16 will be raised.

I think the solution is to specify that the type of the range is other (which doesn't exist yet in Nvim):

com! -range=1 -addr=other Cmd echo 'test'
              ^^^^^^^^^^^

At least, it does fix the issue on my machine.

Do you think that Vim's patch 8.1.1241 introduced a regression, or is it working as intended, and you're now expected to use -addr=other whenever you want to use -range for some arbitrary count, not tied to any specific type (line address, buffer number, window number, ...)?

E149: Sorry, no help for :Plug

Hi, I was playing around with the <K> mapping and there may be a bug for Plug in these contexts:

Plug 'tpope/vim-scriptease'  # 1st column
  Plug 'tpope/vim-scriptease'  # with tab

Not sure if it's my setup, but maybe someone can verify. I guess it has to do with scriptease#helptopic() and an uppercase char as the 1st char of the line.

How can you debug a local "s:" function while NOT inside its Vimscript file?

Sorry if this is just uninformed, but I am having a really hard time wrapping my head around what the workflow is supposed to be with this.

In trying to debug a vim plugin which is active for a certain filetype (vimwiki, .wiki files).

Upon certain keyboard actions (pressing o or Enter on a specific line in the .wiki file), some vimwiki-specific functions are invoked which cause a noticeable slowdown.

I was able to get the following to work so far, using Vim's standard debug functionality:

:123  "go to specific line
:debug normal o  "Insert a new line. This command is very slow.
:breakadd func vimwiki#lst#kbd_o

This makes the debugger break on kbd_o and I can step and echo variables.

But all the action happens in some other local "s:" functions, for which :breakadd apparently does not work.
This is what :Breakadd (according to the documentation) supports, but it is only available when inside a vimscript file.

Since these "s:" functions are not pure functions, but work on some non-trivial buffer contents, I (believe I) can't just call them with their arguments while inside the Vimscript file where they are defined.

Is it possible to add a breakpoint for this local function and still start debugging like described above?

Feature Request : Vgrep

Sometimes I just want to grep through the vim plugins, I can easily write something on my own but feel like this plugin might be a good place for this.

If you think there's value, I can work on a PR.

iskeyword: colon

I've found that vim-scriptease removes the colon from iskeyword:

" Recent versions of vim.vim set iskeyword to include ":", which breaks among
" other things tags. :(
autocmd FileType vim setlocal iskeyword-=:

It mentions that this would break tags, but for me removing : breaks tags, since a colon is included with script-local functions (s:foo).

You are not using https://github.com/universal-ctags/ctags then, are you?

Feature Request - add filetype to Verbose preview window

I'd like to add some behavior to the Verbose preview window. Please consider adding a (scriptease specific filetype to the preview window scriptease#verbose_command() to give a hook to trigger modifications off of.
Among other things, I'd add a <nowait> to the q mapping, but I'd consider some personal navigation commands etc.
I'd expect it could be as simple as adding another command, set ft=scripteaseverbose, into the exe chain.

Feature Request: grep runtimepath & scriptnames

Hi tpope, I wrote a small plugin that greps through &rtp & scriptnames, which I've found useful for hacking on vim.

When I shared it on r/vim, it was suggested to me that I should turn it into a PR for scriptease, which makes sense to me, especially since I used a couple of your functions (scriptease#capture & scriptease#scriptnames_qflist) anyway.

So if you think these 2 features are good additions, just let me know.

Is a :SyntimeReport command possible?

in the spirit of :Messages, :Scriptnames.

Right now I do following to the see full report which is usually longer than the screen.

:syntime on
" scroll in file with slow syntax file (e.g. tex with vimtex and fontawesome5 latex syntax)
:redir > syntimereport.txt
:syntime report
:e syntimereport.txt

I am not sure if it is possible to get the actual lines of the syntax groups in the syntax file. Vim help mentions that the name is not necessarily unique:

			NAME		Name of the syntax item.  Note that
					this is not unique.

Maybe loading the report into the preview window for full view and easy navigation would be a first step.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.