summaryrefslogtreecommitdiffstats
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/files/after/ftplugin/c.vim5
-rw-r--r--vim/files/dein.toml117
-rw-r--r--vim/files/ftplugin/c.vim16
-rw-r--r--vim/files/ftplugin/haskell.vim2
-rw-r--r--vim/files/ftplugin/tex.vim5
-rw-r--r--vim/files/plugrc/vimfiler.rc.vim6
-rw-r--r--vim/files/vimrc177
-rw-r--r--vim/package.toml3
8 files changed, 331 insertions, 0 deletions
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 = '<Plug>'}
+
+[[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 = '<Plug>(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 = '<Plug>'}
+
+[[plugins]]
+repo = 'kana/vim-textobj-user'
+
+[[plugins]]
+repo = 'thinca/vim-textobj-between'
+lazy = 1
+on_map = { xo = '<Plug>' }
+depends = ['vim-textobj-user']
+
+[[plugins]]
+repo = 'kana/vim-textobj-indent'
+lazy = 1
+on_map = { xo = '<Plug>' }
+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] <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/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 <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/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] <Nop>
+ nmap <leader>d [Denite]
+
+ nnoremap [Denite]g :<C-u>Denite grep -auto-preview -split=no -no-empty<CR>
+ nnoremap [Denite]f :<C-u>Denite file/rec -mode=insert -split=no<CR>
+ nnoremap [Denite]l :<C-u>Denite buffer file/old -split=no<CR>
+ nnoremap [Denite]r :<C-u>Denite -resume -refresh<CR>
+
+ nnoremap [Denite]gf :DeniteCursorWord file/rec<CR>
+ nnoremap [Denite]gg :DeniteCursorWord grep<Cr>
+ nnoremap [Denite]g/ :DeniteCursorWord line<Cr>
+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 <C-k> <Plug>(neosnippet_expand_or_jump)
+ smap <C-k> <Plug>(neosnippet_expand_or_jump)
+ xmap <C-k> <Plug>(neosnippet_expand_or_jump)
+endif
+if dein#tap('vim-easy-align')
+ nmap ga <Plug>(EasyAlign)
+endif
+if dein#tap('vim-textobj-between')
+ let g:textobj_between_no_default_key_mappings = 1
+ omap af <Plug>(textobj-between-a)
+ omap if <Plug>(textobj-between-i)
+ xmap af <Plug>(textobj-between-a)
+ xmap if <Plug>(textobj-between-i)
+endif
+if dein#tap('vim-textobj-indent')
+ let g:textobj_indent_no_default_key_mappings = 1
+ omap ai <Plug>(textobj-indent-a)
+ omap ii <Plug>(textobj-indent-i)
+ xmap ai <Plug>(textobj-indent-a)
+ xmap ii <Plug>(textobj-indent-i)
+
+ omap aI <Plug>(textobj-indent-same-a)
+ omap iI <Plug>(textobj-indent-same-i)
+ xmap aI <Plug>(textobj-indent-same-a)
+ xmap iI <Plug>(textobj-indent-same-i)
+endif
+if dein#tap('vim-operator-surround')
+ nmap <silent>sa <Plug>(operator-surround-append)
+ nmap <silent>sd <Plug>(operator-surround-delete)
+ nmap <silent>sr <Plug>(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] <Nop>
+ nmap <leader>l [Lsp]
+
+ nmap [Lsp]dd <Plug>(lsp-definition)
+ nmap [Lsp]s <Plug>(lsp-document-symbol)
+ nmap [Lsp]i <Plug>(lsp-document-diagnostics)
+ nmap [Lsp]r <Plug>(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 "<line1>,<line2>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'