13 Commits

Author SHA1 Message Date
cc39580382 Fast fold 2020-02-02 00:04:00 +01:00
523dd1ad3a Use single quotes 2020-01-30 01:07:59 +01:00
08d59860f5 Enable vint for vim 2020-01-30 01:02:30 +01:00
0eea46beae Fix map 2020-01-28 02:10:39 +01:00
bf7c114395 Add rusty-tags support 2020-01-25 19:22:37 +01:00
34abb66cc9 Trash coc.nvim 2020-01-25 19:22:22 +01:00
f99343ca6e Update 2020-01-16 01:48:59 +01:00
d30df125c5 Disable neosnippet 2020-01-14 13:05:47 +01:00
1c2e0fccc3 Tweak diagnostics in coc.nvim 2020-01-14 13:05:33 +01:00
6e62775c1d Add dhall 2020-01-14 13:05:17 +01:00
c403eb2e73 Clean up plugins 2020-01-11 16:08:12 +01:00
e99f6129db Fix python LSP 2020-01-11 04:18:43 +01:00
e2505ecfc8 Enable shellcheck for sh 2020-01-11 04:18:30 +01:00
7 changed files with 318 additions and 350 deletions

View File

@@ -94,14 +94,6 @@ let g:vim_annotations_offset = '/.liquid/'
" LSP
let g:LanguageClient_autoStart = 0
let g:LanguageClient_serverCommands = {
\ 'haskell': ['hie-wrapper', '--lsp', '-d', '-l', $HOME.'/lang-server-lnvim.log'],
\ }
" we use ALE instead
let g:LanguageClient_diagnosticsEnable = 0
" nnoremap <leader>ld :call LanguageClient#textDocument_definition()<CR>
" nnoremap <leader>lr :call LanguageClient#textDocument_rename()<CR>
" nnoremap <leader>lf :call LanguageClient#textDocument_formatting()<CR>
@@ -200,4 +192,20 @@ let g:neoformat_enabled_haskell = ['brittany']
" LSP
let g:LanguageClient_rootMarkers = ['cabal.project', '*.cabal', 'stack.yaml']
" \ 'haskell': ['ghcide', "--lsp"],
let g:LanguageClient_serverCommands = {
\ 'haskell': ['hie-wrapper', '--lsp'],
\ }
let g:echodoc#enable_at_startup = 1
call deoplete#enable()
call deoplete#custom#source('LanguageClient',
\ 'min_pattern_length',
\ 2)
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"

View File

@@ -1,5 +1,3 @@
let g:tagbar_ctags_bin = '/usr/bin/universal-ctags'
let g:rust_doc#define_map_K = 0
let g:rust_doc#downloaded_rust_doc_dir = '~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu'
@@ -16,6 +14,13 @@ endfunction
nnoremap <buffer><silent><F7> :<C-u>call <SID>search_under_cursor(expand('<cword>'))<CR>
vnoremap <buffer><silent><F7> "gy:call <SID>search_under_cursor(getreg('g'))<CR>
" rusty-tags
autocmd BufRead *.rs :setlocal tags=./rusty-tags.vi;/
autocmd BufWritePost *.rs :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw!
let g:tagbar_ctags_bin = '/usr/bin/exuberant-ctags'
" nnoremap <F3> :call LanguageClient_contextMenu()<CR>
" nnoremap <silent> <F4> :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F6> :call LanguageClient#textDocument_hover()<CR>
@@ -36,11 +41,13 @@ vnoremap <buffer><silent><F7> "gy:call <SID>search_under_cursor(getreg('g'))<CR>
" let g:autofmt_autosave = 0
" deoplete
" call deoplete#custom#option('sources',{
" \ '_': ['buffer'],
" \ 'rust': ['ultisnips', 'buffer', 'file', 'LanguageClient']
" \ })
" inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" call deoplete#enable()
call deoplete#custom#option('sources',{
\ '_': ['buffer'],
\ 'rust': ['ultisnips', 'buffer', 'file', 'LanguageClient']
\ })
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
call deoplete#enable()
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/ra_lsp_server'],
\ }

2
after/ftplugin/vim.vim Normal file
View File

@@ -0,0 +1,2 @@
let g:ale_linters = {'vim':['vint']}

View File

@@ -1,136 +1,64 @@
function! ConfigureCocNVIM()
" ============ coc.nvim ===========
" if hidden is not set, TextEdit might fail.
set hidden
" echodoc
set cmdheight=2
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'signature'
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" Better display for messages
"set cmdheight=2
"LanguageClient-neovim
" Required for operations modifying multiple buffers like rename.
set hidden
nnoremap <silent> lc :call LanguageClient_contextMenu()<CR>
" Or map each action separately
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
let g:LanguageClient_autoStart = 0
let g:LanguageClient_diagnosticsEnable = 1
let g:LanguageClient_diagnosticsDisplay = {
\ 1: {
\ "name": "Error",
\ "texthl": "ALEError",
\ "signText": "✖",
\ "signTexthl": "ALEErrorSign",
\ "virtualTexthl": "Error",
\ },
\ 2: {
\ "name": "Warning",
\ "texthl": "ALEWarning",
\ "signText": "⚠",
\ "signTexthl": "ALEWarningSign",
\ "virtualTexthl": "Virtual",
\ },
\ 3: {
\ "name": "Information",
\ "texthl": "ALEInfo",
\ "signText": "",
\ "signTexthl": "ALEInfoSign",
\ "virtualTexthl": "Virtual",
\ },
\ 4: {
\ "name": "Hint",
\ "texthl": "ALEInfo",
\ "signText": "➤",
\ "signTexthl": "ALEInfoSign",
\ "virtualTexthl": "Virtual",
\ },
\ }
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" hi link ALEError Error
hi ALEError term=underline cterm=underline ctermfg=Red gui=undercurl guisp=Red
hi link ALEWarning Warning
hi Virtual cterm=italic ctermfg=10 gui=italic guifg=#4b5558
hi link ALEInfo SpellCap
" don't give |ins-completion-menu| messages.
set shortmess+=c
let $LANGUAGECLIENT_DEBUG=1
let g:LanguageClient_loggingLevel='DEBUG'
let g:LanguageClient_virtualTextPrefix = ''
let g:LanguageClient_loggingFile = expand('~/LanguageClient.log')
let g:LanguageClient_serverStderr = expand('~/LanguageServer.log')
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>qf <Plug>(coc-fix-current)
" Create mappings for function text object, requires document symbols feature of languageserver.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" Use <TAB> for select selections ranges, needs server support, like: coc-tsserver, coc-python
"nmap <silent> <TAB> <Plug>(coc-range-select)
"xmap <silent> <TAB> <Plug>(coc-range-select)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Add status line support, for integration with other plugin, checkout `:h coc-status`
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Using CocList
" Show all diagnostics
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
endfunction
autocmd! User coc.nvim call ConfigureCocNVIM()
if !has("nvim")
" lj
@@ -140,22 +68,22 @@ endif
" neosnippet
" Plugin key-mappings.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" imap <C-k> <Plug>(neosnippet_expand_or_jump)
" smap <C-k> <Plug>(neosnippet_expand_or_jump)
" xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
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>"
" 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>"
" For conceal markers.
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
" if has('conceal')
" set conceallevel=2 concealcursor=niv
" endif
" Enable snipMate compatibility feature.
let g:neosnippet#enable_snipmate_compatibility = 1
let g:neosnippet#snippets_directory='~/.vim/custom-snippets'
" let g:neosnippet#enable_snipmate_compatibility = 1
" let g:neosnippet#snippets_directory='~/.vim/custom-snippets'
" rainbow
@@ -170,11 +98,8 @@ let g:rainbow_active = 1
" let g:airline#extensions#tabline#enabled = 1
" LSP
let g:LanguageClient_autoStart = 0
" deoplete
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_at_startup = 0
" ==== delimitMate ====
let g:delimitMate_matchpairs = "(:),[:],{:}"
@@ -253,3 +178,23 @@ endfunction
command! -nargs=* Rag
\ call fzf#vim#ag(<q-args>, WithGitRoot())
" fastfold
nmap zuz <Plug>(FastFoldUpdate)
let g:fastfold_savehook = 1
let g:fastfold_fold_command_suffixes = ['x','X','a','A','o','O','c','C']
let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk']
let g:markdown_folding = 1
let g:tex_fold_enabled = 1
let g:vimsyn_folding = 'af'
let g:xml_syntax_folding = 1
let g:html_syntax_folding = 1
let g:javaScript_fold = 1
let g:sh_fold_enabled= 7
let g:ruby_fold = 1
let g:perl_fold = 1
let g:perl_fold_blocks = 1
let g:r_syntax_folding = 1
let g:rust_fold = 1
let g:haskell_fold = 1

View File

@@ -99,7 +99,13 @@ let s:mac_gui = has('gui_macvim') && has('gui_running')
let s:is_win = has('win32')
let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win)
let s:vim8 = has('patch-8.0.0039') && exists('*job_start')
let s:me = resolve(expand('<sfile>:p'))
if s:is_win && &shellslash
set noshellslash
let s:me = resolve(expand('<sfile>:p'))
set shellslash
else
let s:me = resolve(expand('<sfile>:p'))
endif
let s:base_spec = { 'branch': 'master', 'frozen': 0 }
let s:TYPE = {
\ 'string': type(''),
@@ -110,10 +116,42 @@ let s:TYPE = {
let s:loaded = get(s:, 'loaded', {})
let s:triggers = get(s:, 'triggers', {})
if s:is_win
function! s:plug_call(fn, ...)
let shellslash = &shellslash
try
set noshellslash
return call(a:fn, a:000)
finally
let &shellslash = shellslash
endtry
endfunction
else
function! s:plug_call(fn, ...)
return call(a:fn, a:000)
endfunction
endif
function! s:plug_getcwd()
return s:plug_call('getcwd')
endfunction
function! s:plug_fnamemodify(fname, mods)
return s:plug_call('fnamemodify', a:fname, a:mods)
endfunction
function! s:plug_expand(fmt)
return s:plug_call('expand', a:fmt, 1)
endfunction
function! s:plug_tempname()
return s:plug_call('tempname')
endfunction
function! plug#begin(...)
if a:0 > 0
let s:plug_home_org = a:1
let home = s:path(fnamemodify(expand(a:1), ':p'))
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
elseif exists('g:plug_home')
let home = s:path(g:plug_home)
elseif !empty(&rtp)
@@ -121,7 +159,7 @@ function! plug#begin(...)
else
return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
endif
if fnamemodify(home, ':t') ==# 'plugin' && fnamemodify(home, ':h') ==# s:first_rtp
if s:plug_fnamemodify(home, ':t') ==# 'plugin' && s:plug_fnamemodify(home, ':h') ==# s:first_rtp
return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.')
endif
@@ -139,6 +177,16 @@ function! s:define_commands()
if !executable('git')
return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.')
endif
if has('win32')
\ && &shellslash
\ && (&shell =~# 'cmd\.exe' || &shell =~# 'powershell\.exe')
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
endif
if !has('nvim')
\ && (has('win32') || has('win32unix'))
\ && !has('multi_byte')
return s:err('Vim needs +multi_byte feature on Windows to run shell commands. Enable +iconv for best results.')
endif
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(<bang>0, [<f-args>])
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
command! -nargs=0 -bar -bang PlugClean call s:clean(<bang>0)
@@ -334,11 +382,11 @@ function! s:progress_opt(base)
\ s:git_version_requirement(1, 7, 1) ? '--progress' : ''
endfunction
if s:is_win
function! s:rtp(spec)
return s:path(a:spec.dir . get(a:spec, 'rtp', ''))
endfunction
function! s:rtp(spec)
return s:path(a:spec.dir . get(a:spec, 'rtp', ''))
endfunction
if s:is_win
function! s:path(path)
return s:trim(substitute(a:path, '/', '\', 'g'))
endfunction
@@ -350,11 +398,33 @@ if s:is_win
function! s:is_local_plug(repo)
return a:repo =~? '^[a-z]:\|^[%~]'
endfunction
else
function! s:rtp(spec)
return s:dirpath(a:spec.dir . get(a:spec, 'rtp', ''))
" Copied from fzf
function! s:wrap_cmds(cmds)
let cmds = [
\ '@echo off',
\ 'setlocal enabledelayedexpansion']
\ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
\ + ['endlocal']
if has('iconv')
if !exists('s:codepage')
let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0)
endif
return map(cmds, printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))
endif
return map(cmds, 'v:val."\r"')
endfunction
function! s:batchfile(cmd)
let batchfile = s:plug_tempname().'.bat'
call writefile(s:wrap_cmds(a:cmd), batchfile)
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
if &shell =~# 'powershell\.exe'
let cmd = '& ' . cmd
endif
return [batchfile, cmd]
endfunction
else
function! s:path(path)
return s:trim(a:path)
endfunction
@@ -434,8 +504,8 @@ endfunction
function! s:dobufread(names)
for name in a:names
let path = s:rtp(g:plugs[name]).'/**'
for dir in ['ftdetect', 'ftplugin']
let path = s:rtp(g:plugs[name])
for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
if len(finddir(dir, path))
if exists('#BufRead')
doautocmd BufRead
@@ -554,7 +624,7 @@ function! plug#(repo, ...)
try
let repo = s:trim(a:repo)
let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec
let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??'))
let name = get(opts, 'as', s:plug_fnamemodify(repo, ':t:s?\.git$??'))
let spec = extend(s:infer_properties(name, repo), opts)
if !has_key(g:plugs, name)
call add(g:plugs_order, name)
@@ -574,7 +644,7 @@ function! s:parse_options(arg)
elseif type == s:TYPE.dict
call extend(opts, a:arg)
if has_key(opts, 'dir')
let opts.dir = s:dirpath(expand(opts.dir))
let opts.dir = s:dirpath(s:plug_expand(opts.dir))
endif
else
throw 'Invalid argument type (expected: string or dictionary)'
@@ -585,7 +655,7 @@ endfunction
function! s:infer_properties(name, repo)
let repo = a:repo
if s:is_local_plug(repo)
return { 'dir': s:dirpath(expand(repo)) }
return { 'dir': s:dirpath(s:plug_expand(repo)) }
else
if repo =~ ':'
let uri = repo
@@ -738,7 +808,7 @@ function! s:finish_bindings()
endfunction
function! s:prepare(...)
if empty(getcwd())
if empty(s:plug_getcwd())
throw 'Invalid current working directory. Cannot proceed.'
endif
@@ -794,31 +864,28 @@ endfunction
function! s:chsh(swap)
let prev = [&shell, &shellcmdflag, &shellredir]
if s:is_win
set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1
elseif a:swap
if !s:is_win && a:swap
set shell=sh shellredir=>%s\ 2>&1
endif
return prev
endfunction
function! s:bang(cmd, ...)
let batchfile = ''
try
let [sh, shellcmdflag, shrd] = s:chsh(a:0)
" FIXME: Escaping is incomplete. We could use shellescape with eval,
" but it won't work on Windows.
let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd
if s:is_win
let batchfile = tempname().'.bat'
call writefile(["@echo off\r", cmd . "\r"], batchfile)
let cmd = batchfile
let [batchfile, cmd] = s:batchfile(cmd)
endif
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
finally
unlet g:_plug_bang
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
if s:is_win
if s:is_win && filereadable(batchfile)
call delete(batchfile)
endif
endtry
@@ -897,7 +964,7 @@ function! s:checkout(spec)
let output = s:system('git rev-parse HEAD', a:spec.dir)
if !v:shell_error && !s:hash_match(sha, s:lines(output)[0])
let output = s:system(
\ 'git fetch --depth 999999 && git checkout '.s:esc(sha).' --', a:spec.dir)
\ 'git fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
endif
return output
endfunction
@@ -1015,7 +1082,7 @@ function! s:update_impl(pull, force, args) abort
let s:clone_opt = get(g:, 'plug_shallow', 1) ?
\ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : ''
if has('win32unix')
if has('win32unix') || has('wsl')
let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input'
endif
@@ -1094,7 +1161,7 @@ function! s:update_finish()
elseif has_key(spec, 'tag')
let tag = spec.tag
if tag =~ '\*'
let tags = s:lines(s:system('git tag --list '.s:shellesc(tag).' --sort -version:refname 2>&1', spec.dir))
let tags = s:lines(s:system('git tag --list '.plug#shellescape(tag).' --sort -version:refname 2>&1', spec.dir))
if !v:shell_error && !empty(tags)
let tag = tags[0]
call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag))
@@ -1102,12 +1169,12 @@ function! s:update_finish()
endif
endif
call s:log4(name, 'Checking out '.tag)
let out = s:system('git checkout -q '.s:esc(tag).' -- 2>&1', spec.dir)
let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
else
let branch = s:esc(get(spec, 'branch', 'master'))
call s:log4(name, 'Merging origin/'.branch)
let out = s:system('git checkout -q '.branch.' -- 2>&1'
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir)
let branch = get(spec, 'branch', 'master')
call s:log4(name, 'Merging origin/'.s:esc(branch))
let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1'
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)
endif
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
\ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
@@ -1151,7 +1218,7 @@ function! s:job_abort()
silent! call job_stop(j.jobid)
endif
if j.new
call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir))
call s:rm_rf(g:plugs[name].dir)
endif
endfor
let s:jobs = {}
@@ -1204,22 +1271,17 @@ endfunction
function! s:spawn(name, cmd, opts)
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
\ 'batchfile': (s:is_win && (s:nvim || s:vim8)) ? tempname().'.bat' : '',
\ 'new': get(a:opts, 'new', 0) }
let s:jobs[a:name] = job
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
if !empty(job.batchfile)
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
let cmd = job.batchfile
endif
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir, 0) : a:cmd
let argv = s:is_win ? ['cmd', '/s', '/c', '"'.cmd.'"'] : ['sh', '-c', cmd]
if s:nvim
call extend(job, {
\ 'on_stdout': function('s:nvim_cb'),
\ 'on_exit': function('s:nvim_cb'),
\ })
let jid = jobstart(argv, job)
let jid = s:plug_call('jobstart', argv, job)
if jid > 0
let job.jobid = jid
else
@@ -1262,9 +1324,6 @@ function! s:reap(name)
call s:log(bullet, a:name, empty(result) ? 'OK' : result)
call s:bar()
if has_key(job, 'batchfile') && !empty(job.batchfile)
call delete(job.batchfile)
endif
call remove(s:jobs, a:name)
endfunction
@@ -1279,9 +1338,10 @@ function! s:bar()
endfunction
function! s:logpos(name)
for i in range(4, line('$'))
let max = line('$')
for i in range(4, max > 4 ? max : 4)
if getline(i) =~# '^[-+x*] '.a:name.':'
for j in range(i + 1, line('$'))
for j in range(i + 1, max > 5 ? max : 5)
if getline(j) !~ '^ '
return [i, j - 1]
endif
@@ -1354,8 +1414,8 @@ while 1 " Without TCO, Vim stack is bound to explode
\ printf('git clone %s %s %s %s 2>&1',
\ has_tag ? '' : s:clone_opt,
\ prog,
\ s:shellesc(spec.uri),
\ s:shellesc(s:trim(spec.dir))), { 'new': 1 })
\ plug#shellescape(spec.uri, {'script': 0}),
\ plug#shellescape(s:trim(spec.dir), {'script': 0})), { 'new': 1 })
endif
if !s:jobs[name].running
@@ -1982,19 +2042,29 @@ function! s:update_ruby()
EOF
endfunction
function! s:shellesc_cmd(arg)
let escaped = substitute(a:arg, '[&|<>()@^]', '^&', 'g')
let escaped = substitute(escaped, '%', '%%', 'g')
let escaped = substitute(escaped, '"', '\\^&', 'g')
let escaped = substitute(escaped, '\(\\\+\)\(\\^\)', '\1\1\2', 'g')
return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"'
function! s:shellesc_cmd(arg, script)
let escaped = substitute('"'.a:arg.'"', '[&|<>()@^!"]', '^&', 'g')
return substitute(escaped, '%', (a:script ? '%' : '^') . '&', 'g')
endfunction
function! s:shellesc(arg)
if &shell =~# 'cmd.exe$'
return s:shellesc_cmd(a:arg)
function! s:shellesc_ps1(arg)
return "'".substitute(escape(a:arg, '\"'), "'", "''", 'g')."'"
endfunction
function! s:shellesc_sh(arg)
return "'".substitute(a:arg, "'", "'\\\\''", 'g')."'"
endfunction
function! plug#shellescape(arg, ...)
let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {}
let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh')
let script = get(opts, 'script', 1)
if shell =~# 'cmd\.exe'
return s:shellesc_cmd(a:arg, script)
elseif shell =~# 'powershell\.exe' || shell =~# 'pwsh$'
return s:shellesc_ps1(a:arg)
endif
return shellescape(a:arg)
return s:shellesc_sh(a:arg)
endfunction
function! s:glob_dir(path)
@@ -2026,23 +2096,23 @@ function! s:format_message(bullet, name, message)
endif
endfunction
function! s:with_cd(cmd, dir)
return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd)
function! s:with_cd(cmd, dir, ...)
let script = a:0 > 0 ? a:1 : 1
return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd)
endfunction
function! s:system(cmd, ...)
let batchfile = ''
try
let [sh, shellcmdflag, shrd] = s:chsh(1)
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
if s:is_win
let batchfile = tempname().'.bat'
call writefile(["@echo off\r", cmd . "\r"], batchfile)
let cmd = batchfile
let [batchfile, cmd] = s:batchfile(cmd)
endif
return system(s:is_win ? '('.cmd.')' : cmd)
return system(cmd)
finally
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
if s:is_win
if s:is_win && filereadable(batchfile)
call delete(batchfile)
endif
endtry
@@ -2115,7 +2185,7 @@ endfunction
function! s:rm_rf(dir)
if isdirectory(a:dir)
call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir))
call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . plug#shellescape(a:dir))
endif
endfunction
@@ -2147,7 +2217,7 @@ function! s:clean(force)
let allowed = {}
for dir in dirs
let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1
let allowed[s:dirpath(s:plug_fnamemodify(dir, ':h:h'))] = 1
let allowed[dir] = 1
for child in s:glob_dir(dir)
let allowed[child] = 1
@@ -2220,11 +2290,11 @@ endfunction
function! s:upgrade()
echo 'Downloading the latest version of vim-plug'
redraw
let tmp = tempname()
let tmp = s:plug_tempname()
let new = tmp . '/plug.vim'
try
let out = s:system(printf('git clone --depth 1 %s %s', s:shellesc(s:plug_src), s:shellesc(tmp)))
let out = s:system(printf('git clone --depth 1 %s %s', plug#shellescape(s:plug_src), plug#shellescape(tmp)))
if v:shell_error
return s:err('Error upgrading vim-plug: '. out)
endif
@@ -2365,18 +2435,17 @@ function! s:preview_commit()
wincmd P
endif
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
let batchfile = ''
try
let [sh, shellcmdflag, shrd] = s:chsh(1)
let cmd = 'cd '.s:shellesc(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
if s:is_win
let batchfile = tempname().'.bat'
call writefile(["@echo off\r", cmd . "\r"], batchfile)
let cmd = batchfile
let [batchfile, cmd] = s:batchfile(cmd)
endif
execute 'silent %!' cmd
finally
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
if s:is_win
if s:is_win && filereadable(batchfile)
call delete(batchfile)
endif
endtry
@@ -2420,9 +2489,11 @@ function! s:diff()
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
for [k, v] in plugs
let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
let cmd = 'git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)'))
let cmd = 'git log --graph --color=never '
\ . (s:git_version_requirement(2, 10, 0) ? '--no-show-signature ' : '')
\ . join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 'plug#shellescape(v:val)'))
if has_key(v, 'rtp')
let cmd .= ' -- '.s:shellesc(v.rtp)
let cmd .= ' -- '.plug#shellescape(v.rtp)
endif
let diff = s:system_chomp(cmd, v.dir)
if !empty(diff)
@@ -2470,7 +2541,7 @@ function! s:revert()
return
endif
call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch).' --', g:plugs[name].dir)
call s:system('git reset --hard HEAD@{1} && git checkout '.plug#shellescape(g:plugs[name].branch).' --', g:plugs[name].dir)
setlocal modifiable
normal! "_dap
setlocal nomodifiable
@@ -2498,7 +2569,7 @@ function! s:snapshot(force, ...) abort
endfor
if a:0 > 0
let fn = expand(a:1)
let fn = s:plug_expand(a:1)
if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?'))
return
endif

View File

@@ -1,44 +0,0 @@
{
"languageserver": {
"haskell": {
"trace.server": "verbose",
"command": "hie-wrapper",
"args": ["--lsp", "-d", "-l", "/home/jule/lang-server.log"],
"rootPatterns": [
"*.cabal",
"stack.yaml",
"cabal.config",
"cabal.project",
"package.yaml"
],
"filetypes": [
"hs",
"lhs",
"haskell"
],
"initializationOptions": {
"languageServerHaskell": {
"hlintOn": false
}
}
},
"bash": {
"trace.server": "verbose",
"command": "bash-language-server",
"args": ["start"],
"filetypes": ["sh"],
"ignoredRootPaths": ["~"]
},
// install: https://github.com/mattn/efm-langserver
// and: https://github.com/Kuniwak/vint
"efm": {
"command": "efm-langserver",
"args": [],
// custom config path
//"args": ["-c", "/home/jule/.config/efm-langserver/config.yaml"],
"filetypes": ["vim"]
}
},
"coc.preferences.hoverTarget": "float",
"suggest.floatEnable": true
}

123
vimrc
View File

@@ -16,21 +16,20 @@ Plug 'mileszs/ack.vim'
Plug 'vim-scripts/cmdalias.vim'
Plug 'Raimondi/delimitMate'
Plug 'vim-scripts/genindent.vim'
Plug 'sjl/gundo.vim'
Plug 'idris-hackers/idris-vim'
Plug 'yegappan/mru'
" Plug 'sjl/gundo.vim'
" Plug 'idris-hackers/idris-vim'
"Plug 'yegappan/mru'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'vim-scripts/promela.vim'
Plug 'AndrewRadev/simple_bookmarks.vim'
Plug 'Keithbsmiley/swift.vim'
"Plug 'vim-scripts/promela.vim'
"Plug 'AndrewRadev/simple_bookmarks.vim'
"Plug 'Keithbsmiley/swift.vim'
Plug 'majutsushi/tagbar'
Plug 'ternjs/tern_for_vim'
"Plug 'ternjs/tern_for_vim'
Plug 'xolox/vim-easytags'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'xolox/vim-misc'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'tpope/vim-rhubarb'
Plug 'sjbach/lusty'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
@@ -41,12 +40,17 @@ Plug 'junegunn/fzf.vim'
Plug 'sbdchd/neoformat'
Plug 'AndrewRadev/bufferize.vim'
Plug 'vimwiki/vimwiki'
Plug 'vmchale/dhall-vim'
Plug 'Shougo/echodoc.vim'
Plug 'tpope/vim-scriptease'
Plug 'Konfekt/FastFold'
" scm
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'airblade/vim-gitgutter'
Plug 'tommcdo/vim-fubitive'
Plug 'airblade/vim-gitgutter'
" local_vimrc
Plug 'LucHermitte/lh-vim-lib'
@@ -58,44 +62,31 @@ Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --go-comp
\ }
" deoplete for haskell
if has('nvim')
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins',
" \ }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins',
\ }
else
" Plug 'Shougo/deoplete.nvim'
" Plug 'roxma/nvim-yarp'
" Plug 'roxma/vim-hug-neovim-rpc'
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
" snippets
Plug 'Shougo/neosnippet.vim'
Plug 'honza/vim-snippets'
"Plug 'Shougo/neosnippet.vim'
"Plug 'honza/vim-snippets'
" LSP
" setting this per-language breaks "let g:LanguageClient_autoStart = 1",
" Plug 'autozimu/LanguageClient-neovim', {
" \ 'branch': 'next',
" \ 'do': 'bash install.sh',
" \ }
" Use release branch (Recommend)
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile', 'for': ['haskell', 'rust', 'sh', 'python', 'vim']}
Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile', 'for': ['typescript']}
"Plug 'neoclide/coc-git', {'do': 'yarn install --frozen-lockfile'}
" Plug 'neoclide/coc-rls', {'do': 'yarn install --frozen-lockfile', 'for': ['rust']}
Plug 'fannheyward/coc-rust-analyzer', {'do': 'yarn install --frozen-lockfile', 'for': ['rust']}
Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile', 'for': ['haskell', 'rust', 'sh']}
Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile', 'for': ['python']}
"Plug 'neoclide/coc-vetur', {'do': 'yarn install --frozen-lockfile', 'for': ['haskell']}
Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile', 'for': ['json']}
" Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile', 'for': ['']}
Plug 'neoclide/coc-yaml', {'do': 'yarn install --frozen-lockfile', 'for': ['yaml']}
" Plug 'neoclide/coc-highlight', {'do': 'yarn install --frozen-lockfile', 'for': ['']}
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash ./install.sh'
\ }
" linting/compilation
" Plug 'w0rp/ale', {
" \ 'do': 'bash -c \"cp -R ~/.vim/ale_linters .\"',
" \ 'for': 'haskell',
" \ }
Plug 'w0rp/ale', {
\ 'do': 'bash -c \"cp -R ~/.vim/ale_linters .\"',
\ 'for': ['sh', 'vim'],
\ }
" haskell
" if has("nvim")
@@ -116,23 +107,7 @@ Plug 'itchyny/vim-haskell-indent', { 'for': 'haskell' }
Plug 'dan-t/vim-hsimport', { 'for': 'haskell' }
Plug 'Twinside/vim-hoogle', { 'for': 'haskell' }
" clojure
" Plug '~/.vim/unmanaged-vim-plug/tslime', { 'for': 'clojure' }
" Plug 'guns/vim-slamhound', {'for': 'clojure'}
" Plug 'guns/vim-sexp', {'for': 'clojure'}
" Plug 'tpope/vim-sexp-mappings-for-regular-people', {'for': 'clojure'}
" Plug 'kovisoft/paredit', {'for': 'clojure'}
Plug 'luochen1990/rainbow', { 'for': ['clojure', 'haskell', 'python'] }
" Plug 'typedclojure/vim-typedclojure', {'for': 'clojure'}
" heavy clojurescript
" Plug 'tpope/vim-classpath', { 'for': 'clojure' }
Plug 'guns/vim-clojure-static', { 'for': 'clojure' }
Plug 'tpope/vim-salve', { 'for': 'clojure' }
Plug 'tpope/vim-projectionist', { 'for': 'clojure' }
Plug 'tpope/vim-dispatch', { 'for': 'clojure' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'venantius/vim-cljfmt', {'for': 'clojure'}
" go
" Plug 'garyburd/go-explorer', { 'for': 'go' }
@@ -173,7 +148,7 @@ Plug 'Quramy/tsuquyomi', { 'for': 'typescript' }
Plug 'altercation/vim-colors-solarized'
" Plug 'reedes/vim-colors-pencil'
" Plug 'whatyouhide/vim-gotham'
if has("nvim")
if has('nvim')
Plug 'iCyMind/NeoSolarized'
endif
" Plug 'noahfrederick/vim-hemisu'
@@ -187,7 +162,7 @@ Plug '~/.vim/unmanaged-vim-plug/L9'
Plug '~/.vim/unmanaged-vim-plug/log'
Plug '~/.vim/unmanaged-vim-plug/ScrollColor'
Plug '~/.vim/unmanaged-vim-plug/txtfmt'
if !has("nvim")
if !has('nvim')
Plug '~/.vim/unmanaged-vim-plug/fontzoom'
endif
@@ -214,6 +189,10 @@ call CmdAlias('hotkeys', 'tabnew ~/.vim/hotkeys')
call CmdAlias('TC', 'call ToggleComment()<CR>')
call CmdAlias('TF', 'call ToggleFoldText()<CR>')
call CmdAlias('ctags', '!/usr/bin/ctags -R --langmap=c:.c.h --c++-kinds=+p --c-kinds=+p+x --fields=+i+a+S+t+l+m+n --extra=+q .<CR>')
call CmdAlias('Nf', 'Neoformat')
call CmdAlias('NF', 'Neoformat')
call CmdAlias('nf', 'Neoformat')
call CmdAlias('LS', 'LanguageClientStart')
@@ -235,7 +214,7 @@ set directory=~/.vimtmp
set modeline
set modelines=1
let g:nickID = "hasufell"
let g:nickID = 'hasufell'
" don't yank to buffer on deletion
" vnoremap d "_d
@@ -268,10 +247,10 @@ else
colorscheme solarized
endif
if has("nvim")
if has('nvim')
if exists('g:GtkGuiLoaded')
let g:neosolarized_contrast = "normal"
let g:neosolarized_visibility = "normal"
let g:neosolarized_contrast = 'normal'
let g:neosolarized_visibility = 'normal'
let g:neosolarized_vertSplitBgTrans = 0
let g:neosolarized_bold = 1
let g:neosolarized_underline = 1
@@ -279,8 +258,8 @@ if has("nvim")
set background=dark
colorscheme NeoSolarized
else
let g:neosolarized_contrast = "normal"
let g:neosolarized_visibility = "normal"
let g:neosolarized_contrast = 'normal'
let g:neosolarized_visibility = 'normal'
let g:neosolarized_vertSplitBgTrans = 0
let g:neosolarized_bold = 1
let g:neosolarized_underline = 1
@@ -300,7 +279,7 @@ fu! DisableBr()
set nolist " list disables linebreak
set textwidth=0
set wrapmargin=0
set fo-=t
set formatoptions-=t
endfu
" Disable line breaks for all file types
@@ -309,15 +288,15 @@ au BufNewFile,BufRead *.* call DisableBr()
" ==========copy/paste===========
function! Paste(mode)
if a:mode == "v"
if a:mode == 'v'
normal gv
normal "_d
normal "+gP
normal l
elseif a:mode == "i"
elseif a:mode == 'i'
set virtualedit=all
normal `^"+gP
let &virtualedit = ""
let &virtualedit = ''
endif
endfunction
@@ -326,7 +305,7 @@ endfunction
function! Select()
set virtualedit=all
normal `^ggVG
let &virtualedit = ""
let &virtualedit = ''
endfunction
" =======================
@@ -375,7 +354,7 @@ endfun
" comment hiding
func! IsComment( lnum )
return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1),"name") =~? 'comment'
return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1),'name') =~? 'comment'
endfun
@@ -416,13 +395,13 @@ endfunction
" vim macro to jump to devhelp topics.
""""""""""""""""""""""""""""""
function! DevHelpCurrentWord()
let word = expand("<cword>")
exe "!devhelp -s " . word . " &"
let word = expand('<cword>')
exe '!devhelp -s ' . word . ' &'
endfunction
function! ManCurrentWord()
let word = expand("<cword>")
exe "!man 3 " . word
let word = expand('<cword>')
exe '!man 3 ' . word
endfunction
" vim:foldmethod=marker:foldlevel=0