aboutsummaryrefslogtreecommitdiff
path: root/plugin/fall.vim
blob: 3fba6d5c92178878accbf462657200e0a1e44d26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
" Fall through whitespace.
noremap <expr> <silent> <leader>k fall#fall('k', '^\s*$')
noremap <expr> <silent> <leader>j fall#fall('j', '^\s*$')

" Text object to fall through whitepacea
onoremap <silent> <leader>k :<c-u>exec "normal! V" . fall#fall('k', '^\s*$')<cr>
onoremap <silent> <leader>j :<c-u>exec "normal! V" . fall#fall('j', '^\s*$')<cr>

" Text object to fall though whitespace, but exclude the last line.
onoremap <silent> i<leader>k :<c-u>exec "normal! V" . fall#fall('k', '^\s*$') . "j"<cr>
onoremap <silent> i<leader>j :<c-u>exec "normal! V" . fall#fall('j', '^\s*$') . "k"<cr>

" Text object to fall though whitespace, but exclude the last line.
onoremap <silent> i<leader>k :<c-u>exec "normal! V" . fall#fall('k', '^\s*$') . "j"<cr>
onoremap <silent> i<leader>j :<c-u>exec "normal! V" . fall#fall('j', '^\s*$') . "k"<cr>

" Text objects to describe "falling" down, and then "falling" up. Equivalent to
" V<leader>kO<leader>j
onoremap <silent> ai :<c-u>exec "normal! V" 
      \ . fall#fall('j', '^\s*$') 
      \ . "O"
      \ . fall#fall('k', '^\s*$') <cr>
onoremap <silent> ii :<c-u>exec "normal! V" 
      \ . fall#fall('j', '^\s*$') 
      \ . "kO"
      \ . fall#fall('k', '^\s*$') . 'j' <cr>