add treesitter, nvim-langserver, efm-langserver

This commit is contained in:
Ray Elliott 2021-09-04 10:11:03 +01:00
parent 8f12e34f1c
commit dc285da74f
3 changed files with 259 additions and 186 deletions

View File

@ -5,51 +5,60 @@ if empty(glob('~/.config/nvim/autoload/plug.vim'))"
endif
call plug#begin('~/.config/nvim/bundle')
" evaluating
" #nvim-treesitter {{{
" https://github.com/nvim-treesitter/nvim-treesitter
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " update the parsers on update
" config needs to be after call to plug#end
" Treesitter uses a different parser for every language, which needs to be generated
" If the language is already supported by nvim-treesitter, you can install it with
" :TSInstall <language_to_install>
" - can use tab completion with this
" Parsers not on this list can be added manually
"
" If you update nvim-treesitter and want to make sure the parser is at the latest compatible version (as specified in nvim-treesitter's lockfile.json), use
" :TSUpdate {language}.
" To update all parsers unconditionally, use
" :TSUpdate all or just :TSUpdate.
"
" Each module provides a distinct tree-sitter-based feature such as highlighting, indentation, or folding; see :h nvim-treesitter-modules or "Available modules" below for a list of modules and their options.
" All modules are disabled by default and need to be activated explicitly in your init.vim
"
" Each module can also be enabled or disabled interactively through the following commands:
" :TSBufEnable {module} " enable module on current buffer
" :TSBufDisable {module} " disable module on current buffer
" :TSEnableAll {module} [{ft}] " enable module on every buffer. If filetype is specified, enable only for this filetype.
" :TSDisableAll {module} [{ft}] " disable module on every buffer. If filetype is specified, disable only for this filetype.
" :TSModuleInfo [{module}] " list information about modules state for each filetype
"
" Check :h nvim-treesitter-commands for a list of all available commands. It may be necessary to reload the buffer (e.g., via :e) after enabling a module interactively.
"}}}
" #vim-lspconfig {{{
" https://github.com/neovim/nvim-lspconfig
" https://github.com/neovim/nvim-lspconfig/wiki
Plug 'neovim/nvim-lspconfig'
" setings after plug#end
"}}}
" keeping
" #vim-hexokinase {{{
" https://github.com/chrisbra/Colorizer
" display colors asynchronously
Plug 'chrisbra/Colorizer'
" let g:colorizer_use_virtual_text = 1
nnoremap <silent> <cr>cc :ColorToggle<CR>
"}}}
" #coc.nvim{{{
" https://github.com/neoclide/coc.nvim
" SEE BOTTOM OF THIS FILE FOR coc#add_extension statement
" for some reason fails when added some other places
Plug 'neoclide/coc.nvim', {'branch': 'release', 'do': { -> coc#util#install()}}
let g:coc_snippet_next = '<tab>'
let g:coc_snippet_prev = '<s-tab>'
" inoremap <silent><expr> <c-n> coc#refresh()
nnoremap <silent> <silent> <space><space> :call CocAction('doHover')<CR>
nnoremap <silent> <space>cf :call CocAction('doQuickfix')<CR>
nnoremap <silent> <space>cg :call CocAction('jumpDefinition')<CR>
nnoremap <silent> <space>ci :call CocAction('jumpImplementation')<CR>
nnoremap <silent> <space>cr :call CocAction('jumpReferences')<CR>
nnoremap <silent> <space>cm :call CocAction('rename')<CR>
nnoremap <silent> <space>ca :call CocAction('codeAction')<CR>
nnoremap <silent> <space>cs :call CocAction('documentSymbols')<CR>
nnoremap <silent> <space>cS :call CocAction('workspaceSymbols')<CR>
nnoremap <silent> ]c :call CocAction('diagnosticNext')<CR>
nnoremap <silent> [c :call CocAction('diagnosticPrevious')<CR>
command! -nargs=0 Format :call CocAction('format')
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" }}}
" #delimitMate{{{
" https://github.com/Raimondi/delimitMate
" automatic quote, paranthesis,etc closing.
Plug 'Raimondi/delimitMate'
let delimitMate_expand_cr = 1
let delimitMate_expand_space = 1
"}}}
" #echodoc.vim{{{
" https://github.com/Shougo/echodoc.vim
Plug 'Shougo/echodoc.vim'
"}}}
" #emmet-vim {{{
" https://github.com/mattn/emmet-vim
Plug 'mattn/emmet-vim'
@ -61,6 +70,7 @@ call plug#begin('~/.config/nvim/bundle')
"}}}
" #gitgutter {{{
" https://github.com/airblade/vim-gitgutter/blob/master/README.mkd
" show git diff in sign column
Plug 'airblade/vim-gitgutter'
nmap ]h <Plug>(GitGutterNextHunk)
@ -72,6 +82,7 @@ call plug#begin('~/.config/nvim/bundle')
"}}}
" #MatchTagAlways{{{
" always highlights xml/html tags enclosing cursor
" https://github.com/Valloric/MatchTagAlways
Plug 'Valloric/MatchTagAlways'
let g:mta_filetypes = {
@ -82,26 +93,12 @@ let g:mta_filetypes = {
\ 'xml' : 1,
\}
"}}}
" #phpcomplete.vim{{{
" https://github.com/shawncplus/phpcomplete.vim
Plug 'shawncplus/phpcomplete.vim'
" https://github.com/dsawardekar/wordpress.vim
" For up to date Wordpress Files see:
" https://github.com/joseluis/wordpress.vim-generator
"}}}
" #quickscope{{{
" highlights unique characters when using f, F, etc
" https://github.com/unblevable/quick-scope
Plug 'unblevable/quick-scope'
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
"}}}
" #rainbow{{{
" https://github.com/luochen1990/rainbow/blob/master/README.md
Plug 'luochen1990/rainbow'
let g:rainbow_active = 0
nnoremap <cr>9 :RainbowToggle<cr>
nnoremap <cr>( :RainbowToggle<cr>
"}}}
" #switch {{{
"https://github.com/AndrewRadev/switch.vim
Plug 'AndrewRadev/switch.vim'
@ -118,52 +115,6 @@ let g:mta_filetypes = {
\ ['private', 'public', 'protected']
\ ]
"}}}
" #tagbar {{{
" Plug 'majutsushi/tagbar'
"
" nnoremap <space>tb :TagbarOpen fj<CR>
" nnoremap <space>] :tag /[.#@]<c-r>=expand('<cword>')<cr><cr>
" let g:tagbar_autoclose = 1
" " let g:tagbar_autopreview = 1
" " let g:tagbar_previewwin_pos = ''
"
" let g:tagbar_type_css = {
" \ 'ctagstype' : 'css',
" \ 'kinds' : [
" \ 'c:classes',
" \ 'i:ids',
" \ 't:tags',
" \ 'm:medias'
" \ ]
" \}
"
" let g:tagbar_type_scss = {
" \ 'ctagstype' : 'scss',
" \ 'kinds' : [
" \ 'v:variables',
" \ 'c:classes',
" \ 'i:ids',
" \ 't:tags',
" \ 'd:medias',
" \ 'm:mixins',
" \ 'f:functions'
" \ ]
" \}
"
" let g:tagbar_type_vue = {
" \ 'ctagstype' : 'vue',
" \ 'kinds' : [
" \ 'o:objects',
" \ 'f:functions',
" \ 'a:array',
" \ 's:string',
" \ 'b:boolean',
" \ 'n:number',
" \ 'v:variable'
" \ ]
" \ }
"}}}
" #ultisnips {{{
" https://github.com/sirver/UltiSnips
@ -220,72 +171,6 @@ let g:mta_filetypes = {
set completefunc=CompleteSnippets
"}}}
" #vim-dispatch{{{
" https://github.com/tpope/vim-dispatch
Plug 'tpope/vim-dispatch'
"}}}
" #vim-easy-align {{{
" https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
"}}}
" #vim-floaterm{{{
" https://github.com/voldikss/floaterm
Plug 'voldikss/vim-floaterm'
let g:floaterm_opener = 'edit'
nnoremap <space>lf :FloatermNew --height=0.9 --width=0.9 lf<CR>
nnoremap <space>lg :FloatermNew --height=0.9 --width=0.9 lazygit<CR>
"}}}
" #vim-gutentags {{{
" https://github.com/ludovicchabant/vim-gutentags
" Plug 'ludovicchabant/vim-gutentags'
"
" let g:gutentags_ctags_tagfile = '.tags'
" let g:gutentags_ctags_exclude = ['package.json', 'Session.vim', 'package-lock.json', 'TODO.txt']
" let g:gutentags_resolve_symlinks = 1
"}}}
" #vim-Jinja2-Syntax{{{
" https://github.com/studio-vx/Vim-Jinja2-Syntax
" original: https://github.com/Glench/Vim-Jinja2-Syntax
Plug 'studio-vx/Vim-Jinja2-Syntax'
"}}}
" #vim-shellcheck{{{
" https://github.com/itspriddle/vim-shellcheck
Plug 'itspriddle/vim-shellcheck'
"}}}
" #vim-SyntaxRange{{{
" https://github.com/inkarkat/vim-SyntaxRange
" Plug 'inkarkat/vim-SyntaxRange'
" command! HiJinja call SyntaxRange#Include('{{', '}}', 'jinja', 'jinjaBraces', 'jinjaVariable')
" command! HiJinja call SyntaxRange#IncludeEx('start=/{{-\?/hs=s+2 end=/-\?}}/he=s-1', 'jinja')
"}}}
" #vim-Styled-components{{{
"https://github.com/styled-components/vim-styled-components
Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
"}}}
" #wordpress.vim{{{
" doesn't support universal ctags
" #Plug 'dsawardekar/wordpress.vim'
" This fork does:
" https://github.com/DArcMattr/wordpress.vim/tree/universal-ctags
" Using studio-vx fork
" Plug 'studio-vx/wordpress.vim', { 'branch': 'universal-ctags' }
"}}}
" #vim-git{{{
" https://github.com/tpope/vim-git
Plug 'tpope/vim-git'
"}}}
" #Netrw {{{
let g:netrw_liststyle=3
@ -302,17 +187,34 @@ let g:mta_filetypes = {
" fork of tpope/vim-obsession
Plug 'studio-vx/vim-obsession'
"}}}
" #undotree {{{
Plug 'mbbill/undotree'
nnoremap <space>ut :UndotreeToggle<cr>
"}}}
" #tcomment_vim{{{
" https://github.com/tomtom/tcomment_vim
Plug 'tomtom/tcomment_vim'
"}}}
" #vim-rsi{{{
"https://github.com/tpope/vim-rsi
Plug 'tpope/vim-rsi'
"}}}
" #wakatime{{{
" https://wakatime.com/vim
Plug 'wakatime/vim-wakatime'
"}}}
" #vim-repeat{{{
" https://github.com/tpope/vim-repeat
" makes repeat . work for more stuff
Plug 'tpope/vim-repeat'
"}}}
" #vim-surround{{{
Plug 'tpope/vim-surround'
"}}}
" reconfigure and learn to use properly
" #vim-fzf {{{
" https://github.com/junegunn/fzf.vim
Plug 'junegunn/fzf'
@ -342,46 +244,211 @@ let g:fzf_colors =
\ 'header': ['fg', 'Comment'] }
"}}}
" #polyglot{{{
" https://github.com/sheerun/vim-polyglot
Plug 'sheerun/vim-polyglot'
" #vim-shellcheck{{{
" https://github.com/itspriddle/vim-shellcheck
Plug 'itspriddle/vim-shellcheck'
" vue options
let g:vue_disable_pre_processors=0
" set custom syntax highlighting
augroup fixhighlighting
autocmd!
autocmd BufNewFile,BufRead *.vue syntax sync fromstart
augroup END
"}}}
"}}}
" #vim-markdown{{{
" https://github.com/plasticboy/vim-markdown
Plug 'plasticboy/vim-markdown'
let g:vim_markdown_toc_autofit = 1
let g:vim_markdown_fenced_languages = ['bash=sh']
"}}}
" #vim-repeat{{{
" https://github.com/tpope/vim-repeat
Plug 'tpope/vim-repeat'
" #undotree {{{
Plug 'mbbill/undotree'
nnoremap <space>ut :UndotreeToggle<cr>
"}}}
" #vim-rsi{{{
"https://github.com/tpope/vim-rsi
Plug 'tpope/vim-rsi'
" do i still need, can i replace?
" #vim-dispatch{{{
" https://github.com/tpope/vim-dispatch
Plug 'tpope/vim-dispatch'
"}}}
" #vim-surround{{{
Plug 'tpope/vim-surround'
" #phpcomplete.vim{{{
" improved php completion
" https://github.com/shawncplus/phpcomplete.vim
Plug 'shawncplus/phpcomplete.vim'
" https://github.com/dsawardekar/wordpress.vim
" For up to date Wordpress Files see:
" https://github.com/joseluis/wordpress.vim-generator
"}}}
" #wakatime{{{
" https://wakatime.com/vim
Plug 'wakatime/vim-wakatime'
" #vim-floaterm{{{
" https://github.com/voldikss/floaterm
" allows to open floating terminal
Plug 'voldikss/vim-floaterm'
let g:floaterm_opener = 'edit'
nnoremap <space>lf :FloatermNew --height=0.9 --width=0.9 lf<CR>
nnoremap <space>lg :FloatermNew --height=0.9 --width=0.9 lazygit<CR>
"}}}
" #vim-Jinja2-Syntax{{{
" https://github.com/studio-vx/Vim-Jinja2-Syntax
" original: https://github.com/Glench/Vim-Jinja2-Syntax
Plug 'studio-vx/Vim-Jinja2-Syntax'
"}}}
" ------------------------------------------------------------------------------
" get rid
" #coc.nvim{{{
" https://github.com/neoclide/coc.nvim
" SEE BOTTOM OF THIS FILE FOR coc#add_extension statement
" for some reason fails when added some other places
" Plug 'neoclide/coc.nvim', {'branch': 'release', 'do': { -> coc#util#install()}}
" let g:coc_snippet_next = '<tab>'
" let g:coc_snippet_prev = '<s-tab>'
" inoremap <silent><expr> <c-n> coc#refresh()
nnoremap <silent> <silent> <space><space> :call CocAction('doHover')<CR>
nnoremap <silent> <space>cf :call CocAction('doQuickfix')<CR>
nnoremap <silent> <space>cg :call CocAction('jumpDefinition')<CR>
nnoremap <silent> <space>ci :call CocAction('jumpImplementation')<CR>
nnoremap <silent> <space>cr :call CocAction('jumpReferences')<CR>
nnoremap <silent> <space>cm :call CocAction('rename')<CR>
nnoremap <silent> <space>ca :call CocAction('codeAction')<CR>
nnoremap <silent> <space>cs :call CocAction('documentSymbols')<CR>
nnoremap <silent> <space>cS :call CocAction('workspaceSymbols')<CR>
nnoremap <silent> ]c :call CocAction('diagnosticNext')<CR>
nnoremap <silent> [c :call CocAction('diagnosticPrevious')<CR>
command! -nargs=0 Format :call CocAction('format')
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" }}}
" #polyglot{{{
" https://github.com/sheerun/vim-polyglot
" Plug 'sheerun/vim-polyglot'
" vue options
" let g:vue_disable_pre_processors=0
" set custom syntax highlighting
" augroup fixhighlighting
" autocmd!
" autocmd BufNewFile,BufRead *.vue syntax sync fromstart
" augroup END
"}}}
" #echodoc.vim{{{
" https://github.com/Shougo/echodoc.vim
" display function signatures fromm completions in the command line
" Plug 'Shougo/echodoc.vim'
"}}}
" #rainbow{{{
" https://github.com/luochen1990/rainbow/blob/master/README.md
" Plug 'luochen1990/rainbow'
" let g:rainbow_active = 0
" nnoremap <cr>9 :RainbowToggle<cr>
" nnoremap <cr>( :RainbowToggle<cr>
"}}}
" #vim-easy-align {{{
" https://github.com/junegunn/vim-easy-align
" Plug 'junegunn/vim-easy-align'
"
" xmap ga <Plug>(EasyAlign)
" nmap ga <Plug>(EasyAlign)
"}}}
" #vim-git{{{
" https://github.com/tpope/vim-git
" Plug 'tpope/vim-git'
"}}}
call plug#end()
runtime macros/matchit.vim
" Configurations
" #nvim-treesitter {{{
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ignore_install = { "c" }, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
disable = { "c", "rust" }, -- list of language that will be disabled
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
EOF
"}}}
" #nvim-lspconfig {{{
" https://github.com/neovim/nvim-lspconfig
" https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md
lua << EOF
-- npm install -g typescript typescript-language-server
require'lspconfig'.tsserver.setup{}
-- npm install -g vim-language-server
require'lspconfig'.vimls.setup{}
-- npm install -g pyright
require'lspconfig'.pyright.setup{}
-- phpactor installation -
-- https://phpactor.readthedocs.io/en/master/usage/standalone.html
require'lspconfig'.phpactor.setup{}
-- npm i -g vscode-langservers-extracted
require'lspconfig'.cssls.setup{}
-- npm install -g vls
require'lspconfig'.vuels.setup{}
-- npm i -g bash-language-server
-- TODO - don't run for sh files but have something else instead - shellcheck?
require'lspconfig'.bashls.setup{}
-- npm install -g yaml-language-server
require'lspconfig'.yamlls.setup{}
-- npm i -g stylelint-lsp
require'lspconfig'.stylelint_lsp.setup{}
-- https://github.com/neovim/nvim-lspconfig/wiki
require'lspconfig'.tailwindcss.setup{}
-- efm-langserver settings
-- npm install -g eslint_d
local eslint = {
lintCommand = "eslint_d -f unix --stdin --stdin-filename ${INPUT}",
lintStdin = true,
lintFormats = {"%f:%l:%c: %m"},
lintIgnoreExitCode = true,
formatCommand = "eslint_d --fix-to-stdout --stdin --stdin-filename=${INPUT}",
formatStdin = true
}
local shellcheck = {
lintCommand = "shellcheck -f gcc -x",
lintSource = "shellcheck",
lintFormats = {
"%f:%l:%c: %trror: %m",
"%f:%l:%c: %tarning: %m",
"%f:%l:%c: %tote: %m",
}
}
local util = require "lspconfig".util
require "lspconfig".efm.setup {
init_options = {documentFormatting = true},
filetypes = {"javascript", "typescript", "sh"},
root_dir = function(fname)
return util.root_pattern("tsconfig.json")(fname) or
util.root_pattern(".eslintrc.js", ".git")(fname);
end,
settings = {
rootMarkers = {".eslintrc.js", ".git/"},
languages = {
javascript = {eslint},
typescript = {eslint},
sh = {shellcheck}
}
}
}
EOF
"}}}
" vim: set fdm=marker ft=vim:

View File

@ -166,3 +166,9 @@ Cloudways
anime
Yoast
WordPress's
eigenbase
eigenbasis
Maclaurin
Multivariable
erimplement
particularly

Binary file not shown.