diff --git a/README.md b/README.md index 8b06c25..7c16c53 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,49 @@ -# The `.wryn` Directory +# The `.wryn` Library -This is a compilation of utilities which I use across machines. -I expect this to be a lifelong struggle to get everything to work the second that I'm on a new machine, but I have yet to have a flawless transfer from one machine to the next. -Despite my failures (so far) in a *perfect* transfer installation, I have found this project to have sped up my transferring between machines immensely. -When I'm working on multiple machines, a simple `git pull` will keep all of my shell and VI scripts in sync. +A compilation of utilities which I use across my machines. +This library represents my lifelong efforts to create a custom, streamlined IDE based on the terminal and terminal-based editors. So I suppose here is the disclaimer: **this repo is principally for personal utility**. -Sometimes there are local machine dependencies which will cause (particularly setup) utilities to fail. -Feel free to use or adapt anything you find useful, just leave credit where credit is due :) +Although I try to build utilities to be dependency aware, the library is considered to be in a good state when it works on my machine. +Feel free to use or adapt anything you find useful :) ## File Structure Breakdown - -Here's a little breakdown of what each directory may contain (in no particular order). - -### [bash](./bash) -It contains `bash` aliases and functions which might be placed in a `~/.bashrc` to be called from the command line. -I have found it personally useful to break these out into topical groupings or modules. - -All modules which are found directly within `~/.wryn/bash` will be loaded across all operating systems, while specific operating systems architectures will each have their own specified modules (e.g. [`~/.wryn/bash/linux`](./bash/linux) or [`~/.wryn/bash/osx`](./bash/osx)). - -### [zsh](./zsh) -Just like [`~/.wryn/bash`](./bash) but for ZSH. -Currently, I'm using ZSH, so these utilities may be more up-to-date than those found in `~/.wryn/bash` +### [bin](./bin) +Program-specific shell utilities used throughout configurations and other `zsh` scripts. +These utilities are not used directly by the user and are **not** sourced to the user RC. ### [config](./config) -These are all the sort of files you would expect to find in your `~/.config` directory. -In fact, the [`~/.wryn/setup`](./setup) script is designed to symlink relevant files to your local `~/.config` directory. +Configuration files which are typically symlinked to the `~/.config` directory. + +### [env](./env) +Default environment variables used by library utilities. +Overrides can be set on each machine by editing the appropriate local environment in `~/.config/wryn/`. + +### [freeze](./freeze) +A historical list of packages used on personal machines. +Also contains machine-specific `systemd` daemons for managing hardware-specific issues. ### [latex](./latex) -This directory contains my TeX templates. -Each template is composed of four files: `template.tex`, `body.tex`, `imports.sty`, and `formatting.sty`. +A compilation of LaTeX templates, used by the [`.wryn/zsh/latex`](./zsh/latex) utility. +Each template is composed of four files: `template.tex`, `body.tex`, `imports.sty`, and `formatting.sty`. The `template.tex` file is the parent of the document, and thus the target of the latex compiler. This can be renamed to match the document title, but typically does not contain the document body. Every template will use the same parent `template.tex` file, so this is found at the [`~/.wryn/latex`](./latex) directory root. -The remaining three files will vary from template to template, but should be copied to the same directory as `template.tex` when creating a working document. -The two style files, `imports.sty` and `formatting.sty` manage external imports and document styling (respectively), while the `body.tex` should contain the document's text and text-specific commands. - -There are [shell utilities](./zsh/latex) which facilitate their copying for general use. - -### [systemd-utils](./systemd-utils) -I started this directory when I installed Arch Linux on a late 2013 macbook pro. -Currently these are daemons designed to help fix hardware issues with that machine. +### [resume](./resume) +My working resume in `.tex` format. ### [vim](./vim) -This contains all my custom keybindings and vim-scripts. -There is also an installer which pulls down and builds (or rebuilds) the few external plugins which I use with VI. +Contains keybindings, dictionary binary, and custom plugins for `vim`. -### [bin](./bin) -Non-sourced shell utilities. +The [`setup`](./setup) utility will source the `.wryn/vim/rc.vim` and set up all necessary environment variables. +Local environment overrides are placed in `~/.config/wryn/env/env.vim`. -### [env](./env) -[`~/.wryn/setup`](./setup) will link these environment variables to your local machine's shell and vim environments. -This is so directories in respective shell/vim modules are not hard-coded to any particular machine. -The indicated variables should be modified if they cannot be found in the prescribed directory. +### [zsh](./zsh) +Contains `zsh` aliases and functions used directly by a terminal user. +The [`.wryn/zsh/rc`](./zsh/rc), which loads the custom `zsh` modules is sourced directly from the user RC. +Any OS specific utilities are nested in appropriately named directories. -### [new_computer_setup](./new_computer_setup) -Now that I'm writing this, it occurs to me this may be a misnomer. -It is actually a historical log of system and python packages I have installed on previous machines. - -### [tmux](./tmux) -Contains tmux configuration files for keybindings, status bar settings, etc. +The [`setup`](./setup) utility will source the `.wryn/zsh/rc` and set up all necessary environment variables. +Local environment overrides are placed in `~/.config/wryn/env/env`. diff --git a/bin/desktop/kitty/alternate-terminal.sh b/bin/desktop/kitty/alternate-terminal.sh index 76fd3a1..6e8876c 100755 --- a/bin/desktop/kitty/alternate-terminal.sh +++ b/bin/desktop/kitty/alternate-terminal.sh @@ -1,6 +1,8 @@ #!/bin/sh -CONFIG_DIR="$HOME/.wryn/config/kitty" +source "$HOME/.config/wryn/env/env" + +CONFIG_DIR="$DOTWRYN/config/kitty" [ -f "$CONFIG_DIR/temp.conf" ] && return 1 # race condition lock diff --git a/bin/desktop/sfx/canberra-gtk-play.sh b/bin/desktop/sfx/play.sh similarity index 77% rename from bin/desktop/sfx/canberra-gtk-play.sh rename to bin/desktop/sfx/play.sh index d4a40c8..b4074c7 100755 --- a/bin/desktop/sfx/canberra-gtk-play.sh +++ b/bin/desktop/sfx/play.sh @@ -1,11 +1,8 @@ #!/bin/sh -ENGINE="$(which canberra-gtk-play) -f" -SFX="$HOME/Personal/sfx"; -source "$HOME/.config/wryn/env.zsh" - +source "$HOME/.config/wryn/env/env" PLAY() { - eval "$ENGINE" "$SFX/$1" + eval "$MEDIA_ENGINE" "$SFX_PATH/$1" } case $1 in diff --git a/bin/desktop/youtube-music/next.sh b/bin/desktop/youtube-music/next.sh index 4b77250..e481155 100755 --- a/bin/desktop/youtube-music/next.sh +++ b/bin/desktop/youtube-music/next.sh @@ -1 +1,3 @@ -"$HOME/.wryn/bin/desktop/youtube-music/controller.sh" next +source "$HOME/.config/wryn/env/env" + +"$DOTWRYN/bin/desktop/youtube-music/controller.sh" next diff --git a/bin/desktop/youtube-music/playpause.sh b/bin/desktop/youtube-music/playpause.sh index ed98ceb..374fb44 100755 --- a/bin/desktop/youtube-music/playpause.sh +++ b/bin/desktop/youtube-music/playpause.sh @@ -1 +1,3 @@ -"$HOME/.wryn/bin/desktop/youtube-music/controller.sh" playpause +source "$HOME/.config/wryn/env/env" + +"$DOTWRYN/bin/desktop/youtube-music/controller.sh" playpause diff --git a/bin/desktop/youtube-music/previous.sh b/bin/desktop/youtube-music/previous.sh index e0f4b0e..5ccdfd6 100755 --- a/bin/desktop/youtube-music/previous.sh +++ b/bin/desktop/youtube-music/previous.sh @@ -1 +1,3 @@ -"$HOME/.wryn/bin/desktop/youtube-music/controller.sh" prev +source "$HOME/.config/wryn/env/env" + +"$DOTWRYN/bin/desktop/youtube-music/controller.sh" prev diff --git a/bin/vim/update_colorschemes b/bin/vim/update_colorschemes index 07e162f..f56b515 100755 --- a/bin/vim/update_colorschemes +++ b/bin/vim/update_colorschemes @@ -1,6 +1,10 @@ #!/bin/bash +source "$HOME/.config/wryn/env/env" + [ ! -d "$HOME/.vim" ] && mkdir "$HOME/.vim" [ ! -d "$HOME/.vim/colors" ] && mkdir "$HOME/.vim/colors" -for file in $(find "$HOME/.wryn/config/colorschemes/vim" -name \*.vim); do cp $file ~/.vim/colors/; done +for file in $(find "$DOTWRYN/config/colorschemes/vim" -name \*.vim); do + cp $file ~/.vim/colors/; +done echo "vim colorschemes updated" diff --git a/config/i3/config b/config/i3/config index 1aa125b..8708454 100644 --- a/config/i3/config +++ b/config/i3/config @@ -6,10 +6,8 @@ set $mod Mod4 font pango:monospace 20 -set $CONFIG /home/w0ryn/.config/wryn set $UTILS /home/w0ryn/.config/wryn/i3utils - set $SLACK_CLIENT_CLASS ^Slack$ set $MESSAGE_CLIENT_CLASS ^android-messages-desktop$ set $MEDIA_CLIENT_CLASS ^youtubemusic-nativefier diff --git a/config/i3/utils b/config/i3/utils index 0c58892..da93ce9 100755 --- a/config/i3/utils +++ b/config/i3/utils @@ -1,6 +1,8 @@ #!/bin/sh -UTIL_BIN="$HOME/.wryn/bin/desktop" +source "$HOME/.config/wryn/env/env" + +UTIL_BIN="$DOTWRYN/bin/desktop" APP_BIN="$HOME/.config/wryn/default-applications" MEDIA__NEXT="$UTIL_BIN/youtube-music/next.sh" diff --git a/config/xserver/screenlayout/2020-sep-macbook/hdmidock.sh b/config/xorg/screenlayout/2020-sep-macbook/hdmidock.sh similarity index 100% rename from config/xserver/screenlayout/2020-sep-macbook/hdmidock.sh rename to config/xorg/screenlayout/2020-sep-macbook/hdmidock.sh diff --git a/config/xserver/screenlayout/2020-sep-macbook/hdmidock_game_resolution.sh b/config/xorg/screenlayout/2020-sep-macbook/hdmidock_game_resolution.sh similarity index 100% rename from config/xserver/screenlayout/2020-sep-macbook/hdmidock_game_resolution.sh rename to config/xorg/screenlayout/2020-sep-macbook/hdmidock_game_resolution.sh diff --git a/config/xserver/screenlayout/2020-sep-macbook/homedock_hdmionly.sh b/config/xorg/screenlayout/2020-sep-macbook/homedock_hdmionly.sh similarity index 100% rename from config/xserver/screenlayout/2020-sep-macbook/homedock_hdmionly.sh rename to config/xorg/screenlayout/2020-sep-macbook/homedock_hdmionly.sh diff --git a/config/xserver/screenlayout/2020-sep-macbook/undock.sh b/config/xorg/screenlayout/2020-sep-macbook/undock.sh similarity index 100% rename from config/xserver/screenlayout/2020-sep-macbook/undock.sh rename to config/xorg/screenlayout/2020-sep-macbook/undock.sh diff --git a/config/xserver/screenlayout/2020-sep-macbook/workdock.sh b/config/xorg/screenlayout/2020-sep-macbook/workdock.sh similarity index 100% rename from config/xserver/screenlayout/2020-sep-macbook/workdock.sh rename to config/xorg/screenlayout/2020-sep-macbook/workdock.sh diff --git a/config/xserver/screenlayout/2020-sep-macbook/workplus.sh b/config/xorg/screenlayout/2020-sep-macbook/workplus.sh similarity index 100% rename from config/xserver/screenlayout/2020-sep-macbook/workplus.sh rename to config/xorg/screenlayout/2020-sep-macbook/workplus.sh diff --git a/config/xserver/screenlayout/gamedock.sh b/config/xorg/screenlayout/gamedock.sh similarity index 100% rename from config/xserver/screenlayout/gamedock.sh rename to config/xorg/screenlayout/gamedock.sh diff --git a/config/xserver/screenlayout/hdmidock.sh b/config/xorg/screenlayout/hdmidock.sh similarity index 100% rename from config/xserver/screenlayout/hdmidock.sh rename to config/xorg/screenlayout/hdmidock.sh diff --git a/config/xserver/screenlayout/homedock.sh b/config/xorg/screenlayout/homedock.sh similarity index 100% rename from config/xserver/screenlayout/homedock.sh rename to config/xorg/screenlayout/homedock.sh diff --git a/config/xserver/screenlayout/tvdock.sh b/config/xorg/screenlayout/tvdock.sh similarity index 100% rename from config/xserver/screenlayout/tvdock.sh rename to config/xorg/screenlayout/tvdock.sh diff --git a/config/xserver/screenlayout/undock.sh b/config/xorg/screenlayout/undock.sh similarity index 100% rename from config/xserver/screenlayout/undock.sh rename to config/xorg/screenlayout/undock.sh diff --git a/config/xserver/set_randr_layout b/config/xorg/set_randr_layout similarity index 83% rename from config/xserver/set_randr_layout rename to config/xorg/set_randr_layout index 6b8af1d..5364028 100755 --- a/config/xserver/set_randr_layout +++ b/config/xorg/set_randr_layout @@ -1,6 +1,6 @@ #!/bin/zsh -source $HOME/.wryn/env/env.zsh -XSERVER_DIR="$DOTWRYN/config/xserver" +source "$HOME/.config/wryn/env/env" +XSERVER_DIR="$DOTWRYN/config/xorg" AT_HOME(){ xrandr -q | grep -q 'DP2-1 connected' && xrandr -q | grep -q '3840'; diff --git a/config/xserver/xinitrc b/config/xorg/xinitrc similarity index 80% rename from config/xserver/xinitrc rename to config/xorg/xinitrc index 5e5811e..12c19a5 100644 --- a/config/xserver/xinitrc +++ b/config/xorg/xinitrc @@ -1,5 +1,7 @@ #!/bin/sh +source "$HOME/.config/wryn/env/env" + X11_SCRIPTS='/etc/X11/xinit/xinitrc.d'; if [ -d $X11_SCRIPTS ] ; then for script in $(find "$X11_SCRIPTS" -name \*.sh); do @@ -14,6 +16,6 @@ CUSTOM_DMENU_COMMANDS="$HOME/.local/custom_dmenu" export PATH="$CUSTOM_DMENU_COMMANDS:$PATH" -"$HOME/.wryn/config/xserver/set_randr_layout" & +"$DOTWRYN/config/xorg/set_randr_layout" & exec i3; diff --git a/env/env b/env/env index f60bbfb..5fd09ea 100755 --- a/env/env +++ b/env/env @@ -1,3 +1,4 @@ +#!/bin/sh DOTWRYN="$HOME/.wryn" SCHOOL_PATH="$HOME/School" RD_PATH="$HOME/RentDynamics" @@ -8,5 +9,3 @@ PREFERRED_EDITOR=(vi vim) # plays audio files located throughout the system MEDIA_ENGINE="$(which canberra-gtk-play) -f" - -source "$LOCAL_OVERRIDES" diff --git a/env/env.vim b/env/env.vim index 58da98e..e550fe6 100644 --- a/env/env.vim +++ b/env/env.vim @@ -1,11 +1,15 @@ " -- RC Resources ----------------------------------------------- {{{ -let $RC_DIR=expand("$HOME/.wryn") -let $VIM_DIR=expand("$RC_DIR/vim") -let $WRYNVIMRC=expand("$VIM_DIR/rc.vim") +let $DOTWRYN=expand("$HOME/.wryn") +let $WRYNVIMPATH=expand("$DOTWRYN/vim") +let $WRYNVIMRC=expand("$WRYNVIMPATH/rc.vim") let $BASHRC=expand("$HOME/.bashrc") let $ZSHRC=expand("$HOME/.zshrc") " }}} +" -- Leader bindings -------------------------------------------- {{{ +let mapleader = "\\" +"let localmapleader = ',' (not used currently) +" }}} " -- Colorscheme Settings --------------------------------------- {{{ " favorites : tigrana-256-dark, codedark, lilydjwg_dark, up, skittles_autumn, @@ -19,7 +23,3 @@ let $COLORSCHEME="default" " set the webbrowser locally "let $WEBBROWSER="" " }}} - -" -- Local Environment Overrides -------------------------------- {{{ -source $HOME/.config/wryn/env.vim -" }}} diff --git a/setup b/setup index ca3cec6..399de3f 100755 --- a/setup +++ b/setup @@ -1,4 +1,19 @@ -#!/bin/bash +################################################################################ +### SETUP VERIFICATION ######################################################### +################################################################################ + +DOTWRYN_PATH="$(pwd)" +function CHECK_DIR() { + read -p "Is DOTWRYN.git installed at '$DOTWRYN_PATH'? [Yn] : " validate; + + case $validate in + [nN]* ) exit 1;; + * ) ;; + esac +} + +CHECK_DIR; # verify install detected correct location before continuing + ################################################################################ ### SHELL SETUP ################################################################ @@ -10,20 +25,35 @@ function SOURCE_DOTWRYN_RC { [ ! -f "$HOME/$HOME_RC" ] && touch "$HOME/$HOME_RC"; - grep -q '\.wryn' "$HOME/$HOME_RC" \ - && echo "already set up $HOME_RC" \ - || { - echo "source $WRYN_RC" >> "$HOME/$HOME_RC"; - echo "successfully set up $HOME_RC"; - } + grep "$WRYN_RC" "$HOME/$HOME_RC" && { + echo "already set up $HOME_RC"; + } || { + echo "source $WRYN_RC" >> "$HOME/$HOME_RC"; + echo "successfully set up $HOME_RC"; + } +} + +function ENV__SETUP_LOCAL_OVERRIDES() { + local DEFAULT_SHELL_ENV="$DOTWRYN_PATH/env/env" + local LOCAL_SHELL_ENV="$HOME/.config/wryn/env/env" + + local DEFAULT_VIM_ENV="$DOTWRYN_PATH/env/env.vim" + local LOCAL_VIM_ENV="$HOME/.config/wryn/env/env.vim" + + echo "source $DOTWRYN_PATH/env/env" > "$LOCAL_SHELL_ENV" + echo -e '\n#\n# ~/.wryn/env/env local overrides\n#\n' >> "$LOCAL_SHELL_ENV" + sed 's/[#]*\(.*\)/#\1/' $DEFAULT_SHELL_ENV >> "$LOCAL_SHELL_ENV" + + echo "source $DOTWRYN_PATH/env/env.vim" > "$LOCAL_VIM_ENV" + echo -e '\n"\n" ~/.wryn/env/env.vim local overrides\n"\n' >> "$LOCAL_VIM_ENV" + sed 's/["]*\(.*\)/"\1/' $DEFAULT_VIM_ENV >> "$LOCAL_VIM_ENV" } function SHELL__SETUP { - SOURCE_DOTWRYN_RC '.bashrc' '$HOME/.wryn/bash/rc' - which bash >/dev/null && "$HOME/.wryn/env/env.bash"; + SOURCE_DOTWRYN_RC '.bashrc' "$DOTWRYN_PATH/zsh/rc"; + SOURCE_DOTWRYN_RC '.zshrc' "$DOTWRYN_PATH/zsh/rc"; - SOURCE_DOTWRYN_RC '.zshrc' '$HOME/.wryn/zsh/rc'; - which zsh >/dev/null && "$HOME/.wryn/env/env.zsh"; + ENV__SETUP_LOCAL_OVERRIDES; } @@ -31,21 +61,8 @@ function SHELL__SETUP { ### VIM SETUP ################################################################## ################################################################################ -function VIM__SETUP_ENVIRONMENT_VARIABLES() { - VIM_ENV="$HOME/.config/wryn/env.vim"; - - [ ! -f "$VIM_ENV" ] && { - touch "$VIM_ENV"; - which google-chrome-stable \ - && echo 'let $WEBBROWSER="'$(which google-chrome-stable)'"' >> $VIM_ENV\ - || echo 'let $WEBBROWSER=""' >> $VIM_ENV; - } || { - echo 'vim environment variables already set up'; - } -} - function VIM__UPDATE_COLORSCHEMES() { - $HOME/.wryn/bin/vim/update_colorschemes + $DOTWRYN_PATH/bin/vim/update_colorschemes } function VIM__INSTALL_VUNDLE_PLUGINS() { @@ -60,15 +77,14 @@ function VIM__INSTALL_VUNDLE_PLUGINS() { vim +PluginInstall +qall; echo "building plugins" - $HOME/.wryn/bin/vim/rebuild_plugins; + $DOTWRYN_PATH/bin/vim/rebuild_plugins; } function VIM__SETUP() { echo 'setting up vim'; - SOURCE_DOTWRYN_RC '.vimrc' '$HOME/.wryn/vim/rc.vim'; + SOURCE_DOTWRYN_RC '.vimrc' "$DOTWRYN_PATH/vim/rc.vim"; - VIM__SETUP_ENVIRONMENT_VARIABLES; VIM__UPDATE_COLORSCHEMES; VIM__INSTALL_VUNDLE_PLUGINS; @@ -95,7 +111,7 @@ function CONFIG__SYMLINK() { local HOME_CONFIG_DIR="$HOME/.config/$CONFIG_DIR"; local HOME_CONFIG="$HOME_CONFIG_DIR/$FILENAME"; - local WRYN_CONFIG="$HOME/.wryn/config/$CONFIG_DIR/$FILENAME"; + local WRYN_CONFIG="$DOTWRYN_PATH/config/$CONFIG_DIR/$FILENAME"; [ ! -d "$HOME_CONFIG_DIR" ] && mkdir "$HOME_CONFIG_DIR"; @@ -105,7 +121,7 @@ function CONFIG__SYMLINK() { function CONFIG__I3() { CONFIG__SYMLINK "i3" "config"; - CONFIG__BASIC_SYMLINK "$HOME/.config/wryn/i3utils" "$HOME/.wryn/config/i3/utils"; + CONFIG__BASIC_SYMLINK "$HOME/.config/wryn/i3utils" "$DOTWRYN_PATH/config/i3/utils"; echo "linked i3 configuration"; } @@ -136,34 +152,34 @@ function CONFIG__KITTY() { echo "linked kitty configuration" } -function CONFIG__GIT() { - CONFIG__BASIC_SYMLINK "$HOME/.gitconfig" "$HOME/.wryn/config/git/gitconfig"; - echo "linked global git configuration" -} - -function CONFIG__PYLINT() { - CONFIG__BASIC_SYMLINK "$HOME/.config/pylintrc" "$HOME/.wryn/config/pylint/pylintrc"; - echo "linked pylint configuration" -} - function CONFIG__RIPGREP() { CONFIG__SYMLINK "ripgrep" "config" echo "linked ripgrep configuration" } +function CONFIG__GIT() { + CONFIG__BASIC_SYMLINK "$HOME/.gitconfig" "$DOTWRYN_PATH/config/git/gitconfig"; + echo "linked global git configuration" +} + +function CONFIG__PYLINT() { + CONFIG__BASIC_SYMLINK "$HOME/.config/pylintrc" "$DOTWRYN_PATH/config/pylint/pylintrc"; + echo "linked pylint configuration" +} + function CONFIG__TMUX() { - CONFIG__BASIC_SYMLINK "$HOME/.tmux.conf" "$HOME/.wryn/tmux/tmux.conf"; + CONFIG__BASIC_SYMLINK "$HOME/.tmux.conf" "$DOTWRYN_PATH/config/tmux/tmux.conf"; echo "linked tmux configuration" } function CONFIG__XINITRC() { - CONFIG__BASIC_SYMLINK "$HOME/.xinitrc" "$HOME/.wryn/config/xserver/xinitrc" + CONFIG__BASIC_SYMLINK "$HOME/.xinitrc" "$DOTWRYN_PATH/config/xorg/xinitrc" echo "linked xinitrc" } function CONFIG__TERMINFO() { echo "adding terminfo files" - for file in $(find "$HOME/.wryn/config/terminfo" -type f); do + for file in $(find "$DOTWRYN_PATH/config/terminfo" -type f); do tic -x $file >/dev/null 2>&1 || echo "failed to add $file" ; done } @@ -177,6 +193,7 @@ function CONFIG__SETUP() { CONFIG__MSSQLCLI; CONFIG__COMPTON; CONFIG__KITTY; + CONFIG__RIPGREP; CONFIG__GIT; CONFIG__PYLINT; @@ -192,21 +209,22 @@ function CONFIG__SETUP() { ################################################################################ function CLEAN_BACKUP() { - read -p "Clean backup files? [yN] : " yn; + read -p "Clean backup files? [Yn] : " yn; case $yn in - [Yy]* ) + [nN]* ) echo 'skipping cleanup';; + * ) echo 'cleaning backup files'; for file in $(find "$HOME/.config/" -name \*.bak 2>/dev/null); do rm $file && echo cleaned $file; done for file in $(find "$HOME" -maxdepth 1 -name .\*.bak 2>/dev/null); do rm $file && echo cleaned $file; done ;; - * ) echo 'skipping cleanup';; esac } [ ! -d "$HOME/.config" ] && mkdir "$HOME/.config"; [ ! -d "$HOME/.config/wryn" ] && mkdir "$HOME/.config/wryn"; +[ ! -d "$HOME/.config/wryn/env" ] && mkdir "$HOME/.config/wryn/env"; SHELL__SETUP; VIM__SETUP; diff --git a/vim/formatting.vim b/vim/formatting.vim index f4b6caf..f7470c5 100644 --- a/vim/formatting.vim +++ b/vim/formatting.vim @@ -63,7 +63,7 @@ augroup end " -- Format Override Layers ------------------------------ {{{ -source $VIM_DIR/rentdynamics.vim +source $WRYNVIMPATH/rentdynamics.vim " }}} diff --git a/vim/options.vim b/vim/options.vim index d941227..0b85943 100644 --- a/vim/options.vim +++ b/vim/options.vim @@ -14,7 +14,7 @@ set matchtime=0 " -- but don't jump to it. set t_ZH= t_ZR= " italic start / end characters -set spellfile=$VIM_DIR/en.utf-8.add spelllang=en +set spellfile=$WRYNVIMPATH/en.utf-8.add spelllang=en set encoding=utf-8 diff --git a/vim/rc.vim b/vim/rc.vim index d45bf79..006db3f 100644 --- a/vim/rc.vim +++ b/vim/rc.vim @@ -1,74 +1,68 @@ -" set the following environment variables: -" $RC_DIR $VIM_DIR $WRYNVIMRC $BASHRC $ZSHRC $WEBBROWSER -source $HOME/.wryn/env/env.vim +source $HOME/.config/wryn/env/env.vim if isdirectory(expand("$HOME/.vim/bundle/Vundle.vim")) - source $VIM_DIR/vundle.vim + source $WRYNVIMPATH/vundle.vim endif -source $VIM_DIR/options.vim -source $VIM_DIR/testing.vim -source $VIM_DIR/formatting.vim -source $VIM_DIR/abbreviations.vim -source $VIM_DIR/navigation.vim -source $VIM_DIR/color.vim +source $WRYNVIMPATH/options.vim +source $WRYNVIMPATH/testing.vim +source $WRYNVIMPATH/formatting.vim +source $WRYNVIMPATH/abbreviations.vim +source $WRYNVIMPATH/navigation.vim +source $WRYNVIMPATH/color.vim -let mapleader = "\\" -"let localmapleader = ',' +" -- Bindings --------------------------------------------------- {{{ -augroup personal_bindings -" {{{ +" to execute macro on q +nnoremap @q - " to execute macro on q - nnoremap @q +" Q to replace current line/selection with bash execution +vnoremap Q !$SHELL +nnoremap Q !!$SHELL - " Q to replace current line/selection with bash execution - vnoremap Q !$SHELL - nnoremap Q !!$SHELL - - " \q for `q:` - nnoremap q q: +" \q for `q:` +nnoremap q q: - " \s previous selection command - nnoremap s :'<,'> +" \s previous selection command +nnoremap s :'<,'> - " \f for fold - nnoremap f z - nnoremap f z +" \f for fold +nnoremap f z +nnoremap f z - " \j for J, but append current line to the line below - nnoremap j ddpkJ - - " move the current line one below where it is - nnoremap - :m +1 - nnoremap _ :m -2 +" \j for J, but append current line to the line below +nnoremap j ddpkJ - " \t for rerun last 'vimtest' command: - nnoremap t q:?vimtest +" move the current line one below where it is +nnoremap - :m +1 +nnoremap _ :m -2 - " \b for git blame - nnoremap b :set termwinsize=15*0:execute "terminal git blame -L " .eval(line(".")-5) . ",+10 %":set termwinsize& +" \t for rerun last 'vimtest' command: +nnoremap t q:?vimtest - " \d to insert formatted date before/after cursor - nnoremap di :let @d = system("date '+%A, %B %-d, %Y'")id - nnoremap da :let @d = system("date '+%A, %B %-d, %Y'")a d +" \b for git blame +nnoremap b :set termwinsize=15*0:execute "terminal git blame -L " .eval(line(".")-5) . ",+10 %":set termwinsize& - " - toggle casing for current word - inoremap viw~ea +" \d to insert formatted date before/after cursor +nnoremap di :let @d = system("date '+%A, %B %-d, %Y'")id +nnoremap da :let @d = system("date '+%A, %B %-d, %Y'")a d - " \c \v to copy/paste from xclip - " @TODO: learn how to freaking compile vim with x11 compatibility so these - " aren't necessary :) - vnoremap c :w !xclip - nnoremap v o!!xclip -o - nnoremap sc :'<,'>w !xclip +" - toggle casing for current word +inoremap viw~ea - " ------- available / rarely used bindings ------- +" \c \v to copy/paste from xclip +" @TODO: learn how to freaking compile vim with x11 compatibility so these +" aren't necessary :) +vnoremap c :w !xclip +nnoremap v o!!xclip -o +nnoremap sc :'<,'>w !xclip + +" ------- available / rarely used bindings ------- + +" nnoremap +" nnoremap +" nnoremap +" nnoremap z +" nnoremap ^ - " nnoremap - " nnoremap - " nnoremap - " nnoremap z - " nnoremap ^ " }}} -augroup end diff --git a/zsh/rc b/zsh/rc index 453f79a..d1f61af 100644 --- a/zsh/rc +++ b/zsh/rc @@ -1,21 +1,21 @@ #!/bin/zsh -source "$HOME/.wryn/env/env.zsh" - -RC_DIR="$DOTWRYN/zsh" -source "$DOTWRYN/zsh/config" +source "$HOME/.config/wryn/env/env" # --- load custom plugins ------------------------------------------ -for file in $(find $RC_DIR -maxdepth 1 -type f ! -name 'rc' ! -name 'config'); do source $file; done; +# zsh config : must load first for zsh-plugins to work +source "$DOTWRYN/zsh/config" + +for file in $(find "$DOTWRYN/zsh" -maxdepth 1 -type f ! -name 'rc' ! -name 'config'); do source $file; done; # operating system specific plugins case "$OSTYPE" in linux-gnu ) - for file in $(find $RC_DIR/linux -type f); do source $file; done; + for file in $(find "$DOTWRYN/zsh/linux" -type f); do source $file; done; ;; darwin* ) - for file in $(find $RC_DIR/osx -type f); do source $file; done; + for file in $(find "$DOTWRYN/zsh/osx" -type f); do source $file; done; ;; esac