diff --git a/dotfiles/bashrc b/dotfiles/bashrc index b7483d7..3c5c877 100755 --- a/dotfiles/bashrc +++ b/dotfiles/bashrc @@ -40,3 +40,6 @@ if [ -f /etc/bash_completion ] && ! shopt -oq posix; then fi if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi + +# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. +export PATH="$PATH:$HOME/.rvm/bin" diff --git a/dotfiles/profile b/dotfiles/profile index e492c29..e6b103f 100755 --- a/dotfiles/profile +++ b/dotfiles/profile @@ -2,3 +2,6 @@ test -f "$HOME/.env" && . "$HOME/.env" test -f "${HOME}/.profile.local" && . "${HOME}/.profile.local" + +# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. +export PATH="$PATH:$HOME/.rvm/bin" diff --git a/dotfiles/zsh_custom/plugins/metasploit/metasploit.plugin.zsh b/dotfiles/zprezto_custom/.keep similarity index 100% rename from dotfiles/zsh_custom/plugins/metasploit/metasploit.plugin.zsh rename to dotfiles/zprezto_custom/.keep diff --git a/dotfiles/zsh_custom/plugins/jekyll/_jekyll b/dotfiles/zprezto_custom/jekyll/functions/_jekyll similarity index 100% rename from dotfiles/zsh_custom/plugins/jekyll/_jekyll rename to dotfiles/zprezto_custom/jekyll/functions/_jekyll diff --git a/dotfiles/zsh_custom/plugins/jekyll/jekyll.plugin.zsh b/dotfiles/zprezto_custom/jekyll/init.zsh similarity index 98% rename from dotfiles/zsh_custom/plugins/jekyll/jekyll.plugin.zsh rename to dotfiles/zprezto_custom/jekyll/init.zsh index 3565326..5cc1887 100644 --- a/dotfiles/zsh_custom/plugins/jekyll/jekyll.plugin.zsh +++ b/dotfiles/zprezto_custom/jekyll/init.zsh @@ -79,7 +79,7 @@ function jekyll { case "${1:-help}" in help|--help) command jekyll help - echo "Added by oh-my-zsh plugin:" + echo "Added by zsh plugin:" echo " draft Create a new draft post." echo " post Create a new post to publish immediately." echo " publish Publish a draft post by name." diff --git a/dotfiles/zprezto_custom/matir/functions/prompt_matir_setup b/dotfiles/zprezto_custom/matir/functions/prompt_matir_setup new file mode 100644 index 0000000..13ec1ba --- /dev/null +++ b/dotfiles/zprezto_custom/matir/functions/prompt_matir_setup @@ -0,0 +1,36 @@ +function prompt_matir_setup { + autoload -Uz add-zsh-hook + autoload -Uz vcs_info + autoload -Uz colors + + prompt_opts=(sp subst cr percent) + + colors + + add-zsh-hook precmd prompt_matir_precmd + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' check-for-changes true + zstyle ':vcs_info:*' formats ' (%b%u)' + zstyle ':vcs_info:*' stagedstr '*' + zstyle ':vcs_info:*' unstagedstr '*' + + # TODO: add virtualenv/rvm info + PROMPT='%{$fg[black]%}[%{$fg[yellow]%}%h%{$fg[black]%}] %{%(!.$fg[red].$fg[green])%}%8>..>%n%>>%{$fg[white]%}@%{$fg[blue]%}%12>..>%m%>>%{$fg[white]%}:%{$fg[green]%}%32<...<%~%<<%{$fg[blue]%}${vcs_info_msg_0_}%{$fg[white]%}%#%{$reset_color%} ' + + # Rprompt setup + local show_return="✘ " + # Default is to show the return value + if zstyle -T ':prezto:module:prompt' show-return-val; then + show_return+='%? ' + fi + RPROMPT='%(?:: %{$fg[red]%}' + RPROMPT+=${show_return} + RPROMPT+='%{$reset_color)%}' +} + +function prompt_matir_precmd { + vcs_info +} + +prompt_matir_setup "$@" diff --git a/dotfiles/zsh_custom/plugins/metasploit/_msfconsole b/dotfiles/zprezto_custom/xtra_completions/functions/_msfconsole similarity index 100% rename from dotfiles/zsh_custom/plugins/metasploit/_msfconsole rename to dotfiles/zprezto_custom/xtra_completions/functions/_msfconsole diff --git a/dotfiles/zsh_custom/plugins/metasploit/_msfvenom b/dotfiles/zprezto_custom/xtra_completions/functions/_msfvenom similarity index 100% rename from dotfiles/zsh_custom/plugins/metasploit/_msfvenom rename to dotfiles/zprezto_custom/xtra_completions/functions/_msfvenom diff --git a/dotfiles/zsh_custom/plugins/virsh/_virsh b/dotfiles/zprezto_custom/xtra_completions/functions/_virsh similarity index 100% rename from dotfiles/zsh_custom/plugins/virsh/_virsh rename to dotfiles/zprezto_custom/xtra_completions/functions/_virsh diff --git a/dotfiles/zpreztorc b/dotfiles/zpreztorc new file mode 100644 index 0000000..83fbfde --- /dev/null +++ b/dotfiles/zpreztorc @@ -0,0 +1,230 @@ +# +# Sets Prezto options. +# +# Authors: +# Sorin Ionescu +# + +# +# General +# + +# Set case-sensitivity for completion, history lookup, etc. +# zstyle ':prezto:*:*' case-sensitive 'yes' + +# Color output (auto set to 'no' on dumb terminals). +zstyle ':prezto:*:*' color 'yes' + +# Add additional directories to load prezto modules from +zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto_custom + +# Set the Zsh modules to load (man zshmodules). +# zstyle ':prezto:load' zmodule 'attr' 'stat' + +# Set the Zsh functions to load (man zshcontrib). +# zstyle ':prezto:load' zfunction 'zargs' 'zmv' + +# Set the Prezto modules to load (browse modules). +# The order matters. +zstyle ':prezto:load' pmodule \ + 'environment' \ + 'terminal' \ + 'editor' \ + 'history' \ + 'directory' \ + 'spectrum' \ + 'utility' \ + 'completion' \ + 'matir' \ + 'tmux' \ + 'git' \ + 'gpg' \ + 'python' \ + 'ruby' \ + 'history-substring-search' \ + 'jekyll' \ + 'prompt' \ + 'xtra_completions' + +# +# Autosuggestions +# + +# Set the query found color. +# zstyle ':prezto:module:autosuggestions:color' found '' + +# +# Completions +# + +# Set the entries to ignore in static */etc/hosts* for host completion. +# zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \ +# '0.0.0.0' '127.0.0.1' + +# +# Editor +# + +# Set the key mapping style to 'emacs' or 'vi'. +zstyle ':prezto:module:editor' key-bindings 'vi' + +# Auto convert .... to ../.. +# zstyle ':prezto:module:editor' dot-expansion 'yes' + +# +# Git +# + +# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. +# zstyle ':prezto:module:git:status:ignore' submodules 'all' + +# +# GNU Utility +# + +# Set the command prefix on non-GNU systems. +zstyle ':prezto:module:gnu-utility' prefix 'g' + +# +# History Substring Search +# + +# Set the query found color. +# zstyle ':prezto:module:history-substring-search:color' found '' + +# Set the query not found color. +# zstyle ':prezto:module:history-substring-search:color' not-found '' + +# Set the search globbing flags. +# zstyle ':prezto:module:history-substring-search' globbing-flags '' + +# +# OS X +# + +# Set the keyword used by `mand` to open man pages in Dash.app +# zstyle ':prezto:module:osx:man' dash-keyword 'manpages' + +# +# Pacman +# + +# Set the Pacman frontend. +# zstyle ':prezto:module:pacman' frontend 'yaourt' + +# +# Prompt +# + +# Set the prompt theme to load. +# Setting it to 'random' loads a random theme. +# Auto set to 'off' on dumb terminals. +zstyle ':prezto:module:prompt' theme 'matir' + +# Set the working directory prompt display length. +# By default, it is set to 'short'. Set it to 'long' (without '~' expansion) +# for longer or 'full' (with '~' expansion) for even longer prompt display. +# zstyle ':prezto:module:prompt' pwd-length 'short' + +# Set the prompt to display the return code along with an indicator for non-zero +# return codes. This is not supported by all prompts. +# zstyle ':prezto:module:prompt' show-return-val 'yes' + +# +# Ruby +# + +# Auto switch the Ruby version on directory change. +# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes' + +# +# Python +# + +# Auto switch the Python virtualenv on directory change. +# zstyle ':prezto:module:python:virtualenv' auto-switch 'yes' + +# Automatically initialize virtualenvwrapper if pre-requisites are met. +# zstyle ':prezto:module:python:virtualenv' initialize 'yes' + +# +# Screen +# + +# Auto start a session when Zsh is launched in a local terminal. +# zstyle ':prezto:module:screen:auto-start' local 'yes' + +# Auto start a session when Zsh is launched in a SSH connection. +# zstyle ':prezto:module:screen:auto-start' remote 'yes' + +# +# SSH +# + +# Set the SSH identities to load into the agent. +# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github' + +# +# Syntax Highlighting +# + +# Set syntax highlighters. +# By default, only the main highlighter is enabled. +# zstyle ':prezto:module:syntax-highlighting' highlighters \ +# 'main' \ +# 'brackets' \ +# 'pattern' \ +# 'line' \ +# 'cursor' \ +# 'root' +# +# Set syntax highlighting styles. +# zstyle ':prezto:module:syntax-highlighting' styles \ +# 'builtin' 'bg=blue' \ +# 'command' 'bg=blue' \ +# 'function' 'bg=blue' +# +# Set syntax pattern styles. +# zstyle ':prezto:module:syntax-highlighting' pattern \ +# 'rm*-rf*' 'fg=white,bold,bg=red' + +# +# Terminal +# + +# Auto set the tab and window titles. +# zstyle ':prezto:module:terminal' auto-title 'yes' + +# Set the window title format. +# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' + +# Set the tab title format. +# zstyle ':prezto:module:terminal:tab-title' format '%m: %s' + +# Set the terminal multiplexer title format. +# zstyle ':prezto:module:terminal:multiplexer-title' format '%s' + +# +# Tmux +# + +# Auto start a session when Zsh is launched in a local terminal. +zstyle ':prezto:module:tmux:auto-start' local 'no' + +# Auto start a session when Zsh is launched in a SSH connection. +zstyle ':prezto:module:tmux:auto-start' remote 'yes' + +# Integrate with iTerm2. +# zstyle ':prezto:module:tmux:iterm' integrate 'yes' + +# Set the default session name: +# zstyle ':prezto:module:tmux:session' name 'YOUR DEFAULT SESSION NAME' + +# +# Utility +# + +# Enabled safe options. This aliases cp, ln, mv and rm so that they prompt +# before deleting or overwriting files. Set to 'no' to disable this safer +# behavior. +zstyle ':prezto:module:utility' safe-ops 'no' diff --git a/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh b/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh deleted file mode 100644 index eeac10c..0000000 --- a/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh +++ /dev/null @@ -1,59 +0,0 @@ -# Custom plugin to handle gpg-agent 2.1 - -local GPG_ENV=$HOME/.gnupg/gpg-agent.env - -function start_agent_nossh { - eval $(/usr/bin/env gpg-agent --quiet --daemon --write-env-file ${GPG_ENV} 2> /dev/null) - test -f ${GPG_ENV} && chmod 600 ${GPG_ENV} - export GPG_AGENT_INFO -} - -function start_agent_withssh { - eval $(/usr/bin/env gpg-agent --quiet --daemon --enable-ssh-support --write-env-file ${GPG_ENV} 2> /dev/null) - test -f ${GPG_ENV} && chmod 600 ${GPG_ENV} - export GPG_AGENT_INFO - export SSH_AUTH_SOCK - export SSH_AGENT_PID -} - -if [ -z "${GPG_AGENT_INFO}" ] ; then - if which gpgconf >/dev/null 2>&1 ; then - GPG_AGENT_INFO=$(gpgconf --list-dirs agent-socket) - export GPG_AGENT_INFO - if [ -z "${SSH_AUTH_SOCK}" ] ; then - SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - export SSH_AUTH_SOCK - fi - fi -fi - -# check if another agent is running -if ! gpg-connect-agent --agent-program /dev/null --quiet /bye > /dev/null 2> /dev/null; then - # source settings of old agent, if applicable - if [ -f "${GPG_ENV}" ]; then - # This can be clobbered by the file - local OLD_SSH_AUTH_SOCK=${SSH_AUTH_SOCK} - . ${GPG_ENV} > /dev/null - export GPG_AGENT_INFO - export SSH_AUTH_SOCK - export SSH_AGENT_PID - fi - - # check again if another agent is running using the newly sourced settings - if ! gpg-connect-agent --agent-program /dev/null --quiet /bye > /dev/null 2> /dev/null; then - # check for existing ssh-agent - if [ -n "${OLD_SSH_AUTH_SOCK}" ] ; then - SSH_AUTH_SOCK=${OLD_SSH_AUTH_SOCK};export SSH_AUTH_SOCK - fi - if ssh-add -l > /dev/null 2> /dev/null; then - # ssh-agent running, start gpg-agent without ssh support - start_agent_nossh; - else - # otherwise start gpg-agent with ssh support - start_agent_withssh; - fi - fi -fi - -GPG_TTY=$(tty) -export GPG_TTY diff --git a/dotfiles/zsh_custom/themes/matir.zsh-theme b/dotfiles/zsh_custom/themes/matir.zsh-theme deleted file mode 100644 index 684c5ea..0000000 --- a/dotfiles/zsh_custom/themes/matir.zsh-theme +++ /dev/null @@ -1,7 +0,0 @@ -PROMPT='%{$fg[black]%}[%{$fg[yellow]%}%h%{$fg[black]%}] %{%(!.$fg[red].$fg[green])%}%8>..>%n%>>%{$fg[white]%}@%{$fg[blue]%}%12>..>%m%>>%{$fg[white]%}:%{$fg[green]%}%32<...<%~%<<%{$fg[magenta]%}$(virtualenv_prompt_info)%{$fg[blue]%}$(git_prompt_info)%{$fg[white]%}%#%{$reset_color%} ' -ZSH_THEME_GIT_PROMPT_PREFIX=" (" -ZSH_THEME_GIT_PROMPT_SUFFIX=")" -ZSH_THEME_VIRTUALENV_PREFIX=" (py:" -ZSH_THEME_VIRTUALENV_SUFFIX=")" - -# vim: set textwidth=0 wrapmargin=0: diff --git a/dotfiles/zshrc b/dotfiles/zshrc index cd4c7f1..1e2d50b 100755 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -28,16 +28,9 @@ else alias ls='ls -G' fi -# Load oh-my-zsh -if [ -d $HOME/.oh-my-zsh ] ; then - ZSH=$HOME/.oh-my-zsh - ZSH_THEME="matir" - ZSH_CUSTOM="$HOME/.zsh_custom" - plugins=(encode64 gpg-agent pep8 pip python tmux urltools extract sudo virsh virtualenv jekyll metasploit gcloud safe-paste) - test -f /usr/share/virtualenvwrapper/virtualenvwrapper.sh && plugins+=(virtualenvwrapper) - source $ZSH/oh-my-zsh.sh - unset ZSH_THEME - unset ZSH_CUSTOM +# Load prezto +if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then + source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" fi # .profile is universal @@ -80,3 +73,6 @@ function start_esp { export PATH="${PATH}:${HOME}/tools/esp/xtensa-esp32-elf/bin" export IDF_PATH="${HOME}/tools/esp/esp-idf" } + +# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. +export PATH="$PATH:$HOME/.rvm/bin" diff --git a/dotfiles/zsh_custom/plugins/gcloud/gcloud.plugin.zsh b/dotfiles/zshrc.d/gcloud.zsh similarity index 100% rename from dotfiles/zsh_custom/plugins/gcloud/gcloud.plugin.zsh rename to dotfiles/zshrc.d/gcloud.zsh diff --git a/install.sh b/install.sh index 26f5700..bce75e6 100755 --- a/install.sh +++ b/install.sh @@ -40,7 +40,7 @@ prerequisites() { esac ;; esac - install_git https://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh + install_git --recursive https://github.com/sorin-ionescu/prezto.git $HOME/.zprezto else echo "ZSH not found!" >&2 fi