nvim lsp updates, ricing

This commit is contained in:
Andrejus
2020-10-25 21:21:44 +00:00
parent 9ebfb3d135
commit 6ea4142783
14 changed files with 304 additions and 324 deletions

View File

@@ -1,29 +1,90 @@
" ============================================================================ "
" === PLUGINS === "
" ============================================================================ "
call plug#begin('~/.config/nvim/plugged')
" === Editor === "
" Sensible (?) defaults
" sensible defaults
Plug 'tpope/vim-sensible'
" colorschemes
Plug 'flazz/vim-colorschemes'
" colorscheme
Plug 'chriskempson/base16-vim'
" dev icons
Plug 'ryanoasis/vim-devicons'
" {{{
let g:webdevicons_enable_nerdtree = 1
let g:webdevicons_conceal_nerdtree_brackets = 1
" file explorer sidebar
let g:webdevicons_enable_airline_tabline = 1
let g:webdevicons_enable_airline_statusline = 1
let g:webdevicons_enable_startify = 1
" }}}
" explorer sidebar
Plug 'scrooloose/nerdtree'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
" {{{
" Show hidden files/directories
let g:NERDTreeShowHidden = 1
" Remove bookmarks and help text from NERDTree
let g:NERDTreeMinimalUI = 1
let g:NERDTreeMinimalMenu = 1
" Remove icons for expandable/expanded directories
let g:NERDTreeDirArrowExpandable = ''
let g:NERDTreeDirArrowCollapsible = ''
" Hide certain files and directories from NERDTree
let g:NERDTreeIgnore = ['\.git$[[dir]]']
" }}}
" status line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" {{{
" Enable extensions
let g:airline_extensions = ['branch', 'coc', 'hunks']
" indent guides
Plug 'nathanaelkane/vim-indent-guides'
" Do not draw separators for empty sections (only for the active window) >
let g:airline_skip_empty_sections = 1
" Smartly uniquify buffers names with similar filename, suppressing common parts of paths.
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
" Custom setup that removes filetype/whitespace from default vim airline bar
" let g:airline#extensions#default#layout = [['a', 'b', 'c'], ['x', 'z', 'warning', 'error']]
" Customize vim airline per filetype
" 'nerdtree' - Hide nerdtree status line
" 'list' - Only show file type plus current line number out of total
let g:airline_filetype_overrides = {
\ 'coc-explorer': [ 'CoC Explorer', '' ],
\ 'fugitive': ['fugitive', '%{airline#util#wrap(airline#extensions#branch#get_head(),80)}'],
\ 'help': [ 'Help', '%f' ],
\ 'startify': [ 'startify', '' ],
\ 'vim-plug': [ 'Plugins', '' ],
\ 'nerdtree': [ get(g:, 'NERDTreeStatusline', ''), '' ],
\ 'list': [ '%y', '%l/%L'],
\ }
" Enable powerline fonts
let g:airline_powerline_fonts = 1
" Enable caching of syntax highlighting groups
let g:airline_highlighting_cache = 1
" }}}
" Print function signatures in echo area
Plug 'Shougo/echodoc.vim'
" {{{
" Enable echodoc on startup
let g:echodoc#enable_at_startup = 1
" }}}
" start screen
Plug 'mhinz/vim-startify'
" distraction-free typing
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
" DOcumentation GEneraton
Plug 'kkoomen/vim-doge'
@@ -32,253 +93,62 @@ Plug 'kkoomen/vim-doge'
Plug 'rstacruz/vim-closer'
Plug 'tpope/vim-endwise'
" Improved motion in Vim
" better motion
Plug 'easymotion/vim-easymotion'
Plug 'tpope/vim-surround'
" Snippet support
Plug 'Shougo/neosnippet'
Plug 'Shougo/neosnippet-snippets'
" Print function signatures in echo area
Plug 'Shougo/echodoc.vim'
" Enable git changes to be shown in sign column
Plug 'mhinz/vim-signify'
Plug 'tpope/vim-fugitive'
" Comment out lines
Plug 'svermeulen/vim-subversive'
Plug 'godlygeek/tabular'
Plug 'tpope/vim-commentary'
" git tools
Plug 'mhinz/vim-signify'
" {{{
let g:signify_sign_delete = '-'
" }}}
Plug 'tpope/vim-fugitive'
" fzf
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" {{{
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.9 } }
let g:fzf_preview_window = ['right:66%', 'ctrl-/']
let g:fzf_buffers_jump = 1
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
" === Languages === "
" Intellisense Engine
let $FZF_DEFAULT_OPTS="--ansi --layout reverse --margin=1,4 --preview 'batcat --color=always --style=header,grid --line-range :300 {}'"
let $FZF_DEFAULT_COMMAND = 'rg --files --ignore-case --hidden -g "!{.git,node_modules,vendor}/*"'
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, { 'options': $FZF_DEFAULT_OPTS}, <bang>0)
" }}}
" coc
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
" {{{
" Keep in sync with below
let g:coc_global_extensions = [
\ 'coc-css',
\ 'coc-eslint',
\ 'coc-git',
\ 'coc-html',
\ 'coc-json',
\ 'coc-prettier',
\ 'coc-python',
\ 'coc-tabnine',
\ 'coc-tsserver',
\ 'coc-yaml',
\]
" }}}
Plug 'neoclide/coc-css', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-git', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-html', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-tabnine', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'}
Plug 'neoclide/coc-yaml', {'do': 'yarn install --frozen-lockfile'}
" lint
Plug 'dense-analysis/ale'
" Trailing whitespace highlighting & automatic fixing
Plug 'ntpeters/vim-better-whitespace'
" Languages
Plug 'sheerun/vim-polyglot'
" elm
Plug 'elmcast/elm-vim'
" json
Plug 'elzr/vim-json'
" html
Plug 'mattn/emmet-vim'
" js
Plug 'othree/yajs.vim'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
" Python
Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'}
Plug 'Vimjas/vim-python-pep8-indent'
" Initialize plugin system
call plug#end()
" ============================================================================ "
" === PLUGIN SETUP === "
" ============================================================================ "
colorscheme badwolf
" Show hidden files/directories
let g:NERDTreeShowHidden = 1
" Remove bookmarks and help text from NERDTree
let g:NERDTreeMinimalUI = 1
" Custom icons for expandable/expanded directories
let g:NERDTreeDirArrowExpandable = ''
let g:NERDTreeDirArrowCollapsible = ''
" Hide certain files and directories from NERDTree
let g:NERDTreeIgnore = ['\.git$[[dir]]']
let g:elm_setup_keybindings = 0
let g:ale_lint_on_text_changed = 'always'
let g:ale_lint_delay = 1000
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
" Do not display non-specified linter warnings
let g:ale_linters_explicit = 1
let g:ale_linters = {
\ 'python': ['flake8', 'pylint'],
\ 'typescript': ['prettier', 'tslint'],
\ 'javascript': ['prettier', 'eslint'],
\ 'scss': ['prettier'],
\ 'html': ['prettier'],
\}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'cpp': ['clang'],
\ 'css': ['prettier'],
\ 'python': ['yapf'],
\ 'typescript': ['prettier', 'tslint'],
\ 'javascript': ['prettier', 'eslint'],
\ 'scss': ['prettier'],
\ 'html': ['prettier'],
\}
let g:ale_fix_on_save = 1
let g:airline_theme='badwolf'
" Wrap in try/catch to avoid errors on initial install before plugin is available
try
" === Coc.nvim === "
" use <tab> for trigger completion and navigate to next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
"Close preview window when completion is done.
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
" Allow use of :Prettier
command! -nargs=0 Prettier :CocCommand prettier.formatFile
call coc#config('python', {
\ 'jediEnabled': v:false,
\ 'venvPath': '~/.cache/pypoetry/virtualenvs'
\ })
" Disable deprecated python2 provider
let g:loaded_python_provider = 0
" === NeoSnippet === "
" Map <C-k> as shortcut to activate snippet if available
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" Load custom snippets from snippets folder
let g:neosnippet#snippets_directory='~/.config/nvim/snippets'
let g:neosnippet#enable_conceal_markers = 0
" === Vim airline ==== "
" Enable extensions
let g:airline_extensions = ['branch', 'hunks', 'coc']
" Update section z to just have line number
let g:airline_section_z = airline#section#create(['linenr'])
" Do not draw separators for empty sections (only for the active window) >
let g:airline_skip_empty_sections = 1
" Smartly uniquify buffers names with similar filename, suppressing common parts of paths.
let g:airline#extensions#tabline#formatter = 'unique_tail'
" Custom setup that removes filetype/whitespace from default vim airline bar
let g:airline#extensions#default#layout = [['a', 'b', 'c'], ['x', 'z', 'warning', 'error']]
" Customize vim airline per filetype
" 'nerdtree' - Hide nerdtree status line
" 'list' - Only show file type plus current line number out of total
let g:airline_filetype_overrides = {
\ 'nerdtree': [ get(g:, 'NERDTreeStatusline', ''), '' ],
\ 'list': [ '%y', '%l/%L'],
\ }
" Enable powerline fonts
let g:airline_powerline_fonts = 1
" Enable caching of syntax highlighting groups
let g:airline_highlighting_cache = 1
" Define custom airline symbols
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" Don't show git changes to current file in airline
let g:airline#extensions#hunks#enabled=0
catch
echo 'Airline not installed. It should work after running :PlugInstall'
endtry
" === echodoc === "
" Enable echodoc on startup
let g:echodoc#enable_at_startup = 1
" === vim-javascript === "
" Enable syntax highlighting for JSDoc
let g:javascript_plugin_jsdoc = 1
" === vim-jsx === "
" Highlight jsx syntax even in non .jsx files
let g:jsx_ext_required = 0
" === javascript-libraries-syntax === "
let g:used_javascript_libs = 'underscore,requirejs,chai,jquery'
" === Signify === "
let g:signify_sign_delete = '-'
" Fzf
let g:fzf_preview_window = 'right:60%'
let g:fzf_buffers_jump = 1
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.9 } }
let $FZF_DEFAULT_OPTS="--ansi --preview-window 'right:60%' --layout reverse --margin=1,4 --preview 'batcat --color=always --style=header,grid --line-range :300 {}'"
let $FZF_DEFAULT_COMMAND = 'rg --files --ignore-case --hidden -g "!{.git,node_modules,vendor}/*"'
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
" Call method on window enter
augroup WindowManagement
autocmd!
autocmd WinEnter * call Handle_Win_Enter()
augroup END
" Change highlight group of preview window when open
function! Handle_Win_Enter()
if &previewwindow
setlocal winhighlight=Normal:MarkdownError
endif
endfunction
" Reload icons after init source
if exists('g:loaded_webdevicons')
call webdevicons#refresh()
endif
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
let g:user_emmet_leader_key='<Tab>'
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}