mirror of
https://github.com/kristoferssolo/SoloVim.git
synced 2026-02-04 14:52:04 +00:00
Installed tabnine
This commit is contained in:
113
lua/solo/mason/handlers.lua
Normal file
113
lua/solo/mason/handlers.lua
Normal file
@@ -0,0 +1,113 @@
|
||||
local M = {}
|
||||
|
||||
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not status_cmp_ok then
|
||||
return
|
||||
end
|
||||
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
|
||||
|
||||
M.setup = function()
|
||||
local signs = {
|
||||
|
||||
{ name = "DiagnosticSignError", text = "" },
|
||||
{ name = "DiagnosticSignWarn", text = "" },
|
||||
{ name = "DiagnosticSignHint", text = "" },
|
||||
{ name = "DiagnosticSignInfo", text = "" },
|
||||
}
|
||||
|
||||
for _, sign in pairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||
end
|
||||
|
||||
local config = {
|
||||
virtual_text = false, -- virtual text
|
||||
signs = {
|
||||
active = signs, -- show signs
|
||||
},
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
})
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<cr>", opts)
|
||||
keymap(bufnr, "n", "gd", "<cmd>lua require('telescope.builtin').lsp_definitions()<cr>", opts)
|
||||
keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", opts)
|
||||
keymap(bufnr, "n", "gI", "<cmd>lua vim.lsp.buf.implementation()<cr>", opts)
|
||||
keymap(bufnr, "n", "gr", "<cmd>lua require('telescope.builtin').lsp_references()<cr>", opts)
|
||||
keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<cr>", opts)
|
||||
end
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
lsp_keymaps(bufnr)
|
||||
local status_ok, illuminate = pcall(require, "illuminate")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
illuminate.configure({
|
||||
-- providers: provider used to get references in the buffer, ordered by priority
|
||||
providers = {
|
||||
"lsp",
|
||||
"treesitter",
|
||||
"regex",
|
||||
},
|
||||
-- delay: delay in milliseconds
|
||||
delay = 100,
|
||||
-- filetype_overrides: filetype specific overrides.
|
||||
-- The keys are strings to represent the filetype while the values are tables that
|
||||
-- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
|
||||
filetype_overrides = {},
|
||||
-- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
|
||||
filetypes_denylist = {
|
||||
"dirvish",
|
||||
"fugitive",
|
||||
"alpha",
|
||||
"NvimTree",
|
||||
},
|
||||
-- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist
|
||||
filetypes_allowlist = {},
|
||||
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist
|
||||
modes_denylist = {},
|
||||
-- modes_allowlist: modes to illuminate, this is overridden by modes_denylist
|
||||
modes_allowlist = {},
|
||||
-- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
|
||||
-- Only applies to the 'regex' provider
|
||||
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
||||
providers_regex_syntax_denylist = {},
|
||||
-- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist
|
||||
-- Only applies to the 'regex' provider
|
||||
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
||||
providers_regex_syntax_allowlist = {},
|
||||
-- under_cursor: whether or not to illuminate under the cursor
|
||||
under_cursor = true,
|
||||
-- max_file_lines: max number of lines in a file to illuminate
|
||||
max_file_lines = nil,
|
||||
})
|
||||
illuminate.on_attach(client)
|
||||
end
|
||||
|
||||
return M
|
||||
8
lua/solo/mason/init.lua
Normal file
8
lua/solo/mason/init.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local status_ok, _ = pcall(require, "mason-lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("solo.mason.mason-installer")
|
||||
require("solo.mason.handlers").setup()
|
||||
require("solo.mason.null-ls")
|
||||
84
lua/solo/mason/mason-installer.lua
Normal file
84
lua/solo/mason/mason-installer.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
local status_ok, mason = pcall(require, "mason")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
local status_lspconfig_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not status_lspconfig_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local status_mason_lspconfig_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if not status_mason_lspconfig_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local servers = {
|
||||
"bashls",
|
||||
"clangd",
|
||||
"cmake",
|
||||
"cssls",
|
||||
"emmet_ls",
|
||||
"html",
|
||||
"jedi_language_server",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"phpactor",
|
||||
"ruff_lsp",
|
||||
"rust_analyzer",
|
||||
"sqlls",
|
||||
"taplo",
|
||||
"texlab",
|
||||
"tsserver",
|
||||
}
|
||||
|
||||
mason.setup()
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = servers,
|
||||
})
|
||||
|
||||
local on_attach = require("solo.mason.handlers").on_attach
|
||||
local capabilities = require("solo.mason.handlers").capabilities
|
||||
for _, server in pairs(servers) do
|
||||
local opts = {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
if server == "bashls" then
|
||||
local bashls_opts = require("solo.mason.settings.bashls")
|
||||
opts = vim.tbl_deep_extend("force", bashls_opts, opts)
|
||||
end
|
||||
|
||||
if server == "lua_ls" then
|
||||
local lua_ls_opts = require("solo.mason.settings.lua_ls")
|
||||
opts = vim.tbl_deep_extend("force", lua_ls_opts, opts)
|
||||
end
|
||||
|
||||
if server == "emmet_ls" then
|
||||
local emmet_ls_opts = require("solo.mason.settings.emmet_ls")
|
||||
opts = vim.tbl_deep_extend("force", emmet_ls_opts, opts)
|
||||
end
|
||||
|
||||
if server == "rust_analyzer" then
|
||||
local rust_analyzer_opts = require("solo.mason.settings.rust_analyzer")
|
||||
opts = vim.tbl_deep_extend("force", rust_analyzer_opts, opts)
|
||||
require("rust-tools").setup(opts)
|
||||
goto continue
|
||||
end
|
||||
|
||||
if server == "clangd" then
|
||||
local clangd_opts = require("solo.mason.settings.clangd")
|
||||
opts = vim.tbl_deep_extend("force", clangd_opts, opts)
|
||||
require("clangd_extensions").setup(opts)
|
||||
goto continue
|
||||
end
|
||||
|
||||
if server == "texlab" then
|
||||
local texlab_opts = require("solo.mason.settings.texlab")
|
||||
opts = vim.tbl_deep_extend("force", texlab_opts, opts)
|
||||
end
|
||||
|
||||
lspconfig[server].setup(opts)
|
||||
::continue::
|
||||
end
|
||||
98
lua/solo/mason/null-ls.lua
Normal file
98
lua/solo/mason/null-ls.lua
Normal file
@@ -0,0 +1,98 @@
|
||||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local mason_null_ls_status_ok, mason_null_ls = pcall(require, "mason-null-ls")
|
||||
if not mason_null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
mason_null_ls.setup({
|
||||
ensure_installed = {
|
||||
"autopep8",
|
||||
"beautysh",
|
||||
"clang_format",
|
||||
"codespell",
|
||||
"cpplint",
|
||||
"djlint",
|
||||
"gitlint",
|
||||
"html_lint",
|
||||
"isort",
|
||||
"luacheck",
|
||||
"misspell",
|
||||
"mypy",
|
||||
"phpcbf",
|
||||
"phpcs",
|
||||
"prettier",
|
||||
"rustfmt",
|
||||
"sql-formatter",
|
||||
"shfmt",
|
||||
"yamlfmt",
|
||||
"cmakelang",
|
||||
},
|
||||
automatic_installation = true,
|
||||
automatic_setup = true,
|
||||
})
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
-- https://github.com/prettier-solidity/prettier-plugin-solidity
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
diagnostics.codespell,
|
||||
diagnostics.cpplint,
|
||||
diagnostics.luacheck.with({
|
||||
extra_args = {
|
||||
"--globals",
|
||||
"vim",
|
||||
},
|
||||
}),
|
||||
diagnostics.misspell,
|
||||
diagnostics.mypy,
|
||||
diagnostics.cmake_lint,
|
||||
formatting.cmake_format,
|
||||
formatting.autopep8,
|
||||
formatting.beautysh,
|
||||
formatting.clang_format,
|
||||
formatting.djlint,
|
||||
formatting.google_java_format,
|
||||
formatting.isort,
|
||||
formatting.prettier.with({
|
||||
extra_filetypes = { "toml" },
|
||||
extra_args = {
|
||||
"--no-semi",
|
||||
"--double-quote",
|
||||
"--no-bracket-spacing",
|
||||
"--tab-width",
|
||||
"4",
|
||||
"--bracket-same-line",
|
||||
"--html-whitespace-sensitivity",
|
||||
"strict",
|
||||
},
|
||||
}),
|
||||
formatting.phpcbf,
|
||||
formatting.rustfmt,
|
||||
formatting.shfmt.with({
|
||||
extra_filetypes = {
|
||||
"bash",
|
||||
"csh",
|
||||
"ksh",
|
||||
"sh",
|
||||
"zsh",
|
||||
},
|
||||
}),
|
||||
-- formatting.sql_formatter.with({
|
||||
-- extra_args = {
|
||||
-- "-c",
|
||||
-- "/home/kristofers/.config/sql/sql-formatter.json",
|
||||
-- },
|
||||
-- }),
|
||||
formatting.stylua,
|
||||
formatting.yamlfmt,
|
||||
formatting.black,
|
||||
},
|
||||
})
|
||||
7
lua/solo/mason/settings/bashls.lua
Normal file
7
lua/solo/mason/settings/bashls.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
filetypes = {
|
||||
"sh",
|
||||
"bash",
|
||||
"zsh",
|
||||
},
|
||||
}
|
||||
71
lua/solo/mason/settings/clangd.lua
Normal file
71
lua/solo/mason/settings/clangd.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
return {
|
||||
server = {
|
||||
capabilities = {
|
||||
offsetEncoding = { "utf-16" },
|
||||
},
|
||||
on_attach = require("solo.mason.handlers").on_attach,
|
||||
},
|
||||
extensions = {
|
||||
-- defaults:
|
||||
-- Automatically set inlay hints (type hints)
|
||||
autoSetHints = true,
|
||||
-- These apply to the default ClangdSetInlayHints command
|
||||
inlay_hints = {
|
||||
-- Only show inlay hints for the current line
|
||||
only_current_line = false,
|
||||
-- Event which triggers a refersh of the inlay hints.
|
||||
-- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
|
||||
-- not that this may cause higher CPU usage.
|
||||
-- This option is only respected when only_current_line and
|
||||
-- autoSetHints both are true.
|
||||
only_current_line_autocmd = "CursorHold",
|
||||
-- whether to show parameter hints with the inlay hints or not
|
||||
show_parameter_hints = true,
|
||||
-- prefix for parameter hints
|
||||
parameter_hints_prefix = "<- ",
|
||||
-- prefix for all the other hints (type, chaining)
|
||||
other_hints_prefix = "=> ",
|
||||
-- whether to align to the length of the longest line in the file
|
||||
max_len_align = true,
|
||||
-- padding from the left if max_len_align is true
|
||||
max_len_align_padding = 1,
|
||||
-- whether to align to the extreme right or not
|
||||
right_align = false,
|
||||
-- padding from the right if right_align is true
|
||||
right_align_padding = 7,
|
||||
-- The color of the hints
|
||||
highlight = "Comment",
|
||||
-- The highlight group priority for extmark
|
||||
priority = 100,
|
||||
},
|
||||
ast = {
|
||||
-- These require codicons (https://github.com/microsoft/vscode-codicons)
|
||||
role_icons = {
|
||||
type = "",
|
||||
declaration = "",
|
||||
expression = "",
|
||||
specifier = "",
|
||||
statement = "",
|
||||
["template argument"] = "",
|
||||
},
|
||||
kind_icons = {
|
||||
Compound = "",
|
||||
Recovery = "",
|
||||
TranslationUnit = "",
|
||||
PackExpansion = "",
|
||||
TemplateTypeParm = "",
|
||||
TemplateTemplateParm = "",
|
||||
TemplateParamObject = "",
|
||||
},
|
||||
highlights = {
|
||||
detail = "Comment",
|
||||
},
|
||||
},
|
||||
memory_usage = {
|
||||
border = "none",
|
||||
},
|
||||
symbol_info = {
|
||||
border = "none",
|
||||
},
|
||||
},
|
||||
}
|
||||
13
lua/solo/mason/settings/emmet_ls.lua
Normal file
13
lua/solo/mason/settings/emmet_ls.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
filetypes = {
|
||||
"html",
|
||||
"htmldjango",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"css",
|
||||
"sass",
|
||||
"scss",
|
||||
"less",
|
||||
"eruby",
|
||||
},
|
||||
}
|
||||
35
lua/solo/mason/settings/lua_ls.lua
Normal file
35
lua/solo/mason/settings/lua_ls.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim", "awesome", "client" },
|
||||
},
|
||||
-- workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
-- library = vim.api.nvim_get_runtime_file("", true),
|
||||
-- },
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
root_pattern = {
|
||||
".stylua.toml",
|
||||
".luarc.json",
|
||||
".luarc.jsonc",
|
||||
".luacheckrc",
|
||||
"stylua.toml",
|
||||
"selene.toml",
|
||||
"selene.yml",
|
||||
".git",
|
||||
},
|
||||
format = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
105
lua/solo/mason/settings/rust_analyzer.lua
Normal file
105
lua/solo/mason/settings/rust_analyzer.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
return {
|
||||
server = {
|
||||
on_attach = require("solo.mason.handlers").on_attach,
|
||||
capabilities = require("solo.mason.handlers").capabilities,
|
||||
},
|
||||
tools = {
|
||||
-- how to execute terminal commands
|
||||
-- options right now: termopen / quickfix
|
||||
executor = require("rust-tools.executors").termopen,
|
||||
-- callback to execute once rust-analyzer is done initializing the workspace
|
||||
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||
on_initialized = function()
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave", "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("InitializeRustAnalyzer", { clear = true }),
|
||||
pattern = { "*.rs" },
|
||||
callback = function()
|
||||
vim.lsp.codelens.refresh()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||
reload_workspace_from_cargo_toml = true,
|
||||
-- These apply to the default RustSetInlayHints command
|
||||
inlay_hints = {
|
||||
-- automatically set inlay hints (type hints)
|
||||
-- default: true
|
||||
auto = true,
|
||||
-- Only show inlay hints for the current line
|
||||
only_current_line = false,
|
||||
-- whether to show parameter hints with the inlay hints or not
|
||||
-- default: true
|
||||
show_parameter_hints = true,
|
||||
-- prefix for parameter hints
|
||||
-- default: "<-"
|
||||
parameter_hints_prefix = " <- ",
|
||||
-- prefix for all the other hints (type, chaining)
|
||||
-- default: "=>"
|
||||
other_hints_prefix = " => ",
|
||||
-- whether to align to the length of the longest line in the file
|
||||
max_len_align = false,
|
||||
-- padding from the left if max_len_align is true
|
||||
max_len_align_padding = 1,
|
||||
-- whether to align to the extreme right or not
|
||||
right_align = false,
|
||||
-- padding from the right if right_align is true
|
||||
right_align_padding = 7,
|
||||
-- The color of the hints
|
||||
highlight = "Comment",
|
||||
},
|
||||
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
||||
hover_actions = {
|
||||
-- the border that is used for the hover window
|
||||
-- see vim.api.nvim_open_win()
|
||||
border = {
|
||||
{ "╭", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╮", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
{ "╯", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╰", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
},
|
||||
-- Maximal width of the hover window. Nil means no max.
|
||||
max_width = nil,
|
||||
-- Maximal height of the hover window. Nil means no max.
|
||||
max_height = nil,
|
||||
-- whether the hover action window gets automatically focused
|
||||
-- default: false
|
||||
auto_focus = false,
|
||||
},
|
||||
-- settings for showing the crate graph based on graphviz and the dot
|
||||
-- command
|
||||
crate_graph = {
|
||||
-- Backend used for displaying the graph
|
||||
-- see: https://graphviz.org/docs/outputs/
|
||||
-- default: x11
|
||||
backend = "x11",
|
||||
-- where to store the output, nil for no output stored (relative
|
||||
-- path from pwd)
|
||||
-- default: nil
|
||||
output = nil,
|
||||
-- true for all crates.io and external crates, false only the local
|
||||
-- crates
|
||||
-- default: true
|
||||
full = true,
|
||||
},
|
||||
-- all the opts to send to nvim-lspconfig
|
||||
-- these override the defaults set by rust-tools.nvim
|
||||
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
||||
server = {
|
||||
-- standalone file support
|
||||
-- setting it to false may improve startup time
|
||||
standalone = true,
|
||||
}, -- rust-analyzer options
|
||||
-- debugging stuff
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = "codelldb",
|
||||
name = "rt_lldb",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
27
lua/solo/mason/settings/texlab.lua
Normal file
27
lua/solo/mason/settings/texlab.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
return {
|
||||
settings = {
|
||||
texlab = {
|
||||
auxDirectory = ".",
|
||||
bibtexFormatter = "texlab",
|
||||
build = {
|
||||
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
|
||||
executable = "xelatex",
|
||||
forwardSearchAfter = false,
|
||||
onSave = false,
|
||||
},
|
||||
chktex = {
|
||||
onEdit = false,
|
||||
onOpenAndSave = false,
|
||||
},
|
||||
diagnosticsDelay = 0,
|
||||
formatterLineLength = 120,
|
||||
forwardSearch = {
|
||||
args = {},
|
||||
},
|
||||
latexFormatter = "latexindent",
|
||||
latexindent = {
|
||||
modifyLineBreaks = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user