Sunday, March 11, 2012

Current Vim Configuration Setup

Vim is a great and wonderful tool. However, it can be a bit of a burden to maintain the configuration. I recently read an article that improved this and I tried it out to see how well it worked. So far, it has worked out well and has definitely improved how easy it is to maintain my vim configuration.

To start, my new vim configuration file contains the following:

runtime! config/*.vim

That's it. What this does is execute the configuration in every file in the .vim/config directory that ends with the .vim extension. I now have my configuration into six different files. Here is my current breakout:

common.vim
functions.vim
maps.vim
matches.vim
statusline.vim
vundle.vim

Common contains just basic options, such as setting the font, color schema, default tab stops, etc. T?he rest are pretty self-explanatory. The vundle file is named as such because I use Vundle for managing my plugins, however this could contain configuration information for any similar tool.

Another change I made was to leverage the ftplugin capability of vim to set file type specific configurations only for those specific files. I don't have a lot and most aren't that interesting, though for the java plugin, I do set a couple options to make java development a bit nicer.

setlocal omnifunc=javacomplete#Complete
noremap <F5> :let $CLASSPATH=system('cat .classpath')<CR>
compiler maven2

This just sets omnicompletion to use the javacomplete plugin and to also allow the classpath for the project to be set to the contents of the .classpath file, which I generate via maven. Most importantly, at least for me, is the fact that maven2 is now used for the compiler. In my situation, I like to use the :copen command to keep the window with the errors open when compiling so that I can see all of the compilation errors that occurred.

That's all for now. Hopefully this helps out anyone else trying to keep their vim configuration under control. Keeping anything organized on a computer, be it configuration files or code, can be a challenge and anything that can help making things as easy as possible is always welcome.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home