To be archives. :h ModeChanged
since 0.7.0
Hijack your clipboard, make you become the host of the clipboard!!!
Hclipboard will bypass the text into clipboard for change operator in visual/select mode.
Run :help v_c
or :help v_s
to get more information.
Expanding snippet will enter select mode automatically which will pollute your clipboard. The initial motivation of Hclipboard is to solve this issue.
hclipboard_demo.mp4
set clipboard=unnamedplus in Neovim and use xsel as my system clipboard
- Table of contents
- Features
- Quickstart
- Documentation
- Function
- Setup and description
- Advanced configuration
- Feedback
- License
- Hijacked your clipboard unconsciously
- Customize your clipboard
- Neovim 0.5 or later
Install nvim-hclipboard with Vim-plug:
Plug 'kevinhwang91/nvim-hclipboard'
Install nvim-hclipboard with Packer.nvim:
use {'kevinhwang91/nvim-hclipboard'}
" vimscript
lua require('hclipboard').start()
-- lua
require('hclipboard').start()
Functions are all inside hclipboard
module, get module by require('hclipboard')
-
start(): start to hijack clipboard provider
-
stop(): stop to hijack clipboard provider
{
should_bypass_cb = {
description = [[Callback function to decide whether to let text bypass the clipboard.
*WIP*
There's no guarantee that this function will not be changed in the future. If it is
changed, it will be listed in the CHANGES file.]],
default = nil
},
}
-- bypass text into clipboard for change and delete operator in visual/select mode.
require('hclipboard').setup({
-- Return true the text will be bypassed the clipboard
-- @param regname register name
-- @param ev vim.v.ev TextYankPost event
should_bypass_cb = function(regname, ev)
local ret = false
if ev.visual and (ev.operator == 'd' or ev.operator == 'c') then
if ev.regname == '' or ev.regname == regname then
ret = true
end
end
return ret
end
}).start()
default behavior bypass change operator but don't bypass delete operator
- If you get an issue or come up with an awesome idea, don't hesitate to open an issue in github.
- If you think this plugin is useful or cool, consider rewarding it a star.
The project is licensed under a BSD-3-clause license. See LICENSE file for details.