-
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.
fix(language): add nix language support with my own config
- Loading branch information
1 parent
1456ce5
commit b391813
Showing
3 changed files
with
66 additions
and
0 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,3 @@ | ||
return { | ||
import = "plugins.languages.nix", | ||
} |
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,35 @@ | ||
-- nix lsp client named nil | ||
return { | ||
-- tell mason to install nil | ||
{ | ||
"williamboman/mason.nvim", | ||
opts = function(_, opts) | ||
vim.list_extend(opts.ensure_installed or {}, { "nil" }) | ||
end, | ||
}, | ||
-- add nil to nvim-lspconfig | ||
|
||
{ | ||
"neovim/nvim-lspconfig", | ||
opts = { | ||
servers = { nil_ls = {} }, | ||
setup = { | ||
["nil_ls"] = function() | ||
LazyVim.lsp.on_attach(function(client, _) | ||
if client.name == "nil_ls" then | ||
client.settings = { | ||
["nil"] = { | ||
testSetting = 42, | ||
formatting = { | ||
command = { "nixpkgs-fmt" }, | ||
}, | ||
}, | ||
} | ||
end | ||
end) | ||
end, | ||
}, | ||
}, | ||
}, | ||
-- added nix to telescope languages | ||
} |
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,28 @@ | ||
-- nix formatter named nixpkgs_fmt | ||
return { | ||
-- tell mason to install nixpkgs_fmt | ||
{ | ||
"williamboman/mason.nvim", | ||
opts = function(_, opts) | ||
vim.list_extend(opts.ensure_installed or {}, { "nixpkgs-fmt" }) | ||
end, | ||
}, | ||
-- add alejandra to null-ls | ||
{ | ||
"nvimtools/none-ls.nvim", | ||
opts = function(_, opts) | ||
local nls = require("null-ls") | ||
opts.sources = opts.sources or {} | ||
table.insert(opts.sources, nls.builtins.formatting.nixpkgs_fmt) | ||
end, | ||
}, | ||
-- tell conform to use alejandra | ||
{ | ||
"stevearc/conform.nvim", | ||
opts = { | ||
formatters_by_ft = { | ||
["nix"] = { "nixpkgs-fmt " }, | ||
}, | ||
}, | ||
}, | ||
} |