Compare commits
1 Commits
6a469d374a
...
c5474821e3
Author | SHA1 | Date | |
---|---|---|---|
c5474821e3 |
@ -1,12 +1,19 @@
|
|||||||
" Use the OSC 52 escape sequence to copy text to the local system clipboard
|
" Use the OSC 52 escape sequence to copy text to the local system clipboard
|
||||||
" when connected to a remote machine.
|
" when connected to a remote machine.
|
||||||
|
|
||||||
" Add an autocmd to run after text is yanked.
|
function! osc52#init()
|
||||||
function! osc52#autocmd()
|
|
||||||
augroup osc52
|
augroup osc52
|
||||||
autocmd!
|
autocmd!
|
||||||
|
" Add an autocmd to run after text is yanked.
|
||||||
autocmd TextYankPost * call osc52#copy()
|
autocmd TextYankPost * call osc52#copy()
|
||||||
augroup END
|
augroup END
|
||||||
|
" When connected to a remote session the + selection register is not
|
||||||
|
" available and the unnamed register is used instead. Add normal and visual
|
||||||
|
" mode mappings using the z register instead.
|
||||||
|
nnoremap <leader>y "zy
|
||||||
|
nnoremap <leader>Y "zY
|
||||||
|
vnoremap <leader>y "zy
|
||||||
|
vnoremap <leader>Y "zY
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! osc52#copy()
|
function! osc52#copy()
|
||||||
|
@ -95,14 +95,8 @@ nnoremap <leader>tm :tabmove<Space>
|
|||||||
" Clear search highlights
|
" Clear search highlights
|
||||||
nnoremap <leader><Space> :nohlsearch<CR>
|
nnoremap <leader><Space> :nohlsearch<CR>
|
||||||
|
|
||||||
if tmux#isOption('set-clipboard', 'on') || $SSH_CONNECTION !=# ''
|
if exists('loaded_oscyank')
|
||||||
" When connected to a remote session the + selection register is not
|
noremap <leader>y :Oscyank<CR>
|
||||||
" available and the unnamed register is used instead. Add mappings using the
|
|
||||||
" z register instead.
|
|
||||||
noremap <leader>y "zy
|
|
||||||
noremap <leader>Y "zY
|
|
||||||
" Enable OSC 52 copy on yank.
|
|
||||||
call osc52#autocmd()
|
|
||||||
else
|
else
|
||||||
" System clipboard yank/put
|
" System clipboard yank/put
|
||||||
noremap <leader>y "+y
|
noremap <leader>y "+y
|
||||||
|
4
vimrc
4
vimrc
@ -183,3 +183,7 @@ Pack 'mustache/vim-mustache-handlebars'
|
|||||||
Pack 'joshglendenning/vim-caddyfile'
|
Pack 'joshglendenning/vim-caddyfile'
|
||||||
Pack 'kbenzie/vim-khr'
|
Pack 'kbenzie/vim-khr'
|
||||||
Pack 'jrozner/vim-antlr'
|
Pack 'jrozner/vim-antlr'
|
||||||
|
|
||||||
|
if tmux#isOption('set-clipboard', 'on')
|
||||||
|
call osc52#init()
|
||||||
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user