From c786dace2d491a8cd596f81899a103ecbd126e96 Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Fri, 15 Sep 2023 13:34:02 -0600 Subject: [PATCH] organize shell configs so i can use them elsewhere --- shell/aliasrc | 32 ++++++++++++++++---------------- shell/bashrc | 36 ++++++++++++------------------------ shell/dwm | 9 +++++++++ shell/envvar | 7 +++++++ shell/keybinds | 5 +++++ vim/vimrc | 3 +++ 6 files changed, 52 insertions(+), 40 deletions(-) create mode 100644 shell/dwm create mode 100644 shell/keybinds diff --git a/shell/aliasrc b/shell/aliasrc index f742bd7..550d277 100644 --- a/shell/aliasrc +++ b/shell/aliasrc @@ -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" \ + diff --git a/shell/bashrc b/shell/bashrc index 51fc936..8b4b122 100644 --- a/shell/bashrc +++ b/shell/bashrc @@ -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 diff --git a/shell/dwm b/shell/dwm new file mode 100644 index 0000000..cab20d6 --- /dev/null +++ b/shell/dwm @@ -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 diff --git a/shell/envvar b/shell/envvar index 9f1f860..1b04eac 100644 --- a/shell/envvar +++ b/shell/envvar @@ -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" \ diff --git a/shell/keybinds b/shell/keybinds new file mode 100644 index 0000000..f2223b8 --- /dev/null +++ b/shell/keybinds @@ -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"' diff --git a/vim/vimrc b/vim/vimrc index 6fb2abd..6732b7e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -95,6 +95,9 @@ function OpenTerminal() endfunction nnoremap :call OpenTerminal() +" 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