saulpw / visidata

A terminal spreadsheet multitool for discovering and arranging data
http://visidata.org
GNU General Public License v3.0
7.89k stars 280 forks source link

Mapping Ctrl-Semicolon and similar? #2477

Closed slinkeepie closed 1 month ago

slinkeepie commented 3 months ago

Hi there,

Was very glad to find another high quality terminal app such as this, and am spending effort customizing hotkeys before I dive in a bit more... however I've hit the same roadblock i did while customizing vim, and that is certain control key mappings.

How can I access Ctrl-Semicolon in visidata for remapping? I've tried both "^;" and "^:" but to no avail.

I use urxvt and managed to solve the issue in vim via remappings in the .Xresources file, any idea how I could use urxvt to get it working in visidata? I'm no expert in the technicalities of terminals so only managed to get it done in vim with painstaking googling and trial/error.

Any help appreciated, with any luck it's something simple that I'm doing wrong/not doing!

Note: using visidata 3.0.2

David

midichef commented 3 months ago

Interesting question. As a result I have learned that in a standard terminal, Ctrl+; is identical to ;. So from the point of view of visidata, an app which takes input from the terminal, there is no such thing as a Ctrl+; keypress.

Your terminal emulator, urxvt, is running in a GUI, so it can detect the keypresses Ctrl+;, but it can't pass that along to the terminal, as a terminal can only detect ;. The solution discussed in the link to Stack Exchange is: configure urxvt to react to Ctrl+; by sending a custom key sequence. Then configure vim to handle that custom key sequence.

It sounds like you may have already gotten that working with vim? If so, the next step would be to get visidata to handle the same key sequence. However, it may take some work to find key sequences that are unused in both vim and visidata.

slinkeepie commented 2 months ago

Hey Saul,

Seems the answer was right in front of me but I was over-complicating it in my head... your reply made it all clear though, I really appreciate it!

What do you think of the attempts to standardize a more modern approach to terminal input handling, such as: http://www.leonerd.org.uk/hacks/fixterms/ ? Is it hard to implement? I'm happy with the hack workaround, but I am genuinely curious. I love urxvt for many reasons, but the keysym redirecting is definitely one of them!

Thank you once again... once I customize and make sense of the hotkeys I plan to try your Hanukkah of data for a challenge!

David

midichef commented 2 months ago

Hi @slinkeepie, just FYI, the reply about terminal was left by me, midichef, a contributor to the wonderful visidata project, and not Saul.

I'm not expert enough on terminals to have an opinion of LeoNerd's proposals. But I'm happy to learn of such work.

slinkeepie commented 2 months ago

Hey midichef, sorry for the assumption! Greatly appreciate your help AND contributions! David

saulpw commented 1 month ago

Hi @slinkeepie, glad you're enjoying VisiData! We use curses, which is old-school, and augmenting curses with newer terminal features is not that feasible. Perhaps someday we'll port VisiData to another platform, whether terminal or something else.

Thanks for the link!