{ config, lib, pkgs, ... }: with lib; let cfg = config.modules.shell.zsh; in { options.modules.shell.zsh = { enable = mkOption { default = false; }; }; config = mkIf cfg.enable { home.file = { ".config/starship.toml".source = ../../../../starship/starship.toml; }; home.packages = with pkgs; [ starship ]; programs.starship = { enable = true; enableZshIntegration = true; }; programs.zsh = { enable = true; initExtra = '' function go_dir_up() { cd .. || return 1 } function zle_go_dir_up() { zle .kill-buffer go_dir_up zle .accept-line } fzf-z() { dir=$(z | fzf --tiebreak=index --tac | sed -E 's/^[0-9]+[[:space:]]+//') cd $dir } mkcd () { mkdir -p -- "$1" && cd -P -- "$1" } zle -N zle_go_dir_up bindkey "^[[1;3A" zle_go_dir_up bindkey "^[[A" history-substring-search-up bindkey "^[[B" history-substring-search-down bindkey "^[[1;5C" forward-word bindkey "^[[1;5D" backward-word ''; zplug = { enable = true; plugins = [ # list of plugins: https://github.com/unixorn/awesome-zsh-plugins { name = "agkozak/zsh-z"; } { name = "mdumitru/last-working-dir"; } { name = "zsh-users/zsh-completions"; } # make it behave like fish { name = "zsh-users/zsh-autosuggestions"; } { name = "zsh-users/zsh-history-substring-search"; } { name = "zsh-users/zsh-syntax-highlighting"; } # must be last sourced plugin ]; }; }; }; }