.bashrc (view raw)
1#
2# ~/.bashrc
3#
4
5# If not running interactively, don't do anything
6[[ $- != *i* ]] && return
7
8# vi mode
9set -o vi
10
11# aliases
12alias ls='ls --color=auto --group-directories-first'
13alias ll='ls -lAh'
14alias cat='bat -p'
15alias ssh='TERM=rxvt ssh'
16alias config='/usr/bin/git --git-dir=$HOME/Documents/dotfiles --work-tree=$HOME'
17alias brc='nvim ~/.bashrc && source ~/.bashrc'
18alias vrc='nvim ~/.config/nvim/init.vim'
19alias v='nvim'
20alias fsl='fossil'
21
22PS1='[\u@\h \W]\$ '
23
24# use gpg authentication key for ssh auth
25export SSH_AUTH_SOCK=$( gpgconf --list-dirs agent-ssh-socket )
26gpgconf --launch gpg-agent
27
28# fzf bindings and tweaks
29source /usr/share/fzf/key-bindings.bash
30source /usr/share/fzf/completion.bash
31export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
32export FZF_CTRL_T_COMMAND='$FZF_DEFAULT_COMMAND'
33
34# ripped off from nixcasts' .bashrc
35pacs() {
36 sudo pacman -Syy $(pacman -Ssq | fzf -m --preview="pacman -Si {}" \
37 --preview-window=:hidden --bind=space:toggle-preview)
38}
39
40FOSSILS_HOME=$HOME/Documents/Fossils
41
42fslcd() {
43 local fsl_checkout
44 fsl_checkout=$(fossil all ls -c | fzf +m) &&
45 cd "$fsl_checkout"
46}
47
48# fossil init script
49# modified version of one taken from
50# https://www.fossil-scm.org/home/doc/trunk/www/server/openbsd/fastcgi.md
51
52source $HOME/.local/bin/finit
53
54# real one is there, but because it has some
55#personal information, i'll not include it, but it almost identical to
56#following:
57#
58#finit() {
59# FINIT_REPO=$FOSSILS_HOME/$1.fossil
60# fossil init $FINIT_REPO && \
61# chmod 664 $FINIT_REPO && \
62# fossil open $FINIT_REPO --workdir $HOME/Documents/$1 && \
63# fossil user -R $FINIT_REPO password $USER $PASSWD && \
64# fossil remote-url -R $FINIT_REPO https://$USER@domain.tld/$1 && \
65# rsync --perms $FINIT_REPO $USER@domain.tld:/var/www/fossils/ \
66# >/dev/null && \
67# chmod 644 $FINIT_REPO
68#}
69
70# starship prompt
71eval "$(starship init bash)"