For vim I use a .vimrc that has taken a couple of years to be happy with. For example it sets tabs to be replaced by four spaces. However, there are files for which that is a bad idea. Makefiles won’t work unless the leading whitespace is a tab, and js and css files will be leaner if one tab is used instead of four spaces. I could make my .vimrc smart enough to do that, but that wouldn’t help others who might edit these files without the advantage of my .vimrc. Modelines solve the tabs vs spaces problem.

To set my main.css file so that tabs don’t get converted to spaces but still appear equivalent to four spaces, I can put this line at the end of the file.

// vim: ai:ts=4:sw=4:et!

I have to enable interpretation of modelines, especially if I want them to work for ‘root’.

set modeline
set modelines=2

which instructs vim to look at the first and last two lines to check for a modeline.
For my main.css example I could have used parenthesis style comments /* ... */ but these require use of set which in turn requires a different use of colons. This time interpretation terminates after the first colon following set

/* vim: set ai ts=4 sw=4 et!: */

This won’t change existing spaces, for which I might want to try

:%s/    /^I/g

where “^I” is actually <ctrl>+<v>,<tab>
Thus file-by-file I can choose whether real tabs should be used instead of spaces, while keeping spaces as my overall default.

Advertisements

The default settings for page/screen capabilities in oracle are pretty pessimistic. The result is your output is wrapped down the left-hand side of your screen, with column headings repeated too frequently.

Page dimensions

The defaults in sqlplus are 14 rows x 80-chars.
To change to, eg, 60 rows x 132-chars, use:

set PAGESIZE 60;
set LINESIZE 132;

Column widths

If your output has a column ‘Location’ that is too wide for your purposes, you can assign it a format via:

column Location format A20;

To list your current column formats:

column;

To clear your current column formats:

clear columns;

To clear one specific column format:

column Location clear;

CSV files

One way to create comma-separated or tab-separated files is to spool them from within sqlplus.
First set up neutral formatting:

SET PAGESIZE 0
SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET MARKUP HTML OFF SPOOL OFF
SET COLSEP ','

Then

spool /tmp/output.csv
SELECT ...
spool off