121 lines
3.0 KiB
Nix
121 lines
3.0 KiB
Nix
{ pkgs, lib, ... }:
|
|
{
|
|
programs.z-lua = {
|
|
enableAliases = true;
|
|
enableZshIntegration = true;
|
|
};
|
|
|
|
programs.zsh = {
|
|
autocd = true;
|
|
enableCompletion = false;
|
|
defaultKeymap = "viins";
|
|
|
|
shellAliases = {
|
|
cfind = "${pkgs.cscope}/bin/cscope -C -R -L1";
|
|
chmod = "chmod -v";
|
|
chown = "chown -v";
|
|
cp = "cp -v";
|
|
rm = "rm -v";
|
|
ip = "ip --color=auto";
|
|
f = "''$(${lib.getExe pkgs.pay-respects} zsh)";
|
|
};
|
|
|
|
history = {
|
|
expireDuplicatesFirst = true;
|
|
extended = true;
|
|
save = 100000;
|
|
size = 100000;
|
|
};
|
|
|
|
plugins = [
|
|
{
|
|
name = "nix_shell";
|
|
src = pkgs.zsh-nix-shell;
|
|
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
|
|
}
|
|
{
|
|
name = "nix_completion";
|
|
src = pkgs.nix-zsh-completions;
|
|
file = "share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh";
|
|
}
|
|
{
|
|
name = "pure_prompt";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "sindresorhus";
|
|
repo = "pure";
|
|
rev = "92b8e9057988566b37ff695e70e2e9bbeb7196c8";
|
|
hash = "sha256-TbOrnhLHgOvcfsgmL0l3bWY33yLIhG1KSi4ITIPq1+A=";
|
|
};
|
|
file = "pure.plugin.zsh";
|
|
}
|
|
{
|
|
name = "fzf";
|
|
src = pkgs.fzf-zsh;
|
|
file = "share/zsh/plugins/fzf-zsh/fzf-zsh.plugin.zsh";
|
|
}
|
|
{
|
|
name = "zsh-sudo";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "hcgraf";
|
|
repo = "zsh-sudo";
|
|
rev = "d8084def6bb1bde2482e7aa636743f40c69d9b32";
|
|
sha256 = "1dpm51w3wjxil8sxqw4qxim5kmf6afmkwz1yfhldpdlqm7rfwpi3";
|
|
};
|
|
file = "sudo.plugin.zsh";
|
|
}
|
|
{
|
|
name = "zsh-fast-syntax-highlighting";
|
|
src = pkgs.zsh-fast-syntax-highlighting;
|
|
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
|
}
|
|
];
|
|
|
|
envExtra = '''';
|
|
|
|
initExtra = ''
|
|
# binds
|
|
bindkey '^K' fzf-file-widget
|
|
|
|
# options
|
|
setopt nobeep
|
|
setopt nopromptcr
|
|
setopt c_bases
|
|
setopt completeinword
|
|
setopt completealiases
|
|
setopt notify
|
|
|
|
#
|
|
RPS1=""
|
|
|
|
#
|
|
function chpwd() {
|
|
ls;
|
|
}
|
|
|
|
function osc7-pwd() {
|
|
emulate -L zsh # also sets localoptions for us
|
|
setopt extendedglob
|
|
local LC_ALL=C
|
|
printf '\e]7;file://%s%s\e\' $HOST ''${PWD//(#m)([^@-Za-z&-;_~])/%''${(l:2::0:)''$(([##16]#MATCH))}}
|
|
}
|
|
|
|
function chpwd-osc7-pwd() {
|
|
(( ZSH_SUBSHELL )) || osc7-pwd
|
|
}
|
|
add-zsh-hook -Uz chpwd chpwd-osc7-pwd
|
|
|
|
eval "$(direnv hook zsh)"
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
|
|
|
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
|
|
TMUX_EXE="${lib.getExe pkgs.tmux}"
|
|
systemd-run --scope --user $TMUX_EXE attach-session -t $USER || systemd-run --scope --user $TMUX_EXE new-session -s $USER
|
|
fi
|
|
|
|
if [[ -n "$BUBBLEWRAP_DIR" ]]; then
|
|
RPS1="{{$BUBBLEWRAP_DIR}}"
|
|
fi
|
|
'';
|
|
};
|
|
}
|