The Archives

  • 25.Jul.11
    Edit a file using vi in read-only mode cmd | rafacas | (0)
    $ vi -R filename Edits filename in read-only mode. I use it more often than the more or less commands to read code because of vi's syntax highlighting.
  • 18.May.09
    Vi: emptying a file in one shot cmd | rafacas | (4)
    :1,$d This vi command blanks out the file being edited. Updated: javisantana suggested another way to emptying a file. Type: ggdG in command mode.
  • 06.May.09
    Vim, a short tutorial shell | fernape | (0)
    Since quite a while, I have intended to write a short Vim tutorial. I do not plan it to be a very detailed guide, I just want to show some of the features of Vim I use often. In this first chapter I explain what Vim is and what it can do for you. Vim is a command-line oriented editor. This is true even though there are some gui-oriented, vim-based alternatives (gvim, for instance). It is based on the ancient Vi, but Vim stands for Vi (i)Mproved, as it provides more powerful features. Some of the things which can be done ...
  • 29.Oct.08
    Opening a file with vi at specified position cmd | rafacas | (0)
    $ vi +10 /home/rafacas/test.txt Opens the file test.txt with the vi editor and positions the cursor on line 10.
  • 06.Jun.08
    Opening a file with vi at a specified string (regexp) cmd | rafacas | (0)
    $ vi +/id /etc/inittab Opens the file and places the cursor at the first ocurrence of the 'id' string. Works with regexps.