Skip to content

Category Archives: Vim

Highlight the current line in Vim

To highlight the current line in Vim, you have to set the cursorline setting.

:set cursorline
:set cul

These two are the same. This can also be set in your _vimrc file, you don’t need the colon then.
Here’s an extract from my vimrc file:

set nowrap
set ic [...]

Substituting from this line to the end of the file (in Vim)

In vim, if you want to change something from the current line until the end of the line, you can use .,$ as the range segment of the s command.

:.,$s/COMPILE/COMPILE BODY/g

Substituting over the full file is done by using the % range, which is a shortcut for 1,$, ie from the first [...]

Inserting the current filename in Vim

To insert the current file name in Vim, go to insert mode. Then type Control-R % . With Control-R you can do more things :
Control-R =5*4
This inserts 20 into the current cursor position.
Some examples can be found here

Compiling PL/SQL within Vim

Vim is a great Vi clone, which also works on Windows. It supports using external programs to compile the code you are writing. The following will show how to use this to compile PL/SQL code. Cygwin is also used.
The command ‘:make’ in Vim will call an external program on your current document. This external program [...]