Skip to main content

9 posts tagged with "vi"

View All Tags

Using Templates in Vim

· One min read

I just discovered a way to use templates in Vim where when I create a file, depending on the extension of the file, the boilerplate text that should always be there will be there.

You can find out how to do this from the Vim Recipe book, in particular this page: http://vim.runpaint.org/typing/using-templates/

Tips on Using VI Editor (continued)

· 3 min read

The most attractive feature that VI has to offer is the block visual mode. It is amazingly powerful, especially for those who do coding. With it you can add characters to or remove characters a block of text in a column fashion. For example, you can add characters to a block of text (Figure 1) instantly (Figure 2).

Tips on Using VI Editor (continued)

· 2 min read

Changing multiple characters to uppercase

In visual mode, with the characters to change selected, press U (uppercase) to change them to uppercase. Press u (lowercase) to change them to lowercase.

In command mode, the same effect can be achieved on a single character by placing the cursor on the letter and press the tilde sign (~).

Tips on Using VI Editor (continued)

· One min read

More on VI...

H - position the cursor at the top of the screen (left most position)

M - position the cursor in the middle of the screen (left most position)

L - position the cursor in the bottom of the screen (left most position)

G - position the cursor at the bottom of the file (left most position); last line in file

gg - position the cursor at the top of the file (left most position); first line in file

:_n_ - position the cursor at line n of the file

Tips on Using VI Editor

· One min read

This is a one of many mini-posts that I will do on using the VI editor. I've recently bumped into some pages that contains valuable information on how to use VI. The problem with it is its too wordy and that makes it hard to look for information when you need it.

Customisation for Vim Editor

· 2 min read

When doing some simple programming, I like to use the Vim editor instead of using a full-blown IDE. It's a good editor but I want to use it more efficiently. Some of the things I customise for myself are:

  • auto indentation - this is a must for programmers
  • tab size - to indent I use the tab key but different applications represent the tab character with different number of spaces; I like mine to be 4
  • I like my colours to be different

Changing the Tab Size in VI Editor

· One min read

The vi editor is a powerful editor. Problem with it is that it is only for the command line which means that many preferences are not accessible via a 'Preferences' page. You need to know how to set preferences using commands.

Recently I've found out how to change the tab size in the vi editor. I think by default the tab size is 8 characters, which is too long for coding with proper indentation. To change it to a four character stop, use the following command in command mode:

:set tabstop=4