Skip to content

Monthly Archives: August 2007

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 [...]

Selecting random rows

If you want to select random rows from a table, you can order the rows using the dbms_random.value function :

SELECT COLUMN
FROM TABLE
ORDER BY dbms_random.value

To get 20 random rows from the table, we can add a condition on rownum. This selects the first 20 rows :

[...]