-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(no-null-ls)!: Remove null-ls, replace with conform and nvim-lint
BREAKING CHANGE: conform.nvim and nvim-lint introduced again after v1.0.0
- Loading branch information
1 parent
1ed1e46
commit 5cbae70
Showing
5 changed files
with
121 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
return { | ||
"stevearc/conform.nvim", | ||
event = { "BufReadPre", "BufNewFile" }, | ||
lazy = true, | ||
keys = { | ||
{ | ||
"<leader>mf", | ||
"<cmd>lua require('conform').format({lsp_fallback = true,async = false, timeout_ms = 500})<CR>", | ||
mode = { "n", "v" }, | ||
desc = "Format", | ||
}, | ||
}, | ||
|
||
config = function() | ||
local conform_status_ok, conform = pcall(require, "conform") | ||
if not conform_status_ok then | ||
print("conform not found!") | ||
end | ||
conform.setup({ | ||
formatters_by_ft = { | ||
javascript = { "prettierd" }, | ||
javascriptreact = { "prettierd" }, | ||
typescript = { "prettierd" }, | ||
typescriptreact = { "prettierd" }, | ||
json = { "prettierd" }, | ||
yaml = { "prettierd" }, | ||
markdown = { "prettierd" }, | ||
html = { "prettierd" }, | ||
css = { "prettierd" }, | ||
svelte = { "prettierd" }, | ||
lua = { "stylua" }, | ||
python = function(bufnr) | ||
if require("conform").get_formatter_info("ruff_format", bufnr).available then | ||
return { "ruff_format" } | ||
else | ||
return { "isort", "black" } | ||
end | ||
end, | ||
rust = { "rustfmt" }, | ||
cpp = { "clang-format" }, | ||
c = { "clang-format" }, | ||
cmake = { "cmake_format" }, | ||
["*"] = { "codespell" }, | ||
fish = { "fish_indent" }, | ||
sh = { "shfmt" }, | ||
bash = { "shfmt" }, | ||
}, | ||
format_on_save = { | ||
lsp_fallback = true, | ||
async = true, | ||
}, | ||
}) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
return { | ||
"daUnknownCoder/nvim-lint", | ||
event = { "BufReadPre", "BufNewFile" }, | ||
lazy = true, | ||
keys = { | ||
{ "<leader>mt", "<cmd>lua require('lint').try_lint()<cr>", desc = "Lint" }, | ||
}, | ||
config = function() | ||
local linter_status_ok, lint = pcall(require, "lint") | ||
if not linter_status_ok then | ||
print("nvim-lint not found!") | ||
end | ||
lint.linters_by_ft = { | ||
javascript = { "eslint_d" }, | ||
javascriptreact = { "eslint_d" }, | ||
typescript = { "eslint_d" }, | ||
typescriptreact = { "eslint_d" }, | ||
lua = { "luacheck" }, | ||
python = { "pylint" }, | ||
} | ||
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, | ||
}) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters