aboutsummaryrefslogtreecommitdiff
path: root/plugin/fall.vim
blob: 05d4e6eb300e714c96ee3abdb8e2242916221a6d (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
27
28
29
30
31
32
33
34
35
36
" 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>

vnoremap <silent> ai :<c-u>exec "normal! gv" 
      \ . fall#fall('j', '^\s*$') 
      \ . "O"
      \ . fall#fall('k', '^\s*$') <cr>

vnoremap <silent> ii :<c-u>exec "normal! gv" 
      \ . fall#fall('j', '^\s*$') 
      \ . "kO"
      \ . fall#fall('k', '^\s*$') . 'j' <cr>