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
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

View file

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

View file

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

View file

@ -5,10 +5,10 @@
local _file
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
# Fallback to 'find'
_file=$(find . -type f | fzf --height 40% --reverse)
_file=$(find . -type f | fzf --height 40% --reverse -1 -q "$1")
fi
# In POSIX shell, if fzf is cancelled (Esc/Ctrl-C),
@ -34,9 +34,9 @@ in {
set -l file
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
set file (find . -type f | fzf --height 40% --reverse)
set file (find . -type f | fzf --height 40% --reverse -1 -q "$argv[1]")
end
set -l fzf_status $status

View file

@ -24,15 +24,35 @@
ii = "xdg-open";
open = "xdg-open";
};
in
commonAliases
// (
if pkgs.stdenv.isLinux
then linuxAliases
else {}
)
// (
if pkgs.stdenv.isDarwin
then darwinAliases
else {}
)
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
// (
if pkgs.stdenv.isLinux
then linuxAliases
else {}
)
// (
if pkgs.stdenv.isDarwin
then darwinAliases
else {}
);
inherit posixFx fishFx;
}

View file

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

View file

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

View file

@ -3,7 +3,7 @@
pkgs,
...
}: let
aliases = import ./aliases.nix {pkgs = pkgs;};
aliasCfg = import ./aliases.nix {pkgs = pkgs;};
in {
home.packages = with pkgs; [
zsh-fzf-tab
@ -16,19 +16,19 @@ in {
historySubstringSearch.enable = true;
enableCompletion = true;
dotDir = "${config.xdg.configHome}/zsh";
# shellAliases = aliases;
shellAliases = aliasCfg.aliases;
defaultKeymap = "emacs";
zsh-abbr = {
enable = true;
abbreviations = aliases;
};
# zsh-abbr = {
# enable = true;
# abbreviations = aliases;
# };
syntaxHighlighting = {
enable = true;
patterns = {
"rm -rf *" = "fg=blue,bold,bg=red";
};
styles = {
path = "fg=cyan";
path = "fg=cyan,underline";
};
highlighters = [
"main"
@ -38,11 +38,11 @@ in {
];
};
initContent = ''
${aliasCfg.posixFx}
# 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
setopt EXTENDED_GLOB # Extended globbing