-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_bashrc
46 lines (37 loc) · 1.08 KB
/
dot_bashrc
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
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
export PATH="$HOME/bin:$PATH"
export EDITOR="nvim"
# Find in history with arrows by part of command
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# Find with fzf in commands history
__fzf_history_search() {
local selected_command
selected_command=$(history | fzf --tac --no-sort +s --tiebreak=index --height 50% --reverse --query="$READLINE_LINE")
if [ -n "$selected_command" ]; then
READLINE_LINE=$(echo "$selected_command" | sed 's/^[ ]*[0-9]*[ ]*//')
READLINE_POINT=${#READLINE_LINE}
fi
}
# Call Ctrl+R for fzf history find
bind -x '"\C-r": __fzf_history_search'
bind -x '"\C-f": tmux-sessionizer'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias cz='chezmoi'
alias lg='lazygit'
PS1='[\u@\h \W]\$ '
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}
eval "$(starship init bash)"
neofetch