aboutsummaryrefslogtreecommitdiff
path: root/home-manager/zsh/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/zsh/default.nix')
-rw-r--r--home-manager/zsh/default.nix127
1 files changed, 8 insertions, 119 deletions
diff --git a/home-manager/zsh/default.nix b/home-manager/zsh/default.nix
index d713873..400d11e 100644
--- a/home-manager/zsh/default.nix
+++ b/home-manager/zsh/default.nix
@@ -1,125 +1,14 @@
-{ config, pkgs, lib, ... }: let
- nixosScript = ''
- nixos() {
- case $1 in
- update | up)
- if [ "$#" -gt 1 ]; then
- echo "Error: 'nixos update' takes no additional arguments."
- return 1
- fi
- nh os switch $HOME/.nix --ask
- ;;
- upgrade)
- if [ "$#" -gt 1 ]; then
- echo "Error: 'nixos upgrade' takes no additional arguments."
- return 1
- fi
- nh os switch $HOME/.nix -u --ask
- ;;
- clean)
- nh clean all --verbose
- ;;
- config)
- hx ~/.nix/"$2"
- ;;
- *)
- echo "Usage: nixos update | up || nixos upgrade || nixos config <path>"
- ;;
- esac
- }
-
- nix() {
- if [[ $1 == "develop" ]]; then
- shift
- local flake
- case $1 in
- python)
- flake="$HOME/.nix#python"
- shift
- ;;
- nim)
- flake="$HOME/.nix#nim"
- shift
- ;;
- js)
- flake="$HOME/.nix#js"
- shift
- ;;
- *)
- flake="$1"
- shift
- ;;
- esac
- command nix develop "$flake" -c zsh
- else
- command nix "$@"
- fi
- }
-
- _nixos_autocomplete() {
- _arguments \
- '1: :->subcmd' \
- '2: :->files'
-
- case $state in
- subcmd)
- local -a commands
- commands=("update" "config")
- _describe 'command' commands
- ;;
- files)
- # Check if the subcommand is config.
- if [[ $words[2] == "config" ]]; then
- _files -W "$HOME/.nix" -g '*'
- fi
- ;;
- esac
- }
-
- compdef _nixos_autocomplete nixos
- '';
-in {
- programs.zsh = {
- enable = true;
-
- autosuggestion.enable = true;
- enableCompletion = true;
- syntaxHighlighting.enable = true;
-
- shellAliases = {
- ls = "eza --icons=always --color=always";
- ll = "eza -a --long --icons=always --color=always --no-time";
- lt = "eza -a --long --tree --icons=always --color=always --no-time";
-
- cat = "bat";
- mk = "(){ mkdir -p $1 && cd $1 }";
-
- grep = "grep --color=auto";
-
- mv = "mv -i";
- cp = "cp -i";
- rm = "rm -i";
-
- fetch = "fastfetch -c examples/7";
-
- nix-shell = "nix-shell --run $SHELL";
- };
-
- initContent = ''
- ${nixosScript};
- eval "$(atuin init zsh)"
- eval "$(starship init zsh)"
- '';
- };
-
+{
programs = {
- starship = {
+ zsh = {
enable = true;
- };
- atuin = {
- enable = true;
- enableZshIntegration = true;
+ initExtra = ''
+ if [[ $(ps -o command= -p "$PPID" | awk '{print $1}') != 'fish' ]]
+ then
+ exec fish -l
+ fi
+ '';
};
};
}
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.