Skip to content

Commit df526cd

Browse files
committed
feat:add_zsh
1 parent 8dcbddc commit df526cd

8 files changed

Lines changed: 93 additions & 885 deletions

File tree

dotfiles/.config/nushell/config.nu

Lines changed: 0 additions & 821 deletions
This file was deleted.

dotfiles/.config/nushell/env.nu

Lines changed: 0 additions & 57 deletions
This file was deleted.

home/cli/eza.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{pkgs, ...}: {
2+
home.packages = with pkgs; [
3+
eza
4+
];
5+
}

home/cli/fzf.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
_: {
22
programs.fzf = {
33
enable = true;
4+
enableZshIntegration = true;
45
};
56
}

home/cli/nushell.nix

Lines changed: 0 additions & 5 deletions
This file was deleted.

home/cli/zsh.nix

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{ config, pkgs, ... }:
2+
3+
{
4+
programs.zsh = {
5+
enable = true;
6+
enableCompletion = true;
7+
syntaxHighlighting.enable = true;
8+
9+
dotDir = "${config.xdg.configHome}/zsh";
10+
11+
plugins = [
12+
{
13+
name = "zsh-autosuggestions";
14+
src = pkgs.zsh-autosuggestions;
15+
}
16+
{
17+
name = "zsh-syntax-highlighting";
18+
src = pkgs.zsh-syntax-highlighting;
19+
}
20+
{
21+
name = "fzf-tab";
22+
src = pkgs.zsh-fzf-tab;
23+
}
24+
];
25+
26+
initContent = ''
27+
export LANG=zh_CN.UTF-8
28+
export EDITOR=nano
29+
30+
# === History ===
31+
HISTFILE=$XDG_STATE_HOME/zsh/history
32+
HISTSIZE=10000
33+
SAVEHIST=10000
34+
setopt HIST_IGNORE_DUPS HIST_IGNORE_SPACE SHARE_HISTORY INC_APPEND_HISTORY
35+
36+
# === Tools ===
37+
if command -v atuin >/dev/null 2>&1; then
38+
eval "$(atuin init zsh)"
39+
fi
40+
if command -v zoxide >/dev/null 2>&1; then
41+
eval "$(zoxide init zsh)"
42+
fi
43+
if command -v starship >/dev/null 2>&1; then
44+
eval "$(starship init zsh)"
45+
fi
46+
47+
# === Colors and Aliases ===
48+
autoload -U colors && colors
49+
alias ls='eza --icons=auto --group-directories-first'
50+
alias ll='eza -lh --icons=auto --group-directories-first'
51+
alias la='eza -lha --icons=auto --group-directories-first'
52+
53+
alias grep='grep --color=auto'
54+
alias fgrep='fgrep --color=auto'
55+
alias egrep='egrep --color=auto'
56+
alias ..='cd ..'
57+
alias ...='cd ../..'
58+
59+
# === Completion ===
60+
autoload -Uz compinit
61+
mkdir -p ~/.cache/zsh
62+
compinit -d ~/.cache/zsh/zcompdump
63+
setopt CORRECT
64+
65+
# === Load plugins manually ===
66+
if [[ -o interactive ]]; then
67+
source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh
68+
source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
69+
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
70+
71+
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
72+
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
73+
74+
bindkey -e
75+
bindkey "$(tput kcuf1)" autosuggest-accept
76+
fi
77+
78+
# === Prompt ===
79+
if ! command -v starship >/dev/null 2>&1; then
80+
PROMPT='%F{green}%n@%m%f:%F{blue}%~%f %# '
81+
RPROMPT='%F{yellow}[%D{%H:%M}]%f'
82+
fi
83+
'';
84+
};
85+
}

hosts/dos/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
homeMode = "755";
2727
ignoreShellProgramCheck = true;
2828
isNormalUser = true;
29-
shell = pkgs.nushell;
29+
shell = pkgs.zsh;
3030
};
3131
};
3232
}

hosts/example/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
homeMode = "755";
2727
ignoreShellProgramCheck = true;
2828
isNormalUser = true;
29-
shell = pkgs.nushell;
29+
shell = pkgs.zsh;
3030
};
3131
};
3232
}

0 commit comments

Comments
 (0)