Skip to content

Is there a way to replace clipboard contents instead of adding to it? #2397

Answered by alex-courtis
Tudmotu asked this question in Q&A
Discussion options

You must be logged in to vote

The clipboard is additive, without an option to replace.

You can clear the clipboard :help nvim-tree-api.fs.clear_clipboard()

Create a function:

local function clear_and_copy()
  api.fs.clear_clipboard()
  api.fs.copy.node()
end

Map it in your on_attach:

vim.keymap.set('n', 'c',     clear_and_copy,                      opts('Clear And Copy'))

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@alex-courtis
Comment options

@Tudmotu
Comment options

@alex-courtis
Comment options

@Tudmotu
Comment options

@alex-courtis
Comment options

Answer selected by Tudmotu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants