-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot-bashrc
More file actions
123 lines (96 loc) · 3.51 KB
/
dot-bashrc
File metadata and controls
123 lines (96 loc) · 3.51 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#
# ~/.bashrc
#
#export GTK_IM_MODULE='fcitx'
#export QT_IM_MODULE='fcitx'
#export SDL_IM_MODULE='fcitx'
#export XMODIFIERS='@im=fcitx'
#export GLFW_IM_MODULE=ibus
export TERM='kitty'
export TERMINAL='kitty'
export EDITOR='nvim'
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Change default git config directory
alias git="GIT_CONFIG_GLOBAL=~/.config/git/.gitconfig git"
# Change CGDB config directory
alias cgdb="CGDB_DIR=~/.config/cgdb cgdb"
# Use C99 by default
alias gcc="gcc -std=c99 -pedantic"
# safer copy and move with rsync
alias mv-r="rsync -r -h --no-i-r --info=progress2 --info=name0 --remove-source-files"
alias cp-r="rsync -r -h --no-i-r --info=progress2 --info=name0"
alias update-files="rsync -rhu --no-i-r --info=progress2"
alias update-files-v="rsync -rhu --no-i-r --info=progress2 --info=NAME"
alias ff="fastfetch"
alias info="info --vi-keys"
alias icat="kitty +kitten icat"
alias notes="nvim ~/Documents/Notes/"
alias ip="ip --color=auto"
alias sl="echo 'correcting to ls' && ls"
alias ls="eza --icons --color=auto --group-directories-first -a"
alias ll='eza --icons --group-directories-first -la' # show long listing of all except ".."
# Allow any key start software flow control
stty ixany
# Increase size of .bash_history
export HISTSIZE=200000
export HISTFILESIZE=200000
# Ignore duplicates in .bash_history
export HISTCONTROL=ignoredups:erasedups
# ffmpeg command to compress videos with maximum compatibility
ffcompress-video () {
ffmpeg -i "$1" \
-vf scale=1280:720 \
-c:v libx264 -profile:v baseline -crf 23 -preset slow \
-c:a aac -b:a 128k -movflags +faststart \
"$2"
}
_set_liveuser_PS1() {
#PS1='[\u@\h \W]\$ '
PS1="\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[33m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]:\[\e[36m\]\w\[\e[m\]\[\e[32m\]]\[\e[m\]\[\]\\$\[\] "
}
_set_liveuser_PS1
unset -f _set_liveuser_PS1
# limits recursive functions, see 'man bash'
[[ -z "$FUNCNEST" ]] && export FUNCNEST=100
# Use the up and down arrow keys for finding a command in history
# (you can write some initial letters of the command first).
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
# Initialise zoxide tell it to replace cd
eval "$(zoxide init --cmd cd bash)"
# echo file path before navigating to it
export _ZO_ECHO=1
export __GL_SHADER_DISK_CACHE_PATH="~/.local/share/nv/"
export PATH="$PATH:~/.local/bin"
# CUDA Setup
export PATH="$PATH:/opt/cuda/bin/"
export LD_LIBRARY_PATH="/opt/cuda/lib64/"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/cuda/targets/x86_64-linux/lib/"
# Move go out of home
export GOPATH="$HOME/.local/share/go/"
export PATH="$PATH:$GOPATH/bin/"
# Set up fzf key bindings and fuzzy completion
eval "$(fzf --bash)"
export FZF_DEFAULT_OPTS='
--bind=tab:down
--bind=shift-tab:up
'
# ripgrep->fzf->vim [QUERY]
rfv() (
RELOAD='reload:rg --column --color=always --smart-case {q} || :'
OPENER='if [[ $FZF_SELECT_COUNT -eq 0 ]]; then
nvim {1} +{2} # No selection. Open the current line in Vim.
else
nvim +cw -q {+f} # Build quickfix list for the selected items.
fi'
fzf --disabled --ansi --multi \
--bind "start:$RELOAD" --bind "change:$RELOAD" \
--bind "enter:become:$OPENER" \
--bind "ctrl-o:execute:$OPENER" \
--bind 'alt-a:select-all,alt-d:deselect-all,ctrl-/:toggle-preview' \
--delimiter : \
--preview 'bat --style=full --color=always --highlight-line {2} {1}' \
--preview-window '~4,+{2}+4/3,<80(up)' \
--query "$*"
)