summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2024-07-14 12:59:02 -0400
committerseth <[email protected]>2024-07-14 13:47:39 -0400
commit00d5ec09d45d09451b21ab58054e40f593577b15 (patch)
treeadea3dbc1e1d2e0ccd913128a03f2f3b3dbdb409
parent8c76161eb8cf752c00a65cccccd381fb3bc5955d (diff)
efmls -> nvim-lint
also only use native lsps for formatting
-rw-r--r--ftdetect/githubaction.lua7
-rw-r--r--lua/getchoo/plugins/efmls.lua58
-rw-r--r--neovim.nix16
-rw-r--r--plugin/lint.lua15
-rw-r--r--plugin/lsp.lua12
5 files changed, 34 insertions, 74 deletions
diff --git a/ftdetect/githubaction.lua b/ftdetect/githubaction.lua
new file mode 100644
index 0000000..a6e11cf
--- /dev/null
+++ b/ftdetect/githubaction.lua
@@ -0,0 +1,7 @@
+-- this allows `actionlint` to only yaml files that are actions
+vim.filetype.add({
+ pattern = {
+ [".*/.github/workflows/.*%.yml"] = "yaml.githubaction",
+ [".*/.github/workflows/.*%.yaml"] = "yaml.githubaction",
+ },
+})
diff --git a/lua/getchoo/plugins/efmls.lua b/lua/getchoo/plugins/efmls.lua
deleted file mode 100644
index 92d61e9..0000000
--- a/lua/getchoo/plugins/efmls.lua
+++ /dev/null
@@ -1,58 +0,0 @@
-local alex = require("efmls-configs.linters.alex")
-alex.rootMarkers = nil
-local actionlint = require("efmls-configs.linters.actionlint")
-local beautysh = require("efmls-configs.formatters.beautysh")
-local fish_indent = require("efmls-configs.formatters.fish_indent")
-local prettier = require("efmls-configs.formatters.prettier")
-local prettier_eslint = require("efmls-configs.formatters.prettier_eslint")
-local selene = require("efmls-configs.linters.selene")
-local statix = require("efmls-configs.linters.statix")
-local stylua = require("efmls-configs.formatters.stylua")
-
-local languages = {
- all = { alex },
-
- bash = {
- beautysh,
- },
-
- css = { prettier },
-
- fish = { fish_indent },
-
- html = { prettier },
-
- javascript = { prettier_eslint },
-
- json = { prettier },
-
- lua = { selene, stylua },
-
- nix = { statix },
-
- sass = { prettier },
-
- scss = { prettier },
-
- sh = { beautysh },
-
- typescript = { prettier_eslint },
-
- yaml = { prettier, actionlint },
-
- zsh = { beautysh },
-}
-
-return {
- filetypes = vim.tbl_keys(languages),
-
- settings = {
- rootMarkers = { ".git/" },
- languages = languages,
- },
-
- init_options = {
- documentFormatting = true,
- documentRangeFormatting = true,
- },
-}
diff --git a/neovim.nix b/neovim.nix
index 6e57a8e..70df021 100644
--- a/neovim.nix
+++ b/neovim.nix
@@ -6,13 +6,12 @@
wrapNeovimUnstable,
neovim-unwrapped,
actionlint,
- beautysh,
ripgrep,
- efm-langserver,
nil,
nixfmt-rfc-style,
nodePackages,
shellcheck,
+ shfmt,
statix,
typos-lsp,
version,
@@ -29,7 +28,6 @@ let
fs.unions [
./after
./ftdetect
- ./lua
./plugin
]
);
@@ -52,16 +50,15 @@ let
cmp-nvim-lsp
cmp-rg
- efmls-configs-nvim
-
fidget-nvim
flash-nvim
gitsigns-nvim
indent-blankline-nvim
- lsp-format-nvim
nvim-lspconfig
+ lsp-format-nvim
+ nvim-lint
lualine-nvim
@@ -80,18 +77,19 @@ let
# cmp
ripgrep
- # efmls-configs
- efm-langserver
+ # linters
nodePackages.alex
actionlint
- beautysh
statix
# lspconfig
nodePackages.bash-language-server
shellcheck
+ shfmt
+
nil
nixfmt-rfc-style
+
typos-lsp
];
diff --git a/plugin/lint.lua b/plugin/lint.lua
new file mode 100644
index 0000000..2a7f3a9
--- /dev/null
+++ b/plugin/lint.lua
@@ -0,0 +1,15 @@
+require("lint").linters_by_ft = {
+ githubaction = { "actionlint" },
+ lua = { "selene" },
+ nix = { "statix" },
+}
+
+vim.api.nvim_create_autocmd({ "BufWritePost" }, {
+ callback = function()
+ -- Run linters declared in linters_by_ft
+ require("lint").try_lint()
+
+ -- Run these linters regardless of filetype
+ require("lint").try_lint("alex")
+ end,
+})
diff --git a/plugin/lsp.lua b/plugin/lsp.lua
index b652f71..ef1a90b 100644
--- a/plugin/lsp.lua
+++ b/plugin/lsp.lua
@@ -26,11 +26,7 @@ local lsp_servers = {
binary = "vscode-eslint-language-server",
},
- efm = {
- binary = "efm-langserver",
- extraOptions = require("getchoo.plugins.efmls"),
- },
-
+ -- TODO: I WANT STYLUA BACK!!
lua_ls = {
binary = "lua-language-server",
extraOptions = {
@@ -38,7 +34,7 @@ local lsp_servers = {
Lua = {
runtime = { version = "LuaJIT" },
diagnostics = { globals = "vim" },
- workspace = { library = vim.api.nvim_get_runtime_file("", true) },
+ workspace = { checkThirdPaty = false, library = { vim.env.VIMRUNTIME } },
},
},
},
@@ -84,7 +80,9 @@ local lsp_servers = {
binary = "rust-analyzer",
extraOptions = {
settings = {
- checkOnSave = { command = "clippy" },
+ ["rust-analyzer"] = {
+ check = { command = "clippy" },
+ },
},
},
},