Files
archlinux-config/home/.config/fish/config.fish
T

91 lines
2.2 KiB
Fish

fish_add_path "$HOME/go/bin" "$HOME/.bun/bin"
set -gx EDITOR nvim
set -gx VISUAL nvim
set -gx PAGER less
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
set -g fish_greeting
function __prepend_sudo
set -l buffer (commandline)
if test -z "$buffer"
commandline -f up-line
set buffer (commandline)
end
if test -n "$buffer"
if not string match -qr '^sudo\b' -- "$buffer"
commandline -r "sudo $buffer"
end
commandline -f end-of-line repaint
end
end
bind escape,escape __prepend_sudo # Fish 4.0+ 语法:双击 Escape 添加 sudo
bind ctrl-space accept-autosuggestion # Fish 4.0+ 语法
set -gx FZF_DEFAULT_OPTS '--height=50% --layout=reverse --border --preview-window=right:60%'
set -gx FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git'
set -gx FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND"
set -gx FZF_ALT_C_COMMAND 'fd --type d --hidden --follow --exclude .git'
alias ..='cd ..'
alias ...='cd ../..'
function ls
command eza --icons --group-directories-first --git $argv
end
function l
command eza -la --icons --group-directories-first --git $argv
end
function ll
command eza -l --icons --group-directories-first --git $argv
end
function la
command eza -lA --icons --group-directories-first --git $argv
end
function lt
command eza --tree --level=2 --icons --group-directories-first --git $argv
end
alias cat='bat --paging=never'
alias rm='gomi'
alias lg='lazygit'
alias vi='nvim'
alias x='ouch decompress'
if set -q WSL_DISTRO_NAME
alias pbcopy='clip.exe'
alias pbpaste='powershell.exe -noprofile -c Get-Clipboard'
function keep_current_path --on-event fish_prompt
printf '\e]9;9;%s\e\\' (wslpath -w "$PWD")
end
end
if status is-interactive
zoxide init fish --cmd cd | source
mise activate fish | source
set -g direnv_fish_mode eval_after_arrow
direnv hook fish | source
fzf --fish | source
set -gx ATUIN_NOBIND true
atuin init fish | source
bind \cr _atuin_search
bind up _atuin_bind_up
starship init fish | source
end
if test -f ~/.config/fish/config.local.fish
source ~/.config/fish/config.local.fish
end