summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-12-04 22:20:46 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-12-04 22:20:46 +0100
commitb96571d104ab72d95c41ffc120afa260dd280934 (patch)
tree5cd8be3110f07a3a7e02121703f52f8ab3da1554
parent3df5dfb5fe0d05005f9216421444695a9acae9b4 (diff)
Replace null(none)-ls with conform and nvim-lint
-rw-r--r--fnl/plugins/editor/conform.fnl34
-rw-r--r--fnl/plugins/editor/lualine.fnl3
-rw-r--r--fnl/plugins/editor/nvim-lint.fnl26
-rw-r--r--fnl/plugins/lsp/init.fnl4
-rw-r--r--fnl/plugins/lsp/keymaps.fnl4
-rw-r--r--fnl/plugins/lsp/null-ls.fnl43
-rw-r--r--lazy-lock.json26
7 files changed, 75 insertions, 65 deletions
diff --git a/fnl/plugins/editor/conform.fnl b/fnl/plugins/editor/conform.fnl
new file mode 100644
index 0000000..4f1b01a
--- /dev/null
+++ b/fnl/plugins/editor/conform.fnl
@@ -0,0 +1,34 @@
+;; Formatting
+
+(fn init []
+ (vim.keymap.set [:n :v] :<leader>e
+ (lambda []
+ (let [conform (require :conform)]
+ (conform.format {:lsp_fallback true :async true})))
+ {:desc :Format}))
+
+(fn config []
+ (let [conform (require :conform)]
+ (conform.setup {:formatters {:fnlfmt {:command :fnlfmt
+ :args [:--fix :$FILENAME]
+ :stdin false}}
+ :formatters_by_ft {:* [:codespell
+ :trim_whitespace
+ :trim_newlines]
+ :css [:stylelint]
+ :fennel [:fnlfmt]
+ :haskell [:fourmolu]
+ :html [:djlint]
+ :json [:jq]
+ :lua [:stylua]
+ :markdown [:cbfmt]
+ :ocaml [:ocamlformat]
+ :org [:cbfmt]
+ :python [:ruff_format]
+ :rust [:rustfmt]
+ :sh [:shfmt :shellharden]
+ :sql [:pg_format :sqlfluff]
+ :toml [:taplo]
+ :yaml [:yamlfmt]}})))
+
+{1 :stevearc/conform.nvim : init : config :event [:BufReadPost :BufNewFile]}
diff --git a/fnl/plugins/editor/lualine.fnl b/fnl/plugins/editor/lualine.fnl
index 06d7fde..a34e73e 100644
--- a/fnl/plugins/editor/lualine.fnl
+++ b/fnl/plugins/editor/lualine.fnl
@@ -18,8 +18,7 @@
(let [clients (vim.lsp.buf_get_clients)
client_names []]
(each [_ client (pairs clients)]
- (if (not= client.name :null-ls)
- (table.insert client_names client.name)))
+ (table.insert client_names client.name))
(if (> (length client_names) 0)
(table.concat client_names ", ")
"")))
diff --git a/fnl/plugins/editor/nvim-lint.fnl b/fnl/plugins/editor/nvim-lint.fnl
new file mode 100644
index 0000000..bcec08b
--- /dev/null
+++ b/fnl/plugins/editor/nvim-lint.fnl
@@ -0,0 +1,26 @@
+;; Linting
+
+(fn init []
+ (let [lint-augroup (vim.api.nvim_create_augroup :lint {:clear true})
+ lint (require :lint)]
+ (vim.api.nvim_create_autocmd [:BufEnter :BufWritePost :InsertLeave]
+ {:group lint-augroup
+ :callback (lambda []
+ (lint.try_lint))})))
+
+(fn config []
+ (let [lint (require :lint)]
+ (set lint.linters_by_ft {:zsh [:zsh]
+ :* [:codespell :write_good]
+ :fennel [:fennel]
+ :yaml [:yamllint]
+ :python [:ruff]
+ :lua [:selene]
+ :commit [:commitlint]
+ :docker [:hadolint]
+ :haskell [:hlint]
+ :json [:jsonlint]
+ :sh [:shellcheck]
+ :sql [:sqlfluff]})))
+
+{1 :mfussenegger/nvim-lint : init : config :event [:BufReadPost :BufNewFile]}
diff --git a/fnl/plugins/lsp/init.fnl b/fnl/plugins/lsp/init.fnl
index bef4141..f04ba86 100644
--- a/fnl/plugins/lsp/init.fnl
+++ b/fnl/plugins/lsp/init.fnl
@@ -1,5 +1,3 @@
;; Lsp plugins.
-[(require :plugins.lsp.lspconfig)
- (require :plugins.lsp.mason)
- (require :plugins.lsp.null-ls)]
+[(require :plugins.lsp.lspconfig) (require :plugins.lsp.mason)]
diff --git a/fnl/plugins/lsp/keymaps.fnl b/fnl/plugins/lsp/keymaps.fnl
index 6a3544a..d87b32c 100644
--- a/fnl/plugins/lsp/keymaps.fnl
+++ b/fnl/plugins/lsp/keymaps.fnl
@@ -20,10 +20,6 @@
:<leader>a
"<cmd>lua vim.lsp.buf.code_action()<cr>"
{:desc "Code Action"}]
- [:n
- :<leader>e
- "<cmd>lua vim.lsp.buf.format { async = true }<cr>"
- {:desc :Format}]
[:v
:<leader>e
"<cmd>lua vim.lsp.buf.format { async = true }<cr>"
diff --git a/fnl/plugins/lsp/null-ls.fnl b/fnl/plugins/lsp/null-ls.fnl
deleted file mode 100644
index ff98aee..0000000
--- a/fnl/plugins/lsp/null-ls.fnl
+++ /dev/null
@@ -1,43 +0,0 @@
-;; Adds LSP diagnostics and formatting.
-
-(local mason-opts {:ensure_installed nil
- :automatic_installation true
- :automatic_setup false})
-
-(fn config []
- (let [null-ls (require :null-ls)
- mason-null-ls (require :mason-null-ls)]
- (let [formatting null-ls.builtins.formatting
- diagnostics null-ls.builtins.diagnostics]
- (null-ls.setup {:debug false
- :sources [diagnostics.codespell
- diagnostics.cpplint
- diagnostics.gitlint
- diagnostics.hadolint
- diagnostics.jsonlint
- diagnostics.misspell
- diagnostics.ruff
- diagnostics.selene
- diagnostics.shellcheck
- diagnostics.sqlfluff
- diagnostics.write_good
- diagnostics.yamllint
- formatting.fnlfmt
- formatting.markdownlint
- formatting.ocamlformat
- formatting.prettierd
- formatting.ruff
- formatting.rustfmt
- formatting.shellharden
- formatting.shfmt
- formatting.sqlfluff
- formatting.stylua
- formatting.terraform_fmt]}))
- (mason-null-ls.setup mason-opts)))
-
-{1 :nvimtools/none-ls.nvim
- :dependencies [:mason.nvim
- :jayp0521/mason-null-ls.nvim
- :nvim-lua/plenary.nvim]
- :event :BufReadPost
- : config}
diff --git a/lazy-lock.json b/lazy-lock.json
index 4c810b4..30aaeb8 100644
--- a/lazy-lock.json
+++ b/lazy-lock.json
@@ -1,7 +1,7 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "1def35377854535bb3b0f4cc7a33c083cdb12571" },
- "SchemaStore.nvim": { "branch": "main", "commit": "5bfeb36550018438c2c7ef58f91174f79d99a28a" },
+ "SchemaStore.nvim": { "branch": "main", "commit": "02cbeccdcaa8bc11e849b61a08a11b9b8a5dde7d" },
"alpha-nvim": { "branch": "main", "commit": "29074eeb869a6cbac9ce1fbbd04f5f5940311b32" },
"better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
@@ -11,6 +11,7 @@
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
+ "conform.nvim": { "branch": "master", "commit": "96cb2d5e3d8d7c927af2c86a11a71ee6d09d9031" },
"dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
"easyread.nvim": { "branch": "main", "commit": "0b07e315a4cd7d700c4a794bdddbec79fdc2628b" },
@@ -20,44 +21,43 @@
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
"gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
"harpoon": { "branch": "master", "commit": "867e212ac153e793f95b316d1731f3ca1894625e" },
- "hotpot.nvim": { "branch": "master", "commit": "05d9325e14ee1af9114b5c4586d1b200e75ccac9" },
+ "hotpot.nvim": { "branch": "master", "commit": "bedc290557817b0ebf97d2b389bc5bb596a25bd7" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
- "leap.nvim": { "branch": "main", "commit": "d55acc28ecc1f3ab3c396afd1f8b11a239285d9b" },
+ "leap.nvim": { "branch": "main", "commit": "7e19093f53f9462408907eb896fbef2718c097ed" },
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4eb8e15e3c0757303d4c6dea64d2981fc679e990" },
- "mason-null-ls.nvim": { "branch": "main", "commit": "d1f7258f80867f718d643d88eee66959671a4bef" },
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
"minibar.nvim": { "branch": "master", "commit": "353ca4efaf7fff1566bb02e0d7cb51133c41f660" },
- "neogit": { "branch": "master", "commit": "d0e87541130b2cf62d7f8a54487ef99560232fb6" },
+ "neogit": { "branch": "master", "commit": "daa7b9fb7df7488ec90fddf950adc9302d97ebdc" },
"no-clown-fiesta.nvim": { "branch": "master", "commit": "ecf3e186d336e03b5ce7ed4e8f7f72ad983947df" },
- "none-ls.nvim": { "branch": "main", "commit": "7bf88cd3b37a411fdacfdca1745408a77a420493" },
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
"nvim-bqf": { "branch": "main", "commit": "8784eebf34371049b641646d00232c2603215297" },
"nvim-bufdel": { "branch": "main", "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
- "nvim-lspconfig": { "branch": "master", "commit": "694aaec65733e2d54d393abf80e526f86726c988" },
+ "nvim-lint": { "branch": "master", "commit": "f20f35756e74b91c0b4340d01fee22422bdffefa" },
+ "nvim-lspconfig": { "branch": "master", "commit": "cf3dd4a290084a868fac0e2e876039321d57111c" },
"nvim-spectre": { "branch": "master", "commit": "a18a58015b46f02b4fe537ebfffd82e46110ff24" },
- "nvim-surround": { "branch": "main", "commit": "0855a89e00a5822c3a482a82e5223fcf2e9ede13" },
- "nvim-treesitter": { "branch": "master", "commit": "80a16deb5146a3eb4648effccda1ab9f45e43e76" },
+ "nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" },
+ "nvim-treesitter": { "branch": "master", "commit": "67536f4057e4901e37805708bcfdd3d9abacfd26" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" },
"nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" },
"nvim-window-picker": { "branch": "main", "commit": "2c8200c5cbcdaac01dfe2c049997a1ca178506d8" },
- "oil.nvim": { "branch": "master", "commit": "58340545c6a01e5e9f7966df448714a156db137a" },
+ "oil.nvim": { "branch": "master", "commit": "82834573bbca27c240f30087ff642b807ed1872a" },
"org-bullets.nvim": { "branch": "main", "commit": "6e0d60e901bb939eb526139cb1f8d59065132fd9" },
- "orgmode": { "branch": "master", "commit": "cbb10d4c7514680e90f791d62f1168cb87aad0ce" },
+ "orgmode": { "branch": "master", "commit": "92bfc3fb7ee845d9e58326b0b69f3ed89e84253f" },
"persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" },
"stay-in-place.nvim": { "branch": "main", "commit": "0628b6db8970fc731abf9608d6f80659b58932c9" },
- "telescope-frecency.nvim": { "branch": "master", "commit": "ca5fa5326fc2b2ebd3269176594c4341ad720ac5" },
+ "telescope-frecency.nvim": { "branch": "master", "commit": "de410701811f4142315ce89183256a969a08ff9d" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope-orgmode.nvim": { "branch": "main", "commit": "eabff061c3852a9aa94e672a7d2fa4a1ef63f9e2" },
- "telescope.nvim": { "branch": "master", "commit": "84c5a71d825b6687a55aed6f41e98b92fd8e5454" },
+ "telescope.nvim": { "branch": "master", "commit": "3f5f165447d797576206e3b9bd555ea8db85b6f2" },
"toggleterm.nvim": { "branch": "main", "commit": "faee9d60428afc7857e0927fdc18daa6c409fa64" },
"trim.nvim": { "branch": "master", "commit": "629b96a303a3a0bb5fd050e6cd9d627ca7831cc7" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },