mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-08 22:05:06 +02:00
feat: helix with steel, preserve steel's package
This commit is contained in:
@@ -1,18 +1,27 @@
|
|||||||
{ pkgs, helix, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
helix,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
helixPackages = helix.packages.${pkgs.stdenv.hostPlatform.system};
|
helixPackages = helix.packages.${pkgs.stdenv.hostPlatform.system};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
# to make steel work, we need to git clone this repo to your home directory.
|
||||||
|
home.sessionVariables.HELIX_STEEL_CONFIG = "${config.home.homeDirectory}/nix-config/home/base/tui/editors/helix/steel";
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
steel
|
steel
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.helix = {
|
programs.helix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# enable steel as the plugin system
|
||||||
# https://github.com/helix-editor/helix/pull/8675
|
# https://github.com/helix-editor/helix/pull/8675
|
||||||
|
# https://github.com/mattwparas/helix/blob/steel-event-system/STEEL.md
|
||||||
package = helixPackages.default.overrideAttrs (prevAttrs: {
|
package = helixPackages.default.overrideAttrs (prevAttrs: {
|
||||||
# enable steel as the plugin system
|
|
||||||
cargoBuildFeatures = prevAttrs.cargoBuildFeatures or [ ] ++ [ "steel" ];
|
cargoBuildFeatures = prevAttrs.cargoBuildFeatures or [ ] ++ [ "steel" ];
|
||||||
});
|
});
|
||||||
settings = {
|
settings = {
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
;; The helix.scm module will be loaded first before anything else,
|
||||||
|
;; the runtime will require this module, and any functions exported
|
||||||
|
;; will now be available to be used as typed commands, e.g. :git-add :open-helix-scm
|
||||||
|
|
||||||
|
(require "helix/editor.scm")
|
||||||
|
(require (prefix-in helix. "helix/commands.scm"))
|
||||||
|
(require (prefix-in helix.static. "helix/static.scm"))
|
||||||
|
|
||||||
|
(provide shell git-add open-helix-scm open-init-scm)
|
||||||
|
|
||||||
|
(define (current-path)
|
||||||
|
(let* ([focus (editor-focus)]
|
||||||
|
[focus-doc-id (editor->doc-id focus)])
|
||||||
|
(editor-document->path focus-doc-id)))
|
||||||
|
|
||||||
|
;;@doc
|
||||||
|
;; Specialized shell implementation, where % is a wildcard for the current file
|
||||||
|
(define (shell . args)
|
||||||
|
(helix.run-shell-command
|
||||||
|
(string-join
|
||||||
|
;; Replace the % with the current file
|
||||||
|
(map (lambda (x) (if (equal? x "%") (current-path) x)) args)
|
||||||
|
" ")))
|
||||||
|
|
||||||
|
;;@doc
|
||||||
|
;; Adds the current file to git
|
||||||
|
(define (git-add)
|
||||||
|
(shell "git" "add" "%"))
|
||||||
|
|
||||||
|
;;@doc
|
||||||
|
;; Open the helix.scm file
|
||||||
|
(define (open-helix-scm)
|
||||||
|
(helix.open (helix.static.get-helix-scm-path)))
|
||||||
|
|
||||||
|
;;@doc
|
||||||
|
;; Opens the init.scm file
|
||||||
|
(define (open-init-scm)
|
||||||
|
(helix.open (helix.static.get-init-scm-path)))
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
;; The init.scm file is run at the top level, immediately after the helix.scm module is required.
|
||||||
|
;; The helix context is available here, so you can interact with the editor.
|
||||||
|
|
||||||
|
;; configure the LSP for steel
|
||||||
|
(require "helix/configuration.scm")
|
||||||
|
(define-lsp "steel-language-server" (command "steel-language-server") (args '()))
|
||||||
|
(define-language "scheme"
|
||||||
|
(language-servers '("steel-language-server")))
|
||||||
|
|
||||||
|
;; show splash screen - when you open with no argument
|
||||||
|
(require "mattwparas-helix-package/splash.scm")
|
||||||
|
(when (equal? (command-line) '("hx"))
|
||||||
|
(show-splash))
|
||||||
|
|
||||||
|
;; Terminal & shell
|
||||||
|
(require "steel-pty/term.scm")
|
||||||
|
(set-default-shell! "nu")
|
||||||
|
|
||||||
|
;; File Watcher
|
||||||
|
(require "helix-file-watcher/file-watcher.scm")
|
||||||
|
(spawn-watcher)
|
||||||
|
|
||||||
|
;; File Tree
|
||||||
|
(require "mattwparas-helix-package/cogs/file-tree.scm")
|
||||||
@@ -149,6 +149,9 @@ in
|
|||||||
".local/share/nvim"
|
".local/share/nvim"
|
||||||
".local/state/nvim"
|
".local/state/nvim"
|
||||||
|
|
||||||
|
# helix & steel
|
||||||
|
".local/share/steel"
|
||||||
|
|
||||||
# doom-emacs
|
# doom-emacs
|
||||||
# "org" # org files
|
# "org" # org files
|
||||||
# ".config/emacs"
|
# ".config/emacs"
|
||||||
|
|||||||
Reference in New Issue
Block a user