Skip to content

Commit 2727237

Browse files
authored
Fixing: setting register 2 to a value
This makes it for me possible to set register 2 (respectively `"1` of the default register) to the right value. Best regards
1 parent 28854ab commit 2727237

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

plugin/yankring.vim

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,27 +1182,19 @@ endfunction
11821182
" Manages the Vim's numbered registers
11831183
function! s:YRSetNumberedReg()
11841184

1185-
let i = 0
1185+
let i = 1
11861186

11871187
while i <= 10
11881188
if i > s:yr_count
11891189
break
11901190
endif
11911191

1192-
call setreg( (i)
1193-
\ , s:YRGetValElemNbr((i),'v')
1194-
\ , s:YRGetValElemNbr((i),'t')
1192+
call setreg( (i-1)
1193+
\ , s:YRGetValElemNbr((i-1),'v')
1194+
\ , s:YRGetValElemNbr((i-1),'t')
11951195
\ )
11961196
let i += 1
11971197
endwhile
1198-
1199-
" There are a few actions that Vim automatically takes
1200-
" when modifying the numbered registers.
1201-
" Modifying register 1 - changes the named register.
1202-
" It is impossible to set register 2 to a value, since Vim will change it.
1203-
1204-
" This will at least preserve the default register
1205-
let @" = @0
12061198
endfunction
12071199

12081200

0 commit comments

Comments
 (0)