Files
dev/modules/core/tty.nix

80 lines
2.0 KiB
Nix

{
...
}:
{
environment = {
etc = {
"inputrc".source = ./config/etc/inputrc;
};
shellAliases = {
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";
};
# Defined in /etc/set-environnement. Require session restart
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";
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"
];
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
'';
};
}