.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
34keylookup() {
35 curl "http://hkps.pool.sks-keyservers.net/pks/lookup?op=get&search=0x$1"
36}
37
38# ripped off from nixcasts' .bashrc
39pacs() {
40 sudo pacman -Syy $(pacman -Ssq | fzf -m --preview="pacman -Si {}" \
41 --preview-window=:hidden --bind=space:toggle-preview)
42}
43
44FOSSILS_HOME=$HOME/Documents/Fossils
45
46fslcd() {
47 local fsl_checkout
48 fsl_checkout=$(fossil all ls -c | fzf +m) &&
49 cd "$fsl_checkout"
50}
51
52# fossil init script
53# modified version of one taken from
54# https://www.fossil-scm.org/home/doc/trunk/www/server/openbsd/fastcgi.md
55
56source $HOME/.local/bin/finit
57
58# real one is there, but because it has some
59#personal information, i'll not include it, but it almost identical to
60#following:
61#
62#finit() {
63# FINIT_REPO=$FOSSILS_HOME/$1.fossil
64# fossil init $FINIT_REPO && \
65# chmod 664 $FINIT_REPO && \
66# fossil open $FINIT_REPO --workdir $HOME/Documents/$1 && \
67# fossil user -R $FINIT_REPO password $USER $PASSWD && \
68# fossil remote-url -R $FINIT_REPO https://$USER@domain.tld/$1 && \
69# rsync --perms $FINIT_REPO $USER@domain.tld:/var/www/fossils/ \
70# >/dev/null && \
71# chmod 644 $FINIT_REPO
72#}
73
74# starship prompt
75eval "$(starship init bash)"