Thu 24 May 2012

Byobu and mc

Posted by ankur in Tech (241 words, approximately a 1 minute read)

midnight commander on byobu

I'm a big fan of byobu. Even though folks have moved over to using tmux as the backend, I still use gnu screen. It works for me. Now, another tool that I'm a huge fan of is midnight commander, or as it's referred to "mc". Using the default keybindings that byobu sets up makes mc a little difficult to use. The /usr/share/byobu/keybindings/f-keys.screen file will tell you why:

bindkey "^[[1;2A" focus up                              # shift-up | focus up
bindkey "^[[1;2B" focus down                            # shift-up | focus down
bindkey "^[[1;2D" focus up                              # shift-left | focus up
bindkey "^[[1;2C" focus down                            # shift-right | focus down

These lines capture the shift + arrow keys. In mc, shift + up/down is used to select multiple files in the panels. Understandibly, this is an anoyance. I had a tough time when I wanted to select multiple files to copy/move in mc. I've been looking for a fix. The fix is to disable the byobu key bindings. This may be overkill, so you can just unbind the shift+arrow keys. I've disabled them, to use the default screen bindings. Now, here's where a bug crept in. "Escape" + ! is supposed to be the "toggle f-keys" command. However, ctrl + a (escape) + ! for me only prints out the following on the terminal:

":source /usr/share/byobu/keybindings/f-keys.screen.disable" (with the starting ":")

I found a bug already mentioning the issue. I've filed a new one as requested in the last comment. There is a workaround which works well! I can now use mc properly with byobu!