aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorChris Toomey2014-06-06 12:46:49 -0400
committerChris Toomey2014-06-06 12:53:54 -0400
commit815bdef7c0bb6eab62c48d34b85b4082f0566a5d (patch)
tree245c7be128e7baad1b03583e9c2307e7eaae909a /plugin
parentb72b05e853322297f6ecda523fef55c5d3899595 (diff)
downloadvim-system-copy-815bdef7c0bb6eab62c48d34b85b4082f0566a5d.tar.bz2
Expand on readme usage and install
Diffstat (limited to 'plugin')
-rw-r--r--plugin/system_copy.vim9
1 files changed, 3 insertions, 6 deletions
diff --git a/plugin/system_copy.vim b/plugin/system_copy.vim
index 11beee6..71a67f1 100644
--- a/plugin/system_copy.vim
+++ b/plugin/system_copy.vim
@@ -11,17 +11,14 @@ let g:loaded_system_copy = 1
function! s:system_copy(type, ...) abort
let mode = <SID>resolve_mode(a:type, a:0)
if mode == s:linewise
- let first = line("'[")
- let last = line("']")
- let to_copy = join(getline(first, last), ' ')
+ let lines = { 'start': line("'["), 'end': line("']") }
+ silent exe lines.start . "," . lines.end . "y"
elseif mode == s:visual || mode == s:blockwise
silent exe "normal! `<" . a:type . "`>y"
- let to_copy = getreg('@')
else
silent exe "normal! `[v`]y"
- let to_copy = getreg('@')
endif
- silent call system('pbcopy', to_copy)
+ silent call system('pbcopy', getreg('@'))
echohl String | echon 'Copied to system clipboard via: ' . mode | echohl None
endfunction