Just Midi
4ca63a5884
Installation scripts for: + bashls + ccls + clangd + pylsp + pyright + sumneko + zls And adjusted a few keymaps
181 lines
8.2 KiB
Lua
181 lines
8.2 KiB
Lua
-- see `:help` for any questions
|
|
-- use `&<var>` to show value of vimscript variable
|
|
|
|
|
|
-- API --
|
|
-- o = vim.o -- options
|
|
-- go = vim.go -- only-global options
|
|
-- bo = vim.bo -- buffer local options
|
|
-- wo = vim.wo -- window local options
|
|
|
|
-- cmd = vim.cmd -- vim commands
|
|
-- fn = vim.fn -- vim functions
|
|
-- opt = vim.opt -- vim option object
|
|
|
|
-- g = vim.g -- global variables
|
|
-- b = vim.b -- buffer local variables
|
|
-- w = vim.w -- window local variables
|
|
-- t = vim.t -- tab local variables
|
|
-- v = vim.v -- variables
|
|
-- env = vim.env -- environment variables
|
|
|
|
-- dependent on https://github.com/neovim/nvim-lspconfig
|
|
local lspconfig = require 'lspconfig'
|
|
|
|
function lsp_init()
|
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md
|
|
local lsp_filetype = {
|
|
['ada'] = {'als'},
|
|
['aspnetcorerazor'] = {'tailwindcss'},
|
|
['astro'] = {'tailwindcss'},
|
|
['astro-markdown'] = {'tailwindcss'},
|
|
['beancount'] = {'beancount'},
|
|
['bib'] = {'texlab'},
|
|
['bicep'] = {'bicep'},
|
|
['blade'] = {'tailwindcss'},
|
|
['c'] = {'ccls','clangd','sourcekit'},
|
|
['clojure'] = {'clojure_lsp'},
|
|
['cmake'] = {'cmake'},
|
|
-- = {'config'},
|
|
['cpp'] = {'ccls','clangd','sourcekit'},
|
|
['crystal'] = {'crystalline','scry'},
|
|
['css'] = {'cssls','stylelint_lsp','tailwindcss'},
|
|
['d'] = {'serve_d'},
|
|
['dart'] = {'dartls'},
|
|
['dhall'] = {'dhall_lsp_server'},
|
|
['django-html'] = {'tailwindcss'},
|
|
['Dockerfile'] = {'dockerls'},
|
|
['dockerfile'] = {'dockerls'},
|
|
['dot'] = {'dotls'},
|
|
-- = {'diagnostics'},
|
|
['edge'] = {'tailwindcss'},
|
|
['edn'] = {'clojure_lsp'},
|
|
['eelixir'] = {'elixirls','tailwindcss'},
|
|
-- = {'efm'},
|
|
['elixir'] = {'elixirls'},
|
|
['elm'] = {'elmls'},
|
|
['ejs'] = {'tailwindcss'},
|
|
['erb'] = {'tailwindcss'},
|
|
['erlang'] = {'erlangls'},
|
|
['eruby'] = {'tailwindcss'},
|
|
['fortran'] = {'fortls'},
|
|
['fsharp'] = {'fsautocomplete'},
|
|
['gd'] = {'gdscript'},
|
|
['gdscript'] = {'gdscript'},
|
|
['gdscript3'] = {'gdscript'},
|
|
['genie'] = {'vala_ls'},
|
|
['go'] = {'gopls'},
|
|
['gohtml'] = {'tailwindcss'},
|
|
['gomod'] = {'gopls'},
|
|
['graphql'] = {'graphql'},
|
|
['groovy'] = {'groovyls'},
|
|
['haml'] = {'tailwindcss'},
|
|
['handlebars'] = {'ember','tailwindcss'},
|
|
['haskell'] = {'ghcide','hie','hls'},
|
|
['haxe'] = {'haxe_language_server'},
|
|
['hbs'] = {'tailwindcss'},
|
|
-- = {'health'},
|
|
['help'] = {},
|
|
['html'] = {'angular','html','tailwindcss'},
|
|
['html-eex'] = {'tailwindcss'},
|
|
['jade'] = {'tailwindcss'},
|
|
['java'] = {'java_language_server','jdtls'},
|
|
['javascript'] = {'denols','ember','flow','rome','stylelint_lsp','tsserver','tailwindcss'},
|
|
['javascriptreact'] = {'denols','flow','rome','stylelint_lsp','tsserver','tailwindcss'},
|
|
['javascript.jsx'] = {'denols','flow','tsserver'},
|
|
['json'] = {'jsonls','rome'},
|
|
['julia'] = {'julials'},
|
|
['kotlin'] = {'kotlin_language_server'},
|
|
['leaf'] = {'tailwindcss'},
|
|
['lean'] = {'leanls'},
|
|
['lean3'] = {'lean3ls'},
|
|
['less'] = {'cssls','stylelint_lsp','tailwindcss'},
|
|
['lhaskell'] = {'ghcide','hls'},
|
|
-- = {'lspinfo'},
|
|
['liquid'] = {'tailwindcss'},
|
|
['lua'] = {'sumneko_lua'},
|
|
['markdown'] = {'zeta_note','tailwindcss'},
|
|
['mdx'] = {'tailwindcss'},
|
|
['mint'] = {'mint'},
|
|
['mustache'] = {'tailwindcss'},
|
|
['mysql'] = {'sqlls','sqls'},
|
|
['nim'] = {'nimls'},
|
|
['nix'] = {'rnix'},
|
|
['njk'] = {'tailwindcss'},
|
|
['nunjucks'] = {'tailwindcss'},
|
|
['objc'] = {'ccls','clangd'},
|
|
['objcpp'] = {'ccls','clangd'},
|
|
['objective-c'] = {'sourcekit'},
|
|
['objective-cpp'] = {'sourcekit'},
|
|
['ocaml'] = {'ocamlls','ocamllsp'},
|
|
['ocaml.menhir'] = {'ocamllsp'},
|
|
['ocaml.interface'] = {'ocamllsp'},
|
|
['ocaml.ocamllex'] = {'ocamllsp'},
|
|
['perl'] = {'perlls','perlpls'},
|
|
['php'] = {'intelephense','phpactor','tailwindcss'},
|
|
['prisma'] = {'prismals'},
|
|
['ps1'] = {'powershell_es'},
|
|
['puppet'] = {'puppet'},
|
|
['purescript'] = {'purescriptls'},
|
|
['python'] = {'jedi_language_server','pylsp','pyright'},
|
|
['ql'] = {'codeqlls'},
|
|
['r'] = {'r_language_server'},
|
|
['racket'] = {'racket_langserver'},
|
|
['razor'] = {'tailwindcss'},
|
|
['reason'] = {'ocamlls','ocamllsp','tailwindcss'},
|
|
['rescript'] = {'rescript','tailwindcss'},
|
|
['rmd'] = {'r_language_server'},
|
|
['ruby'] = {'solargraph','sorbet'},
|
|
['rust'] = {'rls','rust_analyzer'},
|
|
['sass'] = {'tailwindcss'},
|
|
['scala'] = {'metals'},
|
|
['scheme'] = {'racket_langserver'},
|
|
['scss'] = {'cssls','stylelint_lsp','tailwindcss'},
|
|
['sh'] = {'bashls'},
|
|
['slim'] = {'tailwindcss'},
|
|
['stylus'] = {'tailwindcss'},
|
|
['sql'] = {'sqlls','sqls'},
|
|
['sugarss'] = {'stylelint_lsp','tailwindcss'},
|
|
['svelte'] = {'svelte','tailwindcss'},
|
|
['swift'] = {'source'},
|
|
['systemverilog'] = {'svls'},
|
|
['tex'] = {'texlab'},
|
|
['terraform'] = {'tflint','teraformls'},
|
|
['twig'] = {'tailwindcss'},
|
|
['typescript'] = {'angular', 'denols','ember','rome','stylelint_lsp','tsserver','tailwindcss'},
|
|
['typescriptreact'] = {'angular', 'denols','rome','stylelint_lsp','tsserver','tailwindcss'},
|
|
['typescript.tsx'] = {'angular', 'denols','rome','tsserver'},
|
|
-- = {'util'},
|
|
['vala'] = {'vala_ls'},
|
|
['verilog'] = {'svls'},
|
|
['vim'] = {'vimls'},
|
|
['vlang'] = {'vls'},
|
|
['vue'] = {'stylelint_lsp','vuels','tailwindcss'},
|
|
['wxss'] = {'stylelint_lsp'},
|
|
['yaml'] = {'ansiblels','yamlls'},
|
|
['zig'] = {'zls'},
|
|
['zir'] = {'zls'}
|
|
}
|
|
|
|
for _,server in pairs(lsp_filetype[bo.filetype]) do
|
|
lspconfig[server].setup {}
|
|
end
|
|
end
|
|
|
|
function lsp_format()
|
|
local function format_file()
|
|
if bo.filetype == x then
|
|
vim.lsp.formatting_sync(nil, 100)
|
|
end
|
|
end
|
|
|
|
for _,file in pairs({'javascript', 'python'}) do
|
|
format_file(file)
|
|
end
|
|
end
|
|
|
|
cmd('autocmd BufRead * lua lsp_init()')
|
|
cmd('autocmd BufWritePre * lua lsp_format()')
|
|
|
|
|
|
require 'nvim-compe.lua'
|