Ask HN: What Vim Plugins do you use?
What plugins do you use and what is your favorite plugin and why?
What plugins do you use and what is your favorite plugin and why?
@ pathogen - to manage all the other plugins neatly
@ delimitMate - autoclose quotes, (,{,[ - you can define protected regions (e.g., strings) for no autoclose
@ vim-endwise - automagically enter an 'end' as needed in Ruby files
@ vim-bufexplorer - work better with buffers
@ vim-fugitive - lots of Git goodness for Vim
@ vim-surround - add, delete and change common pairs easily
@ IndexedSearch - show total count number and current hit for searches
@ gist - add support for sending buffers to gist or editing gists via Vim
@ vim-pastie - adds support for http://pastie.org/
@ rvm.vim - show current Ruby interpreter in status line
@ vim-perlbrew - ditto for current Perl interpreter
http://github.com/telemachus/vim-perlbrew
http://github.com/ninjagod/etc/tree/master/vim/plugin/
I've been using Vim for three years or so. Apart from the usual bunch of plugins (NERD_tree, snipmate, etc), I have a few scripts I like:
Pretty much everything by Tim Pope - surround.vim, matchit.vim, fugitive, etc.
Fuzzy finder. I don't know how I survived without this until a few months ago. It allows you to enter a search term, and returns fuzzy matches, and you can jump to any of the matches. Things that Fuzzy finder supports include files, buffers, tags, help, etc.
Bufexplorer: One more of my favorites. "\be" brings up a little text file which you can use to manage your buffers. This is similar to Emacs' buffer explorer (C-x C-b). Except since this is also a text buffer, you can use common motions to delete, switch, save buffers, etc. (Another item is minibufexplorer, which shows all the buffers like "tabs". I stopped using this after switching to a more emacs-esque way of keeping buffers open and using only one gvim window").
Bufkill.vim: Is a very useful little tool for me. I use splits a lot, and sometimes killing a buffer closes the split. This small tool has been invaluable. :BD closes the buffer, but keeps the splits in place.
Eclim: You can use Eclim as a frontend for eclipse. I use some fancy eclipse IDEs sometime like CDT, PyDev, Aptana, etc. But eclipse's editor isn't spectacular. Eclim allows me to use vim as the editor and lets eclipse do the heavy lifting - autocomplete, project management etc.
Supertab: Use Tab for all your insert mode completion. Somehow any form of intelligent completion was always very flaky for me with vim. Still, I map this to keyword complete, which is usually pretty helpful.
Remotes: This isn't a plugin, but a native feature. You can use Vim remotes to keep one instance of gvim running and use "gvim --remote" instead of "gvim" to open files inside a single instance, rather than open each file inside a terminal, and close it when you're finished. I found this really helps improve productivity.
I even aliased "vim" and "vi" to map to the remote editor. You can see my tiny workaround for this: http://github.com/ninjagod/etc/blob/master/zshrc#L31
I would recommend you read Peter Krumin's articles on various vim plugins, etc.
So, serious question: What benefit do you get from Bufexplorer, Bufkill, etc? Why should I ever think about buffers?
I've got $EDITOR set to "gvim --remote --wait" which means that the file is opened in an existing instance of vim. Unlike "gvim --remote" which will return control to the shell the moment the file is opened in gvim, the --wait option forces the command to wait till the file is closed (which is the standard expected behavior for most things like writing git commits, etc).
Now the interesting problem is that I have to kill the buffer rather than quit the editor. so I do a :w and :bd to delete the buffer, which makes sure things go fine on the shell.
Sometimes, if I have opened the file in a split (which is invariably the case), using :BD will ensure that my split isn't closed as well, when the buffer is killed.
Plus, BufExplorer has a very neat little trick which I just discovered recently. Sometimes I can close a buffer and might have to reopen it. So I bring up Bufexplorer and press "u" to undo changes, and I can go reopen any of those buffers.
[1]: http://eclim.org
With Eclim you get all of vim, as you say, but you lose a bit of the native eclipse editor functionality.
With Vrapper you get all of eclipse, and a subset of the core vim commands. It's not vim, but you get to keep all of the features of the native eclipse editor.
- pathogen (for keeping bundles nicely separated)
- pyflakes-vim (highlighting errors in Python files on the fly)
- slime.vim (sending text in the current buffer out to a screen session)
- scratch.vim (an easy way to make a scratch buffer, great when used with a REPL in a screen session and slime.vim)
- ack.vim (easy way to use Ack instead of grep)
- NERD Commenter ("toggle comments" is the only function I use from this, but it works great)
- PeepOpen (much prettier than FuzzyFinder TextMate, and actively developed!)
- NERD Tree (for when I need to add/move/rename files [I do all my opening with PeepOpen])
- rainbow (Highlights pairs of parenthesis/brackets in their own colors. Great for LISP, sometimes useful for other languages as well)
- snipmate (TextMate-style snippets. I'm still building up a decent set of snippets I use often.)
- sparkup (like Zen Coding, but just seems to work more smoothly with vim)
- surround (modify surrounding brackets, tags, parentheses, ets)
- repeat (just for repeating surround actions)
- yankring (awesome yank/paste manager)
My dotfiles (including the vim stuff) are on Bitbucket: http://bitbucket.org/sjl/dotfiles/
Another really useful plugin I need to "release" is a "I'm Feeling Lucky" plugin that opens a browser window with the first Google result of the word the cursor is over--this such a useful general-purpose search that I use it all the time.
Finally, VCSCommand.vim is pretty great for viewing SVN/Git/etc diffs, making commits, seeing annotated files, etc: http://www.vim.org/scripts/script.php?script_id=90
* gnupg : Plugin for transparent editing of gpg encrypted files.
Not a plugin, but related: my .vim directory/.vimrc is a symlink to a directory/file in my Dropbox folder, to keep my plugins and settings in sync on multiple PCs.
Yes, I started doing the exact same thing. Same for my ~/.bash_profile.
Also if you find yourself editing files in your dropbox folder, it helps to have
set directory=~/tmp/
in your .vimrc so that it doesn't keep creating .swp files in your dropbox folder, which keep getting synced.* pathogen : install plugins in seperate directories
* NERD_tree : Tree navigation
* NERD_commenter: Comment/uncomment lines. File type agnostic
* Rename : Rename file in buffer
* Ack : Search using ack not grep
* Command-T : Fuzzy find files in path * Rails.vim : shortcuts to open models, controllers and other ruby on rails related stuff
* snipMate : Textmate like snipplet funktion
* surround : Add, change or delete surroundings
- Taglist : uses exuberant ctags to parse your code and present you with a nice source code browser. It's a lifesaver for large projects.
- surround : Add, change or delete surroundings (punctuation, quotes, tags, etc.) in pairs.
- lhCpp : a suite of C and C++ plugins
- SuperTab : all insert-mode completion done with Tab
- minibufexpl : if you're working with buffers a lot, it will make your life easier
Those are all, I think. Of course there's heaps of other functionality that I've added in my own .vimrc, does that count? :)
Being able to quickly split and have your header file open is incredibly useful, considering how common an action it is.
Its a constantly evolving thing, wherever I find a pain point, or an optimization to be made, it gets changed.
The focus is mostly python development on OSX using MacVim, but I have isolated most things that require MacVim/GVim so they don't load in a terminal.
It doesn't matter so much because whenever I want to get setup, I just git clone those directories into my home directory but I am seriously looking into Pathogen, which seems like a saner way to handle packages in vim.
edit: I just noticed there is a little whitespace bug in my django template handling, so be aware of that until I fix it.
edit edit: Fixed!
Also, I haven't even come close to mastering all of the commands and other things that are already built into vim. If I haven't mastered all of those, why do I need to add more? Instead of changing vim, I should change myself. It's much easier, and it transfers to every machine automatically.
[1] http://cx4a.org/software/rsense/
//Buzzz
- view diffs of the current file with vimdiff
- stage from within vim
- commit from within vim
- blame from within vim
- repository-wide grep within vim $ cd ~/.vim/
$ git init
$ mkdir {autoload,bundle}
$ wget -O autoload/pathogen.vim http://www.vim.org/scripts/download_script.php?src_id=12116
$ git add autoload/pathogen.vim
$ git commit -m 'add pathogen.vim plugin'
Then, you can just extract each plugin under that bundle directory, or if they're managed by the same version control software you're using, you can use something like git submodules to track the plugins automatically. Add this to the top of your ~/.vimrc file: filetype off
call pathogen#runtime_append_all_bundles()
filetype plugin indent on
...and you're off to the races. Let's say you want to add NERD_tree: $ git submodule add http://github.com/scrooloose/nerdtree.git bundle/nerdtree
$ git submodule init
$ git commit -m 'add nerd tree plugin as submodule'
From then on, you'll be able to track upstream changes to the plugin, and everything is self-contained so you don't have to worry about copying all the files into /doc, /ftplugin, /syntax, etc. The one thing you'll want to do is generate all of the help docs after you have your plugins installed by loading up vim and running: :call pathogen#helptags()
The list of what I use goes a little something like this:@ pathogen - to cleanly organize all of your plugins
@ bufexplorer - to explore your open buffers
@ command-t - a better fuzzy finder for opening files
@ endwise - add proper end statements for ruby code
@ fugitive - fantastic git wrapper
@ matchit - jump to matching brackets or logical statements
@ nerdtree - navigate and manipulate files
@ pastie - post code to pastie.org
@ repeat - adds the ability to repeat functions with .
@ speeddating - Ctrl-A/Ctrl-X manipulate dates properly
@ surround - alter stuff that surrounds text like quotes and html tags
@ taglist - helpful source code browser
Beyond that, I have a bunch of syntax files for various languages and file formats.
Realistically though, if you're just starting out. Learn how to use the editor first, then if you notice certain use cases that you don't have with built-in features (and there are a TON), then start looking for plugins to make your life easier. There's a lot you can do with custom settings and functions in your ~/.vimrc file too, so it will take time (years) to build up what works best for you. Be patient, it's worth it!
If you're curious, you can always find gems by looking through other people's configs: http://github.com/elasticdog/dotfiles
a: flip between .c and .h files a bit easier.
snipMate: code snippets. Filling out the shebang line, and C/python main idioms in throwaway experiments are the main reason I use this.
vcscommand: I only really use VCSVimDiff, but it works great for viewing changes in the current file when using git, mercurial and subversion.
emacs: inspired by vimacs[0], I also fixed ex command line editing to work with readline/emacs keys. Mapping Alt in insert mode is really buggy, so I use to ctrl-g instead of esc.
patchreview: like diffpatch, but for multiple files and you can specify a base path.
I have a whole bunch of my own silly plugins that I've created over the years, mostly unreleased, that do lots of great stuff. The :make and :grep quickfix highlighting I lifted from eclim is particularly useful.
I miss emacs.vim and vindect the most when I use vim on some other machine that doesn't have them.
I also have NERDTree but very seldomly use it.
- Where is this symbol defined? - Where is this function called? - Where is this variable referenced? Assigned?
It's the one plugin I use all day, every day.
Here's my .vimrc: http://gist.github.com/517464
I like to use cursorcolumn and cursorline with low contrast colorschemes like obsidian or evening.
I've been using vim for 10-15 years.
This is my configuration: http://bitbucket.org/johannes/vimfiles/src
I'm a netadmin doing a sysadmin's job, though. If I was slingin' code regularly, I'd use several plugins.
When I wear my developer hat, I dig nerdtree and vimoutliner.
ScriptID SourceID Filename
--------------------------
642 1 :AutoInstall: getscript.vim
1075 1 :AutoInstall: netrw.vim
1502 1 :AutoInstall: vimball.vim
2010 1 :AutoInstall: sessionman.vim
1896 1 :AutoInstall: ragtag.zip
273 1 :AutoInstall: taglist.vim
1984 1 :AutoInstall: vim-fuzzyfinder.zip
snipmate - textmate like snippets. Works very well.
NERD_tree: As others have mentioned.
Not really a plugin but, this is useful for automatically closing your '(' and '[' and quotes etc... http://concisionandconcinnity.blogspot.com/2009/07/vim-part-...
My favorites would be:
- surround
- zencoding-vim
- rails-vim
- yankrink
- nerd_commenter
Other: taglist Nerdtree matchit zoomwin dbtext
* NERD_tree - Nice tree list of files for project browsing
* NERD_commenter - Mapped to ,c<Spc> to toggle between commenting and uncommenting
* SimpleFold - Folding that doesn't suck courtesy of the eigenclass blog
* a.vim - quickly alternate between a .c and .h file
* ack - way better searching than vimgrep or regular grep
* vimclojure - A must-have for Clojure dev in Vim <3
* ctk - auto-compilation and syntax check for languages. I use it to check ruby files on save
* easytags - automatically generate the tags file for your buffers
* eclim - I develop enterprise Java, eclim keeps me sane by giving my almost all of Eclipse's useful features in Vim
* fuzzyfinder - great file-finding tool similar to Emacs' C-x C-f
* gist - automatically post your buffer to a gist, download gists etc, super handy
* localvimrc - allows me to have project-specific vimrcs
* matchit - for beter % matching
* narrow - Emacs'-style narrowing and widening
* netrw - edit files remotely over ftp/ssh/etc
* paredit - the paredit.vim file from the slimv plugin, doesn't work as well as Emacs' paredit, but it's semi-useful
* pastie - post your buffer to pastie
* rails - various helpers from the vim-ruby project for rails
* repeat - allows repeating things that aren't normally repeatable with '.'
* securemodelines - don't let people do mean things in modelines
* showmarks - I'm on the fence with this one, great if you use a lot of marks and want to show them
* slime - pipe text from a vim buffer to a screen session
* snipmate - Textmate-like snippets for various languages
* supertab - tab-completion that works pretty well, this + eclim is great for java dev
* surround - tools for messing with surroundings of files
* taglist - use ctags to display a tag list in a pane
* twitvim - seriously, why use a twitter client when you can use vim
* vimball - used to install a lot of vim plugins
* vimwiki - I store all of my tech-related text here
* visualstar - this lets you use '' to search for more than just a single word
yankring - a ring of yanks when doing copy/paste
If I had to pick just one for a favorite, it'd be a tie between fuzzyfinder and NERD_tree, way better than manually trying to find the file to edit.
In addition there are quite a few filetype plugins for better syntax highlighting for the variety of languages I work with.
My entire vim setup dir can be found here: http://github.com/dakrone/dakrone-dotfiles