diff options
| author | Miguel <m.i@gmx.at> | 2018-05-29 20:27:28 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-05-29 20:27:28 +0200 |
| commit | 68b54b0d1729cd036fcba1c85f85ad4af6e9e3dc (patch) | |
| tree | 3d0f4e5eb1b147ae9ba193065d9c7b09f8e72f16 /vim/vim-potion/ftplugin/potion/sections.vim | |
added vim stuff
Diffstat (limited to 'vim/vim-potion/ftplugin/potion/sections.vim')
| -rw-r--r-- | vim/vim-potion/ftplugin/potion/sections.vim | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vim/vim-potion/ftplugin/potion/sections.vim b/vim/vim-potion/ftplugin/potion/sections.vim new file mode 100644 index 0000000..200415c --- /dev/null +++ b/vim/vim-potion/ftplugin/potion/sections.vim @@ -0,0 +1,47 @@ +function! s:NextSection(type, backwards, visual) + + if a:visual + normal! gv + endif + + if a:type == 1 + let pattern = '\v(\n\n^\S|%^)' + let flags = 'e' + elseif a:type == 2 + let pattern = '\v^\S.*\=.*:$' + let flags = '' + endif + + if a:backwards + let dir = '?' + else + let dir = '/' + endif + + execute 'silent normal! ' . dir . pattern . dir . flags . "\r" + +endfunction + +noremap <script> <buffer> <silent> ]] + \ :call <SID>NextSection(1, 0, 0)<cr> + +noremap <script> <buffer> <silent> [[ + \ :call <SID>NextSection(1, 1, 0)<cr> + +noremap <script> <buffer> <silent> ][ + \ :call <SID>NextSection(2, 0, 0)<cr> + +noremap <script> <buffer> <silent> [] + \ :call <SID>NextSection(2, 1, 0)<cr> + +vnoremap <script> <buffer> <silent> ]] + \ :<c-u>call <SID>NextSection(1, 0, 1)<cr> + +vnoremap <script> <buffer> <silent> [[ + \ :<c-u>call <SID>NextSection(1, 1, 1)<cr> + +vnoremap <script> <buffer> <silent> ][ + \ :<c-u>call <SID>NextSection(2, 0, 1)<cr> + +vnoremap <script> <buffer> <silent> [] + \ :<c-u>call <SID>NextSection(2, 1, 1)<cr> |
