organize shell configs so i can use them elsewhere

This commit is contained in:
tavo-wasd 2023-09-15 13:34:02 -06:00
parent 409cb8adea
commit c786dace2d
6 changed files with 52 additions and 40 deletions

View file

@ -1,21 +1,5 @@
#!/bin/bash
# Common
alias \
ls="exa -al --group-directories-first" \
fzf="fzf --cycle --reverse" \
diff="diff --color=auto" \
grep="grep --color=auto" \
calc="bc -l" \
cp="cp -iv" \
mv="mv -iv" \
rm="rm -iv" \
vim="nvim" \
# Command shortcuts
alias \
apt-upgrade="sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y" \
# Directories
alias \
src="cd $HOME/.local/src/ && ls" \
@ -31,6 +15,18 @@ alias \
img="cd $HOME/Pictures/ && ls" \
vid="cd $HOME/Videos/ && ls" \
# Common
alias \
ls="exa -al --group-directories-first" \
fzf="fzf --cycle --reverse" \
diff="diff --color=auto" \
grep="grep --color=auto" \
calc="bc -l" \
cp="cp -iv" \
mv="mv -iv" \
rm="rm -iv" \
vim="nvim" \
# Launch args
alias \
fzf-edit-script="fzf_nav /home/$(whoami)/.config/scripts" \
@ -38,3 +34,7 @@ alias \
notes="note list" \
def="dict" \
# Command shortcuts
alias \
apt-upgrade="sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y" \

View file

@ -9,37 +9,25 @@ prompt_git_branch() {
[ -n "$GIT_BRANCH" ] && printf "  %s " "$GIT_BRANCH"
}
PS1='\[\033[2m\]($?) \[\033[1m\]\[\033[46m\] \u@\h \[\033[44m\] \w \[\033[45m\]$(prompt_git_branch)\[\033[0m\] \[\033[2m\][\!] \@\n\[\033[0m\]⯈ '
PROMPT_COMMAND="echo" # Line jump after every command
PROMPT_COMMAND="echo" # Line jump after every command
# General configs
PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}"
PATH="$HOME/.config/wrappers${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts${PATH:+:${PATH}}"
PATH="$HOME/.local/bin${PATH:+:${PATH}}" # Custom PATHs for executables
bind "set completion-ignore-case on" # Case insensitive TAB complete
shopt -s cdspell # Autocorrect directory name
shopt -s autocd # cd into dir by typing the name
set -o vi # vi mode
bind "set completion-ignore-case on" # Case insensitive TAB complete
shopt -s cdspell # Autocorrect directory name
shopt -s autocd # cd into dir by typing the name
set -o vi # vi mode
# External configs
source ~/.config/shell/xdgspec
source ~/.config/shell/envvar
source ~/.config/shell/aliasrc
source ~/.config/shell/functions
[ -e "$HOME/.config/shell/functions" ] && source ~/.config/shell/functions
[ -e "$HOME/.config/shell/xdgspec" ] && source ~/.config/shell/xdgspec
[ -e "$HOME/.config/shell/aliasrc" ] && source ~/.config/shell/aliasrc
[ -e "$HOME/.config/shell/envvar" ] && source ~/.config/shell/envvar
# Binds
bind '"\C-f":"fzf_nav\C-m"'
bind '"\C-y":"copy_output\C-m"'
bind '"\C-e":"dragon -x \* 2>/dev/null\C-m"'
[ -e "$HOME/.config/shell/keybinds" ] && source ~/.config/shell/keybinds
# Autostart dwm after tty login
type systemctl 2>/dev/null 1>&2 && if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
cat ~/.config/snippets/welcome
sleep 0.5
amixer
exec startx
fi
[ -e "$HOME/.config/shell/dwm" ] && source ~/.config/shell/dwm
# nice login prompt
[ -e "/usr/bin/afetch" ] && afetch || fetch min
[ -e "/usr/bin/afetch" ] && afetch || fetch min 2>/dev/null

9
shell/dwm Normal file
View file

@ -0,0 +1,9 @@
#!/bin/bash
# Autostart dwm after tty login
type systemctl 2>/dev/null 1>&2 && if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
cat ~/.config/snippets/welcome
sleep 0.5
amixer
exec startx
fi

View file

@ -1,6 +1,13 @@
#!/bin/bash
# Useful variables
# Custom PATHs for executables
PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}"
PATH="$HOME/.config/wrappers${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts${PATH:+:${PATH}}"
PATH="$HOME/.local/bin${PATH:+:${PATH}}"
# Common
export \
GIT="ssh://git@gitlab.com/tavo-wasd" \

5
shell/keybinds Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
bind '"\C-e":"dragon -x \* 2>/dev/null\C-m"'
bind '"\C-y":"copy_output\C-m"'
bind '"\C-f":"fzf_nav\C-m"'

View file

@ -95,6 +95,9 @@ function OpenTerminal()
endfunction
nnoremap <C-t> :call OpenTerminal()<CR>
" Custom commands
command SourceVimrc :source ~/.config/vim/vimrc
" Plugins
if empty(glob('~/.config/vim/autoload/plug.vim'))
silent !curl -fLo ~/.config/vim/autoload/plug.vim --create-dirs