From 691527468d31c7113cc052607867630e83d61dd9 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 23 Apr 2018 15:06:51 -0400 Subject: [PATCH] Drop support for misc Most of these files are covered by urbint/meta -- including the setup and bootstrap work. The remaining files are just obsolete and undesirable. --- aliases.sh | 115 ----- brew_packages.txt | 96 ----- clean_downloads_folder.sh | 5 - configs/shared/.emacs | 737 --------------------------------- configs/shared/.vimrc | 586 -------------------------- functions/git_functions.sh | 199 --------- functions/gpg_functions.sh | 48 --- functions/history_functions.sh | 29 -- functions/index.sh | 20 - functions/js_to_bash.sh | 29 -- functions/misc_functions.sh | 150 ------- functions/vim_functions.sh | 30 -- install_brew.sh | 21 - project_mgt.org | 3 - 14 files changed, 2068 deletions(-) delete mode 100644 aliases.sh delete mode 100644 brew_packages.txt delete mode 100755 clean_downloads_folder.sh delete mode 100644 configs/shared/.emacs delete mode 100644 configs/shared/.vimrc delete mode 100644 functions/git_functions.sh delete mode 100644 functions/gpg_functions.sh delete mode 100644 functions/history_functions.sh delete mode 100644 functions/index.sh delete mode 100644 functions/js_to_bash.sh delete mode 100644 functions/misc_functions.sh delete mode 100644 functions/vim_functions.sh delete mode 100755 install_brew.sh delete mode 100644 project_mgt.org diff --git a/aliases.sh b/aliases.sh deleted file mode 100644 index 7743e18de..000000000 --- a/aliases.sh +++ /dev/null @@ -1,115 +0,0 @@ -alias c="clear" -alias dir='find . -maxdepth 1 -type d -regex "\.\/[^.].+"' - - -# aliases with dependencies -command -v nvim >/dev/null && alias vim=nvim || \ - echo 'Missing dependency (nvim). Failed to alias vim -> nvim' -command -v find >/dev/null && alias find='find -E' || \ - echo 'Missing dependency (find -E). Failed to alias find -> find -E' -command -v egrep >/dev/null && alias grep=egrep || \ - echo 'Missing dependency (egrep). Failed to alias grep -> egrep' -command -v pygmentize >/dev/null && alias ccat='pygmentize -g' >/dev/null || \ - echo 'Missing dependency (pygmentize -g). Failed to alias ccat -> pygmentize -g' -command -v hub >/dev/null && alias git=hub || \ - echo 'Missing dependency (hub). Failed to alias git -> hub' -command -v tmux >/dev/null && alias tls='tmux list-sessions' || \ - echo 'Missing dependency (tmux). Failed to alias tls -> tmux list-sessions' -command -v gpg2 >/dev/null && alias gpg=gpg2 || \ - echo 'Missing dependency (gpg2). Failed to alias gpg -> gpg2' - - -# exa-specific aliases -if command -v exa >/dev/null || echo 'Missing dependency (exa). Failed to create dependent aliases.'; then - alias ls='exa' - alias ll='exa -l' - alias ll='ls -l' - alias la='exa -la' - alias la='ls -la' - - # tree-views of dirs and subdirs - function lt { - if [ -z $1 ]; then - exa --tree - else - depth=$1 - exa --tree --level ${depth} - fi - } -fi - - -if command -v kubectl >/dev/null; then - # kubernetes aliases - alias kpods='kubectl get pods' - alias kdeploys='kubectl get deployments' - - # the following functions rely on gcloud being installed - if command -v gcloud >/dev/null; then - function kswitch { - # environment should be "staging" or "public" - environment=$1 - gcloud container clusters get-credentials $environment - } - fi - - # kubernetes functions - function kedit { - deployment=$1 - kubectl edit deployments $deployment - } - - function kdns { - # Returns the domain names of the ingress points - kubectl get ing - } - - function kush { - name=$1 - cmd=${2-/bin/bash} - kubectl exec -it $name -- $cmd - } -fi - - -# git-specific aliases -git config --global alias.recent 'for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"' -git config --global alias.yday '! git log --name-only --since=yesterday.midnight --until=today.midnight --author="$(git config --get user.email)"' -git config --global alias.conflicts 'diff --name-only --diff-filter=U' -git config --global alias.patch-grep 'log -p -S' - -alias gyday='git log --name-only --since=yesterday.midnight --until=today.midnight --author="$(git config --get user.email)"' - -alias glp="git log --graph --pretty=format:'%Cred%h%Creset -%Cblue %an %Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" -alias gprom="git pull --rebase origin master" -alias gcan='git commit --amend --no-edit' -alias gpf='git push --force' -alias gpff='git push --force --no-verify' # aka git push fucking force -alias gds='git diff --staged' -alias gfx='git commit --fixup' -alias gsh='git show' - - -# elixir-specific aliases -alias m=mix -alias ism='iex -S mix' -alias tism='MIX_ENV=test iex -S mix' -alias mdg='mix deps.get' - - -# docker-specific aliases -if command -v docker >/dev/null; then - # personal aliases - alias d=docker - alias dps='docker ps' - alias drm='docker rm' - alias drmi='docker rmi' - alias drit='docker run -it' - alias drd='docker run -d' - alias di='docker images' - - function dsh { - container=$1 - docker exec -it "${container}" /bin/bash - } -fi diff --git a/brew_packages.txt b/brew_packages.txt deleted file mode 100644 index 5ae15c74f..000000000 --- a/brew_packages.txt +++ /dev/null @@ -1,96 +0,0 @@ -ack -autojump -bash-completion -bdw-gc -bind -cairo -chromedriver -cmatrix -coreutils -cowsay -cscope -curl -elixir -elm -emacs -epstool -erlang -fftw -fltk -fontconfig -freetype -fzf -gcc -gd -gdbm -gettext -ghostscript -giflib -gl2ps -glib -global -gmp -gnu-sed -gnupg -gnuplot -go -graphicsmagick -httpie -imagemagick -isl -jpeg -jq -json-c -libevent -libffi -libmpc -libpng -libsass -libstfl -libtiff -libtool -libyaml -little-cms2 -lua -macvim -mpfr -nethogs -newsbeuter -oniguruma -openssl -par -pcre -perl -pidof -pixman -pkg-config -plotutils -postgresql -pstoedit -pup -pyqt5 -python -python3 -qscintilla2 -qt5 -readline -reattach-to-user-namespace -recode -ruby -sassc -shc -sip -sqlite -szip -tbb -texinfo -tig -tmux -tree -vim -w3m -webp -wget -wxmac -xz -zsh-syntax-highlighting diff --git a/clean_downloads_folder.sh b/clean_downloads_folder.sh deleted file mode 100755 index d29570d71..000000000 --- a/clean_downloads_folder.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# delete files in ~/Downloads -rm -r ~/Downloads/* - diff --git a/configs/shared/.emacs b/configs/shared/.emacs deleted file mode 100644 index 8a8cccb34..000000000 --- a/configs/shared/.emacs +++ /dev/null @@ -1,737 +0,0 @@ -;;; William Carroll's Emacs configuration - - -;; From `https://github.com/melpa/melpa` -(require 'package) -(add-to-list 'package-archives - '("melpa" . "https://melpa.org/packages/") t) -(when (< emacs-major-version 24) - ;; For important compatibility libraries like cl-lib - (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))) -(package-initialize) - - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(ansi-color-faces-vector - [default bold shadow italic underline bold bold-italic bold]) - '(ansi-color-names-vector - ["#1B2229" "#ff6c6b" "#98be65" "#ECBE7B" "#51afef" "#c678dd" "#46D9FF" "#DFDFDF"]) - '(column-number-mode t) - '(custom-enabled-themes (quote (sanityinc-tomorrow-eighties))) - '(custom-safe-themes - (quote - ("c50a672a129e71b9362b209c63d4e203ccc88a388c370411535b8b54ecc878bc" "5310b88333fc64c0cb34a27f42fa55ce371438a55f02ac7a4b93519d148bd03d" "f67652440b66223b66a4d3e9c0ddeddbf4a6560182fa38693bdc4d940ce43a2e" "0f0022c8091326c9894b707df2ae58dd51527b0cf7abcb0a310fb1e7bda78cd2" "8d737627879eff1bbc7e3ef1e9adc657207d9bf74f9abb6e0e53a6541c5f2e88" "5c9bd73de767fa0d0ea71ee2f3ca6fe77261d931c3d4f7cca0734e2a3282f439" "628278136f88aa1a151bb2d6c8a86bf2b7631fbea5f0f76cba2a0079cd910f7d" "1b8d67b43ff1723960eb5e0cba512a2c7a2ad544ddb2533a90101fd1852b426e" "82d2cac368ccdec2fcc7573f24c3f79654b78bf133096f9b40c20d97ec1d8016" "06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a" "bb08c73af94ee74453c90422485b29e5643b73b05e8de029a6909af6a3fb3f58" "398e6465d45d5af4cbf94f8ebfb24deb71249f28cdfb4b0fa7197354ee0c9802" "db34c17b9a7810856352a341e15d701696fb4710fe7e0dab57b8268515c2b082" "ee93cac221c92b580bde1326209e1a327287cd49931ba319a9af7a7af201967c" "68f66d916f4e90f11f2dc815e9580c1aaf9e9c75eeee3fbd8b663d706e121a1a" "c158c2a9f1c5fcf27598d313eec9f9dceadf131ccd10abc6448004b14984767c" "cc0dbb53a10215b696d391a90de635ba1699072745bf653b53774706999208e3" "3e335d794ed3030fefd0dbd7ff2d3555e29481fe4bbb0106ea11c660d6001767" "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" "20e23cba00cf376ea6f20049022241c02a315547fc86df007544852c94ab44cb" "60d4556ebff0dc94849f177b85dcb6956fe9bd394c18a37e339c0fcd7c83e4a9" "707227acad0cf8d4db55dcf1e574b3644b68eab8aca4a8ce6635c8830bc72144" "1c656eb3f6ae6c84ced46282cb4ed697bffe2f6c764bb5a737ed7ca6d068f798" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" "c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "9f3181dc1fabe5d58bbbda8c48ef7ece59b01bed606cfb868dd147e8b36af97c" "ad1c2abad40e11d22156fe3987fd9b74b9e1c822264a07dacb24e0b3133aaed1" "945fe66fbc30a7cbe0ed3e970195a7ee79ee34f49a86bc96d02662ab449b8134" "0f0db69b7a75a7466ef2c093e127a3fe3213ce79b87c95d39ed1eccd6fe69f74" "08b8807d23c290c840bbb14614a83878529359eaba1805618b3be7d61b0b0a32" "9d91458c4ad7c74cf946bd97ad085c0f6a40c370ac0a1cbeb2e3879f15b40553" "6254372d3ffe543979f21c4a4179cd819b808e5dd0f1787e2a2a647f5759c1d1" "8ec2e01474ad56ee33bc0534bdbe7842eea74dccfb576e09f99ef89a705f5501" "5b24babd20e58465e070a8d7850ec573fe30aca66c8383a62a5e7a3588db830b" "eb0a314ac9f75a2bf6ed53563b5d28b563eeba938f8433f6d1db781a47da1366" "3d47d88c86c30150c9a993cc14c808c769dad2d4e9d0388a24fee1fbf61f0971" default))) - '(evil-shift-width 2) - '(fci-rule-color "#5B6268") - '(flycheck-color-mode-line-face-to-color (quote mode-line-buffer-id)) - '(jdee-db-active-breakpoint-face-colors (cons "#1B2229" "#51afef")) - '(jdee-db-requested-breakpoint-face-colors (cons "#1B2229" "#98be65")) - '(jdee-db-spec-breakpoint-face-colors (cons "#1B2229" "#3f444a")) - '(mouse-wheel-mode nil) - '(neo-window-fixed-size nil) - '(neo-window-width 35) - '(org-ellipsis "  ") - '(org-fontify-done-headline t) - '(org-fontify-quote-and-verse-blocks t) - '(org-fontify-whole-heading-line t) - '(package-selected-packages - (quote - (undo-tree solaire-mode smart-mode-line memoize async json-mode toml-mode git-timemachine rainbow-mode company-shell swiper ivy nlinum tabbar rainbow-delimiters s font-lock+ f diminish dash avy all-the-icons dired+ linum-off git markdown-mode yaml-mode haskell-mode color-theme-sanityinc-tomorrow graphql-mode flycheck-elm popup-kill-ring green-phosphor-theme green-screen-theme minimal-theme creamsody-theme autothemer solarized-theme avk-emacs-themes github-theme all-the-icons-dired ace-window yasnippet chess synonyms powerline doom-neotree doom-themes persp-mode use-package helm-projectile persp-projectile perspective projectile with-editor helm-core company helm-ag evil-leader flycheck-mix flycheck-elixir evil-matchit typescript-mode evil-surround erlang elixir-mode golden-ratio flycheck-credo flycheck command-log-mode atom-one-dark-theme exec-path-from-shell clues-theme gotham-theme dracula-theme zenburn-theme fill-column-indicator neotree evil vimrc-mode helm-ispell transpose-frame helm-ack nyan-mode alchemist helm dockerfile-mode elm-mode ack))) - '(popwin-mode t) - '(popwin:popup-window-height 25) - '(popwin:special-display-config - (quote - (help-mode - ("^*helm-.+*$" :regexp t) - ("^*helm .+*$" :regexp t) - ("^*helm-.+*$" :regexp t) - ("^*helm .+*$" :regexp t) - ("^*helm-.+*$" :regexp t) - ("^*helm .+*$" :regexp t) - ("^*helm-.+*$" :regexp t) - ("^*helm .+*$" :regexp t) - ("^*helm-.+*$" :regexp t) - ("^*helm .+*$" :regexp t) - ("^*helm-.+*$" :regexp t) - ("^*helm .+*$" :regexp t) - ("^*helm-.+*$" :regexp t) - ("^*helm .+*$" :regexp t) - ("^*helm .+*$" :regexp t) - ("*Miniedit Help*" :noselect t) - (completion-list-mode :noselect t) - (compilation-mode :noselect t) - (grep-mode :noselect t) - (occur-mode :noselect t) - ("*Pp Macroexpand Output*" :noselect t) - "*Shell Command Output*" "*vc-diff*" "*vc-change-log*" - (" *undo-tree*" :width 60 :position right) - ("^\\*anything.*\\*$" :regexp t) - "*slime-apropos*" "*slime-macroexpansion*" "*slime-description*" - ("*slime-compilation*" :noselect t) - "*slime-xref*" - (sldb-mode :stick t) - slime-repl-mode slime-connection-list-mode))) - '(tool-bar-mode nil) - '(vc-annotate-background "#1B2229") - '(vc-annotate-color-map - (list - (cons 20 "#98be65") - (cons 40 "#b4be6c") - (cons 60 "#d0be73") - (cons 80 "#ECBE7B") - (cons 100 "#e6ab6a") - (cons 120 "#e09859") - (cons 140 "#da8548") - (cons 160 "#d38079") - (cons 180 "#cc7cab") - (cons 200 "#c678dd") - (cons 220 "#d974b7") - (cons 240 "#ec7091") - (cons 260 "#ff6c6b") - (cons 280 "#cf6162") - (cons 300 "#9f585a") - (cons 320 "#6f4e52") - (cons 340 "#5B6268") - (cons 360 "#5B6268"))) - '(vc-annotate-very-old-color nil)) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(hl-line ((t (:inherit nil))))) - - -;; Avoid re-read from disk prompt after switching git branches -(global-auto-revert-mode t) - - -;; server stuff -(server-start) - - -;; File extensions and their associated major modes -(add-to-list 'auto-mode-alist '("\\.zsh_profile\\'" . shell-script-mode)) - - -;; Turn off line-wrapping (default) -(set-default 'truncate-lines t) -(setq truncate-partial-width-windows nil) - - -;; Window Auto-Balancing -(defadvice split-window-below (after restore-balanace-below activate) - (balance-windows)) - -(defadvice split-window-right (after restore-balance-right activate) - (balance-windows)) - -(defadvice delete-window (after restore-balance activate) - (balance-windows)) - - -;; Extend load-path -(add-to-list 'load-path "~/.emacs.d/wc-downloads") - - -;; Basic functions used within configuration -(load "~/.emacs.d/wc-helper-functions.el") - - -;; Extend linum to highlight current line numbers -(use-package hlinum - :ensure t - :config - (hlinum-activate)) - - -;; Extend linum to highlight current line numbers -(use-package git-timemachine - :ensure t - :config - (require 'evil) - (evil-make-overriding-map git-timemachine-mode-map 'normal t) - (add-hook 'git-timemachine-mode-hook #'evil-normalize-keymaps)) - - -;; Tabbed buffer support -(use-package tabbar - :ensure t - :init - (load "~/.emacs.d/wc-tabbar-functions.el") - :config - (setq tabbar-hide-header-button t) - (setq tabbar-use-images nil) - - (defun wc/conditionally-activate-tabbar () - (if (and (derived-mode-p 'prog-mode) - (not (string-match-p "*" (buffer-name)))) - (tabbar-local-mode -1) - (tabbar-local-mode 1))) - - (add-hook 'emacs-startup-hook #'wc/conditionally-activate-tabbar) - (add-hook 'after-change-major-mode-hook #'wc/conditionally-activate-tabbar) - - (tabbar-mode)) - - -;; Smart Mode Line -(use-package smart-mode-line - :ensure t - :config - (display-time) - (load-theme 'smart-mode-line-respectful) - (smart-mode-line-enable)) - - -;; Aesthetic tweaks -(use-package solaire-mode - :ensure t - :config - (add-hook 'after-change-major-mode-hook #'turn-on-solaire-mode) - (add-hook 'after-revert-hook #'turn-on-solaire-mode) - (add-hook 'minibuffer-setup-hook #'solaire-mode-in-minibuffer) - (add-hook 'dired-mode-hook #'solaire-mode)) - - -;; Colorized delimiters -(use-package rainbow-delimiters - :ensure t - :config - (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)) - - -;; Colorize Hex codes -(use-package rainbow-mode - :ensure t - :config - (add-hook 'css-mode-hook 'rainbow-mode)) - - -;; Colorscheme -(use-package doom-themes - :ensure t - :config - (setq doom-themes-enable-bold nil - doom-themes-enable-italic nil) - (load-theme 'doom-one) - (doom-themes-visual-bell-config) - (doom-themes-neotree-config) - (load "~/.emacs.d/wc-doom-functions.el")) - - -;; Nyan cat -(use-package nyan-mode - :ensure t - :config - (nyan-mode t)) - - -;; Man page viewing -(use-package man - :bind (:map Man-mode-map - ("j" . next-line) - ("k" . previous-line) - ("h" . backward-char) - ("l" . forward-char) - ("g" . beginning-of-buffer) - ("G" . end-of-buffer))) - - -;; ERC configuration (IRC in Emacs) -(use-package erc - :ensure t - :init - (setq erc-autojoin-channels-alist '(("freenode.net" "#emacs" "#elixir")))) - - -;; Disable fringes in Emacs -(fringe-mode 0) - - -;; Linum -(use-package linum - :init - (setq linum-disabled-modes-list '(term-mode dired-mode Man-mode org-mode emacs-pager-mode)) - :config - (require 'evil) - - (defun linum-on () - (if (or (memq major-mode linum-disabled-modes-list) - (minibufferp) - (and (string-match-p "*" (buffer-name)) - (not (string-match-p "*scratch*" (buffer-name))))) - (linum-mode -1) - (progn - (linum-mode nil) - (evil-local-mode)))) - (setq linum-format " %d ") - (global-linum-mode t)) - - -;; Command Log Mode -(use-package command-log-mode - :ensure t - :config - (setq-default command-log-mode-window-font-size 1) - (setq-default command-log-mode-window-size 40)) - - -;; Ace Window -(use-package ace-window - :ensure t - :config - (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))) - - -;; All-the-fonts -(use-package all-the-icons - :ensure t - :config - ;; (all-the-icons-install-fonts) - ) - - -;; Thesaurus -(use-package synonyms - :ensure t) - - -;; View stream of Emacs commands -(use-package command-log-mode - :ensure t - :commands (global-command-log-mode)) - - -;; Flycheck Settings -(use-package flycheck - :ensure t - :config - (setq flycheck-display-errors-delay 0.0)) - - -(defadvice term-sentinel (around my-advice-term-sentinel (proc msg)) - (if (memq (process-status proc) '(signal exit)) - (let ((buffer (process-buffer proc))) - ad-do-it - (kill-buffer-and-window)) - ad-do-it)) -(ad-activate 'term-sentinel) - - -;; Ansi-Term -(use-package term - :ensure t - :init - (setq explicit-shell-file-name "/bin/zsh") - :config - (add-hook 'term-mode-hook 'wc/bootstrap-ansi-term)) - - -;; Projectile Settings -(use-package projectile - :ensure t - :commands (projectile-mode)) - - -;; Dired Settings -(use-package dired - :init - (load "~/.emacs.d/wc-dired-functions.el") - :bind (:map dired-mode-map - ("C-p" . helm-ag-neotree-node) - ("e" . wdired-change-to-wdired-mode) - ("c" . find-file) - ("RET" . dired-find-alternate-file) - ("^" . wc/dired-up-directory)) - :config - (setq wdired-allow-to-change-permissions t)) - - -;; Dired-plus -(use-package dired+ - :ensure t - :init - (setq diredp-hide-details-initially-flag nil) - :config - ;; remove bindings that interfere with globally-set windmove bindings - (define-key dired-mode-map (kbd "C-h") nil) - (define-key dired-mode-map (kbd "C-j") nil) - (define-key dired-mode-map (kbd "C-k") nil) - (define-key dired-mode-map (kbd "C-l") nil)) - - -(defun wc/evil-window-split-down () - "Convenience function that does 3 things: 1. creates a horizontal split (downward),2. Center both the previous window and the newly created window,3. Moves (downward) to the newly created window." - (interactive) - (evil-window-split-down) - (call-interactively 'evil-window-up) - (call-interactively 'evil-scroll-line-to-center) - (call-interactively 'evil-window-down) - (call-interactively 'evil-scroll-line-to-center)) - - -(defun wc/evil-window-split () - "Convenience function that does 3 things: 1. creates a horizontal split (upward),2. Center both the previous window and the newly created window,3. Moves (upward) to the newly created window." - (interactive) - (evil-window-split) - (call-interactively 'evil-scroll-line-to-center) - (call-interactively 'evil-window-down) - (call-interactively 'evil-scroll-line-to-center) - (call-interactively 'evil-window-up)) - - -;; Evil Settings -(use-package evil - :ensure t - :commands (evil-mode local-evil-mode) - :bind (:map evil-visual-state-map - ("H" . evil-first-non-blank) - ("L" . evil-end-of-visual-line) - - :map evil-motion-state-map - ("" . nil) - ([tab] . nil) - ("SPC" . nil) - ("M-." . nil) - - :map evil-insert-state-map - ("C-k" . nil) - ("C-p" . nil) - ("C-n" . nil) - ("C-r" . nil) - ("C-t" . nil) - ("C-e" . nil) - ("C-a" . nil) - ("C-h" . evil-window-left) - ("C-l" . evil-window-right) - ("C-k" . evil-window-up) - ("C-j" . evil-window-down) - ("C-c" . term-interrupt-subjob) - - :map evil-normal-state-map - ("" . nil) - ([tab] . tabbar-forward-tab) - ([backtab] . tabbar-backward-tab) - ("K" . nil) - ("M-." . nil) - ("s" . nil) - ("C-p" . nil) - ("g c" . comment-or-uncomment-region) - ("s h" . evil-window-vsplit) - ("s l" . evil-window-vsplit-right) - ("s k" . wc/evil-window-split) - ("s j" . wc/evil-window-split-down) - ("H" . evil-first-non-blank) - ("L" . evil-end-of-line) - ("" . evil-window-increase-width) - ("" . evil-window-decrease-width) - ("" . evil-window-decrease-height) - ("" . evil-window-increase-height) - - :map evil-ex-map - ("tb" . alchemist-test-this-buffer) - ("tap" . alchemist-test-at-point) - ("lt" . alchemist-mix-rerun-last-test)) - :init - (global-evil-matchit-mode t) - (global-evil-surround-mode t) - (global-evil-leader-mode t) - :config - - (defadvice evil-write (around force-evil-write activate) - (set-buffer-modified-p t) - (save-buffer)) - - (setq evil-emacs-state-cursor '("VioletRed3" box)) - (setq evil-normal-state-cursor '("DeepSkyBlue2" box)) - (setq evil-visual-state-cursor '("orange" box)) - (setq evil-insert-state-cursor '("VioletRed3" bar)) - (setq evil-replace-state-cursor '("VioletRed3" bar)) - (setq evil-operator-state-cursor '("VioletRed3" hollow)) - (evil-ex-define-cmd (kbd "qb") 'kill-this-buffer) - - ;; center search results - (defadvice evil-search-next - (after center-evil-search-next activate) - (call-interactively 'evil-scroll-line-to-center)) - - (defadvice evil-search-previous - (after center-evil-search-previous activate) - (call-interactively 'evil-scroll-line-to-center)) - - (add-hook 'org-mode-hook 'evil-local-mode)) - - -;; Hack at the moment for extending the behavior of the jump to mark command -(evil-define-command evil-goto-mark-line (char) - "Go to line of marker denoted by CHAR." - :keep-visual t - :repeat nil - :type line - (interactive (list (read-char))) - (evil-goto-mark char) - (evil-first-non-blank) - (call-interactively 'evil-scroll-line-to-center)) - - -(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") - - -;; Evil Leader Settings -(use-package evil-leader - :ensure t - :commands (global-evil-leader-mode) - :config - (evil-leader/set-leader "") - (evil-leader/set-key - "[" 'flycheck-previous-error - "]" 'flycheck-next-error - "w" 'toggle-truncate-lines - "x" 'helm-M-x - "" 'wc/switch-to-mru-buffer - "a" 'ace-delete-window - "l" 'global-linum-mode - "s" 'ace-swap-window - "n" 'neotree-toggle-project-dir - "N" 'neotree-reveal-current-buffer - "t" 'alchemist-project-toggle-file-and-tests - "f" 'helm-projectile - "p" 'helm-projectile-ag - "d" 'dired-jump - "D" 'projectile-dired - "q" 'kill-this-buffer - "h" 'help - "i" 'helm-semantic-or-imenu - "b" 'helm-mini - "T" 'alchemist-mix-test-at-point - "B" 'alchemist-mix-test-this-buffer - "L" 'alchemist-mix-rerun-last-test - "z" 'wc/projectile-shell-pop - "g" 'git-timemachine - )) - - -;; Evil Match-it -(use-package evil-matchit - :ensure t - :commands (global-evil-matchit-mode)) - - -;; Evil Surround -(use-package evil-surround - :ensure t - :commands (global-evil-surround-mode)) - - -;; Flycheck Mix Settings -(use-package flycheck-mix - :ensure t - :init - (flycheck-mix-setup)) - - -;; Flycheck -(use-package flycheck - :ensure t - :config) - ;; (setq flycheck-display-errors-function 'ignore)) - - -;; Flycheck Credo Settings -(use-package flycheck-credo - :ensure t - :init - (flycheck-credo-setup)) - - -;; Popwin Settings -(use-package popwin - :ensure t - :config - (setq display-buffer-function 'popwin:display-buffer) - (setq helm-split-window-preferred-function 'ignore) - (push '("^\*helm-.+\*$" :regexp t) popwin:special-display-config)) - - -;; Alchemist Settings -(use-package alchemist - :ensure t - :config - (setq alchemist-mix-env "prod") - (setq alchemist-goto-elixir-source-dir "~/source_code/elixir/") - (setq alchemist-goto-erlang-source-dir "~/source_code/otp/")) - - -(add-hook 'erlang-mode-hook 'wc/custom-erlang-mode-hook) - - -;; NeoTree Settings -(use-package neotree - :ensure t - :bind (:map neotree-mode-map - ("j" . next-line) - ("k" . previous-line) - ("g" . beginning-of-buffer) - ("G" . end-of-buffer) - ("" . neotree-enter) - ([tab] . neotree-enter) - ("D" . neotree-delete-node) - ("R" . neotree-rename-node) - ("c" . neotree-create-node) - ("C-p" . helm-ag-neotree-node)) - :init - (hl-line-mode) - (setq neo-theme (if (display-graphic-p) 'icons 'arrow)) - (setq-default neo-show-hidden-files t)) - - -;; Whitespace Settings -(use-package whitespace - :ensure t - :commands (whitespace-mode) - :config - (setq whitespace-line-column 100) - (setq whitespace-style '(face lines-tail))) - - -;; Helm Settings -(use-package helm - :ensure t - :commands (helm-mode) - :bind (("M-x" . helm-M-x) - ("M-y" . helm-show-kill-ring) - ("C-x b" . helm-mini) - ("C-x f" . helm-projectile-switch-project) - ("C-x p" . helm-projectile-ag) - ("C-x C-f" . helm-find-files) - - :map helm-map - ("C-j" . helm-next-line) - ("C-k" . helm-previous-line) - ("C-z" . helm-select-action) - - :term-raw-map - ("M-x" . helm-M-x)) - :init - (setq helm-buffers-fuzzy-matching t) - (setq helm-recentf-fuzzy-match t) - (setq helm-semantic-fuzzy-match t) - (setq helm-imenu-fuzzy-match t) - (setq helm-locate-fuzzy-match t) - :config - (load "~/.emacs.d/wc-helm-functions.el")) - - -;; Helm Projectile Settings -(use-package helm-projectile - :ensure t) - - -;; Elm Mode -(use-package elm-mode - :config - (add-to-list 'company-backends 'company-elm)) - - -;; Company Settings -(use-package company - :bind ( - ("C-j" . company-select-next) - ("C-k" . company-select-previous)) - :config - (setq company-idle-delay 0)) - - -(add-hook 'after-init-hook 'global-whitespace-mode) -(add-hook 'after-init-hook 'global-hl-line-mode) -(add-hook 'after-init-hook 'global-flycheck-mode) -(add-hook 'after-init-hook 'global-company-mode) -(add-hook 'after-init-hook 'projectile-mode) -(add-hook 'after-init-hook 'helm-mode) -(add-hook 'before-save-hook 'delete-trailing-whitespace) - - -;; Scrolling Settings -(setq scroll-step 1) -(setq scroll-conservatively 10000) - - -;; Properly configure GUI Emacs to use $PATH values -(when (memq window-system '(mac ns)) - (exec-path-from-shell-initialize)) - - -;; Emacs autosave, backup, interlocking files -(setq auto-save-default nil) -(setq make-backup-files nil) -(setq create-lockfiles nil) - - -;; Automatically follow symlinks -(setq vc-follow-symlinks t) - - -;; Commenting / Uncommenting -(global-set-key (kbd "C-x C-;") 'comment-or-uncomment-region) - - -;; Window movements -(global-set-key (kbd "C-h") 'windmove-left) -(global-set-key (kbd "C-l") 'windmove-right) -(global-set-key (kbd "C-k") 'windmove-up) -(global-set-key (kbd "C-j") 'windmove-down) - - -;; Fullscreen settings -(setq ns-use-native-fullscreen nil) -(global-set-key (kbd "") 'toggle-frame-fullscreen) - - -;; General Settings -;; Hide the menu-bar -(if (string-equal system-type "gnu/linux") (menu-bar-mode -1) - (if (string-equal system-type "darwin") (setq ns-auto-hide-menu-bar t))) - - -;; Native App Settings -(tool-bar-mode -1) - -;; Disable GUI scrollbars -(when (display-graphic-p) - (scroll-bar-mode -1)) - -;; Use spaces instead of tabs -(setq-default indent-tabs-mode nil) - - -;; Change font settings -(if (string-equal system-type "gnu/linux") - (add-to-list 'default-frame-alist '(font . "Hack 9")) - (if (string-equal system-type "darwin") - (add-to-list 'default-frame-alist '(font . "Menlo 12")))) - - -;; Line Height -(setq-default line-spacing 4) - - -;; Default spaces indentation -(setq css-indent-offset 2) -(setq js-indent-level 2) -(setq sh-basic-offset 2) - - -;; Disable startup screen -(setq inhibit-startup-screen t) - - -;; Add transparency -(set-frame-parameter (selected-frame) 'alpha '(100 . 100)) -(add-to-list 'default-frame-alist '(alpha . (100 . 100))) -(put 'narrow-to-region 'disabled nil) -(put 'dired-find-alternate-file 'disabled nil) diff --git a/configs/shared/.vimrc b/configs/shared/.vimrc deleted file mode 100644 index 4fcd992ac..000000000 --- a/configs/shared/.vimrc +++ /dev/null @@ -1,586 +0,0 @@ -" -- BEGIN: Vundle config -- -set nocompatible " be iMproved, required -filetype off " required - -" set the runtime path to include Vundle and initialize -set rtp+=~/.vim/bundle/Vundle.vim -call vundle#begin() -" alternatively, pass a path where Vundle should install plugins -"call vundle#begin('~/some/path/here') - -" let Vundle manage Vundle, required -Plugin 'VundleVim/Vundle.vim' - -" The following are examples of different formats supported. -" Keep Plugin commands between vundle#begin/end. - -" Displays git information in airline. -Plugin 'tpope/vim-fugitive' - -" easier file navigation -Plugin 'tpope/vim-vinegar' - -" Displays git-tracked C*UD ops within gutter. -Plugin 'airblade/vim-gitgutter' - -" Fuzzy-finder -Plugin 'kien/ctrlp.vim' - -" Grep file contents -Plugin 'mileszs/ack.vim' - -" JS support -Plugin 'pangloss/vim-javascript' - -" Syntax Highlighting Support -Plugin 'lambdatoast/elm.vim' - -" Elixir Plugins -Plugin 'elixir-lang/vim-elixir' -Plugin 'slashmili/alchemist.vim' -Plugin 'powerman/vim-plugin-AnsiEsc' - -" TypeScript Plugins -Plugin 'rschmukler/typescript-vim' - -" Themes -Plugin 'sickill/vim-monokai' -Plugin 'altercation/vim-colors-solarized' -Plugin 'mhartington/oceanic-next' - -" Executes shell commands and pipes output into new Vim buffer. -Plugin 'sjl/clam.vim' - -" Multiple cursors for simultaneous edits. -" NOTE: use to run miltiple cursors not -Plugin 'terryma/vim-multiple-cursors' - -" Visualize buffers -Plugin 'vim-airline/vim-airline' -Plugin 'vim-airline/vim-airline-themes' - -" Visually align assignments -Plugin 'godlygeek/tabular' - -" Visually Highlight and comment code. -Plugin 'tpope/vim-commentary' - -" Macros for quotes, parens, etc. -Plugin 'tpope/vim-surround' - -" Allows Plugins to be repeated with `.` character -Plugin 'tpope/vim-repeat' - -" Pairs of mappings -Plugin 'tpope/vim-unimpaired' - -" LISPs support -Plugin 'guns/vim-sexp' -Plugin 'tpope/vim-sexp-mappings-for-regular-people' -let g:sexp_enable_insert_mode_mappings = 0 -let g:sexp_filetypes = '' - -" Seamlessly navigate Vim and Tmux with similar bindings. -Plugin 'christoomey/vim-tmux-navigator' - -" Async `:make` for code linting etc. -Plugin 'neomake/neomake' - -" Color pack -Plugin 'flazz/vim-colorschemes' - -" Dash integration (macOS only) -Plugin 'rizzatti/dash.vim' - -" Better buffer mgt than CtrlP -Plugin 'yegappan/mru' - -Plugin 'zanglg/nova.vim' - -" Emulates Emacs's Helm Swoop search -Plugin 'pelodelfuego/vim-swoop' - -" Fish Shell support -Plugin 'dag/vim-fish' - -" Gotham colorscheme -Plugin 'whatyouhide/vim-gotham' - -" Transparent encryption + decryption -Plugin 'jamessan/vim-gnupg' - -" Javascript auto-formatting -Plugin 'prettier/vim-prettier', { - \ 'do': 'yarn install', - \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown'] } - -" Support Org mode -Plugin 'jceb/vim-orgmode' - -call vundle#end() " required -filetype plugin indent on " required -" Put your non-Plugin stuff after this line -" -- END: Vundle config -- - - -" Maximize the current window -" Similar to Tmux mapping alt-z in my tmux.conf -nnoremap t% :tab sp - - -" Prettier configuration -let g:prettier#exec_cmd_async = 1 -" force Prettier to run on files even without the @format pragma -let g:prettier#autoformat = 0 -autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md PrettierAsync - - -" Basic settings -" Thin cursor on INSERT mode -if has('nvim') - let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1 -endif - -set number -set wrap! -set tabstop=2 -set expandtab -set shiftwidth=2 -set background=dark - -syntax enable -colorscheme material - -if has('termguicolors') - set termguicolors -endif - -if &term =~# '^screen' - let &t_8f = "\[38;2;%lu;%lu;%lum" - let &t_8b = "\[48;2;%lu;%lu;%lum" -endif - -set history=1000 -set undolevels=1000 - -set t_Co=255 - -" Support italics -highlight Comment cterm=italic - -" Changes to character. -let mapleader = " " - - -" Auto resize window splits -autocmd VimResized * wincmd = - - -" Neomake Settings -autocmd! BufWritePost * Neomake - -" Elixir linting -let g:neomake_elixir_credo_maker = { - \ 'exe': 'mix', - \ 'args': ['credo', 'list', '%:p', '--format=oneline'], - \ 'errorformat': - \ '%W[F] %. %f:%l:%c %m,' . - \ '%W[F] %. %f:%l %m,' . - \ '%W[R] %. %f:%l:%c %m,' . - \ '%W[R] %. %f:%l %m,' . - \ '%I[C] %. %f:%l:%c %m,' . - \ '%I[C] %. %f:%l %m,' . - \ '%-Z%.%#' - \ } - - -let g:neomake_elixir_enabled_makers = ['mix', 'credo'] - -augroup my_error_signs - au! - autocmd ColorScheme * hi NeomakeErrorSign ctermfg=203 guifg=#ff5f5f - autocmd ColorScheme * hi NeomakeWarningSign ctermfg=209 guifg=#ffaf00 - autocmd ColorScheme * hi NeomakeInfoSign ctermfg=183 guifg=#dfafff - autocmd ColorScheme * hi NeomakeMessageSign ctermfg=27 guifg=#0087ff -augroup END - - -let g:neomake_error_sign = { - \ 'text': '>>', - \ 'texthl': 'NeoMakeErrorSign', - \ } - -let g:neomake_warning_sign = { - \ 'text': '>>', - \ 'texthl': 'NeoMakeWarningSign', - \ } - -let g:neomake_info_sign = { - \ 'text': '>>', - \ 'texthl': 'NeoMakeInfoSign', - \ } - -let g:neomake_message_sign = { - \ 'text': '>>', - \ 'texthl': 'NeoMakeMessageSign', - \ } - -function! LocationPrevious() - try - lprev - catch /^Vim\%((\a\+)\)\=:E553/ - llast - endtry -endfunction - -function! LocationNext() - try - lnext - catch /^Vim\%((\a\+)\)\=:E553/ - lfirst - endtry -endfunction - -nnoremap [ :call LocationPrevious() -nnoremap ] :call LocationNext() - - -nnoremap h :noh - - -" Alchemist settings -let g:alchemist#elixir_erlang_src = '/usr/local/share/src' - - -" Airline Settings -" Enables the list of buffers. -let g:airline#extensions#tabline#enabled = 0 - -" Buffer numbers alongside files -let g:airline#extensions#tabline#buffer_nr_show = 0 - -" Shows the filename only. -let g:airline#extensions#tabline#fnamemod = ':t' - -" Allow glyphs in airline -let g:airline_powerline_fonts = 1 - -" Change Airline theme -let g:airline_theme = 'hybrid' - - -" Vim-Swoop Settings -" Edits colorscheme -let g:swoopHighlight = ["hi! link SwoopBufferLineHi Warning", "hi! link SwoopPatternHi Error"] - - -nnoremap :q - - -" Jump to buffers. -nmap :1b -nmap :2b -nmap :3b -nmap :4b -nmap :5b -nmap :6b -nmap :7b -nmap :8b -nmap :9b - - -" It's the twenty-first century...no swaps. -set noswapfile - - -" Allow visual tab completion in command mode -set wildmenu - - -" Show Vim commands as they're being input. -set showcmd - - -" Code folding -" set foldmethod=indent -" set foldnestmax=10 -" set nofoldenable -" set foldlevel=4 - - -" emulate ci" and ci' behavior -nnoremap ci( f(%ci( -nnoremap ci[ f[%ci[ - - -" extend functionality of & scrolling -nnoremap j -vnoremap j -nnoremap k -vnoremap k - - -" Opens all folds within the buffer -" nnoremap ZZ zR - -" Closes all folds within the buffer -" nnoremap zz zM - -" Opens all folds beneath the cursor -" NOTE: j is the character to go down -" nnoremap zJ zO - -" Opens single fold beneath the cursor -" NOTE: j is the character to go down -" nnoremap zj zo - -" Opens single fold beneath the cursor -" NOTE: k is the character to go down -" nnoremap zK zC - -" Opens single fold beneath the cursor -" NOTE: k is the character to go down -" nnoremap zk zc - - -" Lookup Dash word under cursor in Dash -nnoremap j :Dash - - -" Save shortcut -nnoremap :w - - -" Switch to MRU'd buffer -nnoremap - - -" Alternative MRU to CtrlP MRU -nnoremap b :MRU - - -" Supports mouse interaction. -set mouse=a - - -" Highlights matches during a search. -set hlsearch - -" Clear highlight -noremap / :nohlsearch - - -" backspace settings -set backspace=2 -set backspace=indent,eol,start - - -" Javascript specific variables -let g:javascript_plugin_jsdoc = 1 - -" GlobalListchars -set list -set listchars=tab:··,trail:·,nbsp:· - - -" Keeps everything concealed at all times. Even when cursor is on the word. -set conceallevel=1 -set concealcursor=nvic - - -" map jk to -inoremap jk - - -" Hybrid mode for Vim -inoremap I -inoremap A - -inoremap -inoremap - -inoremap -inoremap -inoremap -inoremap - - -" Manage Vertical and Horizontal splits -nnoremap sl :vsl -nnoremap sh :vs -nnoremap sj :spj -nnoremap sk :sp - - -" Delete (i.e. "close") the currently opened buffer -" TODO: unless it's a split window, which should be :q -nnoremap q :bdelete - - -" Set CtrlP runtime path -set runtimepath^=~/.vim/bundle/ctrlp.vim - - -" Pane movement -let g:tmux_navigator_no_mappings = 1 - -nnoremap :TmuxNavigateLeft -nnoremap :TmuxNavigateDown -nnoremap :TmuxNavigateUp -nnoremap :TmuxNavigateRight - -" May need redundant mappings bc of LISP plugin -nnoremap :TmuxNavigateLeft -nnoremap :TmuxNavigateDown -nnoremap :TmuxNavigateUp -nnoremap :TmuxNavigateRight - - -" make Y do what is intuitive given: -" D: deletes until EOL -" C: changes until EOL -" Y: (should) yank until EOL -nnoremap Y y$ - - -" scrolling and maintaing mouse position -" nnoremap j -" nnoremap k - - -" remap redo key that is eclipsed by `rotate` currently -nnoremap U :redo - - -" Define highlighting groups -" NOTE: The ANSII aliases for colors will change when iTerm2 settings are -" changed. -highlight InterestingWord1 ctermbg=Magenta ctermfg=Black -highlight InterestingWord2 ctermbg=Blue ctermfg=Black - -" h1 highlighting -nnoremap 1 :execute '2match InterestingWord1 /\<\>/' -nnoremap x1 :execute '2match none' -vnoremap 1 :execute '2match InterestingWord1 /\<\>/' - -" h2 highlighting -nnoremap 2 :execute '3match InterestingWord2 /\<\>/' -nnoremap x2 :execute '3match none' - -"clear all highlighted groups -nnoremap xx :execute '2match none' :execute '3match none' hh - - -" pasteboard copy & paste -nnoremap V"+y -vnoremap "+y - -inoremap "+pa -" nnoremap o"+p -vnoremap "+p - - -" Manage 80 char line limits -highlight OverLength1 ctermbg=Magenta ctermfg=Black -highlight OverLength2 ctermbg=LightMagenta ctermfg=Black -highlight OverLength3 ctermbg=White ctermfg=Black -" match OverLength3 /\%81v.\+/ -match OverLength2 /\%91v.\+/ -" match OverLength3 /\%101v.\+/ - - -" Toggle word-wrapping -nnoremap w :set wrap! - - -" Resize split to 10,20,...,100 chars -" Uncomment the next lines for support at those sizes. -" These bindings interfere with the highlight groups, however. -" Increases the width of a vertical split. -" nnoremap 1 :vertical resize 10 -" nnoremap 2 :vertical resize 20 -nnoremap 3 :vertical resize 30 -nnoremap 4 :vertical resize 40 -nnoremap 5 :vertical resize 50 -nnoremap 6 :vertical resize 60 -nnoremap 7 :vertical resize 70 -nnoremap 8 :vertical resize 80 -nnoremap 9 :vertical resize 90 -nnoremap 0 :vertical resize 100 - - -" Increases the height of a horizontal split. -nnoremap v1 :resize 5 -nnoremap v2 :resize 10 -nnoremap v3 :resize 15 -nnoremap v4 :resize 20 -nnoremap v5 :resize 25 -nnoremap v6 :resize 30 -nnoremap v7 :resize 35 -nnoremap v8 :resize 40 -nnoremap v9 :resize 45 -nnoremap v0 :resize 50 - - -" BOL and EOL -nnoremap H ^ -vnoremap H ^ -nnoremap L $ -vnoremap L $ - - -" Search for visually selected text -vnoremap // y/"N - - -" trim trailing whitespace on save -autocmd BufWritePre *.{js,py,tpl,less,html,ex,exs,txt} :%s/\s\+$//e - - -" Use .gitignore file to populate Ctrl-P -let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] - - -" Ignores dirs and files -let g:ctrlp_custom_ignore = { - \ 'dir': 'node_modules', - \ 'file': '\v\.(exe|dll|png|jpg|jpeg)$' -\} - - -" WIP: Run elixir tests on that line -" TODO: only register binding in *.exs? file extensions -nnoremap t :call ExTestToggle() - - -" Jumps from an Elixir module file to an Elixir test file. -fun! ExTestToggle() - if expand('%:e') == "ex" - - let test_file_name = expand('%:t:r') . "_test.exs" - let test_file_dir = substitute(expand('%:p:h'), "/lib/", "/test/", "") - let full_test_path = join([test_file_dir, test_file_name], "/") - - e `=full_test_path` - - elseif match(expand('%:t'), "_test.exs") != -1 - - let test_file_name = expand('%:t:r') - let offset_amt = strlen(test_file_name) - strlen("_test") - let module_file_name = strpart(test_file_name, 0, offset_amt) . ".ex" - let module_file_dir = substitute(expand('%:p:h'), "/test/", "/lib/", "") - let full_module_path = join([module_file_dir, module_file_name], "/") - - e `=full_module_path` - - endif -endfun - - -" Creates intermediate directories and file to match current buffer's filepath -fun! CreateNonExistingDirsAndFile() - ! echo "Creating directory..." && mkdir -p %:p:h && echo "Created directory." && echo "Creating file..." && touch %:t:p && echo "Created file." - - " Write the buffer to the recently created file. - w -endfun diff --git a/functions/git_functions.sh b/functions/git_functions.sh deleted file mode 100644 index afbc16c70..000000000 --- a/functions/git_functions.sh +++ /dev/null @@ -1,199 +0,0 @@ -# output current branch to STDOUT -function wgbranch { - cat ./.git/HEAD | perl -p -e 's/^ref:\srefs\/heads\/(.+)$/\1/g' -} - - -# edit git conflicts one-by-one -function vconflicts() { - $EDITOR $(git status --porcelain | awk '/^UU/ { print $2 }') -} - - -function git-tasks { - echo "fix - bug patching" - echo "refactor - changing structure; functionality remains unchanged" - echo "feat - introducing a new feature" - echo "style - updating UI / UX" - echo "chore - changing configuration, adding comments, etc" - echo "wip - placeholder tag signifying ongoing work" - echo "build - updating anything related to building and deploying" - echo "deps - updating related to project dependencies" - echo "docs - updating related to project documentation" -} - - -function git-discard { - option=$1 - - if [[ $option == '' ]]; then - echo "Please supply option: --staged, --unstaged, --untracked, or --all" - fi - - if [[ $option == '--all' ]]; then - git-discard --staged && git-discard --unstaged && git-discard --untracked - fi - - if [[ $option == '--staged' ]]; then - staged_files=$(git --no-pager diff --name-only --staged) - - echo -n "Discarding staged..." && - git reset HEAD $staged_files >/dev/null && - echo "done." - fi - - if [[ $option == '--unstaged' ]]; then - unstaged_files=$(git --no-pager diff --name-only) - - echo -n "Discarding unstaged..." && - git checkout -- $unstaged_files >/dev/null - echo "done." - fi - - if [[ $option == '--untracked' ]]; then - untracked_files=$(git ls-files --others --exclude-standard) - - echo -n "Discarding untracked..." - for file in $untracked_files; do - if [ -f $file ]; then - rm $file - else - rm -rf $file - fi - done - echo "done." - fi -} - - -function wgd { - input=$1 - git diff "./**/*/${input}*" -} - - -function wga { - input=$1 - git add "./**/*/${input}*" -} - - -# Outputs staged, unstaged, untracked files -# Similar to `git status` output but without the cruft -function wg-git-changed-files { - tracked_staged=$(wg-diff-tracked-staged) - tracked_unstaged=$(wg-diff-tracked-unstaged) - untracked_unstaged=$(wg-diff-untracked-unstaged) - - echo "${tracked_staged}\n${tracked_unstaged}\n${untracked_unstaged}" -} - -function wg-diff-tracked-staged { - git --no-pager diff --name-only --staged -} - -function wg-diff-tracked-unstaged { - git --no-pager diff --name-only -} - -function wg-diff-untracked-unstaged { - git ls-files --others --exclude-standard -} - - -# git status "plumbing" version -# Useful for piping into grep -> xargs git add -function wgst { - git status -s | awk '{ print $2 }' -} - - -# git add by file regex pattern -function wgadd { - pattern="$2" - - wgst | grep "${pattern}" | xargs git add -} - - -# compare file with another branch -function wgcompare_file { - file_path="$1" - compare_branch_a="master" - compare_branch_b="$(wgbranch)" - - git diff "${compare_branch_a}:${file_path}" "${compare_branch_b}:${file_path}" -} - - -# output the stash ticket number to STDOUT -function wgtix { - wgbranch | perl -p -e 's/(?:feature|bugfix|refactor)\/(\w+-\d+).+$/\1/' -} - - -# search for a git branch by ticket number -# useful when combined with `wgcheckout` -# e.g. -# $ wgcheckout "$(wgfind 1045)" -# checks-out feature/GDMX-1045 ... -# -# if the `TICKET_NO` cannot be found, it will return the current branch -function wgfind { - TICKET_NO="$1" - - BRANCHNAME=$(git branch | grep "$TICKET_NO" | perl -p -e 's/^\s*//') - - if [ -z $BRANCHNAME ]; then - BRANCHNAME="$(wgbranch)" - fi - - echo "$BRANCHNAME" -} - - -# wrapper fn for "git checkout" that exports previous branch to env -function wgcheckout { - if [ -z $1 ]; then - branchname="develop" - else - branchname="$1" - fi - - echo " -- wgcheckout -- " - echo "Storing branch \"$(wgbranch)\" in WGPREV ..." - export WGPREV="$(wgbranch)" - echo "Checking out \"$branchname\" ..." - echo - echo " -- git checkout -- " - git checkout "$branchname" - echo -} - - -# opens the current ticket-branch in web browser -function wgjira { - base_url="https://jira.hugeinc.com/browse" - ticket=$(wgtix) - - open "${base_url}/${ticket}" -} - - -# wgcheckout combined with a fuzzy search -function wgfcheckout { - branchname=$(trim $(git branch | fzf-tmux)) - - [ ! -z "$branchname" ] && wgcheckout "$branchname" || return -} - - -# View an author's work within a specified date range. -function wgviewcommits { - author=$([ -z "$1" ] && echo "William Carroll" || echo "$1") - todays_date=$(date +'%Y-%m-%d') - date=$([ -z "$2" ] && echo "${todays_date}" || echo "$2") - - git log --all --author="${author}" --after="${date} 00:00" \ - --before="${date} 23:59" -} diff --git a/functions/gpg_functions.sh b/functions/gpg_functions.sh deleted file mode 100644 index 92762a5bd..000000000 --- a/functions/gpg_functions.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env zsh - -# wip -function gpg-encrypt-dir() { - dirname=$1 - echo "Encrypting..." - tar -cz "$dirname" | gpg --symmetric --output "$dirname.tar.gz.gpg" - echo "Done." -} - - -# wip -function gpg-decrypt-dir() { - dirname=$1 - outdir=${dirname%.tar.gz.gpg} - - if [ -d "$outdir" ]; then - echo "Output directory, $outdir, already exists and will be overwritten by this command. Aborting..." - exit 1 - else - echo "Decrypting..." - gpg --decrypt $dirname | tar -xv - echo "Done." - fi - -} - - -# encrypts a file, appending a .gpg extension -# deletes the non-encrypted source -function gpg-encrypt-file() { - filename=$1 - echo "Encrypting..." && \ - gpg --symmetric ${filename} && \ - rm ${filename} && \ - echo "Done." -} - - -# decrypts a file -# deletes the original encrypted file with the .gpg extension -function gpg-decrypt-file() { - filename=$1 - echo "Decrypting..." && \ - gpg --decrypt ${filename} >"${filename%.gpg}" && \ - rm ${filename} && \ - echo "Done." -} diff --git a/functions/history_functions.sh b/functions/history_functions.sh deleted file mode 100644 index 5f97884b1..000000000 --- a/functions/history_functions.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - - -HISTFILE=~/.zsh_history - - -function wh_two_back { - command=$(history | tail -n 2 | head -n 1 | cut -c 8-) - echo -n $command -} - - -function wh_three_back { - command=$(history | tail -n 3 | head -n 1 | cut -c 8-) - echo -n "$command" -} - - -function wh_four_back { - command=$(history | tail -n 4 | head -n 1 | cut -c 8-) - echo -n "$command" -} - - -function wh_five_back { - command=$(history | tail -n 5 | head -n 1 | cut -c 8-) - echo -n "$command" -} - diff --git a/functions/index.sh b/functions/index.sh deleted file mode 100644 index a34fa0551..000000000 --- a/functions/index.sh +++ /dev/null @@ -1,20 +0,0 @@ -# custom js functions -source $HOME/pc_settings/functions/js_to_bash.sh - -# custom git functions -source $HOME/pc_settings/functions/git_functions.sh - -# custom bash helpers functions -source $HOME/pc_settings/functions/misc_functions.sh - -# custom history functions for zle bindkey -source $HOME/pc_settings/functions/history_functions.sh - -# custom functions to work with vim -source $HOME/pc_settings/functions/vim_functions.sh - -# custom functions to work with gpg -source $HOME/pc_settings/functions/gpg_functions.sh - -# custom functions for editing the ZSH line editor -source $HOME/pc_settings/functions/zle.sh diff --git a/functions/js_to_bash.sh b/functions/js_to_bash.sh deleted file mode 100644 index 22a70a556..000000000 --- a/functions/js_to_bash.sh +++ /dev/null @@ -1,29 +0,0 @@ -# js function syntax for bash - -function trimend { - LENGTH=${#1} - AMT=$2 - TAKE=$((LENGTH-AMT)) - echo $1 | cut "-c-$TAKE" -} - -function trimfront { - TMP0=$(echo $1 | rev) - TMP1=$(trimend $TMP0 $2 | rev) - echo $TMP1 -} - -function length { - echo ${#1} -} - -function slice { - start="$1" - end="$2" - string="$3" - echo "${string:${start}:${end}}" -} - -function setInterval { - eval "while true; do $1; sleep $2; done" -} diff --git a/functions/misc_functions.sh b/functions/misc_functions.sh deleted file mode 100644 index cc4f39318..000000000 --- a/functions/misc_functions.sh +++ /dev/null @@ -1,150 +0,0 @@ -# fuzzily-find-branch -function wgfb { - echo $(git branch -a | fzf-tmux) -} - - -# utility function for swapping filenames, eg init.el and init.el.bak -function swap-file-names { - file_a=$1 - file_b=$2 - backup=$(mktemp backup.XXX) - - mv ${file_a} ${backup} - mv ${file_b} ${file_a} - mv ${backup} ${file_b} - rm ${backup} - echo "Swapped: ${file_a} <-> ${file_b}" -} - - -# View a directory's contents in a periodically updated fashion. -function periodically-refresh-contents { - clear - lt . - sleep 1 - refresh-contents -} - - -# download files to /tmp directory -function wdownload { - URL="$1" - FILENAME="$(basename $URL)" - - wget -O /tmp/"$FILENAME" $URL >/dev/null && open /tmp && echo "Downloaded to: /tmp/$FILENAME" || echo "Error ..." -} - - -# spell checker -function wspcheck { - if [ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" - cat "$input" | tr '[:upper:]' '[:lower:]' | tr -cd '[:alpha:]_ \n' | tr -s ' ' '\n' | sort | comm -23 - ~/english_words.txt -} - - -# trims leading and trailing whitespace -function trim { - input="$1" - - echo "${input//[[:blank:]]/}" -} - - -# Extends `codemod` to exclude dirs in .gitignore file -function cm { - extensions="$1" - regex="$2" - replacement="$3" - - ignore_dirs="" - - if [ -f ./.gitignore ]; then - # Sanitizes .gitignore and converts it to a comma-separated list - ignore_dirs="$(sed 's/^\//.\//g' <./.gitignore | sed -e 's/#.*$//' -e '/^$/d' | tr '\n' ',' | sed 's/,$//')" - fi - - codemod -m -d . --extensions ${extensions} --exclude-paths ${ignore_dirs} ${regex} ${replacement} -} - - -function tt() { - sessionName="${1}" - if ! tmux has-session -t "${sessionName}" 2> /dev/null; then - oldTMUX="${TMUX}" - unset TMUX - tmux new -d -s "${sessionName}" - export TMUX="${oldTMUX}" - unset oldTMUX - fi - if [[ -n "${TMUX}" ]]; then - tmux switch-client -t "${sessionName}" - else - tmux attach -t "${sessionName}" - fi -} - - -# generates placeholder content for FE work -function lorem { - text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." - - echo $text -} - - -# generates lorem and adds to pasteboard -function loremcp { - lorem | pbcopy -} - - -# searches all PATH directories for a keyword -function wsearchpath { - echo $PATH | tr ':' '\n' | xargs -I {} find {} -type f -perm +111 -maxdepth 1 -name "*${1}*" -print | xargs basename -} - - -function ff { - # finds files smartly; using rg under-the-hood so blacklisted files are ignored - glob=$1 - rg -g "*$glob*" --files -} - - -# tests an internet connection -function is_online { - wget -q --spider "http://google.com" - - if [ $? -eq 0 ]; then - echo "Online" - return 0 - else - echo "Offline" - return 1 - fi -} - - -function du-it-live () { - # live updates the du information for the current directory - directory=$1 - - while true; do - du -hc $directory | tail -n 1 | tr -d '\n' && echo -n ' ' && sleep 0.5 - - # elipsis - echo -n '.' && sleep 0.5 && - echo -n '.' && sleep 0.5 && - echo -n '.' && sleep 0.5 && - - # clear the three-dots - echo -n '\b\b\b' && echo -n ' ' && echo -n '\r' - done -} - - -# programmatically get the router's IP address -function router { - netstat -nr | grep default | head -n 1 | awk '{ print $2 }' -} diff --git a/functions/vim_functions.sh b/functions/vim_functions.sh deleted file mode 100644 index 561695d20..000000000 --- a/functions/vim_functions.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# Easily search for strings within the files within the current directory. -# Specify file extensions and directories to exclude to improve accuracy. -# The file selected from fzf will be opened in vim. -function vfzopen() { - echo -n "Search Term: " - read search_query - echo -n "Filename: " - read filetype - echo -n "Exclude Directory: " - read exclude_dir - - if [ ! -z "$exclude_dirs" ]; then - filename=$(find . -type f -name "$filetype" | \ - xargs grep -l "$search_query" | fzf-tmux) - else - filename=$(find . -type f -name "$filetype" -not -path "./${exclude_dir}/*" \ - | xargs grep -l "$search_query" | fzf-tmux) - fi - - - if [ ! -z "$filename" ]; then - echo "$filename" - vim +/"$search_query" "$filename" - return 0 - else - return 1 - fi -} diff --git a/install_brew.sh b/install_brew.sh deleted file mode 100755 index a86f1a155..000000000 --- a/install_brew.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -echo "Installing Homebrew..." -$(which ruby) -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" -$(which ruby) -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -echo "Homebrew installed." -echo "" - -pushd "$HOME/pc_settings" - -# install brew dependencies -echo "Installing Homebrew packages..." -cat ./brew_packages.txt | xargs brew install -echo "Homebrew packages installed." -echo "" - -echo "Homebrew installed complete!" -echo "" - -popd - diff --git a/project_mgt.org b/project_mgt.org deleted file mode 100644 index 3c2d932e0..000000000 --- a/project_mgt.org +++ /dev/null @@ -1,3 +0,0 @@ -* Roadmap -** TODO Replace shell scripts with Python scripts -** TODO Create `brew cask' install file for OSX GUI applications