zsh optimised

This commit is contained in:
js0ny 2025-11-06 08:31:07 +00:00
parent 6e0352c089
commit 59328ad384
9 changed files with 58 additions and 36 deletions

View file

@ -81,4 +81,4 @@ map ctrl+shift+enter toggle_layout stack
map f1 launch --type tab --cwd ~/.dotfiles nvim map f1 launch --type tab --cwd ~/.dotfiles nvim
shell fish shell zsh

View file

@ -25,7 +25,7 @@ output * bg /run/current-system/sw/share/backgrounds/sway/Sway_Wallpaper_Blue_19
# #
seat seat0 xcursor_theme breeze_cursors 30 seat seat0 xcursor_theme BreezeX-RosePine-Linux 30
# # Floating rules # # Floating rules

View file

@ -14,7 +14,7 @@
../../modules/nixos/desktop/laptop.nix ../../modules/nixos/desktop/laptop.nix
# hardware drivers # hardware drivers
../../modules/nixos/hardware/nvidia-disable.nix ../../modules/nixos/hardware/nvidia.nix
# udev rules # udev rules
../../modules/nixos/hardware/udev/basys3.nix ../../modules/nixos/hardware/udev/basys3.nix

View file

@ -34,6 +34,7 @@
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJToUo2jT3qt7eHIME9e1awabZZVmtKhbxwVz9BMSM2d js0ny@zephyrus" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJToUo2jT3qt7eHIME9e1awabZZVmtKhbxwVz9BMSM2d js0ny@zephyrus"
]; ];
shell = pkgs.zsh;
}; };
programs.command-not-found.enable = true; programs.command-not-found.enable = true;
} }

View file

@ -5,10 +5,10 @@
local _file local _file
if command -v fd >/dev/null 2>&1; then if command -v fd >/dev/null 2>&1; then
_file=$(fd --type f | fzf --height 40% --reverse) _file=$(fd --type f | fzf --height 40% --reverse -1 -q "$1")
else else
# Fallback to 'find' # Fallback to 'find'
_file=$(find . -type f | fzf --height 40% --reverse) _file=$(find . -type f | fzf --height 40% --reverse -1 -q "$1")
fi fi
# In POSIX shell, if fzf is cancelled (Esc/Ctrl-C), # In POSIX shell, if fzf is cancelled (Esc/Ctrl-C),
@ -34,9 +34,9 @@ in {
set -l file set -l file
if command -q fd if command -q fd
set file (fd --type f | fzf --height 40% --reverse) set file (fd --type f | fzf --height 40% --reverse -1 -q "$argv[1]")
else else
set file (find . -type f | fzf --height 40% --reverse) set file (find . -type f | fzf --height 40% --reverse -1 -q "$argv[1]")
end end
set -l fzf_status $status set -l fzf_status $status

View file

@ -24,7 +24,25 @@
ii = "xdg-open"; ii = "xdg-open";
open = "xdg-open"; open = "xdg-open";
}; };
in posixFx = ''
mt() {
mkdir -p $(dirname $1) && touch $1
}
mtv() {
mkdir -p $(dirname $1) && touch $1 && nvim $1
}
'';
fishFx = ''
function mt
mkdir -p (dirname $argv[1]) && touch $argv[1]
end
function mtv
mkdir -p (dirname $argv[1]) && touch $argv[1] && nvim $argv[1]
end
'';
in {
aliases =
commonAliases commonAliases
// ( // (
if pkgs.stdenv.isLinux if pkgs.stdenv.isLinux
@ -35,4 +53,6 @@ in
if pkgs.stdenv.isDarwin if pkgs.stdenv.isDarwin
then darwinAliases then darwinAliases
else {} else {}
) );
inherit posixFx fishFx;
}

View file

@ -1,8 +1,11 @@
{pkgs, ...}: let {pkgs, ...}: let
aliases = import ./aliases.nix {pkgs = pkgs;}; aliasCfg = import ./aliases.nix {pkgs = pkgs;};
in { in {
programs.bash = { programs.bash = {
enable = true; enable = true;
shellAliases = aliases; shellAliases = aliasCfg.aliases;
bashrcExtra = ''
${aliasCfg.posixFx}
'';
}; };
} }

View file

@ -1,5 +1,5 @@
{pkgs, ...}: let {pkgs, ...}: let
aliases = import ./aliases.nix {pkgs = pkgs;}; aliasCfg = import ./aliases.nix {pkgs = pkgs;};
in { in {
programs.fish = { programs.fish = {
enable = true; enable = true;
@ -10,9 +10,7 @@ in {
function tv function tv
touch $argv[1] && $EDITOR $argv[1] touch $argv[1] && $EDITOR $argv[1]
end end
function mtv ${aliasCfg.fishFx}
mkdir -p (dirname $argv[1]) && touch $argv[1] && $EDITOR $argv[1]
end
fish_vi_key_bindings fish_vi_key_bindings
@ -44,7 +42,7 @@ in {
bind -M insert alt-delete kill-line bind -M insert alt-delete kill-line
''; '';
# preferAbbrs = true; # preferAbbrs = true;
shellAbbrs = aliases; shellAbbrs = aliasCfg.aliases;
}; };
programs.zed-editor.extensions = ["fish"]; programs.zed-editor.extensions = ["fish"];
} }

View file

@ -3,7 +3,7 @@
pkgs, pkgs,
... ...
}: let }: let
aliases = import ./aliases.nix {pkgs = pkgs;}; aliasCfg = import ./aliases.nix {pkgs = pkgs;};
in { in {
home.packages = with pkgs; [ home.packages = with pkgs; [
zsh-fzf-tab zsh-fzf-tab
@ -16,19 +16,19 @@ in {
historySubstringSearch.enable = true; historySubstringSearch.enable = true;
enableCompletion = true; enableCompletion = true;
dotDir = "${config.xdg.configHome}/zsh"; dotDir = "${config.xdg.configHome}/zsh";
# shellAliases = aliases; shellAliases = aliasCfg.aliases;
defaultKeymap = "emacs"; defaultKeymap = "emacs";
zsh-abbr = { # zsh-abbr = {
enable = true; # enable = true;
abbreviations = aliases; # abbreviations = aliases;
}; # };
syntaxHighlighting = { syntaxHighlighting = {
enable = true; enable = true;
patterns = { patterns = {
"rm -rf *" = "fg=blue,bold,bg=red"; "rm -rf *" = "fg=blue,bold,bg=red";
}; };
styles = { styles = {
path = "fg=cyan"; path = "fg=cyan,underline";
}; };
highlighters = [ highlighters = [
"main" "main"
@ -38,11 +38,11 @@ in {
]; ];
}; };
initContent = '' initContent = ''
${aliasCfg.posixFx}
# Options # Options
# ========== # ==========
# ! This breaks the nixos-rebuild --flake .#something setopt INTERACTIVE_COMMENTS # Allow comments in interactive mode
# setopt INTERACTIVE_COMMENTS # Allow comments in interactive mode
# Globbing # Globbing
setopt EXTENDED_GLOB # Extended globbing setopt EXTENDED_GLOB # Extended globbing