119 lines
3.3 KiB
Nix
119 lines
3.3 KiB
Nix
|
{
|
||
|
config,
|
||
|
pkgs,
|
||
|
self,
|
||
|
lib,
|
||
|
...
|
||
|
}: let
|
||
|
psCfg = config.pub-solar;
|
||
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
||
|
in {
|
||
|
enable = true;
|
||
|
enableAutosuggestions = true;
|
||
|
enableCompletion = true;
|
||
|
dotDir = ".config/zsh";
|
||
|
|
||
|
history = {
|
||
|
ignoreDups = true;
|
||
|
expireDuplicatesFirst = true;
|
||
|
ignoreSpace = true;
|
||
|
path = "$HOME/.local/share/zsh/zsh_history";
|
||
|
save = 10000;
|
||
|
size = 10000;
|
||
|
};
|
||
|
|
||
|
loginExtra = lib.mkIf psCfg.sway.enable ''
|
||
|
[ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.sway-service}/bin/sway-service
|
||
|
'';
|
||
|
|
||
|
shellAliases = {
|
||
|
nano = "nvim";
|
||
|
vi = "nvim";
|
||
|
vim = "nvim";
|
||
|
mutt = "neomutt";
|
||
|
ls = "exa";
|
||
|
la = "exa --group-directories-first -lag";
|
||
|
fm = "vifm .";
|
||
|
vifm = "vifm .";
|
||
|
wget = "wget --hsts-file=$XDG_CACHE_HOME/wget-hsts";
|
||
|
irssi = "irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_DATA_HOME/irssi";
|
||
|
drone = "DRONE_TOKEN=$(secret-tool lookup drone token) drone";
|
||
|
no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix";
|
||
|
# fix nixos-option
|
||
|
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
|
||
|
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
|
||
|
};
|
||
|
plugins = [
|
||
|
# src gets fetched by nvfetcher, see: ./pkgs/sources.toml
|
||
|
{
|
||
|
# will source ohmyzsh/plugins/z/
|
||
|
name = "zsh-plugins-z";
|
||
|
file = "plugins/z/z.plugin.zsh";
|
||
|
src = pkgs.sources.ohmyzsh.src;
|
||
|
}
|
||
|
{
|
||
|
name = "zsh-powerlevel10k";
|
||
|
file = "powerlevel10k.zsh-theme";
|
||
|
src = pkgs.sources.powerlevel10k.src;
|
||
|
}
|
||
|
{
|
||
|
name = "zsh-fast-syntax-highlighting";
|
||
|
file = "F-Sy-H.plugin.zsh";
|
||
|
src = pkgs.sources.F-Sy-H.src;
|
||
|
}
|
||
|
{
|
||
|
name = "zsh-nix-shell";
|
||
|
file = "nix-shell.plugin.zsh";
|
||
|
src = pkgs.sources.zsh-nix-shell.src;
|
||
|
}
|
||
|
];
|
||
|
|
||
|
initExtra =
|
||
|
''
|
||
|
bindkey -v
|
||
|
bindkey -v 'jj' vi-cmd-mode
|
||
|
bindkey -a 'i' up-line
|
||
|
bindkey -a 'k' down-line
|
||
|
bindkey -a 'j' backward-char
|
||
|
bindkey -a 'h' vi-insert
|
||
|
bindkey '^[[H' beginning-of-line
|
||
|
bindkey '^[[F' end-of-line
|
||
|
bindkey '^R' history-incremental-pattern-search-backward
|
||
|
bindkey '^ ' autosuggest-accept
|
||
|
bindkey '^q' push-line-or-edit
|
||
|
|
||
|
bindkey '^R' fzf-history-widget
|
||
|
|
||
|
# ArrowUp/Down start searching history with current input
|
||
|
autoload -U up-line-or-beginning-search
|
||
|
autoload -U down-line-or-beginning-search
|
||
|
zle -N up-line-or-beginning-search
|
||
|
zle -N down-line-or-beginning-search
|
||
|
bindkey "^[[A" up-line-or-beginning-search
|
||
|
bindkey "^[[B" down-line-or-beginning-search
|
||
|
bindkey "^P" up-line-or-beginning-search
|
||
|
bindkey "^N" down-line-or-beginning-search
|
||
|
|
||
|
# MAKE CTRL+S WORK IN VIM
|
||
|
stty -ixon
|
||
|
stty erase '^?'
|
||
|
|
||
|
precmd () {
|
||
|
DIR_NAME=$(pwd | sed "s|^$HOME|~|g")
|
||
|
echo -e -n "\e]2;$DIR_NAME\e\\"
|
||
|
}
|
||
|
|
||
|
# If a command is not found, show me where it is
|
||
|
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
|
||
|
''
|
||
|
+ builtins.readFile ./base16.zsh
|
||
|
+ builtins.readFile ./p10k.zsh
|
||
|
+ ''
|
||
|
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
|
||
|
source ${pkgs.fzf}/share/fzf/completion.zsh
|
||
|
source ${pkgs.git-bug}/share/zsh/site-functions/git-bug
|
||
|
eval "$(direnv hook zsh)"
|
||
|
''
|
||
|
+ builtins.readFile ./fzf.zsh;
|
||
|
}
|