Compare commits
1 Commits
c5474821e3
...
6a469d374a
Author | SHA1 | Date | |
---|---|---|---|
6a469d374a |
@ -1,19 +1,12 @@
|
||||
" Use the OSC 52 escape sequence to copy text to the local system clipboard
|
||||
" when connected to a remote machine.
|
||||
|
||||
function! osc52#init()
|
||||
" Add an autocmd to run after text is yanked.
|
||||
function! osc52#autocmd()
|
||||
augroup osc52
|
||||
autocmd!
|
||||
" Add an autocmd to run after text is yanked.
|
||||
autocmd TextYankPost * call osc52#copy()
|
||||
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
|
||||
|
||||
function! osc52#copy()
|
||||
|
@ -95,8 +95,14 @@ nnoremap <leader>tm :tabmove<Space>
|
||||
" Clear search highlights
|
||||
nnoremap <leader><Space> :nohlsearch<CR>
|
||||
|
||||
if exists('loaded_oscyank')
|
||||
noremap <leader>y :Oscyank<CR>
|
||||
if tmux#isOption('set-clipboard', 'on') || $SSH_CONNECTION !=# ''
|
||||
" When connected to a remote session the + selection register is not
|
||||
" 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
|
||||
" System clipboard yank/put
|
||||
noremap <leader>y "+y
|
||||
|
Loading…
x
Reference in New Issue
Block a user