feat: minor refactor
parent
c3bed0a62b
commit
0f3b552573
|
@ -1,120 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let xdg-state-home = "${config.home.homeDirectory}/.local/state";
|
||||
in {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
settings = {
|
||||
right_format = "$directory";
|
||||
add_newline = false;
|
||||
character = {
|
||||
success_symbol = "[❯](white)";
|
||||
error_symbol = "[✖](red)";
|
||||
vicmd_symbol = "[❮](white)";
|
||||
};
|
||||
directory = {
|
||||
disabled = false;
|
||||
style = "cyan";
|
||||
truncation_symbol = "…/";
|
||||
read_only = "";
|
||||
};
|
||||
aws = { disabled = true; };
|
||||
line_break = { disabled = true; };
|
||||
};
|
||||
};
|
||||
programs.exa = {
|
||||
enable = true;
|
||||
# enableAliases = true;
|
||||
};
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
enableCompletion = true;
|
||||
completionInit = ''
|
||||
autoload compinit && compinit
|
||||
autoload bashcompinit && bashcompinit
|
||||
'';
|
||||
initExtraBeforeCompInit = ''
|
||||
zstyle ':completion:*' matcher-list ''' \
|
||||
'm:{a-z\-}={A-Z\_}' \
|
||||
'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
|
||||
'r:[[:ascii:]]||[[:ascii:]]=** r:|=* m:{a-z\-}={A-Z\_}'
|
||||
zstyle ':completion:*:functions' ignored-patterns '_*'
|
||||
zstyle ':completion:*' format $'\n%F{green}%d%f'
|
||||
zstyle ':completion:*' group-name '''
|
||||
setopt COMPLETE_ALIASES
|
||||
zstyle ':completion:*' menu select
|
||||
'';
|
||||
enableSyntaxHighlighting = true;
|
||||
autocd = true;
|
||||
defaultKeymap = "viins";
|
||||
history = {
|
||||
expireDuplicatesFirst = true;
|
||||
extended = true;
|
||||
ignoreDups = true;
|
||||
ignoreSpace = true;
|
||||
share = false;
|
||||
path = "${xdg-state-home}/zsh/history";
|
||||
};
|
||||
shellAliases = {
|
||||
testpl = ''echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"'';
|
||||
ls = "exa --icons";
|
||||
"..." = "../..";
|
||||
"...." = "../../..";
|
||||
"....." = "../../../..";
|
||||
"......" = "../../../../..";
|
||||
pyenv-init =
|
||||
''eval "$(pyenv init -)" && eval "$(pyenv virtualenv-init -)"'';
|
||||
nix-direnv-init = "nix flake new -t github:nix-community/nix-direnv .";
|
||||
};
|
||||
localVariables = { KEYTIMEOUT = 1; };
|
||||
initExtra = ''
|
||||
autoload -U history-search-end
|
||||
zle -N history-beginning-search-backward-end history-search-end
|
||||
zle -N history-beginning-search-forward-end history-search-end
|
||||
bindkey "^[[A" history-beginning-search-backward-end
|
||||
bindkey "^[[B" history-beginning-search-forward-end
|
||||
# setopt PROMPT_CR
|
||||
# setopt PROMPT_SP
|
||||
# export PROMPT_EOL_MARK=""
|
||||
unsetopt PROMPT_SP
|
||||
|
||||
precmd() {
|
||||
precmd() {
|
||||
echo
|
||||
}
|
||||
}
|
||||
|
||||
VENV_DIR="${config.home.homeDirectory}/.virtualenvs"
|
||||
export WORKON_HOME="''${VENV_DIR}"
|
||||
function activate-venv() {
|
||||
local selected_env
|
||||
selected_env=$(
|
||||
${pkgs.findutils}/bin/find \
|
||||
"''${VENV_DIR}" \
|
||||
-maxdepth 1 \
|
||||
-mindepth 1 \
|
||||
-type d \
|
||||
-exec basename {} \; | \
|
||||
${pkgs.fzf}/bin/fzf
|
||||
)
|
||||
[ -n "$selected_env" ] && \
|
||||
source "''${VENV_DIR}/''${selected_env}/bin/activate"
|
||||
}
|
||||
|
||||
lf () {
|
||||
tmp=$(mktemp)
|
||||
lf-wrapper -last-dir-path="$tmp" "$@"
|
||||
if [ -f "$tmp" ]; then
|
||||
dir=$(cat "$tmp")
|
||||
rm -f "$tmp"
|
||||
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
|
||||
fi
|
||||
}
|
||||
|
||||
export LANG=en_US.utf8
|
||||
export LC_ALL=en_US.UTF-8
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,10 +1,127 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./common.nix ];
|
||||
programs.starship.settings = {
|
||||
gcloud = { disabled = true; };
|
||||
python = { disabled = true; };
|
||||
let xdg-state-home = "${config.home.homeDirectory}/.local/state";
|
||||
in {
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
settings = {
|
||||
right_format = "$directory";
|
||||
add_newline = false;
|
||||
character = {
|
||||
success_symbol = "[❯](white)";
|
||||
error_symbol = "[✖](red)";
|
||||
vicmd_symbol = "[❮](white)";
|
||||
};
|
||||
directory = {
|
||||
disabled = false;
|
||||
style = "cyan";
|
||||
truncation_symbol = "…/";
|
||||
read_only = "";
|
||||
};
|
||||
aws = { disabled = true; };
|
||||
line_break = { disabled = true; };
|
||||
gcloud = { disabled = true; };
|
||||
python = { disabled = true; };
|
||||
};
|
||||
};
|
||||
|
||||
programs.exa = {
|
||||
enable = true;
|
||||
# enableAliases = true;
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
enableCompletion = true;
|
||||
completionInit = ''
|
||||
autoload compinit && compinit
|
||||
autoload bashcompinit && bashcompinit
|
||||
'';
|
||||
initExtraBeforeCompInit = ''
|
||||
zstyle ':completion:*' matcher-list ''' \
|
||||
'm:{a-z\-}={A-Z\_}' \
|
||||
'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
|
||||
'r:[[:ascii:]]||[[:ascii:]]=** r:|=* m:{a-z\-}={A-Z\_}'
|
||||
zstyle ':completion:*:functions' ignored-patterns '_*'
|
||||
zstyle ':completion:*' format $'\n%F{green}%d%f'
|
||||
zstyle ':completion:*' group-name '''
|
||||
setopt COMPLETE_ALIASES
|
||||
zstyle ':completion:*' menu select
|
||||
'';
|
||||
enableSyntaxHighlighting = true;
|
||||
autocd = true;
|
||||
defaultKeymap = "viins";
|
||||
history = {
|
||||
expireDuplicatesFirst = true;
|
||||
extended = true;
|
||||
ignoreDups = true;
|
||||
ignoreSpace = true;
|
||||
share = false;
|
||||
path = "${xdg-state-home}/zsh/history";
|
||||
};
|
||||
shellAliases = {
|
||||
testpl = ''echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"'';
|
||||
ls = "exa --icons";
|
||||
"..." = "../..";
|
||||
"...." = "../../..";
|
||||
"....." = "../../../..";
|
||||
"......" = "../../../../..";
|
||||
pyenv-init =
|
||||
''eval "$(pyenv init -)" && eval "$(pyenv virtualenv-init -)"'';
|
||||
nix-direnv-init = "nix flake new -t github:nix-community/nix-direnv .";
|
||||
};
|
||||
localVariables = { KEYTIMEOUT = 1; };
|
||||
enableVteIntegration = true;
|
||||
initExtra = ''
|
||||
autoload -U history-search-end
|
||||
zle -N history-beginning-search-backward-end history-search-end
|
||||
zle -N history-beginning-search-forward-end history-search-end
|
||||
bindkey "^[[A" history-beginning-search-backward-end
|
||||
bindkey "^[[B" history-beginning-search-forward-end
|
||||
# setopt PROMPT_CR
|
||||
# setopt PROMPT_SP
|
||||
# export PROMPT_EOL_MARK=""
|
||||
unsetopt PROMPT_SP
|
||||
|
||||
precmd() {
|
||||
precmd() {
|
||||
echo
|
||||
}
|
||||
}
|
||||
|
||||
VENV_DIR="${config.home.homeDirectory}/.virtualenvs"
|
||||
export WORKON_HOME="''${VENV_DIR}"
|
||||
function activate-venv() {
|
||||
local selected_env
|
||||
selected_env=$(
|
||||
${pkgs.findutils}/bin/find \
|
||||
"''${VENV_DIR}" \
|
||||
-maxdepth 1 \
|
||||
-mindepth 1 \
|
||||
-type d \
|
||||
-exec basename {} \; | \
|
||||
${pkgs.fzf}/bin/fzf
|
||||
)
|
||||
[ -n "$selected_env" ] && \
|
||||
source "''${VENV_DIR}/''${selected_env}/bin/activate"
|
||||
}
|
||||
|
||||
lf () {
|
||||
tmp=$(mktemp)
|
||||
lf-wrapper -last-dir-path="$tmp" "$@"
|
||||
if [ -f "$tmp" ]; then
|
||||
dir=$(cat "$tmp")
|
||||
rm -f "$tmp"
|
||||
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
|
||||
fi
|
||||
}
|
||||
|
||||
export LANG=en_US.utf8
|
||||
export LC_ALL=en_US.UTF-8
|
||||
'';
|
||||
};
|
||||
programs.zsh.enableVteIntegration = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue