Ads by Google

Friday, August 9, 2013

A small GNU Screen tip for Cygwin MinTTY

I use Cygwin a lot and use the default mintty terminal emulator for most of my scripting work.  While I used GNU Screen, I never used it much till the vertical split patch was merged into it and made available on Cygwin(found the default horizontal split a bit distracting).  Even then, I found the region traversal a chore, having remapped C-a to C-z and using C-z TAB to switch between regions.  Too many keystrokes and a bit awkward for a bad typist like me.

And so I was rooting around mintty settings and was reading the mintty tips page, when I found the following tip for Gnu Screen.
bindkey "^[[1;5I" next
bindkey "^[[1;6I" prev

Well, the above just replaces the session in the current region with the next one or the previous on using Ctrl+Tab and Ctrl+Shift+Tab key combinations.  Which sort of doesn't do screen a bit of justice.  My way of using screen was

Split the mintty screen estate(maximised) into 4 regions as a 2x2 grid, each grid cell starting off a bash shell; this is what I have on my .screenrc

screen -ln -t "home" 1
split -v
focus right
screen -t "bash2" 2 bash
split
focus down
screen -t "bash4" 4 bash
focus left
split
focus down
screen -t "bash3" 3 bash
focus up
Change keybindings above to
bindkey "^[[1;5I" focus next
bindkey "^[[1;6I" focus prev

and now what you have is the ability to use Ctrl and Tab keys chord combination to quickly switch between regions instead of sessions listed in the tips page.  Over the last few days, this settings alone has lead me to use Screen more in my shell work.

Anyone has anything for cut and paste and buffer copy/paste to external applications? Especially with mouse use?

No comments: