Skip to content

Commit

Permalink
vimrc(nvim): remove oscyank in neovim, set osc 52 clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyinzuo committed Apr 3, 2024
1 parent 17e7078 commit 621290d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
23 changes: 23 additions & 0 deletions root/.config/nvim/clipboard_config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
if vim.fn.has('wsl') == 1 then
vim.g.clipboard = {
name = 'WslClipboard',
copy = { ['+'] = 'clip.exe', ['*'] = 'clip.exe', },
paste = {
['+'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
['*'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
},
['cache_enabled'] = 0,
}
else
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
end
1 change: 0 additions & 1 deletion root/.config/nvim/lua/plugins/vimplug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ local M = {
end,
ft = { "markdown" },
},
{ 'ojroques/vim-oscyank', branch = 'main' },
{ 'whonore/Coqtail', ft = 'coq' },
{
dir = "~/.vim/pack/my_plugins/start/project",
Expand Down
4 changes: 1 addition & 3 deletions root/.vim/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ if has('autocmd') " vim-tiny does not have autocmd
" autopair with nvim may has bug
" https://github.com/neovim/neovim/issues/23666
let g:AutoPairsMapCR = 0
if has('wsl')
let g:clipboard = { 'name': 'WslClipboard', 'copy': { '+': 'clip.exe', '*': 'clip.exe', }, 'paste': { '+': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', '*': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', }, 'cache_enabled': 0, }
endif
runtime clipboard_config.lua
endif
if filereadable(expand('~/.vim/config.vim'))
source ~/.vim/config.vim
Expand Down
12 changes: 6 additions & 6 deletions root/.vim/vimrc.d/plugin.vim
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ if !exists('g:vscode')
if v:version >= 802
" neovim 内置了 inccommand, 无需该插件
Plug 'markonm/traces.vim'
" Alternative? https://github.com/jasonccox/vim-wayland-clipboard
" See:
" https://github.com/vim/vim/pull/9639
" https://github.com/vim/vim/releases/tag/v9.1.0064
Plug 'ojroques/vim-oscyank', {'branch': 'main'}

if v:version >= 900
" Alternative: https://github.com/gelguy/wilder.nvim
Plug 'girishji/autosuggest.vim'
Expand Down Expand Up @@ -206,12 +212,6 @@ if !exists('g:vscode')
if has('nvim') || v:version >= 802
Plug 'skywind3000/vim-quickui'
Plug 'pechorin/any-jump.vim'
" Alternative? https://github.com/jasonccox/vim-wayland-clipboard
" See:
" https://github.com/vim/vim/pull/9639
" https://github.com/vim/vim/releases/tag/v9.1.0064
Plug 'ojroques/vim-oscyank', {'branch': 'main'}
" vnoremap <leader>c :OSCYank<CR>

Plug 'voldikss/vim-floaterm'
Plug 'voldikss/LeaderF-floaterm'
Expand Down

0 comments on commit 621290d

Please sign in to comment.