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 ” Ignore case set ai ” […]

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 to […]

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 : SELECT column FROM ( SELECT column […]