It was a nice experiment but carapace and fzf-tab simply do not work together currently. The main issue is double-backlashes whenever a file with spaces it selected. This is a _huge_ issue since it simply does not allow completing _any_ file with spaces and is extremely tedious. Issue tracked here: https://github.com/carapace-sh/carapace-bin/issues/2667 https://github.com/Aloxaf/fzf-tab/issues/503 There are smaller issues like `cd folder/` completion adding a space after the word so you cannot complete further 'into' the directory, and some other small problems. All of that only even works with a 'empty query string' hack to get the two working together in the first place: https://github.com/carapace-sh/carapace-bin/issues/2819#issuecomment-3092307945%3E Ultimately it just seems not worth it to me.
62 lines
1.3 KiB
Bash
62 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# ~/.bashrc
|
|
#
|
|
# shellcheck disable=SC1090
|
|
|
|
CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}"
|
|
|
|
# If not running interactively, don't do anything
|
|
[[ $- != *i* ]] && return
|
|
|
|
[ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias"
|
|
# load additional aliases
|
|
if [ -d "$CONFDIR/sh/alias.d" ]; then
|
|
for _alias in "$CONFDIR/sh/alias.d"/*.sh; do
|
|
. "$_alias"
|
|
done
|
|
unset _alias
|
|
fi
|
|
if [ -d "$CONFDIR/bash/alias.d" ]; then
|
|
for _alias in "$CONFDIR/bash/alias.d"/*.sh; do
|
|
. "$_alias"
|
|
done
|
|
unset _alias
|
|
fi
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
eval "$(starship init bash)"
|
|
eval "$(zoxide init bash)"
|
|
|
|
set -o vi
|
|
stty time 0
|
|
bind 'set keyseq-timeout 1'
|
|
|
|
# insert files with c-t or T in vicmd mode
|
|
FZF_CTRL_R_COMMAND="" FZF_ALT_C_COMMAND="" eval "$(fzf --bash)"
|
|
builtin bind -m vi-command '"T": "\C-z\C-t\C-z"'
|
|
|
|
_run-cdi() {
|
|
# Get the directory from zoxide query
|
|
local dir=$(zoxide query -i)
|
|
|
|
# If no directory is found, clear the line
|
|
if [[ -z "$dir" ]]; then
|
|
echo ''
|
|
return
|
|
fi
|
|
|
|
# Call cd with the directory
|
|
cd -- "$dir"
|
|
|
|
# Return the exit status of cd
|
|
return $?
|
|
}
|
|
# Make the function _run-cdi available
|
|
# shellcheck disable=SC2016
|
|
bind -x '"\ec": "`_run-cdi`"'
|
|
# shellcheck disable=SC2016
|
|
bind -m vi-command -x '"C": "`_run-cdi`"'
|
|
|
|
eval "$(atuin init bash)"
|