aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-09-09 18:37:40 +0000
committerJosh Rahm <rahm@google.com>2022-09-09 18:37:40 +0000
commit0b9d3d53b776d0f6128c64e8b73557b137d88e4c (patch)
tree19287f47b196e88ccb6cf4510384e2537198a270
parentdf72a999e63711f204f2d9a10b026847a5833302 (diff)
downloadfieldmarshal.vim-0b9d3d53b776d0f6128c64e8b73557b137d88e4c.tar.gz
fieldmarshal.vim-0b9d3d53b776d0f6128c64e8b73557b137d88e4c.tar.bz2
fieldmarshal.vim-0b9d3d53b776d0f6128c64e8b73557b137d88e4c.zip
move.vim: Add some extra object mappings
a% - selects (V)isual from the current line, finds the next { and jumps to the matching one (%). Good for deleting around bodies in C-like languages. i% - finds the next { enters (v)isual, jumpts to matching, and shrinks the selection by a character. (so it changes whatever is in the '{'). Good for changing the contents inside a C-style body.
-rw-r--r--plugin/move.vim5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugin/move.vim b/plugin/move.vim
new file mode 100644
index 0000000..0ed2e7f
--- /dev/null
+++ b/plugin/move.vim
@@ -0,0 +1,5 @@
+onoremap <silent> a% V<cmd>call search('{') <bar> normal! %<cr>
+onoremap <silent> i% <cmd>call search('{') <bar> normal! v%<bs>o<space><cr>
+
+vnoremap <silent> a% <esc>V/{<cr>%
+vnoremap <silent> i% <esc>/{<cr>v%<bs>o<space>o