DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:vimkeys

Vim Key Bindings

To use the power of Vim with DokuWiki I'll get you started with a few simple key mapping sequences. To use these, save them to a text file, then use :source dokukeys.vim from within Vim to install them.

vmap <c-b> "zdi**<c-r>z**
imap <c-b> **  **<esc>2hi
vmap <c-i> "zdi//<c-r>z//
imap <c-i> //  //<esc>2hi
vmap <c-u> "zdi__<c-r>z__
imap <c-u> __  __<esc>2hi
vmap <c-t> "zdi''<c-r>z''
imap <c-t> ''  ''<esc>2hi
vmap <c-s> "zdi<c-v><del><c-r>z</del>
imap <c-s> <c-v><del></del><esc>5hi
vmap <c-l> "zdi[[<c-r>z]]
imap <c-l> [[]]<esc>2ha
vmap <a-1> "zdi======= <c-r>z =======
imap <a-1> =======  =======<esc>7hi
vmap <a-2> "zdi====== <c-r>z ======
imap <a-2> ======  ======<esc>6hi
vmap <a-3> "zdi===== <c-r>z =====
imap <a-3> =====  =====<esc>5hi
vmap <a-4> "zdi==== <c-r>z ====
imap <a-4> ====  ====<esc>4hi
vmap <a-5> "zdi=== <c-r>z ===
imap <a-5> ===  ===<esc>3hi
vmap <a-6> "zdi== <c-r>z ==
imap <a-6> ==  ==<esc>3hi
nmap <F2> :s/.*/  * &/
imap <F2> <space><space>*<space>
nmap <F3> :s/.*/  - &/
imap <F3> <space><space>-<space>

I Dave Earls (wassupdave.com) authored these. Feel free to add or improve.

I use the following key bindings to increase / decrease headings. That way, one can easily restructure a page:
" Increase heading by one level
imap == <Home>=<End>= <BS>
" Decrease heading by one level
imap =- <Home><Del><End><BS>
konstantin baierer 2007-05-20 02:19
vmap <leader>w[ maxi[[]]<esc>hP'a|"   |"wrap selected in double square bracket for dokuwiki.'

Chee Yong_2015-08-08_020956

tips/vimkeys.txt · Last modified: 2015-08-07 20:11 by 2400:d803:2a3c:69b0:75da:eca9:b09c:188

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki