-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zsh-example
67 lines (56 loc) · 2.18 KB
/
.zsh-example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Settings for zsh which apply to interactive sessions only.
# Load the default .profile, shared with other shells.
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile"
# Alias definitions
[[ -s "$HOME/.aliases" ]] && source "$HOME/.aliases"
# fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPTS="
--ansi
--color light
--height 50% --layout=reverse --margin 1,1
--bind 'ctrl-j:jump-accept'
--color header:italic
--header 'CTRL-J: quickly accept a selection'
"
export FZF_DEFAULT_COMMAND="bfs -color -not -name '.' -exclude \\( -name .git -or -name .hg \\) -printf '%P\n' 2>/dev/null"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="bfs -color -not -name '.' -nohidden -type d -printf '%P\n' 2>/dev/null"
# Preview file content using bat (https://github.com/sharkdp/bat)
export FZF_CTRL_T_OPTS="
--preview 'bat -n --color=always {}'
--bind 'ctrl-/:change-preview-window(down|hidden|)'"
# CTRL-/ to toggle small preview window to see the full command
# CTRL-Y to copy the command into clipboard using pbcopy
export FZF_CTRL_R_OPTS="
--preview 'echo {}' --preview-window up:3:hidden:wrap
--bind 'ctrl-/:toggle-preview'
--bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'
--color header:italic
--header 'CTRL-Y: copy command into clipboard'"
# Print tree structure in the preview window
export FZF_ALT_C_OPTS="
--height 80%
--preview='tree -C {} | head -n 50'
--preview-window=border-double,bottom"
_fzf_compgen_path() {
bfs -H "$1" -color -exclude \( -depth +0 -hidden \) 2>/dev/null
}
_fzf_compgen_dir() {
bfs -H "$1" -color -exclude \( -depth +0 -hidden \) -type d 2>/dev/null
}
# compnav
# REQUIRED:
export COMPNAV_DIR="$HOME/bin/compnav"
export COMPNAV_H_REPOS_DIR="$HOME/Repos"
# OPTIONAL:
#
# Show a nice preview of the directory structure.
# Uses eval to resolve ~.
export COMPNAV_FZF_OPTS="
--height 80%
--preview='eval tree -C {} | head -n 50'
--preview-window=border-double,bottom"
# Always accept the first match (just an example, personally I don't recommend it).
# export COMPNAV_FZF_Z_OPTS="--select-1 --exit-0 --sync --bind 'start:accept'"
[ -f "$COMPNAV_DIR/compnav.sh" ] && source "$COMPNAV_DIR/compnav.sh"