aserowy / tmux.nvim

tmux integration for nvim features pane movement and resizing from within nvim.
MIT License
639 stars 40 forks source link

" keymap intersects normal workflow #100

Closed howarddo2208 closed 1 year ago

howarddo2208 commented 1 year ago

I wanted to yank and paste from the system clipboard to neovim with "+y and "+p, it works fine until I enter tmux. So I dug in and found this key bind from the plugin intersects it. https://github.com/aserowy/tmux.nvim/blob/57220071739c723c3a318e9d529d3e5045f503b8/lua/tmux/copy.lua#L95 Can you change this or let me customize the key bindings? For now, I will use vim.api.nvim_del_keymap('n', '"') as a workaround.

aserowy commented 1 year ago

Heho,

normally this uses tmux 'registers' as middleware. Thus, system copies should end up in tmux and nvim uses tmux which includes your systems clipboard.

Can you paste your systems clipboard into tmux at all?

Regards Alexander

howarddo2208 commented 1 year ago

Yeah, I can paste from the system clipboard to tmux with cmd+v on my Mac, but can't copy from tmux neovim to the system clipboard and I still rely on "+y that I bind to <leader>y in my config

howarddo2208 commented 1 year ago

I just realized that what the " and + registers don't synchronize with the system clipboard. So deleting the keymap still doesn't work for me. Edit: delete " keymap + sync_clipboard = false solve it for me on macOS tho.

aserowy commented 1 year ago

cmd+v will not use tmux buffers. maybe your integration of system clipboard in tmux is not working as well.

you can try to copy into system clipboard and let tmux show his buffers to control if the copied stuff gets shown in tmux. if not, the plugin is working as expected :)

howarddo2208 commented 1 year ago

Yes, the system clipboard content is not in tmux buffer

from your comment before

normally this uses tmux 'registers' as middleware. Thus, system copies should end up in tmux and nvim uses tmux which includes your systems clipboard.

I don't think it is the default behavior of tmux, system copies don't show up in tmux buffer at all.

Back to the main point, I can use sync_clipboard = false to make nvim handle system clipboard yank and paste now, but the " keymap prevents normal behavior. I suggest changing it, or give option for users to change it.

I'm on nvim 0.9 and tmux 3.3a

https://github.com/aserowy/tmux.nvim/assets/62332195/c35c6130-88db-4467-a482-97d4733d571c

aserowy commented 1 year ago

If you do not intend to use tmux clipboard, disable it completly. Then, no bindings get set.

copysync = { -- enables copy sync. by default, all registers are synchronized. -- to control which registers are synced, see the `sync*` options. enable = false,

howarddo2208 commented 1 year ago

I do use the tmux clipboard for syncing clipboard between tmux panes, just not the system clipboard.

aserowy commented 1 year ago

I guess the request is out of scope of this plugin. You should get system clipboard sync under tmux working. Thus, you can facilitate the plugin to work the intended way. We should not add further setup customizations to enable a not fully functional setup i guess.

Im closing this issue. If you need help to get system -> tmux working, feel free to chat here. A good start into this topic would be e.g. https://www.freecodecamp.org/news/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b/