aboutsummaryrefslogtreecommitdiff
path: root/plugin/insert.vim
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/insert.vim')
-rw-r--r--plugin/insert.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugin/insert.vim b/plugin/insert.vim
index c6de7a2..3d27f78 100644
--- a/plugin/insert.vim
+++ b/plugin/insert.vim
@@ -17,6 +17,20 @@ noremap cgI <cmd>call <sid>insert_comment_count(v:count1)<cr>1c<Plug><sid>(inser
onoremap <Plug><sid>(insert-comment-obj-nog) <cmd>call <sid>insert_comment_obj(0)<cr>
onoremap <Plug><sid>(insert-comment-obj-g) <cmd>call <sid>insert_comment_obj(1)<cr>
+onoremap <plug>(insert-here-obj) <cmd>normal! "i <esc>v"
+
+let s:motions = ['b', 'w', 'ib', 'ab']
+
+for m in s:motions
+ exec "onoremap <Plug>(mot-before-" . m . ") <cmd>call g:BeforeMot(\"" . m . "\")<cr>"
+ exec "noremap dI" . m . " c<Plug>(mot-before-" . m . ")"
+endfor
+
+function! g:BeforeMot(mot) abort
+ exec "normal! " . a:mot
+ exec "normal! \<esc>i \<esc>v"
+endfunction
+
function! s:insert_comment_count(count) abort
let s:count = a:count
endfunction