From 1bff61b902e9e3e88f385f6ada9ca0b8111b52a7 Mon Sep 17 00:00:00 2001 From: Jakob Guddas Date: Tue, 12 Jun 2018 14:38:38 +0200 Subject: [PATCH] removed modules --- .gitmodules | 21 - modules/archive/README.md | 31 -- modules/archive/functions/_unarchive | 4 - modules/archive/functions/archive | 41 -- modules/archive/functions/unarchive | 39 -- modules/archive/init.zsh | 17 - modules/autosuggestions/README.md | 13 - modules/autosuggestions/external | 1 - modules/autosuggestions/init.zsh | 9 - modules/completion/README.md | 11 - modules/completion/compdefs.zsh | 14 - modules/completion/external | 1 - modules/completion/init.zsh | 94 ---- modules/custom/README.md | 18 - modules/custom/functions/example_function | 4 - modules/custom/init.zsh | 8 - modules/debug/Readme.md | 19 - modules/debug/functions/trace-zim | 105 ----- modules/directory/README.md | 16 - modules/directory/init.zsh | 38 -- modules/environment/README.md | 19 - modules/environment/init.zsh | 52 --- modules/fasd/README.md | 14 - modules/fasd/functions/fasd | 424 ------------------ modules/fasd/init.zsh | 88 ---- modules/git-info/README.md | 103 ----- modules/git-info/functions/coalesce | 7 - modules/git-info/functions/git-action | 80 ---- modules/git-info/functions/git-info | 230 ---------- modules/git/README.md | 227 ---------- .../functions/_git-branch-delete-interactive | 3 - modules/git/functions/git-branch-current | 2 - .../functions/git-branch-delete-interactive | 14 - modules/git/functions/git-dir | 4 - modules/git/functions/git-ignore-add | 6 - modules/git/functions/git-root | 2 - .../git/functions/git-stash-clear-interactive | 10 - modules/git/functions/git-stash-recover | 8 - modules/git/functions/git-submodule-move | 22 - modules/git/functions/git-submodule-remove | 21 - modules/git/init.zsh | 183 -------- modules/history-substring-search/README.md | 19 - modules/history-substring-search/external | 1 - modules/history-substring-search/init.zsh | 11 - modules/history/README.md | 28 -- modules/history/init.zsh | 46 -- modules/input/README.md | 11 - modules/input/init.zsh | 106 ----- modules/pacman/README.md | 61 --- modules/pacman/helper_aur.zsh | 20 - modules/pacman/init.zsh | 135 ------ modules/prompt/README.md | 15 - modules/prompt/external-themes/lean | 1 - modules/prompt/external-themes/liquidprompt | 1 - modules/prompt/external-themes/pure | 1 - modules/prompt/functions/async | 1 - modules/prompt/functions/ext-liquidprompt | 1 - modules/prompt/functions/prompt_eriner_setup | 1 - modules/prompt/functions/prompt_gitster_setup | 1 - modules/prompt/functions/prompt_lean_setup | 1 - .../functions/prompt_liquidprompt_setup | 12 - .../prompt/functions/prompt_magicmace_setup | 1 - modules/prompt/functions/prompt_minimal_setup | 1 - modules/prompt/functions/prompt_pure_setup | 1 - modules/prompt/functions/prompt_steeef_setup | 1 - modules/prompt/functions/short_pwd | 13 - modules/prompt/init.zsh | 8 - modules/prompt/themes/eriner.zsh-theme | 140 ------ modules/prompt/themes/gitster.zsh-theme | 40 -- modules/prompt/themes/magicmace.zsh-theme | 72 --- modules/prompt/themes/minimal.zsh-theme | 88 ---- modules/prompt/themes/steeef.zsh-theme | 114 ----- modules/ssh/README.md | 9 - modules/ssh/init.zsh | 46 -- modules/syntax-highlighting/README.md | 21 - modules/syntax-highlighting/external | 1 - modules/syntax-highlighting/init.zsh | 8 - modules/utility/README.md | 40 -- modules/utility/functions/mkcd | 1 - modules/utility/init.zsh | 114 ----- 80 files changed, 3215 deletions(-) delete mode 100644 modules/archive/README.md delete mode 100644 modules/archive/functions/_unarchive delete mode 100644 modules/archive/functions/archive delete mode 100644 modules/archive/functions/unarchive delete mode 100644 modules/archive/init.zsh delete mode 100644 modules/autosuggestions/README.md delete mode 160000 modules/autosuggestions/external delete mode 100644 modules/autosuggestions/init.zsh delete mode 100644 modules/completion/README.md delete mode 100644 modules/completion/compdefs.zsh delete mode 160000 modules/completion/external delete mode 100644 modules/completion/init.zsh delete mode 100644 modules/custom/README.md delete mode 100644 modules/custom/functions/example_function delete mode 100644 modules/custom/init.zsh delete mode 100644 modules/debug/Readme.md delete mode 100644 modules/debug/functions/trace-zim delete mode 100644 modules/directory/README.md delete mode 100644 modules/directory/init.zsh delete mode 100644 modules/environment/README.md delete mode 100644 modules/environment/init.zsh delete mode 100644 modules/fasd/README.md delete mode 100644 modules/fasd/functions/fasd delete mode 100644 modules/fasd/init.zsh delete mode 100644 modules/git-info/README.md delete mode 100644 modules/git-info/functions/coalesce delete mode 100644 modules/git-info/functions/git-action delete mode 100644 modules/git-info/functions/git-info delete mode 100644 modules/git/README.md delete mode 100644 modules/git/functions/_git-branch-delete-interactive delete mode 100644 modules/git/functions/git-branch-current delete mode 100644 modules/git/functions/git-branch-delete-interactive delete mode 100644 modules/git/functions/git-dir delete mode 100644 modules/git/functions/git-ignore-add delete mode 100644 modules/git/functions/git-root delete mode 100644 modules/git/functions/git-stash-clear-interactive delete mode 100644 modules/git/functions/git-stash-recover delete mode 100644 modules/git/functions/git-submodule-move delete mode 100644 modules/git/functions/git-submodule-remove delete mode 100644 modules/git/init.zsh delete mode 100644 modules/history-substring-search/README.md delete mode 160000 modules/history-substring-search/external delete mode 100644 modules/history-substring-search/init.zsh delete mode 100644 modules/history/README.md delete mode 100644 modules/history/init.zsh delete mode 100644 modules/input/README.md delete mode 100644 modules/input/init.zsh delete mode 100644 modules/pacman/README.md delete mode 100644 modules/pacman/helper_aur.zsh delete mode 100644 modules/pacman/init.zsh delete mode 100644 modules/prompt/README.md delete mode 160000 modules/prompt/external-themes/lean delete mode 160000 modules/prompt/external-themes/liquidprompt delete mode 160000 modules/prompt/external-themes/pure delete mode 120000 modules/prompt/functions/async delete mode 120000 modules/prompt/functions/ext-liquidprompt delete mode 120000 modules/prompt/functions/prompt_eriner_setup delete mode 120000 modules/prompt/functions/prompt_gitster_setup delete mode 120000 modules/prompt/functions/prompt_lean_setup delete mode 100644 modules/prompt/functions/prompt_liquidprompt_setup delete mode 120000 modules/prompt/functions/prompt_magicmace_setup delete mode 120000 modules/prompt/functions/prompt_minimal_setup delete mode 120000 modules/prompt/functions/prompt_pure_setup delete mode 120000 modules/prompt/functions/prompt_steeef_setup delete mode 100644 modules/prompt/functions/short_pwd delete mode 100644 modules/prompt/init.zsh delete mode 100644 modules/prompt/themes/eriner.zsh-theme delete mode 100644 modules/prompt/themes/gitster.zsh-theme delete mode 100644 modules/prompt/themes/magicmace.zsh-theme delete mode 100644 modules/prompt/themes/minimal.zsh-theme delete mode 100644 modules/prompt/themes/steeef.zsh-theme delete mode 100644 modules/ssh/README.md delete mode 100644 modules/ssh/init.zsh delete mode 100644 modules/syntax-highlighting/README.md delete mode 160000 modules/syntax-highlighting/external delete mode 100644 modules/syntax-highlighting/init.zsh delete mode 100644 modules/utility/README.md delete mode 100644 modules/utility/functions/mkcd delete mode 100644 modules/utility/init.zsh diff --git a/.gitmodules b/.gitmodules index becdcb6..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,21 +0,0 @@ -[submodule "modules/history-substring-search/external"] - path = modules/history-substring-search/external - url = https://github.com/zsh-users/zsh-history-substring-search.git -[submodule "modules/completion/external"] - path = modules/completion/external - url = https://github.com/zsh-users/zsh-completions.git -[submodule "modules/syntax-highlighting/external"] - path = modules/syntax-highlighting/external - url = https://github.com/zsh-users/zsh-syntax-highlighting.git -[submodule "modules/prompt/external-themes/pure"] - path = modules/prompt/external-themes/pure - url = https://github.com/sindresorhus/pure.git -[submodule "modules/prompt/external-themes/liquidprompt"] - path = modules/prompt/external-themes/liquidprompt - url = https://github.com/nojhan/liquidprompt.git -[submodule "modules/prompt/external-themes/lean"] - path = modules/prompt/external-themes/lean - url = https://github.com/miekg/lean -[submodule "modules/autosuggestions/external"] - path = modules/autosuggestions/external - url = https://github.com/zsh-users/zsh-autosuggestions.git diff --git a/modules/archive/README.md b/modules/archive/README.md deleted file mode 100644 index 87e8943..0000000 --- a/modules/archive/README.md +++ /dev/null @@ -1,31 +0,0 @@ -Archive -======= - -Provides `archive` and `unarchive` functions for easy archive manipulation. - -This module will make use of `pigz` and `pbzip2` if available to make use of all available CPU cores. - -Functions ---------- - - * `archive` generates an archive based on file extension. Syntax is `archive myarchive.tar.gz /path/to/archive` - * `unarchive` unarchives a file based on the extension. Syntax is `unarchive myarchive.7z` - -Archive Formats ---------------- - -| Format | Requirements | -| ------ | ------------ | -| .tar | `tar` | -| .tar.gz, .tgz | `tar` or `pigz` | -| .tar.bz2, .tbz | `tar` or `pbzip2` | -| .tar.xz, .txz | `tar` with xz support | -| .tar.zma, .tlz | `tar` with lzma support | -| .gz | `gunzip` or `pigz` | -| .bz2 | `bunzip2` or `pbzip2` | -| .xz | `unxz` | -| .lzma | `unzlma` | -| .Z | `uncompress` | -| .zip | `unzip` | -| .rar | `unrar` or `rar` | -| .7z | `7za` | diff --git a/modules/archive/functions/_unarchive b/modules/archive/functions/_unarchive deleted file mode 100644 index 4a8daef..0000000 --- a/modules/archive/functions/_unarchive +++ /dev/null @@ -1,4 +0,0 @@ -#compdef unarchive - -_arguments \ - ":archive:_files -g '(#i)*.(tar|gz|tgz|bz2|tbz|tbz2|xz|txz|tlz|lzma|Z|zip|rar|7z|001)(-.)'" diff --git a/modules/archive/functions/archive b/modules/archive/functions/archive deleted file mode 100644 index 7200cb0..0000000 --- a/modules/archive/functions/archive +++ /dev/null @@ -1,41 +0,0 @@ -# -# Creates archive files -# - -if (( ${#} != 2 )); then - print "usage: ${0} [archive_name.ext] [/path/to/include/in/archive]" >&2 - return 1 -fi - -# we are quitting (above) if there are not exactly 2 vars, -# so we don't need any argc check here. - -# strip the path, just in case one is provided for some reason -local archive_name="${1:t}" -# use absolute paths, and follow symlinks -local dir_to_archive="${2}" - -# if the directory doesn't exist, quit. Nothing to archive -if [[ ! -e "${dir_to_archive}" ]]; then - print "${0}: file or directory not valid: ${dir_to_archive}" >&2 - return 1 -fi - -# pigz and pbzip2 are aliased in the init.zsh file. This provides a significant speedup, resulting in a -# near-liner decrease in compression time based on on the number of available cores. - -case "${archive_name}" in - (*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="gzip" "${dir_to_archive}" ;; - (*.tar.bz2|*.tbz|*.tbz2) tar -cvf "${archive_name}" --use-compress-program="bzip2" "${dir_to_archive}" ;; - (*.tar.xz|*.txz) tar --xz --help &>/dev/null && tar -cvJf "${archive_name}" "${dir_to_archive}" ;; - (*.tar.lzma|*.tlz) tar --lzma --help &>/dev/null && tar -cvf "${archive_name}" --lzma "${dir_to_archive}" ;; - (*.tar) tar -cvf "${archive_name}" "${dir_to_archive}" ;; - (*.zip) zip -r "${archive_name}" "${dir_to_archive}" ;; - (*.rar) rar a "${archive_name}" "${dir_to_archive}" ;; - (*.7z) 7za a "${archive_name}" "${dir_to_archive}" ;; - (*.gz) print "${0}: .gz is only useful for single files, and does not capture permissions. Use .tar.gz" ;; - (*.bz2) print "${0}: .bzip2 is only useful for single files, and does not capture permissions. Use .tar.bz2" ;; - (*.xz) print "${0}: .xz is only useful for single files, and does not capture permissions. Use .tar.xz" ;; - (*.lzma) print "${0}: .lzma is only useful for single files, and does not capture permissions. Use .tar.lzma" ;; - (*) print "${0}: unknown archive type: ${archive_name}" ;; -esac diff --git a/modules/archive/functions/unarchive b/modules/archive/functions/unarchive deleted file mode 100644 index a25af9f..0000000 --- a/modules/archive/functions/unarchive +++ /dev/null @@ -1,39 +0,0 @@ -# -# Unarchives files -# - -if (( ${#} != 1 )); then - print "usage: ${0} [archive.ext]" >&2 - return 1 -fi - -if [[ ! -s ${1} ]]; then - print "archive \"${1}\" was not found or has size 0." >&2 - return 1 -fi - -# strip the path, just in case one is provided for some reason -local archive_name="${1:t}" - -# using unpigz/pbunzip2 provides little to decompression time; the benefit is mainly in compression time. -# setting it as an alias in the init.zsh file should be sufficient here. - -case "${archive_name}" in - (*.tar.gz|*.tgz) tar -xvzf "${archive_name}" ;; - (*.tar.bz2|*.tbz|*.tbz2) tar -xvjf "${archive_name}" ;; - (*.tar.xz|*.txz) tar --xz --help &>/dev/null && tar --xz -xvf "${archive_name}" \ - || xzcat "${archive_name}" | tar xvf - ;; - (*.tar.lzma|*.tlz) tar --lzma --help &>/dev/null && tar --lzma -xvf "${archive_name}" \ - || lzcat "${archive_name}" | tar xvf - ;; - (*.tar) tar xvf "${archive_name}" ;; - (*.gz) gunzip "${archive_name}" ;; - (*.bz2) bunzip2 "${archive_name}" ;; - (*.xz) unxz "${archive_name}" ;; - (*.lzma) unlzma "${archive_name}" ;; - (*.Z) uncompress "${archive_name}" ;; - (*.zip) unzip "${archive_name}";; - (*.rar) (( $+{commands[unrar]} )) && unrar x -ad "${archive_name}" \ - || rar x -ad "${archive_name}" ;; - (*.7z|*.001) 7za x "${archive_name}" ;; - (*) print "${0}: unknown archive type: ${archive_name}" ;; -esac diff --git a/modules/archive/init.zsh b/modules/archive/init.zsh deleted file mode 100644 index d3c43fd..0000000 --- a/modules/archive/init.zsh +++ /dev/null @@ -1,17 +0,0 @@ -# -# Archive aliases -# - -# if pigz/pbzip2 are available, alias them as they are drop-in replacements for gzip and bzip2, respectively. - -# -# pigz -# -(( ${+commands[pigz]} )) && alias gzip='pigz' -(( ${+commands[unpigz]} )) && alias gunzip='unpigz' - -# -# pbzip2 -# -(( ${+commands[pbzip2]} )) && alias bzip2='pbzip2' -(( ${+commands[pbunzip2]} )) && alias bunzip2='pbunzip2' diff --git a/modules/autosuggestions/README.md b/modules/autosuggestions/README.md deleted file mode 100644 index cdffeb8..0000000 --- a/modules/autosuggestions/README.md +++ /dev/null @@ -1,13 +0,0 @@ -zsh-autosuggestions -=================== - -_[Fish](http://fishshell.com/)-like fast/unobtrusive autosuggestions for zsh._ - -It suggests commands as you type, based on command history. - - - -Contributing ------------- - -Contributions should be submitted [upstream to zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) diff --git a/modules/autosuggestions/external b/modules/autosuggestions/external deleted file mode 160000 index 15931f0..0000000 --- a/modules/autosuggestions/external +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 15931f04ffac91a2f9a1a044b6b3ee4050751064 diff --git a/modules/autosuggestions/init.zsh b/modules/autosuggestions/init.zsh deleted file mode 100644 index e6407e7..0000000 --- a/modules/autosuggestions/init.zsh +++ /dev/null @@ -1,9 +0,0 @@ -# -# Fish-like fast/unobtrusive autosuggestions for zsh. -# -# It suggests commands as you type, based on command history. -# - -# source script -source ${0:h}/external/zsh-autosuggestions.zsh || return 1 - diff --git a/modules/completion/README.md b/modules/completion/README.md deleted file mode 100644 index 8cd2581..0000000 --- a/modules/completion/README.md +++ /dev/null @@ -1,11 +0,0 @@ -completion -========== - -Enables and configures smart and extensive tab completion. - -Completions are sourced from [zsh-completions](https://github.com/zsh-users/zsh-completions). - -Contributing ------------- - -Command completions should be submitted [upstream to zsh-completions](https://github.com/zsh-users/zsh-completions). diff --git a/modules/completion/compdefs.zsh b/modules/completion/compdefs.zsh deleted file mode 100644 index 465f8e3..0000000 --- a/modules/completion/compdefs.zsh +++ /dev/null @@ -1,14 +0,0 @@ -# -# Alias compdefs -# - -# Any aliased commands will not function with completion without compdefs. -# Because completion is the LAST module to be loaded (so we make sure to catch all completions) -# we must assign the compdefs here, as opposed to within the modules themselves. - -# Unfortunately, I'm not aware of a worthwhile way to ensure that these will be included in .zcompdump - -# zpacman_frontend -> pacman -if (( ${+zpacman_frontend} )); then - compdef ${zpacman_frontend}='pacman' -fi diff --git a/modules/completion/external b/modules/completion/external deleted file mode 160000 index 7ec5276..0000000 --- a/modules/completion/external +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7ec52769d3a0dd505d33d857511866d2b90d0eec diff --git a/modules/completion/init.zsh b/modules/completion/init.zsh deleted file mode 100644 index 12b2023..0000000 --- a/modules/completion/init.zsh +++ /dev/null @@ -1,94 +0,0 @@ -# -# Completion enhancements -# - - -# -# initialization -# - -# if it's a dumb terminal, return. -if [[ ${TERM} == 'dumb' ]]; then - return 1 -fi - -# add the completions to the fpath -fpath=(${0:h}/external/src ${fpath}) - -# load and initialize the completion system -autoload -Uz compinit && compinit -C -d "${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump}" - -# set any compdefs -source ${0:h}/compdefs.zsh - - -# -# zsh options -# - -# If a completion is performed with the cursor within a word, and a full completion is inserted, -# the cursor is moved to the end of the word -setopt ALWAYS_TO_END - -# Perform a path search even on command names with slashes in them. -setopt PATH_DIRS - -# Make globbing (filename generation) not sensitive to case. -unsetopt CASE_GLOB - -# Don't beep on an ambiguous completion. -unsetopt LIST_BEEP - - -# -# completion module options -# - -# group matches and describe. -zstyle ':completion:*:*:*:*:*' menu select -zstyle ':completion:*:matches' group yes -zstyle ':completion:*:options' description yes -zstyle ':completion:*:options' auto-description '%d' -zstyle ':completion:*:corrections' format '%F{green}-- %d (errors: %e) --%f' -zstyle ':completion:*:descriptions' format '%F{yellow}-- %d --%f' -zstyle ':completion:*:messages' format '%F{purple}-- %d --%f' -zstyle ':completion:*:warnings' format '%F{red}-- no matches found --%f' -zstyle ':completion:*' format '%F{yellow}-- %d --%f' -zstyle ':completion:*' group-name '' -zstyle ':completion:*' verbose yes -zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' '+r:|?=**' - -# directories -if (( ! ${+LS_COLORS} )); then - # Locally use same LS_COLORS definition from utility module, in case it was not set - local LS_COLORS='di=1;34:ln=35:so=32:pi=33:ex=31:bd=1;36:cd=1;33:su=30;41:sg=30;46:tw=30;42:ow=30;43' -fi -zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} -zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories -zstyle ':completion:*:*:cd:*:directory-stack' menu yes select -zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'expand' -zstyle ':completion:*' squeeze-slashes true - -# enable caching -zstyle ':completion::complete:*' use-cache on -zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-${HOME}}/.zcompcache" - -# ignore useless commands and functions -zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec)|prompt_*)' - -# completion sorting -zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters - -# Man -zstyle ':completion:*:manuals' separate-sections true -zstyle ':completion:*:manuals.(^1*)' insert-sections true - -# history -zstyle ':completion:*:history-words' stop yes -zstyle ':completion:*:history-words' remove-all-dups yes -zstyle ':completion:*:history-words' list false -zstyle ':completion:*:history-words' menu yes - -# ignore multiple entries. -zstyle ':completion:*:(rm|kill|diff):*' ignore-line other -zstyle ':completion:*:rm:*' file-patterns '*:all-files' diff --git a/modules/custom/README.md b/modules/custom/README.md deleted file mode 100644 index 36fd8bf..0000000 --- a/modules/custom/README.md +++ /dev/null @@ -1,18 +0,0 @@ -Custom -====== - -Add any custom aliases/settings to the `init.zsh` file. - -Any functions should go in the `functions` folder, where the name of the file is the name of the function. - -For example, this function from your .zshrc: -``` -foo() { - print 'bar' -} -``` - -becomes a file named 'foo' in the functions folder containing: -``` -print 'bar' -``` diff --git a/modules/custom/functions/example_function b/modules/custom/functions/example_function deleted file mode 100644 index fc78a6f..0000000 --- a/modules/custom/functions/example_function +++ /dev/null @@ -1,4 +0,0 @@ -# this is an example function -# running 'example_function' in a zsh session will execute the code below - -print "executed example function: ${ZIM_HOME}/modules/custom/functions/example_function!" diff --git a/modules/custom/init.zsh b/modules/custom/init.zsh deleted file mode 100644 index 57934ad..0000000 --- a/modules/custom/init.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# -# Custom aliases/settings -# - -# any custom stuff should go here. -# ensure that 'custom' exists in the zmodules array in your .zimrc - - diff --git a/modules/debug/Readme.md b/modules/debug/Readme.md deleted file mode 100644 index 0ec55a3..0000000 --- a/modules/debug/Readme.md +++ /dev/null @@ -1,19 +0,0 @@ -Debug -===== - -Provides a function to debug Zim. - -Functions ---------- - - - `trace-zim` provides a trace of Zsh/Zim startup - -Notes ------ - -The `trace-zim` command will not alter your current dotfiles. -It will copy your environment to a temporary directory, launch zsh -within that environment, and output logs. - -This will provide a ztrace.tar.gz archive, which should be attached -to any bug reports if you need help with an issue that you don't understand. diff --git a/modules/debug/functions/trace-zim b/modules/debug/functions/trace-zim deleted file mode 100644 index 65d3dee..0000000 --- a/modules/debug/functions/trace-zim +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env zsh -# -# Generates trace log to debug zim and zsh issues -# - -print "This function creates a trace log to debug -Zsh and Zim functionality. - -It will copy your .zshrc to /tmp/ztrace/, ammend profiling -code, launch a new shell, log the trace, close the shell, -archive the logs, and finally print the path to the archive." - -read \?"Press [Enter] to begin trace." - -mkdir -p /tmp/ztrace -# make sure that we were able to create the directory -if [[ ! -d /tmp/ztrace ]]; then - print 'failed to create /tmp/ztrace directory. Aborting.' - return 1 -else - # check if known output file, if exists - # rm all directory contents - if [[ -e /tmp/ztrace/ztrace.log ]]; then - print "\nLogs from previous run of trace-zim are present -Deleting old logs now..." - # use of anonymous function for dotglob opt - () { - setopt dotglob - rm -rf /tmp/ztrace/* - } - fi -fi - -# get some basic system information (kernel and zsh version) -print "Zsh version: - $(zsh --version) -Kernel information: - $(uname -a) -fpath info: - ${fpath}" >! /tmp/ztrace/sysinfo - -cp ${ZDOTDIR:-${HOME}}/.zshrc /tmp/ztrace/.zshrc.orig -cp ${ZDOTDIR:-${HOME}}/.zimrc /tmp/ztrace/.zimrc -# rsync will allow us to not have to copy the .git folder; use if available -if (( ${+commands[rsync]} )); then - rsync -az --exclude .git ${ZIM_HOME} /tmp/ztrace/ -else - cp -R ${ZIM_HOME} /tmp/ztrace/ -fi - -# create a modified .zshrc to produce a trace log -cat <! /tmp/ztrace/.zshrc -################### -# zim trace start # -################### -PS4=$'%D{%s%6.}-_-' -exec 3>&2 2>/tmp/ztrace/sample-time.$$.log -zmodload zsh/zprof -setopt xtrace prompt_subst -EOF - -cat /tmp/ztrace/.zshrc.orig >>! /tmp/ztrace/.zshrc - -cat <>! /tmp/ztrace/.zshrc -################# -# zim trace end # -################# - -unsetopt xtrace -zprof >! /tmp/ztrace/zprof -#non-linux systems have weird fd; also, no real need to redirect back -#prompt is (practically speaking) non-interactive, fd exists only for that process -#which is closed (by typing exit) - -#exec 2>&3 3>&- -EOF - -print "\nSpawning zsh and producing trace...\n\n" -ZDOTDIR=/tmp/ztrace zsh -ic 'exit' -print "Trace complete. -Parsing logs to a nicer format; this may take some time..." - -# this is ugly thing makes it pretty... -while read line; do if [[ ${line} =~ '^[0-9]+-_-' ]]; then crt=000000$((${line%%-_-*}-10#0$last)); printf "%12.9f %s\n" ${crt:0:${#crt}-6}.${crt:${#crt}-6} ${line#*-_-}; last=${line%%-_-*}; fi; done < /tmp/ztrace/sample-time.(*).log > /tmp/ztrace/ztrace.log -print "Parsing complete!" - -# safe to remove old, unneeded environment files -print "Tidying up before archive..." -rm -f /tmp/ztrace/sample-time.* -rm -rf /tmp/ztrace/.zim -rm -f /tmp/ztrace/.zshrc -mv /tmp/ztrace/.zshrc.orig /tmp/ztrace/.zshrc -rm -f /tmp/ztrace/.zhistory -rm -f /tmp/ztrace/.zcompdump* - -print "Archiving trace logs...\n" - -tar -czf /tmp/ztrace.tar.gz /tmp/ztrace/ - -print "Archive complete!\n -Trace by with execution time available at: - /tmp/ztrace/ztrace.log -Archive (for sharing/help) available at: - /tmp/ztrace.tar.gz" - diff --git a/modules/directory/README.md b/modules/directory/README.md deleted file mode 100644 index 93118a6..0000000 --- a/modules/directory/README.md +++ /dev/null @@ -1,16 +0,0 @@ -directory -========= - -Sets directory, navigation, and redirect options. - -zsh options ------------ - - * `AUTO_CD` performs cd to a directory if the typed command is invalid, but is a directory. - * `AUTO_PUSHD` makes cd push the old directory to the directory stack. - * `PUSHD_IGNORE_DUPS` does not push multiple copies of the same directory to the stack. - * `PUSHD_SILENT` does not print the directory stack after pushd or popd. - * `PUSHD_TO_HOME` has pushd without arguments act like `pushd ${HOME}`. - * `EXTENDED_GLOB` treats `#`, `~`, and `^` as patterns for filename globbing. - * `MULTIOS` performs implicit tees or cats when using multiple redirections. - * `NO_CLOBBER` disallows `>` to overwrite existing files. Use `>|` or `>!` instead. diff --git a/modules/directory/init.zsh b/modules/directory/init.zsh deleted file mode 100644 index 60e332d..0000000 --- a/modules/directory/init.zsh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Directory navigation options -# - -# -# Navigation -# - -# If a command is issued that can’t be executed as a normal command, -# and the command is the name of a directory, perform the cd command to that directory. -setopt AUTO_CD - -# Make cd push the old directory onto the directory stack. -setopt AUTO_PUSHD - -# Don’t push multiple copies of the same directory onto the directory stack. -setopt PUSHD_IGNORE_DUPS - -# Do not print the directory stack after pushd or popd. -setopt PUSHD_SILENT - -# Have pushd with no arguments act like ‘pushd ${HOME}’. -setopt PUSHD_TO_HOME - -# -# Globbing and fds -# - -# Treat the ‘#’, ‘~’ and ‘^’ characters as part of patterns for filename generation, etc. -# (An initial unquoted ‘~’ always produces named directory expansion.) -setopt EXTENDED_GLOB - -# Perform implicit tees or cats when multiple redirections are attempted. -setopt MULTIOS - -# Disallow ‘>’ redirection to overwrite existing files. -# ‘>|’ or ‘>!’ must be used to overwrite a file. -setopt NO_CLOBBER diff --git a/modules/environment/README.md b/modules/environment/README.md deleted file mode 100644 index dd51a5d..0000000 --- a/modules/environment/README.md +++ /dev/null @@ -1,19 +0,0 @@ -environment -=========== - -Sets generic zsh built-in environment options. - -Also enables smart URL-pasting. This prevents the user from having to manually escape URLs. - -Uses `.zimrc` defined `${ztermtitle}` variable to set the terminal title, if defined. - -zsh options ------------ - - * `AUTO_RESUME` resumes an existing job before creating a new one. - * `INTERACTIVE_COMMENTS` allows comments starting with `#` in the shell. - * `LONG_LIST_JOBS` lists jobs in verbose format by default. - * `NOTIFY` reports job status immediately instead of waiting for the prompt. - * `NO_BG_NICE` prevents background jobs being given a lower priority. - * `NO_CHECK_JOBS` prevents status report of jobs on shell exit. - * `NO_HUP` prevents SIGHUP to jobs on shell exit. diff --git a/modules/environment/init.zsh b/modules/environment/init.zsh deleted file mode 100644 index 31ff079..0000000 --- a/modules/environment/init.zsh +++ /dev/null @@ -1,52 +0,0 @@ -# -# generic options and environment settings -# - -# Use smart URL pasting and escaping. -autoload -Uz bracketed-paste-url-magic && zle -N bracketed-paste bracketed-paste-url-magic -autoload -Uz url-quote-magic && zle -N self-insert url-quote-magic - -# Treat single word simple commands without redirection as candidates for resumption of an existing job. -setopt AUTO_RESUME - -# Allow comments starting with `#` even in interactive shells. -setopt INTERACTIVE_COMMENTS - -# List jobs in the long format by default. -setopt LONG_LIST_JOBS - -# Report the status of background jobs immediately, rather than waiting until just before printing a prompt. -setopt NOTIFY - -# Prevent runing all background jobs at a lower priority. -setopt NO_BG_NICE - -# Prevent reporting the status of background and suspended jobs before exiting a shell with job control. -# NO_CHECK_JOBS is best used only in combination with NO_HUP, else such jobs will be killed automatically. -setopt NO_CHECK_JOBS - -# Prevent sending the HUP signal to running jobs when the shell exits. -setopt NO_HUP - -# Remove path separtor from WORDCHARS. -WORDCHARS=${WORDCHARS//[\/]} - -# Set less or more as the default pager. -if (( ! ${+PAGER} )); then - if (( ${+commands[less]} )); then - export PAGER=less - else - export PAGER=more - fi -fi - -# sets the window title and updates upon directory change -# more work probably needs to be done here to support multiplexers -if (( ${+ztermtitle} )); then - case ${TERM} in - xterm*|*rxvt) - precmd() { print -Pn "\e]0;${ztermtitle}\a" } - precmd # we execute it once to initialize the window title - ;; - esac -fi diff --git a/modules/fasd/README.md b/modules/fasd/README.md deleted file mode 100644 index 2d85197..0000000 --- a/modules/fasd/README.md +++ /dev/null @@ -1,14 +0,0 @@ -fasd -==== - -[Fasd](https://github.com/clvv/fasd) (pronounced similar to "fast") is a command-line productivity booster. -Fasd offers quick access to files and directories for POSIX shells. It is -inspired by tools like [autojump](https://github.com/joelthelion/autojump), -[z](http://github.com/rupa/z) and [v](https://github.com/rupa/v). Fasd keeps -track of files and directories you have accessed, so that you can quickly -reference them in the command line. - -Contributing ------------- - -Contributions should be submitted [upstream to fasd](https://github.com/clvv/fasd). diff --git a/modules/fasd/functions/fasd b/modules/fasd/functions/fasd deleted file mode 100644 index 6319df1..0000000 --- a/modules/fasd/functions/fasd +++ /dev/null @@ -1,424 +0,0 @@ -# Fasd is originally written based on code from z (https://github.com/rupa/z) -# by rupa deadwyler under the WTFPL license. Most if not all of the code has -# been rewritten. - -# Copyright (C) 2011, 2012 by Wei Dai. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# make zsh do word splitting inside this function -[ "$ZSH_VERSION" ] && emulate sh && setopt localoptions - -case $1 in ---init) shift - while [ "$1" ]; do - case $1 in - env) - { # Load configuration files - - if [[ -s ${XDG_CONFIG_HOME:-"${HOME}/.config"}/fasd/config ]]; then - source ${XDG_CONFIG_HOME:-"${HOME}/.config"}/fasd/config - else - [[ -s /etc/fasdrc ]] && source /etc/fasd - [[ -s ${HOME}/.fasdrc ]] && source ${HOME}/.fasdrc - fi - - # set default options - (( ! ${+_FASD_DATA} )) && _FASD_DATA="$HOME/.fasd" - (( ! ${+_FASD_BLACKLIST} )) && _FASD_BLACKLIST="--help" - (( ! ${+_FASD_SHIFT} )) && _FASD_SHIFT="sudo busybox" - (( ! ${+_FASD_IGNORE} )) && _FASD_IGNORE="fasd ls echo" - (( ! ${+_FASD_SINK} )) && _FASD_SINK=/dev/null - (( ! ${+_FASD_TRACK_PWD} )) && _FASD_TRACK_PWD=1 - (( ! ${+_FASD_MAX} )) && _FASD_MAX=2000 - (( ! ${+_FASD_BACKENDS} )) && _FASD_BACKENDS=native - (( ! ${+_FASD_FUZZY} )) && _FASD_FUZZY=2 - (( ! ${+_FASD_VIMINFO} )) && _FASD_VIMINFO="$HOME/.viminfo" - (( ! ${+_FASD_RECENTLY_USED_XBEL} )) && \ - _FASD_RECENTLY_USED_XBEL="$HOME/.local/share/recently-used.xbel" - - if (( ! ${+_FASD_AWK} )); then - # awk preferences - local awk; for awk in mawk gawk original-awk nawk awk; do - $awk "" && _FASD_AWK=$awk && break - done - fi - } >> ${_FASD_SINK:-/dev/null} 2>&1 - ;; - esac; shift - done - ;; - -# if "$_fasd_cur" or "$2" is a query, then output shell code to be eval'd ---word-complete-trigger) - shift; [ "$2" ] && local _fasd_cur="$2" || return - case $_fasd_cur in - ,*) printf %s\\n "$1 e $_fasd_cur";; - f,*) printf %s\\n "$1 f ${_fasd_cur#?}";; - d,*) printf %s\\n "$1 d ${_fasd_cur#?}";; - *,,) printf %s\\n "$1 e $_fasd_cur";; - *,,f) printf %s\\n "$1 f ${_fasd_cur%?}";; - *,,d) printf %s\\n "$1 d ${_fasd_cur%?}";; - esac - ;; - ---sanitize) shift; printf %s\\n "$*" | \ - sed 's/\([^\]\)$( *[^ ]* *\([^)]*\)))*/\1\2/g - s/\([^\]\)[|&;<>$`{}]\{1,\}/\1 /g' - ;; - ---proc) shift # process commands - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # blacklists - local each; for each in $_FASD_BLACKLIST; do - case " $* " in *\ $each\ *) return;; esac - done - - # shifts - while true; do - case " $_FASD_SHIFT " in - *\ $1\ *) shift;; - *) break;; - esac - done - - # ignores - case " $_FASD_IGNORE " in - *\ $1\ *) return;; - esac - - shift; fasd --add "$@" # add all arguments except command - ;; - ---add|-A) shift # add entries - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # find all valid path arguments, convert them to simplest absolute form - local paths="$(while [ "$1" ]; do - [ -e "$1" ] && printf %s\\n "$1"; shift - done | sed '/^[^/]/s@^@'"$PWD"'/@ - s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 - s@[^/][^/]*//*\.\./@/@;t 0 - s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@;s@^$@/@' 2>> "$_FASD_SINK" \ - | tr '\n' '|')" - - # add current pwd if the option is set - [ "$_FASD_TRACK_PWD" = "1" -a "$PWD" != "$HOME" ] && paths="$paths|$PWD" - - [ -z "${paths##\|}" ] && return # stop if we have nothing to add - - # maintain the file - local tempfile - tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return - $_FASD_AWK -v list="$paths" -v now="$(date +%s)" -v max="$_FASD_MAX" -F"|" ' - BEGIN { - split(list, files, "|") - for(i in files) { - path = files[i] - if(path == "") continue - paths[path] = path # array for checking - rank[path] = 1 - time[path] = now - } - } - $2 >= 1 { - if($1 in paths) { - rank[$1] = $2 + 1 / $2 - time[$1] = now - } else { - rank[$1] = $2 - time[$1] = $3 - } - count += $2 - } - END { - if(count > max) - for(i in rank) print i "|" 0.9*rank[i] "|" time[i] # aging - else - for(i in rank) print i "|" rank[i] "|" time[i] - }' "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" - if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then - env rm -f "$tempfile" - else - env mv -f "$tempfile" "$_FASD_DATA" - fi - ;; - ---delete|-D) shift # delete entries - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # turn valid arguments into entry-deleting sed commands - local sed_cmd="$(while [ "$1" ]; do printf %s\\n "$1"; shift; done | \ - sed '/^[^/]/s@^@'"$PWD"'/@;s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 - s@[^/][^/]*//*\.\./@/@;t 0 - s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@ - s@^$@/@;s@\([.[\/*^$]\)@\\\1@g;s@^\(.*\)$@/^\1|/d@' 2>> "$_FASD_SINK")" - - # maintain the file - local tempfile - tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return - - sed "$sed_cmd" "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" - - if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then - env rm -f "$tempfile" - else - env mv -f "$tempfile" "$_FASD_DATA" - fi - ;; - ---query) shift # query the db, --query [$typ ["$fnd" [$mode]]] - [ -f "$_FASD_DATA" ] || return # no db yet - [ "$1" ] && local typ="$1" - [ "$2" ] && local fnd="$2" - [ "$3" ] && local mode="$3" - - # cat all backends - local each _fasd_data; for each in $_FASD_BACKENDS; do - _fasd_data="$_fasd_data -$(fasd --backend $each)" - done - [ "$_fasd_data" ] || _fasd_data="$(cat "$_FASD_DATA")" - - # set mode specific code for calculating the prior - case $mode in - rank) local prior='times[i]';; - recent) local prior='sqrt(100000/(1+t-la[i]))';; - *) local prior='times[i] * frecent(la[i])';; - esac - - if [ "$fnd" ]; then # dafault matching - local bre="$(printf %s\\n "$fnd" | sed 's/\([*\.\\\[]\)/\\\1/g - s@ @[^|]*@g;s/\$$/|/')" - bre='^[^|]*'"$bre"'[^|/]*|' - local _ret="$(printf %s\\n "$_fasd_data" | grep "$bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - if [ "$_ret" ]; then - _fasd_data="$_ret" - else # no case mathcing - _ret="$(printf %s\\n "$_fasd_data" | grep -i "$bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - if [ "$_ret" ]; then - _fasd_data="$_ret" - elif [ "${_FASD_FUZZY:-0}" -gt 0 ]; then # fuzzy matching - local fuzzy_bre="$(printf %s\\n "$fnd" | \ - sed 's/\([*\.\\\[]\)/\\\1/g;s/\$$/|/ - s@\(\\\{0,1\}[^ ]\)@\1[^|/]\\{0,'"$_FASD_FUZZY"'\\}@g - s@ @[^|]*@g')" - fuzzy_bre='^[^|]*'"$fuzzy_bre"'[^|/]*|' - _ret="$(printf %s\\n "$_fasd_data" | grep -i "$fuzzy_bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - [ "$_ret" ] && _fasd_data="$_ret" || _fasd_data= - fi - fi - else # no query arugments - _fasd_data="$(printf %s\\n "$_fasd_data" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - fi - - # query the database - [ "$_fasd_data" ] && printf %s\\n "$_fasd_data" | \ - $_FASD_AWK -v t="$(date +%s)" -F"|" ' - function frecent(time) { - dx = t-time - if( dx < 3600 ) return 6 - if( dx < 86400 ) return 4 - if( dx < 604800 ) return 2 - return 1 - } - { - if(!paths[$1]) { - times[$1] = $2 - la[$1] = $3 - paths[$1] = 1 - } else { - times[$1] += $2 - if($3 > la[$1]) la[$1] = $3 - } - } - END { - for(i in paths) printf "%-10s %s\n", '"$prior"', i - }' - 2>> "$_FASD_SINK" - ;; - ---backend) - case $2 in - native) cat "$_FASD_DATA";; - viminfo) - < "$_FASD_VIMINFO" sed -n '/^>/{s@~@'"$HOME"'@ - s/^..// - p - }' | $_FASD_AWK -v t="$(date +%s)" '{ - t -= 60 - print $0 "|1|" t - }' - ;; - recently-used) - local nl="$(printf '\\\nX')"; nl="${nl%X}" # slash newline for sed - tr -d '\n' < "$_FASD_RECENTLY_USED_XBEL" | \ - sed 's@file:/@'"$nl"'@g;s@count="@'"$nl"'@g' | sed '1d;s/".*$//' | \ - tr '\n' '|' | sed 's@|/@'"$nl"'@g' | $_FASD_AWK -F'|' '{ - sum = 0 - for( i=2; i<=NF; i++ ) sum += $i - print $1 "|" sum - }' - ;; - current) - for path in *; do - printf "$PWD/%s|1\\n" "$path" - done - ;; - spotlight) - mdfind '(kMDItemFSContentChangeDate >= $time.today) || - kMDItemLastUsedDate >= $time.this_month' \ - | sed '/Library\//d - /\.app$/d - s/$/|2/' - ;; - *) eval "$2";; - esac - ;; - -*) # parsing logic and processing - local fnd= last= _FASD_BACKENDS="$_FASD_BACKENDS" _fasd_data= comp= exec= - while [ "$1" ]; do case $1 in - --complete) [ "$2" = "--" ] && shift; set -- $2; local lst=1 r=r comp=1;; - --query|--add|--delete|-A|-D) fasd "$@"; return $?;; - --version) [ -z "$comp" ] && echo "1.0.1" && return;; - --) while [ "$2" ]; do shift; fnd="$fnd $1"; last="$1"; done;; - -*) local o="${1#-}"; while [ "$o" ]; do case $o in - s*) local show=1;; - l*) local lst=1;; - i*) [ -z "$comp" ] && local interactive=1 show=1;; - r*) local mode=rank;; - t*) local mode=recent;; - e*) o="${o#?}"; if [ "$o" ]; then # there are characters after "-e" - local exec="$o" # anything after "-e" - else # use the next argument - local exec="${2:?"-e: Argument needed "}" - shift - fi; break;; - b*) o="${o#?}"; if [ "$o" ]; then - _FASD_BACKENDS="$o" - else - _FASD_BACKENDS="${2:?"-b: Argument needed"}" - shift - fi; break;; - B*) o="${o#?}"; if [ "$o" ]; then - _FASD_BACKENDS="$_FASD_BACKENDS $o" - else - _FASD_BACKENDS="$_FASD_BACKENDS ${2:?"-B: Argument needed"}" - shift - fi; break;; - a*) local typ=e;; - d*) local typ=d;; - f*) local typ=f;; - R*) local r=r;; - [0-9]*) local _fasd_i="$o"; break;; - h*) [ -z "$comp" ] && echo "fasd [options] [query ...] -[f|a|s|d|z] [options] [query ...] - options: - -s list paths with scores - -l list paths without scores - -i interactive mode - -e set command to execute on the result file - -b only use backend - -B add additional backend - -a match files and directories - -d match directories only - -f match files only - -r match by rank only - -t match by recent access only - -R reverse listing order - -h show a brief help message - -[0-9] select the nth entry - -fasd [-A|-D] [paths ...] - -A add paths - -D delete paths" >&2 && return;; - esac; o="${o#?}"; done;; - *) fnd="$fnd $1"; last="$1";; - esac; shift; done - - # guess whether the last query is selected from tab completion - case $last in - /?*) if [ -z "$show$lst" -a -${typ:-e} "$last" -a "$exec" ]; then - $exec "$last" - return - fi;; - esac - - local R; [ -z "$r" ] && R=r || R= # let $R be the opposite of $r - fnd="${fnd# }" - - local res - res="$(fasd --query 2>> "$_FASD_SINK")" # query the database - [ $? -gt 0 ] && return - if [ 0 -lt ${_fasd_i:-0} ] 2>> "$_FASD_SINK"; then - res="$(printf %s\\n "$res" | sort -n${R} | \ - sed -n "$_fasd_i"'s/^[^ ]*[ ]*//p')" - elif [ "$interactive" ] || [ "$exec" -a -z "$fnd$lst$show" -a -t 1 ]; then - if [ "$(printf %s "$res" | sed -n '$=')" -gt 1 ]; then - res="$(printf %s\\n "$res" | sort -n${R})" - printf %s\\n "$res" | sed = | sed 'N;s/\n/ /' | sort -nr >&2 - printf "> " >&2 - local i; read i; [ 0 -lt "${i:-0}" ] 2>> "$_FASD_SINK" || return 1 - fi - res="$(printf %s\\n "$res" | sed -n "${i:-1}"'s/^[^ ]*[ ]*//p')" - elif [ "$lst" ]; then - [ "$res" ] && printf %s\\n "$res" | sort -n${r} | sed 's/^[^ ]*[ ]*//' - return - elif [ "$show" ]; then - [ "$res" ] && printf %s\\n "$res" | sort -n${r} - return - elif [ "$fnd" ] && [ "$exec" -o ! -t 1 ]; then # exec or subshell - res="$(printf %s\\n "$res" | sort -n | sed -n '$s/^[^ ]*[ ]*//p')" - else # no args, show - [ "$res" ] && printf %s\\n "$res" | sort -n${r} - return - fi - if [ "$res" ]; then - fasd --add "$res" - [ -z "$exec" ] && exec='printf %s\n' - $exec "$res" - fi - ;; -esac - -#case $- in -# *i*) ;; # assume being sourced, do nothing -# *) # assume being executed as an executable -# if [ -x "$_FASD_SHELL" -a -z "$_FASD_SET" ]; then -# _FASD_SET=1 exec $_FASD_SHELL "$0" "$@" -# else -# fasd "$@" -# fi;; -#esac diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh deleted file mode 100644 index cc05f62..0000000 --- a/modules/fasd/init.zsh +++ /dev/null @@ -1,88 +0,0 @@ -fasd --init env - -# function to execute built-in cd -fasd_cd() { - if [ $# -le 1 ]; then - fasd "$@" - else - local _fasd_ret="$(fasd -e 'printf %s' "$@")" - [ -z "$_fasd_ret" ] && return - [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret" - fi -} - -alias a='fasd -a' -alias s='fasd -si' -alias sd='fasd -sid' -alias sf='fasd -sif' -alias d='fasd -d' -alias f='fasd -f' -alias v='f -e vim -b viminfo' -alias z='fasd_cd -d' -alias zz='fasd_cd -d -i' - -# add zsh hook -_fasd_preexec() { - { eval "fasd --proc $(fasd --sanitize $2)"; } >> "/dev/null" 2>&1 -} -autoload -Uz add-zsh-hook -add-zsh-hook preexec _fasd_preexec - -# zsh command mode completion -_fasd_zsh_cmd_complete() { - local compl - read -c compl - (( $+compstate )) && compstate[insert]=menu # no expand if compsys loaded - reply=(${(f)"$(fasd --complete "$compl")"}) -} - -# enable command mode completion -compctl -U -K _fasd_zsh_cmd_complete -V fasd -x 'C[-1,-*e],s[-]n[1,e]' -c - \ - 'c[-1,-A][-1,-D]' -f -- fasd fasd_cd - -(( $+functions[compdef] )) && { - # zsh word mode completion - _fasd_zsh_word_complete() { - [ "$2" ] && local _fasd_cur="$2" - [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}" - local fnd="${_fasd_cur//,/ }" - local typ=${1:-e} - fasd --query $typ "$fnd" 2>> "/dev/null" | \ - sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do - compadd -U -V fasd "$line" - done - compstate[insert]=menu # no expand - } - _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; } - _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; } - _fasd_zsh_word_complete_trigger() { - local _fasd_cur="${words[CURRENT]}" - eval $(fasd --word-complete-trigger _fasd_zsh_word_complete $_fasd_cur) - } - # define zle widgets - zle -C fasd-complete complete-word _generic - zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete - zstyle ':completion:fasd-complete:*' menu-select - - zle -C fasd-complete-f complete-word _generic - zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f - zstyle ':completion:fasd-complete-f:*' menu-select - - zle -C fasd-complete-d complete-word _generic - zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d - zstyle ':completion:fasd-complete-d:*' menu-select -} - -(( $+functions[compdef] )) && { - # enable word mode completion - orig_comp="$(zstyle -L ':completion:\*' completer 2>> "/dev/null")" - if [ "$orig_comp" ]; then - case $orig_comp in - *_fasd_zsh_word_complete_trigger*);; - *) eval "$orig_comp _fasd_zsh_word_complete_trigger";; - esac - else - zstyle ':completion:*' completer _complete _fasd_zsh_word_complete_trigger - fi - unset orig_comp -} diff --git a/modules/git-info/README.md b/modules/git-info/README.md deleted file mode 100644 index cd82127..0000000 --- a/modules/git-info/README.md +++ /dev/null @@ -1,103 +0,0 @@ -git-info -======== - -Exposes git repository status information to prompts. - -Many thanks to [Sorin Ionescu](https://github.com/sorin-ionescu) and -[Colin Hebert](https://github.com/ColinHebert) for the original code. - -Git **1.7.2** is the -[minimum required version](https://github.com/sorin-ionescu/prezto/issues/219). - -Settings --------- - -### Ignore Submodules - -Retrieving the status of a repository with submodules can take a long time. -So by default 'all' submodules are ignored. Optionally, 'untracked', 'dirty', or -'none' submodules can be ignored: - - zstyle ':zim:git-info' ignore-submodules 'none' - -### Verbose Mode - -Verbose mode uses `git status` and computes the count of indexed, unindexed and -also untracked files. It can be enabled with the following zstyle: - - zstyle ':zim:git-info' verbose yes - -In non-verbose mode, the 'untracked' context is not available (see Main -Contexts below), and untracked files are also not considered for computing the -'dirty' context. Using `git status` to check for untracked files can be -[expensive](https://gist.github.com/sindresorhus/3898739). - -Theming -------- - -To display information about the current repository in a prompt, define your -custom styles in the `prompt_name_setup` function, where the syntax for setting -a style is: - - zstyle ':zim:git-info:context' format 'string' - -### Main Contexts - -| Name | Code | Description -| --------- | :----: | -------------------------------------------------------- -| action | %s | Special action name (see Special Action Contexts below) -| ahead | %A | Commits ahead of remote count -| behind | %B | Commits behind of remote count -| diverged | %V | Diverged commits (both ahead and behind are yield when it's not defined) -| branch | %b | Branch name -| commit | %c | Commit short hash (when in 'detached HEAD' state) -| clean | %C | Clean state -| dirty | %D | Dirty state (count with untracked files when verbose mode enabled) -| indexed | %i | Indexed files (count when verbose mode enabled) -| unindexed | %I | Unindexed files (count when verbose mode enabled) -| position | %p | Commits from nearest tag count (when in 'detached HEAD' state) -| remote | %R | Remote name -| stashed | %S | Stashed states count -| untracked | %u | Untracked files count (only when verbose mode enabled) - -While `commit` and `position` are only available when in ['detached HEAD' -state](http://gitfaq.org/articles/what-is-a-detached-head.html), on the other -hand, `ahead`, `behind`, `diverged`, `branch` and `remote` are only available -when an actual branch is checked out (so when **not** in 'detached HEAD' state). - -### Special Action Contexts - -| Name | Format | Default Value -| --------------------------- | :-----: | ------------------------------------- -| action:apply | value | 'apply' -| action:bisect | value | 'bisect' -| action:cherry-pick | value | 'cherry-pick' -| action:cherry-pick-sequence | value | 'cherry-pick-sequence' -| action:merge | value | 'merge' -| action:rebase | value | 'rebase' -| action:rebase-interactive | value | 'rebase-interactive' -| action:rebase-merge | value | 'rebase-merge' - -Formatting example for special actions: - - zstyle ':zim:git-info:action:bisect' format '' - zstyle ':zim:git-info:action:merge' format '>M<' - zstyle ':zim:git-info:action:rebase' format '>R>' - -### Usage - -First, format the repository state attributes. For example, to format the -branch name, commit, and remote name, define the following styles: - - zstyle ':zim:git-info:branch' format 'branch:%b' - zstyle ':zim:git-info:commit' format 'commit:%c' - zstyle ':zim:git-info:remote' format 'remote:%R' - -Second, format how the above attributes are displayed in prompts: - - zstyle ':zim:git-info:keys' format \ - 'prompt' 'git(%b%c)' \ - 'rprompt' '[%R]' - -Last, add `${git_info[prompt]}` to `PS1` and `${git_info[rprompt]}` to `RPS1` -respectively and call `git-info` in the `prompt_name_precmd` hook function. diff --git a/modules/git-info/functions/coalesce b/modules/git-info/functions/coalesce deleted file mode 100644 index e5f028f..0000000 --- a/modules/git-info/functions/coalesce +++ /dev/null @@ -1,7 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -# Prints the first non-empty string in the arguments array. -for arg in ${argv}; do - print -n ${arg} - return 0 -done -return 1 diff --git a/modules/git-info/functions/git-action b/modules/git-info/functions/git-action deleted file mode 100644 index 007da9a..0000000 --- a/modules/git-info/functions/git-action +++ /dev/null @@ -1,80 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -# Gets the Git special action (am, bisect, cherry, merge, rebase). -# Borrowed from vcs_info and edited. -local git_dir=${$(command git rev-parse --git-dir):A} -local action_dir -for action_dir in \ - "${git_dir}/rebase-apply" \ - "${git_dir}/rebase" \ - "${git_dir}/../.dotest" -do - if [[ -d ${action_dir} ]]; then - local apply_formatted rebase_formatted - zstyle -s ':zim:git-info:action:apply' format 'apply_formatted' || apply_formatted='apply' - zstyle -s ':zim:git-info:action:rebase' format 'rebase_formatted' || rebase_formatted='rebase' - - if [[ -f "${action_dir}/rebasing" ]]; then - print ${rebase_formatted} - elif [[ -f "${action_dir}/applying" ]]; then - print ${apply_formatted} - else - print "${rebase_formatted}/${apply_formatted}" - fi - - return 0 - fi -done - -for action_dir in \ - "${git_dir}/rebase-merge/interactive" \ - "${git_dir}/.dotest-merge/interactive" -do - if [[ -f ${action_dir} ]]; then - local rebase_interactive_formatted - zstyle -s ':zim:git-info:action:rebase-interactive' format 'rebase_interactive_formatted' || rebase_interactive_formatted='rebase-interactive' - print ${rebase_interactive_formatted} - return 0 - fi -done - -for action_dir in \ - "${git_dir}/rebase-merge" \ - "${git_dir}/.dotest-merge" -do - if [[ -d ${action_dir} ]]; then - local rebase_merge_formatted - zstyle -s ':zim:git-info:action:rebase-merge' format 'rebase_merge_formatted' || rebase_merge_formatted='rebase-merge' - print ${rebase_merge_formatted} - return 0 - fi -done - -if [[ -f "${git_dir}/MERGE_HEAD" ]]; then - local merge_formatted - zstyle -s ':zim:git-info:action:merge' format 'merge_formatted' || merge_formatted='merge' - print ${merge_formatted} - return 0 -fi - -if [[ -f "${git_dir}/CHERRY_PICK_HEAD" ]]; then - if [[ -d "${git_dir}/sequencer" ]]; then - local cherry_pick_sequence_formatted - zstyle -s ':zim:git-info:action:cherry-pick-sequence' format 'cherry_pick_sequence_formatted' || cherry_pick_sequence_formatted='cherry-pick-sequence' - print ${cherry_pick_sequence_formatted} - else - local cherry_pick_formatted - zstyle -s ':zim:git-info:action:cherry-pick' format 'cherry_pick_formatted' || cherry_pick_formatted='cherry-pick' - print ${cherry_pick_formatted} - fi - - return 0 -fi - -if [[ -f "${git_dir}/BISECT_LOG" ]]; then - local bisect_formatted - zstyle -s ':zim:git-info:action:bisect' format 'bisect_formatted' || bisect_formatted='bisect' - print ${bisect_formatted} - return 0 -fi - -return 1 diff --git a/modules/git-info/functions/git-info b/modules/git-info/functions/git-info deleted file mode 100644 index 4d4b55b..0000000 --- a/modules/git-info/functions/git-info +++ /dev/null @@ -1,230 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -# -# Exposes Git repository information via the git_info associative array. -# - -# Extended globbing is needed to parse repository status. -setopt LOCAL_OPTIONS EXTENDED_GLOB - -# Clean up previous git_info. -unset git_info -typeset -gA git_info - -# Return if not inside a Git repository work tree. -if ! command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - return 1 -fi - -# Ignore submodule status. -local ignore_submodules -zstyle -s ':zim:git-info' ignore-submodules 'ignore_submodules' || ignore_submodules='all' - -# Format stashed. -local stashed_format stashed_formatted -zstyle -s ':zim:git-info:stashed' format 'stashed_format' -if [[ -n ${stashed_format} ]]; then - local -i stashed=$(command git stash list 2>/dev/null | wc -l) - (( stashed )) && zformat -f stashed_formatted ${stashed_format} "S:${stashed}" -fi - -# Format action. -local action_format action_formatted -zstyle -s ':zim:git-info:action' format 'action_format' -if [[ -n ${action_format} ]]; then - local action=$(git-action) - if [[ -n ${action} ]]; then - zformat -f action_formatted ${action_format} "s:${action}" - fi -fi - -# The contents of git_info are subject to expansion by the shell. Avoid -# putting raw ref names in the prompt to protect the user from arbitrary code -# execution via specially crafted ref names (e.g., a ref named -# '$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' would execute 'sudo rm -rf /' when the -# prompt is drawn). Instead, put the ref names in new global variables and -# reference these variables from git_info. -# See https://github.com/njhartwell/pw3nage - -# Get the branch. -__GIT_INFO_BRANCH=$(command git symbolic-ref -q --short HEAD 2>/dev/null) - -local ahead_formatted behind_formatted branch_formatted commit_formatted diverged_formatted position_formatted remote_formatted -if [[ -n ${__GIT_INFO_BRANCH} ]]; then - unset __GIT_INFO_POSITION - - # Format branch. - local branch_format - zstyle -s ':zim:git-info:branch' format 'branch_format' - if [[ -n ${branch_format} ]]; then - zformat -f branch_formatted ${branch_format} 'b:${__GIT_INFO_BRANCH}' - fi - - # Format remote. - local remote_format - zstyle -s ':zim:git-info:remote' format 'remote_format' - if [[ -n ${remote_format} ]]; then - # Gets the remote name. - local remote_cmd='command git rev-parse --symbolic-full-name --verify HEAD@{upstream}' - __GIT_INFO_REMOTE=${$(${(z)remote_cmd} 2>/dev/null)##refs/remotes/} - if [[ -n ${__GIT_INFO_REMOTE} ]]; then - zformat -f remote_formatted ${remote_format} 'R:${__GIT_INFO_REMOTE}' - else - unset __GIT_INFO_REMOTE - fi - fi - - local ahead_format behind_format diverged_format - zstyle -s ':zim:git-info:ahead' format 'ahead_format' - zstyle -s ':zim:git-info:behind' format 'behind_format' - zstyle -s ':zim:git-info:diverged' format 'diverged_format' - if [[ -n ${ahead_format} || -n ${behind_format} || -n ${diverged_format} ]]; then - # Gets the commit difference counts between local and remote. - local ahead_and_behind_cmd='command git rev-list --count --left-right HEAD...@{upstream}' - - # Get ahead and behind counts. - local ahead_and_behind=$(${(z)ahead_and_behind_cmd} 2>/dev/null) - local -i ahead=${ahead_and_behind[(w)1]} - local -i behind=${ahead_and_behind[(w)2]} - - if [[ -n ${diverged_format} && ${ahead} -gt 0 && ${behind} -gt 0 ]]; then - # Format diverged. - diverged_formatted=${diverged_format} - else - # Format ahead. - if [[ -n ${ahead_format} && ${ahead} -gt 0 ]]; then - zformat -f ahead_formatted ${ahead_format} "A:${ahead}" - fi - # Format behind. - if [[ -n ${behind_format} && ${behind} -gt 0 ]]; then - zformat -f behind_formatted ${behind_format} "B:${behind}" - fi - fi - fi -else - unset __GIT_INFO_BRANCH - unset __GIT_INFO_REMOTE - - # Format commit. - local commit_format - zstyle -s ':zim:git-info:commit' format 'commit_format' - if [[ -n ${commit_format} ]]; then - local commit=$(command git rev-parse --short HEAD 2>/dev/null) - if [[ -n ${commit} ]]; then - zformat -f commit_formatted ${commit_format} "c:${commit}" - fi - fi - - # Format position. - local position_format - zstyle -s ':zim:git-info:position' format 'position_format' - if [[ -n ${position_format} ]]; then - __GIT_INFO_POSITION=$(command git describe --contains --all HEAD 2>/dev/null) - if [[ -n ${__GIT_INFO_POSITION} ]]; then - zformat -f position_formatted ${position_format} 'p:${__GIT_INFO_POSITION}' - fi - fi -fi - -# Dirty and clean format. -local dirty_format dirty_formatted clean_format clean_formatted -zstyle -s ':zim:git-info:dirty' format 'dirty_format' -zstyle -s ':zim:git-info:clean' format 'clean_format' - -local -i dirty -local indexed_formatted unindexed_formatted untracked_formatted -if ! zstyle -t ':zim:git-info' verbose; then - # Format unindexed. - local unindexed_format - zstyle -s ':zim:git-info:unindexed' format 'unindexed_format' - if [[ -n ${unindexed_format} || -n ${dirty_format} || -n ${clean_format} ]]; then - if ! command git diff-files --no-ext-diff --quiet --ignore-submodules=${ignore_submodules} >/dev/null 2>&1; then - unindexed_formatted=${unindexed_format} - dirty=1 - fi - fi - - # Format indexed. - local indexed_format - zstyle -s ':zim:git-info:indexed' format 'indexed_format' - if [[ -n ${indexed_format} || (${dirty} -eq 0 && (-n ${dirty_format} || -n ${clean_format})) ]]; then - if ! command git diff-index --no-ext-diff --quiet --cached --ignore-submodules=${ignore_submodules} HEAD >/dev/null 2>&1; then - indexed_formatted=${indexed_format} - dirty=1 - fi - fi - - # Format dirty and clean. - if (( dirty )); then - dirty_formatted=${dirty_format} - else - clean_formatted=${clean_format} - fi -else - # Use porcelain status for easy parsing. - local status_cmd="command git status --porcelain --ignore-submodules=${ignore_submodules}" - - local -i indexed unindexed untracked - # Get current status. - while IFS=$'\n' read line; do - if [[ ${line:0:2} == '??' ]]; then - (( untracked++ )) - else - [[ ${line:0:1} != ' ' ]] && (( indexed++ )) - [[ ${line:1:1} != ' ' ]] && (( unindexed++ )) - fi - (( dirty++ )) - done < <(${(z)status_cmd} 2>/dev/null) - - # Format indexed. - if (( indexed )); then - local indexed_format - zstyle -s ':zim:git-info:indexed' format 'indexed_format' - zformat -f indexed_formatted ${indexed_format} "i:${indexed}" - fi - - # Format unindexed. - if (( unindexed )); then - local unindexed_format - zstyle -s ':zim:git-info:unindexed' format 'unindexed_format' - zformat -f unindexed_formatted ${unindexed_format} "I:${unindexed}" - fi - - # Format untracked. - if (( untracked )); then - local untracked_format - zstyle -s ':zim:git-info:untracked' format 'untracked_format' - zformat -f untracked_formatted ${untracked_format} "u:${untracked}" - fi - - # Format dirty and clean. - if (( dirty )); then - zformat -f dirty_formatted ${dirty_format} "u:${dirty}" - else - clean_formatted=${clean_format} - fi -fi - -# Format info. -local -A info_formats -local info_format reply -zstyle -a ':zim:git-info:keys' format 'info_formats' -for info_format in ${(k)info_formats}; do - zformat -f reply "${info_formats[${info_format}]}" \ - "A:${ahead_formatted}" \ - "B:${behind_formatted}" \ - "b:${branch_formatted}" \ - "C:${clean_formatted}" \ - "c:${commit_formatted}" \ - "D:${dirty_formatted}" \ - "i:${indexed_formatted}" \ - "I:${unindexed_formatted}" \ - "p:${position_formatted}" \ - "R:${remote_formatted}" \ - "s:${action_formatted}" \ - "S:${stashed_formatted}" \ - "u:${untracked_formatted}" \ - "V:${diverged_formatted}" - git_info[${info_format}]=${reply} -done - -return 0 diff --git a/modules/git/README.md b/modules/git/README.md deleted file mode 100644 index c0f3232..0000000 --- a/modules/git/README.md +++ /dev/null @@ -1,227 +0,0 @@ -git -=== - -Provides nice git aliases and functions. - -Many thanks to [Sorin Ionescu](https://github.com/sorin-ionescu) for the -excellent aliases. - -Aliases -------- - -### Git - - * `g` is short for `git`. - -### Branch - - * `gb` lists, creates, renames, and deletes branches. - * `gbc` creates a new branch. - * `gbl` lists branches and their commits. - * `gbL` lists local and remote branches and their commits. - * `gbm` renames a branch. - * `gbM` renames a branch even if the new branch name already exists. - * `gbs` lists branches and their commits with ancestry graphs. - * `gbS` lists local and remote branches and their commits with ancestry - graphs. - * `gbx` deletes a branch. - * `gbX` deletes a branch irrespective of its merged status. - -### Commit - - * `gc` records changes to the repository. - * `gca` commits all modified and deleted files. - * `gcm` commits with the given message. - * `gco` checks out a branch or paths to the working tree. - * `gcO` checks out hunks from the index or the tree interactively. - * `gcf` amends the tip of the current branch reusing the same log message as - *HEAD*. - * `gcF` amends the tip of the current branch. - * `gcp` applies changes introduced by existing commits. - * `gcP` applies changes introduced by existing commits without committing. - * `gcr` reverts existing commits by reverting patches and recording new - commits. - * `gcR` removes the *HEAD* commit. - * `gcs` shows one or more objects (blobs, trees, tags and commits). - * `gcS` commits with GPG signature. - * `gcv` verifies the GPG signature of commits. - -### Conflict - - * `gCl` lists unmerged files. - * `gCa` adds unmerged file contents to the index. - * `gCe` executes merge-tool on all unmerged files. - * `gCo` checks out our changes for unmerged paths. - * `gCO` checks out our changes for all unmerged paths. - * `gCt` checks out their changes for unmerged paths. - * `gCT` checks out their changes for all unmerged paths. - -### Data - - * `gd` displays information about files in the index and the work tree. - * `gdc` lists cached files. - * `gdx` lists deleted files. - * `gdm` lists modified files. - * `gdu` lists untracked files. - * `gdk` lists killed files. - * `gdi` lists ignored files. - -### Fetch - - * `gf` downloads objects and references from another repository. - * `gfc` clones a repository into a new directory. - * `gfm` fetches from and merges with another repository or local branch. - * `gfr` fetches from and rebases on another repository or local branch. - -### Grep - - * `gg` displays lines matching a pattern. - * `ggi` displays lines matching a pattern ignoring case. - * `ggl` lists files matching a pattern. - * `ggL` lists files that are not matching a pattern. - * `ggv` displays lines not matching a pattern. - * `ggw` displays lines matching a pattern at word boundary. - -### Index - - * `gia` adds file contents to the index. - * `giA` adds file contents to the index interactively. - * `giu` adds file contents to the index (updates only known files). - * `gid` displays changes between the index and a named commit (diff). - * `giD` displays changes between the index and a named commit (word diff). - * `gir` resets the current *HEAD* to the specified state. - * `giR` resets the current index interactively. - * `gix` removes files/directories from the index (recursively). - * `giX` removes files/directories from the index (recursively and forced). - -### Log - - * `gl` displays the log. - * `gls` displays the stats log. - * `gld` displays the diff log. - * `glo` displays the one line log. - * `glO` displays the one line log with authors and dates. - * `glg` displays the graph log. - * `glG` displays the graph log with authors and dates. - * `glv` displays the log verifying the GPG signature of commits. - * `glc` displays the commit count for each contributor in descending order. - -### Merge - - * `gm` joins two or more development histories together. - * `gmC` performs the merge but does not commit. - * `gmF` performs the merge generating a commit even if the merge resolved as a - fast-forward. - * `gma` aborts the conflict resolution, and reconstructs the pre-merge state. - * `gmt` runs the merge conflict resolution tools to resolve conflicts. - -### Push - - * `gp` updates remote refs along with associated objects. - * `gpf` forces a push. - * `gpa` pushes all branches. - * `gpA` pushes all branches and tags. - * `gpt` pushes all tags. - * `gpc` pushes the current branch and adds *origin* as an upstream reference - for it. - * `gpp` pulls and pushes the current branch from *origin* to *origin*. - -### Rebase - - * `gr` forward-ports local commits to the updated upstream head. - * `gra` aborts the rebase. - * `grc` continues the rebase after merge conflicts are resolved. - * `gri` makes a list of commits to be rebased and opens the editor. - * `grs` skips the current patch. - -### Remote - - * `gR` manages tracked repositories. - * `gRl` lists remote names and their URLs. - * `gRa` adds a new remote. - * `gRx` removes a remote. - * `gRm` renames a remote. - * `gRu` fetches remotes updates. - * `gRp` prunes all stale remote tracking branches. - * `gRs` shows information about a given remote. - -### Stash - - * `gs` stashes the changes of the dirty working directory. - * `gsa` applies the changes recorded in a stash to the working directory. - * `gsx` drops a stashed state. - * `gsX` drops all the stashed states. - * `gsl` lists stashed states. - * `gsd` displays changes between the stash and its original parent. - * `gsp` removes and applies a single stashed state from the stash list. - * `gsr` recovers a given stashed state. - * `gss` stashes the working directory changes, including untracked files. - * `gsS` stashes the working directory changes interactively. - * `gsw` stashes the working directory changes retaining the index. - * `gsu` unapplies (reverts) applied changes. - -### Submodule - - * `gS` initializes, updates, or inspects submodules. - * `gSa` adds given a repository as a submodule. - * `gSf` evaluates a shell command in each of checked out submodules. - * `gSi` initializes submodules. - * `gSI` initializes and clones submodules recursively. - * `gSl` lists the commits of all submodules. - * `gSm` moves a submodule. - * `gSs` synchronizes submodules' remote URL to the value specified in - .gitmodules. - * `gSu` fetches and merges the latest changes for all submodules. - * `gSx` removes a submodule. - -### Tag - - * `gt` creates, lists, deletes or verifies a tag object signed with GPG. - * `gts` creates a GPG-signed tag. - * `gtv` verifies the GPG signature of tags. - * `gtx` deletes tags with given names. - -### Working tree - - * `gws` displays working-tree status in the short format. - * `gwS` displays working-tree status. - * `gwd` displays changes between the working tree and the index (diff). - * `gwD` displays changes between the working tree and the index (word diff). - * `gwr` resets the current *HEAD* to the specified state, does not touch the - index nor the working tree. - * `gwR` resets the current *HEAD*, index and working tree to the specified - state. - * `gwc` cleans untracked files from the working tree (dry-run). - * `gwC` cleans untracked files from the working tree. - * `gwx` removes files from the working tree and from the index recursively. - * `gwX` removes files from the working tree and from the index recursively and - forcefully. - -### Misc - - * `g..` changes the current directory to the top level of the working tree. - -### Shadows - -The following aliases may shadow system commands: - - * `gpt` shadows the GUID partition table maintenance utility. - * `gs` shadows Ghostscript. - -If you frequently use the above commands, you may wish to remove said aliases -from this module or to disable them at the bottom of the zshrc with `unalias`. - -You can temporarily bypass an alias by prefixing it with a backward slash: -`\gpt`. - -Functions ---------- - - * `git-branch-current` displays the current branch. - * `git-dir` displays the path to the Git directory. - * `git-ignore-add` adds any arguments to the .gitignore in the project root. - * `git-root` displays the path to the working tree root. - * `git-stash-clear-interactive` asks for confirmation before clearing the stash. - * `git-stash-recover` recovers given dropped stashed states. - * `git-submodule-move` moves a submodule. - * `git-submodule-remove` removes a submodule. diff --git a/modules/git/functions/_git-branch-delete-interactive b/modules/git/functions/_git-branch-delete-interactive deleted file mode 100644 index e102f80..0000000 --- a/modules/git/functions/_git-branch-delete-interactive +++ /dev/null @@ -1,3 +0,0 @@ -#compdef git-branch-delete-interactive - -words[1]=(git branch); (( CURRENT++ )); service=git; _git diff --git a/modules/git/functions/git-branch-current b/modules/git/functions/git-branch-current deleted file mode 100644 index e118d46..0000000 --- a/modules/git/functions/git-branch-current +++ /dev/null @@ -1,2 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -command git symbolic-ref -q --short HEAD diff --git a/modules/git/functions/git-branch-delete-interactive b/modules/git/functions/git-branch-delete-interactive deleted file mode 100644 index 5886cfe..0000000 --- a/modules/git/functions/git-branch-delete-interactive +++ /dev/null @@ -1,14 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -local -a remotes -if (( ${*[(I)(-r|--remotes)]} )); then - remotes=(${^*:#-*}) -else - remotes=(${(f)"$(command git rev-parse --abbrev-ref ${^*:#-*}@{u} 2>/dev/null)"}) || remotes=() -fi -if command git branch --delete ${@} && \ - (( ${#remotes[@]} )) && \ - read -q "?Also delete remote branch(es) ${remotes} [y/N]? "; then - print - local remote - for remote (${remotes}) command git push ${remote%%/*} :${remote#*/} -fi diff --git a/modules/git/functions/git-dir b/modules/git/functions/git-dir deleted file mode 100644 index b18901f..0000000 --- a/modules/git/functions/git-dir +++ /dev/null @@ -1,4 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -local git_dir -git_dir=$(command git rev-parse --git-dir) || return 1 -print ${git_dir:A} diff --git a/modules/git/functions/git-ignore-add b/modules/git/functions/git-ignore-add deleted file mode 100644 index 0022b9e..0000000 --- a/modules/git/functions/git-ignore-add +++ /dev/null @@ -1,6 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -local git_root -git_root=$(git-root) || return 1 - -# we are in a git repository. add parameters to .gitignore -for file (${@}) print ${file} >>! "${git_root}/.gitignore" diff --git a/modules/git/functions/git-root b/modules/git/functions/git-root deleted file mode 100644 index af4d0a5..0000000 --- a/modules/git/functions/git-root +++ /dev/null @@ -1,2 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -command git rev-parse --show-toplevel diff --git a/modules/git/functions/git-stash-clear-interactive b/modules/git/functions/git-stash-clear-interactive deleted file mode 100644 index b677b2a..0000000 --- a/modules/git/functions/git-stash-clear-interactive +++ /dev/null @@ -1,10 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -setopt LOCAL_OPTIONS PIPE_FAIL - -local -i stashed -stashed=$(command git stash list | wc -l) || return 1 -if (( stashed )) && \ - read -q "?Clear ${stashed} stashed state(s) [y/N]? "; then - print - command git stash clear -fi diff --git a/modules/git/functions/git-stash-recover b/modules/git/functions/git-stash-recover deleted file mode 100644 index ad44ab1..0000000 --- a/modules/git/functions/git-stash-recover +++ /dev/null @@ -1,8 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -command git rev-parse --is-inside-work-tree >/dev/null || return 1 - -local commit -for commit in "${@}"; do - git update-ref -m "$(command git log -1 --pretty='format:%s' ${commit})" \ - refs/stash ${commit} -done diff --git a/modules/git/functions/git-submodule-move b/modules/git/functions/git-submodule-move deleted file mode 100644 index a3878d5..0000000 --- a/modules/git/functions/git-submodule-move +++ /dev/null @@ -1,22 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -local git_root -git_root=$(git-root) || return 1 - -if [[ ${PWD} != ${git_root} ]]; then - print "${0}: must be run from the root of the work tree" >&2 - return 1 -fi - -local src="${1}" -local dst="${2}" -local url=$(command git config --file .gitmodules --get "submodule.${src}.url") -if [[ -z "${url}" ]]; then - print "${0}: submodule not found: ${src}" >&2 - return 1 -fi - -mkdir -p "${dst:h}" -git-submodule-remove "${src}" -git submodule add "${url}" "${dst}" - -return 0 diff --git a/modules/git/functions/git-submodule-remove b/modules/git/functions/git-submodule-remove deleted file mode 100644 index 4ad00c6..0000000 --- a/modules/git/functions/git-submodule-remove +++ /dev/null @@ -1,21 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -local git_dir -git_dir=$(git-dir) || return 1 - -if [[ ${PWD} != $(git-root) ]]; then - print "${0}: must be run from the root of the work tree" >&2 - return 1 -elif ! command git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then - print "${0}: submodule not found: ${1}" >&2 - return 1 -fi - -command git config --file "${git_dir}/config" --remove-section "submodule.${1}" &>/dev/null -command git config --file .gitmodules --remove-section "submodule.${1}" &>/dev/null -command git add .gitmodules - -command git rm --cached "${1}" &>/dev/null -rm -rf "${1}" -rm -rf "${git_dir}/modules/${1}" - -return 0 diff --git a/modules/git/init.zsh b/modules/git/init.zsh deleted file mode 100644 index 8d3072e..0000000 --- a/modules/git/init.zsh +++ /dev/null @@ -1,183 +0,0 @@ -# -# Git aliases. -# - -# -# Settings -# - -# Log colour scheme has yellow commit hash, bold blue author, cyan date, auto ref names -# See https://git-scm.com/docs/pretty-formats -_git_log_medium_format='%C(bold)Commit:%C(reset) %C(yellow)%H%C(auto)%d%n%C(bold)Author:%C(reset) %C(bold blue)%an <%ae>%n%C(bold)Date:%C(reset) %C(cyan)%ai (%ar)%C(reset)%n%+B' -_git_log_oneline_format='%C(yellow)%h%C(reset) %s%C(auto)%d%C(reset)' -_git_log_oneline_medium_format='%C(yellow)%h%C(reset) %<|(60,trunc)%s %C(bold blue)<%an> %C(reset)%C(cyan)(%ar)%C(auto)%d%C(reset)' - -# -# Aliases -# - -# Git -alias g='git' - -# Branch (b) -alias gb='git branch' -alias gbc='git checkout -b' -alias gbl='git branch -vv' -alias gbL='git branch --all -vv' -alias gbm='git branch --move' -alias gbM='git branch --move --force' -alias gbs='git show-branch' -alias gbS='git show-branch --all' -alias gbx='git-branch-delete-interactive' -alias gbX='git-branch-delete-interactive --force' - -# Commit (c) -alias gc='git commit --verbose' -alias gca='git commit --verbose --all' -alias gcm='git commit --message' -alias gco='git checkout' -alias gcO='git checkout --patch' -alias gcf='git commit --amend --reuse-message HEAD' -alias gcF='git commit --verbose --amend' -alias gcp='git cherry-pick --ff' -alias gcP='git cherry-pick --no-commit' -alias gcr='git revert' -alias gcR='git reset "HEAD^"' -alias gcs='git show --pretty=format:"${_git_log_medium_format}"' -alias gcS='git commit -S' -alias gcv='git verify-commit' - -# Conflict (C) -alias gCl='git --no-pager diff --diff-filter=U --name-only' -alias gCa='git add $(gCl)' -alias gCe='git mergetool $(gCl)' -alias gCo='git checkout --ours --' -alias gCO='gCo $(gCl)' -alias gCt='git checkout --theirs --' -alias gCT='gCt $(gCl)' - -# Data (d) -alias gd='git ls-files' -alias gdc='git ls-files --cached' -alias gdx='git ls-files --deleted' -alias gdm='git ls-files --modified' -alias gdu='git ls-files --other --exclude-standard' -alias gdk='git ls-files --killed' -alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"' - -# Fetch (f) -alias gf='git fetch' -alias gfc='git clone' -alias gfm='git pull' -alias gfr='git pull --rebase' -alias gfu='git fetch --all --prune && git merge --ff-only @\{u\}' - -# Grep (g) -alias gg='git grep' -alias ggi='git grep --ignore-case' -alias ggl='git grep --files-with-matches' -alias ggL='git grep --files-without-match' -alias ggv='git grep --invert-match' -alias ggw='git grep --word-regexp' - -# Index (i) -alias gia='git add' -alias giA='git add --patch' -alias giu='git add --update' -alias gid='git diff --no-ext-diff --cached' -alias giD='git diff --no-ext-diff --cached --word-diff' -alias gir='git reset' -alias giR='git reset --patch' -alias gix='git rm --cached -r' -alias giX='git rm --cached -rf' - -# Log (l) -alias gl='git log --topo-order --pretty=format:"${_git_log_medium_format}"' -alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"' -alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"' -alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"' -alias glO='git log --topo-order --pretty=format:"${_git_log_oneline_medium_format}"' -alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"' -alias glG='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_medium_format}"' -alias glv='git log --topo-order --show-signature --pretty=format:"${_git_log_medium_format}"' -alias glc='git shortlog --summary --numbered' - -# Merge (m) -alias gm='git merge' -alias gmC='git merge --no-commit' -alias gmF='git merge --no-ff' -alias gma='git merge --abort' -alias gmt='git mergetool' - -# Push (p) -alias gp='git push' -alias gpf='git push --force' -alias gpa='git push --all' -alias gpA='git push --all && git push --tags' -alias gpt='git push --tags' -alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"' -alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"' - -# Rebase (r) -alias gr='git rebase' -alias gra='git rebase --abort' -alias grc='git rebase --continue' -alias gri='git rebase --interactive' -alias grs='git rebase --skip' - -# Remote (R) -alias gR='git remote' -alias gRl='git remote --verbose' -alias gRa='git remote add' -alias gRx='git remote rm' -alias gRm='git remote rename' -alias gRu='git remote update' -alias gRp='git remote prune' -alias gRs='git remote show' - -# Stash (s) -alias gs='git stash' -alias gsa='git stash apply' -alias gsx='git stash drop' -alias gsX='git-stash-clear-interactive' -alias gsl='git stash list' -alias gsd='git stash show --patch --stat' -alias gsp='git stash pop' -alias gsr='git-stash-recover' -alias gss='git stash save --include-untracked' -alias gsS='git stash save --patch --no-keep-index' -alias gsw='git stash save --include-untracked --keep-index' -alias gsu='git stash show --patch | git apply --reverse' - -# Submodule (S) -alias gS='git submodule' -alias gSa='git submodule add' -alias gSf='git submodule foreach' -alias gSi='git submodule init' -alias gSI='git submodule update --init --recursive' -alias gSl='git submodule status' -alias gSm='git-submodule-move' -alias gSs='git submodule sync' -alias gSu='git submodule foreach git pull origin master' -alias gSx='git-submodule-remove' - -# Tag (t) -alias gt='git tag' -alias gts='git tag --sign' -alias gtv='git verify-tag' -alias gtx='git tag --delete' - -# Working tree (w) -alias gws='git status --short' -alias gwS='git status' -alias gwd='git diff --no-ext-diff' -alias gwD='git diff --no-ext-diff --word-diff' -alias gwr='git reset --soft' -alias gwR='git reset --hard' -alias gwc='git clean --dry-run' -alias gwC='git clean -d --force' -alias gwx='git rm -r' -alias gwX='git rm -rf' - -# Misc -alias g..='cd "$(git-root || print .)"' diff --git a/modules/history-substring-search/README.md b/modules/history-substring-search/README.md deleted file mode 100644 index 17778c3..0000000 --- a/modules/history-substring-search/README.md +++ /dev/null @@ -1,19 +0,0 @@ -history-substring-search -======================== - -Allows for fish-like searching of history with UP and DOWN. - -![example][example] - -If you use -[syntax-highlighting](https://github.com/zimfw/zimfw/tree/master/modules/syntax-highlighting), -make sure you place 'syntax-highlighting' before 'history-substring-search' on -the second line of `zmodules` in your `.zimrc`. - -Contributing ------------- - -Contributions should be submitted [upstream to -zsh-history-substring-search](https://github.com/zsh-users/zsh-history-substring-search). - -[example]: https://i.eriner.me/zim_history-substring-search.gif diff --git a/modules/history-substring-search/external b/modules/history-substring-search/external deleted file mode 160000 index 933733e..0000000 --- a/modules/history-substring-search/external +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 933733e86724a018cb98cb8f514fc3d323461f74 diff --git a/modules/history-substring-search/init.zsh b/modules/history-substring-search/init.zsh deleted file mode 100644 index 619bda0..0000000 --- a/modules/history-substring-search/init.zsh +++ /dev/null @@ -1,11 +0,0 @@ -# -# Enable searching history with substrings -# - -# Source script -source ${0:h}/external/zsh-history-substring-search.zsh || return 1 - -# Bind up and down keys -zmodload -F zsh/terminfo +p:terminfo -bindkey "${terminfo[kcuu1]}" history-substring-search-up -bindkey "${terminfo[kcud1]}" history-substring-search-down diff --git a/modules/history/README.md b/modules/history/README.md deleted file mode 100644 index 46f5f77..0000000 --- a/modules/history/README.md +++ /dev/null @@ -1,28 +0,0 @@ -History -======= - -Sets sane default history options. - -History file is set to save in `${ZDOTDIR:-${HOME}}/.zhistory` - -(most likely ~/.zhistory) - -Zsh Options ------------ - -| Option | Effect | -| ------ | ------ | -| BANG_HIST | Use csh-style '!' expansion | -| EXTENDED_HISTORY | Save timestamps along with commands | -| INC_APPEND_HISTORY | Commands are added to the history file immediately upon execution | -| SHARE_HISTORY | Causes all terminals to share the same history 'session' | -| HIST_IGNORE_DUPS | Do not enter immediate duplicates into history | -| HIST_IGNORE_ALL_DUPS | If duplicate is to be added, remove older instance in history | -| HIST_IGNORE_SPACE | Do not add any commands to history that begin with a space | -| HIST_SAVE_NO_DUPS | When saving, older commands that duplicate newer commands are omitted | -| HIST_VERIFY | Upon history 'selection', don't execute immediately. Require a carriage return | - -Aliases -------- - - * `history-stat` lists the 10 most used commands diff --git a/modules/history/init.zsh b/modules/history/init.zsh deleted file mode 100644 index d0d7928..0000000 --- a/modules/history/init.zsh +++ /dev/null @@ -1,46 +0,0 @@ -# -# Configures history options -# - -# sets the location of the history file -HISTFILE="${ZDOTDIR:-${HOME}}/.zhistory" - -# limit of history entries -HISTSIZE=10000 -SAVEHIST=10000 - -# Perform textual history expansion, csh-style, treating the character ‘!’ specially. -setopt BANG_HIST - -# Save each command’s beginning timestamp (in seconds since the epoch) and the duration (in seconds) to the history file. -# ‘: :;’. -setopt EXTENDED_HISTORY - -# This options works like APPEND_HISTORY except that new history lines are added to the ${HISTFILE} incrementally -# (as soon as they are entered), rather than waiting until the shell exits. -setopt INC_APPEND_HISTORY - -# Shares history across all sessions rather than waiting for a new shell invocation to read the history file. -setopt SHARE_HISTORY - -# Do not enter command lines into the history list if they are duplicates of the previous event. -setopt HIST_IGNORE_DUPS - -# If a new command line being added to the history list duplicates an older one, -# the older command is removed from the list (even if it is not the previous event). -setopt HIST_IGNORE_ALL_DUPS - -# Remove command lines from the history list when the first character on the line is a space, -# or when one of the expanded aliases contains a leading space. -setopt HIST_IGNORE_SPACE - -# When writing out the history file, older commands that duplicate newer ones are omitted. -setopt HIST_SAVE_NO_DUPS - -# Whenever the user enters a line with history expansion, don’t execute the line directly; -# instead, perform history expansion and reload the line into the editing buffer. -setopt HIST_VERIFY - - -# Lists the ten most used commands. -alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head" diff --git a/modules/input/README.md b/modules/input/README.md deleted file mode 100644 index 6b49f9a..0000000 --- a/modules/input/README.md +++ /dev/null @@ -1,11 +0,0 @@ -input -===== - -Applies correct bindkeys for input events. - -Without this module, you may experience oddities in how zsh interprets input. -For example, pressing LEFT and then the DELETE key may capitalize characters -rather than delete them. - -This module also provides double-dot parent directory expansion. -It can be enabled by uncommenting `zdouble_dot_expand='true'` in your `.zimrc`. diff --git a/modules/input/init.zsh b/modules/input/init.zsh deleted file mode 100644 index 3f81939..0000000 --- a/modules/input/init.zsh +++ /dev/null @@ -1,106 +0,0 @@ -# -# Editor and input char assignment -# - - -# Return if requirements are not found. -if [[ ${TERM} == 'dumb' ]]; then - return 1 -fi - -# Use human-friendly identifiers. -zmodload -F zsh/terminfo +b:echoti +p:terminfo -typeset -gA key_info -key_info=( - 'Control' '\C-' - 'ControlLeft' '\e[1;5D \e[5D \e\e[D \eOd \eOD' - 'ControlRight' '\e[1;5C \e[5C \e\e[C \eOc \eOC' - 'Escape' '\e' - 'Meta' '\M-' - 'Backspace' ${terminfo[kbs]} - 'BackTab' ${terminfo[kcbt]} - 'Left' ${terminfo[kcub1]} - 'Down' ${terminfo[kcud1]} - 'Right' ${terminfo[kcuf1]} - 'Up' ${terminfo[kcuu1]} - 'Delete' ${terminfo[kdch1]} - 'End' ${terminfo[kend]} - 'F1' ${terminfo[kf1]} - 'F2' ${terminfo[kf2]} - 'F3' ${terminfo[kf3]} - 'F4' ${terminfo[kf4]} - 'F5' ${terminfo[kf5]} - 'F6' ${terminfo[kf6]} - 'F7' ${terminfo[kf7]} - 'F8' ${terminfo[kf8]} - 'F9' ${terminfo[kf9]} - 'F10' ${terminfo[kf10]} - 'F11' ${terminfo[kf11]} - 'F12' ${terminfo[kf12]} - 'Home' ${terminfo[khome]} - 'Insert' ${terminfo[kich1]} - 'PageDown' ${terminfo[knp]} - 'PageUp' ${terminfo[kpp]} -) - -# Bind the keys - -local key -for key (${(s: :)key_info[ControlLeft]}) bindkey ${key} backward-word -for key (${(s: :)key_info[ControlRight]}) bindkey ${key} forward-word - -[[ -n ${key_info[Home]} ]] && bindkey ${key_info[Home]} beginning-of-line -[[ -n ${key_info[End]} ]] && bindkey ${key_info[End]} end-of-line - -[[ -n ${key_info[PageUp]} ]] && bindkey ${key_info[PageUp]} up-line-or-history -[[ -n ${key_info[PageDown]} ]] && bindkey ${key_info[PageDown]} down-line-or-history - -[[ -n ${key_info[Insert]} ]] && bindkey ${key_info[Insert]} overwrite-mode - -if [[ ${zdouble_dot_expand} == 'true' ]]; then - double-dot-expand() { - if [[ ${LBUFFER} == *.. ]]; then - LBUFFER+='/..' - else - LBUFFER+='.' - fi - } - zle -N double-dot-expand - bindkey '.' double-dot-expand -fi - -[[ -n ${key_info[Backspace]} ]] && bindkey ${key_info[Backspace]} backward-delete-char -[[ -n ${key_info[Delete]} ]] && bindkey ${key_info[Delete]} delete-char - -[[ -n ${key_info[Left]} ]] && bindkey ${key_info[Left]} backward-char -[[ -n ${key_info[Right]} ]] && bindkey ${key_info[Right]} forward-char - -# Expandpace. -bindkey ' ' magic-space - -# Clear -bindkey "${key_info[Control]}L" clear-screen - -# Bind Shift + Tab to go to the previous menu item. -[[ -n ${key_info[BackTab]} ]] && bindkey ${key_info[BackTab]} reverse-menu-complete - -autoload -Uz is-at-least && if ! is-at-least 5.3; then - # Redisplay after completing, and avoid blank prompt after - expand-or-complete-with-redisplay() { - print -Pn '...' - zle expand-or-complete - zle redisplay - } - zle -N expand-or-complete-with-redisplay - bindkey "${key_info[Control]}I" expand-or-complete-with-redisplay -fi - -# Put into application mode and validate ${terminfo} -zle-line-init() { - (( ${+terminfo[smkx]} )) && echoti smkx -} -zle-line-finish() { - (( ${+terminfo[rmkx]} )) && echoti rmkx -} -zle -N zle-line-init -zle -N zle-line-finish diff --git a/modules/pacman/README.md b/modules/pacman/README.md deleted file mode 100644 index 0cf9ea1..0000000 --- a/modules/pacman/README.md +++ /dev/null @@ -1,61 +0,0 @@ -Pacman -====== - -Adds aliases for the pacman package manager. - -Also includes optional helper(s). - -.zimrc Configuration -------------- - * `zpacman_frontend='helper_here'` Set helper_here to a wrapper if applicable (powerpill, pacmatic, etc). - * `zpacman_helper=(aur)` add/remove any helper scripts to be loaded here. - -Helpers -------- - -### aur - -provides simple AUR helper aliases. - - * `aurb package_name` clone the package from the AUR, build, and install. - * `aurd package_name` clone the package from the AUR, but do not build. - * `auru` run inside a directory created with `aurb`, this will update, build, and install a package. - -Aliases -------- - -### Build - - * `pacb` build package in the current directory, cleanup, and install. - -### Install - - * `paci` install, sync, and upgrade packages. - * `pacu` install, sync, and upgrade packages (forcibly refresh package list). - * `pacU` install packages from pkg file. - * `pacd` install all packages in current directory. - -### Remove - - * `pacr` remove package and unneeded dependencies. - * `pacrm` remove package, unneded dependencies, and configuration files. - -### Query - - * `pacq` query package information from remote repository - * `pacQ` query package information from local repository - -### Search - - * `pacs` search for package in the remote repository - * `pacS` search for package in the local repository - -### Orphans - - * `pacol` list orphan packages - * `pacor` remove all orphan packages - -### Ownership - - * `pacown` list all files provided by a given package - * `pacblame` show package(s) that own a specified file diff --git a/modules/pacman/helper_aur.zsh b/modules/pacman/helper_aur.zsh deleted file mode 100644 index 3d88883..0000000 --- a/modules/pacman/helper_aur.zsh +++ /dev/null @@ -1,20 +0,0 @@ -# -# AUR aliases -# - -# download and build AUR package -aurb() { - git clone https://aur.archlinux.org/${1}.git && cd ${1} && makepkg --clean --install --syncdeps -} - -# only download aur package; do not build -aurd() { - git clone https://aur.archlinux.org/${1}.git -} - -# remove old package, rebuild, and install. -#NOTE: this is will remove any unstashed/uncommitted changes. -# due to how makepkg will update the PKGBUILD, a git pull alone will not suffice. -auru() { - git reset HEAD --hard && git pull && makepkg --clean --force --install --syncdeps --cleanbuild -} diff --git a/modules/pacman/init.zsh b/modules/pacman/init.zsh deleted file mode 100644 index 3a559b5..0000000 --- a/modules/pacman/init.zsh +++ /dev/null @@ -1,135 +0,0 @@ -# -# Pacman aliases -# - -# ${zpacman_frontend} is provided by either .zimrc or (if not set) init.zsh -# The zpacman_frontend is _only_ used for package installs. - -# -# Setup -# - -# ensure pacman is available -if (( ! ${+commands[pacman]} )); then - return 1 -fi - -local zpacman_frontend_priv helper - -if (( ! ${+zpacman_frontend} )); then - zpacman_frontend='pacman' - zpacman_frontend_priv='sudo pacman' -elif (( ! ${+commands[${zpacman_frontend}]} )); then - print "pacman frontend \"${zpacman_frontend}\" is invalid or not installed. Reverting to \"pacman\". -You can fix this error by editing the 'zpacman_frontend' variable in your .zimrc" >&2 - zpacman_frontend='pacman' - zpacman_frontend_priv='sudo pacman' -elif [[ ${zpacman_frontend} == ("yaourt"|"pacaur") ]]; then - # yaourt and pacaur handles SUID themselves - zpacman_frontend_priv="${zpacman_frontend}" -else - zpacman_frontend_priv="sudo ${zpacman_frontend}" -fi - - -# -# General -# - -alias pac=${zpacman_frontend} - -# -# Build -# - -# build package in current directory, cleanup, and install -alias pacb='makepkg -sci' - -# -# Install -# - -#NOTE: Installing/upgrading individual packages is NOT supported. Sync and upgrade ALL on install. - -# install, sync, and upgrade packages -alias paci="${zpacman_frontend_priv} -Syu" - -# install packages without syncing -alias pacI="${zpacman_frontend_priv} -S" - -# install, sync, and upgrade packages (forcibly refresh package lists) -alias pacu="${zpacman_frontend_priv} -Syyu" - -# install packages by filename -alias pacU="${zpacman_frontend_priv} -U" - -# install all packages in current directory -alias pacd="${zpacman_frontend_priv} -U *.pkg.*" - - -# -# Remove -# - -# remove package and unneeded dependencies -alias pacr="${zpacman_frontend_priv} -R" - -# remove package, unneeded dependencies, and configuration files -alias pacrm="${zpacman_frontend_priv} -Rns" - - -# -# Query -# - -# query package information from the remote repository -alias pacq="${zpacman_frontend} -Si" - -# query package information from the local repository -alias pacQ="${zpacman_frontend} -Qi" - - -# -# Search -# - -# search for package in the remote repository -alias pacs="${zpacman_frontend} -Ss" - -# search for the package in the local repository -alias pacS="${zpacman_frontend} -Qs" - - -# -# Orphans -# - -# list orphan packages -alias pacol="${zpacman_frontend} -Qdt" - -# remove orphan packages -alias pacor="${zpacman_frontend_priv} -Rns \$(pacman -Qtdq)" - - -# -# Ownership -# - -# list all files that belong to a package -alias pacown="${zpacman_frontend} -Ql" - -# show package(s) owning the specified file -alias pacblame="${zpacman_frontend} -Qo" - -# -# Helpers -# - -# source helper functions/aliases -for helper in ${zpacman_helper[@]}; do - if [[ -s ${0:h}/helper_${helper}.zsh ]]; then - source ${0:h}/helper_${helper}.zsh - else - print "no such helper script \"helper_${helper}.zsh\"" >&2 - fi -done diff --git a/modules/prompt/README.md b/modules/prompt/README.md deleted file mode 100644 index edd0018..0000000 --- a/modules/prompt/README.md +++ /dev/null @@ -1,15 +0,0 @@ -Prompt -====== - -Initializes and provides customizable prompt themes. - -Images of various prompt themes can be found on the [wiki](https://github.com/zimfw/zimfw/wiki/Themes). - -A list of available prompts can be found by running `prompt -l`. - -To test a prompt, simply run `prompt prompt_name_here`. - -.zimrc Configuration --------------------- - - * `zprompt_theme='eriner'` change 'eriner' to the name of your desired prompt. This will set it as you default prompt. diff --git a/modules/prompt/external-themes/lean b/modules/prompt/external-themes/lean deleted file mode 160000 index 3cf61b2..0000000 --- a/modules/prompt/external-themes/lean +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3cf61b240d0bb0e3d1c517d2324534ddbf3614e8 diff --git a/modules/prompt/external-themes/liquidprompt b/modules/prompt/external-themes/liquidprompt deleted file mode 160000 index 9c80396..0000000 --- a/modules/prompt/external-themes/liquidprompt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9c80396021a8106bfaeade9a1ea51b85152e951d diff --git a/modules/prompt/external-themes/pure b/modules/prompt/external-themes/pure deleted file mode 160000 index a95d55c..0000000 --- a/modules/prompt/external-themes/pure +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a95d55cc7d3a73fc562ac11e23c26113ed6d58cf diff --git a/modules/prompt/functions/async b/modules/prompt/functions/async deleted file mode 120000 index 0429419..0000000 --- a/modules/prompt/functions/async +++ /dev/null @@ -1 +0,0 @@ -../external-themes/pure/async.zsh \ No newline at end of file diff --git a/modules/prompt/functions/ext-liquidprompt b/modules/prompt/functions/ext-liquidprompt deleted file mode 120000 index 588a0c8..0000000 --- a/modules/prompt/functions/ext-liquidprompt +++ /dev/null @@ -1 +0,0 @@ -../external-themes/liquidprompt/liquidprompt \ No newline at end of file diff --git a/modules/prompt/functions/prompt_eriner_setup b/modules/prompt/functions/prompt_eriner_setup deleted file mode 120000 index d727475..0000000 --- a/modules/prompt/functions/prompt_eriner_setup +++ /dev/null @@ -1 +0,0 @@ -../themes/eriner.zsh-theme \ No newline at end of file diff --git a/modules/prompt/functions/prompt_gitster_setup b/modules/prompt/functions/prompt_gitster_setup deleted file mode 120000 index a818a68..0000000 --- a/modules/prompt/functions/prompt_gitster_setup +++ /dev/null @@ -1 +0,0 @@ -../themes/gitster.zsh-theme \ No newline at end of file diff --git a/modules/prompt/functions/prompt_lean_setup b/modules/prompt/functions/prompt_lean_setup deleted file mode 120000 index 13294d9..0000000 --- a/modules/prompt/functions/prompt_lean_setup +++ /dev/null @@ -1 +0,0 @@ -../external-themes/lean/prompt_lean_setup \ No newline at end of file diff --git a/modules/prompt/functions/prompt_liquidprompt_setup b/modules/prompt/functions/prompt_liquidprompt_setup deleted file mode 100644 index fa2b0b1..0000000 --- a/modules/prompt/functions/prompt_liquidprompt_setup +++ /dev/null @@ -1,12 +0,0 @@ -prompt_liquidprompt_setup() { - autoload -Uz ex-liquidprompt - ext-liquidprompt -} - -prompt_liquidprompt_preview() { - _lp_set_prompt - prompt_preview_theme liquidprompt - prompt_off -} - -prompt_liquidprompt_setup "$@" diff --git a/modules/prompt/functions/prompt_magicmace_setup b/modules/prompt/functions/prompt_magicmace_setup deleted file mode 120000 index cafc569..0000000 --- a/modules/prompt/functions/prompt_magicmace_setup +++ /dev/null @@ -1 +0,0 @@ -../themes/magicmace.zsh-theme \ No newline at end of file diff --git a/modules/prompt/functions/prompt_minimal_setup b/modules/prompt/functions/prompt_minimal_setup deleted file mode 120000 index 7e226df..0000000 --- a/modules/prompt/functions/prompt_minimal_setup +++ /dev/null @@ -1 +0,0 @@ -../themes/minimal.zsh-theme \ No newline at end of file diff --git a/modules/prompt/functions/prompt_pure_setup b/modules/prompt/functions/prompt_pure_setup deleted file mode 120000 index 30f245d..0000000 --- a/modules/prompt/functions/prompt_pure_setup +++ /dev/null @@ -1 +0,0 @@ -../external-themes/pure/pure.zsh \ No newline at end of file diff --git a/modules/prompt/functions/prompt_steeef_setup b/modules/prompt/functions/prompt_steeef_setup deleted file mode 120000 index c2abe5e..0000000 --- a/modules/prompt/functions/prompt_steeef_setup +++ /dev/null @@ -1 +0,0 @@ -../themes/steeef.zsh-theme \ No newline at end of file diff --git a/modules/prompt/functions/short_pwd b/modules/prompt/functions/short_pwd deleted file mode 100644 index 37950cc..0000000 --- a/modules/prompt/functions/short_pwd +++ /dev/null @@ -1,13 +0,0 @@ -# shortens the pwd for use in prompt - -local current_dir="${1:-${PWD}}" -local return_dir='~' - -current_dir="${current_dir/#${HOME}/~}" - -# if we aren't in ~ -if [[ ${current_dir} != '~' ]]; then - return_dir="${${${${(@j:/:M)${(@s:/:)current_dir}##.#?}:h}%/}//\%/%%}/${${current_dir:t}//\%/%%}" -fi - -print ${return_dir} diff --git a/modules/prompt/init.zsh b/modules/prompt/init.zsh deleted file mode 100644 index f3f5e8d..0000000 --- a/modules/prompt/init.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# -# load user-defined prompt -# - -if [[ ! ${TERM} == (linux|*bsd*|dumb) ]] && (( ${+zprompt_theme} )); then - autoload -Uz promptinit && promptinit - prompt ${(ps: :)${zprompt_theme}} -fi diff --git a/modules/prompt/themes/eriner.zsh-theme b/modules/prompt/themes/eriner.zsh-theme deleted file mode 100644 index 8076ce4..0000000 --- a/modules/prompt/themes/eriner.zsh-theme +++ /dev/null @@ -1,140 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -# -# Eriner's Theme - fork of agnoster -# A Powerline-inspired theme for ZSH -# -# In order for this theme to render correctly, a font with Powerline symbols is -# required. A simple way to install a font with Powerline symbols is to follow -# the instructions here: https://github.com/powerline/fonts#installation -# -# The aim of this theme is to only show you *relevant* information. Like most -# prompts, it will only show git information when in a git working directory. -# However, it goes a step further: everything from the current user and -# hostname to whether the last call exited with an error to whether background -# jobs are running in this shell will all be displayed automatically when -# appropriate. -# -# Requires the `git-info` zmodule to be included in the .zimrc file. - -prompt_eriner_help () { - cat < /dev/null) && prompt_short_dir=${prompt_short_dir#${$(short_pwd $git_root):h}/} - print -n "%F{white}${prompt_short_dir}" -} - -prompt_gitster_git() { - [[ -n ${git_info} ]] && print -n "${(e)git_info[prompt]}" -} - -prompt_gitster_precmd() { - (( ${+functions[git-info]} )) && git-info -} - -prompt_gitster_setup() { - local prompt_gitster_status='%(?:%F{green}:%F{red})➜ ' - - autoload -Uz add-zsh-hook && add-zsh-hook precmd prompt_gitster_precmd - - prompt_opts=(cr percent sp subst) - - zstyle ':zim:git-info:branch' format '%b' - zstyle ':zim:git-info:commit' format '%c' - zstyle ':zim:git-info:clean' format '%F{green}✓' - zstyle ':zim:git-info:dirty' format '%F{yellow}✗' - zstyle ':zim:git-info:keys' format \ - 'prompt' ' %F{cyan}%b%c %C%D' - - PS1="${prompt_gitster_status}\$(prompt_gitster_pwd)\$(prompt_gitster_git)%f " - RPS1='' -} - -prompt_gitster_setup "${@}" diff --git a/modules/prompt/themes/magicmace.zsh-theme b/modules/prompt/themes/magicmace.zsh-theme deleted file mode 100644 index 1cceb34..0000000 --- a/modules/prompt/themes/magicmace.zsh-theme +++ /dev/null @@ -1,72 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -# -# magicmace theme -# Ideas and code taken from: -# xero's zsh prompt -# eriner's eriner prompt -# -# Requires the `git-info` zmodule to be included in the .zimrc file. - -# Global variables -function { - COLOR_ROOT="%F{red}" - COLOR_USER="%F{cyan}" - COLOR_NORMAL="%F{white}" - COLOR_ERROR="%F{red}" - - if (( ${EUID} )); then - COLOR_USER_LEVEL=${COLOR_USER} - else - COLOR_USER_LEVEL=${COLOR_ROOT} - fi -} - -# Status: -# - was there an error? -# - are there background jobs? -# - are we in a ranger session? -prompt_magicmace_status() { - local symbols="" - - (( ${RETVAL} )) && symbols+="${COLOR_ERROR}${RETVAL}${COLOR_NORMAL}" # $? for error. - (( $(jobs -l | wc -l) > 0 )) && symbols+='b' # 'b' for background. - (( ${RANGER_LEVEL} )) && symbols+='r' # 'r' for... you guessed it! - - [[ -n ${symbols} ]] && print -n "─${COLOR_NORMAL}${symbols}${COLOR_USER_LEVEL}─" -} - -prompt_magicmace_git() { - [[ -n ${git_info} ]] && print -n "${(e)git_info[prompt]}" -} - -prompt_magicmace_precmd() { - # While it would be apt to have this as a local variable in prompt_status(), - # $? (returned value) and ${(%):-%?} ("The return status of the last command - # executed just before the prompt") both change before executing the function. - # Is this perhaps because prompt_status _is_ here? - # We could also just set $? as an argument, and thus get our nifty local variable, - # but that's stretching it, and makes the code harder to read. - RETVAL=$? - (( ${+functions[git-info]} )) && git-info -} - -prompt_magicmace_setup() { - autoload -Uz add-zsh-hook && add-zsh-hook precmd prompt_magicmace_precmd - autoload -Uz colors && colors - - prompt_opts=(cr percent sp subst) - - zstyle ':zim:git-info:branch' format '%b' - zstyle ':zim:git-info:commit' format '%c...' - zstyle ':zim:git-info:dirty' format '*' - zstyle ':zim:git-info:ahead' format '↑' - zstyle ':zim:git-info:behind' format '↓' - zstyle ':zim:git-info:keys' format \ - 'prompt' '─[${COLOR_NORMAL}%b%c%D%A%B${COLOR_USER_LEVEL}]' - - # Call git directly, ignoring aliases under the same name. - PS1='${COLOR_USER_LEVEL}$(prompt_magicmace_status)[${COLOR_NORMAL}$(short_pwd)${COLOR_USER_LEVEL}]$(prompt_magicmace_git)── ─%f ' - RPS1='' -} - -prompt_magicmace_setup "${@}" diff --git a/modules/prompt/themes/minimal.zsh-theme b/modules/prompt/themes/minimal.zsh-theme deleted file mode 100644 index de10543..0000000 --- a/modules/prompt/themes/minimal.zsh-theme +++ /dev/null @@ -1,88 +0,0 @@ -# -# Minimal theme -# https://github.com/S1cK94/minimal -# -# Requires the `git-info` zmodule to be included in the .zimrc file. - -# Global variables -function { - PROMPT_CHAR='❯' - - ON_COLOR='%F{green}' - OFF_COLOR='%f' - ERR_COLOR='%F{red}' -} - -prompt_minimal_user() { - print -n '%(!.${ON_COLOR}.${OFF_COLOR})${PROMPT_CHAR}' -} - -prompt_minimal_jobs() { - print -n '%(1j.${ON_COLOR}.${OFF_COLOR})${PROMPT_CHAR}' -} - -prompt_minimal_vimode() { - local color - - case ${KEYMAP} in - main|viins) - color=${ON_COLOR} - ;; - *) - color=${OFF_COLOR} - ;; - esac - - print -n "${color}${PROMPT_CHAR}" -} - -prompt_minimal_status() { - print -n '%(0?.${ON_COLOR}.${ERR_COLOR})${PROMPT_CHAR}' -} - -prompt_minimal_path() { - local path_color='%F{244}' - print -n "${path_color}${$(short_pwd)//\//%f\/${path_color}}%f" -} - -prompt_minimal_git() { - if [[ -n ${git_info} ]]; then - print -n " ${(e)git_info[color]}${(e)git_info[prompt]}" - fi -} - -function zle-line-init zle-keymap-select { - zle reset-prompt - zle -R -} - -prompt_minimal_precmd() { - (( ${+functions[git-info]} )) && git-info -} - -prompt_minimal_setup() { - zle -N zle-line-init - zle -N zle-keymap-select - - autoload -Uz colors && colors - autoload -Uz add-zsh-hook - - prompt_opts=(cr percent sp subst) - - add-zsh-hook precmd prompt_minimal_precmd - - zstyle ':zim:git-info:branch' format '%b' - zstyle ':zim:git-info:commit' format '%c' - zstyle ':zim:git-info:dirty' format '${ERR_COLOR}' - zstyle ':zim:git-info:diverged' format '${ERR_COLOR}' - zstyle ':zim:git-info:behind' format '%F{11}' - zstyle ':zim:git-info:ahead' format '${OFF_COLOR}' - zstyle ':zim:git-info:keys' format \ - 'prompt' '%b%c' \ - 'color' '$(coalesce "%D" "%V" "%B" "%A" "${ON_COLOR}")' - - PROMPT="$(prompt_minimal_user)$(prompt_minimal_jobs)\$(prompt_minimal_vimode)$(prompt_minimal_status)%f " - RPROMPT='$(prompt_minimal_path)$(prompt_minimal_git)' -} - -prompt_minimal_setup "$@" diff --git a/modules/prompt/themes/steeef.zsh-theme b/modules/prompt/themes/steeef.zsh-theme deleted file mode 100644 index 4d6b092..0000000 --- a/modules/prompt/themes/steeef.zsh-theme +++ /dev/null @@ -1,114 +0,0 @@ -# vim:et sts=2 sw=2 ft=zsh -# -# A customizable version of the steeef theme from -# https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/steeef.zsh-theme -# -# Requires the `git-info` zmodule to be included in the .zimrc file. - -prompt_steeef_help () { - cat <= 256 )); then - col_user="%F{${1:-135}}" - col_host="%F{${2:-166}}" - col_pwd="%F{${3:-118}}" - col_brnch="%F{${4:-81}}" - col_unidx="%F{${5:-166}}" - col_idx="%F{${7:-118}}" - col_untrk="%F{${9:-161}}" - else - col_user="%F{${1:-magenta}}" - col_host="%F{${2:-yellow}}" - col_pwd="%F{${3:-green}}" - col_brnch="%F{${4:-cyan}}" - col_unidx="%F{${5:-yellow}}" - col_idx="%F{${7:-green}}" - col_untrk="%F{${9:-red}}" - fi - local ind_unidx=${6:-●} - local ind_idx=${8:-●} - local ind_untrk=${10:-●} - local col_stash=${11:+%F{${11}}} - local ind_stash=${12} - - autoload -Uz add-zsh-hook && add-zsh-hook precmd prompt_steeef_precmd - - prompt_opts=(cr percent sp subst) - - zstyle ':zim:git-info' verbose 'yes' - zstyle ':zim:git-info:branch' format '%b' - zstyle ':zim:git-info:commit' format '%c' - zstyle ':zim:git-info:action' format "(${col_idx}%s%f)" - zstyle ':zim:git-info:unindexed' format "${col_unidx}${ind_unidx}" - zstyle ':zim:git-info:indexed' format "${col_idx}${ind_idx}" - zstyle ':zim:git-info:untracked' format "${col_untrk}${ind_untrk}" - zstyle ':zim:git-info:stashed' format "${col_stash}${ind_stash}" - zstyle ':zim:git-info:keys' format \ - 'prompt' "(${col_brnch}%b%c%I%i%u%f%S%f)%s" - - PS1=" -${col_user}%n%f at ${col_host}%m%f in ${col_pwd}%~%f\$(prompt_steeef_git)\$(prompt_steeef_virtualenv) -%(!.#.$) " - RPS1='' -} - -prompt_steeef_preview () { - if (( ${#} )); then - prompt_preview_theme steeef "${@}" - else - prompt_preview_theme steeef - print - prompt_preview_theme steeef magenta yellow green cyan magenta '!' green '+' red '?' yellow '$' - fi -} - -prompt_steeef_setup "${@}" diff --git a/modules/ssh/README.md b/modules/ssh/README.md deleted file mode 100644 index ea176c1..0000000 --- a/modules/ssh/README.md +++ /dev/null @@ -1,9 +0,0 @@ -SSH -=== - -Provides a convenient way to load ssh-agent. This enables one-time login and caching of SSH credentials per session. - -.zimrc Configuration --------------------- - - * `zssh_ids=(id_rsa)` add any identities (from ~/.ssh) to this list to have them loaded and cached on login. diff --git a/modules/ssh/init.zsh b/modules/ssh/init.zsh deleted file mode 100644 index 4411406..0000000 --- a/modules/ssh/init.zsh +++ /dev/null @@ -1,46 +0,0 @@ -# -# sets up ssh-agent -# - -# don't do anything unless we can actually use ssh-agent -if (( ! ${+commands[ssh-agent]} )); then - return 1 -fi - -# use a sane temp dir; creating 1k ssh-* files in /tmp is crazy -if [[ ${TMPDIR} ]]; then - local ssh_env=${TMPDIR}/ssh-agent.env - local ssh_sock=${TMPDIR}/ssh-agent.sock -else - # create a sane tmp dir at /tmp/username - mkdir -p /tmp/${USER} - local ssh_env=/tmp/${USER}/ssh-agent.env - local ssh_sock=/tmp/${USER}/ssh-agent.sock -fi - -# start ssh-agent if not already running -if [[ ! -S ${SSH_AUTH_SOCK} ]]; then - # read environment if possible - source ${ssh_env} 2> /dev/null - - if ! ps -U ${LOGNAME} -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then - eval "$(ssh-agent | sed '/^echo /d' | tee ${ssh_env})" - fi -fi - -# create socket -if [[ -S ${SSH_AUTH_SOCKET} && ${SSH_AUTH_SOCKET} != ${ssh_sock} ]]; then - ln -sf ${SSH_AUTH_SOCKET} ${ssh_sock} - export SSH_AUTH_SOCK=${ssh_sock} -fi - -# load ids -if ssh-add -l 2>&1 | grep -q 'no identities'; then - if (( ${#zssh_ids} > 0 )); then - ssh-add "${HOME}/.ssh/${^zssh_ids[@]}" 2> /dev/null - else - ssh-add 2> /dev/null - fi -fi - -unset ssh_{sock,env} diff --git a/modules/syntax-highlighting/README.md b/modules/syntax-highlighting/README.md deleted file mode 100644 index a623def..0000000 --- a/modules/syntax-highlighting/README.md +++ /dev/null @@ -1,21 +0,0 @@ -Syntax-Highlighting -=================== - -Adds fish shell-like [syntax highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) to your shell. - -![syntax-highlighting][syntax_highlighting] - -If you are also using [history-substring-search](https://github.com/zimfw/zimfw/blob/master/modules/history-substring-search/README.md), -ensure you have placed 'syntax-highlighting' before 'history-substring-search' on the second line of `zmodules` in your `.zimrc`. - -.zimrc Configuration --------------------- - - * `zhighlighters=(main brackets cursor)` add any highlighters you want as described [here](https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md#zsh-syntax-highlighting--highlighters). - -Contributing ------------- - -Contributions should be submitted [upstream to zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) - -[syntax_highlighting]: https://i.eriner.me/zim_syntax-highlighting.gif diff --git a/modules/syntax-highlighting/external b/modules/syntax-highlighting/external deleted file mode 160000 index 434af7b..0000000 --- a/modules/syntax-highlighting/external +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 434af7b11dd33641231f1b48b8432e68eb472e46 diff --git a/modules/syntax-highlighting/init.zsh b/modules/syntax-highlighting/init.zsh deleted file mode 100644 index 6dddf5e..0000000 --- a/modules/syntax-highlighting/init.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# -# enables fish-shell like syntax highlighting -# - -# highlighters -ZSH_HIGHLIGHT_HIGHLIGHTERS=(${zhighlighters[@]}) - -source "${0:h}/external/zsh-syntax-highlighting.zsh" || return 1 diff --git a/modules/utility/README.md b/modules/utility/README.md deleted file mode 100644 index 14ef646..0000000 --- a/modules/utility/README.md +++ /dev/null @@ -1,40 +0,0 @@ -utility -======= - -Utility aliases and functions. - -Adds colour to `ls`, `grep` and `less`. - -Aliases -------- - -### ls - - * `ls` lists directories first (GNU only) and with colour (applies to all aliases below). - * `ll` lists with long format and human-readable sizes (applies to all aliases below). - * `l` lists all files. - * `lm` lists all files using pager. - * `lr` lists recursively. - * `lx` lists sorted by extension (GNU only). - * `lk` lists sorted by largest file size last. - * `lt` lists sorted by newest modification time last. - * `lc` lists sorted by newest status change (ctime) last. - -### File Downloads - - * `get` is short for ( `aria2c` || `axel` || `wget` || `curl` ). - -### Resource Usage - - * `df` reports file system disk usage with human-readable sizes. - * `du` reports file disk usage with human-readable sizes. - -### Condoms - - * `chmod` changes file mode verbosely, not operating from `/` (GNU only). - * `chown` changes file owner verbosely, not operating from `/` (GNU only). - * `rm` uses `safe-rm` if available. - -### Misc - - * `mkcd` creates and changes to the given directory. diff --git a/modules/utility/functions/mkcd b/modules/utility/functions/mkcd deleted file mode 100644 index 4f795ce..0000000 --- a/modules/utility/functions/mkcd +++ /dev/null @@ -1 +0,0 @@ -[[ -n ${1} ]] && mkdir -p ${1} && builtin cd ${1} diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh deleted file mode 100644 index d8b3210..0000000 --- a/modules/utility/init.zsh +++ /dev/null @@ -1,114 +0,0 @@ -# -# Utility Functions and Options -# - -# -# Colours -# - -if (( terminfo[colors] >= 8 )); then - - # ls Colours - if (( ${+commands[dircolors]} )); then - # GNU - - (( ! ${+LS_COLORS} )) && if [[ -s ${HOME}/.dir_colors ]]; then - eval "$(dircolors --sh ${HOME}/.dir_colors)" - else - export LS_COLORS='di=1;34:ln=35:so=32:pi=33:ex=31:bd=1;36:cd=1;33:su=30;41:sg=30;46:tw=30;42:ow=30;43' - fi - - alias ls='ls --group-directories-first --color=auto' - else - # BSD - - (( ! ${+LSCOLORS} )) && export LSCOLORS='ExfxcxdxbxGxDxabagacad' - - # stock OpenBSD ls does not support colors at all, but colorls does. - if [[ ${OSTYPE} == openbsd* ]]; then - if (( ${+commands[colorls]} )); then - alias ls='colorls -G' - fi - else - alias ls='ls -G' - fi - fi - - # grep Colours - (( ! ${+GREP_COLOR} )) && export GREP_COLOR='37;45' #BSD - (( ! ${+GREP_COLORS} )) && export GREP_COLORS="mt=${GREP_COLOR}" #GNU - if [[ ${OSTYPE} == openbsd* ]]; then - (( ${+commands[ggrep]} )) && alias grep='ggrep --color=auto' - else - alias grep='grep --color=auto' - fi - - # less Colours - if [[ ${PAGER} == 'less' ]]; then - (( ! ${+LESS_TERMCAP_mb} )) && export LESS_TERMCAP_mb=$'\E[1;31m' # Begins blinking. - (( ! ${+LESS_TERMCAP_md} )) && export LESS_TERMCAP_md=$'\E[1;31m' # Begins bold. - (( ! ${+LESS_TERMCAP_me} )) && export LESS_TERMCAP_me=$'\E[0m' # Ends mode. - (( ! ${+LESS_TERMCAP_se} )) && export LESS_TERMCAP_se=$'\E[0m' # Ends standout-mode. - (( ! ${+LESS_TERMCAP_so} )) && export LESS_TERMCAP_so=$'\E[7m' # Begins standout-mode. - (( ! ${+LESS_TERMCAP_ue} )) && export LESS_TERMCAP_ue=$'\E[0m' # Ends underline. - (( ! ${+LESS_TERMCAP_us} )) && export LESS_TERMCAP_us=$'\E[1;32m' # Begins underline. - fi -fi - - -# -# GNU only -# - -if (( ${+commands[dircolors]} )); then - - alias lx='ll -X' # long format, sort by extension - - # Always wear a condom - alias chmod='chmod --preserve-root -v' - alias chown='chown --preserve-root -v' -fi - - -# -# ls Aliases -# - -alias ll='ls -lh' # long format and human-readable sizes -alias l='ll -A' # long format, all files -[[ -n ${PAGER} ]] && alias lm="l | ${PAGER}" # long format, all files, use pager -alias lr='ll -R' # long format, recursive -alias lk='ll -Sr' # long format, largest file size last -alias lt='ll -tr' # long format, newest modification time last -alias lc='lt -c' # long format, newest status change (ctime) last - - -# -# File Downloads -# - -# order of preference: aria2c, axel, wget, curl. This order is derrived from speed based on personal tests. -if (( ${+commands[aria2c]} )); then - alias get='aria2c --max-connection-per-server=5 --continue' -elif (( ${+commands[axel]} )); then - alias get='axel --num-connections=5 --alternate' -elif (( ${+commands[wget]} )); then - alias get='wget --continue --progress=bar --timestamping' -elif (( ${+commands[curl]} )); then - alias get='curl --continue-at - --location --progress-bar --remote-name --remote-time' -fi - - -# -# Resource Usage -# - -alias df='df -h' -alias du='du -h' - - -# not aliasing rm -i, but if safe-rm is available, use condom. -# if safe-rmdir is available, the OS is suse which has its own terrible 'safe-rm' which is not what we want -if (( ${+commands[safe-rm]} && ! ${+commands[safe-rmdir]} )); then - alias rm='safe-rm' -fi