diff options
author | yushyin <yushyin@saga> | 2015-07-30 23:07:17 +0200 |
---|---|---|
committer | yushyin <yushyin@saga> | 2015-07-30 23:37:33 +0200 |
commit | 99f1c17274bcea036aca040642bb8377e95f6fcd (patch) | |
tree | beb1f9e3969647fa099834987e8510af037ba312 | |
download | dotfiles-99f1c17274bcea036aca040642bb8377e95f6fcd.tar.gz dotfiles-99f1c17274bcea036aca040642bb8377e95f6fcd.tar.xz |
Add vim config
-rw-r--r-- | vim/ftplugin/c.vim | 15 | ||||
-rw-r--r-- | vim/ftplugin/haskell.vim | 33 | ||||
-rw-r--r-- | vim/ftplugin/tex.vim | 4 | ||||
-rw-r--r-- | vim/neobundle.toml | 156 | ||||
-rw-r--r-- | vim/plugrc/unite.rc.vim | 7 | ||||
-rw-r--r-- | vim/vimrc | 111 |
6 files changed, 326 insertions, 0 deletions
diff --git a/vim/ftplugin/c.vim b/vim/ftplugin/c.vim new file mode 100644 index 0000000..f3f7198 --- /dev/null +++ b/vim/ftplugin/c.vim @@ -0,0 +1,15 @@ +if has('cscope') + if filereadable("cscope.out") + cs add cscope.out + endif + nnoremap [cscope] <Nop> + nmap <C-\> [cscope] + nmap [cscope]s :cs find s <C-R>=expand("<cword>")<CR><CR> + nmap [cscope]g :cs find g <C-R>=expand("<cword>")<CR><CR> + nmap [cscope]c :cs find c <C-R>=expand("<cword>")<CR><CR> + nmap [cscope]t :cs find t <C-R>=expand("<cword>")<CR><CR> + nmap [cscope]e :cs find e <C-R>=expand("<cword>")<CR><CR> + nmap [cscope]f :cs find f <C-R>=expand("<cfile>")<CR><CR> + nmap [cscope]i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> + nmap [cscope]d :cs find d <C-R>=expand("<cword>")<CR><CR> +endif diff --git a/vim/ftplugin/haskell.vim b/vim/ftplugin/haskell.vim new file mode 100644 index 0000000..99f0cd7 --- /dev/null +++ b/vim/ftplugin/haskell.vim @@ -0,0 +1,33 @@ +setlocal omnifunc=necoghc#omnifunc ts=8 sts=4 sw=4 et sr + +let g:tagbar_type_haskell = { + \ 'ctagsbin' : 'hasktags', + \ 'ctagsargs' : '-x -c -o-', + \ 'kinds' : [ + \ 'm:modules:0:1', + \ 'd:data: 0:1', + \ 'd_gadt: data gadt:0:1', + \ 't:type names:0:1', + \ 'nt:new types:0:1', + \ 'c:classes:0:1', + \ 'cons:constructors:1:1', + \ 'c_gadt:constructor gadt:1:1', + \ 'c_a:constructor accessors:1:1', + \ 'ft:function types:1:1', + \ 'fi:function implementations:0:1', + \ 'o:others:0:1' + \ ], + \ 'sro' : '.', + \ 'kind2scope' : { + \ 'm' : 'module', + \ 'c' : 'class', + \ 'd' : 'data', + \ 't' : 'type' + \ }, + \ 'scope2kind' : { + \ 'module' : 'm', + \ 'class' : 'c', + \ 'data' : 'd', + \ 'type' : 't' + \ } +\ } diff --git a/vim/ftplugin/tex.vim b/vim/ftplugin/tex.vim new file mode 100644 index 0000000..d3ea831 --- /dev/null +++ b/vim/ftplugin/tex.vim @@ -0,0 +1,4 @@ +nnoremap <expr> j v:count ? 'j' : 'gj' +vnoremap <expr> j v:count ? 'j' : 'gj' +nnoremap <expr> k v:count ? 'k' : 'gk' +vnoremap <expr> k v:count ? 'k' : 'gk' diff --git a/vim/neobundle.toml b/vim/neobundle.toml new file mode 100644 index 0000000..f91ba55 --- /dev/null +++ b/vim/neobundle.toml @@ -0,0 +1,156 @@ +[[plugins]] +repository = 'Shougo/neobundle.vim' +fetch = 1 + +[[plugins]] +repository = 'Shougo/vimproc.vim' + [plugins.build] + linux = 'make' + +[[plugins]] +repository = 'Shougo/unite.vim' +lazy = 1 + [plugins.commands] + name = 'Unite' + complete = 'customlist,unite#complete_source' + +[[plugins]] +repository = 'Shougo/neomru.vim' +lazy = 1 + [plugins.autoload] + unite_sources = 'file_mru' + +[[plugins]] +repository = 'Shougo/vimshell.vim' +lazy = 1 + [plugins.autoload] + mappings = '<Plug>' + [plugins.commands] + name = 'VimShell' + complete = 'customlist,vimshell#complete' + +[[plugins]] +repository = 'Shougo/vimfiler.vim' +lazy = 1 + [plugins.autoload] + mappings = '<Plug>' + explorer = 1 + [plugins.commands] + name = 'VimFiler' + complete = 'customlist,vimfiler#complete' + +[[plugins]] +repository = 'SirVer/ultisnips' + +[[plugins]] +repository = 'honza/vim-snippets' +lazy = 1 + [plugins.autoload] + insert = 1 + +[[plugins]] +repository = 'chriskempson/base16-vim' + +[[plugins]] +repository = 'tpope/vim-unimpaired' +lazy = 1 + [plugins.autoload] + insert = 1 + +[[plugins]] +repository = 'cespare/vim-toml' +lazy = 1 + [plugins.autoload] + filetypes = 'toml' + +[[plugins]] +repository = 'ledger/vim-ledger' +lazy = 1 + [plugins.autoload] + filename_patterns = '\.ldg$' + +[[plugins]] +repository = 'tpope/vim-fugitive' +lazy = 1 +augroup = 'fugitive' + [plugins.autoload] + commands = + ['Gstatus' + ,'Gdiff' + ,'Gwrite' + ,'Gread' + ,'Gsplit' + ,'Gvsplit' + ,'Gtabedit' + ,'Gcommit' + ,'Gblame' + ,'Gmove' + ,'Gremove' + ,'Ggrep' + ,'Glog' + ,'Gbrowse' + ,'Git' + ,'Git!'] + +[[plugins]] +repository = 'godlygeek/tabular' +lazy = 1 + [plugins.autoload] + commands = 'Tabularize' + +[[plugins]] +repository = 'majutsushi/tagbar' +lazy = 1 +augroup = 'TagbarSession' + [plugins.autoload] + commands = + ['Tagbar' + ,'TagbarToggle' + ,'TagbarOpen' + ,'TagbarOpenAutoClose'] + +[[plugins]] +repository = 'scrooloose/syntastic' +lazy = 1 +augroup = 'syntastic' + [plugins.autoload] + commands = ['SyntasticCheck', 'SyntasticInfo', 'SyntasticToogleMode'] + +[[plugins]] +repository = 'vim-scripts/a.vim' +lazy = 1 + [plugins.autoload] + filetypes = ['c', 'cpp'] + +[[plugins]] +repository = 'Rip-Rip/clang_complete.git' +lazy = 1 + [plugins.autoload] + filetypes = ['c', 'cpp'] + +[[plugins]] +repository = 'Twinside/vim-hoogle' +lazy = 1 + external_commands = 'hoogle' + [plugins.autoload] + filetypes = ['haskell', 'lhaskell', 'chaskell'] + +[[plugins]] +repository = 'eagletmt/ghcmod-vim' +lazy = 1 + external_commands = 'ghc-mod' + [plugins.autoload] + filetypes = ['haskell', 'lhaskell', 'chaskell'] + +[[plugins]] +repository = 'eagletmt/neco-ghc' +lazy = 1 + external_commands = 'ghc-mod' + [plugins.autoload] + filetypes = ['haskell', 'lhaskell', 'chaskell'] + +[[plugins]] +repository = 'rust-lang/rust.vim' +lazy = 1 + [plugins.autoload] + filetypes = 'rust' diff --git a/vim/plugrc/unite.rc.vim b/vim/plugrc/unite.rc.vim new file mode 100644 index 0000000..909c6dc --- /dev/null +++ b/vim/plugrc/unite.rc.vim @@ -0,0 +1,7 @@ +call unite#filters#matcher_default#use(['matcher_fuzzy']) +autocmd FileType unite call s:unite_my_settings() +function! s:unite_my_settings() + nmap <buffer> <C-p> <Plug>(unite_toggle_auto_preview) + imap <buffer> <C-j> <Plug>(unite_select_next_line) + imap <buffer> <C-k> <Plug>(unite_select_previous_line) +endfunction diff --git a/vim/vimrc b/vim/vimrc new file mode 100644 index 0000000..c8cc0ee --- /dev/null +++ b/vim/vimrc @@ -0,0 +1,111 @@ +set nocompatible + +" Environment http://tlvince.com/vim-respect-xdg +if !exists($XDG_CONFIG_HOME) + let $XDG_CONFIG_HOME=expand('~/.config') +endif +if !exists($XDG_DATA_HOME) + let $XDG_DATA_HOME=expand('~/.local/share') +endif +if !exists($XDG_CACHE_HOME) + let $XDG_CACHE_HOME=expand('~/.cache') +endif +set directory=$XDG_CACHE_HOME/vim//,/var/tmp//,/tmp// +set backupdir=$XDG_CACHE_HOME/vim,/var/tmp,/tmp +set viminfo+=n$XDG_CACHE_HOME/vim/viminfo +set rtp=$XDG_CONFIG_HOME/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$XDG_CONFIG_HOME/vim/after + +" NeoBundle +let s:bundle_dir = $XDG_DATA_HOME . '/vim/bundle' +let s:neobundle_dir = s:bundle_dir . '/neobundle.vim' +let s:neobundle_repo = 'https://github.com/Shougo/neobundle.vim' +let s:neobundle_toml = $XDG_CONFIG_HOME . '/vim/neobundle.toml' +let s:neobundle_plugrc = $XDG_CONFIG_HOME . '/vim/plugrc' +let g:neobundle#cache_file = $XDG_CACHE_HOME . '/vim/neobundlecache' +let &runtimepath.=','.s:neobundle_dir +try + call neobundle#begin(s:bundle_dir) +catch /E117/ " neobundle not installed + execute "!mkdir -p " . s:neobundle_dir + execute "!git clone " s:neobundle_repo . " " . s:neobundle_dir + call neobundle#begin(s:bundle_dir) + call neobundle#load_toml(s:neobundle_toml, {}) + NeoBundleInstall + call neobundle#end() + quit +endtry +if neobundle#load_cache(s:neobundle_toml) + call neobundle#load_toml(s:neobundle_toml, {}) + NeoBundleSaveCache +endif +if neobundle#tap('unite.vim') + nnoremap <leader>g :<C-u>Unite grep + \ -auto-preview + \ -no-split + \ -no-empty<CR> + nnoremap <leader>f :<C-u>Unite file_mru file/async file_rec/async + \ -start-insert <CR> + nnoremap <leader>l :<C-u>Unite buffer tab + \ -no-split <CR> + nnoremap <leader>r :<C-u>UniteResume + \ -no-start-insert + \ -force-redraw<CR> + let neobundle#hooks.on_source = s:neobundle_plugrc . '/unite.rc.vim' + call neobundle#untap() +endif +if neobundle#tap('vimfiler.vim') + let g:vimfiler_as_default_explorer = 1 +endif +if neobundle#tap('ultisnips') + let g:UltiSnipsForwardTrigger = "<c-,>" + let g:UltiSnipsBackwardTrigger = "<c-.>" + call neobundle#untap() +endif +if neobundle#tap('clang_complete') + let g:clang_auto_select = 1 + let g:clang_snippets = 1 + let g:clang_snippets_engine = 'ultisnips' + let g:clang_complete_macros = 1 + let g:clang_complete_patterns = 1 + call neobundle#untap() +endif +if neobundle#tap('syntastic') + let g:syntastic_error_symbol = '✗' + let g:syntastic_warning_symbol = '?' + call neobundle#untap() +endif +call neobundle#end() + +filetype plugin indent on +syntax on + +set ai +set bs=2 +set cc=80 +set cin +set fdm=syntax +set formatoptions+=j +set lcs=tab:\│\ ,trail:·,eol:¬ +set ls=2 +set nu +set rnu +set ru +set sta +set sw=4 +set ts=4 +set ttyfast +set wmnu + +" Set Monokai Colorscheme +colorscheme base16-monokai +let base16colorspace=256 +set bg=dark + +if has('gui_running') + set go-=R + set go-=T + set go-=L +endif + +" Filebin +com -range=% Fb :exec "<line1>,<line2>w !fb -e ".&filetype." -n ".expand("%:t") |