Vimrc

From Attie's Wiki
Jump to: navigation, search

This is a configuration file for Vim. Place this in ~/.vimrc

set tabstop=2
set background=dark
set wildmode=longest,list
set splitbelow
set splitright
map = <C-w>=
map - :res<CR>:vertical res<CR>
map ! :vert res 0<CR>:set winfixwidth<CR><C-w>w
map " :set nowinfixwidth<CR><C-w>=
map <F3> :buffer<space>#<CR>
map <F4> :ls<CR>:buffer<space>
map <F5> :bp<CR>
map <F6> :bn<CR>
map <F7> :tag main<CR>
map <F8> :ts<CR>
map <F9> :let @/=expand("<cword>")<CR>:set hlsearch<CR>
map <F10> :nohl<CR>
map <F11> <C-y>
map <F12> <C-e>
map <C-F5> :tp<CR>
map <C-F6> :tn<CR>
map <C-w>] <C-w><C-]>
map <C-w><C-]> <C-w>v<C-]>
 
map [[ ?{<CR>w99[{?(<CR>? <CR>l
map ]] j0?{<CR>w99[{%
 
fun! ShowFuncName()
  let lnum = line(".")
  let col = col(".")
  echohl ModeMsg
  echo getline(search("^[^ \t#/]\\{2}.*[^:]\s*$", 'bW'))
  echohl None
  call search("\\%" . lnum . "l" . "\\%" . col . "c")
endfun
map f :call ShowFuncName() <CR>
 
if has("gui_running")
  set mouse=c
  if has("gui_win32")
    set guifont=6x13-ISO8859-1:h10
    set guioptions+=a
    set backspace=indent,eol,start
    set splitright
    set splitbelow
    colorscheme pablo
    syntax on
    map <F9> :cs kill -1<CR>:cd %:p:h<CR>:cs add .<CR>
    map <F10> <Nop>
    map <C-w><C-]> <C-w>v<C-]>
    source ~/_vimrc_cscope
  endif
endif
if filereadable("~/.vim/color.vim")
  source "~/.vim/color.vim"
elseif filereadable("~/_vim_color.vim")
  source "~/_vim_color.vim"
endif

Highlight Text Past 80 Cols

highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/

Past 80 Col Background

Requires TERM=xterm-256color

let &colorcolumn=join(range(81,9999),",")
highlight ColorColumn ctermbg=234 guibg=#2c2d27

Cscope

You will want to download this file cscope_maps.vim to ~/.vim/plugin/cscope_maps.vim, and apply this patch:

--- cscope_maps.vim.orig        2002-03-13 04:45:35.000000000 +0000
+++ cscope_maps.vim     2012-12-03 15:20:19.434136766 +0000
@@ -31,11 +31,11 @@ if has("cscope")
     """"""""""""" Standard cscope/vim boilerplate
 
     " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
-    set cscopetag
+    "set cscopetag
 
     " check cscope for definition of a symbol before checking ctags: set to 1
     " if you want the reverse search order.
-    set csto=0
+    set csto=1
 
     " add any cscope database in current directory
     if filereadable("cscope.out")
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox