feat(nvim): add CopyToSystemClipboardWithLine

This commit is contained in:
Rob Watson 2024-06-16 16:47:37 +02:00
parent fc4a7ff3b2
commit d3f864429b
1 changed files with 11 additions and 3 deletions

14
nvimrc
View File

@ -209,11 +209,19 @@ endfunction
nmap <leader>fy :call CopyToDefaultRegister()<cr> nmap <leader>fy :call CopyToDefaultRegister()<cr>
" and into + register: " and into + register:
function! CopyToSystemClipboard() function! CopyToSystemClipboard()
let @* = expand("%:p") let result = expand("%:p")
let @+ = expand("%:p") let @* = result
echom expand("%:p") let @+ = result
echom "Copied to clipboard: " . result
endfunction
function! CopyToSystemClipboardWithLine()
let result = expand("%:p") . ":" . line(".")
let @* = result
let @+ = result
echom "Copied to clipboard: " . result
endfunction endfunction
nmap <leader>fY :call CopyToSystemClipboard()<cr> nmap <leader>fY :call CopyToSystemClipboard()<cr>
nmap <leader>fL :call CopyToSystemClipboardWithLine()<cr>
" disable Ex mode " disable Ex mode
nnoremap Q <Nop> nnoremap Q <Nop>