Jump to content


HPR - HPR1091: Useful Vim Plugins

  • Please log in to reply
No replies to this topic



    I make newbies cry!

  • Members
  • 2,983 posts

Posted 06 October 2012 - 07:00 PM

Useful Vim PluginsDave MorrissLast Updated: 2012-10-06I started learning vi a long time ago when I first encountered Unixsystems. In those days you could usually count on a system having vi (orat a pinch, when the system would only boot into single user mode, ed).Learning Emacs did't seem like a good choice since it wasn't usually availableon the systems I was administering.I dont remember when I changed to Vim, but for many years I have used it(actually gVim) as an IDE (Integrated Development Environment), particularlyfor writing Bash and Perl scripts.In these notes I have listed some of the plugins I use to enhance Vim andgVim's functionality. If you have never made enhancements to this editor,here's a site with a very good tutorial on how to install pluginshttp://www.installationwiki.com/Installing_Vim_Scripts.NERDTreeAuthor: Marty GrenfellVersion: 4.2.0Updated: 2011-12-28URL: http://www.vim.org/s...ipt_id=1658This plugin provides a file browser within Vim/gVim. A particular directory isopened by typing :NERDTree somedir. A tree is displayed in a windowwhich can be scrolled and traversed to find files to edit.In case you're interested, the colour theme I use in gVim is "Murphy".Type :h NERD_tree for the large and comprehensive help file.I prefer to use NERDTree in gVim and not in Vim. To achieve this I have thefollowing in my ~/.vimrc " NERDTree settings (only in GUI mode) if has("gui_running") let NERDTreeRoot = '~' let NERDTreeIgnore = ['~$', '.swp$'] let NERDTreeShowHidden = 1 let NERDTreeShowBookmarks = 1 let NERDTreeChDirMode = 2 else let loaded_nerd_tree = 1 endifBash-supportAuthor: Fritz MehnerVersion: 3.10Updated: 2012-06-01URL: http://vim.sourcefor...ript_id=365This one provides a Bash scripting IDE for Vim and gVim. I find it most usablein gVim where it offers a comprehensive set of menus which you can see in theexample.From the Help text: It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, comments, idioms, and code snippets. Syntax checking, running a script, starting a debugger can be done with a keystroke. There are many additional hints and options which can improve speed and comfort when writing shell scripts.The plugin can be used from the menu or by typing short-cut sequences such asct which inserts the current date and time at the cursor position. It'san amazingly detailed package that's well worth dedicating the time to learnif you often write Bash scripts.Perl-supportAuthor: Fritz MehnerVersion: 5.1Updated: 2012-06-01URL: http://www.vim.org/s...ript_id=556This plugin provides a Perl scripting IDE for Vim and gVim. As with the Bashplugin from the same author I find it most useful from gVim where the menuscan be used to perform a wide range of actions.Again, you can use it to insert statements, boilerplate text and comments, ina similar way to the Bash plugin. You can also get regular expression help,check, run and debug the scriptTwo of the functions I find particularly useful are perltidy andperlcritic. Perltidy will reformat your Perl script, and Perlcritic willcritique it according to the rules based on Damian Conway's book PerlBest Practices.Note the lower window showing the various problems detected by perlcritic.If you are a C or C++ programmer Fritz Mehner also provides a pluginfor these languages here.manpageviewAuthor: Charles E. Campbell, Jr.Version: v24Updated: 2011-01-03URL: http://www.drchip.or...MANPAGEVIEWThis is a man page viewer for use within Vim. Use :Man topic or pressK on a keyword. Can view perl, php and python help.This is a great way to view man pages, with the ability to search and cut andpaste the contents.SurroundAuthor: Tim PopeVersion: 1.90Updated: 2010-03-06URL: http://www.vim.org/s...ript_id=1697The plugin provides mappings to easily delete, change and add "surroundings"such as quotes, braces and parentheses.The following extract from the Help text should make this clearer: Consider the following examples. An asterisk (*) is used to denote the cursor position. Old text Command New text "Hello *world!" ds" Hello world! [123+4*56]/2 cs]) (123+456)/2 "Look ma, I'm *HTML!" cs"<q> <q>Look ma, I'm HTML!</q> if *x>3 { ysW( if ( x>3 ) { my $str = *whee!; vlllls' my $str = 'whee!';FugitiveAuthor: Tim PopeVersion: 1.2Updated: 2011-04-29URL: http://www.vim.org/s...script_id=2975A very powerful interface to git.The image shows the result of the :Gstatus command which is equivalentto typing git status on the command line.TaglistAuthor: Yegappan LakshmananVersion: 4.5Updated: 2007-09-21URL: http://www.vim.org/s...ript_id=273This plugin provides source code browsing by listing tags (functions, classes,structures, variables, etc.). The list is in a window in Vim or in a menu ingVim.The plugin makes us of the Exuberant Ctags utility to index tags ina source file. I believe that most Linux distributions ship with this utility,but if not it seems to be easily available in repositories.The image shows gVim with the tag list in a window. I find the menu in gVimmore useful myself.SupertabAuthor: Eric Van DewoestineVersion: 2.0Updated: 2012-06-01URL: http://www.vim.org/s...id=1643Provides insert completion functionality using the Tab key.The example shows a Perl script where the choice being made from the listoffered by Supertab is uptodate. Note also that manpageview is beingused to view the manpage for the CPAN module.It has taken me a while to learn not to use the Tab key to enter TABcharacters but to use CTRL-Tab instead. However, I have decided that theadvantages of redefining the Tab key in this way outweigh the disadvantages.You might not agree!

Go to this episode

BinRev is hosted by the great people at Lunarpages!