razputnik: (Default)
[personal profile] razputnik2010-11-01 01:43 pm
Entry tags:

Bash vi mode

I noticed a few people making posts about editing their shell history with vi - so I thought I'd contribute this little trick that someone may or may not have mentioned already:

If you add "set -o vi" to the end of your .bashrc, it changes your command line editing mode to vi keybindings, meaning you can use hjkl to navigate through your history and edit lines using vi oldies but goldies like cw and c$. It's a bit of a pain to get used to at first, but it's good if you're the type who keeps typing cw when you want to change an argument and then get annoyed when it just inserts that as text.

:wq
jadelennox: Demonic Tutor, Jadelennox: my Magic card (demonic tutor)
[personal profile] jadelennox2010-03-22 08:30 pm
Entry tags:

The daily vim blog

I consider myself a vi power user, but after all these years there is still a ton I have to learn. Introducing the blog The Daily Vim, syndicated at [syndicated profile] dailyvim_feed. It's not even remotely daily (which is good -- it means I have time to learn its various tricks between posts) but it is handy for all kinds of editing and command line tricks. For example Easier command line editing teaches us this bash trick:

Start typing on the command line and then type Ctrl-x Ctrl-e, it should drop you into your system's default editor (hopefully Vim) and allow you to edit the command line from there. Once finished, save the command line, and bash will run the command.

Doesn't help me, because I'm a tcsh user, but I'm contemplating making the big switch back to bash.
foxfirefey: A guy looking ridiculous by doing a fashionable posing with a mouse, slinging the cord over his shoulders. (geek)
[personal profile] foxfirefey2009-12-31 01:32 pm
Entry tags:

vimtutor: HOW DID I NOT KNOW THIS?

We were talking about vi/[community profile] emacs in #dw and avid emacs user [personal profile] mocker reluctantly mentioned vimtutor to me, and so I'm mentioning it to you all here, in case some of you wanted to start learning vim. You should be able to use it just by typing vimtutor on the command line of a system that has vim installed.
foxfirefey: A fox colored like flame over an ornately framed globe (Default)
[personal profile] foxfirefey2009-06-30 06:18 pm
Entry tags:

Copy pasting without reformatting in vi

So, vi(m) is a great command line editor if you've started to outgrow nano. But, if you are copy pasting chunks of things into it, sometimes it does some...creative reformatting. You can stop this if you use this command before you do your i (insert letter) and paste:

:set paste