Pages

Tuesday, June 22, 2010

Make ubuntu's screen play nice with nano shortcuts

I use nano a lot either for programming or editing configuration files on linux. At work we use both ubuntu servers for vmguests and vmhosts.

The main reason I use nano is because they have a preconfigured shortcut-key on your keyboard to save your current document: F3.

You will not catch me hitting esc,colon,w; escape to non-insert mode; :w to write from edits on memory to file in vim. Nor will I do whatever they do in emacs.

I'd rather gain mastery of the language, than mastery of an editor, with my limited time.

Since I have to do stuff simultaneously, I use screen a lot to switch between shells and tasks.

Anyways, in ubuntu the maintainers accidentally hijacked the F3  shortcut with a conflicting shortcut F3 in screen; So, what happened is this, I edit a file with nano, I attempt to save, it but find myself in another screen. You could imagine why that would piss me off. Context-switching craziness.


What you do next to fix the unintentional context-switching is to attack screen. Namely, the configuration files.


In ubuntu they put this in your home dir.

You want to find change your keybindings file.


find ~/ -name "keybindings"


When you crack the file open you'll find something like this:


source /usr/share/screen-profiles/keybindings/common


All I needed to do was to copy that common file up there to /home/user/.screen-profiles/user-common-keys and adapt keybindings to reflect the change.

All I wanted was to regain the ability to save my files with F3 function key. So I smote away this line from the file:


bindkey -k k3 prev ...


and change the keybindings file.


source /home/user/.screen-profiles/user-common-keys


Then they lived happily ever after.

No comments:

Post a Comment

Please help to keep this blog clean. Don't litter with spam.