diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-29 23:35:25 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-29 23:35:25 +1300 |
commit | e6327bb5d4a0310e236d2b233affef4cfb18d5be (patch) | |
tree | 97332bc1d09c7cb2a96f13b587f3e2419d9c837d | |
parent | Merge branch 'hotfix/v1.0.1' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-replace-operator-e6327bb5d4a0310e236d2b233affef4cfb18d5be.tar.gz vim-replace-operator-e6327bb5d4a0310e236d2b233affef4cfb18d5be.zip |
Merge branch 'hotfix/v1.0.2'v1.0.2
* hotfix/v1.0.2:
Correct active register passing
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/replace_operator.vim | 8 | ||||
-rw-r--r-- | plugin/replace_operator.vim | 4 |
3 files changed, 6 insertions, 8 deletions
@@ -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) |