diff --git a/Makefile b/Makefile index d0ce7db..0aa3c27 100644 --- a/Makefile +++ b/Makefile @@ -3,18 +3,5 @@ ALERT_AGREEMENT_FILE ?= "$(MAKEFILE_PATH)/.agreed-to-erasing-files.lock" default: install -$(ALERT_AGREEMENT_FILE): - @echo -e "Running this script may delete existing personal configuration files.\n" \ - "Please view this script's source, fully understand it, and backup any\n" \ - "files before continuing.\n" \ - "Seriously. Like... entire directories. Just gone." - -# RESPONSE=$(shell bash -c 'read -r -p "Are you sure you want to continue? [y/N] "') -# @if [[ $response =~ ^(yes|y)$ ]]; then -# @echo "agreed" > "$ALERT_AGREEMENT_FILE" -# @else -# @exit 1 -# @fi - -install: $(ALERT_AGREEMENT_FILE) - @echo "Installed!" +install: + ./setup diff --git a/apps/neovim/init.vim b/apps/neovim/init.vim index 016d95c..59907f0 100644 --- a/apps/neovim/init.vim +++ b/apps/neovim/init.vim @@ -25,9 +25,6 @@ if filereadable(expand('$HOME/.env_init.vim')) source "$HOME/.env_init.vim" endif -let pluginmanagerfile=$vimdir.'/plugin-manager.vim' -exec 'source ' . pluginmanagerfile - " initialize plugin manager if has('nvim') call plug#begin('~/.config/nvim/bundle') @@ -52,3 +49,9 @@ exec 'source ' . commandsfile let bindingsfile=$vimdir.'/bindings.vim' exec 'source ' . bindingsfile + +" load a per-environment file if one exists +if filereadable(expand('$HOME/.env_init_after.vim')) + source "$HOME/.env_init_after.vim" +endif + diff --git a/apps/neovim/plugin-manager.vim b/apps/neovim/plugin-manager.vim index e9b5b4b..e69de29 100644 --- a/apps/neovim/plugin-manager.vim +++ b/apps/neovim/plugin-manager.vim @@ -1,15 +0,0 @@ -" install plugin manager if needed -augroup PluginManagerInstaller - if has('nvim') - if empty(glob('~/.config/nvim/autoload/plug.vim')) - silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall - endif - else - if empty(glob('~/.vim/autoload/plug.vim')) - silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall - endif - end -augroup End - diff --git a/apps/neovim/plugins.vim b/apps/neovim/plugins.vim index 256960f..992ac10 100644 --- a/apps/neovim/plugins.vim +++ b/apps/neovim/plugins.vim @@ -1,3 +1,20 @@ +" install plugin manager if needed +augroup PluginManagerInstaller + if has('nvim') + if empty(glob('~/.config/nvim/autoload/plug.vim')) + silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall + endif + else + if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall + endif + end +augroup End + +let g:ale_completion_enabled = 1 + " check if we're using vim as the manpage viewer before loading session plugins if exists('asmanviewer') let g:prosession_dir = '/dev/null' @@ -34,3 +51,5 @@ Plug 'junegunn/goyo.vim' " better distraction-free editing Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']} +Plug 'junegunn/vim-peekaboo' +Plug 'tpope/vim-eunuch' diff --git a/apps/neovim/settings.vim b/apps/neovim/settings.vim index 48b9447..056ba9b 100644 --- a/apps/neovim/settings.vim +++ b/apps/neovim/settings.vim @@ -14,23 +14,22 @@ let g:airline_left_sep = '' let g:airline#extensions#tabline#buffers_label = '' let g:airline_mode_map = { - \ '__' : '-', - \ 'n' : 'N', - \ 'i' : 'I', - \ 'R' : 'R', - \ 'c' : 'C', - \ 'v' : 'V', - \ 'V' : 'V', - \ '' : 'V', - \ 's' : 'S', - \ 'S' : 'S', - \ '' : 'S', - \ } + \ '__' : '-', + \ 'n' : 'N', + \ 'i' : 'I', + \ 'R' : 'R', + \ 'c' : 'C', + \ 'v' : 'V', + \ 'V' : 'V', + \ '' : 'V', + \ 's' : 'S', + \ 'S' : 'S', + \ '' : 'S', + \ } let g:indent_guide_auto_colors = 1 let g:indent_guides_enable_on_vim_startup = 1 -let g:ale_completion_enabled = 1 let g:ale_elixir_elixir_ls_release = '/home/daniel/code/open-source/elixir-ls/release' let g:ale_sign_column_always = 0 @@ -183,7 +182,7 @@ set noshowcmd set laststatus=0 " yank to OS clipboard -set clipboard+=unnamed +set clipboard+=unnamedplus set nofoldenable setlocal nofoldenable diff --git a/de/bspwmrc b/de/bspwm/bspwmrc similarity index 96% rename from de/bspwmrc rename to de/bspwm/bspwmrc index d1dbe42..e697e88 100755 --- a/de/bspwmrc +++ b/de/bspwm/bspwmrc @@ -21,7 +21,7 @@ if [ -e "$BSPWM_STATE" ] ; then rm "$BSPWM_STATE" fi -source "$DOTFILES_PATH/de/bspwm_config" +source "$DOTFILES_PATH/de/bspwm/config" # TODO: switch to alacritty if command -v urxvtd >/dev/null 2>&1; then diff --git a/de/bspwm_config b/de/bspwm/config similarity index 100% rename from de/bspwm_config rename to de/bspwm/config diff --git a/de/wmstart b/de/bspwm/wmstart similarity index 100% rename from de/wmstart rename to de/bspwm/wmstart diff --git a/de/compton.conf b/de/compton/compton.conf similarity index 100% rename from de/compton.conf rename to de/compton/compton.conf diff --git a/de/gtk2rc b/de/gtk/2rc similarity index 100% rename from de/gtk2rc rename to de/gtk/2rc diff --git a/de/gtk3settings.ini b/de/gtk/3settings.ini similarity index 100% rename from de/gtk3settings.ini rename to de/gtk/3settings.ini diff --git a/de/sway-init b/de/sway/sway-init similarity index 100% rename from de/sway-init rename to de/sway/sway-init diff --git a/de/sway_config b/de/sway/sway_config similarity index 100% rename from de/sway_config rename to de/sway/sway_config diff --git a/de/sxhkdrc b/de/sxhkd/sxhkdrc similarity index 100% rename from de/sxhkdrc rename to de/sxhkd/sxhkdrc diff --git a/de/xinitrc b/de/x/initrc similarity index 100% rename from de/xinitrc rename to de/x/initrc diff --git a/de/xloadresources b/de/x/loadresources similarity index 100% rename from de/xloadresources rename to de/x/loadresources diff --git a/de/xmodmap b/de/x/modmap similarity index 100% rename from de/xmodmap rename to de/x/modmap diff --git a/de/xprofile b/de/x/profile similarity index 87% rename from de/xprofile rename to de/x/profile index 7979182..06b8ca2 100644 --- a/de/xprofile +++ b/de/x/profile @@ -9,8 +9,8 @@ fi echo "xprofile ($DOTFILES_PATH)" >> "$HOME/.xstartup_log" -if [ -f "$DOTFILES_PATH/de/xloadresources" ]; then - source "$DOTFILES_PATH/de/xloadresources" +if [ -f "$DOTFILES_PATH/de/x/loadresources" ]; then + source "$DOTFILES_PATH/de/x/loadresources" fi # keyrepeat settings diff --git a/de/xresources b/de/x/resources similarity index 100% rename from de/xresources rename to de/x/resources diff --git a/scripts/bin/archupdate b/scripts/bin/archupdate new file mode 100755 index 0000000..0f117f2 --- /dev/null +++ b/scripts/bin/archupdate @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +pacaur -Syyu --noconfirm --noedit diff --git a/scripts/bin/calc b/scripts/bin/calc new file mode 100755 index 0000000..43f4a6e --- /dev/null +++ b/scripts/bin/calc @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +python -c "print(${*})" diff --git a/scripts/bin/editscrot b/scripts/bin/editscrot new file mode 100755 index 0000000..8acdbfa --- /dev/null +++ b/scripts/bin/editscrot @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +SCROT_DIR="$NICE_HOME/img/scrots/" +LATEST_SCROT="$(\ls -Art "${SCROT_DIR}" | tail -n 1)" +krita "${SCROT_DIR}${LATEST_SCROT}" diff --git a/scripts/bin/fsw b/scripts/bin/fsw new file mode 100755 index 0000000..7bd9f8b --- /dev/null +++ b/scripts/bin/fsw @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +SHELL_COMMAND="${1}" +shift +inotifywait -q -m -e close_write -r "${@}" | while read -r _ _; do + eval "${SHELL_COMMAND}" +done diff --git a/scripts/bin/gcwd b/scripts/bin/gcwd new file mode 100755 index 0000000..6ab9002 --- /dev/null +++ b/scripts/bin/gcwd @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +addon="" +if [[ -n $1 ]]; then + addon="-${1}" +fi +cd "$(cat "${DOTFILES_PATH}/.cwd${addon}.tmp")" || return diff --git a/scripts/bin/git-authors b/scripts/bin/git-authors index d8e139c..b4856eb 100755 --- a/scripts/bin/git-authors +++ b/scripts/bin/git-authors @@ -1,4 +1,4 @@ #!/usr/bin/env bash -git ls-tree -r -z --name-only HEAD -- $1 | xargs -0 -n1 git blame \ +git ls-tree -r -z --name-only HEAD -- "$1" | xargs -0 -n1 git blame \ --line-porcelain HEAD | grep "^author "| sort | uniq -c | sort -nr diff --git a/scripts/bin/grb b/scripts/bin/grb new file mode 100755 index 0000000..2434386 --- /dev/null +++ b/scripts/bin/grb @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +MAIN_BRANCH="master" +CUR_BRANCH="$(git branch | grep '\*' | cut -d ' ' -f2-)" +if [[ ! -z ${2+x} ]]; then + MAIN_BRANCH="$2" + CUR_BRANCH="$1" +elif [[ ! -z ${1+x} ]]; then + MAIN_BRANCH="$1" +fi + +git rebase -i "$(git merge-base "$CUR_BRANCH" "$MAIN_BRANCH")" diff --git a/scripts/bin/murxvt b/scripts/bin/murxvt index fa122ab..ad4ef0e 100755 --- a/scripts/bin/murxvt +++ b/scripts/bin/murxvt @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# TODO: migrate to alacritty -font="xft:Monaco:pixelsize=16" +# TODO: migrate to alacritty? +font="xft:Iosevka:pixelsize=16" urxvtc -fb "$font" -fi "$font" -fn "$font" -letsp "-1" diff --git a/scripts/bin/n b/scripts/bin/n new file mode 100755 index 0000000..cab30c4 --- /dev/null +++ b/scripts/bin/n @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +SUBDIR="${2:-}" +mkdir -p "$NOTES_PATH/$SUBDIR" +"$EDITOR" "$NOTES_PATH/$SUBDIR/$(date +%Y-%m-%d)_$1.md" diff --git a/scripts/bin/nsync b/scripts/bin/nsync new file mode 100755 index 0000000..9dd82d0 --- /dev/null +++ b/scripts/bin/nsync @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +cd "${NOTES_PATH}" || exit +git add -A +git commit -m Updates +git pull && git push +cd - || exit diff --git a/scripts/bin/restartbar b/scripts/bin/restartbar new file mode 100755 index 0000000..6a7cdfb --- /dev/null +++ b/scripts/bin/restartbar @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +stopbar +startbar diff --git a/scripts/bin/s b/scripts/bin/s new file mode 100755 index 0000000..740260a --- /dev/null +++ b/scripts/bin/s @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +"$EDITOR" "$NOTES_PATH/_scratch.md" diff --git a/scripts/bin/screenshot b/scripts/bin/screenshot new file mode 100755 index 0000000..9edec4b --- /dev/null +++ b/scripts/bin/screenshot @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SCROT_DIR="$NICE_HOME/img/scrots/" +mkdir -p "$SCROT_DIR" +FILENAME="$NICE_HOME/img/scrots/%Y-%m-%d_%H-%M-%S_\$wx\$h.png" +scrot "$@" "${FILENAME}" >/dev/null && echo "Saved screenshot to: ${FILENAME}" diff --git a/scripts/bin/scwd b/scripts/bin/scwd new file mode 100755 index 0000000..2341e03 --- /dev/null +++ b/scripts/bin/scwd @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +addon="" +if [[ -n $1 ]]; then + addon="-${1}" +fi +echo "${PWD}" > "${DOTFILES_PATH}/.cwd${addon}.tmp" diff --git a/scripts/bin/setbg b/scripts/bin/setbg new file mode 100755 index 0000000..2920902 --- /dev/null +++ b/scripts/bin/setbg @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +feh --bg-fill "$@" diff --git a/scripts/bin/startbar b/scripts/bin/startbar new file mode 100755 index 0000000..31146f2 --- /dev/null +++ b/scripts/bin/startbar @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +bash "${DOTFILES_PATH}/de/bar/bar.bash" & +bg +disown diff --git a/scripts/bin/stopbar b/scripts/bin/stopbar new file mode 100755 index 0000000..af24e17 --- /dev/null +++ b/scripts/bin/stopbar @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# TODO: get the proper monitor! +BAR_MONITOR="$(polybar --list-monitors | tail -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')" +bspc config -m "${BAR_MONITOR}" bottom_padding "0" +bspc config -m "${BAR_MONITOR}" top_padding "0" +killall -q polybar +while pgrep -x polybar >/dev/null; do sleep 1; done diff --git a/scripts/bin/tmuxswitcher b/scripts/bin/tmuxswitcher new file mode 100755 index 0000000..360826c --- /dev/null +++ b/scripts/bin/tmuxswitcher @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +fmt='#{session_id}:|#S|(#{session_attached} attached)' +{ tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \ + | awk '!seen[$1]++' \ + | column -t -s'|' \ + | fzf -q '$' --reverse --prompt 'switch session: ' -1 \ + | cut -d':' -f1 \ + | xargs tmux switch-client -t diff --git a/scripts/bin/vman b/scripts/bin/vman new file mode 100755 index 0000000..fa4b287 --- /dev/null +++ b/scripts/bin/vman @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# our vim config is setup to not auto-load sessions if we set the +# `asmanviewer` variable, so launch vim that way when using vim as our man +# page viewer +if command -v nvim >/dev/null 2>&1; then + nvim --cmd "let asmanviewer=1" -c "SuperMan $*" +else + vim --cmd "let asmanviewer=1" -c "SuperMan $*" +fi + +# proper error handling +if [ "$?" != "0" ]; then + echo "No manual entry for $*" +fi diff --git a/scripts/bin/workdock b/scripts/bin/workdock new file mode 100755 index 0000000..1bc74bc --- /dev/null +++ b/scripts/bin/workdock @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +"$DOTFILES_PATH/de/x/loadresources" lodpi && autorandr --change && sleep 1 && restartbar diff --git a/scripts/env_bin/.gitignore b/scripts/env_bin/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/scripts/env_bin/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/setup b/setup index 98515c0..9be2217 100755 --- a/setup +++ b/setup @@ -31,21 +31,21 @@ fi # TODO: make sure we have an even number, here links=( # desktop environment files - "$dfp/de/sway_config" "$XDG_CONFIG_HOME/sway/config" - "$dfp/de/bspwmrc" "$XDG_CONFIG_HOME/bspwm/bspwmrc" - "$dfp/de/sxhkdrc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc" - "$dfp/de/xresources" "$HOME/.Xresources" - "$dfp/de/xinitrc" "$HOME/.xinitrc" - "$dfp/de/xprofile" "$HOME/.xprofile" - "$dfp/de/xmodmap" "$HOME/.xmodmap" + "$dfp/de/sway/config" "$XDG_CONFIG_HOME/sway/config" + "$dfp/de/bspwm/bspwmrc" "$XDG_CONFIG_HOME/bspwm/bspwmrc" + "$dfp/de/sxhkd/sxhkdrc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc" + "$dfp/de/x/resources" "$HOME/.Xresources" + "$dfp/de/x/initrc" "$HOME/.xinitrc" + "$dfp/de/x/profile" "$HOME/.xprofile" + "$dfp/de/x/modmap" "$HOME/.xmodmap" + "$dfp/de/compton/compton.conf" "$XDG_CONFIG_HOME/compton.conf" "$dfp/scripts/colors/xresources" "$HOME/.Xresources.colors" - "$dfp/de/compton.conf" "$XDG_CONFIG_HOME/compton.conf" # shell files - "$dfp/shell/bashrc" "$HOME/.bashrc" - "$dfp/shell/bash_profile" "$HOME/.bash_profile" - "$dfp/shell/tmux.conf" "$HOME/.tmux.conf" - "$dfp/shell/tmux-layouts" "$HOME/.tmux/layouts" + "$dfp/shell/bash/bashrc" "$HOME/.bashrc" + "$dfp/shell/bash/bash_profile" "$HOME/.bash_profile" + "$dfp/shell/tmux/tmux.conf" "$HOME/.tmux.conf" + "$dfp/shell/tmux/layouts" "$HOME/.tmux/layouts" # text editor files "$dfp/apps/neovim/" "$XDG_CONFIG_HOME/nvim" @@ -54,9 +54,9 @@ links=( "$dfp/scripts/colors/vim" "$XDG_CONFIG_HOME/nvim/colors/base16-donokai.vim" # gtk configuration files - "$dfp/de/gtk2rc" "$HOME/.gtkrc-2.0" - "$dfp/de/gtk2rc" "$HOME/.gtkrc" - "$dfp/de/gtk3settings.ini" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" + "$dfp/de/gtk/2rc" "$HOME/.gtkrc-2.0" + "$dfp/de/gtk/2rc" "$HOME/.gtkrc" + "$dfp/de/gtk/3settings.ini" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" # irc files "$dfp/apps/irssi/" "$HOME/.irssi" diff --git a/shell/aliases b/shell/bash/aliases similarity index 59% rename from shell/aliases rename to shell/bash/aliases index 4f2a0f4..1b2ba56 100644 --- a/shell/aliases +++ b/shell/bash/aliases @@ -1,13 +1,5 @@ #!/usr/bin/env bash -# set our needed variables if we don't already have them -if [[ -z "$XDG_CONFIG_HOME" ]]; then - export XDG_CONFIG_HOME="$HOME/.config" -fi -if [[ -z "$DOTFILES_PATH" ]]; then - export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" -fi - # filesystem aliases alias lx='ls -lXB' # order by filetype alias lk='ls -lSr' # order by filesize reversed @@ -36,9 +28,6 @@ alias cd..="cd .." alias cdd="cd \"\$DOTFILES_PATH\"" # go to dotfiles alias cdc="cd \"\$XDG_CONFIG_HOME\"" # go to alias cdn="cd \"\$NOTES_PATH\"" - -alias nsync="cd \"\$NOTES_PATH\"; git add -A; git commit -m Updates; git pull && git push; cd -" - function cdp() { cd "$(dirname "$(fzf)")" || return } @@ -77,25 +66,6 @@ alias gsur="git submodule update --remote" alias glf="git ls-files" alias gl="git log --graph --pretty=oneline --abbrev-commit --decorate" -grb() { - MAIN_BRANCH="master" - CUR_BRANCH="$(git branch | grep '\*' | cut -d ' ' -f2-)" - if [[ ! -z ${2+x} ]]; then - MAIN_BRANCH="$2" - CUR_BRANCH="$1" - elif [[ ! -z ${1+x} ]]; then - MAIN_BRANCH="$1" - fi - - git rebase -i "$(git merge-base "$CUR_BRANCH" "$MAIN_BRANCH")" -} - -# DEPRECATED: we use network manager (nmtui/nmcli) now -# start netctl using any available profile on the first wireless network -# interface -# TODO: flesh this out into a function that lets the user know what's going on. -#alias wifi="sudo systemctl start netctl-auto@$(for wli in /sys/class/net/wl*; do echo $(basename $wli); break; done)" - # misc aliases alias qute="qutebrowser --backend webengine" alias p="ping 8.8.8.8" @@ -111,44 +81,10 @@ alias redshift="redshift -r -l 39.0997:-94.5786 -t 6500K:2500K" alias gpmdpe="electron --app=/usr/share/gpmdp/resources/app.asar" alias t="task" -export NOTES_DIR="$NICE_HOME" - # games aliases # this sometimes fixes steam dynamic library issues? -# alias steam="LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' steam" +alias lsteam="LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' steam" -# text editor aliases - -# man pages with vim -vman() { - # our vim config is setup to not auto-load sessions if we set the - # `asmanviewer` variable, so launch vim that way when using vim as our man - # page viewer - if command -v nvim >/dev/null 2>&1; then - nvim --cmd "let asmanviewer=1" -c "SuperMan $*" - else - vim --cmd "let asmanviewer=1" -c "SuperMan $*" - fi - - # proper error handling - if [ "$?" != "0" ]; then - echo "No manual entry for $*" - fi -} -# override the man commands +# override the man commands with vim alias _man="\\man" alias man="vman" - -# set our EDITOR to neovim if we've got it -export EDITOR="vim" -if command -v nvim >/dev/null 2>&1; then - alias vim="nvim" - alias ovim="\\vim" - export EDITOR="nvim" -fi - -export BROWSER="firefox" - -# arch aliases -# TODO: load os-specific aliases based on running OS -alias archupdate="pacaur -Syyu --noconfirm --noedit" diff --git a/shell/autocompletions b/shell/bash/autocompletions similarity index 100% rename from shell/autocompletions rename to shell/bash/autocompletions diff --git a/shell/bash_profile b/shell/bash/bash_profile similarity index 100% rename from shell/bash_profile rename to shell/bash/bash_profile diff --git a/shell/bashrc b/shell/bash/bashrc similarity index 83% rename from shell/bashrc rename to shell/bash/bashrc index ff5dad9..842a2f5 100644 --- a/shell/bashrc +++ b/shell/bash/bashrc @@ -13,20 +13,18 @@ NICE_HOME="$HOME" [[ $(basename "${HOME}") = ".home" ]] && NICE_HOME="$(realpath "$HOME/..")" export NICE_HOME +export NOTES_DIR="$NICE_HOME/doc/notes" # TODO: nice home on a per-device basis # set our PATH -source "$DOTFILES_PATH/shell/paths" +source "$DOTFILES_PATH/shell/bash/paths" # import our aliases -source "$DOTFILES_PATH/shell/aliases" - -# import our global shell functions -source "$DOTFILES_PATH/shell/funcs" +source "$DOTFILES_PATH/shell/bash/aliases" # import our autocompletions -source "$DOTFILES_PATH/shell/autocompletions" +source "$DOTFILES_PATH/shell/bash/autocompletions" # load our key binds bind -f "$DOTFILES_PATH/shell/inputrc" @@ -54,7 +52,7 @@ BASE16_SHELL="$DOTFILES_PATH/scripts/colors/shell" shopt -s globstar # import our prompt -source "$DOTFILES_PATH/shell/prompt" +source "$DOTFILES_PATH/shell/bash/prompt" # prevents binds or commands pulling from history from insta-sending, and # instead places them in the readline for editing @@ -82,4 +80,14 @@ _make_paths LS_COLORS='ow=01;36;40' export LS_COLORS +# set our EDITOR to neovim if we've got it +export EDITOR="vim" +if command -v nvim >/dev/null 2>&1; then + alias vim="nvim" + alias ovim="\\vim" + export EDITOR="nvim" +fi + +export BROWSER="firefox" + [ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/shell/paths b/shell/bash/paths similarity index 91% rename from shell/paths rename to shell/bash/paths index 6af0847..b76200d 100644 --- a/shell/paths +++ b/shell/bash/paths @@ -5,6 +5,7 @@ export GOPATH="$HOME/.go" # PATH=$PATH:$APPENDED_PATH export PATH=$PATH:"$GOPATH/bin" export PATH=$PATH:"$DOTFILES_PATH/scripts/bin" +export PATH=$PATH:"$DOTFILES_PATH/scripts/env_bin" export PATH=$PATH:"$HOME/.cargo/bin" if [ -d "$HOME/.local/bin" ]; then diff --git a/shell/prompt b/shell/bash/prompt similarity index 100% rename from shell/prompt rename to shell/bash/prompt diff --git a/shell/funcs b/shell/funcs deleted file mode 100644 index 1806acf..0000000 --- a/shell/funcs +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env bash - -calc() { - tp="$*" - python -c "print(${tp})" -} -export -f calc - -stopbar() { - # TODO: get the proper monitor! - BAR_MONITOR="$(polybar --list-monitors | tail -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')" - bspc config -m "${BAR_MONITOR}" bottom_padding "0" - bspc config -m "${BAR_MONITOR}" top_padding "0" - killall -q polybar - while pgrep -x polybar >/dev/null; do sleep 1; done -} -export -f stopbar - -# wm aliases -startbar() { - bash "${DOTFILES_PATH}/de/bar/bar.bash" & - bg - disown -} -export -f startbar - -restartbar() { - stopbar - startbar -} -export -f restartbar - -screenshot() { - SCROT_DIR="$NICE_HOME/img/scrots/" - mkdir -p "$SCROT_DIR" - FILENAME="$NICE_HOME/img/scrots/%Y-%m-%d_%H-%M-%S_\$wx\$h.png" - scrot "$@" "${FILENAME}" >/dev/null && echo "Saved screenshot to: ${FILENAME}" -} -export -f screenshot - -editscrot() { - SCROT_DIR="$NICE_HOME/img/scrots/" - LATEST_SCROT="$(\ls -Art "${SCROT_DIR}" | tail -n 1)" - krita "${SCROT_DIR}${LATEST_SCROT}" -} - -n() { - SUBDIR="${2:-}" - mkdir -p "$NOTES_PATH/$SUBDIR" - "$EDITOR" "$NOTES_PATH/$SUBDIR/$(date +%Y-%m-%d)_$1.md" -} -export -f n - -s() { - "$EDITOR" "$NOTES_PATH/_scratch.md" -} -export -f s - -# save the current directory for later retrieval -scwd() { - addon="" - if [[ -n $1 ]]; then - addon="-${1}" - fi - echo "${PWD}" > "${DOTFILES_PATH}/.cwd${addon}.tmp" -} -export -f scwd -# bind '"\C-s"':"\"scwd\C-m\"" - -# go to the saved current directory -gcwd() { - addon="" - if [[ -n $1 ]]; then - addon="-${1}" - fi - cd "$(cat "${DOTFILES_PATH}/.cwd${addon}.tmp")" || return -} -export -f gcwd -# bind '"\C-g"':"\"gcwd\C-m\"" - -fsw() { - SHELL_COMMAND="${1}" - shift - inotifywait -q -m -e close_write -r "${@}" | while read -r _ _; do - eval "${SHELL_COMMAND}" - done -} -export -f fsw - -# tmux session switcher with fzf from https://github.com/junegunn/fzf/issues/997 -tmuxswitcher() { - local -r fmt='#{session_id}:|#S|(#{session_attached} attached)' - { tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \ - | awk '!seen[$1]++' \ - | column -t -s'|' \ - | fzf -q '$' --reverse --prompt 'switch session: ' -1 \ - | cut -d':' -f1 \ - | xargs tmux switch-client -t -} -export -f tmuxswitcher diff --git a/shell/tmux-layouts/dev.tmux b/shell/tmux/layouts/dev.tmux similarity index 100% rename from shell/tmux-layouts/dev.tmux rename to shell/tmux/layouts/dev.tmux diff --git a/shell/tmux.conf b/shell/tmux/tmux.conf similarity index 99% rename from shell/tmux.conf rename to shell/tmux/tmux.conf index 572e830..a65b326 100644 --- a/shell/tmux.conf +++ b/shell/tmux/tmux.conf @@ -33,6 +33,7 @@ bind-key l switch-client -n bind-key T set-option -g mouse off bind-key G set-option -g mouse on +# TODO: check if in WSL bind -n C-y run "tmux save-buffer - | /mnt/c/Windows/System32/clip.exe" \; display-message "Clipboard copied" # message colors