From 8134556e58a4ebf325c2b2dca067675558806f99 Mon Sep 17 00:00:00 2001 From: Trevor Merritt Date: Sat, 24 Jul 2021 14:35:06 -0400 Subject: [PATCH] Ready to install. --- .gitmodules | 3 + bash_logout => bash/bash_logout | 0 bin/git-current-branch | 5 + git/gitconfig | 33 ++++++ gitconfig | 3 - install | 4 +- install.conf.yaml | 20 +++- plugins/dotbot-git/.gitignore | 129 ++++++++++++++++++++++++ plugins/dotbot-git/README.md | 82 +++++++++++++++ plugins/dotbot-git/git.py | 173 ++++++++++++++++++++++++++++++++ postgres/psqlrc | 28 ++++++ ssh/config | 79 --------------- tmux/tmux.conf | 24 +++++ zsh/configs/colour.zsh | 6 ++ zsh/configs/editor.zsh | 2 + zsh/configs/history.zsh | 6 ++ zsh/configs/post/completion.zsh | 15 +++ zsh/configs/prompt.zsh | 14 +++ zsh/zshenv | 29 ++++++ zsh/zshrc | 146 +++++++++++++++++++++++++++ 20 files changed, 713 insertions(+), 88 deletions(-) rename bash_logout => bash/bash_logout (100%) create mode 100644 bin/git-current-branch create mode 100644 git/gitconfig delete mode 100644 gitconfig create mode 100644 plugins/dotbot-git/.gitignore create mode 100644 plugins/dotbot-git/README.md create mode 100644 plugins/dotbot-git/git.py create mode 100644 postgres/psqlrc create mode 100644 tmux/tmux.conf create mode 100644 zsh/configs/colour.zsh create mode 100644 zsh/configs/editor.zsh create mode 100644 zsh/configs/history.zsh create mode 100644 zsh/configs/post/completion.zsh create mode 100644 zsh/configs/prompt.zsh create mode 100644 zsh/zshenv create mode 100644 zsh/zshrc diff --git a/.gitmodules b/.gitmodules index 1af14d0..b578bd7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = dotbot url = https://github.com/anishathalye/dotbot ignore = dirty +[submodule "dotbot-git"] + path = plugins/dotbot-git + url = https://github.com/DrDynamic/dotbot-git.git diff --git a/bash_logout b/bash/bash_logout similarity index 100% rename from bash_logout rename to bash/bash_logout diff --git a/bin/git-current-branch b/bin/git-current-branch new file mode 100644 index 0000000..49c4c07 --- /dev/null +++ b/bin/git-current-branch @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +git rev-parse --abbrev-ref HEAD diff --git a/git/gitconfig b/git/gitconfig new file mode 100644 index 0000000..2191fa9 --- /dev/null +++ b/git/gitconfig @@ -0,0 +1,33 @@ +[user] + email = trevor.merritt@gmail.com + name = Trevor Merritt +[init] + defaultBranch = main + templatedir = ~/.git_template +[push] + default = current +[color] + ui = auto +[alias] + aa = add --all + ap = add --patch + branches = for-each-ref --sort=-committerdate --format=\"%(color:blue)%(authordate:relative)\t%(color:red)%(authorname)\t%(color:white)%(color:bold)%(refname:short)\" refs/remotes + ci = commit -v + co = checkout + pf = push --force-with-lease + st = status +[core] + excludesfile = ~/.gitignore + autocrlf = input +[merge] + ff = only +[commit] + template = ~/.gitmessage +[fetch] + prune = true +[rebase] + autosquash = true +[include] + path = ~/.gitconfig.local +[diff] + colorMoved = zebra diff --git a/gitconfig b/gitconfig deleted file mode 100644 index b1e0fb9..0000000 --- a/gitconfig +++ /dev/null @@ -1,3 +0,0 @@ -[user] - email = trevor.merritt@gmail.com - name = Trevor Merritt diff --git a/install b/install index 5a7e72c..9284a2d 100755 --- a/install +++ b/install @@ -12,4 +12,6 @@ cd "${BASEDIR}" git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive git submodule update --init --recursive "${DOTBOT_DIR}" -"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}" +"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}" \ + -p ${BASEDIR}/plugins/dotbot-git/git.py \ + diff --git a/install.conf.yaml b/install.conf.yaml index c9629d2..809ff0d 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -1,10 +1,20 @@ - clean: ['~'] - +- defaults: + link: + relink: true - link: - ~/.bash_logout: bash_logout - ~/.gitconfig: gitconfig + # Bash + ~/.bash_logout: ./bash/bash_logout + # Git + ~/.gitconfig: ./git/gitconfig + # SSH ~/.ssh/config: path: ssh/config create: true - - + # ZSH + ~/.zshrc: ./zsh/zshrc + ~/.zshenv: ./zsh/zshenv + # Postgres + ~/.psqlrc: ./postgres/psqlrc + # tmux + ~/.tmux.conf: ./tmux/tmux.conf diff --git a/plugins/dotbot-git/.gitignore b/plugins/dotbot-git/.gitignore new file mode 100644 index 0000000..b6e4761 --- /dev/null +++ b/plugins/dotbot-git/.gitignore @@ -0,0 +1,129 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ diff --git a/plugins/dotbot-git/README.md b/plugins/dotbot-git/README.md new file mode 100644 index 0000000..5e8db3b --- /dev/null +++ b/plugins/dotbot-git/README.md @@ -0,0 +1,82 @@ +[dotbot_repo]: https://github.com/anishathalye/dotbot + +## Dotbot ```git``` Plugin + +Plugin for [Dotbot][dotbot_repo], that adds ```git``` directive, which allows you to clone or pull git repositories. + +## Installation + +1. Simply add this repo as a submodule of your dotfiles repository: +``` +git submodule add https://github.com/DrDynamic/dotbot-git.git +``` + +2. Pass this folder (or directly git.py file) path with corresponding flag to your [Dotbot][dotbot_repo] script: + - ```-p /path/to/file/git.py``` + + or + + - ```--plugin-dir /pato/to/plugin/folder``` + +## Requirements + +This plugin needs git 2.22 or later to be installes. + +Also please note, that this plugin clones repositories direcly into the given path. +No subfolders are created! + +## Properties + +| Name | Description | Required | +| --- | --- | --- | +| url | The URL to the remote repository | Required | +| branch | The branch to checkout after clone (or pull) | optional | +| commit | The commit to checkout after clone (or pull) | optional | +| method | Either clone, pull or clone-or-pull (see **Supported methods**) | optional | +| description | The description of the Repository (only for log output) | optional | + +### Supported methods + +| Method | Description | +| --- | --- | +| clone | Just clone the repository and checkout the configured branch / commit. Ignore that entry if that is alredy done.| +| pull | Just pull the existing directory. Failes if the directory doesn't exist or isnt a git repository | +| clone-or-pull | DEFAULT - Clones the repository if it doesnt exist or pulls changes if it does. | + +## Supported task variants + + + +```yaml +... +- git: + '/local/path/to/clone/to': + url: + branch: + commit: + method: + description: + ... +... +``` + +## Usage + +### Example config +```yaml +... +- git: + '~/.oh-my-zsh/custom/plugins/zsh-autosuggestions': + url: 'https://github.com/zsh-users/zsh-autosuggestions' + description: 'oh my zsh - autosuggestions' + '~/.oh-my-zsh/custom/themes/powerlevel10k': + url: 'https://github.com/romkatv/powerlevel10k.git' + description: 'oh my zsh - powerlevel10k' + ... +... +``` + +### Execution +```bash +"~/.dotfiles/bin/dotbot" -d "~/.dotfiles" -c "~/.dotfiles/packages.yaml" -p "~/.dotfiles/plugins/dotbot-git/git.py" +``` diff --git a/plugins/dotbot-git/git.py b/plugins/dotbot-git/git.py new file mode 100644 index 0000000..27dc204 --- /dev/null +++ b/plugins/dotbot-git/git.py @@ -0,0 +1,173 @@ +import subprocess, dotbot, os + +from pprint import PrettyPrinter + +class DotbotGit(dotbot.Plugin): + _directive = 'git' + + def can_handle(self, directive): + return self._directive == directive + + def handle(self, directive, data): + if directive != self._directive: + raise ValueError('git cannot handle directive %s' % + directive) + success = True + for clone_path in data: + repo_definition = data[clone_path] + + repo = self.Repository(self._log) + repo.path = os.path.expanduser(clone_path) + if 'url' in repo_definition: + repo.url = repo_definition['url'] + else: + success = False + self._log.error('Failed to clone repository! (no url specified)') + continue + if 'branch' in repo_definition: + repo.branch = repo_definition['branch'] + if 'commit' in repo_definition: + repo.commit = repo_definition['commit'] + if 'method' in repo_definition: + if repo_definition['method'] in ['clone', 'pull', 'clone-or-pull']: + repo.method = repo_definition['method'] + else: + self._log.warning('Method '+repo_definition['method'] + +'is not defined! (Will be ignored...)') + if 'description' in repo_definition: + repo.description = repo_definition['description'] + + if not repo.load(): + success = False + return success + + class Repository: + path=None + url=None + branch=None + commit=None + method='clone-or-pull' + description=None + + _log = None + + def __init__(self, _log): + self._log = _log + + def load(self): + method = None + + # check the load method to use + if self.method == 'clone': + method = 'clone' + if self.method == 'pull': + method = 'pull' + if self.method == 'clone-or-pull': + if self._repo_exists(): + method = 'pull' + else: + method = 'clone' + + # sanity checks + if method == 'clone': + if self._repo_exists(): + method = None + self._log.lowinfo("Repository already exists! Won't clone " + self._get_description()) + if method == 'pull': + if not self._repo_exists(): + method = None + self._log.error("Repository doesn't exist! Woun't pull " + self._get_description()) + + # loading + success = True + if method == 'clone': + success = self._clone() + + self._log.lowinfo('Cloned ' + self._get_description()) + elif method == 'pull': + success = self._pull() + + self._log.lowinfo('Pulled ' + self._get_description()) + if self.branch is not None: + current_branch = self._get_current_branch() + if current_branch != self.branch: + self._checkout('branch') + + if self.commit is not None: + current_commit = self._get_current_commit() + if current_commit != self.commit: + self.checkout('commit') + return success + + def _clone(self): + if not os.path.isdir(self.path): + os.makedirs(self.path) + + command = 'git clone --quiet ' + command += self.url + ' ' + self.path + + return self._run_command(command) + + def _pull(self): + + command = 'git --work-tree="' + self.path + '"' + command += ' --git-dir="' + self.path + '/.git"' + command += ' pull --quiet' + + return self._run_command(command) + + def _checkout(self, source='branch'): + if source == 'branch': + if self.branch is None: + return True + goto = self.branch + if source == 'commit': + if self.commit is None: + return True + goto = self.commit + + command = 'git --work-tree="'+self.path+'"' + command += ' --git-dir="'+self.path+'/.git"' + command += ' checkout --quiet --force ' + goto + + return self._run_command(command) + + def _get_current_commit(self): + p = subprocess.Popen( + ['git --git-dir="'+self.path+'/.git" rev-parse HEAD'], + shell=True, + stdout=subprocess.PIPE) + output = p.communicate()[0].decode() + if p.returncode == 0: + return output.strip() + return False + + def _get_current_branch(self): + p = subprocess.Popen( + ['git --git-dir="' + self.path + '/.git" branch --show-current'], + shell=True, + stdout=subprocess.PIPE) + output = p.communicate()[0].decode() + if p.returncode == 0: + return output.strip() + return False + + def _run_command(self, command): + try: + subprocess.run( + [command], + shell=True, + check=True) + return True + except subprocess.CalledProcessError: + self._log.error('git command failed...') + return False + + def _repo_exists(self): + return os.path.isdir(os.path.join(self.path, '.git')) + + def _get_description(self): + if self.description is None: + return 'into ' + self.path + else: + return self.description diff --git a/postgres/psqlrc b/postgres/psqlrc new file mode 100644 index 0000000..0c536c1 --- /dev/null +++ b/postgres/psqlrc @@ -0,0 +1,28 @@ +-- Official docs: http://www.postgresql.org/docs/9.3/static/app-psql.html +-- Unofficial docs: http://robots.thoughtbot.com/improving-the-command-line-postgres-experience + +-- Don't display the "helpful" message on startup. +\set QUIET 1 +\pset null '[NULL]' + +-- http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-PROMPTING +\set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# ' +-- PROMPT2 is printed when the prompt expects more input, like when you type +-- SELECT * FROM. %R shows what type of input it expects. +\set PROMPT2 '[more] %R > ' + +-- Show how long each query takes to execute +\timing + +-- Use best available output format +\x auto +\set VERBOSITY verbose +\set HISTFILE ~/.psql_history- :DBNAME +\set HISTCONTROL ignoredups +\set COMP_KEYWORD_CASE upper +\unset QUIET + +-- psql can't check for a file's existence, so we'll provide an empty local +-- file that users can override with their custom dotfiles. To set your own +-- personal settings, place your own file in ~/.psqlrc.local +\i ~/.psqlrc.local \ No newline at end of file diff --git a/ssh/config b/ssh/config index 81b1bdd..82f0944 100644 --- a/ssh/config +++ b/ssh/config @@ -1,93 +1,14 @@ Host 192.168.0.141 KexAlgorithms diffie-hellman-group-exchange-sha1 -Host localdev - HostName 192.168.122.246 -Host config.ptbo.achi.tech - HostName config.ptbo.achi.tech -Host 172.24.4.126 - HostName 172.24.4.126 - User root -Host 172.24.4.160 - HostName 172.24.4.160 - User tmerritt -Host 172.24.4.124 - HostName 172.24.4.124 Host git.pyrocode.xyz Port 2222 IdentitiesOnly yes IdentityFile ~/.ssh/id_rsa # entry generated by okteto -Host phoneorders.okteto - ForwardAgent yes - HostName localhost - Port 36087 - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto" -# entry generated by okteto -Host orchard.okteto - ForwardAgent yes - HostName localhost - Port 40245 - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto" -# entry generated by okteto -Host orchardui.okteto - ForwardAgent yes - HostName localhost - Port 43873 - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto" -# entry generated by okteto -Host lilith-server.okteto - ForwardAgent yes - HostName localhost - Port 2222 - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto" -# entry generated by okteto -Host lilith-server-dev.okteto - ForwardAgent yes - HostName localhost - Port 33583 - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto" -# entry generated by okteto -Host devserverlilith.okteto - ForwardAgent yes - HostName localhost - Port 46367 - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto" -# entry generated by okteto -Host dev-server-lilith.okteto - ForwardAgent yes - HostName localhost - Port 36799 - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto" Host 172.24.4.115 HostName 172.24.4.115 User tmerritt -Host 172.24.4.225 - HostName 172.24.4.225 -Host 172.24.4.222 - HostName 172.24.4.222 Host 10.1.24.115 HostName 10.1.24.115 User tmerritt # entry generated by okteto -Host devlilith.okteto - ForwardAgent yes - PubkeyAcceptedKeyTypes +ssh-rsa - HostName localhost - Port 43405 - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto" diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..a9cf402 --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,24 @@ +# improve colors +set -g default-terminal 'screen-256color' + +# start window numbers at 1 to match keyboard order with tmux window order +set -g base-index 1 +set-window-option -g pane-base-index 1 + +# renumber windows sequentially after closing any of them +set -g renumber-windows on + +# soften status bar color from harsh green to light gray +set -g status-style bg='#666666',fg='#aaaaaa' + +# remove administrative debris (session name, hostname, time) in status bar +set -g status-left '' +set -g status-right '' + +# increase scrollback lines +set -g history-limit 10000 + +# prefix -> back-one-character +bind-key C-b send-prefix +# prefix-2 -> forward-incremental-history-search +bind-key C-s send-prefix -2 diff --git a/zsh/configs/colour.zsh b/zsh/configs/colour.zsh new file mode 100644 index 0000000..07fcb6b --- /dev/null +++ b/zsh/configs/colour.zsh @@ -0,0 +1,6 @@ +# makes color constants available +autoload -U colors +colors + +# enable colored output from ls, etc. on FreeBSD-based systems +export CLICOLOR=1 diff --git a/zsh/configs/editor.zsh b/zsh/configs/editor.zsh new file mode 100644 index 0000000..9be92fa --- /dev/null +++ b/zsh/configs/editor.zsh @@ -0,0 +1,2 @@ +export VISUAL=nano +export EDITOR=$VISUAL \ No newline at end of file diff --git a/zsh/configs/history.zsh b/zsh/configs/history.zsh new file mode 100644 index 0000000..b5b2d16 --- /dev/null +++ b/zsh/configs/history.zsh @@ -0,0 +1,6 @@ +setopt hist_ignore_all_dups inc_append_history +HISTFILE=~/.zhistory +HISTSIZE=4096 +SAVEHIST=4096 + +export ERL_AFLAGS="-kernel shell_history enabled" \ No newline at end of file diff --git a/zsh/configs/post/completion.zsh b/zsh/configs/post/completion.zsh new file mode 100644 index 0000000..32bf8b8 --- /dev/null +++ b/zsh/configs/post/completion.zsh @@ -0,0 +1,15 @@ + +# load our own completion functions +fpath=(~/.zsh/completion /usr/local/share/zsh/site-functions $fpath) + +# completion; use cache if updated within 24h +autoload -Uz compinit +if [[ -n $HOME/.zcompdump(#qN.mh+24) ]]; then + compinit -d $HOME/.zcompdump; +else + compinit -C; +fi; + +# disable zsh bundled function mtools command mcd +# which causes a conflict. +compdef -d mcd diff --git a/zsh/configs/prompt.zsh b/zsh/configs/prompt.zsh new file mode 100644 index 0000000..91b3db5 --- /dev/null +++ b/zsh/configs/prompt.zsh @@ -0,0 +1,14 @@ +# modify the prompt to contain git branch name if applicable +git_prompt_info() { + current_branch=$(git current-branch 2> /dev/null) + if [[ -n $current_branch ]]; then + echo " %{$fg_bold[green]%}$current_branch%{$reset_color%}" + fi +} + +setopt promptsubst + +# Allow exported PS1 variable to override default prompt. +if ! env | grep -q '^PS1='; then + PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# ' +fi \ No newline at end of file diff --git a/zsh/zshenv b/zsh/zshenv new file mode 100644 index 0000000..0cefcc8 --- /dev/null +++ b/zsh/zshenv @@ -0,0 +1,29 @@ +local _old_path="$PATH" + +# Local config +[[ -f ~/.zshenv.local ]] && source ~/.zshenv.local + +if [[ $PATH != $_old_path ]]; then + # `colors` isn't initialized yet, so define a few manually + typeset -AHg fg fg_bold + if [ -t 2 ]; then + fg[red]=$'\e[31m' + fg_bold[white]=$'\e[1;37m' + reset_color=$'\e[m' + else + fg[red]="" + fg_bold[white]="" + reset_color="" + fi + + cat <&2 +${fg[red]}Warning:${reset_color} your \`~/.zshenv.local' configuration seems to edit PATH entries. +Please move that configuration to \`.zshrc.local' like so: + ${fg_bold[white]}cat ~/.zshenv.local >> ~/.zshrc.local && rm ~/.zshenv.local${reset_color} + +(called from ${(%):-%N:%i}) + +MSG +fi + +unset _old_path \ No newline at end of file diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..1a043d2 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,146 @@ + + +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="/home/tmerritt/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work) +# See https://github.com/ohmyzsh/ohmyzsh/issues/5765 +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions + if [[ -n $SSH_CONNECTION ]]; then + export EDITOR='nano' + else + export EDITOR='nano' + fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" +# load custom executable functions + + +for function in ~/.zsh/functions/*; do + source $function +done + +# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post +# these are loaded first, second, and third, respectively. +_load_settings() { + _dir="$1" + if [ -d "$_dir" ]; then + if [ -d "$_dir/pre" ]; then + for config in "$_dir"/pre/**/*~*.zwc(N-.); do + . $config + done + fi + + for config in "$_dir"/**/*(N-.); do + case "$config" in + "$_dir"/(pre|post)/*|*.zwc) + : + ;; + *) + . $config + ;; + esac + done + + if [ -d "$_dir/post" ]; then + for config in "$_dir"/post/**/*~*.zwc(N-.); do + . $config + done + fi + fi +} +_load_settings "$HOME/.zsh/configs" + +# Local config +[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local + +# aliases +[[ -f ~/.aliases ]] && source ~/.aliases