Compare commits
17 changed files with 179 additions and 84 deletions
1
nvim/lua/dzu/lsp/.gitignore
vendored
1
nvim/lua/dzu/lsp/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
*.lua_
|
|
||||||
1
nvim/lua/dzu/lsp/dockerls.lua
Normal file
1
nvim/lua/dzu/lsp/dockerls.lua
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
return {}
|
||||||
|
|
@ -18,4 +18,28 @@ return {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
-- cmd = { "haskell-language-server-wrapper", "--lsp", "-Wall" }
|
||||||
|
-- formattingProvider = "hls-stylish-haskell-plugin",
|
||||||
|
-- CRED: https://github.com/haskell/haskell-language-server/issues/4363 -- does not
|
||||||
|
-- work
|
||||||
|
--[[
|
||||||
|
settings = {
|
||||||
|
plugin = {
|
||||||
|
-- CRED: https://github.com/haskell/haskell-language-server/issues/680 --
|
||||||
|
-- does not work too!
|
||||||
|
['ghcide'] = {
|
||||||
|
completionOn = false,
|
||||||
|
},
|
||||||
|
['pramas'] = {
|
||||||
|
completionOn = false,
|
||||||
|
},
|
||||||
|
['ghcide-completions'] = {
|
||||||
|
config = {
|
||||||
|
snippetsOn = false,
|
||||||
|
autoExtendOn = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]] --
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,14 @@ if not is_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- -- format code on save
|
-- format code on save
|
||||||
-- vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
-- pattern = {
|
pattern = {
|
||||||
-- "*.rs", -- rust sources
|
"*.rs", -- rust sources
|
||||||
-- "*.py", -- python sources
|
"*.py", -- python sources
|
||||||
-- "*.js", -- javascript sources
|
"*.js", -- javascript sources
|
||||||
-- "*.html", -- html files
|
},
|
||||||
-- },
|
callback = function(ev)
|
||||||
-- callback = function(ev)
|
vim.lsp.buf.format()
|
||||||
-- vim.lsp.buf.format()
|
end,
|
||||||
-- end,
|
})
|
||||||
-- })
|
|
||||||
|
|
|
||||||
7
nvim/lua/dzu/lsp/jdtls.lua
Normal file
7
nvim/lua/dzu/lsp/jdtls.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
java = {
|
||||||
|
classPath = { "*.jar" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,22 @@
|
||||||
|
local servers = {
|
||||||
|
"rust_analyzer", -- rust
|
||||||
|
"pyright", -- has no code formatting
|
||||||
|
-- "marksman", -- markdown
|
||||||
|
"ts_ls", -- js, ts, tsx
|
||||||
|
"clangd", -- C
|
||||||
|
"lua_ls",
|
||||||
|
"hls",
|
||||||
|
"nil_ls",
|
||||||
|
"tinymist",
|
||||||
|
"dockerls",
|
||||||
|
"html",
|
||||||
|
-- "jdtls",
|
||||||
|
-- "xmlformatter"
|
||||||
|
}
|
||||||
|
local nvimlsp_only_servers = {
|
||||||
|
"nushell",
|
||||||
|
}
|
||||||
|
|
||||||
local settings = {
|
local settings = {
|
||||||
ui = {
|
ui = {
|
||||||
border = "none",
|
border = "none",
|
||||||
|
|
@ -10,47 +29,14 @@ local settings = {
|
||||||
log_level = vim.log.levels.INFO,
|
log_level = vim.log.levels.INFO,
|
||||||
max_concurrent_installers = 4,
|
max_concurrent_installers = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
require("mason").setup(settings)
|
require("mason").setup(settings)
|
||||||
|
|
||||||
local servers = {
|
|
||||||
{ "rust_analyzer", "rust_analyzer" },
|
|
||||||
{ "pyright", "pyright", },
|
|
||||||
{ "ts_ls", nil },
|
|
||||||
{ "biome", nil },
|
|
||||||
{ "clangd", nil },
|
|
||||||
{ "lua_ls", "lua_ls" },
|
|
||||||
-- { "hls", "hls" },
|
|
||||||
{ "nil_ls", nil },
|
|
||||||
{ "tinymist", "tinymist" },
|
|
||||||
{ "jdtls", nil },
|
|
||||||
-- { "nushell", nil }, -- TODO what IS the lspconfig name?
|
|
||||||
{ "html", nil },
|
|
||||||
{ "dockerls", nil },
|
|
||||||
}
|
|
||||||
local lspconfig_servers = {}
|
|
||||||
for _, s in pairs(servers) do
|
|
||||||
local s0 = s[1]
|
|
||||||
if s0 ~= nil then
|
|
||||||
table.insert(lspconfig_servers, s0)
|
|
||||||
vim.lsp.enable(s0, true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
require("mason-lspconfig").setup({
|
require("mason-lspconfig").setup({
|
||||||
ensure_installed = lspconfig_servers,
|
ensure_installed = servers,
|
||||||
automatic_enable = true,
|
automatic_enable = false,
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
local config_servers = {}
|
|
||||||
for _, s in pairs(servers) do
|
|
||||||
local s1 = s[2]
|
|
||||||
if s1 ~= nil then
|
|
||||||
table.insert(config_servers, s1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local is_ok, handlers = pcall(require, "dzu.lsp.handlers")
|
local is_ok, handlers = pcall(require, "dzu.lsp.handlers")
|
||||||
if not is_ok then
|
if not is_ok then
|
||||||
vim.notify("failed to initialize LSP handlers")
|
vim.notify("failed to initialize LSP handlers")
|
||||||
|
|
@ -58,21 +44,31 @@ if not is_ok then
|
||||||
end
|
end
|
||||||
handlers.setup()
|
handlers.setup()
|
||||||
|
|
||||||
local opts = {
|
local opts = {}
|
||||||
|
|
||||||
|
local nvim_lsp_servers = {}
|
||||||
|
for _, nlsp_s in pairs(nvimlsp_only_servers) do
|
||||||
|
table.insert(nvim_lsp_servers, nlsp_s)
|
||||||
|
end
|
||||||
|
for _, s in pairs(servers) do
|
||||||
|
table.insert(nvim_lsp_servers, s)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, server in pairs(nvim_lsp_servers) do
|
||||||
|
opts = {
|
||||||
|
-- on_attach = handlers.on_attach,
|
||||||
capabilities = handlers.capabilities,
|
capabilities = handlers.capabilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, server in pairs(config_servers) do
|
|
||||||
server = vim.split(server, "@")[1]
|
server = vim.split(server, "@")[1]
|
||||||
|
|
||||||
local is_ok, conf_opts = pcall(require, "dzu.lsp." .. server)
|
local is_ok, conf_opts = pcall(require, "dzu.lsp." .. server)
|
||||||
if not is_ok then
|
if is_ok then
|
||||||
|
opts = vim.tbl_deep_extend("force", conf_opts, opts)
|
||||||
|
else
|
||||||
vim.notify("Failed to initialize config for " .. server)
|
vim.notify("Failed to initialize config for " .. server)
|
||||||
goto continue
|
|
||||||
end
|
end
|
||||||
local opts0 = vim.tbl_deep_extend("force", conf_opts, opts)
|
|
||||||
|
|
||||||
vim.lsp.config(server, opts0)
|
vim.lsp.config(server, opts)
|
||||||
vim.lsp.enable(server, true)
|
vim.lsp.enable(server, true)
|
||||||
::continue::
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
4
nvim/lua/dzu/lsp/nil_ls.lua
Normal file
4
nvim/lua/dzu/lsp/nil_ls.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
-- (nix lsp)
|
||||||
|
|
||||||
|
return {
|
||||||
|
}
|
||||||
6
nvim/lua/dzu/lsp/nushell.lua
Normal file
6
nvim/lua/dzu/lsp/nushell.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
cmd = { "nu", "--plugins", "[~/.cargo/bin/nu_plugin_polars]", "--lsp", },
|
||||||
|
filetypes = { "nu" },
|
||||||
|
root_dir = require("lspconfig.util").find_git_ancestor,
|
||||||
|
single_file_support = true,
|
||||||
|
}
|
||||||
1
nvim/lua/dzu/lsp/ts_ls.lua
Normal file
1
nvim/lua/dzu/lsp/ts_ls.lua
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
return {}
|
||||||
|
|
@ -8,13 +8,16 @@ local function config()
|
||||||
-- js/ts fomatters
|
-- js/ts fomatters
|
||||||
local web_fmt = { "biome" };
|
local web_fmt = { "biome" };
|
||||||
local fomatters_by_ft = {
|
local fomatters_by_ft = {
|
||||||
lua = { "stylua" },
|
-- lua = { "stylua" },
|
||||||
python = { "black" },
|
python = { "black" },
|
||||||
javascript = web_fmt,
|
javascript = web_fmt,
|
||||||
javascriptreact = web_fmt,
|
javascriptreact = web_fmt,
|
||||||
typescript = web_fmt,
|
typescript = web_fmt,
|
||||||
typescriptreact = web_fmt,
|
typescriptreact = web_fmt,
|
||||||
json = web_fmt,
|
json = web_fmt,
|
||||||
|
haskell = { "fourmolu" },
|
||||||
|
lhaskell = { "fourmolu" },
|
||||||
|
cabal = { "fourmolu" },
|
||||||
-- nix = { "nixfmt" },
|
-- nix = { "nixfmt" },
|
||||||
cpp = { "clang-format" },
|
cpp = { "clang-format" },
|
||||||
xml = { "xmlformatter" },
|
xml = { "xmlformatter" },
|
||||||
|
|
|
||||||
15
nvim/lua/dzu/plugins/img-clip.lua
Normal file
15
nvim/lua/dzu/plugins/img-clip.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
return {
|
||||||
|
"HakonHarnes/img-clip.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
default = {
|
||||||
|
-- file and directory options
|
||||||
|
dir_path = "/home/dzu/.wiki/attachments/", ---@type string
|
||||||
|
extension = "png", ---@type string
|
||||||
|
file_name = "%Y-%m-%d-%H-%M-%S", ---@type string
|
||||||
|
use_absolute_path = false, ---@type boolean
|
||||||
|
relative_to_current_file = false, ---@type boolean
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lazy = false,
|
||||||
|
}
|
||||||
|
|
@ -25,12 +25,10 @@ local function config()
|
||||||
typescript = web_linters,
|
typescript = web_linters,
|
||||||
typescriptreact = web_linters,
|
typescriptreact = web_linters,
|
||||||
json = web_linters,
|
json = web_linters,
|
||||||
-- haskell = { 'hlint' },
|
haskell = { 'hlint' },
|
||||||
-- lhaskell = { 'hlint' },
|
lhaskell = { 'hlint' },
|
||||||
-- cabal = { 'hlint' },
|
cabal = { 'hlint' },
|
||||||
-- dockerfile = { "hadolint" }, -- kinda broken?
|
dockerfile = { "hadolint" },
|
||||||
gitcommit = { 'gitlint' },
|
|
||||||
html = { 'htmlhint' },
|
|
||||||
}
|
}
|
||||||
-- add to tool list
|
-- add to tool list
|
||||||
for _, lints in pairs(names(linters_by_ft, "mason")) do
|
for _, lints in pairs(names(linters_by_ft, "mason")) do
|
||||||
|
|
@ -43,7 +41,7 @@ local function config()
|
||||||
|
|
||||||
-- autolint on save
|
-- autolint on save
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePost", "BufReadPost" }, {
|
vim.api.nvim_create_autocmd({ "BufWritePost", "BufReadPost" }, {
|
||||||
pattern = { "*.js", "*.ts", "*.jsx", "*.tsx", "*.json", "*.hs", "*.html", "*COMMIT_EDITMSG" },
|
pattern = { "*.js", "*.ts", "*.jsx", "*.tsx", "*.json", "*.hs", "*Dockerfile*" },
|
||||||
callback = function(_)
|
callback = function(_)
|
||||||
lint.try_lint()
|
lint.try_lint()
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
-- CRED: nvim from scratch - https://github.com/LunarVim/Neovim-from-scratch/blob/06-LSP/lua/user/lsp/handlers.lua
|
||||||
local function config()
|
local function config()
|
||||||
local is_ok, _ = pcall(require, 'dzu.lsp')
|
local is_ok, _ = pcall(require, 'dzu.lsp')
|
||||||
if not is_ok then
|
if not is_ok then
|
||||||
|
|
@ -7,13 +8,16 @@ local function config()
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"mason-org/mason-lspconfig.nvim",
|
|
||||||
opts = {},
|
|
||||||
dependencies = {
|
|
||||||
"mason-org/mason.nvim",
|
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
-- lsp completions
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
{
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
lazy = false,
|
||||||
|
}, -- lsp suggestions
|
||||||
|
-- "jose-elias-alvarez/null-ls.nvim",
|
||||||
|
-- "jay-babu/mason-null-ls.nvim",
|
||||||
},
|
},
|
||||||
config = config,
|
config = config,
|
||||||
lazy = false,
|
lazy = false,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
return {
|
|
||||||
"mason-org/mason.nvim",
|
|
||||||
opts = {}
|
|
||||||
}
|
|
||||||
13
nvim/lua/dzu/plugins/nvim-jdtls.lua
Normal file
13
nvim/lua/dzu/plugins/nvim-jdtls.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
local function config()
|
||||||
|
local is_ok, jdtls = pcall(require, "jdtls")
|
||||||
|
if not is_ok then
|
||||||
|
vim.notify "Couldn't load jdtls (java additional LSP plugin)"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-jdtls",
|
||||||
|
config = config,
|
||||||
|
lazy = true,
|
||||||
|
}
|
||||||
|
|
@ -17,9 +17,7 @@ local function config()
|
||||||
"dockerfile", -- oh yeah. I should probably figure docker out...
|
"dockerfile", -- oh yeah. I should probably figure docker out...
|
||||||
"fish",
|
"fish",
|
||||||
"gitignore",
|
"gitignore",
|
||||||
"diff",
|
-- "git_commit",
|
||||||
"git_rebase",
|
|
||||||
"gitcommit",
|
|
||||||
"haskell",
|
"haskell",
|
||||||
"html",
|
"html",
|
||||||
"javascript",
|
"javascript",
|
||||||
|
|
@ -41,13 +39,12 @@ local function config()
|
||||||
"vimdoc",
|
"vimdoc",
|
||||||
"xml",
|
"xml",
|
||||||
"nu",
|
"nu",
|
||||||
"java",
|
|
||||||
},
|
},
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
ignore_install = {}, -- List of parsers to ignore installing
|
ignore_install = { "" }, -- List of parsers to ignore installing
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true, -- false will disable the whole extension
|
enable = true, -- false will disable the whole extension
|
||||||
disable = {}, -- list of language that will be disabled
|
disable = { "" }, -- list of language that will be disabled
|
||||||
additional_vim_regex_highlighting = true,
|
additional_vim_regex_highlighting = true,
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -55,6 +52,38 @@ local function config()
|
||||||
}
|
}
|
||||||
configs.setup(config_opts)
|
configs.setup(config_opts)
|
||||||
|
|
||||||
|
-- latex parser
|
||||||
|
local is_ok, parsers = pcall(require, 'nvim-treesitter.parsers')
|
||||||
|
if not is_ok then
|
||||||
|
vim.notify("couldn't find tree sitter parsers")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local parser_configs = parsers.get_parser_configs()
|
||||||
|
parser_configs.latex = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/latex-lsp/tree-sitter-latex",
|
||||||
|
files = { "src/parser.c", "src/scanner.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc
|
||||||
|
-- optional entries:
|
||||||
|
-- branch = "master", -- default branch in case of git repo if different from master
|
||||||
|
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
||||||
|
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
|
||||||
|
},
|
||||||
|
filetype = "tex", -- if filetype does not match the parser name
|
||||||
|
}
|
||||||
|
|
||||||
|
-- git commit parser
|
||||||
|
parser_configs.git_commit = {
|
||||||
|
install_info = {
|
||||||
|
url = "~/Repositories/random/tree-sitter-git-commit/",
|
||||||
|
files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc
|
||||||
|
-- optional entries:
|
||||||
|
-- branch = "master", -- default branch in case of git repo if different from master
|
||||||
|
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
||||||
|
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
|
||||||
|
},
|
||||||
|
filetype = "gitcommit", -- if filetype does not match the parser name
|
||||||
|
}
|
||||||
|
|
||||||
vim.cmd.TSUpdate()
|
vim.cmd.TSUpdate()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ local function config()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
url_open.setup({
|
url_open.setup({
|
||||||
open_app = 'default',
|
open_app = 'librewolf',
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue