Compare commits

..

99 Commits

Author SHA1 Message Date
2e439a7d4e Add Docker Machine Env Node to Agnoster Theme 2018-06-07 09:27:44 +02:00
374688b313 Resolved upstream merge conflicts 2018-06-07 09:25:30 +02:00
Marc Cornellà
f461d21de1
virtualenvwrapper: set $WORKON_HOME if undefined
This uses the default that virtualenvwrapper.sh would set if it was called. If the user
changes its value after the plugin is loaded, the plugin will work all the same.

Fixes #6882
Closes #6870
Closes #6883
2018-06-06 17:14:19 +02:00
Paul Ossenbruggen
6ace3cd18d add xx command to Xcode plugin. Allows quick opening of files in Xcode. (#6812) 2018-06-05 06:37:20 -07:00
Marc Cornellà
ebda8af870
Clarify ssh-agent settings position 2018-05-28 17:09:53 +02:00
Michael Fladischer
ce2890bef9 [plugins/vundle] Use HTTPS to clone repository. (#6857)
The git protocol is likely to be blocked in some networks while HTTPS usually
works.
2018-05-28 11:23:05 +02:00
Erwan ROUSSEL
8bbef9180e Npm's plugin documentation (#6864)
* Documentation for Npm plugin added

* Fix style and add alias descriptions
2018-05-26 22:22:22 +02:00
Marc Cornellà
62f676116e
Merge pull request #6863 from robbyrussell/fix-compfix-loading
compfix: better error message and loading of completions
2018-05-26 21:35:39 +02:00
Marc Cornellà
b91659951e Always load secure completion directories 2018-05-26 21:33:49 +02:00
Marc Cornellà
77b924b839 Give more helpful message and disable purge of caches
This error message will give information on what exactly has happened
and how to either solve ownership and permissions or disable the check
entirely.

Also gets rid of the purge of compinit caches since with the current
logic insecure completion directories are ignored and therefore haven't
tainted the cached files.
2018-05-26 21:33:24 +02:00
Lorenzo Bolla
90a5bd06ca Prefer virtualenvwrapper_lazy (#6842)
This gives much faster start up times and only loads virtualenvwrapper
when needed.

Fix #6839
2018-05-26 20:44:49 +02:00
Marc Cornellà
5896c87155
shrink-path: match only the beginning of the directory (#6862)
Fixes #6317
2018-05-26 19:31:17 +02:00
Marc Cornellà
2294bae06a Merge branch 'shrink-path-chpwd-fix'
Closes #5930.
2018-05-26 19:07:46 +02:00
Kaleb Elwert
66cb4005ab Update shrink-path to use cd -q for bypassing the chpwd callbacks 2018-05-26 19:05:01 +02:00
Marc Cornellà
c09783c255 Revert "unset chpwd_functions before running cd ... (#6830)"
This reverts commit 3dab7e46e8.
2018-05-26 19:02:03 +02:00
Pooya Parsa
d6aeaad83d [plugin] update NPX docs (#6849) 2018-05-26 18:39:32 +02:00
Marc Cornellà
957eb77239
Merge pull request #6844 from lbolla/Issue6843
Cache kubectl completion script to file to speed up sourcing
2018-05-26 18:32:13 +02:00
Marc Cornellà
9b11b7e938
Update logic to follow npm plugin convention 2018-05-26 18:25:47 +02:00
Marc Cornellà
5421650c81
Merge pull request #6860 from nrobinson2000/patch-1
Remove po alias
2018-05-26 15:38:21 +02:00
Nathan Robinson
de8ef8286a
Remove po alias
https://github.com/robbyrussell/oh-my-zsh/issues/6761
2018-05-25 23:46:18 -04:00
Marc Cornellà
ed0bd6b33c
added a transfer.sh plugin (#5854)
* added a transfer.sh plugin
created a function to easily upload files to transfer.sh file sharing site
Usage : transfer file.txt

* added README for transfer.sh plugin

* replaced transfer function with @nl5887 version

* updated transfer README.md

* modified the script to use tar command instead of zip

* Update README formatting

Co-authored-by: Remco Verhoef <remco@dutchcoders.io>
2018-05-25 20:56:59 +02:00
Marc Cornellà
3d8ee47c7a
Update README formatting 2018-05-25 20:44:56 +02:00
Marc Cornellà
8f3737f45b Revert fbcda4d
The PROMPT building method clashes with other themes and
plugins that modify the PROMPT variable.

Also reverted the $jobstates trick due to it not working
inside $PROMPT.
2018-05-23 11:33:34 +02:00
Chuan Jin
2642f0a8b4 Add git log with date (#6789) 2018-05-20 16:02:53 -07:00
Lorenzo Bolla
ee96d0cf96 Fix 6840 Check emacsclient version instead of emacs's (#6841)
This is much faster.
2018-05-20 16:01:55 -07:00
Lorenzo Bolla
2956e7820e Fix 6843 Cache kubectl completion script to file to speed up sourcing 2018-05-20 13:46:27 +01:00
Mauro Porras P
a600ab4b85 Minor fix: "stdin" instead of "stding" (#6801) 2018-05-17 16:30:03 +02:00
Nikolas Garofil
6dd39a11d4 Docker completion updated to current offical version from the Docker-devs (#6794)
This adds enable/disable and install/remove
2018-05-17 16:29:39 +02:00
Matt Lewin
d79086bc87 Update terraform plugin with v0.11.7 commands and help (#6834) 2018-05-17 16:18:20 +02:00
Andrew Baumann
fbcda4d5a9 agnoster: cut down on fork/execs improve performance when not in a repo (#6210)
* agnoster: improve perf with use of $jobstates (zsh/parameter module)

This saves multiple fork/execs (for the subshell and wc) each
time the prompt is rendered

* agnoster: compute git repo_path only when in a git repo

this avoids needlessly invoking git twice every time we render the prompt

* agnoster: avoid subshell when rendering prompt

Rather than forking a subshell to print the prompt, construct it
incrementally by appending to $PROMPT.

v2: fix incorrect CURRENT_BG
v3: fix bzr and hg prompting

Thanks @mcornella for the help.
2018-05-17 14:46:27 +02:00
dt-rush
3dab7e46e8 unset chpwd_functions before running cd to work with the path, to avoid side-effects if the user has set any chpwd_functions which cause output, such as is the case if the user is using auto-ls (#6830) 2018-05-17 14:45:04 +02:00
Frank Wittig
e8aaab56b9 allow . in profile names 2018-05-16 18:01:09 +02:00
Julien Palmas
de1e3c0794 add pg:backups command 2018-05-16 17:52:11 +02:00
rco-ableton
c3493dc5ce Add Heroku pipelines support (#5660) 2018-05-16 17:40:42 +02:00
Marc Cornellà
afba4f6b9f
Load insecure completion files if compfix is disabled
We have to assume that if people disabled the compfix system they really want
their completion to work, ignoring any permission issues.

Fixes #5651
Fixes #5957
Fixes #6461
2018-05-15 21:22:47 +02:00
Marc Cornellà
0aa645f803
pyenv: search the pyenv command if not found (#6811) 2018-05-15 12:07:23 +02:00
Gert de Pagter
2b7a41b0d2 Update the update prompt (#6825)
`[Oh My Zsh] Would you like to check for updates? [Y/n]: ` does not make sense, 
since answering yes will download/apply the new updates instead of checking for them.
2018-05-15 11:26:59 +02:00
Varun Patro
6876d9c543 Update fasd.plugin.zsh (#6822)
If `EDITOR` variable contains arguments to an editor such as mine:
`export EDITOR=emacsclient -t -c --alternate-editor=''`
Then, the editor's arguments are passed on to `fasd`. To fix this, pass the EDITOR program in quotes.
2018-05-14 16:00:04 +02:00
Harald Nordgren
0608bb768f Use 'apt' instead of 'apt-get' for Ubuntu >=16.04 (#5787) 2018-05-14 15:09:56 +02:00
Quentin Nerden
919f0a42a0 Updated autocomplete and readme (#6720)
Signed-off-by: Troy Fontaine <tfontaine@troyfontaine.com>
2018-05-13 21:58:35 +02:00
Ian Chesal
0c63909ad3 Fix default location of the virtualenvwrapper script (#6348)
The `virtualenvwrapper` script has been relocated to
`/usr/local/bin/virtualenvwrapper.sh`. Update the
plugin to look in the new location first. See:

http://virtualenvwrapper.readthedocs.io/en/latest/#introduction

to confirm the change in location for this script.

This addresses issue #3047 where the solution was to source this file
from your zshrc.
2018-05-13 21:56:46 +02:00
Marc Cornellà
d02d008579
Add directory hierarchy navigation to dirhistory (#6756)
* New Feature:
  Navigate directory hierarchy using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented)
  ALT-UP moves to higher hierarchy (cd ..)
  ALT-DOWN moves into the first directory found in alphabetical order
2018-05-13 01:57:42 +02:00
Giuseppe Landolfi
8ebf2a6785 Fine-tune dirhistory plugin mappings for Mac (#6580)
See https://github.com/robbyrussell/oh-my-zsh/pull/6533#issuecomment-360878060
2018-05-13 01:53:45 +02:00
Xiao Fan
18effd77db last-working-dir: disable chpwd_last_working_dir in subshells (#6817) 2018-05-11 16:28:02 +02:00
Hosh
e8c328cb39 Update AWS completion (#6745) 2018-05-10 20:53:16 +02:00
Quentin Nerden
825baeb310 Add autocomplete plugin for minikube (#6436) 2018-05-09 22:34:41 +02:00
Francisco Zuviría
18f7ca577a Adhere to coding style outlined in wiki 2018-05-08 12:55:59 -03:00
David Harrigan
b7e544e6f1 gradle plugin should support kotlin gradle build files (#6529)
This change allows the gradle plugin to recongise build.gradle.kts files and
thus generate the autocomplete entries.

-=david=-

closes #6528
2018-05-08 13:13:11 +02:00
Marc Cornellà
835c7df795 Merge branch 'MikeDawg-master'
Fixes #6426
Close #6598
2018-05-07 23:15:54 +02:00
MikeDawg
0011d34f71 Removed duplicate fedora from plugins, dnf provides exact same features 2018-05-07 23:14:49 +02:00
Joshua Kovach
362b061f5c Fix branch not updating on checkout in steeef (#6784)
* Fix branch not updating on checkout in steeef

* Check for `hub` in steeef when switching branches
2018-05-07 18:19:45 +02:00
Marc Cornellà
6bff079332
Allow completion of dot directories (#6803)
Fixes #3775, fixes #6543
2018-05-07 18:15:01 +02:00
Marc Cornellà
00f311a3c1
Add READMEs to plugins copydir and copyfile (#6802)
* Add README to copydir plugin

* Add README to copyfile plugin
2018-05-07 18:00:27 +02:00
ningwei1993
8f0ff4bb63 fix bug for check zsh (#6798) 2018-05-07 00:39:28 +02:00
Marc Cornellà
c4981bae0a installer: check if zsh in path instead of /etc/shells
Fixes #4955

Closes #5931
Closes #6398

Co-authored-by: Void <vst4rbot@gmail.com>
Co-authored-by: Kaleb Elwert <belak@coded.io>
2018-05-05 22:03:57 +02:00
Joseph Richey
cafa657469 Correctly handle verbose/version flags for rustc (#6786)
See the help output for rustc (v1.25)
2018-05-01 15:21:12 +02:00
Oliver Baumann
493c30954b Parse branch-name for fresh repo (#6302)
Inside a fresh git repo, i.e. immediately after a `git init`, usually no
commit template exists yet. In this case, git renders a different
status message than "Initial commit on". We should consider this message
when attempting to parse out the branch name.

Fixes #6301
2018-04-30 16:25:02 +02:00
Ady Romantika
32952ec7e8 Add aliases for kubectl ingress (#6762) 2018-04-28 07:55:46 -07:00
Marc Cornellà
8eba19208d
Revert to checking if enable-ssh-support is set
Fixes #6772
2018-04-27 17:56:21 +02:00
Konstantin Zolotarev
9cd3701ac0 Added ecto tasks (#6035) 2018-04-25 22:12:19 +02:00
Cristian Álvarez Belaustegui
bf87e99a14 Fix mix-fast plugin (#6708)
The mix command for listing all available actions has been changed from
`mix --help` to `mix help`.
2018-04-25 22:06:26 +02:00
George Kaklamanos
acacfec924 Remove unneeded option in glol and glola (#6059) 2018-04-25 14:14:33 +02:00
Tomasz Borek
b85c72b5f6 Better app error handling in curl (#5828)
Deals with app error page, saving true error instead.

Upon app failure, Heroku returns HTML "Application Error" page.
Finding HTML page in .gitignore is confusing, so I replaced
`-s` with `-f` in curl calls, which cuts such output.

Replace instead of addition as no progress meter outputs either.

It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.
      -- E. W. Dijkstra
2018-04-25 14:11:46 +02:00
Marc Cornellà
93d9431890
Check for Microsoft's WSL in open_command (#6751)
This will work only on files and directories in a DrvFs mount, i.e.
that can be translated to a Windows drive path.
For example: /mnt/c/Users/user.

Files and folders inside the LXSS directory can't be handled in
Windows, they must be ONLY used by the WSL subsystem. That's why
you won't be able to open your $HOME directory, for instance.

See https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/
2018-04-24 23:47:26 +02:00
Marc Cornellà
ef70990ce1
Simplify hub check and hardcode aliasing (#6767)
* Simplify hub check and hardcode aliasing

* Update hub completion
2018-04-24 22:02:58 +02:00
Marc Cornellà
45a9f28464
[half-life] Fix last command check
Fixes #6758
2018-04-23 20:47:19 +02:00
oooooooo
c117d241cb $ rails runner [TAB] *complete* (#5881) 2018-04-23 20:36:55 +02:00
Marc Cornellà
cf5ccf06a0
[subl] Fix local variable definition
Fixes #6757
2018-04-23 13:06:49 +02:00
Francisco Zuviría
7bb7ce62d3 On branch fzuviria.plugin.dirhistory.new-feature.navigate-history
Changes to be committed:
	modified:   dirhistory/dirhistory.plugin.zsh

New Feature:
  Navigate directory hierarchy using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented)
  ALT-UP moves to higher hierarchy (cd ..)
  ALT-DOWN moves into the first directory found in alphabetical order
2018-04-22 22:34:26 -03:00
Sean Abraham
604f580f05 Make steeef theme much faster by not iterating through all history (#6359)
* Make steef much faster by not printing all history each time

* Use whence -c to expand shell functions as well

* Use $2 (expanded command about to be ran)
2018-04-22 22:37:06 +02:00
Julian Laubstein
c7185c35f3 Add completions to asdf plugin (#6046) 2018-04-22 20:27:12 +02:00
Terrance Kennedy
8efcf2776b pyenv plugin refactor (8x faster) (#6165)
* Refactor pyenv plugin to use PATH
2018-04-22 20:03:58 +02:00
Marc Cornellà
897a7da6c5 Merge branch 'heads/apjanke/fix-local-in-sublime-plugin'
Closes #4086
2018-04-22 18:38:15 +02:00
Andrew Janke
cea941ce42 sublime plugin: make "local" work by wrapping in anon function 2018-04-22 18:37:05 +02:00
Marc Cornellà
64cd002b7a Merge branch 'apjanke/norris-scrape'
Closes #3642
2018-04-22 18:26:28 +02:00
Andrew Janke
13c840fa3e Remove the GPL LICENSE file b/c it's no longer relevant 2018-04-22 18:25:58 +02:00
Andrew Janke
ef68878b22 Rebuild the chucknorris fortune file with a scrapper, using 20 pages worth
NOTE: The scrapper was previously included, but due to the website it scrapped
being dead it's no longer useful. See #3642 for the code.

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2018-04-22 18:24:12 +02:00
Marc Cornellà
676038bdfa
Merge pull request #3422 from mcornella/fix-history-alias
Enhance history alias
2018-04-22 15:57:41 +02:00
Marc Cornellà
2589cdd8f9 Increment HISTSIZE to fix hist_expire_dups_first
This fixes the old behavior which made it so all duplicates would be
deleted if the command history filled up with unique events.

> You should be sure to set the value of HISTSIZE to a larger number
> than SAVEHIST in order to give you some room for the duplicated
> events, otherwise this option will behave just like HIST_IGNORE_ALL_DUPS
> once the history fills up with unique events.
2018-04-22 15:33:12 +02:00
Marc Cornellà
9f2f22d953 Remove duplicate option append_history
The option inc_append_history already has the same effect.
2018-04-22 15:33:11 +02:00
Marc Cornellà
20d63be655 Use zparseopts to get passed arguments 2018-04-22 15:33:10 +02:00
Marc Cornellà
f8180c3a64 Allow overriding -l flag in history 2018-04-22 15:32:30 +02:00
Marc Cornellà
03758416fe Ensure builtin fc is used (see #3001) 2018-04-22 15:32:02 +02:00
Marc Cornellà
643bb25a0d Organize history.zsh file and improve comments 2018-04-22 15:32:02 +02:00
Marc Cornellà
94baa9eadd Simplify `if' into oneliner, allow spaces in HISTFILE 2018-04-22 15:32:01 +02:00
Marc Cornellà
d87d4331cf Change history alias into a function
This commit changes the history alias into a function which puts
the passed arguments before `-l 1`. It also provides a temporary
workaround to the lack of a `history -c` command in zsh.

For more information see issues 739 and 789.
2018-04-22 15:31:53 +02:00
Marc Cornellà
dd39d43021
Merge pull request #5601 from mcornella/refactor-zsh_reload-plugin
Refactor zsh_reload plugin
2018-04-22 12:59:40 +02:00
Marc Cornellà
fbbe902c38 zsh_reload: add README 2018-04-22 12:55:21 +02:00
Marc Cornellà
405b8f220a zsh_reload: use exec zsh instead of source ~/.zshrc
`source ~/.zshrc` is a bad practice, it doesn't make sure that the full
zsh session is reloaded and it may have side effects.

Use `$SHELL` as the path to zsh if it exists (this will fix edge cases
where the zsh used is not the first on $PATH). Otherwise, use `zsh`.
2018-04-22 12:55:13 +02:00
Marc Cornellà
8706c8eb64 zsh_reload: ignore insecure compinit files 2018-04-22 12:50:00 +02:00
Marc Cornellà
9a7c56dcdd zsh_reload: fix code style and indent with tabs 2018-04-22 12:50:00 +02:00
Chris Fleming
9a71864288 Fix gpg-agent plugin checks (#6469)
* Always try and start gpg-agent, with --use-standard-socket it will try and use a standard socket directory. It won't start multiple agents if agent is already running. In addition, XDG_RUNTIME_DIR isn't always set

* ssh socket if broken if --daemon is run again, so onky start if we don't have a socket

* Removed unnecessary allocation of GPG_SSH_AUTH_SOCK
2018-04-21 22:26:36 +02:00
Marc Cornellà
d7948b39dc
[rkj-repos] Make hg prompt check less strict (#6746)
* [rkj-repos] Make `hg prompt` check less strict

Move the `hg prompt` check inside the hg_prompt_info function so that
it returns an empty string if hg-prompt isn't installed.

Fixes #6743.

* [rkj-repos] Check for hg in `hg prompt` function
2018-04-19 23:32:53 +02:00
Marc Cornellà
6c9af4455d
Add exemplary custom theme folder
Co-authored-by: Profpatsch <mail@profpatsch.de>
2018-04-19 21:03:52 +02:00
Ilyes Kechidi
c36474b7df modified the script to use tar command instead of zip 2017-02-09 19:41:09 +01:00
Ilyes Kechidi
6cefe70ffc updated transfer README.md 2017-02-09 02:29:24 +01:00
Ilyes Kechidi
845fdfaae0 replaced transfer function with @nl5887 version 2017-02-09 02:28:33 +01:00
Ilyes Kechidi
8013d3d8a9 added README for transfer.sh plugin 2017-02-07 14:40:21 +01:00
Ilyes Kechidi
76c102944c added a transfer.sh plugin
created a function to easily upload files to transfer.sh file sharing
site
Usage : transfer file.txt
2017-02-07 14:32:32 +01:00
57 changed files with 2823 additions and 749 deletions

View File

@ -0,0 +1 @@
# Put your custom themes in this folder.

View File

@ -2,10 +2,6 @@
# insecure ownership or permissions) by: # insecure ownership or permissions) by:
# #
# * Human-readably notifying the user of these insecurities. # * Human-readably notifying the user of these insecurities.
# * Moving away all existing completion caches to a temporary directory. Since
# any of these caches may have been generated from insecure directories, they
# are all suspect now. Failing to do so typically causes subsequent compinit()
# calls to fail with "command not found: compdef" errors. (That's bad.)
function handle_completion_insecurities() { function handle_completion_insecurities() {
# List of the absolute paths of all unique insecure directories, split on # List of the absolute paths of all unique insecure directories, split on
# newline from compaudit()'s output resembling: # newline from compaudit()'s output resembling:
@ -22,39 +18,27 @@ function handle_completion_insecurities() {
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} ) insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
# If no such directories exist, get us out of here. # If no such directories exist, get us out of here.
if (( ! ${#insecure_dirs} )); then (( ! ${#insecure_dirs} )) && return
print "[oh-my-zsh] No insecure completion-dependent directories detected."
return
fi
# List ownership and permissions of all insecure directories. # List ownership and permissions of all insecure directories.
print "[oh-my-zsh] Insecure completion-dependent directories detected:" print "[oh-my-zsh] Insecure completion-dependent directories detected:"
ls -ld "${(@)insecure_dirs}" ls -ld "${(@)insecure_dirs}"
print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
print "[oh-my-zsh] See the above list for directories with group or other writability.\n"
# Locally enable the "NULL_GLOB" option, thus removing unmatched filename cat <<EOD
# globs from argument lists *AND* printing no warning when doing so. Failing
# to do so prints an unreadable warning if no completion caches exist below.
setopt local_options null_glob
# List of the absolute paths of all unique existing completion caches. [oh-my-zsh] For safety, we will not load completions from these directories until
local -aU zcompdump_files [oh-my-zsh] you fix their permissions and ownership and restart zsh.
zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* ) [oh-my-zsh] See the above list for directories with group or other writability.
# Move such caches to a temporary directory. [oh-my-zsh] To fix your permissions you can do so by disabling
if (( ${#zcompdump_files} )); then [oh-my-zsh] the write permission of "group" and "others" and making sure that the
# Absolute path of the directory to which such files will be moved. [oh-my-zsh] owner of these directories is either root or your current user.
local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad" [oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
# List such files first. [oh-my-zsh] If the above didn't help or you want to skip the verification of
print "[oh-my-zsh] Insecure completion caches also detected:" [oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
ls -l "${(@)zcompdump_files}" [oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
# For safety, move rather than permanently remove such files. EOD
print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
fi
} }

View File

@ -25,6 +25,9 @@ else
fi fi
unset CASE_SENSITIVE HYPHEN_INSENSITIVE unset CASE_SENSITIVE HYPHEN_INSENSITIVE
# Complete . and .. special directories
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' list-colors '' zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'

View File

@ -28,7 +28,3 @@ alias lsa='ls -lah'
alias l='ls -lah' alias l='ls -lah'
alias ll='ls -lh' alias ll='ls -lh'
alias la='ls -lAh' alias la='ls -lAh'
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'

View File

@ -25,7 +25,9 @@ function open_command() {
case "$OSTYPE" in case "$OSTYPE" in
darwin*) open_cmd='open' ;; darwin*) open_cmd='open' ;;
cygwin*) open_cmd='cygstart' ;; cygwin*) open_cmd='cygstart' ;;
linux*) open_cmd='xdg-open' ;; linux*) [[ $(uname -a) =~ "Microsoft" ]] && \
open_cmd='cmd.exe /c start' || \
open_cmd='xdg-open' ;;
msys*) open_cmd='start ""' ;; msys*) open_cmd='start ""' ;;
*) echo "Platform $OSTYPE not supported" *) echo "Platform $OSTYPE not supported"
return 1 return 1

View File

@ -1,24 +1,41 @@
## Command history configuration ## History wrapper
if [ -z "$HISTFILE" ]; then function omz_history {
HISTFILE=$HOME/.zsh_history # Delete the history file if `-c' argument provided.
fi # This won't affect the `history' command output until the next login.
zparseopts -E c=clear l=list
HISTSIZE=10000 if [[ -n "$clear" ]]; then
SAVEHIST=10000 # if -c provided, clobber the history file
echo -n >| "$HISTFILE"
echo >&2 History file deleted. Reload the session to see its effects.
elif [[ -n "$list" ]]; then
# if -l provided, run as if calling `fc' directly
builtin fc "$@"
else
# otherwise, call `fc -l 1` to show all available
# history (and pass additional parameters)
builtin fc "$@" -l 1
fi
}
# Show history # Timestamp format
case $HIST_STAMPS in case $HIST_STAMPS in
"mm/dd/yyyy") alias history='fc -fl 1' ;; "mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='fc -El 1' ;; "dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='fc -il 1' ;; "yyyy-mm-dd") alias history='omz_history -i' ;;
*) alias history='fc -l 1' ;; *) alias history='omz_history' ;;
esac esac
setopt append_history ## History file configuration
setopt extended_history [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
setopt hist_expire_dups_first HISTSIZE=50000
setopt hist_ignore_dups # ignore duplication command history list SAVEHIST=10000
setopt hist_ignore_space
setopt hist_verify ## History command configuration
setopt inc_append_history setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data setopt share_history # share command history data

View File

@ -11,8 +11,6 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
# Load all stock functions (from $fpath files) called below. # Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit autoload -U compaudit compinit
: ${ZSH_DISABLE_COMPFIX:=true}
# Set ZSH_CUSTOM to the path where your custom config files # Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/ # and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then if [[ -z "$ZSH_CUSTOM" ]]; then
@ -65,16 +63,15 @@ if [ -z "$ZSH_COMPDUMP" ]; then
fi fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
# If completion insecurities exist, warn the user without enabling completions. # If completion insecurities exist, warn the user
if ! compaudit &>/dev/null; then if ! compaudit &>/dev/null; then
# This function resides in the "lib/compfix.zsh" script sourced above.
handle_completion_insecurities handle_completion_insecurities
# Else, enable and cache completions to the desired file.
else
compinit -d "${ZSH_COMPDUMP}"
fi fi
else # Load only from secure directories
compinit -i -d "${ZSH_COMPDUMP}" compinit -i -d "${ZSH_COMPDUMP}"
else
# If the user wants it, load from all found directories
compinit -u -d "${ZSH_COMPDUMP}"
fi fi
# Load all of the plugins that were defined in ~/.zshrc # Load all of the plugins that were defined in ~/.zshrc

View File

@ -5,3 +5,8 @@ ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
if [ -f $ASDF_DIR/asdf.sh ]; then if [ -f $ASDF_DIR/asdf.sh ]; then
. $ASDF_DIR/asdf.sh . $ASDF_DIR/asdf.sh
fi fi
# Load asdf completions, if found.
if [ -f $ASDF_DIR/completions/asdf.bash ]; then
. $ASDF_DIR/completions/asdf.bash
fi

View File

@ -37,16 +37,15 @@ function asp {
} }
function aws_profiles { function aws_profiles {
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/')) reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/'))
} }
compctl -K aws_profiles asp compctl -K aws_profiles asp
if _homebrew-installed && _awscli-homebrew-installed ; then if which aws_zsh_completer.sh &>/dev/null; then
_aws_zsh_completer_path=$(which aws_zsh_completer.sh 2>/dev/null)
elif _homebrew-installed && _awscli-homebrew-installed; then
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
else
_aws_zsh_completer_path=$(which aws_zsh_completer.sh)
fi fi
[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path [ -n "$_aws_zsh_completer_path" ] && [ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
unset _aws_zsh_completer_path unset _aws_zsh_completer_path

View File

@ -1,2 +0,0 @@
License: GPL v2
Thanks to http://www.k-lug.org/~kessler/projects.html for the fortune file.

File diff suppressed because it is too large Load Diff

10
plugins/copydir/README.md Normal file
View File

@ -0,0 +1,10 @@
# copydir plugin
Copies the path of your current folder to the system clipboard.
To use, add `copydir` to your plugins array:
```
plugins=(... copydir)
```
Then use the command `copydir` to copy the $PWD.

View File

@ -0,0 +1,10 @@
# copyfile plugin
Puts the contents of a file in your system clipboard so you can paste it anywhere.
To use, add `copyfile` to your plugins array:
```
plugins=(... copyfile)
```
Then you can run the command `copyfile <filename>` to copy the file named `filename`.

View File

@ -2,6 +2,10 @@
# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories # Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. # that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
# #
# Navigate directory hierarchy using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented)
# ALT-UP moves to higher hierarchy (cd ..)
# ALT-DOWN moves into the first directory found in alphabetical order
#
dirhistory_past=($PWD) dirhistory_past=($PWD)
dirhistory_future=() dirhistory_future=()
@ -120,7 +124,9 @@ zle -N dirhistory_zle_dirhistory_back
bindkey "\e[3D" dirhistory_zle_dirhistory_back bindkey "\e[3D" dirhistory_zle_dirhistory_back
bindkey "\e[1;3D" dirhistory_zle_dirhistory_back bindkey "\e[1;3D" dirhistory_zle_dirhistory_back
# Mac teminal (alt+left/right) # Mac teminal (alt+left/right)
bindkey "^[b" dirhistory_zle_dirhistory_back if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
bindkey "^[b" dirhistory_zle_dirhistory_back
fi
# Putty: # Putty:
bindkey "\e\e[D" dirhistory_zle_dirhistory_back bindkey "\e\e[D" dirhistory_zle_dirhistory_back
# GNU screen: # GNU screen:
@ -129,8 +135,56 @@ bindkey "\eO3D" dirhistory_zle_dirhistory_back
zle -N dirhistory_zle_dirhistory_future zle -N dirhistory_zle_dirhistory_future
bindkey "\e[3C" dirhistory_zle_dirhistory_future bindkey "\e[3C" dirhistory_zle_dirhistory_future
bindkey "\e[1;3C" dirhistory_zle_dirhistory_future bindkey "\e[1;3C" dirhistory_zle_dirhistory_future
bindkey "^[f" dirhistory_zle_dirhistory_future if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
bindkey "^[f" dirhistory_zle_dirhistory_future
fi
bindkey "\e\e[C" dirhistory_zle_dirhistory_future bindkey "\e\e[C" dirhistory_zle_dirhistory_future
bindkey "\eO3C" dirhistory_zle_dirhistory_future bindkey "\eO3C" dirhistory_zle_dirhistory_future
#
# HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings
#
# Move up in hierarchy
function dirhistory_up() {
cd .. || return 1
}
# Move down in hierarchy
function dirhistory_down() {
cd "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return 1
}
# Bind keys to hierarchy navigation
function dirhistory_zle_dirhistory_up() {
zle kill-buffer # Erase current line in buffer
dirhistory_up
zle accept-line
}
function dirhistory_zle_dirhistory_down() {
zle kill-buffer # Erase current line in buffer
dirhistory_down
zle accept-line
}
zle -N dirhistory_zle_dirhistory_up
# xterm in normal mode
bindkey "\e[3A" dirhistory_zle_dirhistory_up
bindkey "\e[1;3A" dirhistory_zle_dirhistory_up
# Mac teminal (alt+up)
#bindkey "^[?" dirhistory_zle_dirhistory_up #dont know it
# Putty:
bindkey "\e\e[A" dirhistory_zle_dirhistory_up
# GNU screen:
bindkey "\eO3A" dirhistory_zle_dirhistory_up
zle -N dirhistory_zle_dirhistory_down
bindkey "\e[3B" dirhistory_zle_dirhistory_down
bindkey "\e[1;3B" dirhistory_zle_dirhistory_down
# Mac teminal (alt+down)
#bindkey "^[?" dirhistory_zle_dirhistory_down #dont know it
bindkey "\e\e[B" dirhistory_zle_dirhistory_down
bindkey "\eO3B" dirhistory_zle_dirhistory_down

View File

@ -450,9 +450,9 @@ __docker_complete_events_filter() {
;; ;;
(event) (event)
local -a event_opts local -a event_opts
event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach' event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disable' 'disconnect' 'enable' 'exec_create' 'exec_detach'
'exec_start' 'export' 'health_status' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start' 'exec_start' 'export' 'health_status' 'import' 'install' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'remove' 'rename' 'resize'
'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') 'restart' 'save' 'start' 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update')
_describe -t event-filter-opts "event filter options" event_opts && ret=0 _describe -t event-filter-opts "event filter options" event_opts && ret=0
;; ;;
(image) (image)
@ -889,7 +889,7 @@ __docker_container_subcommand() {
$opts_help \ $opts_help \
$opts_attach_exec_run_start \ $opts_attach_exec_run_start \
"($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \ "($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \
"($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \ "($help -i --interactive)"{-i,--interactive}"[Attach container's stdin]" \
"($help -)*:containers:__docker_complete_stopped_containers" && ret=0 "($help -)*:containers:__docker_complete_stopped_containers" && ret=0
;; ;;
(stats) (stats)

View File

@ -10,7 +10,7 @@
# - Configuration changes made at runtime are applied to all frames. # - Configuration changes made at runtime are applied to all frames.
if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
# set EDITOR if not already defined. # set EDITOR if not already defined.

View File

@ -6,6 +6,6 @@ if [ $commands[fasd] ]; then # check if fasd is installed
source "$fasd_cache" source "$fasd_cache"
unset fasd_cache unset fasd_cache
alias v="f -e $EDITOR" alias v="f -e \"$EDITOR\""
alias o='a -e open_command' alias o='a -e open_command'
fi fi

View File

@ -1,3 +0,0 @@
This is a plugin based on yum plugin, but using dnf as main frontend
(from Fedora 22 onwards, yum is deprecated in favor of dnf).

View File

@ -1,16 +0,0 @@
## Aliases
alias dnfs="dnf search" # search package
alias dnfp="dnf info" # show package info
alias dnfl="dnf list" # list packages
alias dnfgl="dnf grouplist" # list package groups
alias dnfli="dnf list installed" # print all installed packages
alias dnfmc="dnf makecache" # rebuilds the dnf package list
alias dnfu="sudo dnf upgrade" # upgrade packages
alias dnfi="sudo dnf install" # install package
alias dnfgi="sudo dnf groupinstall" # install package group
alias dnfr="sudo dnf remove" # remove package
alias dnfgr="sudo dnf groupremove" # remove pagage group
alias dnfrl="sudo dnf remove --remove-leaves" # remove package and leaves
alias dnfc="sudo dnf clean all" # clean cache

View File

@ -0,0 +1 @@
../dnf/dnf.plugin.zsh

View File

@ -41,7 +41,7 @@ ahead, behind = 0, 0
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
for st in status: for st in status:
if st[0] == '#' and st[1] == '#': if st[0] == '#' and st[1] == '#':
if re.search('Initial commit on', st[2]): if re.search('Initial commit on', st[2]) or re.search('No commits yet on', st[2]):
branch = st[2].split(' ')[-1] branch = st[2].split(' ')[-1]
elif re.search('no branch', st[2]): # detached status elif re.search('no branch', st[2]): # detached status
branch = get_tagname_or_hash() branch = get_tagname_or_hash()

View File

@ -180,8 +180,10 @@ alias glgg='git log --graph'
alias glgga='git log --graph --decorate --all' alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10' alias glgm='git log --graph --max-count=10'
alias glo='git log --oneline --decorate' alias glo='git log --oneline --decorate'
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" alias glod="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
alias glods="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"
alias glog='git log --oneline --decorate --graph' alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all' alias gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily" alias glp="_git_log_prettily"

View File

@ -89,6 +89,7 @@ __hub_setup_zsh_fns () {
browse:'browse the project on GitHub' browse:'browse the project on GitHub'
compare:'open GitHub compare view' compare:'open GitHub compare view'
ci-status:'lookup commit in GitHub Status API' ci-status:'lookup commit in GitHub Status API'
sync:'update local branches from upstream'
) )
_describe -t hub-commands 'hub command' hub_commands && ret=0 _describe -t hub-commands 'hub command' hub_commands && ret=0
@ -115,6 +116,7 @@ create
browse browse
compare compare
ci-status ci-status
sync
EOF EOF
__git_list_all_commands_without_hub __git_list_all_commands_without_hub
} }

View File

@ -1,8 +1,6 @@
# Set up hub wrapper for git, if it is available; http://github.com/github/hub # Set up hub wrapper for git, if it is available; http://github.com/github/hub
if [ "$commands[(I)hub]" ]; then if (( $+commands[hub] )); then
if hub --version &>/dev/null; then alias git=hub
eval $(hub alias -s zsh)
fi
fi fi
# Functions ################################################################# # Functions #################################################################

View File

@ -1,7 +1,7 @@
function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} } function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
_gitignoreio_get_command_list() { _gitignoreio_get_command_list() {
curl -sL https://www.gitignore.io/api/list | tr "," "\n" curl -fL https://www.gitignore.io/api/list | tr "," "\n"
} }
_gitignoreio () { _gitignoreio () {

View File

@ -1,14 +1,16 @@
# Enable gpg-agent if it is not running # Enable gpg-agent if it is not running-
GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh" # --use-standard-socket will work from version 2 upwards
if [ ! -S $GPG_AGENT_SOCKET ]; then
gpg-agent --daemon >/dev/null 2>&1
export GPG_TTY=$(tty)
fi
# Set SSH to use gpg-agent if it is configured to do so AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2)
if [[ ! -S $AGENT_SOCK ]]; then
gpg-agent --daemon --use-standard-socket &>/dev/null
fi
export GPG_TTY=$TTY
# Set SSH to use gpg-agent if it's enabled
GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf" GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf"
if [ -r "$GNUPGCONFIG" ] && grep -q enable-ssh-support "$GNUPGCONFIG"; then if [[ -r $GNUPGCONFIG ]] && command grep -q enable-ssh-support "$GNUPGCONFIG"; then
export SSH_AUTH_SOCK="$AGENT_SOCK.ssh"
unset SSH_AGENT_PID unset SSH_AGENT_PID
export SSH_AUTH_SOCK=$GPG_AGENT_SOCKET
fi fi

View File

@ -88,7 +88,7 @@ function _gradle_arguments() {
# and if so, regenerate the .gradle_tasks cache file # and if so, regenerate the .gradle_tasks cache file
############################################################################ ############################################################################
_gradle_does_task_list_need_generating () { _gradle_does_task_list_need_generating () {
[[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]] [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache || build.gradle.kts -nt .gradletasknamecache ]]
} }
############## ##############
@ -144,7 +144,7 @@ _gradle_parse_and_extract_tasks () {
# Discover the gradle tasks by running "gradle tasks --all" # Discover the gradle tasks by running "gradle tasks --all"
############################################################################ ############################################################################
_gradle_tasks () { _gradle_tasks () {
if [[ -f build.gradle ]]; then if [[ -f build.gradle || -f build.gradle.kts ]]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache
@ -154,7 +154,7 @@ _gradle_tasks () {
} }
_gradlew_tasks () { _gradlew_tasks () {
if [[ -f build.gradle ]]; then if [[ -f build.gradle || -f build.gradle.kts ]]; then
_gradle_arguments _gradle_arguments
if _gradle_does_task_list_need_generating; then if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache

View File

@ -45,6 +45,18 @@ _1st_arguments=(
"logs\:drains":"manage syslog drains" "logs\:drains":"manage syslog drains"
"maintenance\:on":"put the app into maintenance mode" "maintenance\:on":"put the app into maintenance mode"
"maintenance\:off":"take the app out of maintenance mode" "maintenance\:off":"take the app out of maintenance mode"
"pipelines":"list pipelines you have access to"
"pipelines\:add":"add this app to a pipeline"
"pipelines\:create":"create a new pipeline"
"pipelines\:destroy":"destroy a pipeline"
"pipelines\:diff":"compares the latest release of this app to its downstream app(s)"
"pipelines\:info":"show list of apps in a pipeline"
"pipelines\:list":"list pipelines you have access to"
"pipelines\:open":"open a pipeline in dashboard"
"pipelines\:promote":"promote the latest release of this app to its downstream app(s)"
"pipelines\:remove":"remove this app from its pipeline"
"pipelines\:rename":"rename a pipeline"
"pipelines\:update":"update this app's stage in a pipeline"
"pg\:credentials":"display the DATABASE credentials" "pg\:credentials":"display the DATABASE credentials"
"pg\:diagnose":"run diagnostics report on DATABASE" "pg\:diagnose":"run diagnostics report on DATABASE"
"pg\:info":"display database information" "pg\:info":"display database information"
@ -60,6 +72,7 @@ _1st_arguments=(
"pg\:unfollow":"stop a replica from following and make it a read/write database" "pg\:unfollow":"stop a replica from following and make it a read/write database"
"pg\:upgrade":"unfollow a database and upgrade it to the latest PostgreSQL version" "pg\:upgrade":"unfollow a database and upgrade it to the latest PostgreSQL version"
"pg\:wait":"monitor database creation, exit when complete" "pg\:wait":"monitor database creation, exit when complete"
"pg\:backups":"Interact with built-in backups"
"pgbackups":"list captured backups" "pgbackups":"list captured backups"
"pgbackups\:url":"get a temporary URL for a backup" "pgbackups\:url":"get a temporary URL for a backup"
"pgbackups\:capture":"capture a backup from a database id" "pgbackups\:capture":"capture a backup from a database id"
@ -131,6 +144,41 @@ case "$words[1]" in
'(-t|--tail)'{-t,--tail}'[continually stream logs]' \ '(-t|--tail)'{-t,--tail}'[continually stream logs]' \
) )
;; ;;
pipelines)
_command_args=(
'(--json)'--json'[output in json format]' \
)
;;
pipelines:add)
_command_args=(
'(-s|--stage)'{-s,--stage}'[stage of first app in pipeline]' \
)
;;
pipelines:create)
_command_args=(
'(-s|--stage)'{-s,--stage}'[stage of first app in pipeline]' \
)
;;
pipelines:info)
_command_args=(
'(--json)'--json'[output in json format]' \
)
;;
pipelines:list)
_command_args=(
'(--json)'--json'[output in json format]' \
)
;;
pipelines:promote)
_command_args=(
'(-t|--to)'{-t,--to}'[comma separated list of apps to promote to]' \
)
;;
pipelines:update)
_command_args=(
'(-s|--stage)'{-s,--stage}'[stage of first app in pipeline]' \
)
;;
pgbackups:capture) pgbackups:capture)
_command_args=( _command_args=(
'(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \ '(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \

View File

@ -1,9 +1,13 @@
# Autocompletion for kubectl, the command line interface for Kubernetes if (( $+commands[kubectl] )); then
# __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion"
# Author: https://github.com/pstadler
if [ $commands[kubectl] ]; then if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then
source <(kubectl completion zsh) kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE
fi
[[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE
unset __KUBECTL_COMPLETION_FILE
fi fi
# This command is used ALOT both below and in daily life # This command is used ALOT both below and in daily life
@ -33,6 +37,12 @@ alias kes='k edit svc'
alias kds='k describe svc' alias kds='k describe svc'
alias kdels='k delete svc' alias kdels='k delete svc'
# Ingress management
alias kgi='k get ingress'
alias kei='k edit ingress'
alias kdi='k describe ingress'
alias kdeli='k delete ingress'
# Secret management # Secret management
alias kgsec='k get secret' alias kgsec='k get secret'
alias kdsec='k describe secret' alias kdsec='k describe secret'

View File

@ -4,8 +4,10 @@ typeset -g ZSH_LAST_WORKING_DIRECTORY
# Updates the last directory once directory is changed # Updates the last directory once directory is changed
chpwd_functions+=(chpwd_last_working_dir) chpwd_functions+=(chpwd_last_working_dir)
chpwd_last_working_dir() { chpwd_last_working_dir() {
if [ "$ZSH_SUBSHELL" = 0 ]; then
local cache_file="$ZSH_CACHE_DIR/last-working-dir" local cache_file="$ZSH_CACHE_DIR/last-working-dir"
pwd >| "$cache_file" pwd >| "$cache_file"
fi
} }
# Changes directory to the last working directory # Changes directory to the last working directory

View File

@ -0,0 +1,6 @@
# Autocompletion for Minikube.
#
if [ $commands[minikube] ]; then
source <(minikube completion zsh)
fi

View File

@ -12,7 +12,7 @@ _mix_does_task_list_need_generating () {
} }
_mix_generate () { _mix_generate () {
mix --help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks mix help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks
} }
_mix () { _mix () {

View File

@ -21,6 +21,15 @@ _1st_arguments=(
'deps.unlock:Unlock the given dependencies' 'deps.unlock:Unlock the given dependencies'
'deps.update:Update the given dependencies' 'deps.update:Update the given dependencies'
'do:Executes the tasks separated by comma' 'do:Executes the tasks separated by comma'
'ecto.create:Create Ecto database'
'ecto.drop:Drop the storage for the given repository'
'ecto.dump:Dumps the current environments database structure'
'ecto.gen.migration:Generates a migration'
'ecto.gen.repo:Generates a new repository'
'ecto.load:Loads the current environments database structure'
'ecto.migrate:Runs Ecto migration'
'ecto.migrations:Displays the up / down migration status'
'ecto.rollback:Reverts applied migrations'
'escript.build:Builds an escript for the project' 'escript.build:Builds an escript for the project'
'help:Print help information for tasks' 'help:Print help information for tasks'
'hex:Print hex help information' 'hex:Print hex help information'

26
plugins/npm/README.md Normal file
View File

@ -0,0 +1,26 @@
## npm plugin
The npm plugin provides completion as well as adding many useful aliases.
To use it, add npm to the plugins array of your zshrc file:
```
plugins=(... npm)
```
## Aliases
| Alias | Command | Descripton |
|:------ |:-----------------------------|:----------------------------------------------------------------|
| `npmg` | `npm i -g` | Install dependencies globally |
| `npmS` | `npm i -S` | Install and save to dependencies in your package.json |
| `npmD` | `npm i -D` | Install and save to dev-dependencies in your package.json |
| `npmE` | `PATH="$(npm bin)":"$PATH"` | Run command from node_modules folder based on current directory |
| `npmO` | `npm outdated` | Check which npm modules are outdated |
| `npmV` | `npm -v` | Check package versions |
| `npmL` | `npm list` | List installed packages |
| `npmL0` | `npm ls --depth=0` | List top-level installed packages |
| `npmst` | `npm start` | Run npm start |
| `npmt` | `npm test` | Run npm test |
| `npmR` | `npm run` | Run npm scripts |
| `npmP` | `npm publish` | Run npm publish |
| `npmI` | `npm init` | Run npm init |

View File

@ -11,7 +11,21 @@ This plugin automatically registers npx command-not-found handler if `npx` exist
plugins=(.... npx) plugins=(.... npx)
``` ```
- Globally install npx binary (you need node.js installed too!) - Globally install npx binary (npx will be auto installed with recent versions of Node.js)
```bash ```bash
sudo npm install -g npx sudo npm install -g npx
``` ```
## Note
The shell auto-fallback doesn't auto-install plain packages. In order to get it to install something, you need to add `@`:
```
➜ jasmine@latest # or just `jasmine@`
npx: installed 13 in 1.896s
Randomized with seed 54385
Started
```
It does it this way so folks using the fallback don't accidentally try to install regular typoes.

View File

@ -1,50 +1,41 @@
_homebrew-installed() { # This plugin loads pyenv into the current shell and provides prompt info via
type brew &> /dev/null # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
}
_pyenv-from-homebrew-installed() { FOUND_PYENV=$+commands[pyenv]
brew --prefix pyenv &> /dev/null
}
FOUND_PYENV=0 if [[ $FOUND_PYENV -ne 1 ]]; then
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv") pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv")
for dir in $pyenvdirs; do
for pyenvdir in "${pyenvdirs[@]}" ; do if [[ -d $dir/bin ]]; then
if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then export PATH="$PATH:$dir/bin"
FOUND_PYENV=1 FOUND_PYENV=1
export PYENV_ROOT=$pyenvdir break
export PATH=${pyenvdir}/bin:$PATH
eval "$(pyenv init - zsh)"
if pyenv commands | command grep -q virtualenv-init; then
eval "$(pyenv virtualenv-init - zsh)"
fi fi
done
fi
function pyenv_prompt_info() { if [[ $FOUND_PYENV -ne 1 ]]; then
echo "$(pyenv version-name)" if (( $+commands[brew] )) && dir=$(brew --prefix pyenv 2>/dev/null); then
} if [[ -d $dir/bin ]]; then
fi export PATH="$PATH:$dir/bin"
done
unset pyenvdir
if [ $FOUND_PYENV -eq 0 ] ; then
pyenvdir=$(brew --prefix pyenv 2> /dev/null)
if [ $? -eq 0 -a -d $pyenvdir/bin ] ; then
FOUND_PYENV=1 FOUND_PYENV=1
export PYENV_ROOT=$pyenvdir
export PATH=${pyenvdir}/bin:$PATH
eval "$(pyenv init - zsh)"
if pyenv commands | command grep -q virtualenv-init; then
eval "$(pyenv virtualenv-init - zsh)"
fi fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
}
fi fi
fi fi
if [ $FOUND_PYENV -eq 0 ] ; then if [[ $FOUND_PYENV -eq 1 ]]; then
function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" } eval "$(pyenv init - zsh)"
if (( $+commands[pyenv-virtualenv-init] )); then
eval "$(pyenv virtualenv-init - zsh)"
fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
}
else
# fallback to system python
function pyenv_prompt_info() {
echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')"
}
fi fi
unset FOUND_PYENV dir

View File

@ -51,6 +51,9 @@ _arguments \
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "rails subcommand" _1st_arguments _describe -t commands "rails subcommand" _1st_arguments
return return
else
_files
return
fi fi
case "$words[1]" in case "$words[1]" in

View File

@ -88,14 +88,14 @@ _rustc_opts_vals=(
--pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"' --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"'
--unpretty='[Present the input source, unstable (and less-pretty)]::TYPE:_values "TYPES" "$_rustc_unpretty_types[@]"' --unpretty='[Present the input source, unstable (and less-pretty)]::TYPE:_values "TYPES" "$_rustc_unpretty_types[@]"'
--color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"'
{-v,--version}'[Print version info and exit]::VERBOSE:(verbose)'
) )
_rustc_opts_switches=( _rustc_opts_switches=(
-g'[Equivalent to --debuginfo=2]' -g'[Equivalent to --debuginfo=2]'
-O'[Equivalent to --opt-level=2]' -O'[Equivalent to --opt-level=2]'
--test'[Build a test harness]' --test'[Build a test harness]'
--verbose'[Use verbose output]' {-v,--verbose}'[Use verbose output]'
{-V,--version}'[Print version info and exit]'
{-h,--help}'[Display this message]' {-h,--help}'[Display this message]'
--no-analysis'[Parse and expand the output, but run no analysis or produce output]' --no-analysis'[Parse and expand the output, but run no analysis or produce output]'
--no-trans'[Run all passes except translation; no output]' --no-trans'[Run all passes except translation; no output]'

View File

@ -88,19 +88,18 @@ shrink_path () {
if (( named )) { if (( named )) {
for part in ${(k)nameddirs}; { for part in ${(k)nameddirs}; {
[[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part} [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/#${nameddirs[$part]}/\~$part}
} }
} }
(( tilde )) && dir=${dir/$HOME/\~} (( tilde )) && dir=${dir/#$HOME/\~}
tree=(${(s:/:)dir}) tree=(${(s:/:)dir})
( (
unfunction chpwd 2> /dev/null
if [[ $tree[1] == \~* ]] { if [[ $tree[1] == \~* ]] {
cd ${~tree[1]} cd -q ${~tree[1]}
result=$tree[1] result=$tree[1]
shift tree shift tree
} else { } else {
cd / cd -q /
} }
for dir in $tree; { for dir in $tree; {
if (( lastfull && $#tree == 1 )) { if (( lastfull && $#tree == 1 )) {
@ -117,7 +116,7 @@ shrink_path () {
(( short )) && break (( short )) && break
done done
result+="/$part" result+="/$part"
cd $dir cd -q $dir
shift tree shift tree
} }
echo ${result:-/} echo ${result:-/}

View File

@ -11,6 +11,8 @@ plugins=(... ssh-agent)
## Instructions ## Instructions
**IMPORTANT: put these settings _before_ the line that sources oh-my-zsh**
To enable **agent forwarding support** add the following to your zshrc file: To enable **agent forwarding support** add the following to your zshrc file:
```zsh ```zsh

View File

@ -1,5 +1,9 @@
# Sublime Text Aliases
() {
if [[ "$OSTYPE" == linux* ]]; then if [[ "$OSTYPE" == linux* ]]; then
local _sublime_linux_paths > /dev/null 2>&1 local _sublime_linux_paths
_sublime_linux_paths=( _sublime_linux_paths=(
"$HOME/bin/sublime_text" "$HOME/bin/sublime_text"
"/opt/sublime_text/sublime_text" "/opt/sublime_text/sublime_text"
@ -19,9 +23,8 @@ if [[ "$OSTYPE" == linux* ]]; then
break break
fi fi
done done
elif [[ "$OSTYPE" = darwin* ]]; then elif [[ "$OSTYPE" = darwin* ]]; then
local _sublime_darwin_paths > /dev/null 2>&1 local _sublime_darwin_paths
_sublime_darwin_paths=( _sublime_darwin_paths=(
"/usr/local/bin/subl" "/usr/local/bin/subl"
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
@ -38,10 +41,9 @@ elif [[ "$OSTYPE" = darwin* ]]; then
break break
fi fi
done done
elif [[ "$OSTYPE" = 'cygwin' ]]; then elif [[ "$OSTYPE" = 'cygwin' ]]; then
local _sublime_cygwin_paths > /dev/null 2>&1 local sublime_cygwin_paths
_sublime_cygwin_paths=( sublime_cygwin_paths=(
"$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe" "$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe"
"$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe" "$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe"
) )
@ -52,9 +54,10 @@ elif [[ "$OSTYPE" = 'cygwin' ]]; then
break break
fi fi
done done
fi fi
}
alias stt='st .' alias stt='st .'
find_project() find_project()

View File

@ -1,7 +1,9 @@
## atom ## Terraform oh-my-zsh plugin
Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently. Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently.
Current as of Terraform v0.11.7
### Requirements ### Requirements
* [Terraform](https://terraform.io/) * [Terraform](https://terraform.io/)
@ -13,7 +15,7 @@ Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely a
### Expanding ZSH prompt with current Terraform workspace name ### Expanding ZSH prompt with current Terraform workspace name
If you want to get current Terraform workspace name in your ZSH prompt open If you want to get current Terraform workspace name in your ZSH prompt open
your .zsh-theme file and in a choosen place insert: your .zsh-theme file and in a chosen place insert:
``` ```
$FG[045]\ $FG[045]\

View File

@ -3,91 +3,151 @@
local -a _terraform_cmds local -a _terraform_cmds
_terraform_cmds=( _terraform_cmds=(
'apply:Builds or changes infrastructure' 'apply:Builds or changes infrastructure'
'console:Interactive console for Terraform interpolations'
'destroy:Destroy Terraform-managed infrastructure' 'destroy:Destroy Terraform-managed infrastructure'
'fmt:Rewrites config files to canonical format'
'get:Download and install modules for the configuration' 'get:Download and install modules for the configuration'
'graph:Create a visual graph of Terraform resources' 'graph:Create a visual graph of Terraform resources'
'init:Initializes Terraform configuration from a module' 'import:Import existing infrastructure into Terraform'
'init:Initialize a Terraform working directory'
'output:Read an output from a state file' 'output:Read an output from a state file'
'plan:Generate and show an execution plan' 'plan:Generate and show an execution plan'
'pull:Refreshes the local state copy from the remote server' 'providers:Prints a tree of the providers used in the configuration'
'push:Uploads the local state to the remote server' 'push:Upload this Terraform module to Atlas to run'
'refresh:Update local state file against real resources' 'refresh:Update local state file against real resources'
'remote:Configures remote state management'
'show:Inspect Terraform state or plan' 'show:Inspect Terraform state or plan'
'taint:Manually forcing a destroy and recreate on the next plan/apply' 'taint:Manually mark a resource for recreation'
'untaint:Manually unmark a resource as tainted'
'validate:Validates the Terraform files'
'version:Prints the Terraform version' 'version:Prints the Terraform version'
'workspace:Workspace management'
) )
__apply() { __apply() {
_arguments \ _arguments \
'-auto-approve[Skip interactive approval of plan before applying.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-auto-approve[Skip interactive approval of plan before applying.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \ '-input=[(true) Ask for input for variables if not directly set.]' \
'-no-color[If specified, output will not contain any color.]' \ '-no-color[If specified, output wil be colorless.]' \
'-parallelism=[(10) Limit the number of parallel resource operations.]' \
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
'-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
__console() {
_arguments \
'-state=[(terraform.tfstate) Path to read state.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
} }
__destroy() { __destroy() {
_arguments \ _arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-force[If set, then the destroy confirmation will not be shown.]' \ '-auto-approve[Skip interactive approval before destroying.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \ '-force[Deprecated: same as auto-approve.]' \
'-no-color[If specified, output will not contain any color.]' \ '-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
'-target=[(resource) Instead of affecting "dependencies" will instead also destroy any resources that depend on the target(s) specified.]' \ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
}
__fmt() {
_arguments \
'-list=[(true) List files whose formatting differs (always false if using STDIN)]' \
'-write=[(true) Write result to source file instead of STDOUT (always false if using STDIN or -check)]' \
'-diff=[(false) Display diffs of formatting changes]' \
'-check=[(false) Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]'
} }
__get() { __get() {
_arguments \ _arguments \
'-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' '-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' \
'-no-color[If specified, output will contain no color.]'
} }
__graph() { __graph() {
_arguments \ _arguments \
'-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors.]' \ '-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors.]' \
'-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \ '-no-color[If specified, output will contain no color.]' \
'-verbose[Generate a verbose, "worst-case" graph, with all nodes for potential operations in place.]' '-type=[(plan) Type of graph to output. Can be: plan, plan-destroy, apply, validate, input, refresh.]'
}
__import() {
_arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-config=[(path) Path to a directory of Terraform configuration files to use to configure the provider. Defaults to pwd. If no config files are present, they must be provided via the input prompts or env vars.]' \
'-allow-missing-config[Allow import when no resource configuration block exists.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-provider=[(provider) Specific provider to use for import. This is used for specifying aliases, such as "aws.eu". Defaults to the normal provider prefix of the resource being imported.]' \
'-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]' \
'-state-out=[(PATH) Path to the destination state file to write to. If this is not specified, the source state file will be used. This can be a new or existing path.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times. This is only useful with the "-config" flag.]' \
'-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
} }
__init() { __init() {
_arguments \ _arguments \
'-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \ '-backend=[(true) Configure the backend for this configuration.]' \
'-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \ '-backend-config=[This can be either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a 'key=value' format. This is merged with what is in the configuration file. This can be specified multiple times. The backend type must be in the configuration itself.]' \
'-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \ '-force-copy[Suppress prompts about copying state data. This is equivalent to providing a "yes" to all confirmation prompts.]' \
'-backend-config=[(path) Specifies the path to remote backend config file.]' \ '-from-module=[Copy the contents of the given module into the target directory before initialization.]' \
'-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \ '-get=[(true) Download any modules for this configuration.]' \
'-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' '-get-plugins=[(true) Download any missing plugins for this configuration.]' \
'-input=[(true) Ask for input if necessary. If false, will error if input was required.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will contain no color.]' \
'-plugin-dir[Directory containing plugin binaries. This overrides all default search paths for plugins, and prevents the automatic installation of plugins. This flag can be used multiple times.]' \
'-reconfigure[Reconfigure the backend, ignoring any saved configuration.]' \
'-upgrade=[(false) If installing modules (-get) or plugins (-get-plugins), ignore previously-downloaded objects and install the latest version allowed within configured constraints.]' \
'-verify-plugins=[(true) Verify the authenticity and integrity of automatically downloaded plugins.]'
} }
__output() { __output() {
_arguments \ _arguments \
'-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]' \ '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]' \
'-module=[(module_name) The module path which has needed output. By default this is the root path. Other modules can be specified by a period-separated list.]' '-no-color[ If specified, output will contain no color.]' \
'-module=[(name) If specified, returns the outputs for a specific module]' \
'-json[If specified, machine readable output will be printed in JSON format]'
} }
__plan() { __plan() {
_arguments \ _arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with" .backup" extension. Set to "-" to disable backup.]' \ '-destroy[() If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
'-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \ '-detailed-exitcode[() Return detailed exit codes when the command exits. This will change the meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 - Errored, 2 - Succeeded; there is a diff]' \
'-detailed-exitcode[Return a detailed exit code when the command exits. When provided, this argument changes the exit codes and their meanings to provide more granular information about what the resulting plan contains]' \
'-input=[(true) Ask for input for variables if not directly set.]' \ '-input=[(true) Ask for input for variables if not directly set.]' \
'-module-depth=[(n) Specifies the depth of modules to show in the output. This does not affect the plan itself, only the output shown. By default, this is zero. -1 will expand all.]' \ '-lock=[(true) Lock the state file when locking is supported.]' \
'-no-color[If specified, output will not contain any color.]' \ '-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module-depth=[(n) Specifies the depth of modules to show in the output. This does not affect the plan itself, only the output shown. By default, this is -1, which will expand all.]' \
'-no-color[() If specified, output will contain no color.]' \
'-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \ '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
'-parallelism=[(10) Limit the number of concurrent operations.]' \
'-refresh=[(true) Update state prior to checking for differences.]' \ '-refresh=[(true) Update state prior to checking for differences.]' \
'-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
'-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \ '-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' '-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]' \
}
__providers() {
_arguments \
} }
__push() { __push() {
@ -106,6 +166,9 @@ __push() {
__refresh() { __refresh() {
_arguments \ _arguments \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-input=[(true) Ask for input for variables if not directly set.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-no-color[If specified, output will not contain any color.]' \ '-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
@ -114,19 +177,6 @@ __refresh() {
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
} }
__remote() {
_arguments \
'-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
'-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
'-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-disable[Disables remote state management and migrates the state to the -state path.]' \
'-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
'-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' \
'-pull=[(true) Controls if the remote state is pulled before disabling. This defaults to true to ensure the latest state is cached before disabling.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]'
}
__show() { __show() {
_arguments \ _arguments \
'-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \ '-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \
@ -137,12 +187,46 @@ __taint() {
_arguments \ _arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \ '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \ '-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
'-no-color[If specified, output will not contain any color.]' \ '-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]' '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
} }
__untaint() {
_arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
'-lock=[(true) Lock the state file when locking is supported.]' \
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
'-no-color[If specified, output will not contain any color.]' \
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
'-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
}
__validate() {
_arguments \
'-check-variables=[(true) If set to true (default), the command will check whether all required variables have been specified.]' \
'-no-color[If specified, output will not contain any color.]' \
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]'
}
__workspace() {
local -a __workspace_cmds
__workspace_cmds=(
'delete:Delete a workspace'
'list:List Workspaces'
'new:Create a new workspace'
'select:Select a workspace'
'show:Show the name of the current workspace'
)
_describe -t workspace "workspace commands" __workspace_cmds
}
_arguments '*:: :->command' _arguments '*:: :->command'
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
@ -154,26 +238,38 @@ local -a _command_args
case "$words[1]" in case "$words[1]" in
apply) apply)
__apply ;; __apply ;;
console)
__console;;
destroy) destroy)
__destroy ;; __destroy ;;
fmt)
__fmt;;
get) get)
__get ;; __get ;;
graph) graph)
__graph ;; __graph ;;
import)
__import;;
init) init)
__init ;; __init ;;
output) output)
__output ;; __output ;;
plan) plan)
__plan ;; __plan ;;
providers)
__providers ;;
push) push)
__push ;; __push ;;
refresh) refresh)
__refresh ;; __refresh ;;
remote)
__remote ;;
show) show)
__show ;; __show ;;
taint) taint)
__taint ;; __taint ;;
untaint)
__untaint ;;
validate)
__validate ;;
workspace)
test $CURRENT -lt 3 && __workspace ;;
esac esac

View File

@ -0,0 +1,24 @@
# `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/
```

View File

@ -0,0 +1,67 @@
# 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
# cleanup
rm -f $tmpfile
}

View File

@ -5,18 +5,21 @@
# https://github.com/trinaldi # https://github.com/trinaldi
# Nicolas Jonas nextgenthemes.com # Nicolas Jonas nextgenthemes.com
# https://github.com/loctauxphilippe # https://github.com/loctauxphilippe
# https://github.com/HaraldNordgren
# #
# Debian, Ubuntu and friends related zsh aliases and functions for zsh # Debian, Ubuntu and friends related zsh aliases and functions for zsh
(( $+commands[apt] )) && APT=apt || APT=apt-get
alias acs='apt-cache search' alias acs='apt-cache search'
compdef _acs acs='apt-cache search' compdef _acs acs='apt-cache search'
alias afs='apt-file search --regexp' alias afs='apt-file search --regexp'
compdef _afs afs='apt-file search --regexp' compdef _afs afs='apt-file search --regexp'
# These are apt-get only # These are apt/apt-get only
alias ags='apt-get source' # asrc alias ags="$APT source" # asrc
compdef _ags ags='apt-get source' compdef _ags ags="$APT source"
alias acp='apt-cache policy' # app alias acp='apt-cache policy' # app
compdef _acp acp='apt-cache policy' compdef _acp acp='apt-cache policy'
@ -37,33 +40,33 @@ compdef _afu afu='sudo apt-file update'
alias ppap='sudo ppa-purge' alias ppap='sudo ppa-purge'
compdef _ppap ppap='sudo ppa-purge' compdef _ppap ppap='sudo ppa-purge'
alias apg='sudo apt-get' # age - but without sudo alias ag="sudo $APT" # age - but without sudo
alias aga='sudo apt-get autoclean' # aac alias aga="sudo $APT autoclean" # aac
alias agb='sudo apt-get build-dep' # abd alias agb="sudo $APT build-dep" # abd
alias agc='sudo apt-get clean' # adc alias agc="sudo $APT clean" # adc
alias agd='sudo apt-get dselect-upgrade' # ads alias agd="sudo $APT dselect-upgrade" # ads
alias agi='sudo apt-get install' # ai alias agi="sudo $APT install" # ai
alias agp='sudo apt-get purge' # ap alias agp="sudo $APT purge" # ap
alias agr='sudo apt-get remove' # ar alias agr="sudo $APT remove" # ar
alias agu='sudo apt-get update' # ad alias agu="sudo $APT update" # ad
alias agud='sudo apt-get update && sudo apt-get full-upgrade' #adu alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu
alias agug='sudo apt-get upgrade' # ag alias agug="sudo $APT upgrade" # ag
alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg alias aguu="sudo $APT update && sudo $APT upgrade" #adg
alias agar='sudo apt-get autoremove' alias agar="sudo $APT autoremove"
compdef _ag apg='sudo apt-get' compdef _ag ag="sudo $APT"
compdef _aga aga='sudo apt-get autoclean' compdef _aga aga="sudo $APT autoclean"
compdef _agb agb='sudo apt-get build-dep' compdef _agb agb="sudo $APT build-dep"
compdef _agc agc='sudo apt-get clean' compdef _agc agc="sudo $APT clean"
compdef _agd agd='sudo apt-get dselect-upgrade' compdef _agd agd="sudo $APT dselect-upgrade"
compdef _agi agi='sudo apt-get install' compdef _agi agi="sudo $APT install"
compdef _agp agp='sudo apt-get purge' compdef _agp agp="sudo $APT purge"
compdef _agr agr='sudo apt-get remove' compdef _agr agr="sudo $APT remove"
compdef _agu agu='sudo apt-get update' compdef _agu agu="sudo $APT update"
compdef _agud agud='sudo apt-get update && sudo apt-get full-upgrade' compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade"
compdef _agug agug='sudo apt-get upgrade' compdef _agug agug="sudo $APT upgrade"
compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade' compdef _aguu aguu="sudo $APT update && sudo $APT upgrade"
compdef _agar agar='sudo apt-get autoremove' compdef _agar agar="sudo $APT autoremove"
# Remove ALL kernel images and headers EXCEPT the one in use # Remove ALL kernel images and headers EXCEPT the one in use
alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
@ -91,8 +94,8 @@ aar() {
PACKAGE=${1##*/} PACKAGE=${1##*/}
fi fi
sudo apt-add-repository $1 && sudo apt-get update sudo apt-add-repository $1 && sudo $APT update
sudo apt-get install $PACKAGE sudo $APT install $PACKAGE
} }
# Prints apt history # Prints apt history

View File

@ -1,11 +1,27 @@
virtualenvwrapper='virtualenvwrapper.sh' 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 { function {
setopt local_options setopt local_options
unsetopt equals unsetopt equals
source ${${virtualenvwrapper}:c} 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 elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
function { function {
setopt local_options setopt local_options

View File

@ -6,7 +6,7 @@ function vundle-init () {
if [ ! -d ~/.vim/bundle/Vundle.vim/.git ] && [ ! -f ~/.vim/bundle/Vundle.vim/.git ] if [ ! -d ~/.vim/bundle/Vundle.vim/.git ] && [ ! -f ~/.vim/bundle/Vundle.vim/.git ]
then then
git clone git://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
echo "\n\tRead about vim configuration for vundle at https://github.com/VundleVim/Vundle.vim\n" echo "\n\tRead about vim configuration for vundle at https://github.com/VundleVim/Vundle.vim\n"
fi fi
} }

View File

@ -19,7 +19,7 @@ plugins=(... xcode)
| xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* | | xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* |
| xcp | Show currently selected Xcode directory | xcode-select --print-path | | xcp | Show currently selected Xcode directory | xcode-select --print-path |
| xcsel | Select different Xcode directory by path | sudo xcode-select --switch | | xcsel | Select different Xcode directory by path | sudo xcode-select --switch |
| xx | Opens the files listed in Xcode | open -a "Xcode.app" |
## Functions ## Functions
@ -29,6 +29,10 @@ plugins=(... xcode)
Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files. Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files.
Returns 1 if it didn't find any relevant files. Returns 1 if it didn't find any relevant files.
### `xx`
Opens the files listed in Xcode, multiple files are opened in a multi-file browser.
### `simulator` ### `simulator`
Opens the iOS Simulator from your command line, dependent on whichever is the active developer directory for Xcode. (That is, it respects the `xcsel` setting.) Opens the iOS Simulator from your command line, dependent on whichever is the active developer directory for Xcode. (That is, it respects the `xcsel` setting.)

View File

@ -27,6 +27,17 @@ function xc {
fi fi
} }
# Opens a file or files in the Xcode IDE. Multiple files are opened in multi-file browser
# original author: @possen
function xx {
if [[ $# == 0 ]]; then
echo "Specify file(s) to open in xcode."
return 1
fi
echo "${xcode_files}"
open -a "Xcode.app" "$@"
}
# "XCode-SELect by Version" - select Xcode by just version number # "XCode-SELect by Version" - select Xcode by just version number
# Uses naming convention: # Uses naming convention:
# - different versions of Xcode are named Xcode-<version>.app or stored # - different versions of Xcode are named Xcode-<version>.app or stored

View File

@ -0,0 +1,23 @@
# zsh_reload plugin
The zsh_reload plugin defines a function to reload the zsh session with
just a few keystrokes.
To use it, add `zsh_reload` to the plugins array in your zshrc file:
```zsh
plugins=(... zsh_reload)
```
## Usage
To reload the zsh session, just run `src`:
```zsh
$ vim ~/.zshrc # enabled a plugin
$ src
re-compiling /home/user/.zshrc.zwc: succeeded
re-compiling /home/user/.oh-my-zsh/cache/zcomp-host.zwc: succeeded
# you now have a fresh zsh session. happy hacking!
```

View File

@ -1,13 +1,12 @@
# reload zshrc src() {
function src() local cache="$ZSH_CACHE_DIR"
{
local cache=$ZSH_CACHE_DIR
autoload -U compinit zrecompile autoload -U compinit zrecompile
compinit -d "$cache/zcomp-$HOST" compinit -i -d "$cache/zcomp-$HOST"
for f in ~/.zshrc "$cache/zcomp-$HOST"; do for f in ~/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old zrecompile -p $f && command rm -f $f.zwc.old
done done
source ~/.zshrc # Use $SHELL if available; remove leading dash if login shell
[[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
} }

View File

@ -93,9 +93,9 @@ prompt_git() {
PL_BRANCH_CHAR=$'\ue0a0' #  PL_BRANCH_CHAR=$'\ue0a0' # 
} }
local ref dirty mode repo_path local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null)
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
repo_path=$(git rev-parse --git-dir 2>/dev/null)
dirty=$(parse_git_dirty) dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
if [[ -n $dirty ]]; then if [[ -n $dirty ]]; then
@ -151,7 +151,7 @@ prompt_bzr() {
prompt_hg() { prompt_hg() {
(( $+commands[hg] )) || return (( $+commands[hg] )) || return
local rev status local rev st branch
if $(hg id >/dev/null 2>&1); then if $(hg id >/dev/null 2>&1); then
if $(hg prompt >/dev/null 2>&1); then if $(hg prompt >/dev/null 2>&1); then
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
@ -222,7 +222,25 @@ build_prompt() {
prompt_git prompt_git
prompt_bzr prompt_bzr
prompt_hg prompt_hg
prompt_docker_host
# prompt_k8s_context
prompt_end prompt_end
} }
PROMPT='%{%f%b%k%}$(build_prompt) ' PROMPT='%{%f%b%k%}$(build_prompt) '
prompt_docker_host() {
if [[ ! -z "$DOCKER_MACHINE_NAME" ]]; then
prompt_segment red default "\xF0\x9F\x90\xB3: '$DOCKER_MACHINE_NAME'"
elif [[ ! -z "$DOCKER_HOST" ]]; then
prompt_segment red default "\xF0\x9F\x90\xB3: '$DOCKER_HOST'"
fi
}
# k8s context
#prompt_k8s_context() {
# K8S_CONTEXT=$(cat $KUBECONFIG | grep 'current-context:' | cut -d: -f2 | tr -d ' ')
# if [[ -n "$K8S_CONTEXT" ]]; then
# prompt_segment red default "%{$fg_bold[blue]%}\xE2\x8E\x88%{$fg_no_bold[white]%}: '$K8S_CONTEXT'"
# fi
#}

View File

@ -60,7 +60,7 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats ""
function steeef_preexec { function steeef_preexec {
case "$(history $HISTCMD)" in case "$2" in
*git*) *git*)
PR_GIT_UPDATE=1 PR_GIT_UPDATE=1
;; ;;

View File

@ -1,16 +1,13 @@
# user, host, full path, and time/date on two lines for easier vgrepping # user, host, full path, and time/date on two lines for easier vgrepping
if ! grep -q "prompt" ~/.hgrc; then
echo "This theme requires 'hg prompt' (https://bitbucket.org/sjl/hg-prompt/overview)"
return 1
fi
function hg_prompt_info { function hg_prompt_info {
if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then
hg prompt --angle-brackets "\ hg prompt --angle-brackets "\
<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\ <hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\ </%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
%{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}< %{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}<
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
fi
} }
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+"

View File

@ -62,10 +62,13 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats ""
function steeef_preexec { function steeef_preexec {
case "$(history $HISTCMD)" in case "$2" in
*git*) *git*)
PR_GIT_UPDATE=1 PR_GIT_UPDATE=1
;; ;;
*hub*)
PR_GIT_UPDATE=1
;;
*svn*) *svn*)
PR_GIT_UPDATE=1 PR_GIT_UPDATE=1
;; ;;

View File

@ -42,7 +42,7 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
_upgrade_zsh _upgrade_zsh
else else
echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" echo "[Oh My Zsh] Would you like to update? [Y/n]: \c"
read line read line
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
_upgrade_zsh _upgrade_zsh

View File

@ -24,12 +24,11 @@ main() {
# which may fail on systems lacking tput or terminfo # which may fail on systems lacking tput or terminfo
set -e set -e
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) if ! command -v zsh >/dev/null 2>&1; then
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
printf "${YELLOW}Zsh is not installed!${NORMAL} Installing zsh\n" printf "${YELLOW}Zsh is not installed!${NORMAL} Installing zsh\n"
sudo apt-get install zsh -y sudo apt-get install zsh -y
fi fi
unset CHECK_ZSH_INSTALLED
if [ ! -n "$ZSH" ]; then if [ ! -n "$ZSH" ]; then
ZSH=~/.oh-my-zsh ZSH=~/.oh-my-zsh