fix clipboard
This commit is contained in:
@ -1,6 +1,3 @@
|
||||
local fn = vim.fn
|
||||
local use_google = require("utils").use_google
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
|
@ -106,12 +106,6 @@ return {
|
||||
require("libp").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"ojroques/nvim-osc52",
|
||||
config = function()
|
||||
require("config.oscyank")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"squk/java-syntax.vim",
|
||||
lazy = false,
|
||||
|
22
vim/.vim/lua/plugins/oscyank.lua
Normal file
22
vim/.vim/lua/plugins/oscyank.lua
Normal file
@ -0,0 +1,22 @@
|
||||
return {
|
||||
"ojroques/nvim-osc52",
|
||||
config = function()
|
||||
local function copy(lines, _)
|
||||
require("osc52").copy(table.concat(lines, "\n"))
|
||||
end
|
||||
|
||||
local function paste()
|
||||
return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") }
|
||||
end
|
||||
|
||||
vim.g.clipboard = {
|
||||
name = "osc52",
|
||||
copy = { ["+"] = copy, ["*"] = copy },
|
||||
paste = { ["+"] = paste, ["*"] = paste },
|
||||
}
|
||||
|
||||
-- Now the '+' register will copy to system clipboard using OSC52
|
||||
-- vim.keymap.set("n", "<leader>c", '"+y')
|
||||
-- vim.keymap.set("n", "<leader>cc", '"+yy')
|
||||
end,
|
||||
}
|
@ -30,6 +30,7 @@ map <leader>H :wincmd H<cr>
|
||||
map <leader>K :wincmd K<cr>
|
||||
map <leader>L :wincmd L<cr>
|
||||
map <leader>J :wincmd J<cr>
|
||||
map <leader>T :wincmd T<cr>
|
||||
map <leader>x :wincmd x<cr>
|
||||
|
||||
" resize vertical split to 1/3 or 2/3 size
|
||||
@ -54,25 +55,3 @@ vnoremap <leader>p "_dP
|
||||
nnoremap <leader>rp :VimuxOpenRunner<cr> :VimuxRunCommand '!!'<cr> :call VimuxSendKeys("Enter")<cr>
|
||||
|
||||
nnoremap <leader>s :SessionSave<CR>
|
||||
|
||||
" copy to attached terminal using the yank(1) script:
|
||||
" https://github.com/sunaku/home/blob/master/bin/yank
|
||||
function! Yank(text) abort
|
||||
let escape = system('yank', a:text)
|
||||
if v:shell_error
|
||||
echoerr escape
|
||||
else
|
||||
call writefile([escape], '/dev/tty', 'b')
|
||||
endif
|
||||
endfunction
|
||||
noremap <silent> <Leader>y y:<C-U>call Yank(@0)<CR>
|
||||
|
||||
" automatically run yank(1) whenever yanking in Vim
|
||||
" (this snippet was contributed by Larry Sanderson)
|
||||
function! CopyYank() abort
|
||||
call Yank(join(v:event.regcontents, "\n"))
|
||||
endfunction
|
||||
|
||||
" autocmd TextYankPost * call CopyYank()
|
||||
noremap <leader>y :call CopyYank()
|
||||
vnoremap <leader>y :call CopyYank()
|
||||
|
12
vim/.vimrc
12
vim/.vimrc
@ -60,18 +60,6 @@ set splitbelow " Puts new split windows to the bottom of the current
|
||||
set scrolljump=5 " Line to scroll when cursor leaves screen
|
||||
set scrolloff=3 " Minumum lines to keep above and below cursor
|
||||
|
||||
" let g:clipboard = #{
|
||||
" \ name: 'xsel',
|
||||
" \ copy: {
|
||||
" \ '+': ['xclip', '--nodetach', '-i', '-b'],
|
||||
" \ '*': ['xclip', '--nodetach', '-i', '-p'],
|
||||
" \ },
|
||||
" \ paste: {
|
||||
" \ '+': ['xclip', '-o', '-b'],
|
||||
" \ '*': ['xclip', '-o', '-p'],
|
||||
" \ },
|
||||
" \ cache_enabled: 1,
|
||||
" \ }
|
||||
set shortmess=A " disable swap
|
||||
set shortmess+=O
|
||||
set modifiable
|
||||
|
Reference in New Issue
Block a user