I like Vim a lot, because it's lightweight and versatile. If you're used to Vim it is the fastest code editor there is. If you're not used to Vim, it'll probably cause you a migraine.
I started using Linux on and off since 1999 (yeah.. I'm old), so Vim is in my system and I probably developed some Vim DNA as well. I'm prejudiced.
Lately a lot of new text editors became available (Sublime, Atom, Brackets). I tried them and used them, but always get back to Vim.
The config
This is how my Vim looks like.
I have a minimal config with NERDTree for file browsing and text indenting.
This is how:
- Install Vim.
- Install Pathogen. Pathogen makes it easy to install plugins for Vim.
- Create a vimrc
- Install NERDTree
Install Vim
Vim is already is installed if you have a Mac. On Debian based Linux distro's it is a simple apt-get install vim. On Windows I guess you would need to install GVim but I'm not sure if everything works as expected.
Install Pathogen
Next install Pathogen. Check this. Basically you have to create 2 folders (~/.vim/autoload and ~/.vim/bundle) and then you need to install pathogen in ~/.vim/autoload. Like so:
mkdir -p ~/.vim/autoload ~/.vim/bundle && \ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
Then go ahead and create a ~/.vimrc file, for your configuration:
vim ~/.vimrc
Edit the .vimrc
This is my .vimrc:
set statusline=%<%F%h%m%r%h%w%y\ %{&ff}\ %{strftime(\"%c\",getftime(expand(\"%:p\")))}%=\ lin:%l\,%L\ col:%c%V\ pos:%o\$ set laststatus=2 set number set wrap set linebreak set expandtab set shiftwidth=2 set softtabstop=2 set clipboard=unnamedplus execute pathogen#infect() filetype plugin indent on syntax on mapmzgg=G`z function! StartUp() $ if 0 == argc() NERDTree end endfunction autocmd VimEnter * call StartUp()
The first line configures the status line. Until line .. is pretty self explanatory.
Line 10 enables pathogen
Line 11 enables line indenting
Line 13 maps the F7 key to indent the whole page
NERDTree
The last section configures NERDTree.
Install NERDTRee by downloading it in ~/.vim/bundle (the Pathogen way)
cd ~/.vim/bundle git clone https://github.com/scrooloose/nerdtree.git
In my .vimrc I start NERDTree automatically if I start Vim with a file. If I start Vim without arguments, NERDTree is not loaded. I can start NERDTree by executing :NERDTRee in Vim execution mode.
So, that was my Vim config. Until next time!
One thought on “This is my Vim config”