Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vim London: Custom Motions

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for aryoung aryoung
January 29, 2013

Vim London: Custom Motions

An overview of motions and how to create custom motions.

Avatar for aryoung

aryoung

January 29, 2013
Tweet

More Decks by aryoung

Other Decks in Programming

Transcript

  1. Mappings " From: learnvimscriptthehardway.stevelosh.com/chapters/51.html function! s:NextSection(type, backwards) endfunction noremap <script>

    <buffer> <silent> ]] :call <SID>NextSection(1, 0)<cr> noremap <script> <buffer> <silent> [[ :call <SID>NextSection(1, 1)<cr> noremap <script> <buffer> <silent> ][ :call <SID>NextSection(2, 0)<cr> noremap <script> <buffer> <silent> [] :call <SID>NextSection(2, 1)<cr> Wednesday, 30 January 13
  2. Mappings function! s:NextSection(type, backwards) if a:type == 1 let pattern

    = ... elseif a:type == 2 let pattern = ... endif if a:backwards let dir = '?' else let dir = '/' endif execute 'silent normal! ' . dir . pattern . "\r" endfunction Wednesday, 30 January 13