Sep 24

Inspired by this article and the subsequent discussion on reddit, I thought of writing a vim script version of the elisp code.

 1 " To discipline me against using arrow keys in vim
 2 if exists("Abuses_loaded")
 3     finish
 4 endif
 5 let Abuses_loaded = 1
 6 
 7 let s:count = 0
 8 let s:insults = ["YOU SUCK!","OBEY ME, INSECT!","OBEY ME, SUBSERVIENT BIOMASS!"]
 9 call add(s:insults,"ENGAGE IN COPROPHILIA AND THEN EXPIRE!")
10 call add(s:insults,"YOU ARE NOT WORTHY OF VIM!")
11 
12 function <SID>punish_me()
13     let s:count = (s:count + 1) % len(s:insults)
14     echohl WarningMsg | echo s:insults[s:count] | echohl None
15 endfunction
16 
17 nmap <right> :call <SID>punish_me()<CR>
18 nmap <left>  :call <SID>punish_me()<CR>
19 nmap <up>    :call <SID>punish_me()<CR>
20 nmap <down>  :call <SID>punish_me()<CR>

Save this as a .vim file somewhere and source if from your .vimrc file

:so ~/.vim/abuses.vim

Caveat: This is my first vim script.