Compare commits

...

7 Commits

Author SHA1 Message Date
c5d5961800
chore: Update flake.nix 2024-11-22 03:26:20 +01:00
f99d6a7d46
fix: Startup times
- Removed `compinit` call
- Stopped loading ohmyzsh/ohmyzsh path:lib
- Turned off p10k instant prompt
2024-11-22 03:20:21 +01:00
d8f14a58e6
feat(plugins): Move from zplug to antidote, add 6 plugins
Plugins added:
  - zsh-users/zsh-history-substring-search # ZSH port of Fish history search (up arrow)
  - belak/zsh-utils completion # Load and initialize the built-in zsh completion system
  - belak/zsh-utils editor # Override and fill in the gaps of the default keybinds
  - belak/zsh-utils utility kind:defer # Common shell utilities
  - ohmyzsh/ohmyzsh plugins/colored-man-pages # This plugin adds colors to man pages

Plugins readded:
  - ohmyzsh/ohmyzsh plugins/dirhistory
2024-11-22 01:51:11 +01:00
1638c8ff98
feat: Enable autocd 2024-11-21 23:28:51 +01:00
2b58a19281
feat: Add dirHashes
https://nix-community.github.io/home-manager/options.xhtml#opt-programs.zsh.dirHashes
2024-11-21 23:26:45 +01:00
9297d41e33
chore(zsh): Config cleanup 2024-11-21 23:23:40 +01:00
439c7b02c5
fix(aliases): Set global aliases using shellGlobalAliases 2024-11-21 23:05:13 +01:00
2 changed files with 115 additions and 100 deletions

6
flake.lock generated

@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1731319897,
"narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=",
"lastModified": 1732014248,
"narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "dc460ec76cbff0e66e269457d7b728432263166c",
"rev": "23e89b7da85c3640bbc2173fe04f4bd114342367",
"type": "github"
},
"original": {

209
zsh.nix

@ -3,39 +3,7 @@
pkgs,
...
}: {
home.packages = with pkgs; [
nix-zsh-completions
# tools for aliases, etc.
lsd
bat
eza
trash-cli
# ^ tools for aliases, etc.
# packages for enhancd
fzf # enhancd
fd # enhancd
# ^ packages for enhancd
# rofi # for fd
# packags for ex
gnutar
bzip3
unzip
p7zip
unrar
gzip
# ^ packages for ex
];
programs = {
# nix-index = {
# enable = true;
# enableZshIntegration = true;
# };
# thefuck = {
# enable = true;
# enableZshIntegration = true;
@ -48,83 +16,95 @@
zsh = {
enable = true;
enableVteIntegration = true;
enableCompletion = true;
zplug = {
completionInit = ''
'';
autosuggestion = {
enable = true;
strategy = [
"match_prev_cmd"
"completion"
"history"
];
};
autocd = true; # I'll try this out, may be removed later
dirHashes = {
dl = "$HOME/Downloads";
prj = "$HOME/Projects/";
};
antidote = {
enable = true;
plugins = [
{
name = "romkatv/powerlevel10k";
tags = ["as:theme" "depth:1"];
} # Installations with additional options. For the list of options, please refer to Zplug README.
{name = "z-shell/F-Sy-H";} # Feature-rich Syntax Highlighting for Zsh
"getantidote/use-omz" # Handle OMZ dependencies
# Load lib only if things break
# "ohmyzsh/ohmyzsh path:lib" # Load OMZ's library
"ohmyzsh/ohmyzsh path:plugins/colored-man-pages" # Load OMZ plugins
# "ohmyzsh/ohmyzsh path:plugins/magic-enter"
"ohmyzsh/ohmyzsh path:plugins/command-not-found" # Provide suggested packages to be installed if a command cannot be found
"ohmyzsh/ohmyzsh path:plugins/dirhistory kind:defer" # shortcuts for navigating directory history and hierarchy
"romkatv/powerlevel10k kind:fpath" # A Zsh theme
"z-shell/F-Sy-H kind:defer" # Feature-rich Syntax Highlighting for Zsh
"zsh-users/zsh-autosuggestions kind:defer" # Simple plugin installation
# { name = "zsh-users/zsh-syntax-highlighting"; }
{name = "zsh-users/zsh-completions";} # Adds some missing completions to zsh
{name = "zsh-users/zsh-autosuggestions";} # Simple plugin installation
{name = "MichaelAquilina/zsh-you-should-use";} # Did you forget to use an alias?
{name = "jiriks74/git-aliases";} # Aliases for git
{
name = "babarot/enhancd";
tags = ["use:init.sh"];
} # Includes simmilar functionality to zsh-z
{name = "supercrabtree/k";} # Directory listings for Zsh with git features.
{
name = "plugins/command-not-found";
tags = ["from:oh-my-zsh"];
}
{
name = "gko/ssh-connect";
tags = ["use:ssh-connect.sh"];
} # List of most used ssh connections
{name = "agkozak/zsh-z";} # Jump arount your filesystem with ease
{name = "sineto/web-search";}
{name = "zsh-users/zaw";} # Desctiptions for command outputs (afaik)zplug "plugins/git", from:oh-my-zsh
# { name = "plugins/dirhistory"; tags = [ "from:oh-my-zsh" ]; }
"zsh-users/zsh-completions kind:fpath path:src" # Adds some missing completions to zsh
"zsh-users/zsh-history-substring-search kind:defer" # ZSH port of Fish history search (up arrow)
"jiriks74/git-aliases kind:defer" # Aliases for git
"MichaelAquilina/zsh-you-should-use" # Did you forget to use an alias?
"babarot/enhancd" # Includes simmilar functionality to zsh-z
"agkozak/zsh-z" # Jump arount your filesystem with ease
"supercrabtree/k" # Directory listings for Zsh with git features.
"belak/zsh-utils path:completion" # Load and initialize the built-in zsh completion system
"belak/zsh-utils path:editor" # Override and fill in the gaps of the default keybinds
"belak/zsh-utils path:utility kind:defer" # Common shell utilities
"gko/ssh-connect" # List of most used ssh connections
"sineto/web-search kind:defer" # zsh plugin for web searching
"zsh-users/zaw" # Desctiptions for command outputs (afaik)zplug "plugins/git", from:oh-my-zsh
];
};
initExtraFirst = ''
# Basic auto/tab complete:
ZSH_COMPDUMP="$ZSH_CACHE/.zcompdump-''${SHORT_HOST}-''${ZSH_VERSION}"
autoload -U compinit -d ''${ZSH_COMPDUMP}
zstyle ':completion:*' menu select
zmodload zsh/complist
_comp_options+=(globdots) # Include hidden files.
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zmodload zsh/zprof # Profiling. Enable `zprof` at the end of initExtra too.
else
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
fi
'';
initExtra = ''
# From antidote (for p10k):
# prompts:
# with prompt plugins, remember to add this to your .zshrc:
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
autoload -Uz promptinit && promptinit && prompt powerlevel10k
# Remove nix from path if we are in a container (distrobox)
if [ -v DISTROBOX_ENTER_PATH ]; then
export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':')
export PATH=$(echo $PATH | sed 's/:$//')
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
export YSU_MESSAGE_POSITION="after" # you-should-use plugin
export ASCIINEMA_API_URL=https://asciinema.stefka.eu
if [ -v ASCIINEMA_REC ]; then
_zsh_autosuggest_disable
fi
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
# Custom ZSH Binds
bindkey '^ ' autosuggest-accept
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[3~" delete-char
bindkey '^ ' autosuggest-accept # Bind CTRL + Space
# Extracting
ex ()
@ -160,23 +140,16 @@
alias kclip="kitty +kitten clipboard"
fi
# Special aliases that may not work with Nix config
# Command line head / tail shortcuts
alias H="| head";
alias T="| tail";
alias G="| grep";
alias L="| less";
alias M="| most";
alias LL="2>&1 | less";
alias CA="2>&1 | cat -A";
alias NE="2> /dev/null";
alias NUL="> /dev/null 2>&1";
alias P="2>&1| pygmentize -l pytb";
if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
zprof
fi
'';
localVariables = {
YSU_MESSAGE_POSITION="after";
ASCIINEMA_API_URL="https://asciinema.stefka.eu";
};
shellAliases = {
# update = "sudo nixos-rebuild switch";
@ -219,6 +192,19 @@
sshc = "ssh-connect";
};
shellGlobalAliases = {
H="| head";
T="| tail";
G="| grep";
L="| less";
M="| most";
LL="2>&1 | less";
CA="2>&1 | cat -A";
NE="2> /dev/null";
NUL="> /dev/null 2>&1";
P="2>&1| pygmentize -l pytb";
};
history = {
# ignoreAllDups = true;
path = "${config.xdg.cacheHome}/zhistory";
@ -228,4 +214,33 @@
};
};
};
home.packages = with pkgs; [
nix-zsh-completions
python312Packages.pygments # For antidote
# tools for aliases, etc.
lsd
bat
eza
trash-cli
# ^ tools for aliases, etc.
# packages for enhancd
fzf # enhancd
fd # enhancd
# ^ packages for enhancd
# rofi # for fd
# packags for ex
gnutar
bzip3
unzip
p7zip
unrar
gzip
# ^ packages for ex
];
}