"jose-elias-alvarez/null-ls.nvim",
dependencies = {
"plenary.nvim",
+ "nvim-treesitter",
{
"jay-babu/mason-null-ls.nvim",
dependencies = { "mason.nvim" },
{
"williamboman/mason-lspconfig",
dependencies = {
+ "nvim-treesitter",
{
"williamboman/mason.nvim",
build = ":MasonUpdate",
"Maan2003/lsp_lines.nvim",
},
config = function()
+ -- servers to setup
local lsp = require("lspconfig")
lsp.awk_ls.setup({})
lsp.bashls.setup({})
lsp.lua_ls.setup({})
lsp.marksman.setup({})
lsp.solargraph.setup({})
- -- lsp.sorbet.setup({})
lsp.rust_analyzer.setup({})
lsp.taplo.setup({})
lsp.yamlls.setup({})
- local border = {
- { "┏", "FloatBorder" },
- { "━", "FloatBorder" },
- { "┓", "FloatBorder" },
- { "┃", "FloatBorder" },
- { "┛", "FloatBorder" },
- { "━", "FloatBorder" },
- { "┗", "FloatBorder" },
- { "┃", "FloatBorder" },
- }
-
+ -- diagnostic settings
vim.lsp.diagnostics = {
signs = true,
underline = true,
severity_sort = { reverse = false },
}
+ -- custom signs
local signs = { Error = ">>", Warn = "> ", Hint = "- ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
+ -- borders on windows
+ local border = {
+ { "┏", "FloatBorder" },
+ { "━", "FloatBorder" },
+ { "┓", "FloatBorder" },
+ { "┃", "FloatBorder" },
+ { "┛", "FloatBorder" },
+ { "━", "FloatBorder" },
+ { "┗", "FloatBorder" },
+ { "┃", "FloatBorder" },
+ }
+
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
end
+
+ -- auto format code on save
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ pattern = { "*" },
+ callback = function()
+ vim.lsp.buf.format()
+ end,
+ })
end,
},
}
}
require('telescope').load_extension('fzf')
+
+ -- give telescope window if opened with no command
+ vim.api.nvim_create_autocmd('VimEnter', {
+ pattern = '*',
+ callback = function()
+ local arg = vim.api.nvim_eval('argv(0)')
+ if arg and (vim.fn.isdirectory(arg) ~= 0 or arg == "") then
+ vim.defer_fn(function()
+ local function is_git_repo()
+ vim.fn.system("git rev-parse --is-inside-work-tree")
+ return vim.v.shell_error == 0
+ end
+ local function get_git_root()
+ local dot_git_path = vim.fn.finddir(".git", ".;")
+ return vim.fn.fnamemodify(dot_git_path, ":h")
+ end
+ local opts = {}
+ if is_git_repo() then
+ opts = {
+ cwd = get_git_root(),
+ }
+ end
+ require("telescope.builtin").find_files(opts)
+ end, 10)
+ end
+ end
+ })
end
},
}