aboutsummaryrefslogtreecommitdiffstats
path: root/.zsh.prompts/prompt_dvzrv_setup
diff options
context:
space:
mode:
authorDavid Runge <david.runge@frqrec.com>2014-11-28 15:52:21 +0100
committerDavid Runge <david.runge@frqrec.com>2014-11-28 15:52:21 +0100
commit95e4d20a21054bcc3240e733662a5f2aaa331292 (patch)
tree8fd54e6e262f1c3a2800ce86c7d2571e9228a7b1 /.zsh.prompts/prompt_dvzrv_setup
parente39c0420a829c4507989f88c446461b05af9b7aa (diff)
parent80fdb114410b477170a56061d60f5c6316043acc (diff)
downloaddotfiles-95e4d20a21054bcc3240e733662a5f2aaa331292.tar.gz
dotfiles-95e4d20a21054bcc3240e733662a5f2aaa331292.tar.bz2
dotfiles-95e4d20a21054bcc3240e733662a5f2aaa331292.tar.xz
dotfiles-95e4d20a21054bcc3240e733662a5f2aaa331292.zip
Merge branch 'master' of https://git.frqrec.com/git/dot
* 'master' of https://git.frqrec.com/git/dot: (22 commits) .gitignore: Adding further programs and their configs to the list, removing double entries mc panels.ini: Adding panels.ini. Qsampler.conf: Adding first config. .nvimrc: Adding config for NeoVim (symlink to Vim config). .linphonerc: Adding first linphone config file patchagerc: Adding first config file (still very messy with JACK session) mc ini: Adding first ini start_jack: Removing unneeded comments, adding TODO for external config file. checkip: Adding two more possible versions for checking global IP behind NAT. Version using dig now default. adjust_dpms: Merging script based programs into the same Array as the others. Adding -x to pidof check. khard.conf: Adding first khard config for several address books prompt_dvzrv_setup: Adding custom prompt based on steeef_simplified with additional ssh check and exit code printout. prompt.zsh: Switching to custom prompt 'dvzrv' functions.zsh: Making rsync functions more readable by splitting lines. export.zsh: Lowering REPORTTIME to 5 (seconds) aliases.zsh: Adding more systemd aliases. .zpreztorc: Adding highlighting modes. termite: Removing all non-valid settings. Adding transparency setting and colors again. redshift.conf: Choosing xrandr as backend. Setting transition time to 0. Using on screen 0 only. dpms: Adding script based programs to the list of programs. ...
Diffstat (limited to '.zsh.prompts/prompt_dvzrv_setup')
-rw-r--r--.zsh.prompts/prompt_dvzrv_setup105
1 files changed, 105 insertions, 0 deletions
diff --git a/.zsh.prompts/prompt_dvzrv_setup b/.zsh.prompts/prompt_dvzrv_setup
new file mode 100644
index 0000000..3046892
--- /dev/null
+++ b/.zsh.prompts/prompt_dvzrv_setup
@@ -0,0 +1,105 @@
+#
+# A theme based on Steve Losh's Extravagant Prompt with vcs_info integration.
+#
+# Authors:
+# Steve Losh <steve@stevelosh.com>
+# Bart Trojanowski <bart@jukie.net>
+# Brian Carper <brian@carper.ca>
+# steeef_simplified <steeef_simplified@gmail.com>
+# Sorin Ionescu <sorin.ionescu@gmail.com>
+#
+# Screenshots:
+# http://i.imgur.com/HyRvv.png
+#
+
+function prompt_steeef_simplified_precmd {
+ # Check for untracked files or updated submodules since vcs_info does not.
+ if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
+ branch_format="(${_prompt_steeef_simplified_colors[1]}%b%f%u%c${_prompt_steeef_simplified_colors[4]}●%f)"
+ else
+ branch_format="(${_prompt_steeef_simplified_colors[1]}%b%f%u%c)"
+ fi
+
+ zstyle ':vcs_info:*:prompt:*' formats "${branch_format}"
+
+ vcs_info 'prompt'
+
+ if (( $+functions[python-info] )); then
+ python-info
+ fi
+
+ # Get ruby information
+# if (( $+functions[ruby-info] )); then
+# ruby-info
+# fi
+}
+
+# Check if this shell is run through ssh
+function ssh_connection {
+ if [[ -n $SSH_CONNECTION ]]; then
+ echo "[%F{red}ssh%f] "
+ fi
+}
+
+function prompt_steeef_simplified_setup {
+ setopt LOCAL_OPTIONS
+ unsetopt XTRACE KSH_ARRAYS
+ prompt_opts=(cr percent subst)
+
+ # Load required functions.
+ autoload -Uz add-zsh-hook
+ autoload -Uz vcs_info
+
+ # Add hook for calling vcs_info before each command.
+ add-zsh-hook precmd prompt_steeef_simplified_precmd
+
+ # Use extended color pallete if available.
+ if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
+ _prompt_steeef_simplified_colors=(
+ "%F{81}" # Turquoise
+ "%F{166}" # Orange
+ "%F{135}" # Purple
+ "%F{161}" # Hotpink
+ "%F{118}" # Limegreen
+ )
+ else
+ _prompt_steeef_simplified_colors=(
+ "%F{cyan}"
+ "%F{yellow}"
+ "%F{magenta}"
+ "%F{red}"
+ "%F{green}"
+ )
+ fi
+
+ # Formats:
+ # %b - branchname
+ # %u - unstagedstr (see below)
+ # %c - stagedstr (see below)
+ # %a - action (e.g. rebase-i)
+ # %R - repository path
+ # %S - path in the repository
+ local branch_format="(${_prompt_steeef_simplified_colors[1]}%b%f%u%c)"
+ local action_format="(${_prompt_steeef_simplified_colors[5]}%a%f)"
+ local unstaged_format="${_prompt_steeef_simplified_colors[2]}●%f"
+ local staged_format="${_prompt_steeef_simplified_colors[5]}●%f"
+
+ # Set vcs_info parameters.
+ zstyle ':vcs_info:*' enable bzr git hg svn
+ zstyle ':vcs_info:*:prompt:*' check-for-changes true
+ zstyle ':vcs_info:*:prompt:*' unstagedstr "${unstaged_format}"
+ zstyle ':vcs_info:*:prompt:*' stagedstr "${staged_format}"
+ zstyle ':vcs_info:*:prompt:*' actionformats "${branch_format}${action_format}"
+ zstyle ':vcs_info:*:prompt:*' formats "${branch_format}"
+ zstyle ':vcs_info:*:prompt:*' nvcsformats ""
+
+ # Set python-info parameters.
+ zstyle ':prezto:module:python:info:virtualenv' format '(%v)'
+
+ # Define prompts.
+ PROMPT="$(ssh_connection)${_prompt_steeef_simplified_colors[3]}%n%f@${_prompt_steeef_simplified_colors[2]}%m%f ${_prompt_steeef_simplified_colors[5]}%~%f "'${vcs_info_msg_0_}'"$ "
+ RPROMPT="%(?..[%F{red}%?%f] )"
+}
+
+prompt_steeef_simplified_setup "$@"
+