mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
feat(shell): Use one keymaps for shell
This commit is contained in:
parent
68ff1bb357
commit
2346c13564
19 changed files with 530 additions and 265 deletions
|
|
@ -23,14 +23,16 @@ set -gx EDITOR nvim
|
|||
set -gx VISUAL nvim
|
||||
|
||||
# Minimal PATH for early commands
|
||||
set -gx PATH /usr/local/bin /usr/bin /bin /usr/sbin /sbin ~/.local/bin $PATH
|
||||
|
||||
if test -d /opt/homebrew/bin # macOS
|
||||
set -gx PATH /opt/homebrew/bin $PATH
|
||||
else if test -d /home/linuxbrew/.linuxbrew/bin # Linux
|
||||
set -gx PATH /home/linuxbrew/.linuxbrew/bin $PATH
|
||||
for dir in /usr/local/bin /usr/bin /bin /usr/sbin /sbin "$HOME/.local/bin"
|
||||
if test -d "$dir" -a ! -L "$dir"
|
||||
fish_add_path "$dir"
|
||||
end
|
||||
end
|
||||
|
||||
# Homebrew/Linuxbrew
|
||||
test -d /opt/homebrew/bin && fish_add_path /opt/homebrew/bin
|
||||
test -d /home/linuxbrew/.linuxbrew/bin && fish_add_path /home/linuxbrew/.linuxbrew/bin
|
||||
|
||||
if command -v brew > /dev/null
|
||||
set -gx HOMEBREW_NO_ENV_HINTS
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,12 +21,10 @@ alias sn="sudo nvim -u ~/.config/nvim/init.lua"
|
|||
# Dev #
|
||||
abbr --add py python3
|
||||
abbr --add ipy ipython
|
||||
abbr --add reload "source $__fish_config_dir/config.fish"
|
||||
abbr --add pulldots "cd $DOTFILES && git pull"
|
||||
|
||||
# lsd - modern ls
|
||||
if command -v lsd > /dev/null
|
||||
alias ls='lsd -A -I .DS_Store -I .git -I .gitkeep'
|
||||
alias ls='lsd -A'
|
||||
abbr --add l 'lsd -lah'
|
||||
abbr --add ll 'lsd -l'
|
||||
abbr --add tree 'ls --tree'
|
||||
|
|
@ -48,14 +46,9 @@ end
|
|||
function tv
|
||||
touch $argv[1] && nvim $argv[1]
|
||||
end
|
||||
function zls
|
||||
z $argv[1] && ls
|
||||
end
|
||||
|
||||
# Use neovide as gVim
|
||||
if command -v neovide > /dev/null
|
||||
abbr --add gvi "neovide"
|
||||
end
|
||||
abbr --add gvi "neovide"
|
||||
|
||||
if command -v brew > /dev/null
|
||||
abbr --add brewi "brew install"
|
||||
|
|
@ -69,11 +62,28 @@ if command -v pacman > /dev/null
|
|||
abbr --add paci "sudo pacman -S"
|
||||
abbr --add pacr "sudo pacman -R"
|
||||
abbr --add pacu "sudo pacman -Syu"
|
||||
abbr --add pacs "sudo pacman -Ss"
|
||||
if command -v paru > /dev/null
|
||||
abbr --add pacs "paru -Ss"
|
||||
elif command -v yay > /dev/null
|
||||
abbr --add pacs "yay -Ss"
|
||||
else
|
||||
abbr --add pacs "pacman -Ss"
|
||||
end
|
||||
end
|
||||
|
||||
if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty"
|
||||
abbr --add icat "kitten icat"
|
||||
else if test "$TERM_PROGRAM" = "WezTerm"
|
||||
abbr --add icat "wezterm imgcat"
|
||||
if test "$WSL_DISTRO_NAME"
|
||||
abbr --add icat "wezterm.exe imgcat"
|
||||
else
|
||||
abbr --add icat "wezterm imgcat"
|
||||
end
|
||||
end
|
||||
|
||||
# Bash Style Command Substitution
|
||||
# https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$)
|
||||
|
||||
function __last_history_item; echo $history[1]; end
|
||||
|
||||
abbr -a !! --position anywhere --function __last_history_item
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
# read key: `fish_key_reader`
|
||||
# get current bindings: `bind`
|
||||
|
||||
fish_vi_key_bindings
|
||||
|
||||
# Colemak hnei
|
||||
|
|
@ -17,12 +20,52 @@ fish_vi_key_bindings
|
|||
# n
|
||||
# v
|
||||
# bind -M default 'h' backward-char
|
||||
bind -M default 'n' down-or-search
|
||||
bind -M default 'e' up-or-search
|
||||
bind -M default 'i' forward-char
|
||||
bind -M default n down-or-search
|
||||
bind -M default e up-or-search
|
||||
bind -M default i forward-char
|
||||
|
||||
# Similar position to [i] in QWERTY
|
||||
bind -M default -m insert l repaint-mode
|
||||
bind -M default -m insert L beginning-of-line repaint-mode
|
||||
|
||||
# Ne{[k]s}t -> fish doesnt have this feature
|
||||
|
||||
# [J]ump
|
||||
bind -M default j forward-word
|
||||
bind -M default J forward-bigword
|
||||
|
||||
# Use N to Join
|
||||
bind -M default N end-of-line delete-char
|
||||
|
||||
# Emacs Hybrid
|
||||
bind -M default \cp up-or-search
|
||||
bind -M default \cn down-or-search
|
||||
bind -M default \cf forward-char
|
||||
bind -M default \cb backward-char
|
||||
bind -M default \ca beginning-of-line
|
||||
bind -M default \ce end-of-line
|
||||
bind -M default \ck kill-line
|
||||
|
||||
bind -M insert \cp up-or-search
|
||||
bind -M insert \cn down-or-search
|
||||
bind -M insert \cf forward-char
|
||||
bind -M insert \cb backward-char
|
||||
bind -M insert \ca beginning-of-line
|
||||
bind -M insert \ce end-of-line
|
||||
bind -M insert \ck kill-line
|
||||
bind -M insert \cw backward-kill-path-component
|
||||
|
||||
|
||||
# ctrl + backspace
|
||||
bind -M insert \b backward-kill-path-component
|
||||
# alt + backspace
|
||||
bind -M insert \e\x7F backward-kill-line
|
||||
# ctrl + delete
|
||||
bind -M insert \e\[3\;5~ kill-word
|
||||
# alt + delete (d$)
|
||||
bind -M insert \e\[3\;3~ kill-line
|
||||
|
||||
fzf --fish | source
|
||||
# C-r : fzf history search
|
||||
# C-t : fzf file search
|
||||
# A-c : fzf directory search
|
||||
|
|
|
|||
|
|
@ -8,14 +8,27 @@
|
|||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias ......="cd ../../../../.."
|
||||
|
||||
abbr --add \- 'cd -'
|
||||
|
||||
if command -v zoxide > /dev/null
|
||||
zoxide init fish | source
|
||||
alias ..="z .."
|
||||
alias ...="z ../.."
|
||||
alias ....="z ../../.."
|
||||
alias .....="z ../../../.."
|
||||
alias ......="z ../../../../.."
|
||||
|
||||
abbr --add \- 'z -'
|
||||
|
||||
|
||||
function zls
|
||||
z $argv[1] && ls
|
||||
end
|
||||
else
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias ......="cd ../../../../.."
|
||||
|
||||
abbr --add \- 'cd -'
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue