detached 52072ec

fix(shell): improve fzf integration and add bash completion colors

commit
52072ecb23521bba40fe394fca1bae95146920f4
author
bnema · · 2025-10-28 18:25 UTC
parent
c45daf9
signature
GPG Unverified2B82207D370127A0 The key is unknown
3 files · +13 -2
M install/configs/shell/aliases +1 -1
@@ -10,7 +10,7 @@ fi
1010
1111 # Bat + FZF integration
1212 if command -v bat &> /dev/null && command -v fzf &> /dev/null; then
13- alias ff="fzf --preview 'bat --style=numbers --color=always {}'"
13+ alias ff="fzf --preview '[[ -f {} ]] && bat --style=numbers --color=always {} || echo \"{}\"'"
1414 fi
1515
1616 # Bat aliases
@@ -10,7 +10,7 @@ fi
10 10
11 # Bat + FZF integration11 # Bat + FZF integration
12 if command -v bat &> /dev/null && command -v fzf &> /dev/null; then12 if command -v bat &> /dev/null && command -v fzf &> /dev/null; then
13- alias ff="fzf --preview 'bat --style=numbers --color=always {}'"13+ alias ff="fzf --preview '[[ -f {} ]] && bat --style=numbers --color=always {} || echo \"{}\"'"
14 fi14 fi
15 15
16 # Bat aliases16 # Bat aliases
M install/configs/shell/envs +6 -1
@@ -5,5 +5,10 @@ fi
55
66 # FZF default options
77 if command -v fzf &> /dev/null && command -v bat &> /dev/null; then
8- export FZF_DEFAULT_OPTS="--preview 'bat --color=always --style=numbers --line-range=:500 {}' --preview-window right:60%:wrap"
8+ export FZF_DEFAULT_OPTS="--preview '[[ -f {} ]] && bat --color=always --style=numbers --line-range=:500 {} || echo \"{}\"' --preview-window right:60%:wrap"
9+fi
10+
11+# Initialize dircolors for bash-completion and ls colors
12+if command -v dircolors &> /dev/null; then
13+ eval "$(dircolors -b)"
914 fi
@@ -5,5 +5,10 @@ fi
5 5
6 # FZF default options6 # FZF default options
7 if command -v fzf &> /dev/null && command -v bat &> /dev/null; then7 if command -v fzf &> /dev/null && command -v bat &> /dev/null; then
8- export FZF_DEFAULT_OPTS="--preview 'bat --color=always --style=numbers --line-range=:500 {}' --preview-window right:60%:wrap"8+ export FZF_DEFAULT_OPTS="--preview '[[ -f {} ]] && bat --color=always --style=numbers --line-range=:500 {} || echo \"{}\"' --preview-window right:60%:wrap"
9+fi
10+
11+# Initialize dircolors for bash-completion and ls colors
12+if command -v dircolors &> /dev/null; then
13+ eval "$(dircolors -b)"
9 fi14 fi
M install/configs/shell/shell +6 -0
@@ -8,6 +8,12 @@ HISTFILESIZE="${HISTSIZE}"
88 [[ $PS1 && ! ${BASH_COMPLETION_VERSINFO:-} && -f /usr/share/bash-completion/bash_completion ]] && \
99 . /usr/share/bash-completion/bash_completion
1010
11+# Enable colored completion output
12+if [[ -n "$LS_COLORS" ]]; then
13+ bind 'set colored-completion-prefix on'
14+ bind 'set colored-stats on'
15+fi
16+
1117 # Set complete path
1218 export PATH="$HOME/.local/bin:$PATH"
1319 set +h
@@ -8,6 +8,12 @@ HISTFILESIZE="${HISTSIZE}"
8 [[ $PS1 && ! ${BASH_COMPLETION_VERSINFO:-} && -f /usr/share/bash-completion/bash_completion ]] && \8 [[ $PS1 && ! ${BASH_COMPLETION_VERSINFO:-} && -f /usr/share/bash-completion/bash_completion ]] && \
9 . /usr/share/bash-completion/bash_completion9 . /usr/share/bash-completion/bash_completion
10 10
11+# Enable colored completion output
12+if [[ -n "$LS_COLORS" ]]; then
13+ bind 'set colored-completion-prefix on'
14+ bind 'set colored-stats on'
15+fi
16+
11 # Set complete path17 # Set complete path
12 export PATH="$HOME/.local/bin:$PATH"18 export PATH="$HOME/.local/bin:$PATH"
13 set +h19 set +h

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close