kevin's website


This page contains a bunch of vim related stuff.

Here is an article I wrote about my mistake when first learning vim: Don't get bad typing habits

cool vim things i like to use.

plugins i use

I currently use vim-plug to manage plugins but I do want to give the native vim8 plugin manager a try. Plugins:

Themes: - vim dim uses ansi color codes so that vim uses your terminal colors.

useful stuff in my vimrc

Below is some of the stuff that took me some time to figure out. I have left out the simpler stuff like displaying whitespace, setting up clipboard and mouse, and my autocmds and macros.

remove trailing whitespaces on save

autocmd BufWritePre *.py :%s/\s\+$//e


nicer shortcuts to switch between splits

" swithing panes
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l

save markdown files on insert leave

You can use this for any file type but i only want it to happen for markdown.

autocmd InsertLeave *.md silent! execute ":w"

spellchecking for text documents

You can navigate to the next, ]s and previous [s spelling mistake in normal mode and then bring up a list of corrections with z= when your cursor is over the word. I also remove the highlighting and opted to make the errors bold and underlined to be slightly less obnoxious

autocmd filetype markdown,tex,latex,groff set spell
hi clear SpellBad
hi SpellBad cterm=underline,bold

my own vim statusline

I didn't want to use a plugin for my status line but wanted a few more things added.

set laststatus=2
set statusline=
set statusline+=%#PmenuSel#
set statusline+=%#LineNr#
set statusline+=\ %f
set statusline+=%m
set statusline+=%=
set statusline+=%#LineNr#
set statusline+=\ %y
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\[%{&fileformat}\]
set statusline+=\ %p%%
set statusline+=\ %l:%c

type emojis and unicode characters with digraphs

Using <Ctr>+k in insert mode will allow you to insert unicode characters using two character shorthand. You can see all the digraphs by entering :digraphs or :help digraph-table in normal mode

Some installs of vim contain some emojis by default but my vim install did not have emojis so I added the following to my .vimrc.

note: when you search online for emoji codes the codes are given in hexadecimal (base 16) and vim wants them in decimal (base 10). You can use an online tool to convert hex to dec.

dig <3 129293 " 🤍
dig :) 128578 " 🙂
dig :( 128577 " 🙁
dig ;) 128521 " 😉
dig :P 128523 " 😋
dig xD 128514 " 😂
dig B) 128526 " 😎
dig :/ 128528 " 😐
dig (: 128579 " 🙃
dig 3) 128522 " 😊
dig 3( 128532 " 😔
dig :L 128530 " 😒
dig ;P 128540 " 😜
dig >: 128545 " 😡
dig :; 128546 " đŸ˜ĸ
dig :< 128548 " 😤
dig :I 128556 " đŸ˜Ŧ
dig := 128557 " 😭
dig :o 128558 " 😮
dig :O 128561 " 😱
dig 8/ 128563 " đŸ˜ŗ
dig z: 128564 " 😴
dig xo 128565 " đŸ˜ĩ
dig </ 128580 " 🙄
dig hn 128588 " 🙌
dig tx 128591 " 🙏
dig ok 128076 " 👌
dig mm 129292 " 🤌

note: you could also use abbreviations with ab if you want vim to always replace that text in insert mode and don't want to enter a new mode.


  1. What is a koan?↩ī¸Ž