aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/fall.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugin/fall.vim b/plugin/fall.vim
new file mode 100644
index 0000000..3fba6d5
--- /dev/null
+++ b/plugin/fall.vim
@@ -0,0 +1,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>