mirror of
https://github.com/mitchell/dotfiles.git
synced 2026-07-17 08:09:35 +00:00
zsh
This commit is contained in:
parent
8a9b0b3a28
commit
2713e108aa
7 changed files with 113 additions and 4 deletions
|
|
@ -17,6 +17,7 @@ return {
|
|||
"regex",
|
||||
"bash",
|
||||
"fish",
|
||||
"zsh",
|
||||
"typescript",
|
||||
"javascript",
|
||||
"tsx",
|
||||
|
|
|
|||
5
.zshenv
Normal file
5
.zshenv
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
PATH="$HOME/.bun/bin:$PATH"
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
PATH="$HOME/code/scripts:$PATH"
|
||||
export PATH
|
||||
export EDITOR='nvim'
|
||||
99
.zshrc
Normal file
99
.zshrc
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
# --- History ---
|
||||
HISTFILE=~/.histfile
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=2000
|
||||
|
||||
# --- Options ---
|
||||
setopt autocd
|
||||
setopt sharehistory
|
||||
setopt histignoredups
|
||||
setopt histignorealldups
|
||||
setopt histsavenodups
|
||||
bindkey -v
|
||||
|
||||
# --- Completion ---
|
||||
zstyle :compinstall filename '/home/m/.zshrc'
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
# --- Aliases ---
|
||||
alias ls='lsd'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -lA'
|
||||
alias o='opencode run --thinking'
|
||||
alias oc='opencode'
|
||||
alias sctl='sudo systemctl'
|
||||
alias uctl='systemctl --user'
|
||||
|
||||
# --- Keybinds ---
|
||||
bindkey '.,' open-nvim
|
||||
bindkey ',l' clear-screen
|
||||
bindkey ',r' fzf-history-widget
|
||||
bindkey ',f' fzf-file-widget
|
||||
bindkey ',c' fzf-cd-widget
|
||||
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
|
||||
# --- Functions ---
|
||||
function open-nvim { nvim; }
|
||||
zle -N open-nvim open-nvim
|
||||
|
||||
function m {
|
||||
local tmp cwd
|
||||
tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
|
||||
command yazi "$@" --cwd-file="$tmp"
|
||||
IFS= read -r -d '' cwd <"$tmp"
|
||||
[ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd"
|
||||
rm -f -- "$tmp"
|
||||
}
|
||||
|
||||
# --- Prompt Configuration ---
|
||||
prompt_char='>'
|
||||
|
||||
function set_prompt {
|
||||
local branch
|
||||
branch="$(git branch --show-current 2>/dev/null)"
|
||||
|
||||
if [[ "$PWD" == "$HOME" ]]; then
|
||||
PROMPT="%F{magenta}%~%f $prompt_char "
|
||||
elif [[ "$branch" != '' ]]; then
|
||||
PROMPT="%F{magenta}%~%f ($branch)
|
||||
$prompt_char "
|
||||
else
|
||||
PROMPT="%F{magenta}%~%f
|
||||
$prompt_char "
|
||||
fi
|
||||
}
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook precmd set_prompt
|
||||
|
||||
function set_prompt_char {
|
||||
local old
|
||||
old=$prompt_char
|
||||
|
||||
if [[ $KEYMAP == vicmd && $REGION_ACTIVE != 0 ]]; then
|
||||
prompt_char='v'
|
||||
elif [[ $KEYMAP == vicmd ]]; then
|
||||
prompt_char='<'
|
||||
else
|
||||
prompt_char='>'
|
||||
fi
|
||||
|
||||
if [[ $prompt_char != "$old" ]]; then
|
||||
set_prompt
|
||||
zle reset-prompt
|
||||
fi
|
||||
}
|
||||
autoload -Uz add-zle-hook-widget
|
||||
add-zle-hook-widget line-pre-redraw set_prompt_char
|
||||
|
||||
# --- External Tools & Plugins ---
|
||||
eval "$(zoxide init zsh)"
|
||||
eval "$(fzf --zsh)"
|
||||
|
||||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
|
|
@ -158,7 +158,7 @@ function create_admin_user -a username pass
|
|||
set -f username m
|
||||
end
|
||||
log "Creating user $username and adding to wheel group"
|
||||
useradd -m -G wheel -s /usr/bin/fish $username
|
||||
useradd -m -G wheel -s /usr/bin/zsh $username
|
||||
echo $pass | passwd -s $username
|
||||
passwd -l root
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@ set -l arch_pkgs \
|
|||
yazi \
|
||||
ttf-nerd-fonts-symbols \
|
||||
ttf-nerd-fonts-symbols-common \
|
||||
ttf-nerd-fonts-symbols-mono
|
||||
ttf-nerd-fonts-symbols-mono \
|
||||
zsh-autosuggestions \
|
||||
zsh-history-substring-search \
|
||||
zsh-syntax-highlighting
|
||||
|
||||
set -l debian_pkgs \
|
||||
$base_pkgs \
|
||||
|
|
|
|||
2
pacstrap
2
pacstrap
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env fish
|
||||
pacstrap -K /mnt base linux git fish amd-ucode btrfs-progs ghostty-terminfo $argv
|
||||
pacstrap -K /mnt base linux git fish zsh amd-ucode btrfs-progs ghostty-terminfo $argv
|
||||
and genfstab -U /mnt >>/mnt/etc/fstab
|
||||
and cp -r /root/dotfiles /mnt/
|
||||
and arch-chroot /mnt
|
||||
|
|
|
|||
3
sync
3
sync
|
|
@ -61,7 +61,8 @@ function sync_terminal_env
|
|||
mkdir -p ~/code/scripts
|
||||
end
|
||||
|
||||
rsync -aP ./.config/fish ~/.config/
|
||||
rsync -aP ./.zshrc ~/
|
||||
and rsync -aP ./.zshenv ~/
|
||||
and rsync -aP ./.config/nvim ~/.config/
|
||||
and rsync -aP ./.tmux-line.conf ~/
|
||||
and rsync -aP ./.tmux.conf ~/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue