Turn vim into an IDE with spf13-vim

1 minute read

I’ve been using vim for a very long time, my vimrc file is based on Amix’s with minor modifications, I think it’s time to move forward embracing excellent projects like spf13-vim and VundleVim which make vim easy to use.

Installation

curl https://j.mp/spf13-vim3 -L > spf13-vim.sh && sh spf13-vim.sh

72 plugins will be installed during the installation, and spf13-vim project was cloned to $HOME/.spf13-vim-3, it takes a lot of time in case of poor internet connection.

Local version can be updated with:

cd $HOME/.spf13-vim-3
git pull
vim +BundleInstall! +BundleClean +q

Customization

spf13-vim comes with a default vimrc file, customization was also supported by adding your stuff to ~/.vimrc.local:

"Quik close and save
map <leader>q :q<cr>
map <leader>a :qa<cr>
map <leader>x :x<cr>
map <leader>w :w<cr>

map <leader>tn :tabnew
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
map <leader>to :tabonly<cr>
map <leader>tf :tabfirst<cr>

# disable scrolloff, whichwrap etc
set whichwrap=
set scrolloff=0
set scrolljump=0

Change default behavior according to your taste, add to ~/.vimrc.before.local

# Do not switch to the current file directory
let g:spf13_no_autochdir = 1
set shiftwidth=8                " Use indents of 8 spaces
set noexpandtab                 " Tabs are tabs, not spaces

Modification on default .vimrc is not recommended.

Add/Remove plugins

Adding new bundles or remove existing bundles follow the same steps, add a line to ~/.vimrc.bundles.local including keyword Bundle/UnBundle and the bundle name, then followed by a update command vim +BundleInstall! +BundleClean +q.

Projects from vim.org and github are both supported.

# add new bundle
echo Bundle \'spf13/vim-colors\' >> ~/.vimrc.bundles.local

# remove bundle
echo UnBundle \'PIV\' >> ~/.vimrc.bundles.local

Alternatives

Although spf13-vim’s development has been ceased for years, it is still my favorite, there are many other options such as SpaceVim and Oni, you can switch to them as you wish.