Created
August 17, 2015 23:48
-
-
Save zerotao/80e11b3cbad141e020fb 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
" vim:ft=vim:fdm=marker | |
" | |
" Author: Jason L. Shiffer | |
" Email: jshiffer@gmail.com | |
" Copyright: Public Domain 2010 | |
" Packages {{{ | |
" | |
filetype on " a fix for stock OSX | |
filetype off " required by vundle | |
if has('vim_starting') | |
set nocompatible | |
" set rtp+=~/.vim/bundle/vundle/ | |
set rtp+=~/.vim/bundle/neobundle.vim/ | |
endif | |
" call vundle#rc() | |
" Bundle 'gmarik/vundle' | |
call neobundle#begin(expand('~/.vim/bundle/')) | |
NeoBundleFetch 'Shougo/neobundle.vim' | |
NeoBundle 'Shougo/vimproc' | |
NeoBundle 'Shougo/vimshell.vim' | |
NeoBundle 'Shougo/neocomplete.vim' | |
NeoBundle 'Shougo/unite.vim' | |
NeoBundle 'Shougo/neomru.vim' | |
NeoBundle 'Shougo/neosnippet' | |
NeoBundle 'Shougo/neosnippet-snippets' | |
NeoBundle 'Shougo/context_filetype.vim' | |
NeoBundle 'Shougo/neoinclude.vim' | |
NeoBundle 'Shougo/unite-help' | |
" unite plugins | |
NeoBundle 'tsukkee/unite-tag' | |
NeoBundle 'tpope/vim-unimpaired' | |
NeoBundle 'tpope/vim-surround' | |
NeoBundle 'tpope/vim-repeat' | |
NeoBundle 'tpope/vim-fugitive' | |
NeoBundle 'tpope/vim-git' | |
NeoBundle 'brauner/vimtux' | |
" Language/Syntax Support {{{ | |
NeoBundle 'vim-scripts/cmake.vim' | |
NeoBundle 'kchmck/vim-coffee-script' | |
NeoBundle 'jimenezrick/vimerl' | |
NeoBundle 'romanvbabenko/vim-asciidoc' | |
NeoBundle 'cakebaker/scss-syntax.vim' | |
NeoBundle 'othree/html5.vim' | |
NeoBundle 'vim-scripts/c.vim' | |
NeoBundle 'jnwhiteh/vim-golang' | |
NeoBundle 'nono/vim-handlebars' | |
NeoBundle 'mrk21/yaml-vim' | |
NeoBundle 'mitsuhiko/vim-jinja' | |
NeoBundle 'markcornick/vim-terraform' | |
" NeoBundle 'neilhwatson/vim_cf3' " cfengine policy syntax | |
" }}} | |
NeoBundle 'haya14busa/incsearch.vim' | |
NeoBundle 'dkasak/manpageview' " better manpage viewer | |
NeoBundle 'airblade/vim-gitgutter' " show git diff in the gutter | |
NeoBundle 'majutsushi/tagbar' " tags sidebar | |
NeoBundle 'vim-scripts/bufexplorer.zip' " explore buffers | |
NeoBundle 'rgarver/Kwbd.vim' " delete buffer without closing the window | |
NeoBundle 'scrooloose/nerdtree' " directory browser | |
NeoBundle 'jistr/vim-nerdtree-tabs' " make nerdtree work well with tabs | |
NeoBundle 'vim-scripts/taglist.vim' " tag viewer | |
NeoBundle 'sjl/gundo.vim' "visualize the undo tree | |
NeoBundle 'sfiera/vim-emacsmodeline' " interpret emacs modelines | |
NeoBundle 'Lokaltog/vim-easymotion' " window motion keys | |
NeoBundle 'scrooloose/nerdcommenter' " code commenting | |
NeoBundle 'godlygeek/tabular' " align text | |
NeoBundle 'vim-scripts/sessionman.vim' " session management | |
" NeoBundle 'kien/ctrlp.vim' " Full path fuzzy file, buffer, mru, tag, ... finder | |
NeoBundle 'Lokaltog/vim-powerline' " more functional vim statuslines | |
NeoBundle 'vim-scripts/MPage' " split a file across multiple windows | |
NeoBundle 'vim-scripts/sudo.vim' | |
" NeoBundle 'vimwiki/vimwiki' " wiki / journal | |
" NeoBundle 'mattn/calendar-vim' " vim sidebar calendar | |
" | |
" Snipmate {{{ | |
NeoBundle 'tomtom/tlib_vim' " support library | |
NeoBundle 'MarcWeber/vim-addon-mw-utils' " support library | |
NeoBundle 'garbas/vim-snipmate' " snippits | |
" }}} | |
" NeoBundle 'vim-scripts/SuperTab' | |
" NeoBundle 'kana/vim-fakeclip' " CUI <-> GUI clipboard | |
" NeoBundle 'thanthese/Tortoise-Typing' | |
" NeoBundle 'L9' " vimscript Utility library | |
" NeoBundle 'FuzzyFinder' " find files, buffers, etc | |
" NeoBundle 'junegunn/goyo.vim' " distraction free writing | |
" NeoBundle 'scrooloose/syntastic' | |
" NeoBundle 'tomtom/tcomment_vim' | |
NeoBundle 'brookhong/cscope.vim' | |
call neobundle#end() | |
NeoBundleCheck | |
" }}} | |
" Documentation {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" }}} | |
" | |
" General {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" let mapleader="," " set the mapleader before any mappings are created | |
set title " set the title of the terminal | |
set visualbell " my desk mates hate the 'bing' ;) | |
set history=300 " limit history | |
set titleold="" | |
set cmdheight=2 " extend the cmd window at the bottom to 2 lines | |
set modelines=2 | |
set backupdir=~/.vim/backup/ | |
set backup | |
set directory=~/.vim/swap// | |
set viminfo+=n~/.vim/viminfo | |
set undodir=~/.vim/undo// | |
set undofile | |
set cryptmethod=blowfish | |
if has("multi_byte") | |
if &termencoding == "" | |
let &termencoding = &encoding | |
endif | |
set encoding=utf-8 | |
setglobal fileencoding=utf-8 | |
" set fileencodings=ucs-bom,utf-8,latin1 | |
set fileencodings=utf-8,latin1 | |
set nobomb | |
endif | |
if has("spell") | |
map <F10> :set spell!<CR><Bar>:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)<CR> | |
highlight PmenuSel ctermfg=black ctermbg=lightgray | |
set spellsuggest=best,10 | |
endif | |
" }}} | |
" Colors and Fonts {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
syntax on | |
set background=dark | |
colorscheme jellybeans | |
" | |
" if has("gui") | |
set cursorline | |
" endif | |
" set cursorcolumn | |
let g:lisp_rainbow=1 | |
" }}} | |
" Text and Indenting {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
set tabstop=4 " Default tabs to 4 columns | |
set shiftwidth=4 " <<, >> count for 4 columns | |
set softtabstop=4 " <tab> key is 4 columns | |
set expandtab " expand tabs by default | |
set shiftround " round >,< to multiple of shiftwidth | |
set autoindent | |
set smartindent | |
" set copyindent | |
set preserveindent | |
set list | |
set backspace=start,eol,indent | |
set nopaste " I can turn on paste myself (and it screws up indenting) | |
set ruler | |
set textwidth=0 "do not reformat my code automaticly please | |
set relativenumber | |
"set linebreak | |
set nowrap " do not wrap lines for me | |
set encoding=utf8 | |
set listchars=tab:❘-,trail:·,nbsp:×,extends:»,precedes:« | |
" }}} | |
" Folding {{{ | |
set foldmethod=marker " default fold with markers | |
set foldlevelstart=99 " default fold everything on open | |
set foldnestmax=1 " only fold one level deep | |
" spacebar toggles folding | |
" nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR> | |
" vnoremap <Space> zf | |
" }}} | |
" Visual mode {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" set clipboard=unnamed | |
" }}} | |
" Command mode {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" }}} | |
" Movement {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" }}} | |
" Search {{{ | |
set hlsearch " highlight my search | |
let g:incsearch#auto_nohlsearch = 1 | |
map n <Plug>(incsearch-nohl-n) | |
map N <Plug>(incsearch-nohl-N) | |
map * <Plug>(incsearch-nohl-*) | |
map # <Plug>(incsearch-nohl-#) | |
map g* <Plug>(incsearch-nohl-g*) | |
map g# <Plug>(incsearch-nohl-g#) | |
map / <Plug>(incsearch-forward) | |
map ? <Plug>(incsearch-backward) | |
map g/ <Plug>(incsearch-stay) | |
" clear highlighting | |
noremap <silent> <C-L> :noh<CR>:redraw!<CR>:syntax sync fromstart<CR> | |
set ignorecase " case insensitive search | |
set smartcase " ignore case unless it includes uppercase | |
set incsearch " search incrementally | |
" }}} | |
" Session List {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
set sessionoptions=blank,buffers,curdir,folds,tabpages,winsize | |
nmap <Leader>sl :SessionList<CR> | |
nmap <Leader>ss :SessionSave<CR> | |
" }}} | |
" Unite {{{ | |
nmap <Leader>uu :Unite | |
nmap <Leader>ug :Unite -start-insert file_rec/git buffer<CR> | |
nmap <Leader>uf :Unite -start-insert file_rec/async buffer<CR> | |
call unite#filters#matcher_default#use(['matcher_fuzzy']) | |
" call unite#custom#source('file_rec,file_rec/async', 'matchers', ['converter_relative_word', 'matcher_default', 'matcher_hide_hidden_files']) | |
call unite#custom#profile('default', 'context', { | |
\ 'start_insert': 0, | |
\ 'winheight': 10, | |
\ 'direction': 'botright', | |
\ }) | |
" | |
" }}} | |
" NeoComplete {{ | |
let g:acp_enableAtStartup = 0 | |
let g:neocomplete#enable_at_startup = 0 | |
" Use smartcase. | |
let g:neocomplete#enable_smart_case = 1 | |
" Set minimum syntax keyword length. | |
let g:neocomplete#sources#syntax#min_keyword_length = 3 | |
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' | |
" fallback to omnifunc | |
let g:neocomplete#fallback_mappings = ["\<C-x>\<C-o>", "\<C-x>\<C-n>"] | |
" Define dictionary. | |
let g:neocomplete#sources#dictionary#dictionaries = { | |
\ 'default' : '', | |
\ 'vimshell' : $HOME.'/.vimshell_hist', | |
\ 'scheme' : $HOME.'/.gosh_completions' | |
\ } | |
" Define keyword. | |
if !exists('g:neocomplete#keyword_patterns') | |
let g:neocomplete#keyword_patterns = {} | |
endif | |
let g:neocomplete#keyword_patterns['default'] = '\h\w*' | |
" Plugin key-mappings. | |
inoremap <expr><C-g> neocomplete#undo_completion() | |
inoremap <expr><C-l> neocomplete#complete_common_string() | |
" Recommended key-mappings. | |
" <CR>: close popup and save indent. | |
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> | |
function! s:my_cr_function() | |
return neocomplete#close_popup() . "\<CR>" | |
" For no inserting <CR> key. | |
"return pumvisible() ? neocomplete#close_popup() : "\<CR>" | |
endfunction | |
" <TAB>: completion. | |
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
" <C-h>, <BS>: close popup and delete backword char. | |
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>" | |
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>" | |
inoremap <expr><C-y> neocomplete#close_popup() | |
inoremap <expr><C-e> neocomplete#cancel_popup() | |
inoremap <expr><Esc> neocomplete#cancel_popup() . "\<Esc>" | |
" Close popup by <Space>. | |
"inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>" | |
" Enable omni completion. | |
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags | |
" Enable heavy omni completion. | |
if !exists('g:neocomplete#sources#omni#input_patterns') | |
let g:neocomplete#sources#omni#input_patterns = {} | |
endif | |
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::' | |
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)' | |
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' | |
" For perlomni.vim setting. | |
" https://github.com/c9s/perlomni.vim | |
" let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::' | |
" }}} | |
" Hexmode {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" ex command for toggling hex mode - define mapping if desired | |
command! -bar Hexmode call ToggleHex() | |
" helper function to toggle hex mode | |
function! ToggleHex() | |
" hex mode should be considered a read-only operation | |
" save values for modified and read-only for restoration later, | |
" and clear the read-only flag for now | |
let l:modified=&mod | |
let l:oldreadonly=&readonly | |
let &readonly=0 | |
let l:oldmodifiable=&modifiable | |
let &modifiable=1 | |
if !exists("b:editHex") || !b:editHex | |
" save old options | |
let b:oldft=&ft | |
let b:oldbin=&bin | |
" set new options | |
setlocal binary " make sure it overrides any textwidth, etc. | |
silent :e " this will reload the file without trickeries | |
"(DOS line endings will be shown entirely ) | |
let &ft="xxd" | |
" set status | |
let b:editHex=1 | |
" switch to hex editor | |
%!xxd | |
else | |
" restore old options | |
let &ft=b:oldft | |
if !b:oldbin | |
setlocal nobinary | |
endif | |
" set status | |
let b:editHex=0 | |
" return to normal editing | |
%!xxd -r | |
endif | |
" restore values for modified and read only state | |
let &mod=l:modified | |
let &readonly=l:oldreadonly | |
let &modifiable=l:oldmodifiable | |
endfunction | |
" }}} | |
" Tabular {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
nmap <Leader>a& :Tabularize /&<CR> | |
vmap <Leader>a& :Tabularize /&<CR> | |
nmap <Leader>a= :Tabularize /=<CR> | |
vmap <Leader>a= :Tabularize /=<CR> | |
nmap <Leader>a: :Tabularize /:<CR> | |
vmap <Leader>a: :Tabularize /:<CR> | |
nmap <Leader>a:: :Tabularize /::<CR> | |
vmap <Leader>a:: :Tabularize /::<CR> | |
nmap <Leader>a, :Tabularize /,<CR> | |
vmap <Leader>a, :Tabularize /,<CR> | |
nmap <Leader>a<Bar> :Tabularize /<Bar><CR> | |
vmap <Leader>a<Bar> :Tabularize /<Bar><CR> | |
" }}} | |
" Tabs and Buffers {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
set hidden " just hide buffers when switching away from their window do not close the file | |
nnoremap <Leader>tc :tabnew<CR> | |
nnoremap <Leader>tk :tabclose<CR> | |
nnoremap <Leader>tp :tabprevious<CR> | |
nnoremap <Leader>tn :tabnext<CR> | |
nnoremap <Leader>tf :tabfirst<CR> | |
nnoremap <Leader>tl :tablast<CR> | |
nnoremap <C-Right> :tabnext<CR> | |
nnoremap <C-Left> :tabprevious<CR> | |
nnoremap <Leader>vsn :VimShell<CR> | |
nnoremap <Leader>vst :VimShellTab<CR> | |
nnoremap <Leader>vss :split<CR><C-w>w :VimShell<CR> | |
" nnoremap <right> :bn<CR> | |
" nnoremap <left> :bp<CR> | |
" try | |
" nunmap <Right> | |
" nunmap <Left> | |
" nunmap <Up> | |
" nunmap <Down> | |
" catch | |
" endtry | |
" }}} | |
" Character Matching (parens and brackets) {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" }}} | |
" Abbrevs {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
iabbrev abuuid <C-R>=tolower(matchstr(system("uuidgen"), "[^\n\r]*"))<CR> | |
iabbrev abdatetime <C-R>=strftime("%FT%T%z")<CR> | |
iabbrev abdate <C-R>=strftime("%F")<CR> | |
iabbrev abtime <C-R>=strftime("%T")<CR> | |
iabbrev abdt <C-R>=strftime("%b %d, %Y")<CR> | |
" }}} | |
" QuickFix {{{ | |
function! GetBufferList() | |
redir =>buflist | |
silent! ls | |
redir END | |
return buflist | |
endfunction | |
function! ToggleList(bufname, pfx) | |
let buflist = GetBufferList() | |
for bufnum in map(filter(split(buflist, '\n'), 'v:val =~ "'.a:bufname.'"'), 'str2nr(matchstr(v:val, "\\d\\+"))') | |
if bufwinnr(bufnum) != -1 | |
exec(a:pfx.'close') | |
return | |
endif | |
endfor | |
if a:pfx == 'l' && len(getloclist(0)) == 0 | |
echohl ErrorMsg | |
echo "Location List is Empty." | |
return | |
endif | |
let winnr = winnr() | |
exec(a:pfx.'open') | |
" if winnr() != winnr | |
" wincmd p | |
" endif | |
if winnr() == winnr | |
wincmd n | |
endif | |
endfunction | |
nmap <silent> <leader>ll :call ToggleList("Location List", 'l')<CR> | |
nmap <silent> <leader>lf :call ToggleList("Quickfix List", 'c')<CR> | |
" }}} | |
" General Mappings {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" Mirror(Reverse) Word | |
vnoremap <Leader>rv c<C-O>:set revins<CR><C-R>"<Esc>:set norevins<CR> | |
" }}} | |
" Plugins {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
" set g:secure_modelines_verbose=1 | |
set wildmenu " Show list instead of just completing | |
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all. | |
" VikiTasks {{{ | |
" let g:vikitasks#intervikis=1 | |
" }}} | |
" Gtags {{{ | |
nnoremap <silent> <Leader>gg :Ggrep <C-R>=expand("<cword>")<CR><CR><CR>:call ToggleList("Quickfix List", 'c')<CR> | |
nnoremap <silent> <Leader>gt :Gtags <C-R>=expand("<cword>")<CR><CR> | |
let GtagsCscope_Auto_Map = 1 | |
" }}} | |
" Cscope {{{ | |
if has('cscope') | |
set cscopetag cscopeverbose | |
if has('quickfix') | |
set cscopequickfix=s-,c-,d-,i-,t-,e- | |
endif | |
endif | |
" }}} | |
" Omni Completion {{{ | |
if has("autocmd") && exists("+omnifunc") | |
autocmd Filetype * | |
\if &omnifunc == "" | | |
\setlocal omnifunc=syntaxcomplete#Complete | | |
\endif | |
endif | |
" hi Pmenu guifg=#000000 guibg=#F8F8F8 ctermfg=black ctermbg=Lightgray | |
" hi PmenuSbar guifg=#8A95A7 guibg=#F8F8F8 gui=NONE ctermfg=darkcyan ctermbg=lightgray cterm=NONE | |
" hi PmenuThumb guifg=#F8F8F8 guibg=#8A95A7 gui=NONE ctermfg=lightgray ctermbg=darkcyan cterm=NONE | |
" Some convenient mappings | |
inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>" | |
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | |
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>" | |
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>" | |
inoremap <expr> <C-d> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<C-d>" | |
inoremap <expr> <C-u> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<C-u>" | |
" Automatically open and close the popup menu / preview window | |
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif | |
set completeopt=menu,preview,menuone | |
" }}} | |
" VCS {{{ | |
" If this is enabled then look at the statusline above | |
" let VCSCommandEnableBufferSetup=1 " slows down startup toooooo much | |
augroup VCSCommand | |
au User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr> | |
augroup END | |
" }}} | |
" Erlang {{{ | |
let g:erlang_man_path='/usr/local/share/man' | |
let g:erlang_folding = 1 | |
" nmap <Leader>ec <Plug>ExecuteKeysEc :call ExecuteKeys("c().") | |
" }}} | |
" Fugative {{{ | |
noremap <F5> :GundoToggle<CR> | |
" }}} | |
" NERDTree {{{ | |
noremap <special> <F2> :NERDTreeMirrorToggle<CR> | |
noremap <Leader>nt :NERDTreeTabsToggle<CR> | |
noremap <Leader>nf :NERDTreeFocus<CR> | |
" }}} | |
" NERDCommenter {{{ | |
let NERDSpaceDelims=1 " make sure there is a space around commented code | |
" }}} | |
" tcomment {{{ | |
" call tcomment#DefineType('cmake', '# %s') | |
" call tcomment#DefineType('lua', '-- %s') | |
" call tcomment#DefineType('lisp', '; %s') | |
" }}} | |
" Tag List {{{ | |
noremap <special> <F3> :TlistToggle<CR> | |
let Tlist_Close_On_Select=1 | |
let Tlist_GainFocus_On_ToggleOpen=1 | |
" }}} | |
" Tag Bar {{{ | |
noremap <special> <F4> :TagbarToggle<CR> | |
let g:tagbar_autoclose = 1 | |
let g:tagbar_left = 1 | |
let g:tagbar_usearrows = 1 | |
let g:tagbar_autofocus = 1 | |
let g:tagbar_autoshowtag = 1 | |
" }}} | |
" Fuzzy Find {{{ | |
" let g:fuf_mrufile_maxItem = 300 | |
" let g:fuf_mrucmd_maxItem = 400 | |
" " noremap <silent> g] :FufTagWithCursorWord!<CR> | |
" nnoremap <silent> <Leader>ff :FufFileWithCurrentBufferDir<CR> | |
" nnoremap <silent> <Leader>fd :FufDirWithCurrentBufferDir<CR> | |
" nnoremap <silent> <Leader>fb :FufBuffer<CR> | |
" nnoremap <silent> <Leader>fh :FufHelp<CR> | |
" nnoremap <silent> <Leader>fc :FufMruCmd<CR> | |
" nnoremap <silent> <Leader>fB :FufBookmark<CR> | |
" nnoremap <silent> <Leader>ft :FufTagWithCursorWord<CR> | |
" nnoremap <silent> <Leader>fT :FufTaggedFile<CR> | |
" nnoremap <silent> <Leader>fj :FufJumpList<CR> | |
" nnoremap <silent> <Leader>fC :FufChangeList<CR> | |
" nnoremap <silent> <Leader>fl :FufLine<CR> | |
" }}} | |
" easymotion {{{ | |
hi EasyMotionTarget ctermbg=none ctermfg=white | |
" hi EasyMotionShade ctermbg=none ctermfg= | |
" }}} | |
" Snippets {{{ | |
let g:snips_author = 'Jason L. Shiffer <jshiffer@zerotao.org>' | |
let g:snips_company = 'Jason L. Shiffer' | |
let g:snips_copyright = g:snips_company | |
" Plugin key-mappings. | |
" imap <C-i> <Plug>(neosnippet_expand_or_jump) | |
" smap <C-i> <Plug>(neosnippet_expand_or_jump) | |
" xmap <C-i> <Plug>(neosnippet_expand_target) | |
" " SuperTab like snippets behavior. | |
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: pumvisible() ? "\<C-n>" : "\<TAB>" | |
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: "\<TAB>" | |
" Enable snipMate compatibility feature. | |
let g:neosnippet#enable_snipmate_compatibility = 1 | |
" Tell Neosnippet about the other snippets | |
let g:neosnippet#snippets_directory='~/.vim/bundle/neosnippet-snippets/neosnippets/' | |
" }}} | |
" Abbreviations {{{ | |
iab anauthor Jason L. Shiffer <jshiffer@assurenet.us> | |
iab ancorp Assurenet, Inc. | |
iab author Jason L. Shiffer <jshiffer@zerotao.org> | |
iab ztcauthor Jason L. Shiffer <jshiffer@zerotao.com> | |
iab zcorp Zero Tao Software, LLC. | |
" }}} | |
" BufExplorer {{{ | |
let g:bufExplorerFindActive=0 | |
" }}} | |
" FSwitch {{{ | |
" nmap <silent> <Leader>of :FSHere<cr> | |
" nmap <silent> <Leader>ol :FSRight<cr> | |
" nmap <silent> <Leader>oL :FSSplitRight<cr> | |
" nmap <silent> <Leader>oh :FSLeft<cr> | |
" nmap <silent> <Leader>oH :FSSplitLeft<cr> | |
" nmap <silent> <Leader>ok :FSAbove<cr> | |
" nmap <silent> <Leader>oK :FSSplitAbove<cr> | |
" nmap <silent> <Leader>oj :FSBelow<cr> | |
" nmap <silent> <Leader>oJ :FSSplitBelow<cr> | |
" }}} | |
" Utl {{{ | |
" if has("macunix") | |
let g:utl_cfg_hdl_scm_http_system='silent !open "%u"' | |
let g:utl_cfg_hdl_scm_mt_system='silent !open "%u"' | |
" endif | |
"" }}} | |
" Kwbd {{{ | |
nmap <C-W>! <Plug>Kwbd | |
" }}} | |
" LustyExplorer {{{ | |
" let g:LustyExplorerSuppressRubyWarning = 1 | |
" }}} | |
" Vim Shell {{{ | |
let g:vimshell_user_prompt='substitute(getcwd(),eval("$HOME"),"~","")' | |
" let g:vimshell_right_prompt='vcs#info("(%s)=[%b]", "(%s)-[%b|%a]")' | |
let g:vimshell_prompt='$ ' | |
let g:vimshell_enable_smart_case=1 | |
" }}} | |
" Vimwiki {{{ | |
let wiki_1 = {} | |
let wiki_1.path = '~/.vimwiki/' | |
let wiki_1.index = 'main' | |
let g:vimwiki_list = [wiki_1] | |
let g:vimwiki_use_calendar = 1 | |
" }}} | |
" Tmux {{{ | |
vmap <C-c><C-c> <Plug>SendSelectionToTmux | |
nmap <C-c><C-c> <Plug>NormalModeSendToTmux | |
nmap <C-c>r <Plug>SetTmuxVars | |
" }}} | |
" }}} | |
" Compiler Settings {{{ | |
" Ignore libtool output with version info | |
let &errorformat="%-G%.%#libtool%.%#version-info%.%#,".&errorformat | |
" }}} | |
" Functions {{{ | |
"""""""""""""""""""""""""""""""""""""""" | |
" diff against on disk version | |
if !exists(":DiffOrig") | |
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis | |
endif | |
if !exists(":Uncrustify") | |
command! -range -bang -nargs=0 Uncrustify <line1>,<line2>!uncrustify --frag -c ~/.uncrustify.cfg -lC -q | |
endif | |
if has("unix") | |
let s:uname = substitute(system("uname"), "\n", "", "g") | |
if s:uname == "Darwin" | |
let Tlist_Ctags_Cmd = "/usr/local/bin/ctags" | |
let g:tagbar_ctags_bin="/usr/local/bin/ctags" | |
endif | |
endif | |
" }}} | |
" StatusLine {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
let g:git_branch_status_head_current=1 | |
let g:git_branch_status_text="" | |
" let g:git_branch_status_around="" | |
if has("statusline") | |
set laststatus=2 | |
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P | |
endif | |
try | |
set switchbuf=usetab | |
set laststatus=2 | |
catch | |
endtry | |
" }}} | |
" local vimrc {{{ | |
let g:local_vimrc = '.vimrc' | |
" }}} | |
" Syntastic {{{ | |
" let g:systastic_c_check_header = 1 | |
" }}} | |
" cmaps {{{ | |
" allow saving as root when I forget to start vim with sudo | |
cmap w!! w !sudo tee > /dev/null % | |
" }}} | |
" Files {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
filetype off | |
filetype plugin indent off | |
set runtimepath+=$GOROOT/misc/vim | |
filetype plugin indent on | |
syntax on | |
set fileformats=unix,dos,mac | |
" convert spaces to tabs when reading file | |
" autocmd! bufreadpost * set noexpandtab | retab! 4 | |
" | |
" " convert tabs to spaces before writing file | |
" autocmd! bufwritepre * set expandtab | retab! 4 | |
" | |
" " convert spaces to tabs after writing file (to show guides again) | |
" autocmd! bufwritepost * set noexpandtab | retab! 4 | |
" }}} | |
" Auto Commands {{{ | |
""""""""""""""""""""""""""""""""""""""" | |
if !exists("autocommands_loaded") | |
let autocommands_loaded=1 | |
au BufEnter * :syntax sync minlines=200 | |
au BufNewFile,BufRead *.m set ft=objc | |
au BufNewFile,BufRead *.txt set ft=rst textwidth=78 | |
au BufNewFile,BufRead *.[e|h]rl setlocal softtabstop=4 shiftwidth=4 tabstop=4 iskeyword+=: complete=.,w,b,u,t,i,k dictionary=~/.vim/dict/erlang.dict | |
au BufNewFile,BufRead *.py setlocal expandtab foldmethod=indent tabstop=4 | |
au BufWritePre *.py set expandtab | retab! 4 | |
au BufNewFile,BufRead *.[ch] set expandtab cindent foldmethod=syntax foldlevelstart=99 | |
au BufNewFile,BufRead *.cmake,CMakeLists.txt set ft=cmake | |
au BufNewFile,BufRead *.rsn set expandtab ft=reason | |
au BufNewFile,BufRead *.yml setlocal expandtab ft=yaml expandtab shiftwidth=2 softtabstop=2 | |
au BufNewFile,BufRead *.j2 setlocal ft=jinja | |
au BufNewFile,BufRead *.lua setlocal expandtab | |
au BufNewFile,BufRead *.md set ft=markdown | |
au BufNewFile,BufRead *.viki set ft=viki | |
au BufNewFile,BufRead *.html,*.hbs,*.handlebars,*.js,*.json setlocal shiftwidth=2 softtabstop=2 tabstop=2 | |
au BufNewFile,BufRead *.wiki setlocal textwidth=80 | |
au BufNewFile,BufRead COMMIT_EDITMSG :1 | |
au BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
" remove empty space at EOL | |
au BufWritePre * :%s/\s\+$//e | |
" disable cursorline in windows we are not in | |
au WinEnter * if exists('w:last_cursorline') | let &l:cursorline=w:last_cursorline | unlet w:last_cursorline | endif | |
au WinLeave * if !exists('w:last_cursorline') | let w:last_cursorline=&cursorline | setlocal nocursorline | endif | |
au FileType calendar setlocal norelativenumber | |
" Don't screw up folds when inserting text that might affect them, until | |
" leaving insert mode. Foldmethod is local to the window. Protect against | |
" screwing up folding when switching between windows. | |
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif | |
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif | |
autocmd User fugitive | |
\ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' | | |
\ nnoremap <buffer> .. :edit %:h<CR> | | |
\ endif | |
autocmd BufReadPost fugitive://* set bufhidden=delete | |
autocmd FileType go autocmd BufWritePre <buffer> Fmt | |
endif | |
" }}} | |
" Protect large files from sourcing and other overhead. | |
" Files become read only | |
if !exists("my_auto_commands_loaded") | |
let my_auto_commands_loaded = 1 | |
" Large files are > 1M | |
" Set options: | |
" eventignore+=FileType (no syntax highlighting etc | |
" assumes FileType always on) | |
" noswapfile (save copy of file) | |
" bufhidden=unload (save memory when other file is viewed) | |
" buftype=nowritefile (is read-only) | |
" undolevels=-1 (no undo possible) | |
" | |
let g:LargeFile = 1024 * 1024 * 1 | |
augroup LargeFile " {{{ | |
autocmd! | |
autocmd BufReadPre * let f=expand("<afile>") | if getfsize(f) > g:LargeFile | set eventignore+=FileType | setlocal noswapfile bufhidden=unload undolevels=-1 | else | set eventignore-=FileType | endif | |
augroup END " }}} | |
augroup reload_vimrc " {{{ | |
autocmd! | |
autocmd BufWritePost $MYVIMRC source $MYVIMRC | |
augroup END " }}} | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment