aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiran Bastaja <miran.bastaja04@gmail.com>2024-05-01 13:10:24 +0200
committerMiran Bastaja <miran.bastaja04@gmail.com>2024-05-02 20:47:01 +0200
commit6f7b574a9857d654543016b20613c0955ade7814 (patch)
treeae5088b95818518d33e8822110d40a17ac00b452
parenteaaac6432def5abfb4907c19bf15bd6f30d7c115 (diff)
WIP helix config improvements
-rw-r--r--flake.lock21
-rw-r--r--flake.nix4
-rw-r--r--share/cfg/helix.nix89
3 files changed, 108 insertions, 6 deletions
diff --git a/flake.lock b/flake.lock
index 665c6b3..cd9313a 100644
--- a/flake.lock
+++ b/flake.lock
@@ -347,11 +347,32 @@
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
+ "snippets-ls": "snippets-ls",
"sops-nix": "sops-nix",
"sorre-website": "sorre-website",
"treefmt-nix": "treefmt-nix"
}
},
+ "snippets-ls": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1702995973,
+ "narHash": "sha256-LnGCTdl4x7uGWnLvYScQXcO/fAGyg9Fwo+qW5L2uSvc=",
+ "owner": "quantonganh",
+ "repo": "snippets-ls",
+ "rev": "12314f2175fe34fd781d89dc85c4e234f8d0f34e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "quantonganh",
+ "repo": "snippets-ls",
+ "type": "github"
+ }
+ },
"sops-nix": {
"inputs": {
"nixpkgs": [
diff --git a/flake.nix b/flake.nix
index 9f85f1b..aeaf818 100644
--- a/flake.nix
+++ b/flake.nix
@@ -35,6 +35,10 @@
inputs.devshell.follows = "devshell";
inputs.treefmt-nix.follows = "treefmt-nix";
};
+ snippets-ls = {
+ url = "github:quantonganh/snippets-ls";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
};
outputs = inputs@{ flake-parts, ... }:
diff --git a/share/cfg/helix.nix b/share/cfg/helix.nix
index a847ad6..4a185ce 100644
--- a/share/cfg/helix.nix
+++ b/share/cfg/helix.nix
@@ -1,4 +1,16 @@
-{ pkgs, ... }: {
+{
+ # inputs,
+ pkgs
+, # config,
+ # lib,
+ ...
+}:
+# let
+# inherit (lib) mkIf;
+# cfg = config.programs.helix;
+# jsonFormat = pkgs.formats.json { };
+# in
+{
programs.helix = {
extraPackages = with pkgs; [
rust-analyzer
@@ -12,6 +24,9 @@
vscode-langservers-extracted
nodePackages.typescript-language-server
nodePackages."@astrojs/language-server"
+ cmake-language-server
+ cmake-format
+ # inputs.snippets-ls
];
settings = {
@@ -52,23 +67,85 @@
typescript.tsdk = "${pkgs.typescript}/lib/node_modules/typescript/lib";
environment = "node";
};
+ # language-server.snippets-html = {
+ # command = "snippets-ls";
+ # args = [
+ # "-config"
+ # config.xdg.configFile."helix/snippets/html.json".target
+ # ];
+ # };
};
language = [
{
name = "html";
- language-servers = [ "vscode-html-language-server" "emmet-ls" ];
+ language-servers = [
+ "vscode-html-language-server"
+ "emmet-ls"
+ # "snippets-html"
+ ];
}
{
name = "astro";
scope = "source.astro";
injection-regex = "astro";
file-types = [ "astro" ];
- roots = [ "package.json" "astro.config.mjs" ];
- language-servers = [ "astro-ls" "emmet-ls" ];
+ roots = [
+ "package.json"
+ "astro.config.mjs"
+ ];
+ language-servers = [
+ "astro-ls"
+ "emmet-ls"
+ ];
auto-format = true;
}
+ {
+ name = "nix";
+ auto-format = true;
+ formatter = {
+ command = "nixfmt";
+ args = [ "-" ];
+ };
+ }
+ {
+ name = "cpp";
+ auto-format = true;
+ formatter.command = "clang-format";
+ }
+ {
+ name = "cmake";
+ auto-format = true;
+ formatter = {
+ command = "cmake-format";
+ args = [ "-" ];
+ };
+ }
];
- };
- };
+ }; # end of languages
+ }; # end of programs.helix
+
+ # xdg.configFile = {
+ # "helix/snippets/html.json" = mkIf cfg.enable {
+ # source = jsonFormat.generate "html-snippets" {
+ # "html doc" = {
+ # isFileTemplate = true;
+ # prefix = [ "!" ];
+ # body = [
+ # "<!DOCTYPE html>"
+ # "<html>"
+ # "<head>"
+ # ''\t<meta charset=\"UTF-8\" />''
+ # ''\t<title>$\{1:title}</title>''
+ # "</head>"
+ # "<body>"
+ # ''\t$0''
+ # "</body>"
+ # "</html>"
+ # ];
+ # description = "HTML Document";
+ # };
+ # };
+ # };
+ # };
}