Tidy neovim configuration

* Remove some unused plugins and packages.
  * e.g. floaterm, projectionist, vim-wiki, vim-easy-align,
    vim-surround, visual-star-search, vim-rhubarb
* Replace none-ls with conform.nvim and nvim-lint.
* Replace lualine.nvim with mini-statusline.
* Add neodev.
* Simplify cmp completion sources.
This commit is contained in:
Oliver Davies 2024-02-22 23:23:12 +00:00
parent 94581a9c7f
commit 3afe1bd12b
16 changed files with 184 additions and 193 deletions

View file

@ -33,7 +33,7 @@ local custom_attach = function(client)
nvim_status.on_attach(client)
buf_inoremap { "<C-s>", vim.lsp.buf.signature_help }
buf_inoremap { "<C-k>", vim.lsp.buf.signature_help }
buf_nnoremap { "<leader>ca", vim.lsp.buf.code_action }
buf_nnoremap { "<leader>d", vim.diagnostic.open_float }
buf_nnoremap { "<leader>rn", vim.lsp.buf.rename }
@ -66,6 +66,8 @@ local custom_attach = function(client)
-- filetype_attach[filetype](client)
end
require("neodev").setup {}
local servers = {
ansiblels = true,
bashls = true,
@ -85,9 +87,21 @@ local servers = {
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = "Replace",
},
diagnostics = {
globals = { "vim" },
},
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
},
},
},
},
@ -146,9 +160,42 @@ vim.diagnostic.config {
virtual_text = { spacing = 2 },
}
local conform = require "conform"
conform.setup {
formatters_by_ft = {
bash = { "shellcheck" },
javascript = { { "prettierd", "prettier" } },
just = { "just" },
lua = { "stylua" },
nix = { { "alejandra", "nixfmt" } },
php = { { "php_cs_fixer", "phpcbf" } },
terraform = { "terraform_fmt" },
yaml = { "yamlfmt" },
},
}
vim.keymap.set("n", "<leader>f", function()
vim.lsp.buf.format { async = true }
conform.format { lsp_fallback = true, async = false, timeout_ms = 500 }
end)
require "opdavies.lsp.none-ls"
require "opdavies.lsp.signature"
local lint = require "lint"
lint.linters_by_ft = {
dockerfile = { "hadolint" },
javascript = { "eslint_d" },
json = { "jsonlint" },
lua = { "luacheck" },
markdown = { "markdownlint" },
nix = { "nix" },
php = { "php", "phpcs", "phpstan" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})

View file

@ -1,47 +0,0 @@
local status_ok, null_ls = pcall(require, "null-ls")
if not status_ok then
return
end
local code_actions = null_ls.builtins.code_actions
local diagnostics = null_ls.builtins.diagnostics
local formatting = null_ls.builtins.formatting
null_ls.setup {
sources = {
code_actions.gitsigns,
formatting.alejandra,
formatting.black,
formatting.markdownlint,
formatting.phpcbf.with {
command = "./vendor/bin/phpcbf",
condition = function(utils)
return utils.root_has_file { "phpcs.xml.dist" }
end,
},
formatting.prettier,
formatting.rustywind,
formatting.stylua,
diagnostics.eslint.with {
condition = function(utils)
return utils.root_has_file { ".eslintrc.js" }
end,
},
diagnostics.markdownlint.with {
extra_args = { "--config", "~/.markdownlint.yaml" },
},
diagnostics.php,
diagnostics.phpcs.with {
command = "./vendor/bin/phpcs",
condition = function(utils)
return utils.root_has_file { "phpcs.xml.dist" }
end,
},
diagnostics.phpstan,
diagnostics.shellcheck,
},
temp_dir = "/tmp",
}

View file

@ -1,6 +0,0 @@
local status_ok, lsp_signature = pcall(require, "lsp_signature")
if not status_ok then
return
end
lsp_signature.setup {}