vi (6)


search highlight in vi

  • October 22, 2012
  • vi

I was wondering how to turn off the search highlight in vi as it’s distracting when trying to code through yellow blobs of highlighting. [code]:nohlsearch[/code] and the highlighting disappears. Ideal.

Read more...



remove blank lines in vi

  • September 1, 2012
  • vi

to remove blank lines in vi: [code]:v/\S/d [/code]

Read more...



Recover .swp file in vi

  • August 29, 2012
  • vi

I was just editing a file in vi on my iPad using diet coda. Hadn’t saved it and the app crashed. Boo. Tried to open the .swp file, oops, don’t do that. Instead, use: [code]vi -r file[/code] Open the file as if it existed, but using the -r flag (recover, suprisingly) vi will look for […]

Read more...



line numbers in vi and goto line in vi

  • August 28, 2012
  • vi

There are some by handy shortcuts in vi, to say the least, it’s a very comprehensive program. So here is how to turn on line numbers in vi and how to goto line in vi. To turn line numbers on, do [code]:set number[/code] To jump to a specific line, a colon followed by the number […]

Read more...



running a shell from vi

  • August 28, 2012
  • vi

sometimes you are editing a file and need to quickly do something back on the command line. the usual practice would be to save the file, exit to the shell, do your stuff, then reopen the file again… instead, when in vi, do :sh this will send you back to your command line, where you […]

Read more...



oops, i edited and i’m not root

  • August 28, 2012
  • vi

the amount of times i have been editing away at a file in vi and gone to save it only to realise i’m not root… if my edits were all in one block, i’d usually end up copying the text with my mouse, closing the file, su to root, open it up, paste, zzz…. so. […]

Read more...