ojroques / nvim-osc52

A Neovim plugin to copy text through SSH with OSC52
BSD 2-Clause "Simplified" License
356 stars 11 forks source link

disable printing status, return status, <leader>cc not working. #14

Closed matu3ba closed 1 year ago

matu3ba commented 1 year ago

This can be very annoying for a global or absent statusline, because it must be confirmed via enter. Can you let the user configure this?

Would be also nice to know how to get the return status of your functions from lua code. I'd like to use my statusline instead of popups.

For me at least vim.keymap.set('n', '<leader>cc', '<leader>c_', {remap = true}) does not work properly. What is the underlying lua function to be used for this? To me '<leader>c_' looks like there is something sneaky hiding below waiting to clash with other keybindings.

ojroques commented 1 year ago

Hello!

You can disable the success message like so:

require('osc52').setup {silent = true}

The _ is the line operator which is integrated in Vim / Neovim (but not documented AFAIK). dd and yy are synonyms of d_ and y_. So <leader>c_ will call <leader>c with the current line. Therefore in order for that mapping to work, you need to have the mapping for <leader>c as well:

vim.keymap.set('n', '<leader>c', require('osc52').copy_operator, {expr = true})
vim.keymap.set('n', '<leader>cc', '<leader>c_', {remap = true})
ojroques commented 1 year ago

Now all functions described in the readme return their exit code, true for success and false for error. The functions are:

require('osc52').copy(<text>)
require('osc52').copy_register(<register>)