diff options
author | Blaise Thompson <blaise@untzag.com> | 2018-07-03 18:00:32 -0500 |
---|---|---|
committer | Blaise Thompson <blaise@untzag.com> | 2018-07-03 18:00:32 -0500 |
commit | f94b9b632630175c589fdd73b8648bd00af64a1e (patch) | |
tree | 3f6efa14b765489c4d938377ed94a706c958bdde | |
parent | f972585b1ce8c6f29320f157cdd711277b3f5c33 (diff) |
2018-07-03 18:00
-rw-r--r-- | bash/bashrc.sync | 94 | ||||
-rw-r--r-- | direnv/direnvrc | 18 | ||||
-rw-r--r-- | emacs/init.el | 7 | ||||
-rwxr-xr-x | link.sh | 3 |
4 files changed, 119 insertions, 3 deletions
diff --git a/bash/bashrc.sync b/bash/bashrc.sync index 842211a..199e206 100644 --- a/bash/bashrc.sync +++ b/bash/bashrc.sync @@ -1,4 +1,4 @@ -export PS1="\[\033[01;32m\]\u@\h \W \\$ \[$(tput sgr0)\]\[\033[0m\]" +# --- environment variables ----------------------------------------------------------------------- export VISUAL=vim export EDITOR="$VISUAL" @@ -14,6 +14,98 @@ alias ledger-checking='ledger register checking --tail 15' alias ledger-worth='ledger bal ^assets ^liabilities' + +# --- prompt command ------------------------------------------------------------------------------ + + +_bash_prompt_config() { + + local USER_SYMBOL="\u" + local HOST_SYMBOL="\h" + local ESC_OPEN="\[" + local ESC_CLOSE="\]" + + if tput setaf >/dev/null 2>&1 ; then + _setaf () { tput setaf "$1" ; } + local RESET="${ESC_OPEN}$( { tput sgr0 || tput me ; } 2>/dev/null )${ESC_CLOSE}" + local BOLD="$( { tput bold || tput md ; } 2>/dev/null )" + else + # Fallback + _setaf () { echo "\033[0;$(($1+30))m" ; } + local RESET="\033[m" + local BOLD="" + ESC_OPEN="" + ESC_CLOSE="" + fi + + # Normal colors + local BLACK="${ESC_OPEN}$(_setaf 0)${ESC_CLOSE}" + local RED="${ESC_OPEN}$(_setaf 1)${ESC_CLOSE}" + local GREEN="${ESC_OPEN}$(_setaf 2)${ESC_CLOSE}" + local YELLOW="${ESC_OPEN}$(_setaf 3)${ESC_CLOSE}" + local BLUE="${ESC_OPEN}$(_setaf 4)${ESC_CLOSE}" + local VIOLET="${ESC_OPEN}$(_setaf 5)${ESC_CLOSE}" + local CYAN="${ESC_OPEN}$(_setaf 6)${ESC_CLOSE}" + local WHITE="${ESC_OPEN}$(_setaf 7)${ESC_CLOSE}" + + # Bright colors + local BRIGHT_GREEN="${ESC_OPEN}$(_setaf 10)${ESC_CLOSE}" + local BRIGHT_YELLOW="${ESC_OPEN}$(_setaf 11)${ESC_CLOSE}" + local BRIGHT_BLUE="${ESC_OPEN}$(_setaf 12)${ESC_CLOSE}" + local BRIGHT_VIOLET="${ESC_OPEN}$(_setaf 13)${ESC_CLOSE}" + local BRIGHT_CYAN="${ESC_OPEN}$(_setaf 14)${ESC_CLOSE}" + local BRIGHT_WHITE="${ESC_OPEN}$(_setaf 15)${ESC_CLOSE}" + + # Bold colors + local BLACK_BOLD="${ESC_OPEN}${BOLD}$(_setaf 0)${ESC_CLOSE}" + local RED_BOLD="${ESC_OPEN}${BOLD}$(_setaf 1)${ESC_CLOSE}" + local GREEN_BOLD="${ESC_OPEN}${BOLD}$(_setaf 2)${ESC_CLOSE}" + local YELLOW_BOLD="${ESC_OPEN}${BOLD}$(_setaf 3)${ESC_CLOSE}" + local BLUE_BOLD="${ESC_OPEN}${BOLD}$(_setaf 4)${ESC_CLOSE}" + local VIOLET_BOLD="${ESC_OPEN}${BOLD}$(_setaf 5)${ESC_CLOSE}" + local CYAN_BOLD="${ESC_OPEN}${BOLD}$(_setaf 6)${ESC_CLOSE}" + local WHITE_BOLD="${ESC_OPEN}${BOLD}$(_setaf 7)${ESC_CLOSE}" + + # Expose the variables we need in prompt command + P_USER=${BRIGHT_GREEN}${USER_SYMBOL} + P_HOST=${CYAN}${HOST_SYMBOL} + P_WHITE=${WHITE_BOLD} + P_BLUE=${BLUE_BOLD} + P_GREEN=${YELLOW_BOLD} + P_YELLOW=${GREEN_BOLD} + P_RED=${RED} + P_RESET=${RESET} + +} + +_bash_prompt_config +unset _bash_prompt_config + +parse_git_branch() { + local OUT=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` + if [ "$OUT" != "" ]; then echo "$OUT"; fi +} + +bash_prompt_command() { + # conda + if [ "$CONDA_DEFAULT_ENV" != "" ]; + then + P_CONDA="conda@$CONDA_DEFAULT_ENV " + else + P_CONDA="" + fi + # git + if [ "$(parse_git_branch)" != "" ]; + then + P_GIT="git@$(parse_git_branch) " + else + P_GIT="" + fi + # construct + export PS1="${P_YELLOW}\u@\h ${P_GREEN}${P_CONDA}${P_RED}${P_GIT}${P_BLUE}\W ${P_YELLOW}\\$ ${P_RESET}" +} +PROMPT_COMMAND=bash_prompt_command + # --- functions ----------------------------------------------------------------------------------- function countdown(){ diff --git a/direnv/direnvrc b/direnv/direnvrc new file mode 100644 index 0000000..f3dad9e --- /dev/null +++ b/direnv/direnvrc @@ -0,0 +1,18 @@ +load_conda() { + source "$1/etc/profile.d/conda.sh" +} + +## The list of available conda installs + +load_database_conda() { + load_conda /home/blaise/miniconda3 +} + +## The list of environments + +activate_conda() { + load_database_conda + conda activate $1 + echo "entering into conda environment" $1 + conda env list +} diff --git a/emacs/init.el b/emacs/init.el index dc9dead..7b2f37b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -27,6 +27,7 @@ (use-package evil-leader :ensure t :config + (evil-leader/set-leader "<SPC>") (global-evil-leader-mode) ) (use-package evil @@ -60,7 +61,9 @@ (use-package org :ensure t ) -(use-package org-brain +(setq org-todo-keywords '((sequence "TODO" "WAITING" "|" "DONE" "DELEGATED" "CANCELED"))) +(setq org-tags-column -99) +(use-package org-brain :ensure t :init (setq org-brain-path "~/brain") @@ -178,5 +181,5 @@ (evil-leader/set-key "s" 'check-next-spelling-error) (evil-leader/set-key "t" 'color-theme-tomorrow-night) (evil-leader/set-key "T" 'color-theme-tomorrow) -(evil-leader/set-key "x" 'helm-M-x) +(evil-leader/set-key "<SPC>" 'helm-M-x) (evil-leader/set-key "," 'other-window) @@ -23,6 +23,9 @@ function link-file(){ # bash link-file $HERE/bash/bashrc.sync ~/.bashrc.sync +# direnv +link-file $HERE/direnv/direnvrc ~/.config/direnv/direnvrc + # dunst link-file $HERE/dunst/dunstrc ~/.config/dunst/dunstrc |