Improving shell

This commit is contained in:
2025-10-13 18:29:23 +02:00
parent 3df4363583
commit e1d128f28a
11 changed files with 181 additions and 89 deletions

View File

@@ -1,11 +1,6 @@
{
config,
pkgs,
...
}@attrs:
let
cfg = config.services.getty;
in
}:
{
environment = {
etc = {
@@ -15,13 +10,79 @@ in
ls = "ls --color=auto";
ll = "ls --color=auto -lha";
grep = "grep --color=auto";
egrep = "egrep --color=auto";
frep = "frep --color=auto";
ip = "ip -color=auto";
vi = "nvim";
df = "df -h";
du = "du -h";
};
variables = {
XDG_CONFIG_HOME = "$HOME/.config";
XDG_CACHE_HOME = "$HOME/.cache";
XDG_DATA_HOME = "$HOME/.local/share";
ZDOTDIR = "$HOME/.config/zsh";
TERMINAL = "kitty";
EDITOR = "nvim";
HISTSIZE = 20000;
HISTTIMEFORMAT = "%F %T ";
BROWSER = "firefox";
HISTSIZE = 200000;
SAVEHIST = 200000;
};
};
programs.zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
autosuggestions.enable = false;
histSize = 200000;
histFile = "$HOME/.config/zsh/.zsh_history";
setOptions = [
"SHARE_HISTORY"
];
# shellInit = ''
# export XDG_CONFIG_HOME=$HOME/.config
# export XDG_CACHE_HOME=$HOME/.cache
# export XDG_DATA_HOME=$HOME/.local/share
# export ZDOTDIR=$HOME/.config/zsh
# export TERMINAL=kitty
# export EDITOR=nvim
# export BROWSER=firefox
# export SAVEHIST=200000
# '';
promptInit = ''
stty stop undef # Disable ctrl+s to freeze terminal
# Get keycode by typing Ctrl+v in your terminal then the key or key combination you want
bindkey '^[OA' history-beginning-search-backward
bindkey '^[OB' history-beginning-search-forward
zstyle ':completion:*' menu select
zmodload zsh/complist
fzf-history() {
local selected
selected=$(fc -l 1 | fzf --tac --no-sort | sed 's/^[ ]*[0-9]*[ ]*//')
if [[ -n "$selected" ]]; then
BUFFER="$selected"
CURSOR=$#BUFFER
fi
zle redisplay
}
zle -N fzf-history
bindkey '^R' fzf-history
# Fonction SSH avec fzf
fzf-ssh() {
local selected
selected=$(fc -l 1 | grep 'ssh ' | fzf --tac --no-sort | sed 's/^[ ]*[0-9]*[ ]*//')
if [[ -n "$selected" ]]; then
BUFFER="$selected"
CURSOR=$#BUFFER
fi
zle redisplay
}
zle -N fzf-ssh
bindkey '^S' fzf-ssh
'';
};
}