From 614eb79f5271b3c2a5f1c62e57dd8a5be161d76c Mon Sep 17 00:00:00 2001 From: yushyin Date: Tue, 11 Jun 2019 00:55:39 +0200 Subject: first commit --- vim/files/after/ftplugin/c.vim | 5 ++ vim/files/dein.toml | 117 ++++++++++++++++++++++++++ vim/files/ftplugin/c.vim | 16 ++++ vim/files/ftplugin/haskell.vim | 2 + vim/files/ftplugin/tex.vim | 5 ++ vim/files/plugrc/vimfiler.rc.vim | 6 ++ vim/files/vimrc | 177 +++++++++++++++++++++++++++++++++++++++ vim/package.toml | 3 + 8 files changed, 331 insertions(+) create mode 100644 vim/files/after/ftplugin/c.vim create mode 100644 vim/files/dein.toml create mode 100644 vim/files/ftplugin/c.vim create mode 100644 vim/files/ftplugin/haskell.vim create mode 100644 vim/files/ftplugin/tex.vim create mode 100644 vim/files/plugrc/vimfiler.rc.vim create mode 100644 vim/files/vimrc create mode 100644 vim/package.toml (limited to 'vim') diff --git a/vim/files/after/ftplugin/c.vim b/vim/files/after/ftplugin/c.vim new file mode 100644 index 0000000..2e39262 --- /dev/null +++ b/vim/files/after/ftplugin/c.vim @@ -0,0 +1,5 @@ +if dein#tap('vim-lsp') + if executable('ccls') + setl omnifunc=lsp#complete + endif +endif diff --git a/vim/files/dein.toml b/vim/files/dein.toml new file mode 100644 index 0000000..372f4c6 --- /dev/null +++ b/vim/files/dein.toml @@ -0,0 +1,117 @@ +[[plugins]] +repo = 'Shougo/dein.vim' + +[[plugins]] +repo = 'roxma/vim-hug-neovim-rpc' +lazy = 1 + +[[plugins]] +repo = 'roxma/nvim-yarp' +lazy = 1 + +[[plugins]] +repo = 'Shougo/denite.nvim' +lazy = 1 +on_cmd = 'Denite' +depends = ['vim-hug-neovim-rpc', 'nvim-yarp'] + +[[plugins]] +repo = 'chriskempson/base16-vim' + +[[plugins]] +repo = 'tpope/vim-unimpaired' +lazy = 1 +on_i = 1 + +[[plugins]] +repo = 'cespare/vim-toml' + +[[plugins]] +repo = 'ledger/vim-ledger' + +[[plugins]] +repo = 'sirtaj/vim-openscad' + +[[plugins]] +repo = 'vim-scripts/a.vim' +lazy = 1 +on_ft = ['c', 'cpp'] + +[[plugins]] +repo = 'Twinside/vim-hoogle' +lazy = 1 +external_commands = 'hoogle' +on_ft = ['haskell', 'lhaskell', 'chaskell'] + +[[plugins]] +repo = 'ujihisa/unite-haskellimport' +lazy = 1 +external_commands = 'hoogle' + +[[plugins]] +repo = 'rust-lang/rust.vim' +lazy = 1 +on_ft = 'rust' + +[[plugins]] +repo = 'MarcWeber/vim-addon-local-vimrc' + +[[plugins]] +repo = 'neomake/neomake' +lazy = 1 +on_cmd = 'Neomake' + +[[plugins]] +repo = 'lambdalisue/gina.vim' +rev = 'v1.0.*' +lazy = 1 +on_cmd = 'Gina' + +[[plugins]] +repo = 'Shougo/neosnippet.vim' +lazy = 1 +on_map = {i = ''} + +[[plugins]] +repo = 'Shougo/neosnippet-snippets' +lazy = 1 +on_source = 'neosnippet.vim' + +[[plugins]] +repo = 'junegunn/vim-easy-align' +lazy = 1 +on_cmd = ['EasyAlign', 'LiveEasyAlign'] +on_map = '(EasyAlign)' + +[[plugins]] +repo = 'kana/vim-operator-user' +lazy = 1 +on_source = 'vim-operator-surround' + +[[plugins]] +repo = 'rhysd/vim-operator-surround' +lazy = 1 +on_map = {n = ''} + +[[plugins]] +repo = 'kana/vim-textobj-user' + +[[plugins]] +repo = 'thinca/vim-textobj-between' +lazy = 1 +on_map = { xo = '' } +depends = ['vim-textobj-user'] + +[[plugins]] +repo = 'kana/vim-textobj-indent' +lazy = 1 +on_map = { xo = '' } +depends = ['vim-textobj-user'] + +[[plugins]] +repo = 'prabirshrestha/async.vim' + +[[plugins]] +repo = 'prabirshrestha/vim-lsp' +lazy = 0 +depends = ['async.vim'] diff --git a/vim/files/ftplugin/c.vim b/vim/files/ftplugin/c.vim new file mode 100644 index 0000000..f08009e --- /dev/null +++ b/vim/files/ftplugin/c.vim @@ -0,0 +1,16 @@ +setl cin cino+=:0,(s,l1 +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/files/ftplugin/haskell.vim b/vim/files/ftplugin/haskell.vim new file mode 100644 index 0000000..23a4130 --- /dev/null +++ b/vim/files/ftplugin/haskell.vim @@ -0,0 +1,2 @@ +setl tags+=codex.tags +setl ts=8 sts=4 sw=4 et sr diff --git a/vim/files/ftplugin/tex.vim b/vim/files/ftplugin/tex.vim new file mode 100644 index 0000000..72097c4 --- /dev/null +++ b/vim/files/ftplugin/tex.vim @@ -0,0 +1,5 @@ +setl lbr +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/files/plugrc/vimfiler.rc.vim b/vim/files/plugrc/vimfiler.rc.vim new file mode 100644 index 0000000..3c80c47 --- /dev/null +++ b/vim/files/plugrc/vimfiler.rc.vim @@ -0,0 +1,6 @@ +let g:vimfiler_as_default_explorer = 1 +let g:vimfiler_tree_indentation = 1 +let g:vimfiler_tree_opened_icon = "▼" +let g:vimfiler_tree_closed_icon = "▷" +let g:vimfiler_readonly_file_icon = "⭤" +let g:vimfiler_marked_file_icon = '✓' diff --git a/vim/files/vimrc b/vim/files/vimrc new file mode 100644 index 0000000..ac03d93 --- /dev/null +++ b/vim/files/vimrc @@ -0,0 +1,177 @@ +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/swp//,/var/tmp//,/tmp// +set undodir=$XDG_CACHE_HOME/vim/undo//,/var/tmp//,/tmp// +set backupdir=$XDG_CACHE_HOME/vim/backup,/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 + +" dein.vim +let s:dein_base = $XDG_DATA_HOME . '/vim/dein' +let s:dein_repo_path = s:dein_base . '/repos/github.com/Shougo/dein.vim' +let s:dein_repo_url = 'https://github.com/Shougo/dein.vim' +let s:dein_toml = $XDG_CONFIG_HOME . '/vim/dein.toml' +let s:plugrc = $XDG_CONFIG_HOME . '/vim/plugrc' +let &runtimepath.=','.s:dein_repo_path + +function! s:hook_source() abort + let l:rcfile = s:plugrc . '/' . g:dein#plugin.normalized_name . '.rc.vim' + let g:dein#plugin.hook_source = "source " . l:rcfile +endfunction + +" dein.vim +let g:dein#types#git#clone_depth = 1 +try + if dein#load_state(s:dein_base) + call dein#begin(s:dein_base) + call dein#load_toml(s:dein_toml) + call dein#end() + call dein#save_state() + endif +catch /E117:/ " dein not installed + execute "silent !git clone" s:dein_repo_url s:dein_repo_path + call dein#begin(s:dein_base) + call dein#load_toml(s:dein_toml) + set nomore + call dein#install() + call dein#end() + quit +endtry + +if dein#tap('denite.nvim') + nnoremap [Denite] + nmap d [Denite] + + nnoremap [Denite]g :Denite grep -auto-preview -split=no -no-empty + nnoremap [Denite]f :Denite file/rec -mode=insert -split=no + nnoremap [Denite]l :Denite buffer file/old -split=no + nnoremap [Denite]r :Denite -resume -refresh + + nnoremap [Denite]gf :DeniteCursorWord file/rec + nnoremap [Denite]gg :DeniteCursorWord grep + nnoremap [Denite]g/ :DeniteCursorWord line +endif +if dein#tap('vimfiler.vim') + call s:hook_source() +endif +if dein#tap('neosnippet.vim') + let g:neosnippet#snippets_directory = + \ $XDG_CONFIG_HOME . '/vim/snippets' + imap (neosnippet_expand_or_jump) + smap (neosnippet_expand_or_jump) + xmap (neosnippet_expand_or_jump) +endif +if dein#tap('vim-easy-align') + nmap ga (EasyAlign) +endif +if dein#tap('vim-textobj-between') + let g:textobj_between_no_default_key_mappings = 1 + omap af (textobj-between-a) + omap if (textobj-between-i) + xmap af (textobj-between-a) + xmap if (textobj-between-i) +endif +if dein#tap('vim-textobj-indent') + let g:textobj_indent_no_default_key_mappings = 1 + omap ai (textobj-indent-a) + omap ii (textobj-indent-i) + xmap ai (textobj-indent-a) + xmap ii (textobj-indent-i) + + omap aI (textobj-indent-same-a) + omap iI (textobj-indent-same-i) + xmap aI (textobj-indent-same-a) + xmap iI (textobj-indent-same-i) +endif +if dein#tap('vim-operator-surround') + nmap sa (operator-surround-append) + nmap sd (operator-surround-delete) + nmap sr (operator-surround-replace) +endif +if dein#tap('vim-addon-local-vimrc') + let g:local_vimrc = {'names':['.lvimrc'],'hash_fun':'LVRHashOfFile'} +endif +if dein#tap('vim-lsp') + if executable('ccls') + au User lsp_setup call lsp#register_server({ + \ 'name': 'ccls', + \ 'cmd': {server_info->['ccls']}, + \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))}, + \ 'initialization_options': {'cache': {'directory': '/tmp/ccls/cache' }}, + \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'], + \ }) + endif + if executable('rls') + au User lsp_setup call lsp#register_server({ + \ 'name': 'rls', + \ 'cmd': {server_info->['rustup', 'run', 'nightly', 'rls']}, + \ 'whitelist': ['rust'], + \ }) + + au FileType rust setl omnifunc=lsp#complete + endif + if executable('hie-wrapper') + au User lsp_setup call lsp#register_server({ + \ 'name': 'hie', + \ 'cmd': {server_info->['hie-wrapper']}, + \ 'whitelist': ['haskell'], + \ }) + + au FileType haskell setl omnifunc=lsp#complete + endif + + nnoremap [Lsp] + nmap l [Lsp] + + nmap [Lsp]dd (lsp-definition) + nmap [Lsp]s (lsp-document-symbol) + nmap [Lsp]i (lsp-document-diagnostics) + nmap [Lsp]r (lsp-rename) +endif +if dein#tap('base16-vim') + set bg=dark + let base16colorspace=256 + colorscheme base16-monokai +endif + +filetype plugin indent on +syntax on + +set ai +set bs=2 +set cc=80 +set fdm=syntax +set formatoptions+=j +set lcs=tab:\│\ ,trail:·,eol:¬ +set ls=2 +set nu +set rnu +set ru +set si +set sta +set sw=4 +set ts=4 +set ttyfast +set udf +set wmnu + +if has('gui_running') + set go=m +endif + +" Filebin +com -range=% Fb :exec ",w !fb -e ".&filetype." -n ".expand("%:t") + +" Write with sudo +com W w !sudo tee % > /dev/null diff --git a/vim/package.toml b/vim/package.toml new file mode 100644 index 0000000..d861910 --- /dev/null +++ b/vim/package.toml @@ -0,0 +1,3 @@ +[[files]] +source = './files' +dest = '~/.config/vim' -- cgit v1.2.3-24-g4f1b