From 99f1c17274bcea036aca040642bb8377e95f6fcd Mon Sep 17 00:00:00 2001 From: yushyin Date: Thu, 30 Jul 2015 23:07:17 +0200 Subject: Add vim config --- vim/ftplugin/c.vim | 15 +++++ vim/ftplugin/haskell.vim | 33 ++++++++++ vim/ftplugin/tex.vim | 4 ++ vim/neobundle.toml | 156 +++++++++++++++++++++++++++++++++++++++++++++++ vim/plugrc/unite.rc.vim | 7 +++ vim/vimrc | 111 +++++++++++++++++++++++++++++++++ 6 files changed, 326 insertions(+) create mode 100644 vim/ftplugin/c.vim create mode 100644 vim/ftplugin/haskell.vim create mode 100644 vim/ftplugin/tex.vim create mode 100644 vim/neobundle.toml create mode 100644 vim/plugrc/unite.rc.vim create mode 100644 vim/vimrc 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] + nmap [cscope] + nmap [cscope]s :cs find s =expand("") + nmap [cscope]g :cs find g =expand("") + nmap [cscope]c :cs find c =expand("") + nmap [cscope]t :cs find t =expand("") + nmap [cscope]e :cs find e =expand("") + nmap [cscope]f :cs find f =expand("") + nmap [cscope]i :cs find i ^=expand("")$ + nmap [cscope]d :cs find d =expand("") +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 j v:count ? 'j' : 'gj' +vnoremap j v:count ? 'j' : 'gj' +nnoremap k v:count ? 'k' : 'gk' +vnoremap 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 = '' + [plugins.commands] + name = 'VimShell' + complete = 'customlist,vimshell#complete' + +[[plugins]] +repository = 'Shougo/vimfiler.vim' +lazy = 1 + [plugins.autoload] + mappings = '' + 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 (unite_toggle_auto_preview) + imap (unite_select_next_line) + imap (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 g :Unite grep + \ -auto-preview + \ -no-split + \ -no-empty + nnoremap f :Unite file_mru file/async file_rec/async + \ -start-insert + nnoremap l :Unite buffer tab + \ -no-split + nnoremap r :UniteResume + \ -no-start-insert + \ -force-redraw + 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 = "" + let g:UltiSnipsBackwardTrigger = "" + 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 ",w !fb -e ".&filetype." -n ".expand("%:t") -- cgit v1.2.3-24-g4f1b