update oh my zsh
This commit is contained in:
parent
4764bc8f9e
commit
308c4ad023
@ -132,6 +132,10 @@ ZSH_THEME_RANDOM_CANDIDATES=(
|
||||
)
|
||||
```
|
||||
|
||||
### FAQ
|
||||
|
||||
If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).
|
||||
|
||||
## Advanced Topics
|
||||
|
||||
If you're the type that likes to get their hands dirty, these sections might resonate.
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
**Maintainer:** [@emzar](https://github.com/emzar)
|
||||
|
||||
This plugin adds many useful aliases.
|
||||
This plugin adds many useful aliases for [arcanist](https://github.com/phacility/arcanist).
|
||||
|
@ -6,16 +6,37 @@ Colorize will highlight the content based on the filename extension. If it can't
|
||||
method for a given extension, it will try to find one by looking at the file contents. If no highlight method
|
||||
is found it will just cat the file normally, without syntax highlighting.
|
||||
|
||||
To use it, add colorize to the plugins array of your zshrc file:
|
||||
## Setup
|
||||
|
||||
To use it, add colorize to the plugins array of your `~/.zshrc` file:
|
||||
```
|
||||
plugins=(... colorize)
|
||||
```
|
||||
|
||||
## Styles
|
||||
## Configuration
|
||||
|
||||
### Requirements
|
||||
|
||||
This plugin requires that either of the following tools be installed:
|
||||
|
||||
* Chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma)
|
||||
* Pygments be installed: [pygments.org](https://pygments.org/)
|
||||
|
||||
### Colorize tool
|
||||
|
||||
Colorize supports `pygmentize` and `chroma` as syntax highlighter. By default colorize uses `pygmentize` unless it's not installed and `chroma` is. This can be overridden by the `ZSH_COLORIZE_TOOL` environment variable:
|
||||
|
||||
```
|
||||
ZSH_COLORIZE_TOOL=chroma
|
||||
```
|
||||
|
||||
### Styles
|
||||
|
||||
Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable:
|
||||
|
||||
`ZSH_COLORIZE_STYLE="colorful"`
|
||||
```
|
||||
ZSH_COLORIZE_STYLE="colorful"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
@ -29,7 +50,3 @@ Note that `cless` will behave as less when provided more than one file: you have
|
||||
the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
|
||||
But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
|
||||
In the latter form, the file contents will be concatenated and presented by less as a single file.
|
||||
|
||||
## Requirements
|
||||
|
||||
You have to install Pygments first: [pygments.org](http://pygments.org/download.html)
|
||||
|
@ -3,21 +3,42 @@ alias ccat='colorize_via_pygmentize'
|
||||
alias cless='colorize_via_pygmentize_less'
|
||||
|
||||
colorize_via_pygmentize() {
|
||||
if ! (( $+commands[pygmentize] )); then
|
||||
echo "package 'Pygments' is not installed!"
|
||||
local available_tools=("chroma" "pygmentize")
|
||||
|
||||
if [ -z "$ZSH_COLORIZE_TOOL" ]; then
|
||||
if (( $+commands[pygmentize] )); then
|
||||
ZSH_COLORIZE_TOOL="pygmentize"
|
||||
elif (( $+commands[chroma] )); then
|
||||
ZSH_COLORIZE_TOOL="chroma"
|
||||
else
|
||||
echo "Neither 'pygments' nor 'chroma' is installed!" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then
|
||||
echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2
|
||||
return 1
|
||||
elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then
|
||||
echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# If the environment varianle ZSH_COLORIZE_STYLE
|
||||
# If the environment variable ZSH_COLORIZE_STYLE
|
||||
# is set, use that theme instead. Otherwise,
|
||||
# use the default.
|
||||
if [ -z $ZSH_COLORIZE_STYLE ]; then
|
||||
ZSH_COLORIZE_STYLE="default"
|
||||
if [ -z "$ZSH_COLORIZE_STYLE" ]; then
|
||||
# Both pygmentize & chroma support 'emacs'
|
||||
ZSH_COLORIZE_STYLE="emacs"
|
||||
fi
|
||||
|
||||
# pygmentize stdin if no arguments passed
|
||||
if [ $# -eq 0 ]; then
|
||||
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
|
||||
else
|
||||
chroma --style="$ZSH_COLORIZE_STYLE"
|
||||
fi
|
||||
return $?
|
||||
fi
|
||||
|
||||
@ -27,12 +48,16 @@ colorize_via_pygmentize() {
|
||||
local FNAME lexer
|
||||
for FNAME in "$@"
|
||||
do
|
||||
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||
lexer=$(pygmentize -N "$FNAME")
|
||||
if [[ $lexer != text ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
|
||||
else
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
|
||||
fi
|
||||
else
|
||||
chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -32,17 +32,21 @@ plugins=(... extract)
|
||||
| `tar` | Tarball |
|
||||
| `tar.bz2` | Tarball with bzip2 compression |
|
||||
| `tar.gz` | Tarball with gzip compression |
|
||||
| `tar.lz` | Tarball with lzip compression |
|
||||
| `tar.xz` | Tarball with lzma2 compression |
|
||||
| `tar.zma` | Tarball with lzma compression |
|
||||
| `tar.zst` | Tarball with zstd compression |
|
||||
| `tbz` | Tarball with bzip compression |
|
||||
| `tbz2` | Tarball with bzip2 compression |
|
||||
| `tgz` | Tarball with gzip compression |
|
||||
| `tlz` | Tarball with lzma compression |
|
||||
| `txz` | Tarball with lzma2 compression |
|
||||
| `tzst` | Tarball with zstd compression |
|
||||
| `war` | Web Application archive (Java-based) |
|
||||
| `xpi` | Mozilla XPI module file |
|
||||
| `xz` | LZMA2 archive |
|
||||
| `zip` | Zip archive |
|
||||
| `zst` | Zstandard file (zstd) |
|
||||
|
||||
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
|
||||
more information regarding archive formats.
|
||||
|
@ -3,5 +3,5 @@
|
||||
|
||||
_arguments \
|
||||
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
|
||||
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \
|
||||
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lz|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
|
||||
&& return 0
|
||||
|
@ -40,7 +40,12 @@ extract() {
|
||||
tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$1" \
|
||||
|| lzcat "$1" | tar xvf - ;;
|
||||
(*.tar.zst|*.tzst)
|
||||
tar --zstd --help &> /dev/null \
|
||||
&& tar --zstd -xvf "$1" \
|
||||
|| zstdcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
@ -59,6 +64,7 @@ extract() {
|
||||
cd ..; rm *.tar.* debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*.zst) unzstd "$1" ;;
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" >&2
|
||||
success=1
|
||||
|
@ -5,7 +5,7 @@
|
||||
To use it, add `fasd` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... fd)
|
||||
plugins=(... fasd)
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
@ -12,6 +12,7 @@ function setup_using_base_dir() {
|
||||
"${HOME}/.fzf"
|
||||
"/usr/local/opt/fzf"
|
||||
"/usr/share/fzf"
|
||||
"/usr/local/share/examples/fzf"
|
||||
)
|
||||
for dir in ${fzfdirs}; do
|
||||
if [[ -d "${dir}" ]]; then
|
||||
@ -67,7 +68,10 @@ function setup_using_debian_package() {
|
||||
# NOTE: There is no need to configure PATH for debian package, all binaries
|
||||
# are installed to /usr/bin by default
|
||||
|
||||
local completions="/usr/share/zsh/vendor-completions/_fzf"
|
||||
# Determine completion file path: first bullseye/sid, then buster/stretch
|
||||
local completions="/usr/share/doc/fzf/examples/completion.zsh"
|
||||
[[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf"
|
||||
|
||||
local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
|
||||
|
||||
# Auto-completion
|
||||
|
@ -4,26 +4,21 @@ from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import shlex
|
||||
from subprocess import Popen, PIPE, check_output
|
||||
|
||||
|
||||
def get_tagname_or_hash():
|
||||
"""return tagname if exists else hash"""
|
||||
cmd = 'git log -1 --format="%h%d"'
|
||||
output = check_output(shlex.split(cmd)).decode('utf-8').strip()
|
||||
hash_, tagname = None, None
|
||||
# get hash
|
||||
m = re.search('\(.*\)$', output)
|
||||
if m:
|
||||
hash_ = output[:m.start()-1]
|
||||
# get tagname
|
||||
m = re.search('tag: .*[,\)]', output)
|
||||
if m:
|
||||
tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
|
||||
hash_cmd = ['git', 'rev-parse', '--short', 'HEAD']
|
||||
hash_ = check_output(hash_cmd).strip()
|
||||
|
||||
if tagname:
|
||||
return tagname.replace(' ', '')
|
||||
# get tagname
|
||||
tags_cmd = ['git', 'for-each-ref', '--points-at=HEAD', '--count=2', '--sort=-version:refname', '--format=%(refname:short)', 'refs/tags']
|
||||
tags = check_output(tags_cmd).split()
|
||||
|
||||
if tags:
|
||||
return tags[0] + ('+' if len(tags) > 1 else '')
|
||||
elif hash_:
|
||||
return hash_
|
||||
return None
|
||||
|
@ -15,7 +15,7 @@ function _start_agent() {
|
||||
zstyle -a :omz:plugins:keychain options options
|
||||
|
||||
# start keychain...
|
||||
keychain ${^options:-} --agents ${agents:-gpg} ${^identities}
|
||||
keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
|
||||
|
||||
# Get the filenames to store/lookup the environment from
|
||||
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
|
||||
|
@ -17,16 +17,16 @@ plugins=(... sbt)
|
||||
| sbcln | `sbt clean` | Deletes all generated files |
|
||||
| sbcc | `sbt clean compile` | Deletes generated files, compiles the main sources |
|
||||
| sbco | `sbt console` | Starts Scala with the compiled sources and all dependencies |
|
||||
| sbcq | `sbt console-quick` | Starts Scala with all dependencies |
|
||||
| sbcp | `sbt console-project` | Starts Scala with sbt and the build definitions |
|
||||
| sbcq | `sbt consoleQuick` | Starts Scala with all dependencies |
|
||||
| sbcp | `sbt consoleProject` | Starts Scala with sbt and the build definitions |
|
||||
| sbd | `sbt doc` | Generates API documentation for Scala source files |
|
||||
| sbdc | `sbt dist:clean` | Deletes the distribution packages |
|
||||
| sbdi | `sbt dist` | Creates the distribution packages |
|
||||
| sbgi | `sbt gen-idea` | Create Idea project files |
|
||||
| sbgi | `sbt genIdea` | Create Idea project files |
|
||||
| sbp | `sbt publish` | Publishes artifacts to the repository |
|
||||
| sbpl | `sbt publish-local` | Publishes artifacts to the local Ivy repository |
|
||||
| sbpl | `sbt publishLocal` | Publishes artifacts to the local Ivy repository |
|
||||
| sbr | `sbt run` | Runs the main class for the project |
|
||||
| sbrm | `sbt run-main` | Runs the specified main class for the project |
|
||||
| sbrm | `sbt runMain` | Runs the specified main class for the project |
|
||||
| sbu | `sbt update` | Resolves and retrieves external dependencies |
|
||||
| sbx | `sbt test` | Compiles and runs all tests |
|
||||
| sba | `sbt assembly` | Create a fat JAR with all dependencies |
|
||||
|
@ -6,23 +6,23 @@ _sbt_commands=(
|
||||
'clean:delete files produced by the build'
|
||||
'compile:compile sources'
|
||||
'console:start the Scala REPL with project classes on the classpath'
|
||||
'console-quick:start the Scala REPL with project deps on the classpath'
|
||||
'console-project:start the Scala REPL w/sbt+build-def on the classpath'
|
||||
'consoleQuick:start the Scala REPL with project deps on the classpath'
|
||||
'consoleProject:start the Scala REPL w/sbt+build-def on the classpath'
|
||||
'dist:generate distribution artifacts'
|
||||
'dist\:clean:clean distribution artifacts'
|
||||
'doc:generate API documentation'
|
||||
'gen-idea:generate Intellij Idea project files'
|
||||
'genIdea:generate Intellij Idea project files'
|
||||
'package:produce the main artifact, such as a binary jar'
|
||||
'package-doc:produce a doc artifact, such as a jar containing API docs'
|
||||
'package-src:produce a source artifact, such as a jar containing sources'
|
||||
'packageDoc:produce a doc artifact, such as a jar containing API docs'
|
||||
'packageSrc:produce a source artifact, such as a jar containing sources'
|
||||
'publish:publish artifacts to a repository'
|
||||
'publish-local:publish artifacts to the local repository'
|
||||
'publish-m2:publish artifacts to the local Maven 2 repository'
|
||||
'publishLocal:publish artifacts to the local repository'
|
||||
'publishM2:publish artifacts to the local Maven 2 repository'
|
||||
'run:run a main class'
|
||||
'run-main:run the main class selected by the first argument'
|
||||
'runMain:run the main class selected by the first argument'
|
||||
'test:execute all tests'
|
||||
'test-only:execute the tests provided as arguments'
|
||||
'test-quick:execute previously failed tests'
|
||||
'testOnly:execute the tests provided as arguments'
|
||||
'testQuick:execute previously failed tests'
|
||||
'update:resolve and optionally retrieve dependencies'
|
||||
)
|
||||
|
||||
|
@ -9,17 +9,17 @@
|
||||
alias sbc='sbt compile'
|
||||
alias sbcc='sbt clean compile'
|
||||
alias sbco='sbt console'
|
||||
alias sbcq='sbt console-quick'
|
||||
alias sbcq='sbt consoleQuick'
|
||||
alias sbcln='sbt clean'
|
||||
alias sbcp='sbt console-project'
|
||||
alias sbcp='sbt consoleProject'
|
||||
alias sbd='sbt doc'
|
||||
alias sbdc='sbt dist:clean'
|
||||
alias sbdi='sbt dist'
|
||||
alias sbgi='sbt gen-idea'
|
||||
alias sbgi='sbt genIdea'
|
||||
alias sbp='sbt publish'
|
||||
alias sbpl='sbt publish-local'
|
||||
alias sbpl='sbt publishLocal'
|
||||
alias sbr='sbt run'
|
||||
alias sbrm='sbt run-main'
|
||||
alias sbrm='sbt runMain'
|
||||
alias sbu='sbt update'
|
||||
alias sbx='sbt test'
|
||||
alias sba='sbt assembly'
|
||||
|
@ -38,3 +38,4 @@ The plugin also supports the following -
|
||||
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
|
||||
| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
|
||||
| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) |
|
||||
| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
|
||||
|
@ -36,6 +36,8 @@ alias tkss='tmux kill-session -t'
|
||||
: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
|
||||
# Set the configuration path
|
||||
: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}
|
||||
# Set -u option to support unicode
|
||||
: ${ZSH_TMUX_UNICODE:=false}
|
||||
|
||||
# Determine if the terminal supports 256 colors
|
||||
if [[ $terminfo[colors] == 256 ]]; then
|
||||
@ -62,6 +64,7 @@ function _zsh_tmux_plugin_run() {
|
||||
local -a tmux_cmd
|
||||
tmux_cmd=(command tmux)
|
||||
[[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
|
||||
[[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
|
||||
|
||||
# Try to connect to an existing session.
|
||||
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
|
||||
|
@ -77,6 +77,12 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||
else
|
||||
ENV_NAME=""
|
||||
fi
|
||||
|
||||
if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
|
||||
# We've just left the repo, deactivate the environment
|
||||
# Note: this only happens if the virtualenv was activated automatically
|
||||
deactivate && unset CD_VIRTUAL_ENV
|
||||
fi
|
||||
if [[ "$ENV_NAME" != "" ]]; then
|
||||
# Activate the environment only if it is not already active
|
||||
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
|
||||
@ -86,10 +92,6 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
|
||||
fi
|
||||
fi
|
||||
elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
|
||||
# We've just left the repo, deactivate the environment
|
||||
# Note: this only happens if the virtualenv was activated automatically
|
||||
deactivate && unset CD_VIRTUAL_ENV
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ plugins=(... yarn)
|
||||
| yh | `yarn help` | Show help for a yarn command |
|
||||
| yi | `yarn init` | Interactively creates or updates a package.json file |
|
||||
| yin | `yarn install` | Install dependencies defined in `package.json` |
|
||||
| yln | `yarn lint` | Run the lint script defined in `package.json` |
|
||||
| yls | `yarn list` | List installed packages |
|
||||
| yout | `yarn outdated` | Check for outdated package dependencies |
|
||||
| yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
|
||||
|
@ -12,6 +12,7 @@ alias ygu="yarn global upgrade"
|
||||
alias yh="yarn help"
|
||||
alias yi="yarn init"
|
||||
alias yin="yarn install"
|
||||
alias yln="yarn lint"
|
||||
alias yls="yarn list"
|
||||
alias yout="yarn outdated"
|
||||
alias yp="yarn pack"
|
||||
|
@ -25,12 +25,8 @@ if [ -e "$ZSHRC_ORIG" ]; then
|
||||
echo "Your original zsh config was restored."
|
||||
fi
|
||||
|
||||
if hash chsh >/dev/null 2>&1; then
|
||||
if [ -f ~/.shell.pre-oh-my-zsh ]; then
|
||||
if hash chsh >/dev/null 2>&1 && [ -f ~/.shell.pre-oh-my-zsh ]; then
|
||||
old_shell=$(cat ~/.shell.pre-oh-my-zsh)
|
||||
else
|
||||
old_shell=/bin/bash
|
||||
fi
|
||||
echo "Switching your shell back to '$old_shell':"
|
||||
if chsh -s "$old_shell"; then
|
||||
rm -f ~/.shell.pre-oh-my-zsh
|
||||
|
Loading…
Reference in New Issue
Block a user