Compare commits

...

4 commits

Author SHA1 Message Date
ppenguin
8f0e64fa12
Merge 38d586994a into 473ebea4cf 2024-08-24 14:12:23 +02:00
Ching Pei Yang
473ebea4cf
theme: fix broken function signatures (#364)
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Validate flake & check formatting / Validate Flake (push) Waiting to run
Validate flake & check formatting / Formatting via Alejandra (push) Waiting to run
2024-08-24 12:12:20 +00:00
Gerg-L
fc2e5998e7
flake.lock: Update (#363)
Flake lock file updates:

• Updated input 'mnw':
    'github:Gerg-L/mnw/e06b48c51291cc1df08adcd34a8796f86d5b235e?narHash=sha256-qimVBdes%2B2gNRRcyFoIUA1RyOKV0Ee40hUaVVf7ZsNs%3D' (2024-08-22)
  → 'github:Gerg-L/mnw/c261925dbbf02f523af0e8add844df64fddf0359?narHash=sha256-SMgnviF6ofBPbyV3%2BrljPGcX0Hn9HBOhgXE10Cyjaic%3D' (2024-08-23)
2024-08-24 10:47:26 +00:00
ppenguin
38d586994a
add language HCL
Terraform doesn't register hcl and doesn't offer good DX if manually set
for editing e.g. nomad HCL files.

Incl. reformat with alejandra
2024-08-17 20:53:43 +02:00
4 changed files with 77 additions and 5 deletions

View file

@ -69,11 +69,11 @@
}, },
"mnw": { "mnw": {
"locked": { "locked": {
"lastModified": 1724368098, "lastModified": 1724456641,
"narHash": "sha256-qimVBdes+2gNRRcyFoIUA1RyOKV0Ee40hUaVVf7ZsNs=", "narHash": "sha256-SMgnviF6ofBPbyV3+rljPGcX0Hn9HBOhgXE10Cyjaic=",
"owner": "Gerg-L", "owner": "Gerg-L",
"repo": "mnw", "repo": "mnw",
"rev": "e06b48c51291cc1df08adcd34a8796f86d5b235e", "rev": "c261925dbbf02f523af0e8add844df64fddf0359",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -8,6 +8,7 @@ in {
./css.nix ./css.nix
./elixir.nix ./elixir.nix
./go.nix ./go.nix
./hcl.nix
./html.nix ./html.nix
./java.nix ./java.nix
./lua.nix ./lua.nix

View file

@ -0,0 +1,71 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) package;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.hcl;
in {
options.vim.languages.hcl = {
enable = mkEnableOption "HCL support";
treesitter = {
enable = mkEnableOption "HCL treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "hcl";
};
lsp = {
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
# TODO: it would be cooler to use vscode-extensions.hashicorp.hcl probably, shouldn't be too hard
# TODO: formatter, suppied by above or ...
# FIXME: or should we somehow integrate this:
#` https://git.mzte.de/nvim-plugins/null-ls.nvim/commit/e1fb7e2b2e4400835e23b9603a19813be119852b ??
package = mkOption {
description = "HCL ls package (terraform-ls)";
type = package;
default = pkgs.terraform-ls;
};
};
};
config = mkIf cfg.enable (mkMerge [
{
vim.pluginRC.hcl = ''
vim.api.nvim_create_autocmd("FileType", {
pattern = "hcl",
callback = function(opts)
local bo = vim.bo[opts.buf]
bo.tabstop = 2
bo.shiftwidth = 2
bo.softtabstop = 2
end
})
local ft = require('Comment.ft')
ft
.set('hcl', '#%s')
'';
}
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources = lib.optionalAttrs (! config.vim.languages.terraform.lsp.enable) {
terraform-ls = ''
lspconfig.terraformls.setup {
capabilities = capabilities,
on_attach=default_on_attach,
cmd = {"${cfg.lsp.package}/bin/terraform-ls", "serve"},
}
'';
};
})
]);
}

View file

@ -6,7 +6,7 @@
inherit (lib.trivial) boolToString warnIf; inherit (lib.trivial) boolToString warnIf;
in { in {
onedark = { onedark = {
setup = {style ? "dark"}: '' setup = {style ? "dark", ...}: ''
-- OneDark theme -- OneDark theme
require('onedark').setup { require('onedark').setup {
style = "${style}" style = "${style}"
@ -30,7 +30,7 @@ in {
}; };
dracula = { dracula = {
setup = {transparent}: '' setup = {transparent, ...}: ''
require('dracula').setup({ require('dracula').setup({
transparent_bg = ${boolToString transparent}, transparent_bg = ${boolToString transparent},
}); });