Created
August 25, 2008 23:49
-
-
Save halorgium/7181 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if v:progname =~? "evim" | |
finish | |
endif | |
"core vim options {{{1 | |
" Use Vim settings, rather then Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
" allow backspacing over everything in insert mode | |
set backspace=indent,eol,start | |
set autoindent | |
syntax on | |
set hlsearch | |
if has("vms") | |
set nobackup " do not keep a backup file, use versions instead | |
else | |
set backup " keep a backup file | |
endif | |
set history=50 " keep 50 lines of command line history | |
set showcmd " display incomplete commands | |
set incsearch " do incremental searching | |
set nowrap " turn wordwrap off | |
set statusline=%<%t\ [%{strlen(&fenc)?&fenc:'none'},%{strlen(&ff)?&ff:'none'}]%h%m%r%y\ %=%c,%l/%L\ %P | |
set rulerformat=%60(%=%t\ %c,%l/%L\ %P%) | |
set showmode " mode is shown on stat line | |
set ls=2 " status line always on | |
set sw=4 | |
set sts=4 | |
"set nows | |
set foldmethod=indent | |
set foldnestmax=2 | |
set nofoldenable | |
set expandtab | |
set wildmode=list:longest | |
let &updatetime=1000 | |
let &mousemodel='popup' | |
set linebreak | |
"set path=.,** | |
"set ignorecase | |
"set smartcase | |
set guitablabel=%N\ %t | |
set dictionary+=/usr/share/dict/words | |
set t_Co=256 | |
set completeopt-=menu | |
set scrolloff=3 "keep >= 3 lines above/below the cursor | |
set formatoptions-=o "dont continue comments when push o/O on a comment line | |
set wildmenu | |
"some stuff to get the mouse going in term | |
set mouse=a | |
set ttymouse=xterm2 | |
set mousetime=750 | |
" Select colormap: 'soft', 'softlight', 'standard' or 'allblue' | |
let xterm16_colormap = 'softlight' | |
"let xterm16_colormap = 'standard' | |
"let xterm16_colormap = 'soft' | |
"Select brightness: 'low', 'med', 'high', 'default' or custom levels. | |
"let xterm16_brightness = 'default' | |
"let xterm16_brightness = 'low' | |
"colo white | |
"colo autumn | |
"colo elflord | |
"colo earth | |
"colo tolerable | |
"colo metacosm | |
"colo xterm16 | |
"colo oceandeep | |
"colo desert256 | |
"colo vividchalk | |
set background=dark | |
"colo peaksea | |
colo inkpot | |
let g:filetype_pl='perl' | |
" Enable file type detection. | |
" Use the default filetype settings, so that mail gets 'tw' set to 72, | |
" 'cindent' is on in C files, etc. | |
" Also load indent files, to automatically do language-dependent indenting. | |
filetype plugin indent on | |
" When editing a file, always jump to the last known cursor position. | |
" Don't do it when the position is invalid or when inside an event handler | |
" (happens when dropping a file on gvim). | |
autocmd BufReadPost * call SetCursorPosition() | |
function! SetCursorPosition() | |
if &filetype !~ 'commit\c' | |
if line("'\"") > 0 && line("'\"") <= line("$") | |
exe "normal g`\"" | |
endif | |
end | |
endfunction | |
"}}} | |
"plugin options {{{1 | |
"Buf explorer{{{2 | |
nnoremap <c-b> :BufExplorer<cr> | |
"NERD commenter {{{2 | |
let NERDComLineToggleMap="" | |
let NERDDefaultNesting=1 | |
"}}} | |
"fuzzy finder {{{2 | |
"nnoremap <c-f> :FuzzyFinderFile **/ | |
"runtime plugin/fuzzyfinder.vim | |
"let g:FuzzyFinderOptions.File.excluded_path = '\v\~$|\.o$|\.exe$|\.bak$|\.swp$|((^|[/\\])\.[/\\]$)|\.svn\/|\.git\/|\.\.\/' | |
"}}} | |
"taglist {{{2 | |
let Tlist_Compact_Format = 1 | |
let Tlist_Enable_Fold_Column = 0 | |
let Tlist_Exit_OnlyWindow = 1 | |
let Tlist_Show_One_File = 1 | |
let Tlist_WinWidth = 40 | |
let tlist_php_settings = 'php;c:class;f:Functions' | |
nnoremap <c-t> :TlistToggle<cr> | |
"}}} | |
"NERD tree {{{2 | |
nmap <c-n> :NERDTreeToggle<cr> | |
let g:NERDTreeSortOrder = ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$'] | |
let g:NERDTreeMouseMode = 2 | |
let g:NERDTreeMapOpenSplit = 'i' | |
let g:NERDTreeWinSize = 40 | |
let g:NERDTreeWinPos = "right" | |
let g:NERDTreeChDirMode = 0 | |
so ~/projects/nerdtree/plugin/NERD_tree.vim | |
"netrw {{{2 | |
let g:netrw_list_hide='\~$' | |
let g:netrw_hide=1 | |
"surround {{{2 | |
let g:surround_indent = 1 | |
"random crap {{{1 | |
"other mappings {{{2 | |
nnoremap <BS> :set hlsearch!<cr> | |
nnoremap <C-L> :nohls<CR><C-L> | |
inoremap <C-L> <C-O>:nohls<CR> | |
inoremap <C-CR> <C-o>o | |
"stolen from godlygeek | |
exe 'vnoremap * <C-\><C-n>' | |
\.':let [@", @/] = reverse([@", @/])<CR>' | |
\.'gvy' | |
\.':let [@", @/] = reverse([@", @/])<CR>' | |
\.":let @/='\\V'.escape(@/, '\\')<CR>" | |
\.":let @/=substitute(@/, '\\n', '\\\\'.'n', 'g')<CR>" | |
\."/<CR>" | |
vmap # *?<CR>?<CR> | |
set list listchars=tab:�~V��~K~E,trail:�~K~E,nbsp:�~K~E | |
"}}} | |
au BufRead,BufNewFile,BufEnter *.erb setf eruby | |
map <f2> :call DoDiff()<cr> | |
function! DoDiff() | |
let f = expand("%") | |
exec "vnew " . expand("%:t") . ".diff" | |
silent exec ":r !git diff " . f | |
setl buftype=nofile bufhidden=delete nobuflisted nospell noswapfile | |
endfunction | |
command! -complete=customlist,AvailableTemplates -n=1 Template :call InsertTemplate('<args>') | |
function! InsertTemplate(name) | |
"read in the template | |
execute 'read ~/.vim/templates/' . &filetype . '/' . a:name | |
"if the cursor was previously on a blank line, delete it | |
if getline(line(".")-1) =~ '^\s*$' | |
exec line(".")-1 . 'd' | |
endif | |
endfunction | |
function! AvailableTemplates(lead, cmdline, cursorpos) | |
let templateDir = expand('~/.vim/templates/' . &filetype . '/') | |
let files = split(globpath(templateDir, a:lead . '*'), '\n') | |
"chop off the templateDir from each file | |
return map(files, 'strpart(v:val,strlen(templateDir))') | |
endfunction | |
command! -nargs=1 Tab call s:SetTabs('<args>') | |
function s:SetTabs(width) | |
exec "set sts=" . a:width | |
exec "set sw=" . a:width | |
endfunction | |
command! -nargs=0 Lorem :normal iLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum | |
"autocmd FileType * autocmd BufRead,BufEnter * call <sid>HighlightExcessColumns() | |
"function s:HighlightExcessColumns() | |
"if &:textwidth > 0 | |
"exec 'match Todo /\%>' . (&textwidth+1) . 'v/' | |
"endif | |
"endfunction | |
" vim: set foldmethod=marker : | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment