Some vim/bash commands I learned recently that I really like

I’ve gotten into vim and bash in the last year or so and theres a few commands I really  like.

bash

ctrl+r  =  reverse-i-search.  Basically this looks through your terminal history to complete the command you’re writing. I use this most frequently when I’m ssh’ing somewhere.

ls -ltc | head -5 = I’ve aliased this to lth, one of my colleagues showed it to me and I really like it.  It returns the five most recently updated files in the current directory.  I use it a lot.

vim

gq  = this formats the spacing and line breaks of your text.  I’ve found this most useful when I’m using vim as a text editor for Latex or note taking.  Makes things look great, so I like to think that the magazine on style was named after this command.  After setting the text width (ex. tw=80), highlight a block of text in visual mode and hit gq. Boom. Beautiful.

ctrl+n = yes, vim has autocomplete.  I discovered it by accident.  If there is only one possible completion, it puts that in.  If not, it comes up with a little list of possible completions.  Kind of incredible.

 

 

Leave a Reply