Varius
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
set -gx ATUIN_SESSION (atuin uuid)
|
||||
set --erase ATUIN_HISTORY_ID
|
||||
|
||||
function _atuin_preexec --on-event fish_preexec
|
||||
if not test -n "$fish_private_mode"
|
||||
set -g ATUIN_HISTORY_ID (atuin history start -- "$argv[1]")
|
||||
end
|
||||
end
|
||||
|
||||
function _atuin_postexec --on-event fish_postexec
|
||||
set -l s $status
|
||||
|
||||
if test -n "$ATUIN_HISTORY_ID"
|
||||
ATUIN_LOG=error atuin history end --exit $s -- $ATUIN_HISTORY_ID &>/dev/null &
|
||||
disown
|
||||
end
|
||||
|
||||
set --erase ATUIN_HISTORY_ID
|
||||
end
|
||||
|
||||
function _atuin_search
|
||||
set -l keymap_mode
|
||||
switch $fish_key_bindings
|
||||
case fish_vi_key_bindings
|
||||
switch $fish_bind_mode
|
||||
case default
|
||||
set keymap_mode vim-normal
|
||||
case insert
|
||||
set keymap_mode vim-insert
|
||||
end
|
||||
case '*'
|
||||
set keymap_mode emacs
|
||||
end
|
||||
|
||||
# In fish 3.4 and above we can use `"$(some command)"` to keep multiple lines separate;
|
||||
# but to support fish 3.3 we need to use `(some command | string collect)`.
|
||||
# https://fishshell.com/docs/current/relnotes.html#id24 (fish 3.4 "Notable improvements and fixes")
|
||||
set -l ATUIN_H (ATUIN_SHELL=fish ATUIN_LOG=error ATUIN_QUERY=(commandline -b) atuin search --keymap-mode=$keymap_mode $argv -i 3>&1 1>&2 2>&3 | string collect)
|
||||
|
||||
if test -n "$ATUIN_H"
|
||||
if string match --quiet '__atuin_accept__:*' "$ATUIN_H"
|
||||
set -l ATUIN_HIST (string replace "__atuin_accept__:" "" -- "$ATUIN_H" | string collect)
|
||||
commandline -r "$ATUIN_HIST"
|
||||
commandline -f repaint
|
||||
commandline -f execute
|
||||
return
|
||||
else
|
||||
commandline -r "$ATUIN_H"
|
||||
end
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function _atuin_bind_up
|
||||
# Fallback to fish's builtin up-or-search if we're in search or paging mode
|
||||
if commandline --search-mode; or commandline --paging-mode
|
||||
up-or-search
|
||||
return
|
||||
end
|
||||
|
||||
# Only invoke atuin if we're on the top line of the command
|
||||
set -l lineno (commandline --line)
|
||||
|
||||
switch $lineno
|
||||
case 1
|
||||
_atuin_search --shell-up-key-binding
|
||||
case '*'
|
||||
up-or-search
|
||||
end
|
||||
end
|
||||
|
||||
if string match -q '4.*' $version
|
||||
bind ctrl-r _atuin_search
|
||||
bind up _atuin_bind_up
|
||||
if bind -M insert >/dev/null 2>&1
|
||||
bind -M insert ctrl-r _atuin_search
|
||||
bind -M insert up _atuin_bind_up
|
||||
end
|
||||
else
|
||||
bind \cr _atuin_search
|
||||
bind -k up _atuin_bind_up; bind \eOA _atuin_bind_up; bind \e\[A _atuin_bind_up
|
||||
if bind -M insert >/dev/null 2>&1
|
||||
bind -M insert \cr _atuin_search
|
||||
bind -M insert -k up _atuin_bind_up; bind -M insert \eOA _atuin_bind_up; bind -M insert \e\[A _atuin_bind_up
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
# This file was created by fish when upgrading to version 4.3, to migrate
|
||||
# the 'fish_key_bindings' variable from its old default scope (universal)
|
||||
# to its new default scope (global). We recommend you delete this file
|
||||
# and configure key bindings in ~/.config/fish/config.fish if needed.
|
||||
|
||||
set --global fish_key_bindings fish_vi_key_bindings
|
||||
|
||||
# Prior to version 4.3, fish shipped an event handler that runs
|
||||
# `set --universal fish_key_bindings fish_default_key_bindings`
|
||||
# whenever the fish_key_bindings variable is erased.
|
||||
# This means that as long as any fish < 4.3 is still running on this system,
|
||||
# we cannot complete the migration.
|
||||
# As a workaround, erase the universal variable at every shell startup.
|
||||
set --erase --universal fish_key_bindings
|
||||
@@ -0,0 +1 @@
|
||||
eval "$(fnm env)"
|
||||
+6
-3
@@ -3,14 +3,17 @@ abbr -a -- opc opencode
|
||||
abbr -a -- opcc opencode -c
|
||||
abbr -a -- cl clear
|
||||
abbr -a -- g git
|
||||
abbr -a -- l ezals
|
||||
abbr -a -- ll 'ezals -TL2'
|
||||
abbr -a -- l lls
|
||||
abbr -a -- ls lls
|
||||
abbr -a -- ll 'lls -TL2'
|
||||
abbr -a -- q exit
|
||||
abbr -a -- v nvim
|
||||
abbr -a -- vs nvim --server /tmp/nvim-server.sock
|
||||
abbr -a -- vo nvim --server /tmp/nvim-server.sock --remote-tab
|
||||
abbr -a -- kc kubectl
|
||||
abbr -a -- kc kubectl --context
|
||||
abbr -a -- kcc kubectl ctx
|
||||
abbr -a -- zj zellij
|
||||
abbr -a -- sysc systemctl
|
||||
abbr -a -- syscu systemctl --user
|
||||
abbr -a -- diswn disown \(jobs -p\)
|
||||
abbr -a -- rg rg --hyperlink-format kitty
|
||||
|
||||
+15
-6
@@ -1,7 +1,16 @@
|
||||
set -Ux PYENV_ROOT $HOME/.pyenv
|
||||
set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths
|
||||
while set pyenv_index (contains -i -- "/home/df/.pyenv/shims" $PATH)
|
||||
set -eg PATH[$pyenv_index]; end; set -e pyenv_index
|
||||
set -gx PATH '/home/df/.pyenv/shims' $PATH
|
||||
set -gx PYENV_SHELL fish
|
||||
command pyenv rehash
|
||||
function pyenv
|
||||
set command $argv[1]
|
||||
set -e argv[1]
|
||||
|
||||
# Load pyenv automatically by appending
|
||||
# the following to ~/.config/fish/config.fish:
|
||||
|
||||
# Restart your shell for the changes to take effect.
|
||||
switch "$command"
|
||||
case rehash shell
|
||||
source (pyenv "sh-$command" $argv|psub)
|
||||
case "*"
|
||||
command pyenv "$command" $argv
|
||||
end
|
||||
end
|
||||
|
||||
+11
-5
@@ -11,7 +11,11 @@ end
|
||||
# A copy of fish's internal cd function. This makes it possible to use
|
||||
# `alias cd=z` without causing an infinite loop.
|
||||
if ! builtin functions --query __zoxide_cd_internal
|
||||
string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' <$__fish_data_dir/functions/cd.fish | source
|
||||
if status list-files functions/cd.fish &>/dev/null
|
||||
status get-file functions/cd.fish | string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' | source
|
||||
else
|
||||
string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' <$__fish_data_dir/functions/cd.fish | source
|
||||
end
|
||||
end
|
||||
|
||||
# cd + custom logic based on the value of _ZO_ECHO.
|
||||
@@ -86,11 +90,13 @@ end
|
||||
# Commands for zoxide. Disable these using --no-cmd.
|
||||
#
|
||||
|
||||
abbr --erase z &>/dev/null
|
||||
alias z=__zoxide_z
|
||||
abbr --erase cd &>/dev/null
|
||||
complete --erase --command cd
|
||||
alias cd=__zoxide_z
|
||||
|
||||
abbr --erase zi &>/dev/null
|
||||
alias zi=__zoxide_zi
|
||||
abbr --erase cdi &>/dev/null
|
||||
complete --erase --command cdi
|
||||
alias cdi=__zoxide_zi
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user