aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/insert.vim7
-rw-r--r--plugin/move.vim9
2 files changed, 12 insertions, 4 deletions
diff --git a/plugin/insert.vim b/plugin/insert.vim
index 3caca81..dea819a 100644
--- a/plugin/insert.vim
+++ b/plugin/insert.vim
@@ -57,6 +57,9 @@ if g:field_marshal_insert_include_bindings
"
noremap Zi <Plug>(insert-before-motion)
noremap Za <Plug>(append-after-motion)
+
+ vnoremap <expr> Zi "\<esc>'<" . (visualmode() == "V" ? "0" : "") . "i"
+ vnoremap <expr> Za "\<esc>'>" . (visualmode() == "V" ? "$" : "") . "a"
endif
noremap <Plug>(insert-after-comment) <cmd>call <sid>insert_comment_count(v:count1)<cr>1c<Plug><sid>(insert-comment-obj-nog)
@@ -171,8 +174,8 @@ function! s:insert_before_recorded() abort
" Something of a hack. If the motion starts with i or a, it is probably a
" text object.
"
- " I think there's probably a better way to handle this, butth
- if s:recorded =~ '^[ia]'
+ " I think there's probably a better way to handle this, but
+ if s:recorded =~ '^[ia]' || s:recorded =~ 'g[nN]' || s:recorded =~ '[_]'
" Without Rahm's patched Neovim, custom text objects will not work. This is
" because while the redo buffer is saved and restored when calling a user
" function, repeat_cmdline is not, and thus the g@ command clobbers the
diff --git a/plugin/move.vim b/plugin/move.vim
index 88680cd..aa89f40 100644
--- a/plugin/move.vim
+++ b/plugin/move.vim
@@ -50,9 +50,14 @@ function! s:inner_next(operator, ai, open, close) abort
if v:operator =~ "[cd]"
" Cheese a 0-width by inserting a space to then immediately delete for d and c operators.
exec "normal! i \<esc>v"
- else
- " Other operations, just reset the position to what it was before.
+ elseif v:operator =~ "[y]"
+ " Yank operation, don't do anything.
call setpos('.', opos)
+ else
+ let [a, l, c, b] = getpos(".")
+ call setpos("'<", [a, l, c, b])
+ call setpos("'>", [a, l, c-1, b])
+ normal! gv
endif
return
endif