Vim のカーソルをバッファ末尾まで移動したら先頭に戻る
いわゆる 'whichwrap' のような挙動をバッファの先頭/末尾で行うスクリプトを書いてみた。
[ソース]
function! Up(key) if line(".") == 1 return ":call cursor(line('$'), col('.'))\<CR>" else return a:key endif endfunction function! Down(key) if line(".") == line("$") return ":call cursor(1, col('.'))\<CR>" else return a:key endif endfunction nnoremap <expr><silent> k Up("gk") nnoremap <expr><silent> j Down("gj")
'whichwrap' があるのだし、Vim のオプションにあってもよさそうな気はする。
(と、いうかすでにあったりするのかな。