?

Log in

GDB: Readline vi Mode

« previous entry | next entry »
Oct. 13th, 2006 | 09:19 am
mood: enthralled

[From my blog where I post more often: GDB: Readline vi Mode]

Only the ardent most of vi lovers will appreciate this...

I was debugging my program that was SIGSEGV'ing. After a couple of runs, my left-right and up-down arrow keys stopped working in gdb! Annoyed I switched the termnial to have a second look at the code, when I returned to GDB terminal... lo and behold... in my instinctive way used vi's 'k' and 'j' keys! BINGO! I just found out that there indeed is a vi mode in gdb too! And I bet not many know that, and hence this post.

If you don't care reading any further, you can enable vim editing mode by pressing: Ctrl-Alt-j Now pressing Esc will enter you in command mode.

For the more persistent readers...
Being an ardent lover of vim, the only TRUE programmer's editor (Emacs is a nice OS, but it lacks a good editor, that's why I use vim), I do all my work in vi: be it coding, writing mail, compose documents, blog, etc. etc. Anything that you can think of which requires writing more than few sentences, I do it in vim. In any other editor, I feel handicaped! So much so, that I even use vi mode on my BASH shell! That way I can really type and manipulate anything with eye-flashing speed. (Tip: This can really impress people [...cough ...cough...] at times ;-) )

$ set -o vi
This will put your command editing in vi mode. Press ESC and you get all of vi cursor movement and most of text editing commands. So when I found this under gdb, I was just flabbergasted! It's called 'vim readline mode' in gdb. Damn! Why I didn't think of this earlier, the world's MOST versatile debugger ought to have such features!

Now I won't have to move my hands off in brain-dead fashion at snail slow speed to and from the arrow keys! One of the best things about vim is if, like me, you are a touch typist and prefer typing really fast (for you don't want to miss anything that's on your mind), you won't want to move your hands off their position on keyboard often. And this is _exactly_ where Emacs fails, miserably! A tech-tip post after a long long time.

Links
1 VIM Tip-1 http://the-shaolin.blogspot.com/2004/12/my-own-2-cent-vim-tip.html
2 VIM Tip-2 http://the-shaolin.blogspot.com/2005/03/vim-tip.html
3 Gdb Readline vi Mode http://sunsite.ualberta.ca/Documentation/Gnu/gdb-5.0/html_node/gdb_237.html
Tags: , ,

Link | Leave a comment | Share

Comments {0}