Skip to content

Commit

Permalink
Add basic helix config
Browse files Browse the repository at this point in the history
  • Loading branch information
2639-unofficial committed Feb 28, 2024
1 parent aa49d04 commit 592e83a
Show file tree
Hide file tree
Showing 5 changed files with 255 additions and 7 deletions.
120 changes: 119 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@
# Home manager
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";

helix.url = "github:helix-editor/helix/master";
};

outputs = inputs @ { self, nixpkgs, home-manager, ... }: {
# NixOS configuration entrypoint
nixosConfigurations.mfm8s = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/mfm8s/configuration.nix
];
modules = [ ./hosts/mfm8s/configuration.nix ];
};

homeConfigurations."unofficial@mfm8s" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ ./home.nix ];
extraSpecialArgs = { inherit inputs; };
modules = [ ./home-manager/home.nix ];
};
};
}
13 changes: 13 additions & 0 deletions home-manager/helix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ inputs, pkgs, ... }:
let
helix = inputs.helix.packages.${pkgs.system}.default;
in
{
programs.helix = {
enable = true;
package = helix;
defaultEditor = true;
};

xdg.configFile.helix.source = ./helix;
}
103 changes: 103 additions & 0 deletions home-manager/helix/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
theme = "ayu_dark"

[editor]
line-number = "relative"
bufferline = "multiple"
# rulers = [80]
true-color = true
color-modes = true
# cursorline = true
idle-timeout = 50
completion-trigger-len = 1

[editor.file-picker]
hidden = false

[editor.lsp]
display-messages = true
# display-inlay-hints = true

[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"

[editor.indent-guides]
render = true
character = ""

[editor.statusline]
# left = ["mode", "spacer", "spinner", "spacer", "file-type-icon", "file-name", "file-modification-indicator"]
left = ["mode", "spinner", "spacer", "version-control", "file-name", "file-modification-indicator"]
# center = ["diagnostics","workspace-diagnostics"]
center = ["diagnostics"]
right = [ "selections", "position", "position-percentage", "file-encoding", "file-line-ending", "file-type"]

[keys.normal]
esc = ["collapse_selection", "keep_primary_selection"]
ret = ["move_line_down", "goto_first_nonwhitespace"]
a = ["move_char_right", "insert_mode"]

C-r = ":reload"
C-s = ":write"
C-S-s = ":write-all"
C-A-s = ":write-quit-all"
C-q = ":quit"

# C-j = "save_selection"
"'" = "save_selection"
S-tab = "jump_backward"

"C-c" = ["collapse_selection", "keep_primary_selection"]
"C-/" = "toggle_comments" # does not work

C-u = ["half_page_up", "goto_window_center"]
C-d = ["half_page_down", "goto_window_center"]

# non-ideal at the top of a document when half_page_up is nullipotent and align_view_center bloacks the top of the view
# C-u = ["half_page_up", "align_view_center"]
# C-d = ["half_page_down", "align_view_center"]

[keys.normal.space]
z = ":write-quit"
x = ":buffer-close"
X = ":buffer-close-others"
"." = "file_picker_in_current_buffer_directory"
c = 'toggle_comments'

[keys.normal.space.l]
c = [":write!", ":run-shell-command zellij run --floating -- just check"]
b = [":write!", ":run-shell-command zellij run --floating -- just build"]
r = [":write!", ":run-shell-command zellij run --floating -- just run"]
t = [":write!", ":run-shell-command zellij run --floating -- just test"]
k = [":write!", ":run-shell-command zellij run --floating -- just --choose"]

[keys.normal.space.t]
s = ":toggle-option soft-wrap.enable"
i = ":toggle-option file-picker.ignore"
h = ":toggle-option lsp.display-inlay-hints"

[keys.normal.space.w]
c = ":config-open"
r = ":config-reload"

# duplicate from [keys.normal.space.w] due to lack of window mode remapping
[keys.normal.C-w]
c = ":config-open"
r = ":config-reload"

[keys.insert]
# esc = ["collapse_selection", "normal_mode"]
j = { j = ["collapse_selection", "normal_mode"] }
# "C-c" = ["collapse_selection", "normal_mode"]

[keys.select]
# esc = ["collapse_selection", "keep_primary_selection", "normal_mode"]
"C-c" = ["collapse_selection", "keep_primary_selection"]

[keys.select.space]
z = ":quit"
x = ":buffer-close"
X = ":buffer-close-others"
"." = "file_picker_in_current_buffer_directory"
"c" = 'toggle_comments'
17 changes: 15 additions & 2 deletions home.nix → home-manager/home.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
{ config, pkgs, ... }:
# Home-manager configuration
# Man page: home-configuration.nix(5)
# Manual: `home-manager-help`

{ inputs, config, pkgs, ... }:

{
home.username = "unofficial";
home.homeDirectory = "/home/unofficial";

imports = [
./helix.nix
];

# So home-manager can set the session variables
programs.bash.enable = true;

# User packages
home.packages = with pkgs; [
firefox
Expand All @@ -12,11 +23,13 @@
pfetch
wezterm
zellij
helix
just
fzf
];

# Open the HTML manual with `home-manager-help`
manual.html.enable = true;

# Nicely reload system units when switching configs
systemd.user.startServices = "sd-switch";

Expand Down

0 comments on commit 592e83a

Please sign in to comment.