VIM Plugins

Vim. Most of them just grew out of the fact that I’ve used previous IDEs and editors that have similar functionality. Hope it helps someone.

CompView – Compressed Search View

compview.vim is a handy little script that I use all the time. After a search term is entered it generates a list of matches and displays a window with all the matching lines. As you move around this window to different matched lines the original window is automatically updated to show you where in the file the match is found. It is like an interactive ‘cw’ command.

Mini-FAQ

Can you change it to search all the buffers loaded?
That was my original intent, but as you can see I haven’t had time to change the script.
Why is there a delay when I move around the result list?
This is because it is not really capturing keystrokes but rather using the CursorHold event that gets triggered whenever the user doesn’t press a key for the specified time in ‘updatetime’. You can try reducing the value but might slow down other things. Play around with it.

Screenshoot

Compress View Script

TaskList – Simple Eclipse Like Task List

tasklist.vim I got a request from a developer that he used the CompView script (see above) all the time, but wanted something that resembled the eclipse task list. So here it is, this script will search the file for FIXME, TODO, and XXX (or a custom list) and put them in a handy list for you to browse which at the same time will update the location in the document so you can see exactly where the tag is located. Something like an interactive ‘cw’

Mini-FAQ

Can you change it to search all the buffers loaded?
I haven’t had time to implement this but I really think this would help out.
Can you make it sort according to the way the appear in the file rather than grouping by type?
The way it is implemented right now it is not very easy to do this. You would have to re-write the whole search function to do this.

Screenshoot

Task List Script

SearchFold – Search by folding non matching lines

searchfold.vim is a good script to have around. You give it a search string to find and folds everything except for the lines where the string matches. By default is keeps some non-matching lines around you you can get an idea of where you are in the file and gives you the ability to expand “the view” for a particular match to get more context. After you are done looking around you can “quit” the script and keep the fold or go back to the file as it was (restoring any previous folds).

Screenshoot

Search Fold Script

Miscellaneous Commands Beta

I have a few version control commands that I use quite often, I have not tested them or polished them for general distribution so they are very beta. If you feel adventurous here they are rcsdiff.vim, cvsdiff.vim and svndiff.vim. Just drop them into your plugins directory, then when you are in a file with version control use the command :RCSDiff to start a diff session. You can also specify the revision you want to compare to as well such as :CVSDiff 1.5 And the best part is that I can do a quick diff from the command line $ vim +SVNDiff main.c

If you are a GIT user Bart Trojanowski has GITDiff script.

8 comments

  • Alessandro (5 years)

    Hi,

    I just want to inform you that a add one global variable to your script “TaskList” and made a change on the “map” option. Of course, in my copy of your plugin. I used t for something else and I added a global variable to be able to change the key mapping in a setting flag.

  • keramcan (5 years)

    Hi
    Thanks for the tasklist.vim it is very helpful. However it is very greedy I mean it does not respect the script formatting of the Tokens. I was wondering if we could get a version that is less greedy when searching for the tokens in the file?

    thanks

    • Juan Frias (5 years)

      I am not sure what you mean by “greedy” can you give me an example?

  • keramcan (5 years)

    Hi
    I meant that it matches every occurences even inside individual words.

    For example, Tasklist catches “mytodolist” as a TODO and lists it naturally in the special buffer. I would think that it should only do exact match?

    • Juan Frias (5 years)

      Ah! I see what you mean. Well the patterns it uses for matching are actually regular expressions so you could add this to your .vimrc to make it “non-greedy”

      let g:tlTokenList = ["\<FIXME\>", "\<TODO\>", "\<XXX\>"]

      The plugin uses the search() function so you can use any {pattern} you like. See :help pattern for details.

      Hope this helps.

  • Ludvig Ericson (4 years)

    This is awesome. Thank you.

  • Matteo Landi (4 years)

    Hi,
    I found your tasklist plugin very useful: thanks for sharing! I was wondering if it would be difficult to implement a `toggle’ functionality: currently if you press the shortcut again once the tasklist window is open, it ends creating a new one. What do you think about it?

    Regards,
    Matteo

    • bpkroth (4 years)

      A bit of a kludge, but it works:

      let s:tasklist_open = 0
      function s:ToggleTaskList()
      if (s:tasklist_open == 1)
      call s:Exit(0)
      let s:tasklist_open = 0
      else
      call s:TaskList()
      let s:tasklist_open = 1
      endif
      endfunction

      command! ToggleTaskList call s:ToggleTaskList()

      map :ToggleTaskList

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Go to Top