aboutsummaryrefslogtreecommitdiff
path: root/plugin/fall.vim
blob: a3eb2c588a690f28e0a0c4efeb27ed94cfacb9ae (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
" 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 <cmd>exec "normal! V" . fall#fall('k', '^\s*$')<cr>
onoremap <silent> <leader>j <cmd>exec "normal! V" . fall#fall('j', '^\s*$')<cr>

" Text object to fall though whitespace, but exclude the last line.
onoremap <silent> i<leader>k <cmd>exec "normal! V" . fall#fall('k', '^\s*$') . "j"<cr>
onoremap <silent> i<leader>j <cmd>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 <cmd>exec "normal! V" . fall#fall('k', '^\s*$') . "j"<cr>
onoremap <silent> i<leader>j <cmd>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 <cmd>exec "normal! V" 
      \ . fall#fall('j', '^\s*$') 
      \ . "O"
      \ . fall#fall('k', '^\s*$') <cr>
onoremap <silent> ii <cmd>exec "normal! V" 
      \ . fall#fall('j', '^\s*$') 
      \ . "kO"
      \ . fall#fall('k', '^\s*$') . 'j' <cr>

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

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

" Selects "vertical words"
vnoremap <expr> <silent> iv fall#visual_vertical_word("jk", '\k')
onoremap <silent> iv <cmd>exec "normal! V" . fall#visual_vertical_word("jk", '\k')<cr>

" Selects "vertical WORDS"
vnoremap <expr> <silent> iV fall#visual_vertical_word("jk", '\S')
onoremap <silent> iV <cmd>exec "normal! V" . fall#visual_vertical_word("jk", '\S')<cr>

vnoremap <expr> <silent> ic fall#visual_same_character("jk")
onoremap <silent> ic <cmd>exec "normal! V" . fall#visual_same_character("jk")<cr>

vnoremap <expr> <silent> ijc fall#visual_same_character("j")
onoremap <silent> ijc <cmd>exec "normal! V" . fall#visual_same_character("j")<cr>

vnoremap <expr> <silent> ikc fall#visual_same_character("k")
onoremap <silent> ikc <cmd>exec "normal! V" . fall#visual_same_character("k")<cr>