I've been putting off learning GNU screen for years now, despite the
rave reviews I've seen. I've come across yet another article[1] about
GNU screen, and it has gotten me interested in trying it again.
The thing that always stops me in my tracks, though, is choosing a
command key. By default, screen uses control-A as the command key. I
have long-standing muscle memory of using control-A at the Bash prompt
to move to the start of line, and I think it would drive me crazy to
keep invoking screen by mistake.
If any of you guys use GNU screen, have you remapped the command key?
If so, what key have you found convenient? I expect I'll have to give
up some Vim keystroke to use as the screen command key, but I thought
I'd see if anyone has a good recommendation.
Thanks,
Michael Henry
[1]: http://www.ibm.com/developerworks/aix/library/au-gnu_screen/
I'd say use whatever seems appropriate to you, and change it as soon as
you notice a problem. One person's "best choice" can be "far from best"
to the next guy.
I'm conscious that this isn't much of an answer -- but in many cases,
the best solution can be found by trial and error.
Best regards,
Tony.
--
"The sooner all the animals are dead, the sooner we'll find their
money."
-- Ed Bluestone, "The National Lampoon"
> The thing that always stops me in my tracks, though, is choosing a
> command key. By default, screen uses control-A as the command key. I
> have long-standing muscle memory of using control-A at the Bash prompt
> to move to the start of line, and I think it would drive me crazy to
> keep invoking screen by mistake.
With "Ctrl-a a" you can send a single Ctrl-a to the terminal.
> If any of you guys use GNU screen, have you remapped the command key?
My text terminal is always XTerm+Screen so I use Screen a lot. I haven't
remapped the command key because I think "Ctrl+a a" is OK for running
beginning-of-line. But I would probably use:
escape ^zz
in my ~/.screenrc. In Vim and many text terminal applications Ctrl-z is
suspend key. I think it's not a big loss if you now use Ctrl-z for
Screen command and "Ctrl-z z" for suspend.
Same here.
> If any of you guys use GNU screen, have you remapped the command key?
> If so, what key have you found convenient? I expect I'll have to give
> up some Vim keystroke to use as the screen command key, but I thought
> I'd see if anyone has a good recommendation.
I use ctrl-space. I've been told that the mapping is take in
emacs ;-) Note that you can always access these via the second
escape key.
It took me some time to find out how to set Ctrl-space in
screenrc, so in case you want to follow my bad example:
escape ^@a
c
--
Vim plugin to paste current GNU Screen buffer in (almost) any mode:
<http://www.vim.org/scripts/script.php?script_id=1512>
On the contrary vim works very well with screen. ctrl-a is used by vim
to increment a character by I don't need it, so that while using vim
it can freely switch to other screens. For the bash shell I use the
vi key binding. Type "esc 0" will move to the beginning just the same
as vim. In fact programs (including bash) that use readline should
use vi key binding by customizing the ~/.inputrc
# set editing mode to vi-like key binding
set editing-mode vi
set keymap vi
set convert-meta on
I used to puzzle why edit command key for bash is so hard to memorise,
it turned out that the default key binding for bash is emacs.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩113 杜甫 旅夜書懷
細草微風岸 危檣獨夜舟 星垂平野闊 月湧大江流
名豈文章著 官應老病休 飄飄何所似 天地一沙鷗
Same here - default CTRL-A is therefore just fine in my opinion.
> In fact programs (including bash) that use readline should use
> vi key binding by customizing the ~/.inputrc
>
># set editing mode to vi-like key binding
>set editing-mode vi
>set keymap vi
>set convert-meta on
Hmm. I also use bash with VI-like keybindings, but I configure it
differently, in ~/.bashrc:
set -o vi
Just for my education - can you tell some examples of the
programs (besides bash) which using readline library and allows
you to use VI-like keybindings with the above settings in
~/.inputrc ?
--
Anton
Me too. `man readline` talks about key binding or both emacs and vi
mode and inputrc. And yet one program that I use seems to ignore
~/.inputrc . I bug the developer but null response. I guess it is up
the program to use that ~/.inputrc that why I added the word "should"
in my first message.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩215 李商隱 無題
相見時難別亦難 東風無力百花殘 春蠶到死絲方盡 蠟炬成灰淚始乾
曉鏡但愁雲鬢改 夜吟應覺月光寒 蓬萊此去無多路 青鳥殷勤為探看
Your message has inspired me to small investigation. Result: you
can use readline and VI-like keybindings with any kind of CLI
apps, even with those which are not linked with readline - for
example with oracle's sqlplus:
The trick described here [1] and uses 'rlwrap', readline wrapper
program.
~/.inputrc:
# settings pointed by bill lam on vim_use
set editing-mode vi
set keymap vi
set convert-meta on
~/.bashrc:
# ...
alias sqlplus='rlwrap sqlplus'
# ...
This works really. One strange thing though: ct<char>, cf<char>
commands aren't work as in bash, but remaining is ok so far. With
<C-R> you can start to incrementally search the last entered sql
statements. Very useful addition to dbext plugin, for all vim'ers
who uses oracle.
--
Anton
[1] how to edit command-line in sqlplus and rman (unix case)
http://www.oracledba.ru/notes_sqlplus_readline_en.html
will this have trouble when you need to input non-ascii characters?
I use the following setting:
set input-meta on
set output-meta on
set convert-meta off
set keymap vi
set editing-mode vi
Yes, you are correct, but convert-meta is default on if I didn't miss
read the man.
Ctrl-_ is bound to undo in readline's default configuration.
I found that Ctrl-o is not bound by readline in the default
configuration, so that is what I use.
However, that keystroke is very handy in Vim, where in normal mode it
jumps the cursor to a prevoius position, or in insert mode puts you
temporarily into normal mode. I can still access this function
indside of Screen by typing Ctrl-o o, but it is really trying on my
muscle-memory to switch between using Vim both in and out of Screen.
So, you could say that I'm in the market for a new command key.
Alas, a perusal of `man readline` reveals that there are precious few
unused key combinations.
--
Erik Falor
Registered Linux User #445632 http://counter.li.org
I use Ctrl-Q for switching. It clashes with terminal flow control (Ctrl-Q
and Ctrl-S), but I disable that anyway whereever I use screen. It has the
advantage of being just an alias for Ctrl-V in both readline and vim.
Besides, in some terminal apps (e.g. rtorrent), ctrl-Q is the quit
mapping and having to escape it through screen prevents me from
accidently quitting on a regular basis.
The only time I use Ctrl-Q in vim is when I want to close the last
window with ^W^Q. Again, I think the need to escape it is a feature.
Finally, it can be used painlessly used with one hand, even better than
Ctrl-A in my opinion.
- kba
I like to use iPython for interactive work with Python code and modules.
It uses readline and being able to use vi keybindings adds even more
power to the tool for me.
-Markus-
2009/3/7 Anton Sharonov <anton.s...@gmail.com>:
> ...