From f49657495b72426b6527f74bdd04fc30b585efbc Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Mon, 25 Jun 2018 13:21:31 -0700 Subject: [PATCH] Adds ALE, LanguageClient, and clang --- .gitconfig | 2 ++ .vim/autoload/plug.vim | 21 +++++++++++---------- .vimrc | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/.gitconfig b/.gitconfig index 9cf26ee..34c6993 100644 --- a/.gitconfig +++ b/.gitconfig @@ -34,3 +34,5 @@ default = current [rerere] enabled = true +[url "git@github.com:"] + insteadOf = https://github.com/ diff --git a/.vim/autoload/plug.vim b/.vim/autoload/plug.vim index ceb2762..9dd02c0 100644 --- a/.vim/autoload/plug.vim +++ b/.vim/autoload/plug.vim @@ -605,7 +605,7 @@ function! plug#helptags() return s:err('plug#begin was not called') endif for spec in values(g:plugs) - let docd = join([spec.dir, 'doc'], '/') + let docd = join([s:rtp(spec), 'doc'], '/') if isdirectory(docd) silent! execute 'helptags' s:esc(docd) endif @@ -799,7 +799,7 @@ function! s:bang(cmd, ...) 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', cmd], batchfile) + call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = batchfile endif let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') @@ -908,7 +908,7 @@ function! s:finish(pull) call add(msgs, "Press 'R' to retry.") endif if a:pull && len(s:update.new) < len(filter(getline(5, '$'), - \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) + \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'")) call add(msgs, "Press 'D' to see the updated changes.") endif echo join(msgs, ' ') @@ -1196,7 +1196,7 @@ function! s:spawn(name, cmd, opts) 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', cmd], 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) @@ -2023,7 +2023,7 @@ function! s:system(cmd, ...) 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', cmd], batchfile) + call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = batchfile endif return system(s:is_win ? '('.cmd.')' : cmd) @@ -2246,15 +2246,16 @@ function! s:status() let unloaded = 0 let [cnt, total] = [0, len(g:plugs)] for [name, spec] in items(g:plugs) + let is_dir = isdirectory(spec.dir) if has_key(spec, 'uri') - if isdirectory(spec.dir) + if is_dir let [err, _] = s:git_validate(spec, 1) let [valid, msg] = [empty(err), empty(err) ? 'OK' : err] else let [valid, msg] = [0, 'Not found. Try PlugInstall.'] endif else - if isdirectory(spec.dir) + if is_dir let [valid, msg] = [1, 'OK'] else let [valid, msg] = [0, 'Not found.'] @@ -2263,7 +2264,7 @@ function! s:status() let cnt += 1 let ecnt += !valid " `s:loaded` entry can be missing if PlugUpgraded - if valid && get(s:loaded, name, -1) == 0 + if is_dir && get(s:loaded, name, -1) == 0 let unloaded = 1 let msg .= ' (not loaded)' endif @@ -2356,7 +2357,7 @@ function! s:preview_commit() let cmd = 'cd '.s:shellesc(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha if s:is_win let batchfile = tempname().'.bat' - call writefile(['@echo off', cmd], batchfile) + call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = batchfile endif execute 'silent %!' cmd @@ -2406,7 +2407,7 @@ 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 diff = s:system_chomp('git log --graph --color=never --pretty=format:"%x01%h%x01%d%x01%s%x01%cr" '.s:shellesc(range), v.dir) + let diff = s:system_chomp('git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)')), v.dir) if !empty(diff) let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) diff --git a/.vimrc b/.vimrc index 2cfd066..dffe5b1 100644 --- a/.vimrc +++ b/.vimrc @@ -1,4 +1,4 @@ - " ___ _ _ _ +" ___ _ _ _ " | _ ) __ _ _ _ __ _| |_( )___ __ _(_)_ __ _ _ __ " | _ \/ _` | '_/ _` | / //(_-< \ V / | ' \| '_/ _| " |___/\__,_|_| \__,_|_\_\ /__/ (_)_/|_|_|_|_|_| \__| @@ -87,7 +87,8 @@ Plug 'sjbach/lusty' Plug 'scrooloose/nerdcommenter' Plug 'scrooloose/nerdtree' Plug 'rstacruz/sparkup' -Plug 'scrooloose/syntastic' +"Plug 'scrooloose/syntastic' +Plug 'w0rp/ale' Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' Plug 'lunaru/vim-less' @@ -95,6 +96,7 @@ Plug 'lunaru/vim-less' Plug 'tpope/vim-unimpaired' "Plug 'Valloric/YouCompleteMe' Plug 'Shougo/deoplete.nvim' +Plug 'zchee/deoplete-clang' Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}} Plug 'zchee/deoplete-jedi' Plug 'b4winckler/vim-angry' @@ -139,6 +141,10 @@ Plug 'Shougo/denite.nvim' Plug 'tpope/vim-fireplace' Plug 'junegunn/vim-easy-align' Plug 'idris-hackers/idris-vim' +Plug 'autozimu/LanguageClient-neovim', { + \ 'branch': 'next', + \ 'do': 'bash install.sh', + \ } Plug 'ambv/black' @@ -199,6 +205,13 @@ setlocal cursorline " ** PLUGIN CONFIGURATION ** " +" Change the source rank +call deoplete#custom#option('sources', { + \ 'python': ['LanguageClient'], + \}) +call deoplete#custom#source('buffer', 'rank', 1) +let g:deoplete#sources#clang#libclang_path = '/usr/lib/llvm-6.0/lib/libclang.so' +let g:deoplete#sources#clang#clang_header = '/usr/lib/llvm-6.0/lib/clang' let g:deoplete#enable_at_startup = 1 " * Vim general/Unknown let python_highlight_all = 1 @@ -216,6 +229,22 @@ let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 2 let g:syntastic_loc_list_height = 10 " E111 = Spaces should be multiples of 4. I use 2. +" + +" * ALE +let g:airline#extensions#ale#enabled = 1 +let g:ale_set_highlights = 0 + +" * LanguageServer +let g:LanguageClient_serverCommands = { + \ 'python': ['pyls'], + \ } +let g:LanguageClient_diagnosticsDisplay = { + \1: {'name': 'Error', 'texthl': 'ALEError', 'signText': 'E>', 'signTexthl': 'ALEErrorSign',}, + \2: {"name": "Warning", "texthl": "ALEWarning", "signText": "W>", "signTexthl": "ALEWarningSign",}, + \3: {"name": "Information", "texthl": "ALEInfo", "signText": "i-", "signTexthl": "ALEInfoSign",}, + \4: {"name": "Hint", "texthl": "ALEInfo", "signText": "--", "signTexthl": "ALEInfoSign",}, +\} " * Configure browser for haskell_doc.vim let g:haddock_browser = "open"