This commit is contained in:
Daniel Flanagan 2018-11-08 07:32:36 -06:00
parent 134134fcd5
commit b5f99b9d7d
50 changed files with 194 additions and 241 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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

3
scripts/bin/archupdate Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
pacaur -Syyu --noconfirm --noedit

3
scripts/bin/calc Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
python -c "print(${*})"

5
scripts/bin/editscrot Executable file
View File

@ -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}"

7
scripts/bin/fsw Executable file
View File

@ -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

7
scripts/bin/gcwd Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
addon=""
if [[ -n $1 ]]; then
addon="-${1}"
fi
cd "$(cat "${DOTFILES_PATH}/.cwd${addon}.tmp")" || return

View File

@ -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

12
scripts/bin/grb Executable file
View File

@ -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")"

View File

@ -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"

5
scripts/bin/n Executable file
View File

@ -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"

7
scripts/bin/nsync Executable file
View File

@ -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

4
scripts/bin/restartbar Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
stopbar
startbar

3
scripts/bin/s Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
"$EDITOR" "$NOTES_PATH/_scratch.md"

6
scripts/bin/screenshot Executable file
View File

@ -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}"

7
scripts/bin/scwd Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
addon=""
if [[ -n $1 ]]; then
addon="-${1}"
fi
echo "${PWD}" > "${DOTFILES_PATH}/.cwd${addon}.tmp"

3
scripts/bin/setbg Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
feh --bg-fill "$@"

5
scripts/bin/startbar Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
bash "${DOTFILES_PATH}/de/bar/bar.bash" &
bg
disown

8
scripts/bin/stopbar Executable file
View File

@ -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

9
scripts/bin/tmuxswitcher Executable file
View File

@ -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

15
scripts/bin/vman Executable file
View File

@ -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

3
scripts/bin/workdock Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
"$DOTFILES_PATH/de/x/loadresources" lodpi && autorandr --change && sleep 1 && restartbar

2
scripts/env_bin/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

30
setup
View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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