zsh/vim/vimrc

201 lines
5.2 KiB
VimL

"
" General Setup
"
" $Id$
set nocompatible " Use Vim defaults (much better!)
set backspace=indent,eol,start " allow backspacing over everything
set textwidth=0
set backup
set viminfo='20,\"50,f10
set history=50
set nohlsearch
set nostartofline
" set paste
set ruler
set cmdheight=1
set laststatus=2
" Following are good for python
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab
set softtabstop=4
set autoindent
set smartindent
" For highlighted numbers:
let python_highlight_numbers = 1
"
" For highlighted builtin functions:
let python_highlight_builtins = 1
"
" For highlighted standard exceptions:
let python_highlight_exceptions = 1
"
" Highlight erroneous whitespace:
let python_highlight_space_errors = 1
" End Python settings
set nofoldenable
set background=dark
set title
set browsedir=buffer
" set autochdir
set cpoptions=aAcF$
set modeline
set modelines=1
set encoding=utf-8
set listchars=tab:->,trail:.,eol:$
set smartcase
set errorbells
" set visualbell
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
" set statusline=%<%f\ %H%m%r%=%-14.(%l,%c%)\ %P\ Buf.%n
set showtabline=0
set backupcopy=yes
set fileformats=unix,mac,dos
set fileformat=unix
set mouse=a
set printfont=Monaco:h14
colorscheme wombat256
" """""""""
" User Info
" """""""""
" PLEASE DEFINE THESE IN vimrc.local
" let g:shortname = 'login'
" let g:fullname = 'Full Name'
" let g:email = 'email address'
" """""""""""""""""""""""""
" COMPLETION & INDENTATION
" """""""""""""""""""""""""
" Function that returns tab if called on an "empty" line
" C-N elsewhere
" function! CleverTab()
" if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
" return "\<Tab>"
" else
" return "\<C-N>"
" endfunction
" map the function to Tab
" inoremap <C-\> <C-R>=CleverTab()<CR>
set completeopt=longest
" Emacs like indenting. Pressing Tab indents line
" Not in python, there it is managed by GetPythonIndent
set indentkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F
set cinkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F
" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
" """""""""""""""
" TagLIST support
" """""""""""""""
let Tlist_Ctags_Cmd="/opt/local/bin/ctags"
let Tlist_Exit_OnlyWindow = 1
let Tlist_File_Fold_Auto_Close = 1
"let Tlist_Use_SingleClick = 0 "Do not use yet
let Tlist_Use_Right_Window = 1
let Tlist_Display_Prototype = 0
let Tlist_Compact_Format = 1
" """"""""
" NERDTree
" """"""""
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc']
let NERDTreeShowBookmarks=1
" """""""""""
" BufExplorer
" """""""""""
let g:bufExplorerSplitBelow=1
let g:bufExplorerResize=1
" """"""""""""""
" NERD Commenter
" """"""""""""""
let NERDSpaceDelims=1
let NERDCreateDefaultMappings=1
" """""""""""
" Keymappings
" """""""""""
let g:mapleader = ","
nnoremap <silent> <Leader>l :set list!<CR>
nnoremap <silent> <Leader>f :set fullscreen!<CR>
nnoremap <silent> <Leader>x :set paste!<CR>
nnoremap <silent> <Leader>n :NERDTreeToggle<CR>
nnoremap <silent> <Leader>t :Tlist<CR>
nnoremap <silent> <Leader>N :set number!<CR>
nnoremap <silent> <Leader>b :HSBufExplorer<CR>
map <silent> <Leader>c <plug>NERDCommenterToggle
" nnoremap <silent> Y y$
inoremap <silent> <C-\> <C-N>
inoremap <silent> <C-Tab> <C-N>
" Visual mode selection
nnoremap <silent> <S-Down> V
nnoremap <silent> <S-Up> V
vnoremap <silent> <S-Down> j
vnoremap <silent> <S-Up> k
" Terminal/Filemanager integration
nnoremap <silent> <F9> :OpenTerminal<CR>
nnoremap <silent> <F10> :OpenFilemanager<CR><CR>
" Tab selection by number
nnoremap <silent> <D-1> 1gt
nnoremap <silent> <D-2> 2gt
nnoremap <silent> <D-3> 3gt
nnoremap <silent> <D-4> 4gt
nnoremap <silent> <D-5> 5gt
nnoremap <silent> <D-6> 6gt
nnoremap <silent> <D-7> 7gt
nnoremap <silent> <D-8> 8gt
nnoremap <silent> <D-9> 9gt
nnoremap <silent> <D-0> 10gt
" Vim5 comes with syntaxhighlighting. If you want to enable syntaxhightlighting
" by default uncomment the next three lines.
if has("syntax")
syntax on " Default to no syntax highlightning
endif " has("syntax")
if has("autocmd")
filetype indent on
filetype plugin on
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
" Mako
autocmd BufNewFile,BufRead *.mako setf mako
" Plist
autocmd BufReadPre,FileReadPre *.plist set binary ft=plist syntax=xml
autocmd BufReadPost *.plist call MyBinaryPlistReadPost()
autocmd FileReadPost *.plist call MyBinaryPlistReadPost() | let b:saveAsBinaryPlist = 0
autocmd BufWritePre,FileWritePre *.plist call MyBinaryPlistWritePre()
autocmd BufWritePost,FileWritePost *.plist call MyBinaryPlistWritePost()
endif
" User customizations are held in file ~/.vim/vimrc.local
if filereadable($HOME."/.vim/vimrc.local")
source $HOME/.vim/vimrc.local
endif
" vim: set ts=4 sw=4 tw=78 ft=vim :