aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-29 23:35:42 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-29 23:35:42 +1300
commitcd86574069dfa34fc5843c6bb1dbe425710f85de (patch)
tree97332bc1d09c7cb2a96f13b587f3e2419d9c837d
parentMerge branch 'hotfix/v1.0.1' (diff)
parentBump VERSION (diff)
downloadvim-replace-operator-cd86574069dfa34fc5843c6bb1dbe425710f85de.tar.gz
vim-replace-operator-cd86574069dfa34fc5843c6bb1dbe425710f85de.zip
Merge branch 'hotfix/v1.0.2' into develop
* hotfix/v1.0.2: Correct active register passing
-rw-r--r--VERSION2
-rw-r--r--autoload/replace_operator.vim8
-rw-r--r--plugin/replace_operator.vim4
3 files changed, 6 insertions, 8 deletions
diff --git a/VERSION b/VERSION
index 7dea76e..6d7de6e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.1
+1.0.2
diff --git a/autoload/replace_operator.vim b/autoload/replace_operator.vim
index ff442b6..6b8ce96 100644
--- a/autoload/replace_operator.vim
+++ b/autoload/replace_operator.vim
@@ -1,9 +1,6 @@
" Replace the operated text with the contents of a register
function! replace_operator#Operatorfunc(type) abort
- " Save the active register into a local variable
- let l:register = v:register
-
" Save the current value of the unnamed register and the current value of
" the 'clipboard' and 'selection' options into a dictionary for restoring
" after this is all done
@@ -33,8 +30,8 @@ function! replace_operator#Operatorfunc(type) abort
" a register prefix if it's not the default unnamed register, because Vim
" before 7.4 gets ""p wrong in visual mode
let l:paste = 'p'
- if l:register !=# '"'
- let l:paste = '"'.l:register.l:paste
+ if s:register !=# '"'
+ let l:paste = '"'.s:register.l:paste
endif
silent execute 'normal! '.l:select.l:paste
@@ -48,6 +45,7 @@ endfunction
" Helper function for normal mode map
function! replace_operator#Map(register) abort
+ let s:register = a:register
set operatorfunc=replace_operator#Operatorfunc
return 'g@'
endfunction
diff --git a/plugin/replace_operator.vim b/plugin/replace_operator.vim
index 982b573..a8cf835 100644
--- a/plugin/replace_operator.vim
+++ b/plugin/replace_operator.vim
@@ -15,6 +15,6 @@ let g:loaded_replace_operator = 1
" Set up mapping
nnoremap <expr> <Plug>(ReplaceOperator)
- \ replace_operator#Map()
+ \ replace_operator#Map(v:register)
xnoremap <expr> <Plug>(ReplaceOperator)
- \ replace_operator#Map()
+ \ replace_operator#Map(v:register)