Organizing Your .vimrc
Most .vimrc files that I’ve seen are quite long and unwieldy, often extending to upwards of 300 lines of code. The .vimrc becomes a mess of code as it is built up over the years, just a few lines at a time. Many people try to resolve this issue by breaking the .vimrc down into sections, often with the help of comments or fold markers. This makes it much easier to read, but it isn’t a perfect solution. I still find myself having to scroll around the .vimrc to find the line of I want to change or to find a place I can insert a new line of vimscript.
There’s a much better solution for organizing the .vimrc, thanks to the ability to source other vimscripts from within a vimscript. I’ve broken up my own .vimrc file into 8 smaller files, and I include them into my main .vimrc file by using the source function. Here’s what it looks like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Now each of my files are much smaller and easier to manage! It’s also quite
simple to navigate to each of these files. I’ve set up
If you’re interested, check out my vimfiles on github here: https://github.com/thenovices/dotfiles