Skip to content

Commit

Permalink
preserve unnamed register: try #2
Browse files Browse the repository at this point in the history
  • Loading branch information
bounceme authored and christoomey committed May 9, 2017
1 parent bd430ad commit 5cb28e3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugin/system_copy.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let s:linux = 'linux'

function! s:system_copy(type, ...) abort
let mode = <SID>resolve_mode(a:type, a:0)
let unnamed = @@
if mode == s:linewise
let lines = { 'start': line("'["), 'end': line("']") }
silent exe lines.start . "," . lines.end . "y"
Expand All @@ -24,6 +25,7 @@ function! s:system_copy(type, ...) abort
let command = s:CopyCommandForCurrentOS()
silent call system(command, getreg('@'))
echohl String | echon 'Copied to clipboard using: ' . command | echohl None
let @@ = unnamed
endfunction

function! s:system_paste() abort
Expand Down

0 comments on commit 5cb28e3

Please sign in to comment.