aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/insert.vim37
1 files changed, 24 insertions, 13 deletions
diff --git a/plugin/insert.vim b/plugin/insert.vim
index 722c0b5..0029827 100644
--- a/plugin/insert.vim
+++ b/plugin/insert.vim
@@ -63,13 +63,31 @@ if g:field_marshal_insert_include_bindings
noremap Z[ <Plug>(to-object-start)
noremap Z] <Plug>(to-object-end)
+ noremap Zn <Plug>(to-object-pos-post)
+
+ " Zx commands, run x on the last recorded action. The equivalelent of xZr
+ noremap <expr> Zd "d" . <sid>getrecorded()
+ noremap <expr> Zc "c" . <sid>getrecorded()
+ noremap <expr> Zg~ "g~" . <sid>getrecorded()
+ noremap <expr> Zv "v" . <sid>getrecorded()
+
+ " The last recorded object.
+ onoremap <expr> Zr <sid>getrecorded()
+
" Zgi -- start another insert using the same parameters from the last Z[ia]
noremap Zgi c<Plug>(insert-about-obj)
vnoremap <expr> Zi "\<esc>'<" . (visualmode() == "V" ? "0" : "") . "i"
vnoremap <expr> Za "\<esc>'>" . (visualmode() == "V" ? "$" : "") . "a"
+
+ vnoremap <expr> Z[ "\<esc>'<" . (visualmode() == "V" ? "0" : "") . "i"
+ vnoremap <expr> Z] "\<esc>'<" . (visualmode() == "V" ? "0" : "") . "i"
+
+ vnoremap <expr> Zo "\<esc>'>o"
+ vnoremap <expr> ZO "\<esc>'<O"
endif
+
noremap <Plug>(insert-after-comment) <cmd>call <sid>insert_comment_count(v:count1)<cr>1c<Plug><sid>(insert-comment-obj-nog)
noremap <Plug>(insert-after-comment-g)> <cmd>call <sid>insert_comment_count(v:count1)<cr>1c<Plug><sid>(insert-comment-obj-g)
@@ -188,19 +206,12 @@ let s:instype = ''
" Not many people use the 'z' register, right?
let s:reg_to_clobber = 'z'
-" if exists('&urf')
-" " Neovim has Rahm's multibyte register extension patch. Pick an arbitrary
-" " unicode character which is probably not used very often to clobber.
-" let s:reg_to_clobber = '∫'
-" endif
-
function! s:start_recording()
exec "normal! q" . s:reg_to_clobber
endfunction
let s:operate_keys=''
function! s:prepare_operation(instype, operate_keys)
- echom "operate_keys: " . a:operate_keys
" Unfortunately macros kinda break this feature. While I think I might be able
" to patch together a fix to make them work, I figure that I'll see if there's
" any real need to implement it.
@@ -214,8 +225,6 @@ function! s:prepare_operation(instype, operate_keys)
let s:operate_keys = a:operate_keys
endfunction
-noremap <plug>(ñóþ) <nop>
-
" Save the motion postions, for use with g@.
function s:save_object(t) abort
let s:object = {
@@ -231,7 +240,6 @@ function! s:to_object_start() abort
let pos = s:instype == '[' ? s:object.start : s:object.end
- echom printf("Jump To [%s] (%s) (%s)", string(pos), s:recorded, v:operator)
call setpos('.', pos)
endfunction
@@ -290,10 +298,10 @@ function! s:recordop(...) abort
normal! q
" Save the recorded amount
let s:recorded=getreg(s:reg_to_clobber)
- " A limitation of normal! is that it can't start with a space, so use a NOP
- " instead.
+ " A limitation of normal! is that it can't start with a space, so prefix with
+ " a 1 to get around this
if s:recorded =~ '^\s'
- let s:recorded = "\<plug>(ñóþ)" . s:recorded
+ let s:recorded = "1" . s:recorded
endif
" Restore the register
call setreg(s:reg_to_clobber, s:savereg[0], s:savereg[1])
@@ -304,3 +312,6 @@ function! s:recordop(...) abort
call feedkeys(s:operate_keys)
endfunction
+function! s:getrecorded()
+ return s:recorded
+endfunction