2024-07-06 22:41:58 +07:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib.lists) optional;
|
|
|
|
in
|
2024-06-12 09:54:11 +07:00
|
|
|
{
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
eza
|
|
|
|
bat
|
|
|
|
gojq
|
2024-07-06 23:55:05 +07:00
|
|
|
nix-zsh-completions
|
2024-06-12 09:54:11 +07:00
|
|
|
];
|
|
|
|
programs.zsh = {
|
|
|
|
enable = true;
|
|
|
|
autosuggestion.enable = true;
|
2024-07-06 22:41:58 +07:00
|
|
|
enableCompletion = true;
|
2024-06-12 09:54:11 +07:00
|
|
|
defaultKeymap = "emacs";
|
|
|
|
dirHashes = {
|
|
|
|
docs = "$HOME/Documents";
|
|
|
|
dl = "$HOME/Downloads";
|
|
|
|
videos = "$HOME/Videos";
|
|
|
|
pictures = "$HOME/Pictures";
|
|
|
|
};
|
|
|
|
shellAliases = {
|
|
|
|
ls = "eza -lah";
|
|
|
|
cat = "bat";
|
|
|
|
update = "sudo nixos-rebuild switch --flake $HOME/dotfiles";
|
|
|
|
superupdate = "(cd $HOME/dotfiles && nix flake update && sudo nixos-rebuild switch --flake $HOME/dotfiles)";
|
|
|
|
lg = "lazygit";
|
|
|
|
du = "dust -H";
|
|
|
|
uptest = "sudo nixos-rebuild test --flake $HOME/dotfiles";
|
|
|
|
dry = "sudo nixos-rebuild dry-activate --flake $HOME/dotfiles";
|
|
|
|
jq = "gojq";
|
2024-06-17 18:21:38 +07:00
|
|
|
n = "neovide";
|
2024-06-12 09:54:11 +07:00
|
|
|
v = "nvim";
|
2024-06-17 18:21:38 +07:00
|
|
|
cd = "z";
|
2024-06-12 09:54:11 +07:00
|
|
|
};
|
|
|
|
dotDir = ".config/zsh";
|
|
|
|
history = {
|
|
|
|
expireDuplicatesFirst = true;
|
|
|
|
extended = true;
|
|
|
|
ignoreAllDups = true;
|
2024-07-06 22:41:58 +07:00
|
|
|
ignoreSpace = true;
|
2024-06-12 09:54:11 +07:00
|
|
|
path = "$HOME/.local/share/zsh/zsh_history";
|
|
|
|
save = 40000;
|
|
|
|
size = 40000;
|
|
|
|
};
|
2024-07-06 23:55:05 +07:00
|
|
|
syntaxHighlighting.enable = true;
|
2024-07-02 14:05:44 +07:00
|
|
|
initExtraFirst = /*bash*/ ''
|
2024-07-06 23:55:05 +07:00
|
|
|
export ZSH_CACHE_DIR=$HOME/.cache/zsh
|
|
|
|
|
|
|
|
if [ -f $HOME/.config/zsh/.p10k.zsh ]; then
|
|
|
|
source $HOME/.config/zsh/.p10k.zsh
|
|
|
|
fi
|
|
|
|
|
2024-06-12 09:54:11 +07:00
|
|
|
_ZSH_COLOR_SCHEME_FILE=$HOME/.cache/wallust/sequences
|
|
|
|
if [ -f "$_ZSH_COLOR_SCHEME_FILE" ]; then
|
|
|
|
(cat "$_ZSH_COLOR_SCHEME_FILE" &)
|
|
|
|
fi
|
|
|
|
'';
|
2024-07-02 14:05:44 +07:00
|
|
|
initExtra = /*bash*/ ''
|
2024-07-06 23:55:05 +07:00
|
|
|
packfiles() {
|
|
|
|
find $(nix build "nixpkgs#$1" --no-link --print-out-paths)
|
|
|
|
}
|
2024-07-06 22:41:58 +07:00
|
|
|
|
|
|
|
# Completion settings
|
|
|
|
## Case insensitive completion
|
|
|
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
|
|
|
|
|
|
|
|
# FZF Tab configurations
|
|
|
|
#
|
|
|
|
# disable sort when completing `git checkout`
|
|
|
|
zstyle ':completion:*:git-checkout:*' sort false
|
|
|
|
# set descriptions format to enable group support
|
|
|
|
# NOTE: don't use escape sequences here, fzf-tab will ignore them
|
|
|
|
zstyle ':completion:*:descriptions' format '[%d]'
|
|
|
|
# set list-colors to enable filename colorizing
|
|
|
|
zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
|
|
|
|
# force zsh not to show completion menu, which allows fzf-tab to capture the unambiguous prefix
|
|
|
|
zstyle ':completion:*' menu no
|
|
|
|
# preview directory's content with eza when completing cd
|
|
|
|
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
|
|
|
|
# switch group using `<` and `>`
|
|
|
|
zstyle ':fzf-tab:*' switch-group '<' '>'
|
|
|
|
# Preview fzf
|
|
|
|
zstyle ':fzf-tab:*' fzf-preview 'eza -1 --color=always $realpath'
|
2024-06-12 18:09:56 +07:00
|
|
|
'';
|
2024-07-06 22:41:58 +07:00
|
|
|
|
2024-07-06 23:55:05 +07:00
|
|
|
plugins = [
|
|
|
|
{
|
|
|
|
name = "fzf-tab";
|
|
|
|
src = pkgs.zsh-fzf-tab;
|
|
|
|
file = "share/fzf-tab/fzf-tab.plugin.zsh";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "powerlevel10k";
|
|
|
|
src = pkgs.zsh-powerlevel10k;
|
|
|
|
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "auto-suggestions";
|
|
|
|
src = pkgs.zsh-autosuggestions;
|
|
|
|
file = "share/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "zsh-nix-shell";
|
|
|
|
src = pkgs.zsh-nix-shell;
|
|
|
|
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "zsh-history-substring-search";
|
|
|
|
src = pkgs.zsh-history-substring-search;
|
|
|
|
file = "share/zsh-history-substring-search/zsh-history-substring-search.zsh";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "golang-autocomplete";
|
|
|
|
src = pkgs.oh-my-zsh;
|
|
|
|
file = "share/oh-my-zsh/plugins/golang/golang.plugin.zsh";
|
|
|
|
}
|
|
|
|
]
|
|
|
|
# ++ optional (config.profile.podman.enable) {
|
|
|
|
# name = "podman";
|
|
|
|
# src = pkgs.oh-my-zsh;
|
|
|
|
# file = "share/oh-my-zsh/plugins/podman/podman.plugin.zsh";
|
|
|
|
# }
|
|
|
|
;
|
|
|
|
|
|
|
|
# Antidote should only be used for loading completions
|
|
|
|
# antidote = {
|
|
|
|
# enable = true;
|
|
|
|
# plugins = [
|
|
|
|
# "ohmyzsh/ohmyzsh path:plugins/golang"
|
|
|
|
# ]
|
|
|
|
# ++ optional (config.profile.podman.enable) "ohmyzsh/ohmyzsh path:plugins/podman"
|
|
|
|
# ;
|
|
|
|
# };
|
2024-06-12 09:54:11 +07:00
|
|
|
};
|
|
|
|
}
|