Gian Saß

My Vim Setup

· Gian Sass

If someone uses vim, they’ll probably tell you sooner or later.

Vim is simple, light-weight, and still extendable with thousands of plugins to choose from. After writing about this in 2014 I have continuously used vim for daily purposes. Now I have one year of vimming experience but I still feel like a noob.

vim_learning
By TheJach

To learn vim is to keep learning vim. You probably never end learning it, and you probably never master it completely. There’s always some hidden, mysterious feature you didn’t try out yet.

A look at my .vimrc

My .vimrc resides here. Whenever I’m using vim on my PC, I’m using a GUI version of vim, such as MacVim.

Screenshot 2016-01-14 19.25.02
Code from a kernel heap memory allocation function I wrote.

The programming font I fell in love with is Inconsolata. Before that I used Droid Sans Mono. What is your favourite programming font my dear reader?

I don’t use hjkl, call me crazy but I navigate around with w, b, e, W, f and t. Basically w, b, e and W let you navigate around words, while f and t let you navigate exactly to a character you type in. This saves you time, as I don’t like navigating around with arrow-like keys.

To put the useless hjkl to use I map them window commands, since I extensively use split windows.

noremap h <NOP>
noremap j <NOP>
noremap k <NOP>
noremap l <NOP>

nmap <silent> h :wincmd h<CR>
nmap <silent> j :wincmd j<CR>
nmap <silent> k :wincmd k<CR>
nmap <silent> l :wincmd l<CR>

CTRL-S is two keys, while :w(+ Enter) is three. I’d much rather use the former. Saves you one key and keeps the habit.

nnoremap <C-S> :w<CR>

What else I liked doing was pressing F5 to run my code. Here’s one rule that, for example, launches your current python script if it’s one.

autocmd BufNewFile,BufRead *.py map <F5> :!python %:p<CR>

I HATE beeping, this disables them both for GUI and CLI version.

set noerrorbells visualbell t_vb=
if has('autocmd')
  autocmd GUIEnter * set visualbell t_vb=
endif

I’m a lazy guy and don’t like changing routine. That’s why my .vimrc is not so long. But don’t kick the habit of trying out new stuff.

Awesome Plugins

Powerline

Powerline is what makes you feel like a ninja-hacker. It’s a very advanced status line which shows you git information and whatever you may put in it.

Screenshot 2016-01-16 10.48.42

Installation

You first need pip and git (silly names).

sudo apt-get install python-pip git

Now you can let pip install Powerline by running the following.

pip install --user git+git://github.com/powerline/powerline

Additionally, you should install patched fonts for Powerline.

auto-pairs

Simple plugin to automatically insert brackets, parentheses, quotes in pair.

NERDTree

File browser right inside vim.

Then, I use plugins that help me write Ruby on Rails more efficiently.