The Archives

  • 01.22.10
    Vim for programmers (III) shell | n0str0m0 | (0)
    Welcome to the last "Vim for programmers" issue. Ironically, in this issue I will show you some nice characteristics despite they are not specific of programming. However they make much more sense when they are applied to programming. Getting C help This first feature is oriented directly to C programming. In most UNIX systems, there is a collection of system manual pages available with the command "man". Although I will not explain man in detail (you can read more here (or type man man) it is worth saying it shows information about the command, system call, file, etc passed as parameter. ...
  • 01.07.10
    Vim for programmers (II) shell | n0str0m0 | (0)
    In the first part of this series, we visited some Vim features that help us in programming. In this second issue, I will show you some other important things you should know to really appreciate the power of Vim. Completion Completion is not a programming specific feature in Vim, however it is in programming where I find it to be more useful. There are several completion options, but I will explain the ones I find more interesting. Completion is a sub mode of insert mode. This means the commands are applied while being in insert mode. Line completion: Ctrl-x ...
  • 11.01.09
    Vim. Editing multiple files shell | n0str0m0 | (0)
    In previous issues, we have edited one file at a time. We did this because there were other points of interest at that time. However, Vim can handle more than one file at a time using several different techniques including buffers, viewports and tabs last one, since Vim 7. In this issue we take a look at these handy mechanisms that will speed up your work. Buffers We can think of a buffer as a place inside Vim where a file is loaded. In the following example, I will use a couple of files: $ cat file1 file2 This is file 1 This is ...
  • 10.03.09
    Vim. Copy & Paste shell | n0str0m0 | (0)
    Copy & Paste are two of the most important operations when writing a text. It is easy to know why: you save a lot of time. Vim handles copy & paste powerfully and gracefully. In Vim you can yank (copy), cut and paste text objects. There are two basic ways for selecting text: either using the normal vim commands or going into visual mode. Let us see all of this with some examples: This is a sample text (Bold letters indicate the cursor position as in the previous issues.) Now type: yw followed by ESC o As you can expect, you have just yanked a word ...
  • 09.28.09
    Vim. Moving around shell | n0str0m0 | (0)
    Vim is not a mouse driven program. With other editors, you use the mouse to place the cursor at the desired position. This seems to be fine. However, you do not realize how faster you can move using a command approach as in Vim. In Vim, you move around the text using different commands, that is, keystrokes while you are in command mode. At the beginning this may result confusing or even seem a waste of time. However, once you get used to it, you will never leave it and you find it to be faster than any other method. Basic ...
  • 07.10.09
    Adding password protection on a file with vim cmd, security | rafacas | (1)
    $ vim -x filename The -x option uses encryption when writing the file. It will ask for a key: Enter encryption key: ****** Enter same key again: ****** From then on your filename will be encrypted and accessed using the password. The -x option will no longer be necessary when editing the file.
  • 07.04.09
    Vim. Inserting text shell | n0str0m0 | (0)
    Probably, the most important action to do with a text editor is inserting text. Vim makes this task very easy and powerful at the same time. Before we start, let us specify some symbolic conventions: I will use ESC and ENTER to refer to the escape and ENTER keys respectively All the keys you are expected to press without producing any output on the screen will be in boldface. Example: ESC i means you have to press escape and then i, i being a command that does not produce any output Let us start with vim: $ vim test.txt The simplest way of inserting test ...
  • 06.08.09
    Vim, first session shell | n0str0m0 | (0)
    Here you are: your first vim lesson! First off, start vim with a named empty file: $ vim myfile Once you have done this, you get a screen similar to this one (I've removed some of the blank lines for the sake of clarity): ~ ...
  • 05.06.09
    Vim, a short tutorial shell | n0str0m0 | (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 ...
  • 03.29.09
    Opening files in Vim shell | n0str0m0 | (0)
    $ vim file1 file2 Opens file1 and file2 in two different buffers and shows file1 in the current viewport $ vim -o file1 file2 Opens file1 and file2 in two different buffers and shows every one of them in a viewport with the screen splitted horizontally $ vim -O file1 file2 Same as above but with the screen splitted vertically