home: move zsh and direnv to new modules
This commit is contained in:
15
home-manager/modules/shell/direnv.nix
Normal file
15
home-manager/modules/shell/direnv.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.modules.shell.direnv;
|
||||
in {
|
||||
options.modules.shell.direnv = { enable = mkOption { default = false; }; };
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
};
|
||||
}
|
75
home-manager/modules/shell/zsh/default.nix
Normal file
75
home-manager/modules/shell/zsh/default.nix
Normal file
@ -0,0 +1,75 @@
|
||||
{ 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
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user