Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set nocompatible " We don't want vi compatibility.
- filetype on " Automatically detect file types.
- " Add recently accessed projects menu (project plugin)
- set viminfo^=!
- " maps esc to break out of autocompletion and reset to
- " original word
- inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>"
- " Minibuffer Explorer Settings
- "let g:miniBufExplMapWindowNavVim = 1
- "let g:miniBufExplMapWindowNavArrows = 1
- let g:miniBufExplMapCTabSwitchBufs=1
- let g:miniBufExplorerMoreThanOne=1
- let g:miniBufExplMaxSize=2
- let g:miniBufExplTabWrap=1
- "
- " alt+n or alt+p to navigate between entries in QuickFix
- " (this isn't working, think it's a shell thing with alt)
- map <silent> <m-p> :cp <cr>
- map <silent> <m-n> :cn <cr>
- " mapping for modified recently menu to \r
- map <silent> <Leader>r :MRU<cr>
- " Change which file opens after executing :Rails command
- let g:rails_default_file='config/database.yml'
- set cf " Enable error files & error jumping.
- set clipboard+=unnamed " Yanks go on clipboard instead.
- set history=256 " Number of things to remember in history.
- set autowrite " Writes on make/shell commands
- set ruler " Ruler on
- set nu " Line numbers on
- set nowrap " Line wrapping off
- set timeoutlen=350 " Time to wait after ESC (default causes an annoying delay)
- " Formatting (some of these are for coding in C and C++)
- set ts=2 " Tabs are 2 spaces
- set bs=2 " Backspace over everything in insert mode
- set shiftwidth=2 " Tabs under smart indent
- set softtabstop=2
- set expandtab
- set smarttab
- set autoindent
- set nocp incsearch
- set hlsearch
- set formatoptions=tcqr
- set cinoptions=:0,p0,t0
- set cinwords=if,else,while,do,for,switch,case
- set cindent
- " Visual
- set showmatch " Show matching brackets.
- set showcmd "show incomplete cmds down the bottom
- set showmode "show current mode down the bottom
- set mat=5 " Bracket blinking.
- set list
- " Show $ at end of line and trailing space as ~
- set lcs=tab:\ \ ,eol:$,trail:~,extends:>,precedes:<
- set noerrorbells " No noise.
- set laststatus=2 " Always show status line.
- " macro to automatically switch directories when opening files
- " autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9]*://" | lcd %:p:h | endif
- " easy mapping for cd to current file directory (to avoid bugs with plugins
- " that don't expect auto cd to happen)
- map <silent> ,cd :cd %:p:h<CR>
- let g:plaintex_delimiters = 0
- " color the nasty popup menu pink. doesn't always work
- "highlight Pmenu ctermbg=238 gui=bold
- highlight Pmenu ctermfg=0 ctermbg=3
- highlight PmenuSel ctermfg=0 ctermbg=7
- " cheap hack to force fuzzyfinder to reinit.
- " there's probably a right way to do this, didn't see it
- function! ResetFuzzyFinderToCWD()
- ruby @finder = nil
- let g:fuzzy_roots = [getcwd()]
- echo "Resetting FuzzyFinder root to " . getcwd()
- endfunction
- map <Leader>f :call ResetFuzzyFinderToCWD()<cr>
- " autocmd to source vimrc when it's saved
- "au! BufWritePost .vimrc source %
- autocmd BufNewFile *.as set filetype=javascript
- autocmd BufRead *.as set filetype=javascript
- nnoremap ,, :buffers<CR>:bu<space>
- " hacky thing I did to MRU that opens most recent file
- " (works mostly like <C-^> but works on closed files)
- command! BB MRURecent
- nmap ,b :BB<CR>
- " left/right arrows change buffers
- map <C-right> :bn<CR>
- map <C-left> :bp<CR>
- map <C-h> :bp<CR>
- map <C-l> :bn<CR>
- " comma+dir for directional buffer nav
- nmap ,k <C-W>k
- nmap ,j <C-W>j
- nmap ,h <C-W>h
- nmap ,l <C-W>l
- " because I hate typing C-d
- nmap <C-j> <C-d>
- nmap <C-k> <C-u>
- ",s to pull word under cursor into a search/replace (global)
- nmap ,s :%s/<c-r><c-w>//g<Left><Left>
- "allow backspacing over everything in insert mode
- set backspace=indent,eol,start
- set linebreak "wrap lines at convenient points
- "statusline setup
- set statusline+=%n: "buffer number
- set statusline+=%f "relative filename
- "display a warning if fileformat isnt unix
- "set statusline+=%#warningmsg#
- "set statusline+=%{&ff!='unix'?'['.&ff.']':''}
- "set statusline+=%*
- "display a warning if file encoding isnt utf-8
- "set statusline+=%#warningmsg#
- "set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
- "set statusline+=%*
- "set statusline+=%y "filetype
- set statusline+=%m "modified flag
- "display a warning if &et is wrong, or we have mixed-indenting
- "set statusline+=%#error#
- "set statusline+=%{StatuslineTabWarning()}
- "set statusline+=%*
- "set statusline+=%{StatuslineTrailingSpaceWarning()}
- "display a warning if &paste is set
- "set statusline+=%#error#
- "set statusline+=%{&paste?'[paste]':''}
- "set statusline+=%*
- set statusline+=%= "left/right separator
- set statusline+=%{StatuslineCurrentHighlight()}\ \ "current highlight
- set statusline+=%c, "cursor column
- set statusline+=%l/%L "cursor line/total lines
- set statusline+=\ %P "percent through file
- "recalculate the trailing whitespace warning when idle, and after saving
- autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
- "return '[\s]' if trailing white space is detected
- "return '' otherwise
- function! StatuslineTrailingSpaceWarning()
- if !exists("b:statusline_trailing_space_warning")
- if search('\s\+$', 'nw') != 0
- let b:statusline_trailing_space_warning = '[\s]'
- else
- let b:statusline_trailing_space_warning = ''
- endif
- endif
- return b:statusline_trailing_space_warning
- endfunction
- "return the syntax highlight group under the cursor ''
- function! StatuslineCurrentHighlight()
- let name = synIDattr(synID(line('.'),col('.'),1),'name')
- if name == ''
- return ''
- else
- return '[' . name . ']'
- endif
- endfunction
- "recalculate the tab warning flag when idle and after writing
- autocmd cursorhold,bufwritepost * unlet! b:statusline_tab_warning
- "return '[&et]' if &et is set wrong
- "return '[mixed-indenting]' if spaces and tabs are used to indent
- "return an empty string if everything is fine
- function! StatuslineTabWarning()
- if !exists("b:statusline_tab_warning")
- let tabs = search('^\t', 'nw') != 0
- let spaces = search('^ ', 'nw') != 0
- if tabs && spaces
- let b:statusline_tab_warning = '[mixed-indenting]'
- elseif (spaces && !&et) || (tabs && &et)
- let b:statusline_tab_warning = '[&et]'
- else
- let b:statusline_tab_warning = ''
- endif
- endif
- return b:statusline_tab_warning
- endfunction
- "folding settings
- set foldmethod=indent "fold based on indent
- set foldnestmax=3 "deepest fold is 3 levels
- set nofoldenable "dont fold by default
- set wildmode=list:longest "make cmdline tab completion similar to bash
- set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
- set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
- "display tabs and trailing spaces
- set listchars=tab:\ \ ,extends:>,precedes:<
- set formatoptions-=o "dont continue comments when pushing o/O
- "vertical/horizontal scroll off settings
- set scrolloff=3
- set sidescrolloff=7
- set sidescroll=1
- "load ftplugins and indent files
- filetype plugin on
- filetype indent on
- "turn on syntax highlighting
- syntax on
- set t_Co=256
- "hide buffers when not displayed
- set hidden
- "dont load csapprox if we no gui support - silences an annoying warning
- if !has("gui")
- let g:CSApprox_loaded = 1
- else
- if has("gui_gnome")
- set term=gnome-256color
- syntax on
- else
- set guitablabel=%M%t
- set lines=40
- set columns=115
- endif
- if has("gui_mac") || has("gui_macvim")
- set guifont=Monaco:h16
- endif
- if has("gui_win32") || has("gui_win32s")
- set guifont=Consolas:h12
- set enc=utf-8
- endif
- endif
- set mousehide " Hide mouse after chars typed
- set mouse=a " Mouse in all modes
- set guioptions-=r
- set guioptions-=R
- set guioptions-=l
- set guioptions-=L
- set guioptions-=T
- " note for whatever reason ttymouse must be set after term is set
- " or it will cause problems with the terminal
- set ttymouse=xterm2
- nmap <silent> <Leader>p :NERDTreeToggle<CR>
- nnoremap <silent> ,f :NERDTreeToggle<CR>
- "make <c-l> clear the highlight as well as redraw
- "nnoremap <C-L> :nohls<CR><C-L>
- "inoremap <C-L> <C-O>:nohls<CR>
- "map to fuzzy finder text mate stylez
- nnoremap <c-f> :FuzzyFinderTextMate<CR>
- "map Q to something useful
- noremap <silent> Q :bd<CR>
- "make Y consistent with C and D
- nnoremap Y y$
- "visual search mappings
- function! s:VSetSearch()
- let temp = @@
- norm! gvy
- let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
- let @@ = temp
- endfunction
- vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR>
- vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR>
- "jump to last cursor position when opening a file
- "dont do it when writing a commit log entry
- autocmd BufReadPost * call SetCursorPosition()
- function! SetCursorPosition()
- if &filetype !~ 'commit\c'
- if line("'\"") > 0 && line("'\"") <= line("$")
- exe "normal g`\""
- endif
- end
- endfunction
- "define :HighlightExcessColumns command to highlight the offending parts of
- "lines that are "too long". where "too long" is defined by &textwidth or an
- "arg passed to the command
- command! -nargs=? HighlightExcessColumns call s:HighlightExcessColumns('<args>')
- function! s:HighlightExcessColumns(width)
- let targetWidth = a:width != '' ? a:width : &textwidth
- if targetWidth > 0
- exec 'match Todo /\%>' . (targetWidth+1) . 'v/'
- else
- echomsg "HighlightExcessColumns: set a &textwidth, or pass one in"
- endif
- endfunction
- " akitaonrails vimfies suggestions
- let g:fuzzy_ignore = "gems/*"
- " command to get urls
- let g:netrw_http_cmd = "wget -q -O"
- "colorscheme brookstream
- "colorscheme wombat
- colorscheme vilight
- "colorscheme vividchalk
- "colorscheme desert256
- "colorscheme fnaqevan " like dante but more pastel and less contrast
- " colorscheme dante " orange/blue/green, med contrast
- " colorscheme neverness " gray/blue/green, med contrast
- " colorscheme vibrantink " multi, high contrast
- " colorscheme blacksea " multi, high contrast
- " colorscheme darkdot " gray bg, blue/grayish, med/high contrast
- " colorscheme camo " browns/greens
- "colorscheme chlordane " greens/grays
- "colorscheme jammy " gray, pastel
- "colorscheme metacosm " high contrast
Advertisement
Add Comment
Please, Sign In to add comment