Recently been looking for solutions to do things like highlight a whole word in putty because there is no desktop in most of my instances, and I am spoiled by nice visual terminals.
Anyway, I thought it was nice to have at least solved delete whole word left and right and jump whole word left and right so I added those.
To enable this, I used a combination o AHK and ~/.inputrc --
Step 1:
In Windows, create an ahk file in your ahk scripts directory (putty.ahk for example)--it may be a good idea to name them carefully!
;;;;;c:\scripts\ahk\putty\puttyinputrc.ahk
#singleinstance force
#IfWinActive ahk_class PuTTY ; Only when PuTTY is focused...,
;;;;... do these things:
$^Backspace:: ; When Ctrl+Backspace is pressed--works...,
Send, {U+00A6} ; ...send the Unicode character for é to PuTTY.
sleep 50 ; then wait (I had double-characters due to not having a return; you can remove this line).
return ; wait.
$^del:: ; When Ctrl+Del hotkey is pressed--works--...,
Send, {U+00A7} ; ... send the Unicode character for §.
sleep 50
return
$^+left:: ; Ctrl+Left hotkey--breaks in terminal--...,
Send, {U+00BB} ; ...send the Unicode character for ஹ.
sleep 50
return
$^+right:: ; Ctrl+right hotkey--breaks in terminal--..,
Send, {U+00BB9} ; ... send the Unicode character for ».
sleep 50
return
#IfWinActive ;;;;Removes if-win-active focus on Notepad++.
;;;;;For testing: test special characters
#If WinActive("ahk_class Notepad++") ; Only activate when the Notepad++ window with the specified ahk_id is active
^+e:: ; Ctrl+= hotkey--tests a hotkey
Send, {U+00E9} ; Send the Unicode character for é
Return
#if ;;;;Removes if-win-active focus on Notepad++.
Next, use sudo nano ~/.inputrc to open the file for modifications. Paste the following....
# /home/casualspooner/.inputrc .... this is a comment.
# Word jumps (Ctrl + Left/Right)--works.
"\eOC": forward-word
"\eOD": backward-word
#this is a problem. If uncommented, the next two lines are supposed to highlight whole words--I tried mapping the character code from showkey -a (exit using ctrl+d), but that also did not work.... These are the characters for the sake of interest: »ஹ. They are early unicode characters so the OS should recognize them!
#"\e\e[C": set-mark; forward-word; exchange-point
#"\e\e[D": set-mark; backward-word; exchange-point
Delete word right (Ctrl + Delete)--works...
"§": kill-word # Mapped to Carriage Return (Enter) - might not be ideal
Delete word left (Ctrl + Backspace)--works...
"¦": backward-kill-word
Impurtent! Use bind -f ~/.inputrc to apply to current session: will not work until you do that.
What the script does:
Basically, if you run the first script in Windows via AHK and modify your .inputrc in PuTTY, you can do whole-word delete an whole-word jump in terminal, but whole-word highlight does not work.
My question:
Has anyone had success with whole-word highlight? Would love a solution for that or a reason why it does not work. I think it may be impossible due to my not having a visual environment, and that would make sense because I would not have a mouse, and I believe the mouse is necessary for highlighting words.