helix: for FASM

This commit is contained in:
2026-08-19 22:09:40 +03:00
parent cdc137c2d9
commit 357db9432d
+61 -6
View File
@@ -68,11 +68,29 @@
PY PY
''; '';
in { in {
home.packages = with pkgs; [
asm-lsp
fasm
];
programs.helix = { programs.helix = {
enable = true; enable = true;
package = helixSteel; package = helixSteel;
defaultEditor = true; defaultEditor = true;
languages = {
language-server.asm-lsp.command = "asm-lsp";
language = [
{
name = "nasm";
file-types = [ "asm" "inc" ];
comment-token = ";";
language-servers = [ "asm-lsp" ];
}
];
};
settings = { settings = {
# theme = "catppuccin-mocha"; # theme = "catppuccin-mocha";
editor = { editor = {
@@ -96,22 +114,48 @@ in {
}; };
keys.normal = { keys.normal = {
space.C-c = { space = {
h = ":comment-h1"; C-a = {
j = ":comment-h2"; b = ":fasm-build";
k = ":comment-h3"; r = ":fasm-run";
d = ":comment-divider"; c = ":fasm-clean";
};
C-c = {
h = ":comment-h1";
j = ":comment-h2";
k = ":comment-h3";
d = ":comment-divider";
};
}; };
}; };
}; };
}; };
xdg.configFile = { xdg.configFile = {
"asm-lsp/.asm-lsp.toml".text = ''
[default_config]
assembler = "fasm"
instruction_set = "x86/x86-64"
[opts]
compiler = "fasm"
diagnostics = true
default_diagnostics = true
'';
"helix/cogs/comment_headers.scm".source = patched-comment-headers; "helix/cogs/comment_headers.scm".source = patched-comment-headers;
"helix/helix.scm".text = '' "helix/helix.scm".text = ''
(require (prefix-in div. "cogs/comment_headers.scm")) (require (prefix-in div. "cogs/comment_headers.scm"))
(require (prefix-in helix. "helix/commands.scm"))
(provide comment-h1 comment-h2 comment-h3 comment-divider) (provide comment-h1
comment-h2
comment-h3
comment-divider
fasm-build
fasm-run
fasm-clean)
(define (comment-h1) (define (comment-h1)
(div.insert-h1!)) (div.insert-h1!))
@@ -124,6 +168,17 @@ in {
(define (comment-divider) (define (comment-divider)
(div.insert-divider! 80 "~")) (div.insert-divider! 80 "~"))
(define (fasm-build)
(helix.write)
(helix.run-shell-command "just" "build"))
(define (fasm-run)
(helix.write)
(helix.run-shell-command "just" "run"))
(define (fasm-clean)
(helix.run-shell-command "just" "clean"))
''; '';
"helix/init.scm".text = '' "helix/init.scm".text = ''
;; Steel init file ;; Steel init file