Plugins you should put in your vimrc(vimninjas.com) |
Plugins you should put in your vimrc(vimninjas.com) |
There are many fancy presets out there https://github.com/skwp/dotfiles https://github.com/carlhuda/janus https://github.com/spf13/spf13-vim https://github.com/vgod/vimrc but they freak me out. They turn vim into a singing, dancing, syntax/spell checking, indexing, buffer Whack-a-mole. My philosophy is that vim shouldn't do anything behind your back, but it should do great things if you ask.
* Jumping to definitions
* Finding all uses of a symbol in a repo
* Running things
+ A test
+ Code in a repl
* Git blame, diff
* Summarizing methods in open file
* Navigating my (rails) app
When putting this together, I found Vundle to be the easiest package manager. Just specify any desired vim plugin github repos in your vimrc and let the :BundleInstall, :BundleClean etc commands do the rest.I used the standard plugins for most of the stated objectives, but there are places where I found some tricks. The coolest trick is running external programs without locking vim. You can send commands and selections to a tmux terminal using Vimux: https://github.com/benmills/vimux After wrangling with running vim under tmux, I discovered that the vimux plugin works in MacVim too when tmux is running alongside.
The thing I run most often is tests. In Rubyland people advise using Guard, which runs tests automatically when test files change. However this goes against my "don't do things behind my back" philosophy. Vim-turbux is more my taste. It extends vimux to run cucumber and rspec tests with the press of a key: https://github.com/jgdavey/vim-turbux
The next area where most megadotfile presets are lacking is finding the uses of code. Finding code definition is pretty well handled by exuberant-ctags and vim-rails, but finding code uses is trickier. The cscope utility does this, but its language support is limited from what I could tell. Another contender is GNU global. Its setup is...interesting: http://simple-and-basic.com/2008/10/using-rtags-ang-gtags-fo... I couldn't get it working and the GTAGS files it generates cluttered my repos. I cheated and just mapped a key to do :Ggrep (git-fugitive) on the current word. While cscope or global would give the finest results, a massive grep comes close. Let me know, anyone, if you've gotten the tagging systems working better.
My work in progress is here: https://github.com/begriffs/dotfiles I'd appreciate any criticism; I have lots to learn.
Where's the love for UltiSnips? [1]
UltiSnips is actively maintained and well documented, not to mention supporting many more features, such as Python interpolation. More info at [2].
[1] https://github.com/SirVer/ultisnips
[2] http://fueledbylemons.com/blog/2011/07/27/why-ultisnips/
neocomplcache is actively maintained and well documented, not to mention supporting many more features, such as file path completion, register completion, omni completion and Vim completion.
I've been a happy user of snipmate, but I'll give ultisnips a try. Thanks for the tip!
Because the old SnipMate still works very well. Thanks.
* pathogen [1]
* PreciseJump [2]
* MRU [3]
* scratch [4]
* xptemplate [5]
* renumber [6]
[1] - http://www.vim.org/scripts/script.php?script_id=2332[2] - http://www.vim.org/scripts/script.php?script_id=3437
[3] - http://www.vim.org/scripts/script.php?script_id=521
[4] - http://www.vim.org/script.php?script_id=389
I disagree. This may be true if you don't understand git submodules, but git submodules are not hard to understand with just a little effort. Once understood, git submodules are very easy to work with.
Also, this may be just a personal quirk, but I'm not very fond of managing vim from within vim. It would bug the living daylights out of me to load vim just to update my plugins. I'm probably the only one who feels that way, though.
EasyGrep - A nice quick way to search for arbitrary text when ctags/cscope doesn't have the answer. https://github.com/vim-scripts/EasyGrep
QuickFixSigns - Show marks associated with each line in a buffer. Also shows lines that have been changed from what has been committed to Git. https://github.com/vim-scripts/quickfixsigns
Would be interested to know what others have to say about SuperTab since i'm thinking of giving it a try. https://github.com/ervandew/supertab
Note: I have nothing against this blog in particular.. but please, upvoters, try to upvote new stuff.
But, I must say: no matter how repetitive these articles, I pick up something new in the HN comments every single time.
Surround: wrap-region (https://github.com/rejeep/wrap-region)
Command-T: ido-mode with ido-find-file
snipMate: YASnippet
Syntastic: flymake
Buffer Explorer: ibuffer
Is there some really easy modification I have overlooked? Because that is one of the major advantages CtrlP or Command-T have - and trying to use https://github.com/emacs-helm/helm with https://github.com/bbatsov/projectile turned out to be by far too slow.
Check also pkrumins' Vim Plugins You Should Know About:
http://www.catonmat.net/blog/vim-plugins-surround-vim/ http://www.catonmat.net/blog/vim-plugins-repeat-vim/ http://www.catonmat.net/blog/vim-plugins-matchit-vim/ http://www.catonmat.net/blog/vim-plugins-snipmate-vim/ http://www.catonmat.net/blog/vim-plugins-a-vim/ http://www.catonmat.net/blog/vim-plugins-nerdtree-vim/ http://www.catonmat.net/blog/vim-plugins-ragtag-allml-vim/
These are all the 13 plugins currently sitting in my bundle directory:
* AutoComplPop
Provides auto completion. I like/need auto completion less and less, these days, so this one is on its way out. I tend to deactivate it and use my old custom mappings for omni completion instead.
The no plugin way:
inoremap ,, <C-x><C-o>
* CommentaryToggles comments.
The no plugin way:
0i//
:s+^//++
* CtrlPSuper sleek fuzzy file/buffer/tag navigation. I love it.
The no plugin way:
:e filename
:sp *na<tab>
:vs **/fi<tab>
:sb *na<tab>
nnoremap <leader>ls :ls<CR>:sb<Space>
etc.
* DelimitMateAutomatically adds the second "')]}.
The no plugin way:
inoremap { {}<left>
* EasyGrepHandy cross-files/buffers search/replace. More convenient than the default mechanism.
The no plugin way:
:vimgrep <cword> *.js | copen
* InsertImg (customized)Inserts an <img> tag with the correct width and height.
* SnipMate
I use the old one as it does everything I need without any problem.
The no plugin way:
:help abbreviations
* SparkupUses CSS syntax to quickly create large HTML layouts:
div.aclass*5 > p{lorem ipsum} + img.anotherclass[src=/images/img.png]
* SurroundSee the article. This one is almost a good reason in of itself to switch to Vim.
* Syntastic
Syntax checking of many languages on the fly. Super handy.
* Tabular
Because I like my code neatly aligned.
* Visincr
I actually don't use this one much but it helps a lot when I need to write lists of numbers/letters.
* Word-Column
The new kid on the block. Provides a text-object for columns.
and the 14th, currently testing:
* EasyMotion
I looked at the rest of the site, bookmarked!
Can I make an article suggestion though? I'm a new(ish) vim user that is always on different systems. I need a way to quickly install/remove my vim settings and plugins. A tutorial how to do this would be awesome.
Take for granted vim and git are already installed, my ideal workflow would be something like this:
git clone git://blah.blah/my_settings.git ./my_settings/install.sh
Now I can run vim and my whole environment will be ready. If I make any changes I should be able to run git push to update the repository. Then I could run remove.sh to clean everything up.
Is there a system like this out there already?
https://github.com/gmarik/vundle
You just copy your .vimrc over and Vundle installs everything.
The Writegood scripts can be handy if you write non-fiction prose in Vim.
A strange synchronicity: I came across the page at
http://matt.might.net/articles/shell-scripts-for-passive-voi...
and duly copy/pasted the bash scripts and ran them over some text files. Quite useful. Then I saw this thread and wondered if anyone had done a vim plug in for them. And davidbeckingsale has.
Maybe, there is some deeper sense in it that I haven't grasped yet?
It allows you to define up to 10 search terms and highlights them in different colors, making it easy to see patterns of output in logs.
It doesn't sound that amazing at first but is worth trying if you herd log files for a living.
* matchit - extends % functionality to support HTML/XML tags and also functions, blocks, conditionals in many languages.
* Supertab - tab completion done right.
* Tagbar or Taglist - code tree browser.
2. Unzip in ~/.vim/bundle
3. Done
How is that "dark art"?
It may sound odd, but learn to use the tool by itself before you try and plugin anything else, otherwise you'll just get lost.
More generally, to me, the features that happen ship with Vim aren't special. I want the best editor for me, which might require features the builders of Vim didn't want to include. Vanilla is just another flavor.
Whatever you do, don't install syntastic unless you want your vim to run awfully slow.
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
It lets CtrlP use git to list files, which is much faster for large project let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files --exclude-standard -co']
It was annoying me that I couldn't open files I'd just created with CtrlP, as they wern't yet tracked. let g:ctrlp_user_command = "find %s -type f | egrep -v '/\.(git|hg|svn)|solr|tmp/' | egrep -v '\.(png|exe|jpg|gif|jar|class|swp|swo|log|gitkep|keepme|so|o)$'"
While the CtrlP window is open, hitting F5 will refresh the list of files and it's really fast. I'm on an SSD but it's still basically instant on every project I code in. I think it must have a slow default which gives people the impression that it's slow. After using both FuzzyFinder and Cmd-T for a long time, CtrlP has been easily the best of the bunch. "Keep caches between sessions - f5 to refresh
let g:ctrlp_clear_cache_on_exit = 0 :ts *Something*xml<tab> (or /Something.*xml<tab>)
will do what you expect. As will :e **/somewhere/*myfile*.
That said, I'm going to check ctrlp out to see if I'm missing something good. :-)Granted, Ctrl-P is much slower than Command-T. Won't deny it. But carefully excluding all .git, virtualenv (for python) and similar folders in my .vimrc, along with making sure I cd into a directory a little closer to my code makes it almost as quick for me. And it just works, which is invaluable in my book.
:e *ba<Tab>
:vs ../**/fo<Tab>
I love CtrlP but you can go a long way without any plugins. It just takes some time and effort.My own is here [1] but it covers my whole homedir, not just VIM. I use Rake tasks (originally inspired by @holman, I believe) for install / update / clean.
There is a bootstrapping problem when using Vundle with many plugins [2]. The only way to have your Vundles install cleanly the first time is to split up .vimrc into two separate files, which is what I have done.
[1] https://github.com/anthonywilson/dotfiles
[2] http://www.gmarik.info/blog/2011/05/17/chicken-or-egg-dilemm...
For me my vim environment consists of my vimrc plus plugins. Granted, I pick plugins based on the "doesn't need extra steps to work" requirement.
vundle therefor restores my setup completely from a (potentially restored or managed in a git repository) vimrc file. What's missing for you?
./configure --enable-rubyinterp && make
works just fine on my machine.Or if yours isn't for whatever reason, you could cheat and grab MacVim[0] then symlink `/Applications/MacVim.app/Contents/MacOS/Vim` to `/usr/local/bin/vim` (editing paths as necessary)
Open file in MacVim:
$ mivm file
Open file in Vim: $ mvim -v fileI can't speak for other vim users, but I haven't had a lot of luck with distro versions of vim and Ruby/Python extension scripts on Linux either. After fighting with it for a while, I ended up just declaring my .vimrc to be a VimScript-only zone. It sucks losing Gundo and Command-T and a couple other great plugins, but it's done wonders for my sanity, and everything works well on Windows as a bonus.
I also had no problem installing it in Ubuntu/Mint. Just removed vanilla vim and installed vim-gtk and then compiled command-t.
Command-t is actually my only non-vimscript plugin in my plugin list, and it is rightfully so :). I tried to cope with CtrlP, but it feels too slow for me for large collection of files. Also its fuzzy matching is not on par with command-t. I have actually no problem to take this little hassle to install command-t for performance consideration :).
I agree with your vundle suggestion. I migrated from pathogen to vundle and would recommend that people using the former check out vundle again. Even if it's from the 'wrong author' (aka not from tpope).
Just stating "X is better" without giving any reason is not particularly helpful.
This isn't clear from it's webpage.