Following is my "system" using a combination of vimrc files and maps.
What I did was create a basic .vimrc file in my home directory and map the function keys (except F1) to source each of the custom vimrc files. Here is my example ~/.vimrc.
The custom vimrc files were placed in the ~/.vim_custom directory. Currently those files consist of vimrc files for editing shell scripts, php scripts, C/C++ programming, and sgml source files.
Here is my example ~/.vim_custom/bash-vimrc.
Here is my example ~/.vim_custom/php-vimrc.
Here is my example ~/.vim_custom/c-vimrc.
Here is my example ~/.vim_custom/sgml-vimrc.
If you're going to copy and paste these into files please beware of the CTRL-D character. That character has to be typed into your file with this key combination: CTRL-V and then CTRL-D. It will display in the file like this: ^D. A quick way to convert all these is to do this:
Everything in that command is typed as printed on this document except CTRL-V CTRL-D which is typed as explained above. |
Each vimrc file calls a function which unmaps the function keys except for the F2 function key which is always mapped to re-source the base ~/.vimrc file. It then maps the function keys and any other custom maps specific to its purpose.
I chose to do it this way for several reasons. The first reason was modularity. If I find someone else's vimrc file which includes some neat functions or mappings it's easy to incorporate them into my existing "system" without messing with what's already there. Second, I don't use the function keys for anything else so it seemed the logical thing to do. Third, it seemed to follow a sort of "menu" approach to doing things.
If you have an approach to doing this which you like and would like to include it in this document please send in your vimrc/functions/mappings to newbiedoc-discuss@lists.sourceforge.net so we can add it to this document.