OSC52 clipboard yanks

This commit is contained in:
Christian Nieves
2023-02-13 12:31:47 -06:00
parent 189570685b
commit 84aa6e8933
7 changed files with 117 additions and 47 deletions

View File

@ -9,7 +9,7 @@ lsp_status.register_progress()
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "sumneko_lua", "rust_analyzer" }
ensure_installed = { "lua_ls", "rust_analyzer" }
})
local lspconfig = require("lspconfig")
@ -102,34 +102,6 @@ local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
lspconfig.sumneko_lua.setup({
capabilities = capabilities,
on_attach = on_attach,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
})
local lspkind = require("lspkind")
lspkind.init()
local cmp = require("cmp")

View File

@ -0,0 +1,3 @@
local map = require("utils").map
map("n", "<Leader>y", ":OSCYank<CR>", opts)
map("v", "<Leader>y", ":OSCYank<CR>", opts)

View File

@ -222,6 +222,10 @@ require('packer').startup(function(use)
'tmux-plugins/vim-tmux-focus-events',
'skywind3000/asyncrun.vim',
}
use {
'ojroques/vim-oscyank',
config = [[ require("config.oscyank") ]]
}
-- mine
use {

View File

@ -29,8 +29,8 @@ vmap <leader>v c<ESC>"+p<ESC>
imap <leader>v <ESC>"+pa
" Copy to OS clipboard
vnoremap <leader>y "yy <Bar> :call system('xclip', @y)<CR>
map <leader>y "yy <Bar> :call system('xclip', @y)<CR>
" vnoremap <leader>y "yy <Bar> :call system('xclip', @y)<CR>
" map <leader>y "yy <Bar> :call system('xclip', @y)<CR>
" --------- WINDOW/PANE MAPPINGS ---------
map <leader>wr <C-W>r
@ -123,3 +123,25 @@ function! <SID>SynStack()
endfunc
nnoremap <leader>s :SaveSession<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()

View File

@ -60,18 +60,18 @@ 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,
\ }
" 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
set shortmess+=O
set modifiable