ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.82k stars 450 forks source link

<C-V> in NvimTree can't work #1234

Closed Penguin-SAMA closed 2 months ago

Penguin-SAMA commented 2 months ago

Version confirmation

Following prerequisites

Not a user config issue

Neovim version

NVIM v0.9.5

Operating system/version

WSL Ubuntu 24.04

Terminal name/version

Windows Terminal

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

How to reproduce the issue

in NvimTree, when i use <C-v> image

but <C-X> is work image

I think there may be a conflict with the system's paste shortcut keys? But can I make it work properly without modifying the shortcut keys?

Expected behavior

can work ### Actual behavior _No response_ ### Additional information _No response_
CharlesChiuGit commented 2 months ago

why would u want to paste in a file tree?

i dont think it's doable to paste in nvimtree buffer, i think this is normal.

Penguin-SAMA commented 2 months ago

no, i want to use <C-V> to open a file in split buffer, because I found out that this is the default operation of nvimtree

image

CharlesChiuGit commented 2 months ago

ahh got it, but i dont think it's a bug. everyone use their computer differently.

I think there may be a conflict with the system's paste shortcut keys?

ys, i think it is.

But can I make it work properly without modifying the shortcut keys?

no, u have to modify it if u want to use it.

Penguin-SAMA commented 2 months ago

But I think the shortcut for "paste" should be <C-v> on most machines these days. If this is a mechanism and not a bug, then this default shortcut should be unusable for most people? Or is this just a phenomenon unique to Windows Terminal?

CharlesChiuGit commented 2 months ago

it's not the case on macos and linux.

u need to consider 3 levels of keymaps: system level, terminal level, other nvim keymaps so this is really hard to balance between between OSs.

u can suggest a better keymap u think is suitable or make a pr.

Jint-lzxy commented 2 months ago

I think the main issue here boils down to the fact that the terminal holds all the cards when it comes to what gets sent to the TUI app. It's the "gatekeeper", catching all your keystrokes and deciding what to do with them - whether to handle them itself or pass them along to the TUI app. AFAIK most terminals do let you tweak which keys they handle internally and which ones they pass on. Checking out Windows Terminal's docs might shed some light on this.

But I think the shortcut for "paste" should be <C-v> on most machines these days. If this is a mechanism and not a bug, then this default shortcut should be unusable for most people Or is this just a phenomenon unique to Windows Terminal?

I gotta admit this one is kinda user-dependent. There are still tons of platforms or emulators that either don't use <C-v> for pasting or won't mess with (or hijack) your input. Frankly the best advice we can offer is to get to know your terminal better if you really want <C-v> to work in NvimTree, just like what @CharlesChiuGit suggested.

Penguin-SAMA commented 2 months ago

Oh I see, on MacOS the shortcut for pasting is <Command-V> instead of <control-V>.

That is indeed the influence of Windows Terminal.

I think <C-V> is a good keymap so it doesn't need to be changed, so I removed the <Ctrl+V> action in windows Terminal.

thanks for your help, and it's bad to use Windows :(