think tank forum

technology » vimrc

lucas's avatar
14 years ago
r2, link
lucas
i ❤ demo
post yours here!

i use gvim 7.2 for win32.

syntax on
colorscheme elflord 
set ruler
set showcmd
set mousehide
set nobk
set nobackup
set nowritebackup
set autoindent
set expandtab
set background=dark
set ch=2
set ts=4
set sw=4
set bs=2
set encoding=utf8
source $VIMRUNTIME/mswin.vim
asemisldkfj's avatar
14 years ago
link
asemisldkfj
the law is no protection
this is mine on pretty much every system:

set autoindent
set background=dark
set backspace=indent,eol,start
set ruler
set tabstop=4
set vb
syntax enable
bluet's avatar
14 years ago
r4, link
bluet
Wow, that's short!

http://ciew.wingedleopard.net/hg/etc/file/912366f2da95/vimrc

And if anything fails:
if has("gui_running")
    colorscheme synic
endif

let g:netrw_browse_split=4
let g:netrw_list_hide='.*\.swp$,.*\.pyc$'

set autoindent
set backspace=indent
set diffopt=filler,vertical
set encoding=utf-8
set expandtab
" set guifont=Inconsolata\ 10
set guifont=Terminus\ 10
set guioptions=a
set hlsearch
set mouse=a
set nocompatible
set number
set ruler
set shiftwidth=4
set smartindent
set smarttab
set tabstop=4
set textwidth=80
set visualbell
set wildmenu
syntax on

; ^[ is actually ^V<ESC>

map ^[1 1gt
map ^[2 2gt
map ^[3 3gt
map ^[4 4gt
map ^[5 5gt
map ^[6 6gt
map ^[7 7gt
map ^[8 8gt
map ^[9 9gt
map ^[0 10gt

map <F6> :NERDTreeToggle<CR>
map <F7> :%!xxd<CR>
map <F8> :%!xxd -r<CR>

map - :s/^\( *\)/\1# /<CR>:nohls<CR>
map _ :s/^\( *\)[#!"] */\1/<CR>:nohls<CR>

filetype indent on

autocmd FileType c,cpp      map <buffer> - :s/^\( *\)/\1\/\/ /<CR>:noh<CR>
autocmd FileType c,cpp      map <buffer> _ :s/^\( *\)\/\/ */\1/<CR>:noh<CR>
autocmd FileType forth      map <buffer> <F5> :!gforth %<CR>
autocmd FileType haskell    map <buffer> <F5> :!ghci %<CR>
autocmd FileType haskell    map <buffer> - :s/^\( *\)/\1-- /<CR>:noh<CR>
autocmd FileType haskell    map <buffer> _ :s/^\( *\)-- */\1/<CR>:noh<CR>
autocmd FileType lua        map <buffer> <F5> :!lua %<CR>
autocmd FileType lua        map <buffer> - :s/^\( *\)/\1-- /<CR>:noh<CR>
autocmd FileType lua        map <buffer> _ :s/^\( *\)-- */\1/<CR>:noh<CR>
autocmd FileType make       map <F5> :make test<CR>
autocmd FileType make       setlocal expandtab! " Saves a byte.
autocmd FileType python     map <buffer> <F5> :!python %<CR>
autocmd FileType python     setlocal keywordprg=pydoc
autocmd FileType vim        map <buffer> - :s/^\( *\)/\1" /<CR>:noh<CR>
autocmd FileType xdefaults  map <buffer> - :s/^\( *\)/\1! /<CR>:noh<CR>

noh


The netrw stuff is a bit redundant since I use NERDTree for browsing now.
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
My vimrc is a mess

"
" Standard options
"
set nocompatible        " Use Vim settings, rather then Vi settings
set backspace=indent,eol,start  " allow backspacing over everything
set history=100         " keep 100 lines of command line history
set ruler               " show the cursor position all the time
set showcmd             " display incomplete commands
set incsearch           " do incremental searching
set hlsearch            " highlight the last used search pattern.
set textwidth=78        " set 'text width' to 70 characters.
set autoindent          " always set auto indenting on
set autowriteall        " Automatically write files
set ignorecase          " Case-insensitive searching
set smartcase           " Case-sensitive searching only if pattern has caps
set sbr=+               " Show a + when wrapping a line
set lbr                 " Wrap at word
set pdev=/dev/lpt0      " Printer device
set tabstop=2           " Tabs are 2 spaces wide
set shiftwidth=2        " Auto-indent 2 spaces wide
set softtabstop=2       " Still 2...
set backup              " keep backup file
set backupext=.bak      " Extension for backup files
set backupdir=/tmp/carpet       " Where to keep backup files.
set dir=/tmp/carpet     " Keep swap file here
set listchars=tab:>-,trail:_    " String to use in 'list' mode
set spelllang=en_us     " Language for spell check
set mousemodel=popup_setpos     " Use pop-up menu for right button
set virtualedit=onemore " Allow cursor to move one char beyond end of line
set showtabline=2       " Always show tab line
set foldmethod=marker   " Automatically fold stuff
set foldopen=hor,mark,search,block,tag,undo     " Automatically unfold on these events
set foldclose=all       " Automatically close folds when moving out of them
set laststatus=2        " Always show statusline
set viminfo='500,<500,s10
"set t_Co=256           " Enable 256 colors
"set title              " Update term title
colorscheme default
"colorscheme murphy
"colorscheme torte

"
" Keybinds
"
" Map key to toggle opt
function MapToggle(key, opt)
  let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>"
  exec 'nnoremap '.a:key.' '.cmd
  exec 'inoremap '.a:key." \<C-O>".cmd
endfunction
command -nargs=+ MapToggle call MapToggle(<f-args>)

MapToggle <F10> list
MapToggle <F11> spell
MapToggle <F12> paste

"
" Syntax highlighting options
"
syntax on               " Switch syntax highlighting on
filetype plugin indent on       " Enable file type detection.
let loaded_matchparen=1 " Don't highlight matching parens (it's slow and ugly)
autocmd BufEnter * :syntax sync fromstart       " Syntax breaks less often

au BufNewFile,BufRead *[mM]akefile* setf make

" We want a tabstop of 8 (instead of 2) for some files (mainly configfiles)
au BufNewFile,BufRead
        \ Makefile*,
        \.vimrc,
        \crontab*,
        \*cshrc*,
        \*.conf,*.ini,*.cfg,*.rc,
        \ set ts=8 sts=8 sw=8

" html syntax
au BufNewFile,BufRead *.html,*.htm,*.inc set textwidth=100

let python_highlight_numbers = 1
let python_highlight_builtins = 1
let python_highlight_exceptions = 1
let python_highlight_space_errors = 1

let php_sql_query=1             " SQL syntax highlighting inside strings
let php_htmlInStrings=1         " HTML syntax highlighting inside strings
let php_parent_error_close=1    " highlighting parent error ] or )
let php_parent_error_open=1
let php_folding=1               " for folding classes and functions

"
" Other functions and stuff
"

" When editing a file, try to jump to the last known cursor position.
autocmd BufReadPost *
  \ if line("'\"") > 0 && line("'\"") <= line("$") |
  \   exe "normal g`\"" |
  \ endif

" Add python path to gf will work on import module
"python << EOF
"import os
"import sys
"import vim
"for p in sys.path:
"    # Add each directory in sys.path, if it exists.
"    if os.path.isdir(p):
"        # Command 'set' needs backslash before each space.
"        vim.command(r"set path+=%s" % (p.replace(" ", r"\ ")))
"EOF

" Use antiword to read word files
autocmd BufReadPre *.doc set ro
autocmd BufReadPre *.doc set hlsearch!
autocmd BufReadPost *.doc %!antiword "%"

" Easy / Better pasting
function! SmartPasteSelection(insertMode)
  let s:old_col = col(".")
  let s:old_lnum = line(".")
  " Correct the cursor position
  if a:insertMode
    if s:old_col == 1
      exec "normal iX\<Esc>"
    else
      exec "normal aX\<Esc>"
    endif
  endif
  exec 'normal "+gP'
  if a:insertMode
    exec 'normal x'
  endif
  let s:after_col = col(".")
  let s:after_col_end=col("$")
  let s:after_col_offset=s:after_col_end-s:after_col
  let s:after_lnum = line(".")
  let s:cmd_str='normal V'
  if s:old_lnum < s:after_lnum
    let s:cmd_str=s:cmd_str . (s:after_lnum - s:old_lnum) . "k"
  elseif s:old_lnum> s:after_lnum
    let s:cmd_str=s:cmd_str . (s:old_lnum - s:after_lnum) . "j"
  endif
  let s:cmd_str=s:cmd_str . "="
  exec s:cmd_str
  let s:new_col_end=col("$")
  call cursor(s:after_lnum, s:new_col_end-s:after_col_offset)
  if a:insertMode
    if s:after_col_offset <=1
      exec 'startinsert!'
    else
      exec 'startinsert'
    endif
  endif
endfunction
nmap <C-V> :call SmartPasteSelection(0)<CR>
imap <C-V> <Esc>:call SmartPasteSelection(1)<CR>


function! HTMLEncode()
perl << EOF
 use HTML::Entities;
 @pos = $curwin->Cursor();
 $line = $curbuf->Get($pos[0]);
 $encvalue = encode_entities($line);
 $curbuf->Set($pos[0],$encvalue)
EOF
endfunction

function! HTMLDecode()
perl << EOF
 use HTML::Entities;
 @pos = $curwin->Cursor();
 $line = $curbuf->Get($pos[0]);
 $encvalue = decode_entities($line);
 $curbuf->Set($pos[0],$encvalue)
EOF
endfunction

map <Leader>h :call HTMLEncode()<CR>
map <Leader>H :call HTMLDecode()<CR>

nnoremap <Leader>Q :%s/=\(\x\x\<BAR>\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge<CR>
vnoremap <Leader>Q :s/=\(\x\x\<BAR>\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge<CR>

function! GenerateUnicode(first, last)
  let i = a:first
  while i <= a:last
    if (i%256 == 0)
      $put ='----------------------------------------------------'
      $put ='     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F '
      $put ='----------------------------------------------------'
    endif
    let c = printf('%04X ', i)
    for j in range(16)
      let c = c . nr2char(i) . ' '
      let i += 1
    endfor
    $put =c
  endwhile
endfunction
lucas's avatar
14 years ago
r1, link
lucas
i ❤ demo
asemi: `tabstop=4` is good, but bro--you gotta `expandtab`!

cs: `tabstop=2` is wicked shit. why don't you `expandtab`?
bluet's avatar
14 years ago
link
bluet
"expandtab!" is the same as "noexpandtab"!
lucas's avatar
14 years ago
link
lucas
i ❤ demo
oh shit

revised!
asemisldkfj's avatar
14 years ago
link
asemisldkfj
the law is no protection
hold on. if I set expandtab it will insert spaces instead of tabs, right? can someone explain the spaces side of the tabs vs. spaces argument? because I've never understood it.
lucas's avatar
14 years ago
r1, link
lucas
i ❤ demo
spaces always look the same.

tabs are interpreted differently depending on the editor and settings.

so if you open it elsewhere, commit it, or send it to someone, it might turn your beautiful spacing into ugliness.
asemisldkfj's avatar
14 years ago
link
asemisldkfj
the law is no protection
I don't use tabs to do anything but indent, so I don't see where a problem could arise.

http://www.iovene.com/tabs-vs-spaces-the-end-of-the-debate/

if I was going to align anything as shown in that blog post, I would make a point to use tabs. but for indenting, I don't see any problem with using tabs.
lucas's avatar
14 years ago
link
lucas
i ❤ demo
> I don't use tabs to do anything but indent, so I don't see where a problem could arise.

your indents may be too short or too long, depending on how you want to distinguish the line.

your tabs are 2 characters to cs, 4 to me, and 8 to ms notepad.
asemisldkfj's avatar
14 years ago
link
asemisldkfj
the law is no protection
well I figure anyone who has their tabstop set has it set to something that allows them to distinguish lines according to their own personal preferences. if indenting with tabs could cause any serious screw-ups like this then I would set expandtab. plus it annoys me to have to delete spaces instead of tabs if I want to decrease the indent of something.
lucas's avatar
14 years ago
link
lucas
i ❤ demo
fair enough. i do a lot of alignment like that. i got used to deleting the spaces quickly.
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
> cs: `tabstop=2` is wicked shit. why don't you `expandtab`?

I like tabs for coding, I do use expandtabs for text and emails though (Manually set it).

For code, everyone prefers different indentation. I prefer 2 spaces, others 3, 4, 5, etc. with tabs, everyone can set their own preference in the editor. With spaces this is not the case. This will almost always look fine when used for indentation.
lucas's avatar
14 years ago
link
lucas
i ❤ demo
fair enough
andre's avatar
14 years ago
r1, link
andre
Well the problem with tabs is how to indent continuation lines:

if (something_very_long
    && something_else) { ...


How do you indent the second line? If you use tabs only it may not align nicely with the first one. If you add spaces, then it'll break stuff for people with different tab widths.
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
I would just use a tab.

I don't care about alignment that much. I used to, but I found it didn't really improve readability in most cases (Exceptions excepted of course).
bluet's avatar
14 years ago
link
bluet
> plus it annoys me to have to delete spaces instead of tabs if I want to decrease the indent of something.

I use << for decreasing the indentation level. This is cool because it also works with several lines and levels at once.
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
> I use << for decreasing the indentation level. This is cool because it also works with several lines and levels at once.

Damn, I vote for this as vim tip of the month!
andre's avatar
14 years ago
r1, link
andre
If you set "softtabstop" (sts) to your indent level, backspace will automatically decrease indentation correctly (no need to use <<).
asemisldkfj's avatar
14 years ago
link
asemisldkfj
the law is no protection
neat, maybe I will use spaces now.
bluet's avatar
14 years ago
link
bluet
> (no need to use <<).

But with << you can do stuff like "/{V/}<CR><<" to decrease the indentation level of a block of code.
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
Yeah, that's useful, especially in Python. I used a macro for that but this is much more elegant/better.
andre's avatar
14 years ago
link
andre
> But with << you can do stuff like "/{V/}<CR><<" to decrease the indentation level of a block of code.

Of course, but if you're simply re-indenting some line, doing "<esc><<" and then going back to input mode is a lot of work when you can just use backspace.

Btw, you can press "==" to place the current line at (what vim thinks is) the correct indent level.
lucas's avatar
14 years ago
link
lucas
i ❤ demo
you guys are crazy and awesome

go tips!
andre's avatar
14 years ago
r2, link
andre
btw, my vimrc:

if has("gui_running")
  colorscheme zenburn
else
  colorscheme bw
endif

set encoding=utf8
set nocompatible
set backspace=indent,eol,start
set autoindent
set history=50
set ruler
set showcmd
set incsearch

set nobackup
set tabstop=2
set hardtabs=2
set shiftwidth=2
set softtabstop=2
set expandtab
set nohlsearch
set guifont=Bitstream\ Vera\ Sans\ Mono\ 7.5
set mouse=

set guicursor=a:block-Cursor-blinkon0


I also keep language-dependent options in ~/.vim/ftplugin/$language.vim. For example, in c.vim I have

set ts=4
set sw=4
set ht=4
set sts=4


In ocaml.vim I have

set wildignore+=*.cmi,*.cmx,*.cma,*.a,*.annot,*.o


This makes vim ignore those extensions when I press tab (e.g. in the tabedit command).

In ruby.vim I have silly macros like this:

map ,d 0==idef<SPACE><ESC>oend<ESC>O


If I type "foo<ESC>,d" it'll become

def foo
  <cursor here>
end


with the correct indentation. Is there a cleaner way to do this?
bluet's avatar
14 years ago
link
bluet
> Is there a cleaner way to do this?

Maybe a substitution command?
andre's avatar
14 years ago
link
andre
How do you mean?
bluet's avatar
14 years ago
r1, link
bluet
Something like

s/^\(\s\)*\([a-zA-Z0-9]\+\)$/\1def \2^V^M\1 ^V^M\1end/

That doesn't move the cursor, though.
lucas's avatar
14 years ago
link
lucas
i ❤ demo
aw man, setting encoding is for real.

syntax on
colorscheme elflord 
set ruler
set showcmd
set mousehide
set nobk
set nobackup
set nowritebackup
set autoindent
set expandtab
set background=dark
set ch=2
set ts=4
set sw=4
set bs=2
set encoding=utf8
source $VIMRUNTIME/mswin.vim
nny's avatar
14 years ago
link
nny
M̮͈̣̙̰̝̃̿̎̍ͬa͉̭̥͓ț̘ͯ̈́t̬̻͖̰̞͎ͤ̇ ̈̚J̹͎̿̾ȏ̞̫͈y̭̺ͭc̦̹̟̦̭̫͊̿ͩeͥ̌̾̓ͨ
Does anyone remember how one controls function collapsing in vim?
bluet's avatar
14 years ago
link
bluet
> Does anyone remember how one controls function collapsing in vim?

Do you mean folding?
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
I have these options in my vimrc for that:
set foldmethod=marker   " Automatically fold stuff
set foldopen=hor,mark,search,block,tag,undo     " Automatically unfold on these events
set foldclose=all       " Automatically close folds when moving out of them


Add {{{ and }}} to make folds (Typically inside comments). You can change the markers with the foldmarker option (IIRC).

Only command I use is `zc', which means close fold.
dannyp's avatar
13 years ago
r1, link
dannyp
dʎuuɐp
I like this handy mapping:


nnoremap <F5> "=strftime("%c")<CR>P
inoremap <F5> <C-R>=strftime("%c")<CR>



Just mash F5 for a date/time stamp! Really handy for logs.
lucas's avatar
13 years ago
link
lucas
i ❤ demo
cool.
asemisldkfj's avatar
13 years ago
link
asemisldkfj
the law is no protection
I frequent this thread to get a decent vimrc on systems without one.
dannyp's avatar
13 years ago
r1, link
dannyp
dʎuuɐp
I've added this script for saving window position and size:
http://vim.wikia.com/wiki/Restore_screen_size_and_position

Even though I just found out about mksession.4 and tabs in gvim :D

Try it:


Control+W gf
Control+W v
:mksession ~/dpworkbook.vim
Alt+F4

open gvim
:source ~/dpworkbook.vim



:D

If you don't want to type source and remember the file path every time in an empty gvim just add this to a gvim shortcut for automated magic:


Properties->Target: "C:\Program Files (x86)\Vim\vim73\gvim.exe" -S ~/dpworkbook.vim



probably should map a command for saving everything too:


"Session save all
map <F11> <C-O>:wall<CR>:mksession! ~/dpworkbook.vim<CR>


Oh yeah I added "Find" and "Find and Replace" to my vimrc:


inoremap <C-F> <C-O>:promptfind<CR>
inoremap <C-H> <C-O>:promptrepl<CR>
inoremap <F3> <C-O>n



So it's Control+F to Find, Control+H to Find and Replace, F3 to cycle to the next!
dannyp's avatar
13 years ago
r1, link
dannyp
dʎuuɐp
here's what i'm workin with
if has("gui_running")
    colorscheme herald
    syntax on
    source $VIMRUNTIME/mswin.vim
else
    colorscheme bw
    source $VIMRUNTIME/menu.vim
endif

"General
set bs=2
set cul
set enc=utf8
set gfn=Consolas
set go-=T
set history=50
set hls
set is
set ls=2
set lsp=0
set nu
set ru
set wmnu

"Indents and Tabs
set ai
set ch=2
set et 
set nocin
set sc
set si 
set sta
set sts=4
set sw=4
set ts=4

"Folding
nnoremap <space> za 
set fdm=indent
set foldc=all
set foldo=hor,mark,search,block,tag,undo,quickfix,percent 

"Custom

"TimeDate via F5
inoremap <F5> <C-R>=strftime("%c")<CR>
nnoremap <F5> "=strftime("%c")<CR>P

"Session save all
map <F11> <C-O>:wall<CR>:mksession! ~/dpworkbook.vim<CR>

"Find and Replace
inoremap <C-F> <C-O>:promptfind<CR> 
inoremap <C-H> <C-O>:promptrepl<CR>
inoremap <F3> <C-O>n

ia pdp projectdp

"Programming 
set sm  "Highlights matching brackets in programming languages

"Python
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,with,try,except,finally,def,class
autocmd BufRead,BufNewFile *.py set ai
autocmd BufRead,BufNewFile *.py syntax on
bluet's avatar
13 years ago
link
bluet
ab hinst hints
ab sop System.out.println
ab psvm public static void main(String[] args)

filetype indent plugin on

let mapleader=","
let loaded_matchparen=1

if v:version >= 703
    set undodir=~/.vim/undo
    set undofile
    set undolevels=10000
    set undoreload=100000
endif

function! ToggleColorcolumn()
    if &colorcolumn == "+1"
        set colorcolumn=
    else
        set colorcolumn=+1
    endif
endfunction

function! ToggleSyntax()
    if exists("g:syntax_on")
        syntax off
    else
        syntax enable
    endif
endfunction

map <silent> <leader>[ ddhGpl
map <silent> <leader>] ddlGph
map <silent> <leader>c :center<CR>
map <silent> <leader>m :call ToggleColorcolumn()<CR>
map <silent> <leader>s :call ToggleSyntax()<CR>
map <silent> <leader>d :r!date +\%Y-\%m-\%d<CR>
map <silent> <leader>t :r!date "+\%Y-\%m-\%d \%H:\%M:\%S"<CR>
map <silent> <leader>lp :!latexmk -pv % 2>/dev/null<CR><CR>
map <silent> <leader>lc :!latexmk -pdf % 2>/dev/null<CR><CR>
map <silent> ZZ :wqa!<CR>
map <silent> ZQ :wqa!<CR>
map <silent>  gt
map <silent>  gt

set autoindent
set autowrite
set bg=dark
set cinoptions=:0
set expandtab
set hidden
set nohlsearch
set incsearch
set modelines=2
set mouse=
set noerrorbells
set nofoldenable
set pastetoggle=<F2>
set ruler
set shiftwidth=4
set softtabstop=4
set tabstop=8
set textwidth=80
set wildmenu

syntax off
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
set cursorline
nnoremap <Leader>c :set cursorline cursorcolumn! <CR>

i set cursorline (which only acts on the main window). then i use a mapping to set it again per buffer, and toggle cursorcolumn with "\c". woohoo!
bluet's avatar
13 years ago
r1, link
bluet
set statusline=%F\ %m%r%h%w[%{&fenc}][%{&ff}]%y\ [column\ %c%V]\ [line\ %l\ of\ %L]\ [byte\ %o]
bluet's avatar
13 years ago
r1, link
bluet
I made a colorscheme:

set background=dark
hi clear
if exists("syntax_on")
    syntax reset
endif
let g:colors_name="mastensg"

hi ColorColumn  cterm=NONE      ctermbg=darkgray    ctermfg=white
hi Comment      cterm=NONE      ctermbg=black       ctermfg=darkcyan
hi Constant     cterm=NONE      ctermbg=black       ctermfg=white
hi Cursor       cterm=NONE      ctermbg=black       ctermfg=white
hi CursorIM     cterm=NONE      ctermbg=black       ctermfg=white
hi DiffAdd      cterm=bold      ctermbg=darkgreen   ctermfg=white
hi DiffChange   cterm=bold      ctermbg=darkyellow  ctermfg=white
hi DiffDelete   cterm=bold      ctermbg=darkred     ctermfg=white
hi DiffText     cterm=NONE      ctermbg=black       ctermfg=white
hi Directory    cterm=NONE      ctermbg=black       ctermfg=white
hi Error        cterm=bold      ctermbg=black       ctermfg=red
hi ErrorMsg     cterm=NONE      ctermbg=black       ctermfg=white
hi FoldColumn   cterm=NONE      ctermbg=black       ctermfg=white
hi Folded       cterm=NONE      ctermbg=black       ctermfg=white
hi Identifier   cterm=NONE      ctermbg=black       ctermfg=white
hi Ignore       cterm=NONE      ctermbg=black       ctermfg=white
hi IncSearch    cterm=bold      ctermbg=green       ctermfg=black
hi LineNr       cterm=NONE      ctermbg=black       ctermfg=white
hi Menu         cterm=NONE      ctermbg=black       ctermfg=white
hi ModeMsg      cterm=NONE      ctermbg=black       ctermfg=white
hi MoreMsg      cterm=NONE      ctermbg=black       ctermfg=white
hi NonText      cterm=NONE      ctermbg=black       ctermfg=darkgray
hi Normal       cterm=NONE      ctermbg=black       ctermfg=white
hi PreProc      cterm=NONE      ctermbg=black       ctermfg=white
hi Question     cterm=NONE      ctermbg=black       ctermfg=white
hi Scrollbar    cterm=NONE      ctermbg=black       ctermfg=white
hi Search       cterm=NONE      ctermbg=black       ctermfg=green
hi Special      cterm=NONE      ctermbg=black       ctermfg=white
hi SpecialKey   cterm=NONE      ctermbg=black       ctermfg=darkgray
hi Statement    cterm=NONE      ctermbg=black       ctermfg=white
hi StatusLine   cterm=bold      ctermbg=white       ctermfg=black
hi StatusLineNC cterm=bold      ctermbg=gray        ctermfg=black
hi Title        cterm=NONE      ctermbg=black       ctermfg=white
hi Todo         cterm=bold      ctermbg=black       ctermfg=cyan
hi Tooltip      cterm=NONE      ctermbg=black       ctermfg=white
hi Type         cterm=NONE      ctermbg=black       ctermfg=white
hi Underlined   cterm=NONE      ctermbg=black       ctermfg=white
hi VertSplit    cterm=NONE      ctermbg=white       ctermfg=black
hi Visual       cterm=reverse   ctermbg=black       ctermfg=white
hi VisualNOS    cterm=NONE      ctermbg=black       ctermfg=white
hi WarningMsg   cterm=NONE      ctermbg=black       ctermfg=white
hi WildMenu     cterm=NONE      ctermbg=black       ctermfg=white


It looks like this:

http://www.ping.uio.no/~mastensg/skrot/mastensg-vim.png
dannyp's avatar
13 years ago
link
dannyp
dʎuuɐp
:D
andre's avatar
13 years ago
link
andre
set t_Co=256


This lets vim uses 256 colors even in text mode.