feat(bash): add bash, remove zsh
This commit is contained in:
parent
60f4b6e808
commit
b373fbaaab
7 changed files with 127 additions and 108 deletions
39
config/bash/bashrc
Normal file
39
config/bash/bashrc
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
for _hm in "/etc/profiles/per-user/$(id -un)" "$HOME/.nix-profile"; do
|
||||||
|
[ -f "$_hm/etc/profile.d/hm-session-vars.sh" ] && . "$_hm/etc/profile.d/hm-session-vars.sh" && break
|
||||||
|
done
|
||||||
|
unset _hm
|
||||||
|
|
||||||
|
shopt -s autocd histappend
|
||||||
|
|
||||||
|
HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/bash_history"
|
||||||
|
HISTSIZE=2000
|
||||||
|
HISTFILESIZE=2000
|
||||||
|
HISTCONTROL=ignoreboth:erasedups
|
||||||
|
|
||||||
|
alias ls='eza'
|
||||||
|
alias l='ls --color=auto --group-directories-first'
|
||||||
|
alias ll='l -alF'
|
||||||
|
alias la='ll -R'
|
||||||
|
alias g='git'
|
||||||
|
alias nv='nvim'
|
||||||
|
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
export THEME="${THEME:-midnight}"
|
||||||
|
export FZF_COMPLETION_TRIGGER=';'
|
||||||
|
export FZF_TMUX=1
|
||||||
|
|
||||||
|
eval "$(fzf --bash)"
|
||||||
|
eval "$(zoxide init bash)"
|
||||||
|
eval "$(direnv hook bash)"
|
||||||
|
eval "$(starship init bash)"
|
||||||
|
|
||||||
|
fzf-config-widget() {
|
||||||
|
local file
|
||||||
|
file="$(FZF_CTRL_T_COMMAND="fd --type file --hidden . \"$XDG_CONFIG_HOME\"/nix | sed \"s|$HOME|~|g\"" fzf --reverse)" || return
|
||||||
|
file="${file/#\~/$HOME}"
|
||||||
|
READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}${file}${READLINE_LINE:$READLINE_POINT}"
|
||||||
|
READLINE_POINT=$(( READLINE_POINT + ${#file} ))
|
||||||
|
}
|
||||||
|
bind -x '"\C-e": fzf-config-widget'
|
||||||
|
|
||||||
|
[ -r "$OPAMROOT/opam-init/init.sh" ] && . "$OPAMROOT/opam-init/init.sh" > /dev/null 2> /dev/null
|
||||||
24
config/bash/inputrc
Normal file
24
config/bash/inputrc
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
set editing-mode vi
|
||||||
|
set show-mode-in-prompt on
|
||||||
|
set vi-cmd-mode-string "\1\e[2 q\2"
|
||||||
|
set vi-ins-mode-string "\1\e[6 q\2"
|
||||||
|
|
||||||
|
set completion-ignore-case on
|
||||||
|
set colored-stats on
|
||||||
|
set show-all-if-ambiguous on
|
||||||
|
|
||||||
|
$if mode=vi
|
||||||
|
set keymap vi-command
|
||||||
|
"\C-p": previous-history
|
||||||
|
"\C-n": next-history
|
||||||
|
"\C-j": backward-char
|
||||||
|
"\C-k": forward-char
|
||||||
|
"\e[3~": delete-char
|
||||||
|
|
||||||
|
set keymap vi-insert
|
||||||
|
"\C-p": previous-history
|
||||||
|
"\C-n": next-history
|
||||||
|
"\C-j": backward-char
|
||||||
|
"\C-k": forward-char
|
||||||
|
"\e[3~": delete-char
|
||||||
|
$endif
|
||||||
|
|
@ -37,6 +37,7 @@ return {
|
||||||
args = { '-i', '2' },
|
args = { '-i', '2' },
|
||||||
stdin = true,
|
stdin = true,
|
||||||
})
|
})
|
||||||
|
ft('sh,bash'):lint('shellcheck')
|
||||||
ft('zsh'):lint('zsh')
|
ft('zsh'):lint('zsh')
|
||||||
|
|
||||||
ft('proto'):fmt('buf'):lint('buf')
|
ft('proto'):fmt('buf'):lint('buf')
|
||||||
|
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
autoload -U compinit && compinit -d "$XDG_STATE_HOME/zcompdump" -u
|
|
||||||
zmodload zsh/complist
|
|
||||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
|
||||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-za-z}'
|
|
||||||
|
|
||||||
export GPG_TTY=$(tty)
|
|
||||||
export THEME="${THEME:-midnight}"
|
|
||||||
|
|
||||||
setopt auto_cd
|
|
||||||
unsetopt beep notify
|
|
||||||
unset completealiases
|
|
||||||
|
|
||||||
bindkey -v
|
|
||||||
bindkey '^[[3~' delete-char
|
|
||||||
bindkey '^P' up-line-or-history
|
|
||||||
bindkey '^N' down-line-or-history
|
|
||||||
bindkey '^J' backward-char
|
|
||||||
bindkey '^K' forward-char
|
|
||||||
|
|
||||||
export PURE_PROMPT_SYMBOL=">"
|
|
||||||
export PURE_PROMPT_VICMD_SYMBOL="<"
|
|
||||||
export PURE_GIT_UP_ARROW="^"
|
|
||||||
export PURE_GIT_DOWN_ARROW="v"
|
|
||||||
export PURE_GIT_STASH_SYMBOL="="
|
|
||||||
export PURE_CMD_MAX_EXEC_TIME=5
|
|
||||||
export PURE_GIT_PULL=0
|
|
||||||
export PURE_GIT_UNTRACKED_DIRTY=1
|
|
||||||
zstyle ':prompt:pure:git:stash' show yes
|
|
||||||
|
|
||||||
autoload -Uz promptinit && promptinit
|
|
||||||
prompt pure
|
|
||||||
|
|
||||||
autoload -Uz add-zle-hook-widget
|
|
||||||
function _cursor_shape() {
|
|
||||||
case $KEYMAP in
|
|
||||||
vicmd) echo -ne '\e[2 q' ;;
|
|
||||||
viins|main) echo -ne '\e[6 q' ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
function _cursor_init() { echo -ne '\e[6 q'; }
|
|
||||||
add-zle-hook-widget zle-keymap-select _cursor_shape
|
|
||||||
add-zle-hook-widget zle-line-init _cursor_init
|
|
||||||
|
|
||||||
export FZF_COMPLETION_TRIGGER=\;
|
|
||||||
export FZF_TMUX=1
|
|
||||||
|
|
||||||
fzf-config-widget() {
|
|
||||||
local file="$(FZF_CTRL_T_COMMAND="fd --type file --hidden . \"$XDG_CONFIG_HOME\"/nix | sed \"s|$HOME|~|g\"" __fzf_select)"
|
|
||||||
[ -n "$file" ] || { zle reset-prompt; return; }
|
|
||||||
file="${file/#\\~/~}"
|
|
||||||
LBUFFER+="$file"
|
|
||||||
zle reset-prompt
|
|
||||||
}
|
|
||||||
zle -N fzf-config-widget
|
|
||||||
bindkey '^E' fzf-config-widget
|
|
||||||
|
|
||||||
[[ ! -r "$OPAMROOT/opam-init/init.zsh" ]] || source "$OPAMROOT/opam-init/init.zsh" > /dev/null 2> /dev/null
|
|
||||||
|
|
@ -38,6 +38,7 @@ in
|
||||||
hadolint
|
hadolint
|
||||||
mypy
|
mypy
|
||||||
selene
|
selene
|
||||||
|
shellcheck
|
||||||
|
|
||||||
# runtime/tools
|
# runtime/tools
|
||||||
nodejs
|
nodejs
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ in
|
||||||
with pkgs;
|
with pkgs;
|
||||||
[
|
[
|
||||||
awscli2
|
awscli2
|
||||||
pure-prompt
|
|
||||||
tree
|
tree
|
||||||
jq
|
jq
|
||||||
curl
|
curl
|
||||||
|
|
@ -193,58 +192,62 @@ in
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.zsh = {
|
programs.bash = lib.mkIf (!hostConfig.isNixOS) {
|
||||||
enable = true;
|
enable = true;
|
||||||
dotDir = "${config.xdg.configHome}/zsh";
|
initExtra = ''
|
||||||
completionInit = "";
|
source "${pkgs.blesh}/share/blesh/ble.sh" --noattach
|
||||||
|
export INPUTRC="$HOME/.config/nix/config/bash/inputrc"
|
||||||
profileExtra = lib.mkIf hostConfig.isLinux ''
|
export THEME="''${THEME:-midnight}"
|
||||||
[ "$(tty)" = "/dev/tty1" ] && [ -z "$WAYLAND_DISPLAY" ] && start-hyprland
|
[ -f "$HOME/.config/nix/config/bash/bashrc" ] && . "$HOME/.config/nix/config/bash/bashrc"
|
||||||
'';
|
[[ ''${BLE_VERSION-} ]] && ble-attach
|
||||||
|
|
||||||
history = {
|
|
||||||
path = "${config.xdg.stateHome}/zsh_history";
|
|
||||||
size = 2000;
|
|
||||||
save = 2000;
|
|
||||||
ignoreDups = true;
|
|
||||||
ignoreAllDups = true;
|
|
||||||
ignoreSpace = true;
|
|
||||||
extended = true;
|
|
||||||
append = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
shellAliases = {
|
|
||||||
ls = "eza";
|
|
||||||
l = "ls --color=auto --group-directories-first";
|
|
||||||
ll = "l -alF";
|
|
||||||
la = "ll -R";
|
|
||||||
g = "git";
|
|
||||||
nv = "nvim";
|
|
||||||
};
|
|
||||||
|
|
||||||
syntaxHighlighting.enable = true;
|
|
||||||
|
|
||||||
autosuggestion = {
|
|
||||||
enable = true;
|
|
||||||
strategy = [
|
|
||||||
"history"
|
|
||||||
"completion"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
initContent = ''
|
|
||||||
fpath+=("${pkgs.pure-prompt}/share/zsh/site-functions")
|
|
||||||
source "$XDG_CONFIG_HOME/nix/config/zsh/zshrc"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
home.activation.removeZshenvBridge = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
programs.starship = {
|
||||||
[ -L "$HOME/.zshenv" ] && rm "$HOME/.zshenv" || true
|
enable = true;
|
||||||
|
enableBashIntegration = false;
|
||||||
|
settings = {
|
||||||
|
format = lib.concatStrings [
|
||||||
|
"$directory"
|
||||||
|
"$git_branch"
|
||||||
|
"$git_status"
|
||||||
|
"$cmd_duration"
|
||||||
|
"$line_break"
|
||||||
|
"$character"
|
||||||
|
];
|
||||||
|
add_newline = true;
|
||||||
|
character = {
|
||||||
|
success_symbol = "[>](bold)";
|
||||||
|
error_symbol = "[>](bold red)";
|
||||||
|
vimcmd_symbol = "[<](bold)";
|
||||||
|
};
|
||||||
|
directory = {
|
||||||
|
truncation_length = 0;
|
||||||
|
truncate_to_repo = false;
|
||||||
|
};
|
||||||
|
git_branch.format = "[$branch]($style) ";
|
||||||
|
git_status = {
|
||||||
|
format = "([$all_status$ahead_behind]($style) )";
|
||||||
|
ahead = "^";
|
||||||
|
behind = "v";
|
||||||
|
stashed = "=";
|
||||||
|
};
|
||||||
|
cmd_duration = {
|
||||||
|
min_time = 5000;
|
||||||
|
format = "[$duration]($style) ";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home.activation.removeZshFiles = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
for f in "$HOME/.zshenv" "$HOME/.zshenv.bak"; do
|
||||||
|
[ -e "$f" ] && rm "$f" || true
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.fzf = {
|
programs.fzf = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableZshIntegration = true;
|
enableBashIntegration = false;
|
||||||
defaultCommand = "rg --files --hidden";
|
defaultCommand = "rg --files --hidden";
|
||||||
defaultOptions = [
|
defaultOptions = [
|
||||||
"--bind=ctrl-a:select-all"
|
"--bind=ctrl-a:select-all"
|
||||||
|
|
@ -260,18 +263,18 @@ in
|
||||||
|
|
||||||
programs.eza = {
|
programs.eza = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableZshIntegration = false;
|
enableBashIntegration = false;
|
||||||
git = true;
|
git = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.zoxide = {
|
programs.zoxide = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableZshIntegration = true;
|
enableBashIntegration = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.direnv = {
|
programs.direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableZshIntegration = true;
|
enableBashIntegration = false;
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
config.global = {
|
config.global = {
|
||||||
hide_env_diff = true;
|
hide_env_diff = true;
|
||||||
|
|
|
||||||
|
|
@ -82,15 +82,23 @@ in
|
||||||
"storage"
|
"storage"
|
||||||
"power"
|
"power"
|
||||||
];
|
];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.bash;
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.zsh = {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
shellInit = ''
|
shellInit = ''
|
||||||
export ZDOTDIR="$HOME/.config/zsh"
|
export INPUTRC="$HOME/.config/nix/config/bash/inputrc"
|
||||||
export THEME="midnight"
|
export THEME="midnight"
|
||||||
'';
|
'';
|
||||||
|
interactiveShellInit = ''
|
||||||
|
source "${pkgs.blesh}/share/blesh/ble.sh" --noattach
|
||||||
|
[ -f "$HOME/.config/nix/config/bash/bashrc" ] && . "$HOME/.config/nix/config/bash/bashrc"
|
||||||
|
[[ ''${BLE_VERSION-} ]] && ble-attach
|
||||||
|
'';
|
||||||
|
loginShellInit = ''
|
||||||
|
[ "$(tty)" = "/dev/tty1" ] && [ -z "$WAYLAND_DISPLAY" ] && start-hyprland
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
programs.hyprland = {
|
programs.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue