Unverified Commit 0232ac4b authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into master

parents afb02876 ebc700be
# `transfer` plugin
[`transfer.sh`](https://transfer.sh) is an easy to use file sharing service from the command line
## Usage
Add `transfer` to your plugins array in your zshrc file:
```zsh
plugins=(... transfer)
```
Then you can:
- transfer a file:
```zsh
transfer file.txt
```
- transfer a whole directory (it will be automatically compressed):
```zsh
transfer directory/
```
# transfer.sh Easy file sharing from the command line
# transfer Plugin
# Usage Example :
# > transfer file.txt
# > transfer directory/
# Author:
# Remco Verhoef <remco@dutchcoders.io>
# https://gist.github.com/nl5887/a511f172d3fb3cd0e42d
# Modified to use tar command instead of zip
#
curl --version 2>&1 > /dev/null
if [ $? -ne 0 ]; then
echo "Could not find curl."
return 1
fi
transfer() {
# check arguments
if [ $# -eq 0 ];
then
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
fi
# get temporarily filename, output is written to this file show progress can be showed
tmpfile=$( mktemp -t transferXXX )
# upload stdin or file
file=$1
if tty -s;
then
basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
if [ ! -e $file ];
then
echo "File $file doesn't exists."
return 1
fi
if [ -d $file ];
then
echo $file
# tar directory and transfer
tarfile=$( mktemp -t transferXXX.tar.gz )
cd $(dirname $file) && tar -czf $tarfile $(basename $file)
curl --progress-bar --upload-file "$tarfile" "https://transfer.sh/$basefile.tar.gz" >> $tmpfile
rm -f $tarfile
else
# transfer file
curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile
fi
else
# transfer pipe
curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile
fi
# cat output link
cat $tmpfile
# add newline
echo
# cleanup
rm -f $tmpfile
}
# Ubuntu plugin
This plugin adds completions and aliases for [Ubuntu](https://www.ubuntu.com/).
To use it, add `ubuntu` to the plugins array in your zshrc file:
```zsh
plugins=(... ubuntu)
```
## Aliases
Commands that use `$APT` will use apt if installed or defer to apt-get otherwise.
| Alias | Command | Description |
|---------|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| acs | `apt-cache search` | Search the apt-cache with the specified criteria |
| acp | `apt-cache policy` | Display the package source priorities |
| afs | `apt-file search --regexp` | Perform a regular expression apt-file search |
| afu | `sudo apt-file update` | Generates or updates the apt-file package database |
| ag | `sudo $APT` | Run apt-get with sudo |
| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded |
| agb | `sudo $APT build-dep <source_pkg>` | Installs/Removes packages to satisfy the dependencies of a specified build pkg |
| agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files |
| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
| agi | `sudo $APT install <pkg>` | Install the specified package |
| agli | `apt list --installed` | List the installed packages |
| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts |
| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
| agr | `sudo $APT remove <pkg>` | Remove a package |
| ags | `$APT source <pkg>` | Fetch the source for the specified package |
| agu | `sudo $APT update` | Update package list |
| agud | `sudo $APT update && sudo $APT dist-upgrade` | Update packages list and perform a distribution upgrade |
| agug | `sudo $APT upgrade` | Upgrade available packages |
| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed |
| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages |
| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages |
| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` |Remove ALL kernel images and headers EXCEPT the one in use |
| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
## Functions
| Function | Usage |Description |
|-------------------|---------------------------------------|--------------------------------------------------------------------------|
| aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
| apt-history | `apt-history <action>` | Prints the Apt history of the specified action |
| apt-list-packages | `apt-list-packages` | List packages by size |
| kerndeb | `kerndeb` | Kernel-package building shortcut |
This plugin was created because the aliases in the debian plugin are inconsistent and hard to remember. Also this apt-priority detection that switched between apt-get and aptitude was dropped to keep it simpler. This plugin uses apt-get for everything but a few things that are only possible with aptitude I guess. Ubuntu does not have aptitude installed by default.
acs = Apt-Cache Search
acp = Apt-Cache Policy
ag = sudo Apt-Get
agi = sudo Apt-Get Install
agd = sudo Apt-Get Dselect-upgrade
By now you already can guess almost all aliases
There are two exeptions since ...
agu = sudo Apt-Get Update - we have ...
agug = sudo Apt-Get UpGrade - as the exceptional 4 letter alias for a single command.
afs = Apt-File Search --regexp - this has the regexp switch on without being represented in the alias, I guess this makes sense since the debian plugin has it, I never used that command.
Then there are the 2 other 4 letter aliases for combined commands, that are straight forward and easy to remember.
aguu = sudo Apt-Get Update && sudo apt-get Upgrade - better then adg or not?
agud = sudo Apt-Get Update && sudo apt-get full-upgrade
For a full list aliases and the functions just watch the plugins code https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/ubuntu/ubuntu.plugin.zsh, look at the comments if you want to switch from the debian plugin. Ubuntu, Mint and & co users will like the new aar function to install packages from ppas with a single command.
......@@ -5,18 +5,21 @@
# https://github.com/trinaldi
# Nicolas Jonas nextgenthemes.com
# https://github.com/loctauxphilippe
# https://github.com/HaraldNordgren
#
# Debian, Ubuntu and friends related zsh aliases and functions for zsh
(( $+commands[apt] )) && APT=apt || APT=apt-get
alias acs='apt-cache search'
compdef _acs acs='apt-cache search'
alias afs='apt-file search --regexp'
compdef _afs afs='apt-file search --regexp'
# These are apt-get only
alias ags='apt-get source' # asrc
compdef _ags ags='apt-get source'
# These are apt/apt-get only
alias ags="$APT source" # asrc
compdef _ags ags="$APT source"
alias acp='apt-cache policy' # app
compdef _acp acp='apt-cache policy'
......@@ -37,33 +40,33 @@ compdef _afu afu='sudo apt-file update'
alias ppap='sudo ppa-purge'
compdef _ppap ppap='sudo ppa-purge'
alias apg='sudo apt-get' # age - but without sudo
alias aga='sudo apt-get autoclean' # aac
alias agb='sudo apt-get build-dep' # abd
alias agc='sudo apt-get clean' # adc
alias agd='sudo apt-get dselect-upgrade' # ads
alias agi='sudo apt-get install' # ai
alias agp='sudo apt-get purge' # ap
alias agr='sudo apt-get remove' # ar
alias agu='sudo apt-get update' # ad
alias agud='sudo apt-get update && sudo apt-get full-upgrade' #adu
alias agug='sudo apt-get upgrade' # ag
alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg
alias agar='sudo apt-get autoremove'
compdef _ag apg='sudo apt-get'
compdef _aga aga='sudo apt-get autoclean'
compdef _agb agb='sudo apt-get build-dep'
compdef _agc agc='sudo apt-get clean'
compdef _agd agd='sudo apt-get dselect-upgrade'
compdef _agi agi='sudo apt-get install'
compdef _agp agp='sudo apt-get purge'
compdef _agr agr='sudo apt-get remove'
compdef _agu agu='sudo apt-get update'
compdef _agud agud='sudo apt-get update && sudo apt-get full-upgrade'
compdef _agug agug='sudo apt-get upgrade'
compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade'
compdef _agar agar='sudo apt-get autoremove'
alias ag="sudo $APT" # age - but without sudo
alias aga="sudo $APT autoclean" # aac
alias agb="sudo $APT build-dep" # abd
alias agc="sudo $APT clean" # adc
alias agd="sudo $APT dselect-upgrade" # ads
alias agi="sudo $APT install" # ai
alias agp="sudo $APT purge" # ap
alias agr="sudo $APT remove" # ar
alias agu="sudo $APT update" # ad
alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu
alias agug="sudo $APT upgrade" # ag
alias aguu="sudo $APT update && sudo $APT upgrade" #adg
alias agar="sudo $APT autoremove"
compdef _ag ag="sudo $APT"
compdef _aga aga="sudo $APT autoclean"
compdef _agb agb="sudo $APT build-dep"
compdef _agc agc="sudo $APT clean"
compdef _agd agd="sudo $APT dselect-upgrade"
compdef _agi agi="sudo $APT install"
compdef _agp agp="sudo $APT purge"
compdef _agr agr="sudo $APT remove"
compdef _agu agu="sudo $APT update"
compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade"
compdef _agug agug="sudo $APT upgrade"
compdef _aguu aguu="sudo $APT update && sudo $APT upgrade"
compdef _agar agar="sudo $APT autoremove"
# Remove ALL kernel images and headers EXCEPT the one in use
alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
......@@ -91,8 +94,8 @@ aar() {
PACKAGE=${1##*/}
fi
sudo apt-add-repository $1 && sudo apt-get update
sudo apt-get install $PACKAGE
sudo apt-add-repository $1 && sudo $APT update
sudo $APT install $PACKAGE
}
# Prints apt history
......@@ -102,7 +105,7 @@ aar() {
# apt-history remove
# apt-history rollback
# apt-history list
# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
# Based On: https://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
apt-history () {
case "$1" in
install)
......
#compdef ufw
#autoload
typeset -A opt_args
function _ufw_delete_rules {
if ufw status &> /dev/null ; then
ufw status numbered \
| perl -n -e'/\[ +(\d+)\] +([^ ].+)/ && print "\"$1\[$2\]\" "'
fi
}
function _ufw_app_profiles {
grep -rhoP "(?<=\[)[^\]]+" /etc/ufw/applications.d/ \
| awk '{ print "\""$0"\""}' \
| tr '\n' ' '
}
local -a _1st_arguments
_1st_arguments=(
'allow:add allow rule'
'app:Application profile commands'
'default:set default policy'
'delete:delete RULE'
'deny:add deny rule'
'disable:disables the firewall'
'enable:enables the firewall'
'insert:insert RULE at NUM'
'limit:add limit rule'
'logging:set logging to LEVEL'
'reject:add reject rule'
'reload:reloads firewall'
'reset:reset firewall'
'show:show firewall report'
'status:show firewall status'
'version:display version information'
)
local context state line curcontext="$curcontext"
_arguments -C \
'(--dry-run)--dry-run[dry run]' \
'1:: :->cmds' \
'2:: :->subcmds' \
'3:: :->subsubcmds' \
&& return 0
local rules
case "$state" in
(cmds)
_describe -t commands "ufw commands" _1st_arguments
return 0
;;
(subcmds)
case "$line[1]" in
(app)
_values 'app' \
'list[list application profiles]' \
'info[show information on PROFILE]' \
'update[update PROFILE]' \
'default[set default application policy]' \
&& ret=0
;;
(status)
_values 'status' \
'numbered[show firewall status as numbered list of RULES]' \
'verbose[show verbose firewall status]' \
&& ret=0
;;
(logging)
_values 'logging' \
'on' 'off' 'low' 'medium' 'high' 'full' \
&& ret=0
;;
(default)
_values 'default' \
'allow' 'deny' 'reject' \
&& ret=0
;;
(show)
_values 'show' \
'raw' 'builtins' 'before-rules' 'user-rules' 'after-rules' 'logging-rules' 'listening' 'added' \
&& ret=0
;;
(delete)
rules="$(_ufw_delete_rules)"
if [[ -n "$rules" ]] ; then
_values 'delete' \
${(Q)${(z)"$(_ufw_delete_rules)"}} \
&& ret=0
fi
;;
esac
;;
(subsubcmds)
case "$line[1]" in
(app)
case "$line[2]" in
(info|update)
_values 'profiles' \
${(Q)${(z)"$(_ufw_app_profiles)"}} \
&& ret=0
;;
esac
;;
(default)
_values 'default-direction' \
'incoming' 'outgoing' \
&& ret=0
;;
esac
esac
return
# URLTools plugin
This plugin provides two aliases to URL-encode and URL-decode strings.
To start using it, add the `urltools` plugin to your plugins array in `~/.zshrc`:
```zsh
plugins=(... urltools)
```
Original author: [Ian Chesal](https://github.com/ianchesal)
Original idea and aliases: [Ruslan Spivak](https://ruslanspivak.wordpress.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/)
## Commands
| Command | Description |
| :---------- | :--------------------------- |
| `urlencode` | URL-encodes the given string |
| `urldecode` | URL-decodes the given string |
## Examples
```zsh
urlencode 'https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code'
# returns https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode
urldecode 'https%3A%2F%2Fgithub.com%2Frobbyrussell%2Foh-my-zsh%2Fsearch%3Fq%3Durltools%26type%3DCode'
# returns https://github.com/robbyrussell/oh-my-zsh/search?q=urltools&type=Code
```
......@@ -2,7 +2,7 @@
# Adds handy command line aliases useful for dealing with URLs
#
# Taken from:
# http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
# https://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then
URLTOOLS_METHOD=""
......
This plugin prompts the status of the Vagrant VMs. It supports single-host and
multi-host configurations as well.
Look inside the source for documentation about custom variables.
Alberto Re <alberto.re@gmail.com>
# vim:ft=zsh ts=2 sw=2 sts=2
#
# To display Vagrant infos on your prompt add the vagrant_prompt_info to the
# $PROMPT variable in your theme. Example:
#
# PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(vagrant_prompt_info)$(svn_prompt_info)$(git_prompt_info)%(!.#.$) '
#
# `vagrant_prompt_info` makes use of some custom variables. This is an example
# definition:
#
# ZSH_THEME_VAGRANT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
# ZSH_THEME_VAGRANT_PROMPT_SUFFIX="%{$fg_bold[blue]%}]%{$reset_color%} "
# ZSH_THEME_VAGRANT_PROMPT_RUNNING="%{$fg_no_bold[green]%}●"
# ZSH_THEME_VAGRANT_PROMPT_POWEROFF="%{$fg_no_bold[red]%}●"
# ZSH_THEME_VAGRANT_PROMPT_SUSPENDED="%{$fg_no_bold[yellow]%}●"
# ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED="%{$fg_no_bold[white]%}○"
function vagrant_prompt_info() {
test -d .vagrant && test -f Vagrantfile
if [[ "$?" == "0" ]]; then
statuses=$(vagrant status 2> /dev/null | grep -P "\w+\s+[\w\s]+\s\(\w+\)")
statuses=("${(f)statuses}")
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_PREFIX
for vm_details in $statuses; do
vm_state=$(echo $vm_details | grep -o -E "saved|poweroff|not created|running")
if [[ "$vm_state" == "running" ]]; then
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_RUNNING
elif [[ "$vm_state" == "saved" ]]; then
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUSPENDED
elif [[ "$vm_state" == "not created" ]]; then
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED
elif [[ "$vm_state" == "poweroff" ]]; then
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_POWEROFF
fi
done
printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUFFIX
fi
}
# Vagrant plugin
This plugin adds autocompletion for [Vagrant](https://www.vagrantup.com/) commands, task names, box names and built-in handy documentation.
To use it, add `vagrant` to the plugins array in your zshrc file:
```zsh
plugins=(... vagrant)
```
......@@ -6,6 +6,7 @@
local -a _1st_arguments
_1st_arguments=(
'box:Box commands'
'cloud:Manages everything related to Vagrant Cloud'
'connect:Connects to a remotely shared Vagrant environment'
'destroy:Destroys the vagrant environment'
'docker-logs:Outputs the logs from the Docker container'
......@@ -18,11 +19,12 @@ _1st_arguments=(
'login:Authenticates against a Vagrant Cloud server to access protected boxes'
'package:Packages a vagrant environment for distribution'
'plugin:Plugin commands'
'port:Displays information about guest port mappings'
'provision:Run the provisioner'
'push:Deploys code in this environment to a configured destination'
'rdp:Connects to machine via RDP'
'reload:Reload the vagrant environment'
'resume:Resumes a suspend vagrant environment'
'resume:Resumes a suspended vagrant environment'
'rsync:Syncs rsync synced folders to remote machine'
'rsync-auto:Syncs rsync synced folders automatically when files change'
'share:Shares your Vagrant environment with anyone in the world'
......@@ -33,6 +35,7 @@ _1st_arguments=(
'suspend:Suspends the currently running vagrant environment'
'snapshot:Used to manage snapshots with the guest machine'
'up:Creates the vagrant environment'
'validate:Validates the Vagrantfile'
'version:Prints current and latest Vagrant version'
'--help:[TASK] Describe available tasks or one specific task'
'--version:Prints the Vagrant version information'
......@@ -54,7 +57,7 @@ __task_list ()
local expl
declare -a tasks
tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version)
tasks=(box destroy halt init package port provision reload resume ssh ssh_config status suspend up version)
_wanted tasks expl 'help' compadd $tasks
}
......@@ -81,7 +84,7 @@ __vagrant-box ()
case $state in
(command)
_describe -t commands "gem subcommand" _box_arguments
_describe -t commands "vagrant subcommand" _box_arguments
return
;;
......@@ -110,7 +113,7 @@ _arguments -C \
case $state in
(command)
_describe -t commands "gem subcommand" _1st_arguments
_describe -t commands "vagrant subcommand" _1st_arguments
return
;;
......@@ -123,7 +126,7 @@ case $state in
(box)
__vagrant-box
;;
(up|provision|package|destroy|reload|ssh|ssh-config|halt|resume|status)
(up|provision|port|package|destroy|reload|ssh|ssh-config|halt|resume|status)
_arguments ':feature:__vm_list'
esac
;;
......
## Vault (https://www.vaultproject.io) autocomplete plugin
# Vault plugin
- Adds autocomplete options for all vault commands.
Note: this plugin is deprecated. Use the [official autocompletion](https://www.vaultproject.io/docs/commands/index.html#autocompletion) instead.
####Show help for all commands
![General Help](http://i.imgur.com/yv5Db1r.png "Help for all commands")
-------
Adds autocomplete options for all [vault](https://www.vaultproject.io) commands.
####Create new Vault token
![Create token](http://i.imgur.com/xMegNgh.png "Create token")
####Enable audit backends
![Audit backends](http://i.imgur.com/fKLeiSF.png "Audit backends")
To use it, add `vault` to the plugins array in your zshrc file:
```zsh
plugins=(... vault)
```
Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud))
# Updates editor information when the keymap changes.
function zle-keymap-select() {
# update keymap variable for the prompt
VI_KEYMAP=$KEYMAP
zle reset-prompt
zle -R
}
# Ensure that the prompt is redrawn when the terminal size changes.
TRAPWINCH() {
zle && zle -R
}
zle -N zle-keymap-select
zle -N edit-command-line
......@@ -28,8 +26,9 @@ bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
# allow ctrl-r to perform backward search in history
# allow ctrl-r and ctrl-s to search the history
bindkey '^r' history-incremental-search-backward
bindkey '^s' history-incremental-search-forward
# allow ctrl-a and ctrl-e to move to beginning/end of line
bindkey '^a' beginning-of-line
......@@ -41,7 +40,7 @@ if [[ "$MODE_INDICATOR" == "" ]]; then
fi
function vi_mode_prompt_info() {
echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
echo "${${VI_KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
}
# define right prompt, if it wasn't defined by a theme
......
......@@ -8,10 +8,11 @@ function callvim
{
if [[ $# == 0 ]]; then
cat <<EOH
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
usage: callvim [-b cmd] [-a cmd] [-n name] [file ... fileN]
-b cmd Run this command in GVIM before editing the first file
-a cmd Run this command in GVIM after editing the first file
-n name Name of the GVIM server to connect to
file The file to edit
... fileN The other files to add to the argslist
EOH
......@@ -21,13 +22,16 @@ EOH
local cmd=""
local before="<esc>"
local after=""
while getopts ":b:a:" option
local name="GVIM"
while getopts ":b:a:n:" option
do
case $option in
a) after="$OPTARG"
;;
b) before="$OPTARG"
;;
n) name="$OPTARG"
;;
esac
done
shift $((OPTIND-1))
......@@ -43,7 +47,7 @@ EOH
files=':args! '"${@:A:q}<cr>"
fi
cmd="$before$files$after"
gvim --remote-send "$cmd"
gvim --servername "$name" --remote-send "$cmd"
if typeset -f postCallVim > /dev/null; then
postCallVim
fi
......
# virtualenv
The plugin displays information of the created virtual container and allows background theming.
To use it, add `virtualenv` to the plugins array of your zshrc file:
```
plugins=(... virtualenv)
```
The plugin creates a `virtualenv_prompt_info` function that you can use in your theme, which displays
the basename of the current `$VIRTUAL_ENV`. It uses two variables to control how that is shown:
- `ZSH_THEME_VIRTUALENV_PREFIX`: sets the prefix of the VIRTUAL_ENV. Defaults to `[`.
- `ZSH_THEME_VIRTUALENV_SUFFIX`: sets the suffix of the VIRTUAL_ENV. Defaults to `]`.
virtualenvwrapper='virtualenvwrapper.sh'
virtualenvwrapper_lazy='virtualenvwrapper_lazy.sh'
if (( $+commands[$virtualenvwrapper] )); then
if (( $+commands[$virtualenvwrapper_lazy] )); then
function {
setopt local_options
unsetopt equals
virtualenvwrapper=${${virtualenvwrapper_lazy}:c}
source ${${virtualenvwrapper_lazy}:c}
[[ -z "$WORKON_HOME" ]] && WORKON_HOME="$HOME/.virtualenvs"
}
elif (( $+commands[$virtualenvwrapper] )); then
function {
setopt local_options
unsetopt equals
source ${${virtualenvwrapper}:c}
}
elif [[ -f "/usr/local/bin/virtualenvwrapper.sh" ]]; then
function {
setopt local_options
unsetopt equals
virtualenvwrapper="/usr/local/bin/virtualenvwrapper.sh"
source "/usr/local/bin/virtualenvwrapper.sh"
}
elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
function {
setopt local_options
......
# VS code
This plugin makes interaction between the command line and the code editor easier.
To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`:
```zsh
plugins=(... vscode)
```
If you are using [Visual Studio Code Insiders](https://code.visualstudio.com/insiders/),
add the following line in the oh-my-zsh settings section (between the `ZSH_THEME` and
the `plugins=()` line). This will make the plugin use the Insiders version instead.
```zsh
ZSH_THEME=...
# Add this line to use code-insiders instead of code
VSCODE=code-insiders
plugins=(... vscode)
source $ZSH/oh-my-zsh.sh
```
## Common aliases
| Alias | Command | Description |
| ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| vsc | code . | Open the current folder in VS code |
| vsca `dir` | code --add `dir` | Add folder(s) to the last active window |
| vscd `file` `file` | code --diff `file` `file` | Compare two files with each other. |
| vscg `file:line[:char]` | code --goto `file:line[:char]` | Open a file at the path on the specified line and character position. |
| vscn | code --new-window | Force to open a new window. |
| vscr | code --reuse-window | Force to open a file or folder in the last active window. |
| vscw | code --wait | Wait for the files to be closed before returning. |
| vscu `dir` | code --user-data-dir `dir` | Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code. |
## Extensions aliases
| Alias | Command | Description |
| ----------------------- | ---------------------------------------------------------------- | --------------------------------- |
| vsced `dir` | code --extensions-dir `dir` | Set the root path for extensions. |
| vscie `id or vsix-path` | code --install-extension `extension-id> or <extension-vsix-path` | Installs an extension. |
| vscue `id or vsix-path` | code --uninstall-extension `id or vsix-path` | Uninstalls an extension. |
## Other options:
| Alias | Command | Description |
| ------------ | ------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| vscv | code --verbose | Print verbose output (implies --wait). |
| vscl `level` | code --log `level` | Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'. |
| vscde | code --disable-extensions | Disable all installed extensions. |
# VScode zsh plugin
# author: https://github.com/MarsiBarsi
# Use main Visual Studio Code version by default
: ${VSCODE:=code}
alias vsc="$VSCODE ."
alias vsca="$VSCODE --add"
alias vscd="$VSCODE --diff"
alias vscg="$VSCODE --goto"
alias vscn="$VSCODE --new-window"
alias vscr="$VSCODE --reuse-window"
alias vscw="$VSCODE --wait"
alias vscu="$VSCODE --user-data-dir"
alias vsced="$VSCODE --extensions-dir"
alias vscie="$VSCODE --install-extension"
alias vscue="$VSCODE --uninstall-extension"
alias vscv="$VSCODE --verbose"
alias vscl="$VSCODE --log"
alias vscde="$VSCODE --disable-extensions"
# Vundle plugin
This plugin adds functions to control [vundle](https://github.com/VundleVim/Vundle.vim) plug-in manager for vim.
To use it, add `vundle` to the plugins array in your zshrc file:
```zsh
plugins=(... vundle)
```
## Functions
| Function | Usage | Description |
|---------------|-----------------|----------------------------------------------------------------------------|
| vundle-init | `vundle-init` | Install vundle by cloning git repository into ~/.vim folder |
| vundle | `vundle` | Install plugins set in .vimrc (equals `:PluginInstall`) |
| vundle-update | `vundle-update` | Update plugins set in .vimrc (equals `:PluginInstall!`) |
| vundle-clean | `vundle-clean` | Delete plugins that have been removed from .vimrc (equals `:PluginClean!`) |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment