Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: silly vi question

Re: silly vi question

From: Egor Starostin <egorst_at_gmail.com>
Date: Fri, 12 Nov 2004 13:47:29 +0600
Message-ID: <f0fc9197041111234766a38ec8@mail.gmail.com>


> does anyone use syntax highlighting for vi or vim? Id like to at least
> get .oracle- .sql and possible shell scripts. The black and white gets
> my eyes crossed in a few hours ;-) The syntax highlighting would be a
> god send!
>
> I googled for it but nothing is prominent, so I thought asking here
> would be more efficient than trying all sorts of things that dont work.
Here's the steps which I did to allow to use vim in sqlplus (with syntax highlighting and words completion):

  1. add 'define _editor=vim' to ~/login.sql
  2. add to ~/.vimrc *** set nocompatible syntax on " next function allows you to do completion of words by pressing <Tab> function! InsertTabWrapper?(direction) let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\<tab>" elseif "backward" == a:direction return "\<c-p>" else return "\<c-n>" endif endfunction inoremap <tab> <c-r>=InsertTabWrapper? ("forward")<cr> inoremap <s-tab> <c-r>=InsertTabWrapper? ("backward")<cr> ***
  3. add to ~/.vim/after/ (create this dir if necessary) file filetype.vim with content: *** augroup filetypedetect au BufNewFile,BufRead afiedt.buf setf sql augroup END ***
  4. add to ~/.vim/after/syntax/ file sql.vim with content: *** set dict+=$HOME/.vim/dict/sql.dict " our own dictionary set cpt=.,k,w,b,t,i " use keywords (k) for completion ***
  5. this step is optional. create file ~/.vim/dict/sql.dict with words for which you'd like to use completion (note, that completion will already work for standard keywords defined in $VIMRUNTIME/syntax/sql.vim). It may be words like dual,dba_segments etc.

If you want to use vim alone (not as an editor in sqlplus) then just skip first and third steps.

Egor
http://www.oracledba.ru/orasrp/
Free Oracle Session Resource Profiler

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Nov 12 2004 - 01:43:13 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US