diff options
146 files changed, 6409 insertions, 1144 deletions
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index c44bb2475..484a8cf53 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ -github: [robbyrussell, mcornella, larson-carter] +github: [ohmyzsh, robbyrussell, mcornella, larson-carter] open_collective: ohmyzsh diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index af2973fec..98f66b1d2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,12 +1,11 @@ -name: Bug report -description: Create a report to help us improve Oh My Zsh -labels: 'Bug' +name: Report a bug +description: Report a bug that isn't caused by Oh My Zsh. If unsure, use this form body: - type: markdown attributes: value: | ## Self Check - - Try searching existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed) for similar issues. + - Look for similar errors in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed). - Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help. - type: textarea validations: @@ -41,21 +40,21 @@ body: validations: required: true attributes: - label: OS / Distro - placeholder: e.g. Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15... + label: OS / Linux distribution + placeholder: Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15... - type: input validations: required: true attributes: label: Zsh version description: Run `echo $ZSH_VERSION` to check. - placeholder: e.g. 5.6 + placeholder: "5.6" - type: input validations: required: true attributes: label: Terminal emulator - placeholder: e.g. iTerm2, Gnome Terminal... + placeholder: iTerm2, GNOME Terminal, Terminal.app... - type: dropdown attributes: label: If using WSL on Windows, which version of WSL diff --git a/.github/ISSUE_TEMPLATE/bug_report_omz.yml b/.github/ISSUE_TEMPLATE/bug_report_omz.yml new file mode 100644 index 000000000..96f5ad934 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report_omz.yml @@ -0,0 +1,77 @@ +name: Report a bug in Oh My Zsh +description: Create a report to help us improve Oh My Zsh +labels: ['Bug'] +body: + - type: markdown + attributes: + value: | + ## Self Check + - **Make sure this bug only happens with Oh My Zsh enabled**. + - Look for similar errors in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed). + - Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help. + - type: textarea + validations: + required: true + attributes: + label: Describe the bug + description: A clear description of what the bug is. + - type: textarea + validations: + required: true + attributes: + label: Steps to reproduce + description: | + Steps to reproduce the problem. + placeholder: | + For example: + 1. Enable plugin '...' + 2. Run command '...' or try to complete command '...' + 3. See error + - type: textarea + validations: + required: true + attributes: + label: Expected behavior + description: A brief description of what should happen. + - type: textarea + attributes: + label: Screenshots and recordings + description: | + If applicable, add screenshots to help explain your problem. You can also record an asciinema session: https://asciinema.org/ + - type: input + validations: + required: true + attributes: + label: OS / Linux distribution + placeholder: Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15... + - type: input + validations: + required: true + attributes: + label: Zsh version + description: Run `echo $ZSH_VERSION` to check. + placeholder: "5.6" + - type: input + validations: + required: true + attributes: + label: Oh My Zsh version + description: Run `omz version` to check. + placeholder: master (bf303965) + - type: input + validations: + required: true + attributes: + label: Terminal emulator + placeholder: iTerm2, GNOME Terminal, Terminal.app... + - type: dropdown + attributes: + label: If using WSL on Windows, which version of WSL + description: Run `wsl -l -v` to check. + options: + - WSL1 + - WSL2 + - type: textarea + attributes: + label: Additional context + description: Add any other context about the problem here. This can be themes, plugins, custom settings... diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index dc4baf2b1..ac966dfd9 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,7 +1,12 @@ name: Feature request description: Suggest a feature for Oh My Zsh -labels: 'Feature' +labels: ["Feature"] body: + - type: markdown + attributes: + value: | + ## Self Check + - Look for similar features in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed). - type: input attributes: label: If the feature request is for a plugin or theme, specify it here. diff --git a/.github/actions/spelling/README.md b/.github/actions/spelling/README.md new file mode 100644 index 000000000..dcd237ba2 --- /dev/null +++ b/.github/actions/spelling/README.md @@ -0,0 +1,15 @@ +# check-spelling/check-spelling configuration + +File | Purpose | Format | Info +-|-|-|- +[dictionary.txt](dictionary.txt) | Replacement dictionary (creating this file will override the default dictionary) | one word per line | [dictionary](https://github.com/check-spelling/check-spelling/wiki/Configuration#dictionary) +[allow.txt](allow.txt) | Add words to the dictionary | one word per line (only letters and `'`s allowed) | [allow](https://github.com/check-spelling/check-spelling/wiki/Configuration#allow) +[reject.txt](reject.txt) | Remove words from the dictionary (after allow) | grep pattern matching whole dictionary words | [reject](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-reject) +[excludes.txt](excludes.txt) | Files to ignore entirely | perl regular expression | [excludes](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-excludes) +[only.txt](only.txt) | Only check matching files (applied after excludes) | perl regular expression | [only](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-only) +[patterns.txt](patterns.txt) | Patterns to ignore from checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns) +[expect.txt](expect.txt) | Expected words that aren't in the dictionary | one word per line (sorted, alphabetically) | [expect](https://github.com/check-spelling/check-spelling/wiki/Configuration#expect) +[advice.md](advice.md) | Supplement for GitHub comment when unrecognized words are found | GitHub Markdown | [advice](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice) + +Note: you can replace any of these files with a directory by the same name (minus the suffix) +and then include multiple files inside that directory (with that suffix) to merge multiple files together. diff --git a/.github/actions/spelling/advice.md b/.github/actions/spelling/advice.md new file mode 100644 index 000000000..c83423a8e --- /dev/null +++ b/.github/actions/spelling/advice.md @@ -0,0 +1,25 @@ +<!-- See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice --> <!-- markdownlint-disable MD033 MD041 --> +<details><summary>If the flagged items do not appear to be text</summary> + +If items relate to a ... +* well-formed pattern. + + If you can write a [pattern](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns) that would match it, + try adding it to the `patterns.txt` file. + + Patterns are Perl 5 Regular Expressions - you can [test]( +https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines. + + Note that patterns can't match multiline strings. + +* binary file. + + Please add a file path to the `excludes.txt` file matching the containing file. + + File paths are Perl 5 Regular Expressions - you can [test]( +https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files. + + `^` refers to the file's path from the root of the repository, so `^README\.md$` would exclude [README.md]( +../tree/HEAD/README.md) (on whichever branch you're using). + +</details> diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/.github/actions/spelling/allow.txt diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt new file mode 100644 index 000000000..f1cfeefbb --- /dev/null +++ b/.github/actions/spelling/excludes.txt @@ -0,0 +1,41 @@ +# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes +(?:^|/)(?i)COPYRIGHT +(?:^|/)(?i)LICEN[CS]E +(?:^|/)package(?:-lock|)\.json$ +(?:^|/)vendor/ +ignore$ +\.avi$ +\.ico$ +\.jpe?g$ +\.lock$ +\.map$ +\.min\.. +\.mod$ +\.mp[34]$ +\.png$ +\.wav$ +^\.github/ +^\Qplugins/archlinux/archlinux.plugin.zsh\E$ +^\Qplugins/cp/cp.plugin.zsh\E$ +^\Qplugins/extract/_extract\E$ +^\Qplugins/genpass/genpass.plugin.zsh\E$ +^\Qplugins/gitignore/gitignore.plugin.zsh\E$ +^\Qplugins/gnu-utils/gnu-utils.plugin.zsh\E$ +^\Qplugins/hitchhiker/fortunes/hitchhiker\E$ +^\Qplugins/jhbuild/jhbuild.plugin.zsh\E$ +^\Qplugins/jhbuild/README.md\E$ +^\Qplugins/jruby/jruby.plugin.zsh\E$ +^\Qplugins/kubectl/kubectl.plugin.zsh\E$ +^\Qplugins/lol/lol.plugin.zsh\E$ +^\Qplugins/mosh/mosh.plugin.zsh\E$ +^\Qplugins/npx/npx.plugin.zsh\E$ +^\Qplugins/powder/_powder\E$ +^\Qplugins/suse/suse.plugin.zsh\E$ +^\Qplugins/thor/_thor\E$ +^\Qplugins/universalarchive/_universalarchive\E$ +^\Qplugins/vagrant/vagrant.plugin.zsh\E$ +^\Qplugins/wp-cli/README.md\E$ +^\Qplugins/wp-cli/wp-cli.plugin.zsh\E$ +^\Qthemes/clean.zsh-theme\E$ +^\Qthemes/philips.zsh-theme\E$ +^\Qthemes/tonotdo.zsh-theme\E$ diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt new file mode 100644 index 000000000..65215c6c3 --- /dev/null +++ b/.github/actions/spelling/expect.txt @@ -0,0 +1,4492 @@ +AAAAC +aac +aar +abcdefghjkmnpqrstvwxyz +ABRT +absorbgitdirs +abspath +abtvfr +acceptorthreads +accessip +ACDIM +acking +ackmate +ackup +ACLs +acon +aconf +acp +acpi +acpitool +acr +acroread +acs +acsc +acss +acsp +actionformats +Adamantium +adb +adbd +adben +addgroups +addhistory +addon +addprincipals +addrport +addrs +addusergroups +addwin +adelcampo +adg +ADK +adminalias +adminport +Admins +adoc +adu +aeiouy +afh +afind +afmagic +afs +afu +agb +agc +agd +agentpath +agi +agignore +agli +aglu +agnoster +agp +agrimaldi +ags +agu +agud +agug +aguu +AHg +ainv +aip +Airbender +ajp +ajs +Akinori +akoenig +alacritty +albers +alberto +alertmanager +alex +alexandre +aliasfiletype +aliaspassword +allexport +alloc +allocstatus +allownoncomponentcallers +allpkgs +alnum +ALRM +altchar +Altoid +alwayz +amanda +amazonaws +amazonec +ambyj +amd +amqp +AMRD +anche +andi +andrewrdwyer +angularjs +anley +anlp +annots +anonymize +anotherfolder +ansible +antrun +anycommand +apexcodefile +apextests +api +apidocs +apiversion +apjanke +apk +apklib +aplaybook +appid +applica +applist +appname +apps +appup +aps +apull +arachnophobia +araxis +ARCHFLAGS +archimport +archlinux +arci +arcizan +ard +ardc +ardnu +ardnupc +ardp +ardpc +ARGC +args +argset +argslist +argu +argv +ARGZERO +arh +arinit +arl +arli +arpa +arquillian +artifactory +asadmin +asc +asciicast +asciidoc +asciidoctor +asciinema +asdeps +asdf +askpass +asm +asmo +asrc +assem +associatewiththread +ASTs +asyncreplication +atlassian +attr +ATTRIBUTENAME +aufs +auin +auinsd +auloc +auls +aulst +aumir +auown +auownloc +auownls +aur +aure +aurem +aurep +aurinsd +aurph +aurrep +authmethods +authorizationdb +authpriv +authrealmname +authz +autoapplyenabled +autoclean +autocomplete +autocompleted +autocompletion +AUTOCONNECT +autocrlf +autodetermine +autodie +autoenv +autohadboverride +autoipd +autojump +autoload +autolock +autolocking +autopep +AUTOQUIT +autoreload +autoreloading +autoremove +autorun +autoscale +autoscaling +autoselect +autoshortened +autosquash +autostart +autostash +autoupdate +auupd +auupg +availabilityenabled +avh +avi +AVIT +avivrosenberg +avneet +avz +avzu +aws +awscli +awslogs +babakks +backend +backendconfig +backtick +backupconfig +backupdir +backupfile +backuptheme +bactrian +baidu +bamshuf +bamtobed +bamtofastq +Barsi +Basecamp +basedir +basedn +basefile +baseurl +basevmdk +bashcompinit +bashdefault +bashrc +batchid +baz +bazel +bazelbuild +bbd +bbdiff +bbedit +BBM +bbpb +bcc +bcdfghjklmnpqrstvwxz +bck +bcn +bcubc +bcubo +beaglidx +becc +bedcov +BEDGRAPH +BEDPE +bedpetobam +bedtobam +bedtools +Belarus +bem +benchmarker +benchmem +benchtime +bento +benwilcock +berks +Bertinelli +bgnotify +bgrewriteeaof +bgsave +binarynights +bindaddress +binded +bindir +bindkey +binpack +binstub +bintray +bip +bira +bisd +bitboxer +bitbucket +bitswap +blkio +blockprofile +blockprofilerate +blod +blog +blogger +blogspot +blpop +bluebox +Bluetooth +bobwilliams +bodycc +Bonetti +bookmarked +booknames +bootclasspath +bootscript +bootsnipp +borland +borrowck +Boudreau +Boushh +Bouvet +BPtmux +bpython +bqr +brainstormr +Brainville +branchformat +branchname +branchrefs +brewp +brewsp +briancarper +bringz +Broadcom +Brodersen +brpop +brpoplpush +btannous +btih +btn +btrestart +btrfs +btw +bubc +bubu +buf +buffersizebytes +buflines +bugfix +bugfixes +bugreport +bugsnag +Buildfile +buildinstance +buildnumber +buildpackage +buildpacks +buildscript +builtins +bundlephobia +bunzip +Burkina +Busybox +bwaht +Bxegedabagacad +bypjyp +bytebuffertype +bytecode +bytewise +byznis +bzip +bzr +cabextract +CACERT +cacertfile +cacheinfo +cachename +caiifr +Cakefile +cakephp +callvim +calmd +calways +caname +caniuse +cano +capath +Capfile +capify +capistrano +capistranorb +capit +CARETCOLOR +caserta +Caskroom +catimg +catserver +catspeak +cbr +ccat +cccmd +ccflags +ccl +ccomp +ccp +cdargs +cdcmd +cdo +CDPATH +cdu +cdx +cdylib +cecho +cehlrtx +celerybeat +celeryev +celerymon +celeryproject +Celso +celsomiranda +certfile +certname +certs +cfa +cfap +cfbpk +cfbs +cfc +cfdel +cfdm +cfdor +cfds +cfe +cfev +cfg +cfgfile +cfhu +cfl +cflg +cflr +cfp +cfpc +cfpm +cfr +cfsc +cfsh +cfsp +cfsrt +cfsrtall +cfstg +cfstp +cfstpall +cft +cfup +cfus +cget +cgi +cgit +cgr +cgrm +cgroup +cgroupns +cgu +changelog +changepassword +changeset +charmap +charset +chaselinks +chcid +chdir +cheatsheet +checkin +checkinit +checkonly +checkports +checkstyle +cheeseshops +Chesal +chiark +childlogdir +chlrtx +chmod +chown +chpwd +chroot +chruby +chrubydirs +chsh +chucknorris +chucknorrisfacts +Chucktatorship +Chucktober +chunker +cidfile +cidr +CIDs +cidv +ciici +cim +cirw +citool +civis +cjk +clamav +classfile +classloaders +classloading +classmap +classname +classpath +CLDR +cleardump +cless +CLICOLOR +clientauthenabled +clientid +clipcmd +clipcopy +clippaste +Clipperton +clj +Clojure +closelim +cloudfoundry +cloudproviders +CLOUDSDK +clrz +clustertype +cmdargs +cmdline +cmds +Cmp +CMR +cms +cmt +cnorm +cobertura +cocoapods +codebase +codeclimate +codecompare +codecoverage +codegen +codepen +coderwall +CODESET +codium +coffeescript +colemak +Colindres +collectstatic +colorbool +colorcoded +colorcoding +colorify +colorized +colorls +colorpair +colorset +colorspec +colourised +Colouriser +colsearch +COMMANDLINE +commandlinefu +committerdate +Comoros +compadd +comparguments +compassdoc +compaudit +compbiome +compcall +compctl +compdef +compdescribe +compdump +compfiles +compfix +compgen +compgroups +compilemessages +compinit +compl +completemarks +completionsdir +complist +componentname +compopt +compquote +COMPREPLY +COMPRESSSPARSESTATE +compset +compstate +comptags +comptry +compvalues +CONDA +CONFG +config +configfile +confighelp +configmap +configstoretype +connectiondefinition +connectionpoolid +conssec +Consts +contacto +containerd +contenttype +contextinitialization +contextroot +contoroll +contreras +controlargs +conventionalcommits +COOKBOOKNAME +cookbookversion +coproc +copybuffer +copydir +copyfile +copypaste +copypasteable +cordova +coreutil +cors +cowsay +cowthink +cpan +cpanm +cpanminus +cpantesters +cpio +cpp +cprint +cprof +cpuprofile +cpuset +cpv +createcachetable +createdlastdays +createsuperuser +createtables +creationretryattempts +creationretryinterval +cription +crlf +crm +crockford +cron +cronjob +crt +cseuckr +cseucpkdfmtjapanese +csh +csibm +csiso +csisolatin +cskoi +csksc +css +cssflow +cssh +csshiftjis +csu +csv +csvfile +ctag +ctl +ctlseqs +ctx +ctype +culater +Cunha +curcontext +curdir +curhistsize +curkeyword +curpath +currentartist +currentdir +currenttrack +cursored +curtheme +Customisation +CUTBUFFER +cvccvc +cvf +cvhs +cvjf +cvs +cvsexportcommit +cvsimport +cvsserver +cvvis +cvzf +cwd +cword +cxx +cya +cycledleft +cycledright +cygpath +cygstart +cygwin +cygwyn +czf +daemonize +daemonized +daemonizing +daemonset +dalias +dango +danielcsgomes +darcs +dartdoc +dartlang +dashdoc +DATABAGNAME +datafieldenc +datasift +datasourceclassname +datastore +datestamp +datetime +daylerees +dbbolton +dbconsole +dbfile +dbhome +dbhost +dbport +dbshell +dbsize +dburl +dbus +dbuser +dbvendor +dbvendorname +dccmd +dcdn +dce +dck +dcl +dclf +dco +dcom +dcommit +dcps +dcpull +dcr +dcrestart +dcrm +dcstart +dcstop +dcup +dcupb +dcupd +ddg +ddl +deadwyler +debian +debman +debuginfo +debuglevel +decr +decrby +DECSCUSR +defaultleasettl +defaultpackagedir +Defaultsfdx +defaultvs +defaultwebmodule +definitionfile +definitionjson +deinit +deinstall +delwin +denable +deno +dependencyfile +deploydir +deployers +deploymentplan +deps +depthfrom +dequote +dequoted +deref +derek +descr +dest +DESTDIR +destroot +desttype +devcenter +devdocs +devfolder +devicehost +devicemapper +deviceport +devlog +devops +devpath +dfa +dffx +dflt +dfmt +dfs +dhcp +dhcpd +dhcpip +dht +dhtrc +dhtt +diagdump +didexit +diffcore +diffmerge +diffs +diffsettings +difftool +digitalocean +diiirrrty +dijcaf +dircolors +dircycle +direnv +dirhistory +dirname +dirpath +dirpersist +dirs +dirstack +DIRSTACKSIZE +dirstat +dirver +disablemasking +disksize +diskutil +displayconfiguration +displayname +distcache +distcheck +distclean +distro +dists +django +djangojs +djangoproject +djangopypi +djview +djvu +dli +dlist +dls +dman +dmatching +dmesg +dmg +dna +dnf +dnfc +dnfgi +dnfgl +dnfgr +dnfi +dnfl +dnfli +dnfmc +dnfp +dnfr +dnfu +dng +dnote +dns +dnsmasq +dnsrr +doap +docck +dockerd +dockerdaemon +dockerenv +Dockerfile +dockerport +dockersearch +docopt +docset +docstring +doctl +doctorjellyface +dogenpunk +doitclient +domaindir +domainname +domainproperties +domterm +Donenfeld +dongweiming +donotwant +dopts +dotall +dotenv +dotest +dotfile +dotnet +doubledash +doublequotes +dowant +dpkg +drca +drcb +drcg +drcj +drcm +drcml +drcr +drct +drcv +drdmp +dren +dreurmail +drf +drfi +drfr +drfra +drfu +Driessen +drif +dris +driverclassname +drn +drnew +droid +dropandcreatetables +dropindexes +droplr +dropreplace +droptables +drpm +drpu +drst +drup +drush +drushrc +drv +drvd +drvg +drw +dsa +dselect +dsl +dssh +dst +dsupport +Dtest +dtrace +dts +duckduckgo +duf +dumpconfig +dumpdata +dumpfiles +duplessis +durationdays +durrheimer +dutchcoders +dvd +dvi +dwim +dwr +dylib +eal +eastermonday +eauth +ebuild +ecd +ecdsa +echotc +echoti +ecma +ecmerge +ecosia +ecto +editorcmd +edu +eecms +eed +eeval +efforted +efile +eframe +egrep +ein +Eisentraut +ejb +ekzsh +Eley +ELGNRCIS +elidable +elif +elim +elisp +elllen +elot +emacs +emacsclient +emacsfun +emacswiki +emails +emberjs +Emelianenko +emoji +emotty +enablesnoop +enacs +endswith +ent +entrypoint +enum +envsubst +envvar +enwom +eocw +EOH +eol +eoq +eow +eoww +eoy +EPOCHREALTIME +epochseconds +eprof +eread +erl +errlog +Errored +esac +escripts +essembeh +etcd +ethanschoonover +ets +etwlogs +euc +EUID +EULAs +eunit +evals +evalstatus +evan +eventlet +eventname +Evernote +Evt +exe +executables +execv +exfxcxdxbxbxbxbxbxbxbx +exfxcxdxbxegedabagacad +existentials +exitcode +exoscale +expandvars +expaning +expireat +expl +explaintypes +explicitouter +expn +expr +exps +exs +extcmd +extdirs +extendedglob +externalid +extmethods +fabfile +facebook +factoryclass +faidx +failconnection +failfast +failurefatal +fakeroot +faqs +fargs +Faroe +fasd +FASTA +fastcgi +fastfile +fastprint +FASTQ +favlist +fbterm +fcap +Fcart +fcgi +Fcrt +fcss +fdfind +fdlimit +feditor +fedoraproject +felipe +felixr +ffls +ffp +ffrm +ffsync +fghijk +fgrep +Fiala +fieldlist +Filemode +filepath +filesize +filestore +filesystem +filetype +filevaultmaster +FILLBAR +filtername +findpeer +findprovs +finetune +firefox +firewalld +firewalls +firstline +fishshell +fitzpatrick +fixmate +fixme +fixperms +FIXTERM +fizsh +fjs +flagstat +flatlist +flattach +flc +fldoc +flget +flickr +flowgraph +flowtype +flr +fluentd +flup +flushall +flushdb +flv +fnd +fnm +fns +Fnv +Folgers +fontello +foodcritic +foqtam +forall +forceoverwrite +forceupgrade +foreach +forrest +fortunecity +forw +fosmid +fotqoh +fpath +fprof +fqn +framep +frecency +frecent +freebsd +freenode +freqs +fri +Friesel +fromaddress +frontend +frontmost +fsc +fscache +fsck +fsl +fsmonitor +FSsh +fstgpy +ftp +fts +fucnul +func +funcsourcetrace +functrace +funtoo +Futuna +futuret +fwl +fwp +fwr +fwrp +fzf +fzfdirs +gaa +gallifrey +gamc +Gamera +gamscp +gapt +gasconfig +Gatorade +gatsbyjs +gav +gba +gbd +gbda +gbk +gbl +gbnm +gbr +gbs +gbsb +gbsg +gbsr +gca +gcam +gcan +gcasm +gcb +gcc +gccd +gccgo +gccgoflags +gcf +gcflags +gch +gcl +gclean +gcloud +gcm +gcmsg +gcn +gco +gcor +gcount +gcp +gcpa +gcpc +gcplogs +gcr +gcs +gcsm +gcssm +gdc +gdca +gdct +gdcw +gdd +gdm +gdnolock +gdt +gdup +gdv +gdw +geca +gecb +gecho +geclup +gecr +geeknote +gegi +geh +gei +geiall +gelcyv +gelf +geli +gemb +gemfile +gemoji +gemp +gemset +gemspec +gemy +generatekey +generatermistubs +genomecov +genpass +genpaths +genzshcomp +geoe +geoff +geoffgarside +getattr +getbit +getcomposer +getdir +geteip +getenv +getfasta +getgb +getip +getline +getln +getopt +getrange +getset +gettext +geun +gevent +Geza +gezalore +gfa +gfg +gfl +gflf +gflff +gflfp +gflfpll +gflh +gflhf +gflhp +gfli +gflr +gflrf +gflrp +gfo +gga +ggf +ggfl +ggl +ggp +ggpnp +ggpull +ggpur +ggpush +ggsup +ggu +ghci +ghf +ghff +ghfh +ghfr +ghfu +ghh +ghostrevery +gignore +gignored +gimmeh +giobi +gistcomment +gitbranch +gitbranchsize +gitcomp +gitcompadd +gitcompappend +gitcompletion +gitdir +gitex +gitfast +gitflow +github +gitignore +gitinfo +gitk +gitmodules +gitpod +GITSS +gitstatus +gitstring +gitweb +givero +gke +gkrellmd +glfsi +glfsls +glfsmi +glfst +glg +glgg +glgga +glgm +glgp +glidenote +glo +globalias +globals +globbing +globsubst +glods +glog +gloga +glol +glola +glp +gls +gma +gmail +gmom +gmtl +gmtlvim +gmum +Gneat +Gniazdowski +gnore +gnupg +goc +godoc +Godzilla +gof +gofa +gofmt +goga +Gohr +golang +gom +GOMAXPROCS +Gomes +Gonz +goodreads +google +googlecode +gop +gopath +gopb +GOROOT +goroutine +gota +gpf +gpg +gpgconf +gplfs +GPLv +gpoat +gpr +gpristine +gpsup +gpu +gpus +gpv +gradle +gradlew +graphviz +grb +grba +grbc +grbd +grbi +grbm +grbo +grbom +grc +greenend +greer +grename +grep +grepping +grev +grh +grhh +GRIMALDI +grk +Grlm +grm +grmc +grml +grmv +groh +grok +Grosenbach +groupby +groupinstall +grouplist +groupremove +groupsmap +growlnotify +grrm +grset +grss +grst +grt +gru +gruntfile +grup +grv +gsb +gsd +gsemet +gsh +gsi +gsps +gsr +gss +gst +gsta +gstaa +gstall +gstc +gstd +gstl +gstp +gstu +gsu +gsub +gsw +gswc +gswd +gswm +gtb +gtfo +gtl +gts +gtv +gua +Guake +Guerci +gui +guidovansteen +guitool +gulpfile +gulpjs +gunignore +gunwip +gunzip +gupa +gupav +gupv +gvim +gvimdiff +gwc +gwch +gwip +gwt +Gxfxcxdxbxegedabagacad +gxvx +gyazo +Gyver +gzip +Hackage +Hacktoberfest +hackzor +hacluster +hadouken +hai +haldaemon +Halis +Hamelink +hammertest +hanami +hanamirb +har +hardcoded +hardlinks +hardstatus +harishnarayanan +hashh +Hashicorp +haskell +haskellstack +Hasklig +hawaga +hax +HBAR +hbm +Hcode +hda +hdc +hdd +hdel +hdp +hdrs +hdtp +hdv +hea +healthcheck +healthcheckerinterval +healthcheckertimeout +healthcheckerurl +heduled +heg +Helens +helpmojo +heroku +hexdocs +hexdump +hexists +hga +hgb +hgba +hgbk +hgc +hgca +hgchangeset +hgco +hgd +hged +hget +hgetall +hgi +hgic +hgl +hglg +hglgp +hglr +hgm +hgo +hgoc +hgp +hgrc +hgrep +hgs +hgsl +hgun +hhatto +hhh +hidefiles +highlighter +hincrby +HISTCMD +HISTFILE +HISTNO +historywords +histsize +histsubstrsrch +hitokoto +hkeys +hkscs +hlen +hmget +hmset +Hocevar +hocho +hoeg +Homeboy +homepage +hostip +hostname +hostpath +hotfix +hotfixes +hotlist +hotpink +howto +howtorun +hpodder +href +hrg +hscolour +hscroll +hset +hsetnx +hsi +hsp +hsqldb +htm +html +htmlsingle +htop +htslib +HTT +http +httpd +httpie +httplisteners +httpparams +httpsrouting +httpstatus +hubflow +hukkan +humza +huyy +hvals +hyperlink +hypermedia +hyperv +hypervisor +iam +ian +ianchesal +ibest +icanhas +icanhazip +icba +icbi +icc +icode +icpaa +icpai +icpra +icpri +icra +icri +icrosoft +icrsa +icrsi +idlekeytimeoutseconds +idletimeout +idmv +idx +idxstats +ietf +ifargs +ifconfig +iflist +iglob +ignoredescriptoritem +ignoreerrors +ignorenonexistent +ignorewarnings +igv +ihasbucket +iiop +iiopport +ilikenwf +ilkka +ima +imageshack +imap +imatch +imatches +img +imgur +iminurbase +imnp +imonit +impl +implicits +importpath +inbox +incrby +indexopts +inet +infocmp +ini +initsql +inkytonik +inl +inliner +inlining +inplace +inprogress +Inproper +inputenc +inr +insecureskipverify +insns +inspectdb +inspr +instagram +Installable +installationkey +installationkeybypass +installdeps +installdir +installsuffix +instancealias +instanceport +instanceurl +instaweb +instrs +integ +Intellij +interactivecomments +interdiff +interfacename +interoperability +interp +Intf +inur +invicem +iojs +iokit +ionescu +ionicframework +iops +ioreg +ipa +ipaddr +ipam +ipamdriver +ipapp +ipc +ipcidr +ipe +ipfs +ipld +ipns +IPREFIX +ipsw +iptables +ipv +ipython +irb +irc +IRTY +isconnectvalidatereq +isdefaultprovider +isdeleted +isearch +isfile +isisolationguaranteed +isodate +isodatesec +isolationlevel +isredeploy +istio +ISUFFIX +isundeploy +iterm +itertools +itunes +ivan +Ivoire +ixfuk +izakaya +ize +jacc +jaccard +jaddr +jaischeema +jakefile +jakejs +Janke +japvyz +jarfile +JARIN +jarsigner +javabootclasspath +javac +javadoc +javaextdirs +javamail +javap +javascript +javax +jbm +jboss +jcon +jdbc +jdc +jdcds +jde +jdeps +JDK +jdkinternals +jdl +jdlr +jdm +jdmds +jdwp +jeb +jecdyq +ject +Jedis +jeffmhubbard +jenv +jenvdir +jepgad +jerryling +jestjs +jex +jexec +jfrog +jgitflow +jgpagent +jid +jimhester +jimweirich +jira +jis +jisse +jkc +jkenabled +JLine +jlist +jmc +jmsdbpassword +jmsdest +jmx +jndi +jndilookupname +jnrowe +jobid +jobspec +jobstates +jobtexts +jof +johnhamelink +joly +jonas +jonmosco +jorge +journald +jpeg +jpg +jpo +jprofile +jql +jquery +jra +jraw +jrel +jreld +jrm +jrmds +jrmrel +jrmsas +jrp +jrs +jrspec +jruby +jsa +jsh +jshc +jshm +json +jsonfunc +jsonpath +jsontool +jsp +jspa +jssl +jst +jstj +jsu +jsw +jukie +junegunn +junex +junit +junkbust +JUNKFOOD +Juraj +jvenant +jvm +jvmargs +jvmoptions +jwt +jwtkeyfile +jxr +kajrod +kalsi +kapeli +kapow +kate +Kaving +kbd +kca +kcbt +kccc +kcdc +kcgc +kclean +kcn +kcp +kcsc +kcub +kcuc +kcud +kcuf +kcuu +kdch +kdcj +kdcm +kdd +kde +kdel +kdelcj +kdelcm +kdeld +kdelf +kdeli +kdelno +kdelns +kdelp +kdelpvc +kdelsa +kdelsec +kdelss +kdi +kdialog +kdiff +kdm +kdno +kdns +kdp +kdpvc +kds +kdsa +kdsec +Keanu +kecj +kecm +keds +keepfailedstubs +keepreposdir +keepstate +kei +kepvc +kerndeb +kes +keti +kevinkirkup +kexec +kextload +kextunload +keybindings +keycap +keychain +keyfile +keygen +keymap +keymetrics +keypair +keyring +keyshares +keysize +keyspace +keythreshold +KEYTIMEOUT +keytooloptions +keywordisfresh +keywordmsg +keywordquickly +kga +kgaa +kgcj +kgcm +kgd +kgdsw +kgdw +kgdwide +kgi +kgno +kgns +kgp +kgpl +kgpn +kgpvc +kgpvcw +kgpw +kgpwide +kgrs +kgs +kgsec +kgssw +kgsswide +kgsw +kgswide +Khas +khome +killall +killit +Kindergarteners +Kitts +kiwiirc +kiwish +kjx +klf +Klingberg +knative +kni +knifecmd +knifesubcmd +knp +knu +koenig +Kombat +kompare +konsole +kotlin +kotlintest +kpf +kphoen +kpkg +kpp +kres +krh +Krivitsky +krsd +krsss +kru +ksc +ksd +ksh +ksharrays +kshautoload +kshglob +kshoptionprint +ksshaskpass +ksss +kthxbai +kts +kube +kubeconfig +kubectl +kubectx +kubens +kubeoff +kubeon +kubernetes +kungfoo +Kurapati +kwargs +kypkvcw +Kyrgyzstan +Lacheze +lambdalift +lando +langinfo +laravel +lart +lastcategory +lastcmd +lastfull +lastrun +lastsave +launchctl +lazyconnectionassociation +lazyconnectionenlistment +lazyvals +lbenableallapplications +lbenableallinstances +lbenabled +lblue +lbname +lbpolicy +lbpolicymodule +lbtargets +lbuf +LBUFFER +lbweight +lcmd +ldap +ldflags +ldot +leakreclaim +leaktimeout +leavebrowseropen +lein +leiningen +lemy +len +Lengyel +leonhartx +LESSCLOSE +lesskey +LESSKEYIN +LESSOPEN +letcat +leter +lexduv +lexer +lfs +lho +lhs +libc +libedit +libexec +libnotify +libp +libreadline +libsecret +lifecycle +lighthouseapp +limegreen +lindex +linearizer +linewords +linkcheck +linkname +linsert +linux +linuxcommando +linuxcontainers +linuxmain +liquibase +listeneraddress +listenerport +livecheck +liveserver +llc +LLCORNER +llen +llr +llvm +lmnop +lname +loadconfig +loaddata +loadorder +localhost +localonly +localoptions +localtime +localtraps +lockdown +lockfile +lodash +logcat +logdriver +logentries +logfile +logid +loginurl +loglevel +logname +logreportederrors +logrotate +logtype +lol +lowerip +lpop +lpr +lpush +lpushx +lrange +lrbu +LRCORNER +lrem +lrh +lrp +lrt +lrunzip +lrz +lrzip +lrzuntar +lsa +lsb +lscolors +lset +lsof +lstheme +lstrip +lto +ltrim +lubs +lucentbeing +lvi +lways +lwc +lwd +lxc +lxd +lzcat +lzip +lzma +lzo +lzop +LZW +Maarten +macos +macports +macromates +Maeda +Magento +magerun +magicequalsubst +magick +mailhost +mailinfo +mailmap +mailnull +mailrc +mailsplit +mailuser +mainporcelain +maintail +maintainership +makecache +MAKEFLAGS +makemessages +makemigrations +makewindows +managedreleased +managepy +manni +manpage +manpath +mapcar +mapfile +mappedpassword +mappedusername +markname +markpath +maskfasta +maskray +masq +massimiliano +matchconnections +mathfunc +Mattern +Matth +matthewratzloff +matthr +maxbytes +maxchildren +maxconnectionscount +maxconnectionusagecount +maxdepth +maxleasettl +maxpoolsize +maxqueuesize +maxrank +maxrate +maxrequests +maxspare +maxtasksperchild +maxthreadpoolsize +maxwait +Mayen +Mayra +mbean +mbegin +mbologna +mbox +mboxrd +mbp +mca +mcl +mcm +mco +mcornella +mct +mdapi +mdb +mde +mdi +mdn +mds +meanlife +mediawiki +megazord +meh +Mek +mekanics +memprofile +memprofilerate +memq +menuselect +MENUSIZE +mergetool +mergewebxml +merkledag +Mery +messagebus +messagestoretype +metacpan +metadata +metricscollector +mfa +mfaerevaag +mfs +mget +miam +michelebologna +microk +microsoft +middleware +midsommar +midsommarafton +mikeh +millis +mindepth +minfds +minidisc +minikube +minlogprob +minprocs +minspare +minthreadpoolsize +mirko +mirrorlist +mixin +mkcd +mkdir +mkdirs +mktag +mktemp +mktree +mkv +mkvirtualenv +mla +mldonkey +Mleb +MLH +mli +mlo +mlog +mlp +mls +mlterm +MMA +mmap +mmin +mng +mnt +moar +modded +modifiedlastdays +modulename +Moldova +mongocli +mongodb +monit +monitorable +monokai +Morote +Mosco +mosh +mostfrequent +MOTD +mountpoint +mov +moyai +mozilla +mpa +mpeg +mpileup +mpkg +mplayer +mplex +mpr +mputniorz +mqhost +mqpassword +mqport +mquser +mre +mrp +mset +msetnx +msgnum +msgs +msh +msil +msp +mst +msvs +msw +msys +msysgit +mtime +mtu +Mudkipz +multiaddresses +multibase +multicastaddress +multicastport +multicov +multihashes +multiinter +multiline +multios +multiset +mumpub +munication +MURI +muscato +mutex +muxer +mvim +mvn +mvnag +mvnboot +mvnc +mvncd +mvnce +mvnci +mvncie +mvncini +mvncist +mvncisto +mvncom +mvncp +mvnct +mvncv +mvncvst +mvnd +mvndocs +mvndt +mvne +mvnfmt +mvnjetty +mvnp +mvnqdev +mvnsrc +mvnt +mvntc +mvnw +Mvt +Myanmar +myapp +myargs +myd +mydeb +myers +myfile +myfirstnamemylastname +mygit +myissues +mymark +myns +myprop +mypy +myrole +myserver +mysql +mysqladmin +mysqlrestart +mysqlstart +mysqlstatus +mysqlstop +mytime +myuser +myvalue +myvirtualenv +myzsh +nables +nagios +naliases +nameddirs +namespace +namesys +nanoant +nanoc +Narayanan +Naruto +nativelibrarypath +ncd +ncipe +NCOLOR +ncpu +ncs +ncv +ndjson +NDUw +NEm +nenv +neovim +netbsd +netdump +netloc +netmask +netstat +networkdriver +networklisteners +neuralsandwich +newcons +newpl +newvol +nextgenthemes +nfsnobody +nfunctions +nginx +ngnix +ngth +nhelp +nhistory +nhughes +nicoulaj +Nicoulaud +nixos +nkeywords +nkill +nle +nlinux +nlist +nmap +nmatches +Nmh +Nms +Nmw +noacl +noancestors +noargs +noautonamedirs +noautopushd +noblock +nobootcp +nobreak +nocache +nochunk +nocleanup +nocolor +nocopy +nocorrect +nodaemon +nodedir +nodefaultpolicy +nodegroup +nodehost +nodeid +nodejs +nodense +nodestatus +noexec +noexpand +noglob +noheading +nohelpers +nohup +noinput +nojline +noksh +nomadproject +nomnom +nomz +nonamespace +nondistributable +nongnu +NONINFRINGEMENT +nonomatch +NONSELECTABLE +nontransactionalconnections +nopassword +noposixbuiltins +noprofile +noprompt +nopromptsubst +noptions +nopushdminus +norc +noreload +NORMARG +NORRIS +noshortloops +noshwordsplit +nospace +nosplash +nostatic +nostatus +nostream +notactive +notailcalls +notest +nothreading +notifu +notnull +nounit +noverbose +nowai +nowarn +noword +noyes +NPAGE +npanelize +npm +npmd +npmg +npmi +npmjs +npmrc +npmst +npmt +npr +nproc +npu +npx +nroff +nscd +nsu +nthemes +ntlp +ntp +ntu +nubxa +nuc +nuget +numstat +nvcsformats +nvie +nvimdiff +nvm +nvmrc +Oakv +oanward +oathtool +OAuth +objectname +objectsize +objecttype +obsrun +obtw +octocat +octozen +oden +ofd +ogg +ogm +ohmyz +ohmyzsh +oid +oldp +oldpatmat +OLDPWD +OMITSPARSESTATE +OMMIT +omz +omztemp +onbehalfof +oneline +onlyrepos +onoz +ooanward +oom +openbsd +opendiff +openr +openshift +opensource +openssh +openstack +opensuse +openvpn +openw +OPTARG +optimisations +OPTIND +orderby +orgdir +orgs +oris +ority +orm +ornicar +orss +osascript +osname +osscan +ostype +osver +osx +oth +otp +otpcode +Ouellet +oug +outfh +outfile +outfilebase +outfilename +outlog +outputdir +outputtedto +Outputters +pacac +pacaur +pacdisowned +pacfiles +pacfileupg +pacin +pacinsd +packagecreaterequestid +packageid +packagekitd +packagename +packageobjects +packagephobia +packagetype +packageversionid +paclist +pacloc +pacls +paclsorphans +pacman +pacmanallkeys +pacmansignkeys +pacmir +pacoc +pacown +pacre +pacrem +pacrep +pacrmorphans +pacupd +pacupg +pacweb +pagage +pagename +painsd +pairtobed +pairtopair +paloc +palst +pamc +pame +pamf +pamfa +pamir +pamj +paml +pamm +pamn +pamp +pampp +pamr +pamt +panelize +paorph +paperclips +paqf +paqft +paql +paqr +paqt +paqw +paralint +params +parem +parep +PARGON +parhaat +paroc +parseable +parseopt +parwok +passivepopup +passphrase +passthrough +passthru +passwd +passwordstore +pastebin +pasu +patchformat +pathspec +patmat +patshead +paupd +paupg +pausedservices +pavic +paypal +paypalobjects +pbcopy +pbi +pbl +pbo +pbpaste +pbs +pbu +pcap +pch +pchk +pcl +pcmode +pcpu +PCR +pcre +pdf +PDoc +peb +peepcode +peerid +pem +percol +perflog +perl +perlbrew +perldoc +permset +permsetname +petere +peterhoeg +Pfenniger +pfs +pgp +pgpkeys +pgr +pgrep +pgs +phab +phing +phome +php +phx +pid +pidev +pidfile +pidof +pigz +pipenv +pipestatus +pipfile +pipir +piplist +pipreq +pipunall +pipupall +Pitcairn +pjdb +pjo +PKGBUILD +pkgfile +plaetinck +planetargon +playlists +playpause +ple +pleted +plist +Plug'n +plugin +pluginsdir +plz +pmat +pmd +pmin +pmset +png +pnp +podfile +podspec +policyconfigfactoryclass +policyproviderclass +polipo +polkitd +poo +poolname +poolresize +Poorter +popd +Popen +porcheron +portbase +portdir +Portfile +portlist +portname +posix +possen +posteo +posterasure +postgres +postinstallurl +posva +powd +powed +Powerline +poweroff +powershell +powify +powit +PPAGE +ppap +ppid +ppy +precache +precaire +precmd +precompilejsp +precompilewait +predef +preexec +prefetching +prefiltered +prefork +preload +premajor +preminor +prepatch +prepends +prepopulate +prettylist +previewer +prevword +pri +princ +principalsmap +printenv +printf +printflags +printprompt +privhist +privoxy +procfs +procs +prodlog +progfile +projectname +PROMPTCOLOR +PROMPTPREFIX +promptsize +promptsubst +promptvars +propget +proplist +protobuf +providertype +prun +pscpu +pseudoword +psgrep +psh +psmem +psprint +pstadler +pstree +psu +psubscribe +psy +psykorebase +pthree +ptot +ptree +pubgrub +publishwait +pubsub +puni +punsubscribe +puo +pushd +pushdefault +pushdf +pushdignoredups +pushdminus +pushdsilent +pushln +pushremote +pushurl +Putniorz +pvc +pvenv +pvm +pwd +PWDCASECORRECT +PWDLEN +pwdsize +pwdx +pwgen +pwh +pwned +pxd +pxy +pybundles +pyc +pycache +pyclean +pyenv +pyenvdirs +pyfind +pygmentize +pygments +pygrep +pylint +pypa +pypi +pytb +pytest +pythonhosted +pythonpath +pythonrc +PYTHONSTARTUP +PYTHONUSERBASE +pyuserpaths +Qdt +qiqmiq +qkey +qlmanage +qpwd +Qql +Qqo +qqq +qqwtzgejwgqve +Qtdq +quarkus +quicklisp +quickstart +quiltimport +qunit +qunitjs +quotationspage +quotedir +quu +quux +qwant +qwerty +qxtm +qyjti +rabin +rackspace +rackup +radvd +raek +Rakefile +raname +randomkey +rangepos +rar +ratijas +rawurldecode +rawurlencode +rbenv +rbenvdirs +rbfu +RBUFFER +rcfile +Rchive +rcs +rdargument +rdb +rdc +rdd +rdependents +rdeps +rdm +rdmd +rdmr +rdmtc +rdmu +rdoc +rdp +rdr +rds +rdsl +rdtc +rdtp +reactjs +readline +readlink +readme +readonly +readthedocs +readtimeoutmillis +Reagle +realcmd +reauthor +rebased +rebases +rebasing +receivepack +reddit +redirectport +redis +rediscli +redistrubute +redzone +reencode +reexec +refactor +refchecks +reflogs +refmap +refname +refspec +regex +regexes +regexn +regexp +reheader +reintializes +Reitsma +rej +reldates +reldist +releasenotesurl +releaseversion +relid +reloadinterval +reloadpost +reltool +remco +remoteonly +remotetestdir +removegroups +removeprincipals +removeusergroups +renamenx +rephorm +replacetokens +repow +reprovider +requestauthrecipient +requestauthsource +requestid +rerere +resetstat +resolv +resolvemsg +responseauthrecipient +responseauthsource +responsetimeout +restartpost +restype +resultformat +retcode +retlog +retrievefile +retrievetargetdir +returncode +RETVAL +revdeps +revlist +rfa +rfakeroot +rfap +rfbu +rfc +RFh +rfind +rgm +rhash +rinass +rinf +ripgrep +riseup +RIXIUS +rlc +Rli +rlib +Rlvi +rmacs +rmcup +rmd +rmdir +rmdsstore +rmdup +rmi +rmkx +rnand +rnatv +rnaw +rnios +rniosse +rniosx +rniosxr +rniosxsm +rnipad +rnipada +rnipadm +rnipadp +rnipadr +rnland +rnlink +rnlios +rns +robby +robbyrussell +ROLENAME +rollbackonerror +rootdir +rosrc +roswell +ROSWELLPATH +roundhoused +routecookie +rpath +rpc +rpcuser +rpmpackage +rpms +rpo +rpop +rpoplpush +rprompt +rpush +rpushx +rra +rrg +rsa +rsb +rsd +rset +rsh +rsp +rspec +rsrra +rst +rsto +rstrip +rsync +rtfm +rtkit +rtorrent +rts +rubocop +rubygems +rubyonrails +rubyprompt +rubypromptsize +rubyversion +Rudkin +rulz +runfcgi +runningservers +runningservices +runpy +runserver +runtests +runtfile +runtimes +RUNZSH +Ruslan +ruslanspivak +rustc +rustup +Rvi +rvm +rvmprompt +rvmpromptsize +rxvt +saas +sadd +salesforce +samtools +sandboxed +SAVEHIST +savelogin +savemasterpassword +sba +sbc +sbcc +sbcln +sbco +sbcp +sbcq +sbd +sbdc +sbdi +sbgi +sbin +sbp +sbpl +sbr +sbrake +sbrm +sbt +sbu +sbx +scalac +scaladoc +scalatest +scaleway +scandeps +scard +scd +scdalias +scdaliases +scdhistory +scdignore +scgi +sched +scheduledrundatetime +Schlatow +scm +scmpublish +scorpius +scottkidder +scp +screencast +screenshot +SCTP +scu +scutil +scw +scwsearch +sdiff +sdiffstore +sdist +sdk +sdkman +Sdl +sdurrheimer +Seagal +searchterm +seccomp +securityenabled +securitymap +securitytype +segfault +selectables +selectionkeyhandler +selectiveanf +selectivecps +selectorpolltimeoutmillis +selfupdate +selinux +semver +sendemail +sendperiod +serialfile +serialno +serverlist +servername +serverurl +serviceproperties +serviceuser +servlet +setab +setaf +setalias +setapp +setbit +setdefaultdevhubusername +setdefaulttimeout +setdefaultusername +setenv +setex +setnx +setopt +setprompt +setrange +sfcl +sfcontainer +sfcw +sfdc +sfdev +sfdx +sfdxcli +sfdxurl +sfdxurlfile +sfffe +sfgb +sfgc +sfgcom +sfge +sfn +sfprod +sfroute +SFSB +sfsr +sfsu +sftp +sfx +sgem +sgr +sgrep +sgtatham +shasum +sheerun +shellcheck +shellinit +shellperson +SHELLPROXY +shitload +SHLVL +shm +Shohei +shopt +shortlist +shortlog +shortname +shortstat +SHOWCOLORHINTS +showcurrentpatch +showdeprecated +SHOWDIRTYSTATE +showfiles +showformat +showmigrations +showpkg +SHOWSTASHSTATE +showsubclasses +SHOWUNTRACKEDFILES +showupstream +shpotify +shuf +shunit +Shyamshankar +sid +sidekiq +sideload +SIGINT +SIGKILL +sigs +SIMBL +Sindre +sindresorhus +singlechar +singlepackage +Sint +sinterstore +sirech +sismember +sitecookbooks +sitesearch +sjis +skintone +skiptraceflag +skitch +slaveof +slicehost +sln +slogin +slp +smacs +smartlist +smartsync +smcup +smembers +smerge +smkx +Smood +smove +smt +smtp +Smurf +snapshotname +snowboarder +sobject +sobjectid +sobjecttreefiles +sobjecttype +sobjecttypecategory +socio +socw +softlayer +solaris +som +soq +soql +Sorhus +sorin +sortconip +sortcons +sortnr +sortr +sourceapiversion +sourced +sourcedir +sourcefile +sourceforge +sourceorg +sourcepath +sourcetype +sourcing +soww +soyc +spacewander +spam +spd +spearce +speartail +spf +spi +Spivak +splitbrain +splitlines +splunk +spock +spop +spork +spotify +springframework +sprintf +sprunge +spu +spx +sql +sqlall +sqlc +sqlclear +sqlcustom +sqldropindexes +sqlflush +sqlindexes +sqlinitialdata +sqlq +sqlsan +sqlsequencereset +sqltracelisteners +squashmigrations +srake +srandmember +src +srem +ssh +sshd +sshkey +sshkeyfile +sshkeypassphrase +sshpassword +sshport +sshpublickeyfile +sshuser +ssl +sslproxyhost +sslproxyport +ssm +sso +sst +sstat +stackoverflow +stacktrace +stagedstr +standalone +standaloneonly +startapp +startpage +startpost +startproject +startswith +startus +statd +statedb +statefile +statefulset +statelist +statementcachesize +statementleakreclaim +statementleaktimeout +statementtimeout +STATESEPARATOR +staticlib +statuspost +stderr +stdin +stdio +stdlayout +stdlib +stdout +steadypoolsize +stedolan +steeef +sterr +stevelosh +stgit +stil +STITLE +stn +stoppedservers +stoppedservices +stoppost +stopwait +storeprotocol +storeprotocolclass +stp +strfile +strftime +stringification +stringified +stringify +stripspace +strlen +strverscmp +Strzelecki +sts +stt +stty +stu +stylesheets +subcmds +subdigital +subdir +subdomain +subfolder +Subhaditya +subl +sublimemerge +sublimetext +subm +subnut +subpage +subpath +subscriberfile +subscriberorg +subservices +subshells +subspec +substr +subsubcmds +Subsubcommands +Subsubsubcommands +sudo +sudoedit +suitenames +sunaku +sunion +sunionstore +supad +superaccessors +supervisorctl +supervisord +suppresscc +suprl +suprm +suprr +suprs +supso +supsr +supu +Suraj +surryhill +suse +svcat +svg +svm +svn +svnsync +svntrunk +swiftc +swiftpm +sxa +sxc +sxd +sxf +sxfn +sxm +sxn +sxp +sxu +sxw +sxy +sykora +symfony +symkinds +symlink +Symlinking +symref +syms +syncdb +SYNOPSYS +syns +syohex +sys +sysadmins +sysctl +syslog +sysread +sysroot +systemadmin +systemctl +systemd +systeminfo +systemproperties +Syu +Syua +Syy +Tabone +tagname +tailcalls +Tajikistan +takedir +takegit +takeurl +tanabata +tarball +tarfile +targetcut +targetdevhubusername +targetprotocol +targetted +targetusername +Tasche +Tascii +taskwarrior +Tassilo +tatooine +tavric +tbz +tcl +tcp +tcpdump +tcpip +tcpnodelay +tcsh +tdiff +tdiffstr +tempdir +tempfile +tempfilename +TEMPLATENAME +terday +termcap +termcolor +Termfile +terminalapp +terminfo +terminitor +termsupport +termux +TERMWIDTH +terraform +terremark +testflag +testfunc +testlevel +testlog +testname +testng +testrb +testrunid +testrunner +testserver +textastic +textasticapp +textconv +textfile +textmate +tformat +tfstate +tftp +tfvars +tgz +thedir +thefuck +themeisfresh +thememsg +there're +thibault +thisfcn +Thoumie +threadpool +threadpoolid +thu +tif +timeoutmsec +timeremaining +timetolive +timewait +timothybasanov +tion +titlebar +tjkirch +tkachenko +tkdiff +tkss +tksv +tldr +Tlp +tls +tlscacert +tlscert +tlsciphers +tlsenabled +tlskey +tlsrollbackenabled +tlsverify +tlz +tmp +tmpdir +tmpfile +tmpfs +tmux +tmuxinator +tne +tnn +tobed +todo +Tokenise +tokenized +tolower +tomee +tonotdo +toolchain +toolcp +toplevel +Toponce +torrez +torromeo +tortoisemerge +totp +totpkey +Touron +tput +traceroute +trackball +transactionlogdir +transactionsupport +transferencoding +transprotocol +transprotocolclass +trapd +trconf +triggerevents +triggername +trins +trinsd +trizen +trloc +trlst +trmir +Troiae +Trojanowski +trorph +trre +trrem +trrep +trsu +trunc +trupd +trupg +tsdh +tsl +ttl +ttr +ttyctl +ttys +tview +twohead +txl +txn +txo +txs +txz +tycho +typechecking +typescriptlang +typesetsilent +typespec +typoes +tzst +uapprox +uberjar +Ubfksu +ubuntu +udp +uescape +UFE +ufw +uid +ukpog +ULCORNER +ulimit +Ullrich +ultiple +umask +umd +umich +unace +unalias +uname +unarchive +Uncomment +uncommit +uncompress +uncurry +undelete +undeploy +unedit +unescape +unexport +unexpose +unfunction +unhash +unheap +unhost +unicode +unidiff +unindex +uninst +uninstall +uninstalling +unionbedg +uniq +uniqid +uniquetablenames +unittest +universalarchive +unixfs +unixstamp +unlimit +unlzma +unmark +unmatch +unmonitor +unmute +unpause +unrar +unreachability +unsetopt +unshallow +unshare +unstagedstr +unstartup +unsubscribe +untag +unversioned +unwatch +unwip +unxz +unzstd +updatedb +updateonsave +updatestartuptty +upgr +upgradable +upgradetype +uploadpack +upperip +upsert +urandom +URCORNER +uri +url +urldecode +urlencode +urllib +urlmatch +urlonly +urlparse +urlstring +urltools +urxvt +usb +usbmux +usejavacp +uselimit +usemasterpassword +usergroups +userguide +userland +username +userns +userpass +userpassword +usetoolingapi +usetty +usr +utc +utf +utils +utm +uucp +UUID +Vagrantfile +vagrantup +valentinbud +validateatmostonceperiod +validateddeployrequestid +validateschema +validationclassname +validationmethod +validationtable +Valodim +vals +varargs +vared +varkey +varname +vaultproject +vba +vbl +vbm +vbo +vbox +vbqs +vbr +vbu +vcf +vcmp +vcs +vcsa +vdf +vectorize +Venant +vendored +venv +Verhoef +Verma +VERSINFO +versioncomp +versiondescription +versioned +versioning +versionname +versionnumber +versiontagprefix +verstr +vfs +vgi +vgrepping +vgs +vguerci +vhost +vhsp +vicmd +viewtopic +viins +vimdiff +vimgrep +vimrc +violenz +viopp +virtenv +virtualbox +virtualenv +virtualenvwrapper +virtualizing +virtualservers +virumque +visitpage +visualforce +visualstudio +VMDK +VMs +vmwarefusion +vmwarevcloudair +vmwarevsphere +vnc +vncviewer +vnd +voggom +Voldemort +volumedriver +vonnegut +Vop +vopts +vpaivatorres +vpc +vpli +vpll +vplu +vplun +vpr +vrdp +vre +vrp +vsc +vsca +vscd +vscde +vscg +vscie +vscl +vscn +vscode +vscodium +vscr +vscu +vscue +vscv +vscw +vsh +vsix +vsp +vsplit +vssh +vsshc +vssp +vst +VTE +vterm +Vue +vuejs +vulns +vulscan +vundle +vup +vvsp +vvv +vwxyz +vydpig +waittime +wakeonlan +walle +wantlist +warpdir +warprc +wav +wclip +wcomp +Webchat +weblog +webm +webrick +webscr +webserver +website +webtraffic +Wegner +Weiming +Weirich +Wez +wfilter +wget +whatchanged +whatisthor +whatthecommit +whatwg +whitespacelist +whl +whoami +wiki +wikipedia +wil +willmendesneto +wincmd +windowid +windowsdomain +windowspassword +windowsuser +wip +wjst +wks +wlne +wolframalpha +womens +wordbits +WORDBREAKS +WORDCHARS +wordlist +wordpress +workaround +workdir +workflow +workon +workpass +workqueues +workspaces +worktree +would've +wrapjdbcobjects +writetimeoutmillis +WSL +wslpath +wtf +wtfpl +www +wwwrun +Wzf +xargs +xcb +xcconfig +xcdd +xchm +xclick +xclip +xcode +xcodebuild +xcodeproj +xcp +xcsel +xcselv +xcworkspace +XDCHDSBDSDG +xdg +xdvi +xfn +xfree +xfs +xit +XIVIEWER +xjnmahqewy +xkcd +Xkten +XLBUFFER +xlbuflines +xml +xnode +xontab +xor +Xout +xperl +xphp +xpi +xpm +xpowered +xprop +xpython +XRBUFFER +xrbuflines +xruby +xsel +xshell +xstrat +xterm +XTRACE +xudmec +xunit +xvf +xvjf +xxd +xxdiff +Xxjn +xzcat +yaconf +yain +yainsd +yaloc +yalst +yamir +yaml +yandex +yandsearch +Yanovich +yaorph +yarem +yarep +yarnpkg +yarnrc +yasu +yaupd +yaupg +ybalrid +ycc +yesorno +yga +ygi +ygl +ygr +ygrm +ygu +yii +yiic +yiiframework +yireo +yleo +ylep +yli +yln +ylnf +yls +ymc +yml +yolo +Yonchu +YOSHIDA +yout +youtube +yrl +yrm +yrun +yst +ytc +yuc +yui +yuil +yuyuchu +yws +yyy +yzf +zadd +zake +zal +zall +zas +zbell +ZCA +zcard +zcl +zcompcache +zcompdump +zcompile +Zconvey +zcount +zcu +zcurses +zdbc +zdbcm +zdbm +zdbmigrate +zdbr +zdbreset +ZDgw +zdharma +zdirs +zdotdir +zdup +zenerate +zenmap +zerver +zfs +zgen +zgrep +zhimingwang +zhse +zic +zif +zin +zincrby +zinit +zinr +zinterstore +zipalign +zipfile +zkat +zle +zleparameter +zlicenses +zll +zlogin +zlogout +zlp +zlr +zls +zlu +zma +zmodload +zmr +zms +znr +znt +zocmez +zonsole +zoxide +zpa +zparseopts +zpatch +zpattern +zpch +zpchk +zpd +zplg +zplug +zplugin +zproduct +zprofile +zps +zpt +zrake +zrange +zrangebyscore +zrank +zref +zregexparse +zrem +zremrangebyrank +zremrangebyscore +zrevrange +zrevrangebyscore +zrevrank +zrl +zrm +zrn +zrr +zrs +zscore +zse +zsh'ed +zsh +zshaddhistory +zshcmd +zshcommands +zshcompfunc +zshconfig +zshell +zshenv +zshexpn +zshids +zshrc +zshtheme +zshwiki +zshzle +zsi +zsocket +Zsolt +zsource +zspec +zsr +zsrc +zst +Zstandard +zstat +zstd +zstdcat +zstyle +zsw +ztart +ztos +zucumber +zunctional +zunionstore +zunits +zunner +zup +zutil +zvcmp +zve +zweep +zwip +ZWJ +zwp +zxvf +zyg +zypper +zzz diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt new file mode 100644 index 000000000..93dfa201c --- /dev/null +++ b/.github/actions/spelling/patterns.txt @@ -0,0 +1,73 @@ +# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns + +# YouTube +https?://(?:(?:www\.|)youtube\.com|youtu.be)/(?:channel/|embed/|playlist\?list=|watch\?v=|v/|)[-a-zA-Z0-9?&=_]* +<\s*youtube\s+id=['"][-a-zA-Z0-9?_]*['"] +\bimg\.youtube\.com/vi/[-a-zA-Z0-9?&=_]* +# Google Analytics +\bgoogle-analytics\.com/collect.[-0-9a-zA-Z?%=&_.~]* +# Google APIs +\bgoogleapis\.com/[a-z]+/v\d+/[a-z]+/[@./?=\w]+ +\b[-a-zA-Z0-9.]*\bstorage\d*\.googleapis\.com(?:/\S*|) +# Google Calendar +\bcalendar\.google\.com/calendar(?:/u/\d+|)/embed\?src=[@./?=\w&%]+ +\w+\@group\.calendar\.google\.com\b +# Google DataStudio +\bdatastudio\.google\.com/(?:(?:c/|)u/\d+/|)(?:embed/|)(?:open|reporting|datasources|s)/[-0-9a-zA-Z]+(?:/page/[-0-9a-zA-Z]+|) +# The leading `/` here is as opposed to the `\b` above +# ... a short way to match `https://` or `http://` since most urls have one of those prefixes +# Google Docs +/docs\.google\.com/[a-z]+/d/(?:e/|)[0-9a-zA-Z_-]+/? +# Google Drive +\bdrive\.google\.com/file/d/[0-9a-zA-Z_?=]* +# Google Groups +\bgroups\.google\.com/(?:forum/#!|d/)(?:msg|topic)/[^/]+/[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+|) +# Google themes +themes\.googleusercontent\.com/static/fonts/[^/]+/v\d+/[^.]+. +# Google CDN +\bclients2\.google(?:usercontent|)\.com[-0-9a-zA-Z/.]* +# Goo.gl +/goo\.gl/[a-zA-Z0-9]+ +# Google Chrome Store +\bchrome\.google\.com/webstore/detail/\w*(?:/\w*|) +# Google Books +\bbooks\.google\.(?:\w{2,4})/books\?[-\w\d=&#.]* +# Google Fonts +\bfonts\.(?:googleapis|gstatic)\.com/[-/?=:;+&0-9a-zA-Z]* + +# GitHub SHAs +\bapi.github\.com/repos/[^/]+/[^/]+/[^/]+/[0-9a-f]+\b +(?:\[[0-9a-f]+\]\(https:/|)/(?:www\.|)github\.com/[^/]+/[^/]+(?:/[^/]+/[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|) +\bgithub\.com/[^/]+/[^/]+[@#][0-9a-f]+\b +# githubusercontent +/[-a-z0-9]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]* +# gist github +/gist\.github\.com/[^/]+/[0-9a-f]+ +# git.io +\bgit\.io/[0-9a-zA-Z]+ +# GitHub JSON +"node_id": "[-a-zA-Z=;:/0-9+]*" +# Contributor +\[[^\]]+]\(https://github\.com/[^/]+\) +# GHSA +GHSA(?:-[0-9a-z]{4}){3} + +LS_COLORS=(["']).*?\g{-1} + +(\\?)%[a-zA-Z]+\g{-1}(?!%) + +# URL escaped characters +\%[0-9A-F]{2} +# hex digits including css/html color classes: +(?:[\\0][xX]|\\u|[uU]\+|#x?|\%23)[0-9a-fA-FgGrR_]{2,}(?:[uU]?[lL]{0,2}|u\d+)\b + +# https://www.gnu.org/software/groff/manual/groff.html +# man troff content +\\f[BCIPR] + +# Compiler flags +[\t "'`=]-[LPWXY] +[\t "'`=]-D(?!ebian) + +# ignore long runs of a single character: +\b([A-Za-z])\g{-1}{3,}\b diff --git a/.github/actions/spelling/reject.txt b/.github/actions/spelling/reject.txt new file mode 100644 index 000000000..a5ba6f639 --- /dev/null +++ b/.github/actions/spelling/reject.txt @@ -0,0 +1,7 @@ +^attache$ +benefitting +occurence +Sorce +^[Ss]pae +^untill +^wether @@ -16,6 +16,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi [![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh) [![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh) [![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh) +[![huntr.dev](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) ## Getting Started @@ -36,6 +37,8 @@ Oh My Zsh is installed by running one of the following commands in your terminal | **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` | | **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` | +_Note that previous configuration in `.zshrc` will be placed in `.pre-oh-my-zsh`. After installation you can move configuration you want to preserve into `.zshrc`._ + #### Manual inspection It's a good idea to inspect the install script from projects you don't yet know. You can do diff --git a/SECURITY.md b/SECURITY.md index cda53379f..7e5c8eed0 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -3,7 +3,8 @@ ## Supported Versions At the moment Oh My Zsh only considers the very latest commit to be supported. -We combine that with our fast response to incidents, so risk is minimized. +We combine that with our fast response to incidents and the automated updates +to minimize the time between vulnerability publication and patch release. | Version | Supported | |:-------------- |:------------------ | @@ -14,9 +15,10 @@ In the near future we will introduce versioning, so expect this section to chang ## Reporting a Vulnerability -If you find a vulnerability, email all the maintainers directly at: +**Do not submit an issue or pull request**: this might reveal the vulnerability. -- Robby: robby [at] planetargon.com -- Marc: hello [at] mcornella.com +Instead, you should email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh). -**Do not open an issue or Pull Request directly**, because it might reveal the vulnerability. +We will deal with the vulnerability privately and submit a patch as soon as possible. + +You can also submit your vulnerability report to [huntr.dev](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) and see if you can get a bounty reward. diff --git a/lib/cli.zsh b/lib/cli.zsh index 0b6bbc6cb..4917bc354 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -29,6 +29,7 @@ function _omz { 'reload:Reload the current zsh session' 'theme:Manage themes' 'update:Update Oh My Zsh' + 'version:Show the version' ) if (( CURRENT == 2 )); then @@ -36,7 +37,7 @@ function _omz { elif (( CURRENT == 3 )); then case "$words[2]" in changelog) local -a refs - refs=("${(@f)$(command git -C "$ZSH" for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") + refs=("${(@f)$(cd "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") _describe 'command' refs ;; plugin) subcmds=( 'disable:Disable plugin(s)' @@ -67,10 +68,12 @@ function _omz { _describe 'plugin' valid_plugins ;; plugin::info) - local -aU plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) + local -aU plugins + plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) _describe 'plugin' plugins ;; theme::(set|use)) - local -aU themes=("$ZSH"/themes/*.zsh-theme(.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::)) + local -aU themes + themes=("$ZSH"/themes/*.zsh-theme(.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::)) _describe 'theme' themes ;; esac elif (( CURRENT > 4 )); then @@ -164,6 +167,7 @@ Available commands: reload Reload the current zsh session theme <command> Manage themes update Update Oh My Zsh + version Show the version EOF } @@ -171,9 +175,12 @@ EOF function _omz::changelog { local version=${1:-HEAD} format=${3:-"--text"} - if ! command git -C "$ZSH" show-ref --verify refs/heads/$version &>/dev/null && \ - ! command git -C "$ZSH" show-ref --verify refs/tags/$version &>/dev/null && \ - ! command git -C "$ZSH" rev-parse --verify "${version}^{commit}" &>/dev/null; then + if ( + cd "$ZSH" + ! command git show-ref --verify refs/heads/$version && \ + ! command git show-ref --verify refs/tags/$version && \ + ! command git rev-parse --verify "${version}^{commit}" + ) &>/dev/null; then cat >&2 <<EOF Usage: omz changelog [version] @@ -446,9 +453,9 @@ function _omz::plugin::load { fi # Check if it has completion to reload compinit - if [[ -f "$base/_$plugin" ]]; then - has_completion=1 - fi + local -a comp_files + comp_files=($base/_*(N)) + has_completion=$(( $#comp_files > 0 )) # Load the plugin if [[ -f "$base/$plugin.plugin.zsh" ]]; then @@ -774,3 +781,24 @@ function _omz::update { [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" fi } + +function _omz::version { + ( + cd "$ZSH" + + # Get the version name: + # 1) try tag-like version + # 2) try name-rev + # 3) try branch name + local version + version=$(command git describe --tags HEAD 2>/dev/null) \ + || version=$(command git name-rev --no-undefined --name-only --exclude="remotes/*" HEAD 2>/dev/null) \ + || version=$(command git symbolic-ref --quiet --short HEAD 2>/dev/null) + + # Get short hash for the current HEAD + local commit=$(command git rev-parse --short HEAD 2>/dev/null) + + # Show version and commit hash + printf "%s (%s)\n" "$version" "$commit" + ) +} diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh index 650520797..eaeba7d23 100644 --- a/lib/diagnostics.zsh +++ b/lib/diagnostics.zsh @@ -335,7 +335,7 @@ function _omz_diag_dump_os_specific_version() { builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)" ;; cygwin) - command systeminfo | command head -4 | command tail -2 + command systeminfo | command head -n 4 | command tail -n 2 ;; esac diff --git a/lib/directories.zsh b/lib/directories.zsh index 6696854b0..c62f56468 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -26,7 +26,7 @@ function d () { if [[ -n $1 ]]; then dirs "$@" else - dirs -v | head -10 + dirs -v | head -n 10 fi } compdef _dirs d diff --git a/lib/functions.zsh b/lib/functions.zsh index 73b491a59..61f4dd49e 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -1,7 +1,7 @@ function zsh_stats() { fc -l 1 \ | awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \ - | grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl + | grep -v "./" | sort -nr | head -n 20 | column -c3 -s " " -t | nl } function uninstall_oh_my_zsh() { @@ -45,7 +45,7 @@ function takeurl() { data="$(mktemp)" curl -L "$1" > "$data" tar xf "$data" - thedir="$(tar tf "$data" | head -1)" + thedir="$(tar tf "$data" | head -n 1)" rm "$data" cd "$thedir" } @@ -237,12 +237,11 @@ function omz_urldecode { tmp=${tmp:gs/\\/\\\\/} # Handle %-escapes by turning them into `\xXX` printf escapes tmp=${tmp:gs/%/\\x/} - local decoded - eval "decoded=\$'$tmp'" + local decoded="$(printf -- "$tmp")" # Now we have a UTF-8 encoded string in the variable. We need to re-encode # it if caller is in a non-UTF-8 locale. - local safe_encodings + local -a safe_encodings safe_encodings=(UTF-8 utf8 US-ASCII) if [[ -z ${safe_encodings[(r)$caller_encoding]} ]]; then decoded=$(echo -E "$decoded" | iconv -f UTF-8 -t $caller_encoding) diff --git a/lib/git.zsh b/lib/git.zsh index 9a615e77b..62aac8f39 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -29,7 +29,7 @@ function git_prompt_info() { && upstream=" -> ${upstream}" fi - echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref}${upstream}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" + echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" } # Checks if working tree is dirty @@ -51,7 +51,7 @@ function parse_git_dirty() { FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}" ;; esac - STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -1) + STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1) fi if [[ -n $STATUS ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" diff --git a/lib/prompt_info_functions.zsh b/lib/prompt_info_functions.zsh index 48f033da6..e5535848b 100644 --- a/lib/prompt_info_functions.zsh +++ b/lib/prompt_info_functions.zsh @@ -30,7 +30,7 @@ function rvm_prompt_info() { local rvm_prompt rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null) [[ -z "${rvm_prompt}" ]] && return 1 - echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt}${ZSH_THEME_RUBY_PROMPT_SUFFIX}" + echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt:gs/%/%%}${ZSH_THEME_RUBY_PROMPT_SUFFIX}" } ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index d5c22a8c5..97f5c360a 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -20,16 +20,18 @@ done # Show all 256 colors with color number function spectrum_ls() { + setopt localoptions nopromptsubst local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} for code in {000..255}; do - print -P -- "$code: $FG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" + print -P -- "$code: ${FG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}" done } # Show all 256 colors where the background is set to specific color function spectrum_bls() { + setopt localoptions nopromptsubst local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} for code in {000..255}; do - print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" + print -P -- "$code: ${BG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}" done } diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index ef0d78895..4035d10a1 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -7,11 +7,10 @@ # (In screen, only short_tab_title is used) # Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { - emulate -L zsh - setopt prompt_subst + setopt localoptions nopromptsubst # Don't set the title if inside emacs, unless using vterm - [[ -n "$INSIDE_EMACS" && "$INSIDE_EMACS" != vterm ]] && return + [[ -n "${INSIDE_EMACS:-}" && "$INSIDE_EMACS" != vterm ]] && return # if $2 is unset use $1 as default # if it is set and empty, leave it as is @@ -48,13 +47,13 @@ fi # Runs before showing the prompt function omz_termsupport_precmd { - [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return + title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE" } # Runs before executing the command function omz_termsupport_preexec { - [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return + [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return emulate -L zsh setopt extended_glob @@ -97,10 +96,10 @@ function omz_termsupport_preexec { fi # cmd name only, or if this is sudo or ssh, the next cmd - local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} + local CMD="${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}" local LINE="${2:gs/%/%%}" - title '$CMD' '%100>...>$LINE%<<' + title "$CMD" "%100>...>${LINE}%<<" } autoload -Uz add-zsh-hook diff --git a/plugins/aliases/cheatsheet.py b/plugins/aliases/cheatsheet.py index d6d507b92..694afd31c 100644 --- a/plugins/aliases/cheatsheet.py +++ b/plugins/aliases/cheatsheet.py @@ -26,16 +26,16 @@ def cheatsheet(lines): target_aliases.extend(group_list) return cheatsheet -def pretty_print_group(key, aliases, hightlight=None): +def pretty_print_group(key, aliases, highlight=None): if len(aliases) == 0: return group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)]) alias_hl_formatter = lambda alias, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'green') for part in ('\t%s = %s' % alias[0:2]).split(hl)]) group_formatter = lambda g: termcolor.colored('[%s]' % g, 'red') alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green') - if hightlight and len(hightlight)>0: - print (group_hl_formatter(key, hightlight)) - print ('\n'.join([alias_hl_formatter(alias, hightlight) for alias in aliases])) + if highlight and len(highlight)>0: + print (group_hl_formatter(key, highlight)) + print ('\n'.join([alias_hl_formatter(alias, highlight) for alias in aliases])) else: print (group_formatter(key)) print ('\n'.join([alias_formatter(alias) for alias in aliases])) diff --git a/plugins/aliases/termcolor.py b/plugins/aliases/termcolor.py index f11b824b2..bb725e905 100644 --- a/plugins/aliases/termcolor.py +++ b/plugins/aliases/termcolor.py @@ -21,7 +21,7 @@ # # Author: Konstantin Lepa <konstantin.lepa@gmail.com> -"""ANSII Color formatting for output in terminal.""" +"""ANSI Color formatting for output in terminal.""" from __future__ import print_function import os diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index c8ec1de1e..fd772c61a 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -17,8 +17,10 @@ plugins=(... archlinux) | pacin | `sudo pacman -S` | Install packages from the repositories | | pacins | `sudo pacman -U` | Install a package from a local file | | pacinsd | `sudo pacman -S --asdeps` | Install packages as dependencies of another package | +| paclean | `sudo pacman -Sc` | Clean out old and unused caches and packages | | pacloc | `pacman -Qi` | Display information about a package in the local database | | paclocs | `pacman -Qs` | Search for packages in the local database | +| paclr | `sudo pacman -Scc` | Remove all files from the cache | | paclsorphans | `sudo pacman -Qdt` | List all orphaned packages | | pacmir | `sudo pacman -Syy` | Force refresh of all package lists after updating mirrorlist | | pacre | `sudo pacman -R` | Remove packages, keeping its settings and dependencies | @@ -52,6 +54,8 @@ upgrades were available. Use `pacman -Que` instead. | Alias | Command | Description | |---------|-------------------------------------------------|-------------------------------------------------------------------------| +| auclean | `sudo aura -Sc` | Clean out old and unused caches and packages | +| auclr | `sudo aura -Scc` | Remove all files from the cache | | auin | `sudo aura -S` | Install packages from the repositories | | aurin | `sudo aura -A` | Install packages from the repositories | | auins | `sudo aura -U` | Install a package from a local file | @@ -84,6 +88,8 @@ upgrades were available. Use `pacman -Que` instead. | Alias | Command | Description | |---------|-----------------------------------|---------------------------------------------------------------------| +| pacclean| `pacaur -Sc` | Clean out old and unused caches and packages | +| pacclr | `pacaur -Scc` | Remove all files from the cache | | pain | `pacaur -S` | Install packages from the repositories | | pains | `pacaur -U` | Install a package from a local file | | painsd | `pacaur -S --asdeps` | Install packages as dependencies of another package | @@ -106,6 +112,8 @@ upgrades were available. Use `pacman -Que` instead. | Alias | Command | Description | |---------|-----------------------------------|---------------------------------------------------------------------| | trconf | `trizen -C` | Fix all configuration files with vimdiff | +| trclean | `trizen -Sc` | Clean out old and unused caches and packages | +| trclr | `trizen -Scc` | Remove all files from the cache | | trin | `trizen -S` | Install packages from the repositories | | trins | `trizen -U` | Install a package from a local file | | trinsd | `trizen -S --asdeps` | Install packages as dependencies of another package | @@ -128,6 +136,8 @@ upgrades were available. Use `pacman -Que` instead. | Alias | Command | Description | |---------|--------------------------------|-------------------------------------------------------------------| | yaconf | `yay -Pg` | Print current configuration | +| yaclean | `yay -Sc` | Clean out old and unused caches and packages | +| yaclr | `yay -Scc` | Remove all files from the cache | | yain | `yay -S` | Install packages from the repositories | | yains | `yay -U` | Install a package from a local file | | yainsd | `yay -S --asdeps` | Install packages as dependencies of another package | @@ -170,3 +180,4 @@ whether the package manager is installed, checked in the following order: - ornicar - thibault.duplessis@gmail.com - Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info - Jeff M. Hubbard - jeffmhubbard@gmail.com +- K. Harishankar(harishnkr) - hari2menon1234@gmail.com diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 0c5782d98..4f1364779 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -5,7 +5,9 @@ # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips alias pacupg='sudo pacman -Syu' alias pacin='sudo pacman -S' +alias paclean='sudo pacman -Sc' alias pacins='sudo pacman -U' +alias paclr='sudo pacman -Scc' alias pacre='sudo pacman -R' alias pacrem='sudo pacman -Rns' alias pacrep='pacman -Si' @@ -88,6 +90,8 @@ fi if (( $+commands[aura] )); then alias auin='sudo aura -S' alias aurin='sudo aura -A' + alias auclean='sudo aura -Sc' + alias auclr='sudo aura -Scc' alias auins='sudo aura -U' alias auinsd='sudo aura -S --asdeps' alias aurinsd='sudo aura -A --asdeps' @@ -115,6 +119,8 @@ if (( $+commands[aura] )); then fi if (( $+commands[pacaur] )); then + alias pacclean='pacaur -Sc' + alias pacclr='pacaur -Scc' alias paupg='pacaur -Syu' alias pasu='pacaur -Syu --noconfirm' alias pain='pacaur -S' @@ -138,6 +144,8 @@ if (( $+commands[trizen] )); then alias trupg='trizen -Syua' alias trsu='trizen -Syua --noconfirm' alias trin='trizen -S' + alias trclean='trizen -Sc' + alias trclr='trizen -Scc' alias trins='trizen -U' alias trre='trizen -R' alias trrem='trizen -Rns' @@ -155,6 +163,8 @@ fi if (( $+commands[yay] )); then alias yaconf='yay -Pg' + alias yaclean='yay -Sc' + alias yaclr='yay -Scc' alias yaupg='yay -Syu' alias yasu='yay -Syu --noconfirm' alias yain='yay -S' diff --git a/plugins/aws/README.md b/plugins/aws/README.md index 011bbd8b4..24c6429dd 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -14,6 +14,7 @@ plugins=(... aws) * `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`. It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. Run `asp` without arguments to clear the profile. +* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection. * `acp [<profile>]`: in addition to `asp` functionality, it actually changes the profile by assuming the role specified in the `<profile>` configuration. It supports MFA and sets diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 2d095635b..3a3a111b4 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -21,6 +21,10 @@ function asp() { export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 export AWS_EB_PROFILE=$1 + + if [[ "$2" == "login" ]]; then + aws sso login + fi } # AWS profile switch diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index aecde20ea..479796dbe 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -20,6 +20,12 @@ if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom functi } fi +currentAppId () { + if (( $+commands[osascript] )); then + osascript -e 'tell application (path to frontmost application as text) to id' 2>/dev/null + fi +} + currentWindowId () { if hash osascript 2>/dev/null; then #osx osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0" @@ -32,11 +38,20 @@ currentWindowId () { bgnotify () { ## args: (title, subtitle) if hash terminal-notifier 2>/dev/null; then #osx - [[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2'; - [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal'; + local term_id="$bgnotify_appid" + if [[ -z "$term_id" ]]; then + case "$TERM_PROGRAM" in + iTerm.app) term_id='com.googlecode.iterm2' ;; + Apple_Terminal) term_id='com.apple.terminal' ;; + esac + fi + ## now call terminal-notifier, (hopefully with $term_id!) - [ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null || - terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null + if [[ -z "$term_id" ]]; then + terminal-notifier -message "$2" -title "$1" >/dev/null + else + terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null + fi elif hash growlnotify 2>/dev/null; then #osx growl growlnotify -m "$1" "$2" elif hash notify-send 2>/dev/null; then #ubuntu gnome! @@ -54,6 +69,7 @@ bgnotify () { ## args: (title, subtitle) bgnotify_begin() { bgnotify_timestamp=$EPOCHSECONDS bgnotify_lastcmd="${1:-$2}" + bgnotify_appid="$(currentAppId)" bgnotify_windowid=$(currentWindowId) } @@ -62,7 +78,7 @@ bgnotify_end() { elapsed=$(( EPOCHSECONDS - bgnotify_timestamp )) past_threshold=$(( elapsed >= bgnotify_threshold )) if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then - if [ $(currentWindowId) != "$bgnotify_windowid" ]; then + if [[ $(currentAppId) != "$bgnotify_appid" || $(currentWindowId) != "$bgnotify_windowid" ]]; then print -n "\a" bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed" fi diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh index 3a40b3af0..c4f71c2ae 100644 --- a/plugins/bower/bower.plugin.zsh +++ b/plugins/bower/bower.plugin.zsh @@ -9,7 +9,7 @@ _bower_installed_packages () { } _bower () { - local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production + local -a _1st_arguments _no_color _dopts _save_dev _force_latest _production local expl typeset -A opt_args @@ -22,7 +22,7 @@ _bower () _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]') - _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]') + _force_latest=('(--force-latest)--force-latest[Force latest version on conflict]') _production=('(--production)--production[Do not install project devDependencies]') @@ -54,7 +54,7 @@ _bower () _arguments \ $_dopts \ $_save_dev \ - $_force_lastest \ + $_force_latest \ $_no_color \ $_production ;; @@ -62,7 +62,7 @@ _bower () _arguments \ $_dopts \ $_no_color \ - $_force_lastest + $_force_latest _bower_installed_packages compadd "$@" $(echo $bower_package_list) ;; diff --git a/plugins/branch/README.md b/plugins/branch/README.md index 56ab8da4b..a15dd22df 100644 --- a/plugins/branch/README.md +++ b/plugins/branch/README.md @@ -1,31 +1,47 @@ -# Branch +# Branch plugin -Displays the current Git or Mercurial branch fast. +This plugin displays the current Git or Mercurial branch, fast. If in a Mercurial repository, +also display the current bookmark, if present. + +To use it, add `branch` to the plugins array in your zshrc file: + +```zsh +plugins=(... branch) +``` ## Speed test -### Mercurial +- `hg branch`: -```shell -$ time hg branch -0.11s user 0.14s system 70% cpu 0.355 total -``` + ```console + $ time hg branch + 0.11s user 0.14s system 70% cpu 0.355 total + ``` -### Branch plugin +- branch plugin: -```shell -$ time zsh /tmp/branch_prompt_info_test.zsh -0.00s user 0.01s system 78% cpu 0.014 total -``` + ```console + $ time zsh /tmp/branch_prompt_info_test.zsh + 0.00s user 0.01s system 78% cpu 0.014 total + ``` ## Usage -Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`) -adding `$(branch_prompt_info)` in your prompt like this: +Copy your theme to `$ZSH_CUSTOM/themes/` and modify it to add `$(branch_prompt_info)` in your prompt. +This example is for the `robbyrussell` theme: ```diff -- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme +index 2fd5f2cd..9d89a464 100644 +--- a/themes/robbyrussell.zsh-theme ++++ b/themes/robbyrussell.zsh-theme +@@ -1,5 +1,5 @@ + PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" +-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' ++PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)' + + ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ``` ## Maintainer diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh index 2e5659bdf..dd5871fdc 100644 --- a/plugins/branch/branch.plugin.zsh +++ b/plugins/branch/branch.plugin.zsh @@ -3,29 +3,33 @@ # Oct 2, 2015 function branch_prompt_info() { - # Defines path as current directory - local current_dir=$PWD - # While current path is not root path - while [[ $current_dir != '/' ]] - do - # Git repository - if [[ -d "${current_dir}/.git" ]] - then - echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/} - return; + # Start checking in current working directory + local branch="" dir="$PWD" + while [[ "$dir" != '/' ]]; do + # Found .git directory + if [[ -d "${dir}/.git" ]]; then + branch="${"$(<"${dir}/.git/HEAD")"##*/}" + echo '±' "${branch:gs/%/%%}" + return fi - # Mercurial repository - if [[ -d "${current_dir}/.hg" ]] - then - if [[ -f "$current_dir/.hg/branch" ]] - then - echo '☿' $(<"$current_dir/.hg/branch") + + # Found .hg directory + if [[ -d "${dir}/.hg" ]]; then + if [[ -f "${dir}/.hg/branch" ]]; then + branch="$(<"${dir}/.hg/branch")" else - echo '☿ default' + branch="default" + fi + + if [[ -f "${dir}/.hg/bookmarks.current" ]]; then + branch="${branch}/$(<"${dir}/.hg/bookmarks.current")" fi - return; + + echo '☿' "${branch:gs/%/%%}" + return fi - # Defines path as parent directory and keeps looking for :) - current_dir="${current_dir:h}" + + # Check parent directory + dir="${dir:h}" done } diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index 532dd9be7..070a083d0 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,5 +1,4 @@ alias brewp='brew pin' -alias brews='brew list -1' alias brewsp='brew list --pinned' alias bubo='brew update && brew outdated' alias bubc='brew upgrade && brew cleanup' @@ -7,3 +6,16 @@ alias bubu='bubo && bubc' alias buf='brew upgrade --formula' alias bcubo='brew update && brew outdated --cask' alias bcubc='brew upgrade --cask && brew cleanup' + +function brews() { + local formulae="$(brew leaves | xargs brew deps --installed --for-each)" + local casks="$(brew list --cask)" + + local blue="$(tput setaf 4)" + local bold="$(tput bold)" + local off="$(tput sgr0)" + + echo "${blue}==>${off} ${bold}Formulae${off}" + echo "${formulae}" | sed "s/^\(.*\):\(.*\)$/\1${blue}\2${off}/" + echo "\n${blue}==>${off} ${bold}Casks${off}\n${casks}" +} diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 6293dc28a..c1cbb13dd 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -40,7 +40,7 @@ bundle_install() { else local cores_num="$(nproc)" fi - bundle install --jobs="$cores_num" "$@" + BUNDLE_JOBS="$cores_num" bundle install "$@" } ## Gem wrapper @@ -81,14 +81,12 @@ bundled_commands=( ) # Remove $UNBUNDLED_COMMANDS from the bundled_commands list -for cmd in $UNBUNDLED_COMMANDS; do - bundled_commands=(${bundled_commands#$cmd}); -done +bundled_commands=(${bundled_commands:|UNBUNDLED_COMMANDS}) +unset UNBUNDLED_COMMANDS # Add $BUNDLED_COMMANDS to the bundled_commands list -for cmd in $BUNDLED_COMMANDS; do - bundled_commands+=($cmd); -done +bundled_commands+=($BUNDLED_COMMANDS) +unset BUNDLED_COMMANDS # Check if in the root or a subdirectory of a bundled project _within-bundled-project() { @@ -126,5 +124,4 @@ for cmd in $bundled_commands; do compdef "_$cmd" "bundled_$cmd"="$cmd" fi done - unset cmd bundled_commands diff --git a/plugins/catimg/catimg.plugin.zsh b/plugins/catimg/catimg.plugin.zsh index ca46444cc..f4ff6f856 100644 --- a/plugins/catimg/catimg.plugin.zsh +++ b/plugins/catimg/catimg.plugin.zsh @@ -2,7 +2,7 @@ # catimg script by Eduardo San Martin Morote aka Posva # # https://posva.net # # # -# Ouput the content of an image to the stdout using the 256 colors of the # +# Output the content of an image to the stdout using the 256 colors of the # # terminal. # # GitHub: https://github.com/posva/catimg # ################################################################################ diff --git a/plugins/catimg/catimg.sh b/plugins/catimg/catimg.sh index 713a03291..f58392428 100644 --- a/plugins/catimg/catimg.sh +++ b/plugins/catimg/catimg.sh @@ -2,7 +2,7 @@ # catimg script by Eduardo San Martin Morote aka Posva # # https://posva.net # # # -# Ouput the content of an image to the stdout using the 256 colors of the # +# Output the content of an image to the stdout using the 256 colors of the # # terminal. # # GitHub: https://github.com/posva/catimg # ################################################################################ diff --git a/plugins/chruby/README.md b/plugins/chruby/README.md index d373006a5..19eb15a8d 100644 --- a/plugins/chruby/README.md +++ b/plugins/chruby/README.md @@ -5,6 +5,7 @@ current Ruby version, and completion and a prompt function to display the Ruby v Supports brew and manual installation of chruby. To use it, add `chruby` to the plugins array in your zshrc file: + ```zsh plugins=(... chruby) ``` @@ -14,7 +15,7 @@ plugins=(... chruby) If you'd prefer to specify an explicit path to load chruby from you can set variables like so: -``` +```zsh zstyle :omz:plugins:chruby path /local/path/to/chruby.sh zstyle :omz:plugins:chruby auto /local/path/to/auto.sh ``` diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh index 32f0525aa..d7a28d4e2 100644 --- a/plugins/chruby/chruby.plugin.zsh +++ b/plugins/chruby/chruby.plugin.zsh @@ -1,121 +1,94 @@ -# -# INSTRUCTIONS -# -# With either a manual or brew installed chruby things should just work. -# -# If you'd prefer to specify an explicit path to load chruby from -# you can set variables like so: -# -# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh -# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh -# -# TODO -# - autodetermine correct source path on non OS X systems -# - completion if ruby-install exists +## load chruby from different locations -# rvm and rbenv plugins also provide this alias -alias rubies='chruby' +_source-from-omz-settings() { + local _chruby_path _chruby_auto + + zstyle -s :omz:plugins:chruby path _chruby_path || return 1 + zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1 + if [[ -r ${_chruby_path} ]]; then + source ${_chruby_path} + fi -_homebrew-installed() { - whence brew &> /dev/null - _xit=$? - if [ $_xit -eq 0 ];then - # ok , we have brew installed - # speculatively we check default brew prefix - if [ -h /usr/local/opt/chruby ];then - _brew_prefix="/usr/local/opt/chruby" - else - # ok , it is not default prefix - # this call to brew is expensive ( about 400 ms ), so at least let's make it only once - _brew_prefix=$(brew --prefix chruby) - fi - return 0 - else - return $_xit - fi + if [[ -r ${_chruby_auto} ]]; then + source ${_chruby_auto} + fi } -_chruby-from-homebrew-installed() { - [ -r $_brew_prefix ] &> /dev/null -} +_source-from-homebrew() { + (( $+commands[brew] )) || return 1 -_ruby-build_installed() { - whence ruby-build &> /dev/null -} + local _brew_prefix + # check default brew prefix + if [[ -h /usr/local/opt/chruby ]];then + _brew_prefix="/usr/local/opt/chruby" + else + # ok , it is not default prefix + # this call to brew is expensive ( about 400 ms ), so at least let's make it only once + _brew_prefix=$(brew --prefix chruby) + fi -_ruby-install-installed() { - whence ruby-install &> /dev/null -} + [[ -r "$_brew_prefix" ]] || return 1 -# Simple definition completer for ruby-build -if _ruby-build_installed; then - _ruby-build() { compadd $(ruby-build --definitions) } - compdef _ruby-build ruby-build -fi - -_source_from_omz_settings() { - local _chruby_path - local _chruby_auto - - zstyle -s :omz:plugins:chruby path _chruby_path - zstyle -s :omz:plugins:chruby auto _chruby_auto - - if [[ -r ${_chruby_path} ]]; then - source ${_chruby_path} - fi - - if [[ -r ${_chruby_auto} ]]; then - source ${_chruby_auto} - fi + source $_brew_prefix/share/chruby/chruby.sh + source $_brew_prefix/share/chruby/auto.sh } -_chruby_dirs() { - chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies) - for dir in chrubydirs; do - if [[ -d $dir ]]; then - RUBIES+=$dir - fi - done +_load-chruby-dirs() { + local dir + for dir in "$HOME/.rubies" "$PREFIX/opt/rubies"; do + if [[ -d "$dir" ]]; then + RUBIES+=("$dir") + fi + done } -if _homebrew-installed && _chruby-from-homebrew-installed ; then - source $_brew_prefix/share/chruby/chruby.sh - source $_brew_prefix/share/chruby/auto.sh - _chruby_dirs +# Load chruby +if _source-from-omz-settings; then + _load-chruby-dirs elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then - source /usr/local/share/chruby/chruby.sh - source /usr/local/share/chruby/auto.sh - _chruby_dirs -else - _source_from_omz_settings - _chruby_dirs + source /usr/local/share/chruby/chruby.sh + source /usr/local/share/chruby/auto.sh + _load-chruby-dirs +elif _source-from-homebrew; then + _load-chruby-dirs fi -function ensure_chruby() { - $(whence chruby) -} +unfunction _source-from-homebrew _source-from-omz-settings _load-chruby-dirs + + +## chruby utility functions and aliases + +# rvm and rbenv plugins also provide this alias +alias rubies='chruby' function current_ruby() { - local _ruby - _ruby="$(chruby |grep \* |tr -d '* ')" - if [[ $(chruby |grep -c \*) -eq 1 ]]; then - echo ${_ruby} - else - echo "system" - fi + local ruby + ruby="$(chruby | grep \* | tr -d '* ')" + if [[ $(chruby | grep -c \*) -eq 1 ]]; then + echo ${ruby} + else + echo "system" + fi } function chruby_prompt_info() { - echo "$(current_ruby)" + echo "${$(current_ruby):gs/%/%%}" } -# complete on installed rubies +# Complete chruby command with installed rubies _chruby() { - compadd $(chruby | tr -d '* ') - local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' - if PATH=${default_path} type ruby &> /dev/null; then - compadd system - fi + compadd $(chruby | tr -d '* ') + if PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command ruby &>/dev/null; then + compadd system + fi } + compdef _chruby chruby + + +# Simple definition completer for ruby-build +if command ruby-build &> /dev/null; then + _ruby-build() { compadd $(ruby-build --definitions) } + compdef _ruby-build ruby-build +fi diff --git a/plugins/chucknorris/fortunes/chucknorris b/plugins/chucknorris/fortunes/chucknorris index 6ba5bb9b5..9e36ce89a 100644 --- a/plugins/chucknorris/fortunes/chucknorris +++ b/plugins/chucknorris/fortunes/chucknorris @@ -228,7 +228,7 @@ Chuck Norris once punched the ground to stop an earthquake. The resulting afters % Chuck Norris once round-house kicked a salesman. Over the phone. % -Chuck Norris once rounhouse kicked a football. The astronomical society now considers it a planet. +Chuck Norris once roundhouse kicked a football. The astronomical society now considers it a planet. % Chuck Norris once thought he was wrong. He was, however, mistaken. % @@ -342,7 +342,7 @@ Every time there's an earthquake, you know Chuck Norris is hungry. The earthquak % Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris. % -Fear of spiders is arachnaphobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic. +Fear of spiders is arachnophobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic. % Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % @@ -426,7 +426,7 @@ Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag % Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face. +Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindness, and possibly foot sized bruises on the face. % Taking Karate Lessons = $100, Buying MMA DVD's = $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS. % @@ -452,7 +452,7 @@ The best part of waking up is not Folgers in your cup. it's knowing that Chuck N % The chief export of Chuck Norris is pain. % -The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship. +The dictionary references Chuck Norris several times, he is mentioned under Fear, Law, Order and Chucktatorship. % The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % @@ -468,7 +468,7 @@ The only way sharks will come near CN underwater is when CN is inside of a cage. % The only word that rhymes with orange is Chuck Norris. % -The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender". +The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequel "The Last Skull Bender". % The quickest way to a man's heart is with Chuck Norris' fist. % diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 8ea98f80a..a9da6cf83 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -82,7 +82,7 @@ colorize_less() { # This variable tells less to pipe every file through the specified command # (see the man page of less INPUT PREPROCESSOR). # 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like - # the ~/.zsh_history. For such files the tty of the preprocessor will be supended. + # the ~/.zsh_history. For such files the tty of the preprocessor will be suspended. # Therefore we must source this file to make colorize_cat available in the # preprocessor without the interactive mode. # `2>/dev/null` will suppress the error for large files 'broken pipe' of the python diff --git a/plugins/command-not-found/README.md b/plugins/command-not-found/README.md index f267f0c89..5a373c537 100644 --- a/plugins/command-not-found/README.md +++ b/plugins/command-not-found/README.md @@ -29,5 +29,6 @@ It works out of the box with the command-not-found packages for: - [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound) - [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found) - [Termux](https://github.com/termux/command-not-found) +- [SUSE](https://www.unix.com/man-page/suse/1/command-not-found/) You can add support for other platforms by submitting a Pull Request. diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index cb96fe063..cb8a8989c 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -57,6 +57,13 @@ fi # Termux: https://github.com/termux/command-not-found if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; then command_not_found_handler() { - /data/data/com.termux/files/usr/libexec/termux/command-not-found -- "$1" + /data/data/com.termux/files/usr/libexec/termux/command-not-found "$1" + } +fi + +# SUSE and derivates: https://www.unix.com/man-page/suse/1/command-not-found/ +if [[ -x /usr/bin/command-not-found ]]; then + command_not_found_handler() { + /usr/bin/command-not-found "$1" } fi diff --git a/plugins/cpanm/_cpanm b/plugins/cpanm/_cpanm index ff9ae1c15..f328dd997 100644 --- a/plugins/cpanm/_cpanm +++ b/plugins/cpanm/_cpanm @@ -36,7 +36,7 @@ arguments=( '--reinstall[Reinstall the distribution even if you already have the latest version installed]' '--interactive[Turn on interactive configure]' - '--scandeps[Scan the depencencies of given modules and output the tree in a text format]' + '--scandeps[Scan the dependencies of given modules and output the tree in a text format]' '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)' '--save-dists[Specify the optional directory path to copy downloaded tarballs]' diff --git a/plugins/deno/README.md b/plugins/deno/README.md index 828e6af39..691318397 100644 --- a/plugins/deno/README.md +++ b/plugins/deno/README.md @@ -13,6 +13,7 @@ This plugin sets up completion and aliases for [Deno](https://deno.land). | dh | deno help | | dli | deno lint | | drn | deno run | +| drA | deno run -A | | drw | deno run --watch | | dts | deno test | | dup | deno upgrade | diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index 34adddc37..eb7191971 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -6,6 +6,7 @@ alias dfmt='deno fmt' alias dh='deno help' alias dli='deno lint' alias drn='deno run' +alias drA='deno run -A' alias drw='deno run --watch' alias dts='deno test' alias dup='deno upgrade' diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index 26ef07494..8268147f6 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -19,14 +19,14 @@ export DIRHISTORY_SIZE=30 # Returns the element if the array was not empty, # otherwise returns empty string. function pop_past() { - eval "$1='$dirhistory_past[$#dirhistory_past]'" + typeset -g $1="${dirhistory_past[$#dirhistory_past]}" if [[ $#dirhistory_past -gt 0 ]]; then dirhistory_past[$#dirhistory_past]=() fi } function pop_future() { - eval "$1='$dirhistory_future[$#dirhistory_future]'" + typeset -g $1="${dirhistory_future[$#dirhistory_future]}" if [[ $#dirhistory_future -gt 0 ]]; then dirhistory_future[$#dirhistory_future]=() fi @@ -182,7 +182,7 @@ bindkey "\e\e[A" dirhistory_zle_dirhistory_up # Putty bindkey "\eO3A" dirhistory_zle_dirhistory_up # GNU screen case "$TERM_PROGRAM" in iTerm.app) bindkey "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2 -Apple_Terminal) bindkey "^[OA" dirhistory_zle_dirhistory_up ;; # Terminal.app +Apple_Terminal) bindkey "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app esac if (( ${+terminfo[kcuu1]} )); then bindkey "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt @@ -195,7 +195,7 @@ bindkey "\e\e[B" dirhistory_zle_dirhistory_down # Putty bindkey "\eO3B" dirhistory_zle_dirhistory_down # GNU screen case "$TERM_PROGRAM" in iTerm.app) bindkey "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2 -Apple_Terminal) bindkey "^[OB" dirhistory_zle_dirhistory_down ;; # Terminal.app +Apple_Terminal) bindkey "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app esac if (( ${+terminfo[kcud1]} )); then bindkey "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 13985fc82..b8a4b067d 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -1,7 +1,5 @@ # support Compose v2 as docker CLI plugin -DOCKER_CONTEXT=default command docker compose &>/dev/null \ - && dccmd='docker compose' \ - || dccmd='docker-compose' +(( ${+commands[docker-compose]} )) && dccmd='docker-compose' || dccmd='docker compose' alias dco="$dccmd" alias dcb="$dccmd build" diff --git a/plugins/docker-machine/_docker-machine b/plugins/docker-machine/_docker-machine index 7c19ba8e7..fbd36d7c6 100644 --- a/plugins/docker-machine/_docker-machine +++ b/plugins/docker-machine/_docker-machine @@ -90,7 +90,7 @@ __docker-machine_filters() { } __get_swarm_discovery() { - declare -a masters serivces + declare -a masters services local service services=() masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}')) @@ -169,7 +169,7 @@ __get_create_argument() { __docker-machine_subcommand() { local -a opts_help opts_help=("(- :)--help[Print usage]") - local -a opts_only_host opts_driver opts_storage_driver opts_stragery + local -a opts_only_host opts_driver opts_storage_driver opts_state opts_only_host=( "$opts_help" "*:host:__docker-machine_hosts_all" @@ -330,7 +330,7 @@ _docker-machine() { _arguments -C \ "(- :)"{-h,--help}"[Show help]" \ "(-D --debug)"{-D,--debug}"[Enable debug mode]" \ - '(-s --stroage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \ + '(-s --storage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \ '--tls-ca-cert[CA to verify remotes against]:file:_files' \ '--tls-ca-key[Private key to generate certificates]:file:_files' \ '--tls-client-cert[Client cert to use for TLS]:file:_files' \ diff --git a/plugins/dotnet/README.md b/plugins/dotnet/README.md index 7554b4e3c..87dfd8f8d 100644 --- a/plugins/dotnet/README.md +++ b/plugins/dotnet/README.md @@ -21,3 +21,4 @@ plugins=(... dotnet) | da | dotnet add | Add a package or reference to a .NET project. | | dp | dotnet pack | Create a NuGet package. | | dng | dotnet nuget | Provides additional NuGet commands. | +| db | dotnet build | Build a .NET project | diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh index 6bd4b7af8..8ea31cdbd 100644 --- a/plugins/dotnet/dotnet.plugin.zsh +++ b/plugins/dotnet/dotnet.plugin.zsh @@ -12,7 +12,7 @@ _dotnet_zsh_complete() return fi - # This is not a variable assigment, don't remove spaces! + # This is not a variable assignment, don't remove spaces! _values = "${(ps:\n:)completions}" } @@ -30,3 +30,4 @@ alias ds='dotnet sln' alias da='dotnet add' alias dp='dotnet pack' alias dng='dotnet nuget' +alias db='dotnet build' diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh index 7876f1c89..f70e09320 100644 --- a/plugins/emoji/emoji.plugin.zsh +++ b/plugins/emoji/emoji.plugin.zsh @@ -20,7 +20,7 @@ unset _omz_emoji_plugin_dir # These additional emoji are not in the definition file, but are useful in conjunction with it -# This is a combinin character that can be placed after any other character to surround +# This is a combining character that can be placed after any other character to surround # it in a "keycap" symbol. # The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc. # It's unclear whether this should be in the $emoji array, because those characters are all ones diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh index ccbbce3b2..6288bb275 100644 --- a/plugins/fastfile/fastfile.plugin.zsh +++ b/plugins/fastfile/fastfile.plugin.zsh @@ -18,7 +18,7 @@ default fastfile_var_prefix "§" # 1. name - The name of the shortcut (default: name of the file) # 2. file - The file or directory to make the shortcut for # STDOUT: -# => fastfle_print +# => fastfile_print # function fastfile() { test "$2" || 2="." @@ -75,14 +75,14 @@ function fastfile_print() { # List all shortcuts # # STDOUT: -# (=> fastfle_print) for each shortcut +# (=> fastfile_print) for each shortcut # function fastfile_ls() { for f in "${fastfile_dir}"/*(NF); do - file=`basename "$f"` # To enable simpler handeling of spaces in file names + file=`basename "$f"` # To enable simpler handling of spaces in file names varkey=`echo "$file" | tr " " "_"` - # Special format for colums + # Special format for columns echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")" done | column -t -s "|" } @@ -93,7 +93,7 @@ function fastfile_ls() { # Arguments: # 1. name - The name of the shortcut (default: name of the file) # STDOUT: -# => fastfle_print +# => fastfile_print # function fastfile_rm() { fastfile_print "$1" @@ -105,7 +105,7 @@ function fastfile_rm() { # function fastfile_sync() { for f in "${fastfile_dir}"/*(NF); do - file=`basename "$f"` # To enable simpler handeling of spaces in file names + file=`basename "$f"` # To enable simpler handling of spaces in file names varkey=`echo "$file" | tr " " "_"` alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'" diff --git a/plugins/fd/README.md b/plugins/fd/README.md index aabd624b8..4d9cf190f 100644 --- a/plugins/fd/README.md +++ b/plugins/fd/README.md @@ -10,4 +10,4 @@ plugins=(... fd) Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0). -Updated on Febrary 13th, 2019. +Updated on February 13th, 2019. diff --git a/plugins/flutter/README.md b/plugins/flutter/README.md index be419144f..9c8169afc 100644 --- a/plugins/flutter/README.md +++ b/plugins/flutter/README.md @@ -18,4 +18,4 @@ plugins=(... flutter) | `flb` | `flutter build` | Build flutter application | | `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory | | `flget` | `flutter packages get` | Installs dependencies | -| `flc` | `flutter clean` | Cleans flutter porject | +| `flc` | `flutter clean` | Cleans flutter project | diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend index 15f8d239d..15f8d239d 100644 --- a/plugins/frontend-search/_frontend-search.sh +++ b/plugins/frontend-search/_frontend diff --git a/plugins/fzf/README.md b/plugins/fzf/README.md index 791a3eb6f..15d4d31f3 100644 --- a/plugins/fzf/README.md +++ b/plugins/fzf/README.md @@ -26,7 +26,7 @@ export FZF_BASE=/path/to/fzf/install/dir Set default command to use when input is tty: ```zsh -export FZF_DEFAULT_COMMAND='<your fzf default commmand>' +export FZF_DEFAULT_COMMAND='<your fzf default command>' ``` If not set, the plugin will try to set it to these, in the order in which they're found: diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index aabd62cb1..102605958 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -1,176 +1,201 @@ -function setup_using_base_dir() { - local fzf_base fzf_shell fzfdirs dir - - test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}" +function fzf_setup_using_base_dir() { + local fzf_base fzf_shell fzfdirs dir + + test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}" + + if [[ -z "${fzf_base}" ]]; then + fzfdirs=( + "${HOME}/.fzf" + "${HOME}/.nix-profile/share/fzf" + "${XDG_DATA_HOME:-$HOME/.local/share}/fzf" + "/usr/local/opt/fzf" + "/usr/share/fzf" + "/usr/local/share/examples/fzf" + ) + for dir in ${fzfdirs}; do + if [[ -d "${dir}" ]]; then + fzf_base="${dir}" + break + fi + done if [[ -z "${fzf_base}" ]]; then - fzfdirs=( - "${HOME}/.fzf" - "${HOME}/.nix-profile/share/fzf" - "${XDG_DATA_HOME:-$HOME/.local/share}/fzf" - "/usr/local/opt/fzf" - "/usr/share/fzf" - "/usr/local/share/examples/fzf" - ) - for dir in ${fzfdirs}; do - if [[ -d "${dir}" ]]; then - fzf_base="${dir}" - break - fi - done - - if [[ -z "${fzf_base}" ]]; then - if (( ${+commands[fzf-share]} )) && dir="$(fzf-share)" && [[ -d "${dir}" ]]; then - fzf_base="${dir}" - elif (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then - if [[ -d "${dir}" ]]; then - fzf_base="${dir}" - fi - fi + if (( ${+commands[fzf-share]} )) && dir="$(fzf-share)" && [[ -d "${dir}" ]]; then + fzf_base="${dir}" + elif (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then + if [[ -d "${dir}" ]]; then + fzf_base="${dir}" fi - fi - - if [[ ! -d "${fzf_base}" ]]; then - return 1 - fi - - # Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages - if [[ ! -d "${fzf_base}/shell" ]]; then - fzf_shell="${fzf_base}" - else - fzf_shell="${fzf_base}/shell" - fi - - # Setup fzf binary path - if (( ! ${+commands[fzf]} )) && [[ "$PATH" != *$fzf_base/bin* ]]; then - export PATH="$PATH:$fzf_base/bin" - fi - - # Auto-completion - if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then - source "${fzf_shell}/completion.zsh" 2> /dev/null - fi - - # Key bindings - if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then - source "${fzf_shell}/key-bindings.zsh" - fi + fi + fi + fi + + if [[ ! -d "${fzf_base}" ]]; then + return 1 + fi + + # Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages + if [[ ! -d "${fzf_base}/shell" ]]; then + fzf_shell="${fzf_base}" + else + fzf_shell="${fzf_base}/shell" + fi + + # Setup fzf binary path + if (( ! ${+commands[fzf]} )) && [[ "$PATH" != *$fzf_base/bin* ]]; then + export PATH="$PATH:$fzf_base/bin" + fi + + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source "${fzf_shell}/completion.zsh" 2> /dev/null + fi + + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "${fzf_shell}/key-bindings.zsh" + fi } -function setup_using_debian_package() { - if (( ! $+commands[dpkg] )) || ! dpkg -s fzf &>/dev/null; then - # Either not a debian based distro, or no fzf installed - return 1 - fi - - # NOTE: There is no need to configure PATH for debian package, all binaries - # are installed to /usr/bin by default - - local completions key_bindings - - case $PREFIX in - *com.termux*) - # Support Termux package - completions="${PREFIX}/share/fzf/completion.zsh" - key_bindings="${PREFIX}/share/fzf/key-bindings.zsh" - ;; - *) - # Determine completion file path: first bullseye/sid, then buster/stretch - completions="/usr/share/doc/fzf/examples/completion.zsh" - [[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf" - key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh" - ;; - esac - - # Auto-completion - if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then - source $completions 2> /dev/null - fi - - # Key bindings - if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then - source $key_bindings - fi - - return 0 +function fzf_setup_using_debian() { + if (( ! $+commands[dpkg] )) || ! dpkg -s fzf &>/dev/null; then + # Either not a debian based distro, or no fzf installed + return 1 + fi + + # NOTE: There is no need to configure PATH for debian package, all binaries + # are installed to /usr/bin by default + + local completions key_bindings + + case $PREFIX in + *com.termux*) + # Support Termux package + completions="${PREFIX}/share/fzf/completion.zsh" + key_bindings="${PREFIX}/share/fzf/key-bindings.zsh" + ;; + *) + # Determine completion file path: first bullseye/sid, then buster/stretch + completions="/usr/share/doc/fzf/examples/completion.zsh" + [[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf" + key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh" + ;; + esac + + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source $completions 2> /dev/null + fi + + # Key bindings + if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then + source $key_bindings + fi + + return 0 } -function setup_using_opensuse_package() { - # OpenSUSE installs fzf in /usr/bin/fzf - # If the command is not found, the package isn't installed - (( $+commands[fzf] )) || return 1 +function fzf_setup_using_opensuse() { + # OpenSUSE installs fzf in /usr/bin/fzf + # If the command is not found, the package isn't installed + (( $+commands[fzf] )) || return 1 + + # The fzf-zsh-completion package installs the auto-completion in + local completions="/usr/share/zsh/site-functions/_fzf" + # The fzf-zsh-completion package installs the key-bindings file in + local key_bindings="/etc/zsh_completion.d/fzf-key-bindings" + + # If these are not found: (1) maybe we're not on OpenSUSE, or + # (2) maybe the fzf-zsh-completion package isn't installed. + if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then + return 1 + fi + + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source "$completions" 2>/dev/null + fi + + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "$key_bindings" 2>/dev/null + fi + + return 0 +} - # The fzf-zsh-completion package installs the auto-completion in - local completions="/usr/share/zsh/site-functions/_fzf" - # The fzf-zsh-completion package installs the key-bindings file in - local key_bindings="/etc/zsh_completion.d/fzf-key-bindings" +function fzf_setup_using_openbsd() { + # openBSD installs fzf in /usr/local/bin/fzf + if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then + return 1 + fi - # If these are not found: (1) maybe we're not on OpenSUSE, or - # (2) maybe the fzf-zsh-completion package isn't installed. - if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then - return 1 - fi + # The fzf package installs the auto-completion in + local completions="/usr/local/share/zsh/site-functions/_fzf_completion" + # The fzf package installs the key-bindings file in + local key_bindings="/usr/local/share/zsh/site-functions/_fzf_key_bindings" - # Auto-completion - if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then - source "$completions" 2>/dev/null - fi + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source "$completions" 2>/dev/null + fi - # Key bindings - if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then - source "$key_bindings" 2>/dev/null - fi + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "$key_bindings" 2>/dev/null + fi - return 0 + return 0 } -function setup_using_openbsd_package() { - # openBSD installs fzf in /usr/local/bin/fzf - if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then - return 1 - fi +function fzf_setup_using_cygwin() { + # Cygwin installs fzf in /usr/local/bin/fzf + if [[ "$OSTYPE" != cygwin* ]] || (( ! $+commands[fzf] )); then + return 1 + fi - # The fzf package installs the auto-completion in - local completions="/usr/local/share/zsh/site-functions/_fzf_completion" - # The fzf package installs the key-bindings file in - local key_bindings="/usr/local/share/zsh/site-functions/_fzf_key_bindings" + # The fzf-zsh-completion package installs the auto-completion in + local completions="/etc/profile.d/fzf-completion.zsh" + # The fzf-zsh package installs the key-bindings file in + local key_bindings="/etc/profile.d/fzf.zsh" - # Auto-completion - if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then - source "$completions" 2>/dev/null - fi + # Auto-completion + if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then + source "$completions" 2>/dev/null + fi - # Key bindings - if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then - source "$key_bindings" 2>/dev/null - fi + # Key bindings + if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then + source "$key_bindings" 2>/dev/null + fi - return 0 + return 0 } -function indicate_error() { - cat >&2 <<EOF +# Indicate to user that fzf installation not found if nothing worked +function fzf_setup_error() { + cat >&2 <<'EOF' [oh-my-zsh] fzf plugin: Cannot find fzf installation directory. -Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc +Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc EOF } -# Indicate to user that fzf installation not found if nothing worked -setup_using_openbsd_package \ - || setup_using_debian_package \ - || setup_using_opensuse_package \ - || setup_using_base_dir \ - || indicate_error +fzf_setup_using_openbsd \ + || fzf_setup_using_debian \ + || fzf_setup_using_opensuse \ + || fzf_setup_using_cygwin \ + || fzf_setup_using_base_dir \ + || fzf_setup_error -unset -f setup_using_opensuse_package setup_using_debian_package setup_using_base_dir indicate_error +unset -f -m 'fzf_setup_*' if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then - if (( $+commands[rg] )); then - export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"' - elif (( $+commands[fd] )); then - export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git' - elif (( $+commands[ag] )); then - export FZF_DEFAULT_COMMAND='ag -l --hidden -g "" --ignore .git' - fi + if (( $+commands[rg] )); then + export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"' + elif (( $+commands[fd] )); then + export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git' + elif (( $+commands[ag] )); then + export FZF_DEFAULT_COMMAND='ag -l --hidden -g "" --ignore .git' + fi fi diff --git a/plugins/git/README.md b/plugins/git/README.md index 113080874..b9af3488f 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -130,6 +130,7 @@ plugins=(... git) | grbd | git rebase $(git_develop_branch) | | grbi | git rebase -i | | grbm | git rebase $(git_main_branch) | +| grbom | git rebase origin/$(git_main_branch) | | grbo | git rebase --onto | | grbs | git rebase --skip | | grev | git revert | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5a3c98287..648fa0a33 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -251,6 +251,7 @@ alias grbc='git rebase --continue' alias grbd='git rebase $(git_develop_branch)' alias grbi='git rebase -i' alias grbm='git rebase $(git_main_branch)' +alias grbom='git rebase origin/$(git_main_branch)' alias grbo='git rebase --onto' alias grbs='git rebase --skip' alias grev='git revert' diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index 4497a294f..f7b09b2c1 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -3383,7 +3383,7 @@ _git_worktree () # Here we are not completing an --option, it's either the # path or a ref. case "$prev" in - -b|-B) # Complete refs for branch to be created/reseted. + -b|-B) # Complete refs for branch to be created/reset. __git_complete_refs ;; -*) # The previous word is an -o|--option without an diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh index 11777738c..ddc257428 100644 --- a/plugins/grails/grails.plugin.zsh +++ b/plugins/grails/grails.plugin.zsh @@ -1,5 +1,5 @@ _enumerateGrailsScripts() { - # Default directoryies + # Default directories directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts) # Check all of the plugins directories, if they exist diff --git a/plugins/grunt/grunt.plugin.zsh b/plugins/grunt/grunt.plugin.zsh index 3f9695177..a89469a59 100644 --- a/plugins/grunt/grunt.plugin.zsh +++ b/plugins/grunt/grunt.plugin.zsh @@ -82,7 +82,7 @@ function __grunt() { update_msg=' (cache updated)' fi - # Make optioins completion. + # Make options completion. if [[ ${#__grunt_opts} -gt 0 ]]; then opts+=("${__grunt_opts[@]}") fi @@ -161,7 +161,7 @@ function __grunt_update_cache() { fi if [[ $is_updating -ne 0 ]]; then - # Update caceh. + # Update cache. __grunt_version=$version __grunt_gruntfile=$gruntfile is_updating=1 diff --git a/plugins/heroku/heroku.plugin.zsh b/plugins/heroku/heroku.plugin.zsh index 9a99b4211..d22c1bb2f 100644 --- a/plugins/heroku/heroku.plugin.zsh +++ b/plugins/heroku/heroku.plugin.zsh @@ -1,9 +1,9 @@ -HEROKU_AC_CACHE_DIR="$HOME/.cache" -if [ "$(uname -s)" = "Darwin" ]; then - HEROKU_AC_CACHE_DIR="$HOME/Library/Caches" +if [[ "$OSTYPE" = darwin* ]]; then + cache_dir="${HOME}/Library/Caches" +else + cache_dir="${XDG_CACHE_HOME:-"${HOME}/.cache"}" fi -if [ ! -z "$XDG_CACHE_HOME" ]; then - HEROKU_AC_CACHE_DIR="$XDG_CACHE_DIR" -fi -HEROKU_AC_ZSH_SETUP_PATH=$HEROKU_AC_CACHE_DIR/heroku/autocomplete/zsh_setup -[ -f $HEROKU_AC_ZSH_SETUP_PATH ] && source $HEROKU_AC_ZSH_SETUP_PATH + +setup_path="${cache_dir}/heroku/autocomplete/zsh_setup" +[[ -f "$setup_path" ]] && source $setup_path +unset cache_dir setup_path diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index a791cc4da..c326778d4 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -243,8 +243,8 @@ _history-substring-search-begin() { fi # - # Escape and join query parts with wildcard character '*' as seperator - # `(j:CHAR:)` join array to string with CHAR as seperator + # Escape and join query parts with wildcard character '*' as separator + # `(j:CHAR:)` join array to string with CHAR as separator # local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" diff --git a/plugins/hitokoto/hitokoto.plugin.zsh b/plugins/hitokoto/hitokoto.plugin.zsh index 8646ebf3b..e346d18c5 100644 --- a/plugins/hitokoto/hitokoto.plugin.zsh +++ b/plugins/hitokoto/hitokoto.plugin.zsh @@ -1,14 +1,18 @@ if ! (( $+commands[curl] )); then - echo "hitokoto plugin needs curl to work" >&2 - return + echo "hitokoto plugin needs curl to work" >&2 + return fi function hitokoto { - emulate -L zsh - Q=$(curl -s --connect-timeout 2 "https://v1.hitokoto.cn" | jq -j '.hitokoto+"\t"+.from') + setopt localoptions nopromptsubst - TXT=$(echo "$Q" | awk -F '\t' '{print $1}') - WHO=$(echo "$Q" | awk -F '\t' '{print $2}') + # Get hitokoto data + local -a data + data=("${(ps:\n:)"$(command curl -s --connect-timeout 2 "https://v1.hitokoto.cn" | command jq -j '.hitokoto+"\n"+.from')"}") - [[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”" + # Exit if could not fetch hitokoto + [[ -n "$data" ]] || return 0 + + local quote="${data[1]}" author="${data[2]}" + print -P "%F{3}${author}%f: “%F{5}${quote}%f”" } diff --git a/plugins/ipfs/_ipfs b/plugins/ipfs/_ipfs index 9ee8bd79c..90c0a61c8 100644 --- a/plugins/ipfs/_ipfs +++ b/plugins/ipfs/_ipfs @@ -596,7 +596,7 @@ case $MAIN_SUBCOMMAND in '(-v --headers)'{-v,--headers}'[Print table headers (Hash, Size, Name).]' \ '--resolve-type[Resolve linked objects to find out their types. Default: true.]' \ '--size[Resolve linked objects to find out their file size. Default: true.]' \ - '(-s --stream)'{-s,--stream}'[Enable exprimental streaming of directory entries as they are traversed.]' \ + '(-s --stream)'{-s,--stream}'[Enable experimental streaming of directory entries as they are traversed.]' \ ;; (mount) _arguments \ diff --git a/plugins/istioctl/README.md b/plugins/istioctl/README.md new file mode 100644 index 000000000..afd4d293c --- /dev/null +++ b/plugins/istioctl/README.md @@ -0,0 +1,9 @@ +# Istioctl - Istio Command-line Tool + +The [istioctl](https://istio.io/latest/docs/ops/diagnostic-tools/istioctl/) tool is a configuration command line utility that allows service operators to debug and diagnose their Istio service mesh deployments. + +To use it, add `istioctl` to the plugins array of your zshrc file: + +```sh +plugins=(... istioctl) +``` diff --git a/plugins/istioctl/istioctl.plugin.zsh b/plugins/istioctl/istioctl.plugin.zsh new file mode 100644 index 000000000..13ead1b2b --- /dev/null +++ b/plugins/istioctl/istioctl.plugin.zsh @@ -0,0 +1,4 @@ +if [ $commands[istioctl] ]; then + source <(istioctl completion zsh) + compdef _istioctl istioctl +fi diff --git a/plugins/iterm2/iterm2.plugin.zsh b/plugins/iterm2/iterm2.plugin.zsh index e4ac72ee3..9d8e40bf6 100644 --- a/plugins/iterm2/iterm2.plugin.zsh +++ b/plugins/iterm2/iterm2.plugin.zsh @@ -8,7 +8,7 @@ if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then ### - # Executes an arbitrary iTerm2 command via an escape code sequce. + # Executes an arbitrary iTerm2 command via an escape code sequence. # See https://iterm2.com/documentation-escape-codes.html for all supported commands. # Example: $ _iterm2_command "1337;StealFocus" function _iterm2_command() { diff --git a/plugins/jenv/README.md b/plugins/jenv/README.md index c043c626e..148794197 100644 --- a/plugins/jenv/README.md +++ b/plugins/jenv/README.md @@ -1,6 +1,6 @@ # jenv plugin -[jenv](https://www.jenv.be/) is a Java version manager similiar to [rbenv](https://github.com/rbenv/rbenv) +[jenv](https://www.jenv.be/) is a Java version manager similar to [rbenv](https://github.com/rbenv/rbenv) and [pyenv](https://github.com/yyuu/pyenv). This plugin initializes jenv and provides the `jenv_prompt_info` function to add Java diff --git a/plugins/jfrog/jfrog.plugin.zsh b/plugins/jfrog/jfrog.plugin.zsh index 064ffa2db..1441bc107 100644 --- a/plugins/jfrog/jfrog.plugin.zsh +++ b/plugins/jfrog/jfrog.plugin.zsh @@ -7,4 +7,5 @@ _jfrog() { fi } -compdef _jfrog jfrog
\ No newline at end of file +compdef _jfrog jfrog +compdef _jfrog jf diff --git a/plugins/kn/README.md b/plugins/kn/README.md new file mode 100644 index 000000000..d2eb9b31d --- /dev/null +++ b/plugins/kn/README.md @@ -0,0 +1,17 @@ +# kn - Knative CLI + +This plugin provides autocompletion for [kn](https://knative.dev/docs/install/client/install-kn/) operations. + +To use it, add `kn` to the plugins array of your zshrc file: + +```zsh +plugins=(... kn) +``` + +## See Also + ++ [kn/client](https://github.com/knative/client) + +## Contributors + ++ [btannous](https://github.com/btannous) - Plugin Author diff --git a/plugins/kn/kn.plugin.zsh b/plugins/kn/kn.plugin.zsh new file mode 100644 index 000000000..f60177dd9 --- /dev/null +++ b/plugins/kn/kn.plugin.zsh @@ -0,0 +1,8 @@ +# Autocompletion for kn, the command line interface for knative +# +# Author: https://github.com/btannous + +if [ $commands[kn] ]; then + source <(kn completion zsh) + compdef _kn kn +fi diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh index 4bcbbaead..6a91be336 100644 --- a/plugins/macos/macos.plugin.zsh +++ b/plugins/macos/macos.plugin.zsh @@ -1,9 +1,3 @@ -# Check if 'osx' is still in the plugins list and prompt to change to 'macos' -if [[ -n "${plugins[(r)osx]}" ]]; then - print ${(%):-"%F{yellow}The \`osx\` plugin is deprecated and has been renamed to \`macos\`."} - print ${(%):-"Please update your .zshrc to use the \`%Bmacos%b\` plugin instead.%f"} -fi - # Open the current directory in a Finder window alias ofd='open_command $PWD' diff --git a/plugins/macos/osx.plugin.zsh b/plugins/macos/osx.plugin.zsh deleted file mode 120000 index 73d718d43..000000000 --- a/plugins/macos/osx.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -macos.plugin.zsh
\ No newline at end of file diff --git a/plugins/macos/spotify b/plugins/macos/spotify index 663215a74..491a60686 100644 --- a/plugins/macos/spotify +++ b/plugins/macos/spotify @@ -191,7 +191,7 @@ while [ $# -gt 0 ]; do -d "grant_type=client_credentials" \ ) if ! [[ "${SPOTIFY_TOKEN_RESPONSE_DATA}" =~ "access_token" ]]; then - cecho "Autorization failed, please check ${USER_CONFG_FILE}" + cecho "Authorization failed, please check ${USER_CONFG_FILE}" cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}" showAPIHelp return 1 diff --git a/plugins/mercurial/README.md b/plugins/mercurial/README.md index 756964896..19d4a17b1 100644 --- a/plugins/mercurial/README.md +++ b/plugins/mercurial/README.md @@ -11,27 +11,29 @@ plugins=(... mercurial) ## Aliases -| Alias | Command | -|--------|-------------------------------------------------------------------------------------------------------------| -| `hga` | `hg add` | -| `hgc` | `hg commit` | -| `hgca` | `hg commit --amend` | -| `hgb` | `hg branch` | -| `hgba` | `hg branches` | -| `hgbk` | `hg bookmarks` | -| `hgco` | `hg checkout` | -| `hgd` | `hg diff` | -| `hged` | `hg diffmerge` | -| `hgp` | `hg push` | -| `hgs` | `hg status` | -| `hgsl` | `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"` | -| `hgun` | `hg resolve --list` | -| `hgi` | `hg incoming` | -| `hgl` | `hg pull -u` | -| `hglr` | `hg pull --rebase` | -| `hgo` | `hg outgoing` | -| `hglg` | `hg log --stat -v` | -| `hglgp`| `hg log --stat -p -v` | +| Alias | Command | +| ------- | ------------------------------------------- | +| `hga` | `hg add` | +| `hgc` | `hg commit` | +| `hgca` | `hg commit --amend` | +| `hgci` | `hg commit --interactive` | +| `hgb` | `hg branch` | +| `hgba` | `hg branches` | +| `hgbk` | `hg bookmarks` | +| `hgco` | `hg checkout` | +| `hgd` | `hg diff` | +| `hged` | `hg diffmerge` | +| `hgp` | `hg push` | +| `hgs` | `hg status` | +| `hgsl` | `hg log --limit 20 --template "<template>"` | +| `hgun` | `hg resolve --list` | +| `hgi` | `hg incoming` | +| `hgl` | `hg pull -u` | +| `hglr` | `hg pull --rebase` | +| `hgo` | `hg outgoing` | +| `hglg` | `hg log --stat -v` | +| `hglgp` | `hg log --stat -p -v` | + ## Prompt usage - Switch to a theme which uses `hg_prompt_info` @@ -61,7 +63,7 @@ ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})" This is the same as git plugin does. **Note**: additional changes to `.zshrc`, or using a theme designed to use `hg_prompt_info`, are required in order for this to work. -## Mantainers +## Maintainers - [ptrv](https://github.com/ptrv): original creator - [oshybystyi](https://github.com/oshybystyi) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index e098664c0..9b85d02f6 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -2,6 +2,7 @@ alias hga='hg add' alias hgc='hg commit' alias hgca='hg commit --amend' +alias hgci='hg commit --interactive' alias hgb='hg branch' alias hgba='hg branches' alias hgbk='hg bookmarks' @@ -10,7 +11,7 @@ alias hgd='hg diff' alias hged='hg diffmerge' alias hgp='hg push' alias hgs='hg status' -alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"' +alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|person}: {desc|strip|firstline}\n" ' alias hgun='hg resolve --list' # pull and update alias hgi='hg incoming' @@ -20,55 +21,98 @@ alias hgo='hg outgoing' alias hglg='hg log --stat -v' alias hglgp='hg log --stat -p -v' +function hgic() { + hg incoming "$@" | grep "changeset" | wc -l +} + +function hgoc() { + hg outgoing "$@" | grep "changeset" | wc -l +} + +# functions +function hg_root() { + local dir="$PWD" + while [[ "$dir" != "/" ]]; do + if [[ -d "$dir/.hg" ]]; then + echo "$dir" + return 0 + fi + dir="${dir:h}" + done + return 1 +} + function in_hg() { - if $(hg branch > /dev/null 2>&1); then - echo 1 - fi + hg_root >/dev/null } function hg_get_branch_name() { - branch=`hg branch 2>/dev/null` - if [ $? -eq 0 ]; then - echo $branch + local dir + if ! dir=$(hg_root); then + return fi - unset branch -} -function hg_prompt_info { - _DISPLAY=`hg branch 2>/dev/null` - if [ $? -eq 0 ]; then - echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\ -$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR" + if [[ ! -f "$dir/.hg/branch" ]]; then + echo default + return fi - unset _DISPLAY + + echo "$(<"$dir/.hg/branch")" } -function hg_dirty_choose { - hg status -mar 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]' - if [ $? -eq 0 ]; then - if [ $pipestatus[-1] -eq 0 ]; then - # Grep exits with 0 when "One or more lines were selected", return "dirty". - echo $1 - return - fi +function hg_get_bookmark_name() { + local dir + if ! dir=$(hg_root); then + return fi - echo $2 -} -function hg_dirty { - hg_dirty_choose $ZSH_THEME_HG_PROMPT_DIRTY $ZSH_THEME_HG_PROMPT_CLEAN -} + if [[ ! -f "$dir/.hg/bookmarks.current" ]]; then + return + fi -function hgic() { - hg incoming "$@" | grep "changeset" | wc -l + echo "$(<"$dir/.hg/bookmarks.current")" } -function hgoc() { - hg outgoing "$@" | grep "changeset" | wc -l +function hg_prompt_info { + local dir branch dirty + if ! dir=$(hg_root); then + return + fi + + if [[ ! -f "$dir/.hg/branch" ]]; then + branch=default + else + branch="$(<"$dir/.hg/branch")" + fi + + dirty="$(hg_dirty)" + + echo "${ZSH_THEME_HG_PROMPT_PREFIX}${branch:gs/%/%%}${dirty}${ZSH_THEME_HG_PROMPT_SUFFIX}" } -function hg_get_bookmark_name() { - if [ $(in_hg) ]; then - echo $(hg id -B) +function hg_dirty { + # Do nothing if clean / dirty settings aren't defined + if [[ -z "$ZSH_THEME_HG_PROMPT_DIRTY" && -z "$ZSH_THEME_HG_PROMPT_CLEAN" ]]; then + return + fi + + # Check if there are modifications + local hg_status + if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" = true ]]; then + if ! hg_status="$(hg status -q 2>/dev/null)"; then + return + fi + else + if ! hg_status="$(hg status 2>/dev/null)"; then + return + fi fi + + # grep exits with 0 when dirty + if command grep -Eq '^\s*[ACDIMR!?L].*$' <<< "$hg_status"; then + echo $ZSH_THEME_HG_PROMPT_DIRTY + return + fi + + echo $ZSH_THEME_HG_PROMPT_CLEAN } diff --git a/plugins/npm/README.md b/plugins/npm/README.md index 47d153619..e970c3c7a 100644 --- a/plugins/npm/README.md +++ b/plugins/npm/README.md @@ -10,7 +10,7 @@ plugins=(... npm) ## Aliases -| Alias | Command | Descripton | +| Alias | Command | Description | |:------ |:-----------------------------|:----------------------------------------------------------------| | `npmg` | `npm i -g` | Install dependencies globally | | `npmS` | `npm i -S` | Install and save to dependencies in your package.json | diff --git a/plugins/operator-sdk/README.md b/plugins/operator-sdk/README.md new file mode 100644 index 000000000..3336e36ef --- /dev/null +++ b/plugins/operator-sdk/README.md @@ -0,0 +1,11 @@ +# Operator SDK + +[Operator SDK](https://sdk.operatorframework.io/) is a component of the Operator Framework, an open source toolkit to manage Kubernetes native applications, called Operators, in an effective, automated, and scalable way. + +To use it, add `operator-sdk` to the plugins array of your zshrc file: + +```sh +plugins=(... operator-sdk) +``` + + diff --git a/plugins/operator-sdk/operator-sdk.plugin.zsh b/plugins/operator-sdk/operator-sdk.plugin.zsh new file mode 100644 index 000000000..baeb01a80 --- /dev/null +++ b/plugins/operator-sdk/operator-sdk.plugin.zsh @@ -0,0 +1,4 @@ +if [ $commands[operator-sdk] ]; then + source <(operator-sdk completion zsh) + compdef _operator-sdk operator-sdk +fi diff --git a/plugins/osx b/plugins/osx deleted file mode 120000 index a8d0f9c48..000000000 --- a/plugins/osx +++ /dev/null @@ -1 +0,0 @@ -macos
\ No newline at end of file diff --git a/plugins/osx/README.md b/plugins/osx/README.md new file mode 100644 index 000000000..98d859545 --- /dev/null +++ b/plugins/osx/README.md @@ -0,0 +1,3 @@ +# osx plugin + +**Deprecated: use the [`macos`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/macos) plugin instead.** diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh new file mode 100644 index 000000000..9304e7f32 --- /dev/null +++ b/plugins/osx/osx.plugin.zsh @@ -0,0 +1,5 @@ +print ${(%):-'%F{yellow}The `osx` plugin is deprecated and has been renamed to `macos`.'} +print ${(%):-'Please update your .zshrc to use the `%Bmacos%b` plugin instead.%f'} + +(( ${fpath[(Ie)$ZSH/plugins/macos]} )) || fpath=("$ZSH/plugins/macos" $fpath) +source "$ZSH/plugins/macos/macos.plugin.zsh" diff --git a/plugins/pep8/_pep8 b/plugins/pep8/_pep8 index ce19951dc..27b7fc544 100644 --- a/plugins/pep8/_pep8 +++ b/plugins/pep8/_pep8 @@ -29,6 +29,6 @@ _arguments -s -S \ "--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \ "--format[set the error format \[default|pylint|<custom>\]]::format:_files" \ "--diff[report only lines changed according to the unified diff received on STDIN]" \ - "--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) llowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \ + "--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) allowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \ "--config[user config file location (default: /home/gsemet/.config/pep8)]::path:_files" \ "*::args:_files" diff --git a/plugins/percol/README.md b/plugins/percol/README.md index ec5de4f86..78c881f55 100644 --- a/plugins/percol/README.md +++ b/plugins/percol/README.md @@ -1,20 +1,23 @@ -## percol +# percol -Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) +Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and +the [jump plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/jump), optionally. -### Requirements +To use it, add `percol` to the plugins array in your zshrc: -```shell -pip install percol +```zsh +plugins=(... percol) ``` -And [jump](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement. +## Requirements -### Usage +- `percol`: install with `pip install percol`. -For default +- (_Optional_) [`jump`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/jump) plugin: needs to be + enabled before the `percol` plugin. -- `^-r` bind to `percol_select_history`.You can use it to grep your history with percol. +## Usage -- `^-b` bind to `percol_select_marks`.You can use it to grep your bookmarks with percol. +- <kbd>CTRL-R</kbd> (bound to `percol_select_history`): you can use it to grep your history with percol. +- <kbd>CTRL-B</kbd> (bound to `percol_select_marks`): you can use it to grep your jump bookmarks with percol. diff --git a/plugins/percol/percol.plugin.zsh b/plugins/percol/percol.plugin.zsh index c6adf4e1e..b78383eee 100644 --- a/plugins/percol/percol.plugin.zsh +++ b/plugins/percol/percol.plugin.zsh @@ -1,22 +1,25 @@ -if which percol &> /dev/null; then - function percol_select_history() { - local tac - which gtac &> /dev/null && tac="gtac" || { which tac &> /dev/null && tac="tac" || { tac="tail -r" } } - BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER") - CURSOR=$#BUFFER - zle -R -c - } +(( ${+commands[percol]} )) || return - zle -N percol_select_history - bindkey '^R' percol_select_history +function percol_select_history() { + # print history in reverse order (from -1 (latest) to 1 (oldest)) + BUFFER=$(fc -l -n -1 1 | percol --query "$LBUFFER") + CURSOR=$#BUFFER + zle -R -c +} +zle -N percol_select_history +bindkey -M emacs '^R' percol_select_history +bindkey -M viins '^R' percol_select_history +bindkey -M vicmd '^R' percol_select_history - if which marks &> /dev/null; then - function percol_select_marks() { - BUFFER=$(marks | percol --query "$LBUFFER" | awk '{print $3}') - CURSOR=$#BUFFER # move cursor - zle -R -c # refresh - } - zle -N percol_select_marks - bindkey '^B' percol_select_marks - fi +if (( ${+functions[marks]} )); then + function percol_select_marks() { + # parse directory from marks output (markname -> path) and quote if necessary + BUFFER=${(q)"$(marks | percol --query "$LBUFFER")"##*-> } + CURSOR=$#BUFFER + zle -R -c + } + zle -N percol_select_marks + bindkey -M emacs '^B' percol_select_marks + bindkey -M viins '^B' percol_select_marks + bindkey -M vicmd '^B' percol_select_marks fi diff --git a/plugins/please/README.md b/plugins/please/README.md index 89bfbf105..0a33f897b 100644 --- a/plugins/please/README.md +++ b/plugins/please/README.md @@ -1,7 +1,7 @@ # please plugin [Please](https://please.build) is a cross-language build system with an emphasis on -high performance, extensibility and reproduceability. It supports a number of popular +high performance, extensibility and reproducibility. It supports a number of popular languages and can automate nearly any aspect of your build process. This plugin adds autocomplete and major aliases for `plz`, the command line tool for diff --git a/plugins/pm2/_pm2 b/plugins/pm2/_pm2 index 6f1e89df5..86412aef1 100644 --- a/plugins/pm2/_pm2 +++ b/plugins/pm2/_pm2 @@ -124,7 +124,7 @@ logs_options=( '--out[only shows standard output]' '--lines[output the last N lines, instead of the last 15 by default]' '--timestamp[add timestamps (default format YYYY-MM-DD-HH:mm:ss)]' - '--nostream[print logs without lauching the log stream]' + '--nostream[print logs without launching the log stream]' '(-h --help)'{-h,--help}'[output usage information]' $id_all_comp ) @@ -139,7 +139,7 @@ case "$words[1]" in stop|restart|delete|reload|reset) _arguments $id_all_comp && return 0 ;; - env|inspect|monitor|unmonitor|discribe) + env|inspect|monitor|unmonitor|describe) _arguments $id_comp && return 0 ;; deploy|startOrRestart|startOrReload) diff --git a/plugins/powify/_powify b/plugins/powify/_powify index 9507f400e..57042aa63 100644 --- a/plugins/powify/_powify +++ b/plugins/powify/_powify @@ -15,7 +15,7 @@ _1st_arguments=( 'restart:restarts the pow app linked to the current directory' 'always_restart:reload the pow app after each request' 'always_restart_off:do not reload the pow app after each request' - 'rename:rename the current pow app to [NAME] or renmae [OLD] to [NEW]' + 'rename:rename the current pow app to [NAME] or rename [OLD] to [NEW]' 'environment:run the this pow app in a different environment (aliased `env`)' 'browse:opens and navigates the default browser to this app' 'logs:tail the application logs' diff --git a/plugins/rake/rake.plugin.zsh b/plugins/rake/rake.plugin.zsh index 121150017..3ceb20fea 100644 --- a/plugins/rake/rake.plugin.zsh +++ b/plugins/rake/rake.plugin.zsh @@ -2,7 +2,7 @@ # over the years. We will miss you dearly. alias jimweirich="rake" -alias rake="noglob rake" # allows square brackts for rake task invocation +alias rake="noglob rake" # allows square brackets for rake task invocation alias brake='noglob bundle exec rake' # execute the bundled rake gem alias srake='noglob sudo rake' # noglob must come before sudo alias sbrake='noglob sudo bundle exec rake' # altogether now ... diff --git a/plugins/rand-quote/rand-quote.plugin.zsh b/plugins/rand-quote/rand-quote.plugin.zsh index 371b997d3..23c21dc8f 100644 --- a/plugins/rand-quote/rand-quote.plugin.zsh +++ b/plugins/rand-quote/rand-quote.plugin.zsh @@ -1,14 +1,23 @@ if ! (( $+commands[curl] )); then - echo "rand-quote plugin needs curl to work" >&2 - return + echo "rand-quote plugin needs curl to work" >&2 + return fi function quote { - emulate -L zsh - Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ") + setopt localoptions nopromptsubst - TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g') - WHO=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g') + # Get random quote data + local data + data="$(command curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" \ + | iconv -c -f ISO-8859-1 -t UTF-8 \ + | command grep -a -m 1 'dt class="quote"')" - [[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”" + # Exit if could not fetch random quote + [[ -n "$data" ]] || return 0 + + local quote author + quote=$(sed -e 's|</dt>.*||g' -e 's|.*html||g' -e 's|^[^a-zA-Z]*||' -e 's|</a..*$||g' <<< "$data") + author=$(sed -e 's|.*/quotes/||g' -e 's|<.*||g' -e 's|.*">||g' <<< "$data") + + print -P "%F{3}${author}%f: “%F{5}${quote}%f”" } diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index 0f2d366e2..d758aebae 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -4,65 +4,65 @@ FOUND_RBENV=$+commands[rbenv] if [[ $FOUND_RBENV -ne 1 ]]; then - rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv") - for dir in $rbenvdirs; do - if [[ -d $dir/bin ]]; then - export PATH="$dir/bin:$PATH" - FOUND_RBENV=1 - break - fi - done + rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv") + for dir in $rbenvdirs; do + if [[ -d $dir/bin ]]; then + export PATH="$dir/bin:$PATH" + FOUND_RBENV=1 + break + fi + done fi if [[ $FOUND_RBENV -ne 1 ]]; then - if (( $+commands[brew] )) && dir=$(brew --prefix rbenv 2>/dev/null); then - if [[ -d $dir/bin ]]; then - export PATH="$dir/bin:$PATH" - FOUND_RBENV=1 - fi + if (( $+commands[brew] )) && dir=$(brew --prefix rbenv 2>/dev/null); then + if [[ -d $dir/bin ]]; then + export PATH="$dir/bin:$PATH" + FOUND_RBENV=1 fi + fi fi if [[ $FOUND_RBENV -eq 1 ]]; then - eval "$(rbenv init --no-rehash - zsh)" + eval "$(rbenv init --no-rehash - zsh)" - alias rubies="rbenv versions" - alias gemsets="rbenv gemset list" + alias rubies="rbenv versions" + alias gemsets="rbenv gemset list" - function current_ruby() { - echo "$(rbenv version-name)" - } + function current_ruby() { + echo "$(rbenv version-name)" + } - function current_gemset() { - echo "$(rbenv gemset active 2>/dev/null)" | tr ' ' '+' - } + function current_gemset() { + echo "$(rbenv gemset active 2>/dev/null)" | tr ' ' '+' + } - function gems() { - local rbenv_path=$(rbenv prefix) - gem list $@ | sed -E \ - -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ - -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ - -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ - -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" - } + function gems() { + local rbenv_path=$(rbenv prefix) + gem list $@ | sed -E \ + -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ + -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" + } - function rbenv_prompt_info() { - local ruby=$(current_ruby) gemset=$(current_gemset) - echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}" - [[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}" - echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}" - } + function rbenv_prompt_info() { + local ruby=${$(current_ruby):gs/%/%%} gemset=${$(current_gemset):gs/%/%%} + echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}" + [[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}" + echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}" + } else - alias rubies="ruby -v" - function gemsets() { echo "not supported" } - function current_ruby() { echo "not supported" } - function current_gemset() { echo "not supported" } - function gems() { echo "not supported" } - function rbenv_prompt_info() { - echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}" - echo -n "system: $(ruby -v | cut -f-2 -d ' ')" - echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}" - } + alias rubies="ruby -v" + function gemsets() { echo "not supported" } + function current_ruby() { echo "not supported" } + function current_gemset() { echo "not supported" } + function gems() { echo "not supported" } + function rbenv_prompt_info() { + echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}" + echo -n "system: $(ruby -v | cut -f-2 -d ' ' | sed 's/%/%%/g')" + echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}" + } fi unset FOUND_RBENV rbenvdirs dir diff --git a/plugins/rbfu/README.md b/plugins/rbfu/README.md index f1f9fa2f7..fbcab64de 100644 --- a/plugins/rbfu/README.md +++ b/plugins/rbfu/README.md @@ -4,6 +4,7 @@ This plugin starts [rbfu](https://github.com/hmans/rbfu), a minimal Ruby version manager, and adds some useful functions. To use it, add `rbfu` to the plugins array in your zshrc file: + ```zsh plugins=(... rbfu) ``` diff --git a/plugins/rbfu/rbfu.plugin.zsh b/plugins/rbfu/rbfu.plugin.zsh index 008485205..27dc3eec6 100644 --- a/plugins/rbfu/rbfu.plugin.zsh +++ b/plugins/rbfu/rbfu.plugin.zsh @@ -5,38 +5,45 @@ # rvm_prompt_info function to return the $RBFU_RUBY_VERSION # version. -command -v rbfu &>/dev/null - -if [[ $? -eq 0 ]]; then - eval "$(rbfu --init --auto)" - - # Internal: Print ruby version details, if it's currently - # active etc. - function _rbfu_rubies_print() { - local rb rb_out - rb=$(basename $1) - rb_out="$rb" - [[ -h $1 ]] && rb_out="$rb_out${fg[green]}@${reset_color}" - [[ "x$rb" == "x$2" ]] && rb_out="${fg[red]}$rb_out ${fg[red]}*${reset_color}" - echo $rb_out - } - - # Public: Provide a list with all available rubies, this basically depends - # on `ls -1` and .rfbu/rubies. Highlights the currently active ruby version - # and aliases. - function rbfu-rubies() { - local rbfu_dir active_rb - rbfu_dir=$RBFU_RUBIES - active_rb=$RBFU_RUBY_VERSION - [[ -z "$rbfu_dir" ]] && rbfu_dir="${HOME}/.rbfu/rubies" - [[ -z "$active_rb" ]] && active_rb="system" - _rbfu_rubies_print "${rbfu_dir}/system" $active_rb - for rb in $(ls -1 $rbfu_dir); do - _rbfu_rubies_print "${rbfu_dir}/${rb}" $active_rb - done - } - - # Public: Create rvm_prompt_info command for themes compatibility, unless - # it has already been defined. - [ ! -x rvm_prompt_info ] && function rvm_prompt_info() { echo "${RBFU_RUBY_VERSION:=system}" } -fi +command -v rbfu &>/dev/null || return + +eval "$(rbfu --init --auto)" + +# Internal: Print ruby version details, if it's currently active, etc. +function _rbfu_rubies_print() { + # 1: path to ruby file + # 2: active ruby + local rb rb_out + rb="${$1:t}" + rb_out="$rb" + + # If the ruby is a symlink, add @ to the name. + if [[ -h "$1" ]]; then + rb_out="${rb_out}${fg[green]}@${reset_color}" + fi + + # If the ruby is active, add * to the name and show it in red. + if [[ "$rb" = "$2" ]]; then + rb_out="${fg[red]}${rb_out} ${fg[red]}*${reset_color}" + fi + + echo $rb_out +} + +# Public: Provide a list with all available rubies, this basically depends +# on ~/.rfbu/rubies. Highlights the currently active ruby version and aliases. +function rbfu-rubies() { + local rbfu_dir active_rb + rbfu_dir="${RBFU_RUBIES:-${HOME}/.rbfu/rubies}" + active_rb="${RBFU_RUBY_VERSION:-system}" + + _rbfu_rubies_print "${rbfu_dir}/system" "$active_rb" + for rb in ${rbfu_dir}/*(N); do + _rbfu_rubies_print "$rb" "$active_rb" + done +} + +# Public: Create rvm_prompt_info command for themes compatibility, unless +# it has already been defined. +(( ${+functions[rvm_prompt_info]} )) || \ +function rvm_prompt_info() { echo "${${RBFU_RUBY_VERSION:=system}:gs/%/%%}" } diff --git a/plugins/rebar/_rebar b/plugins/rebar/_rebar index 7ac5a510c..ea0d8a674 100644 --- a/plugins/rebar/_rebar +++ b/plugins/rebar/_rebar @@ -32,7 +32,7 @@ _rebar () { 'create[Create skel based on template and vars]' \ 'create-app[Create simple app skel]' \ 'create-node[Create simple node skel]' \ - 'list-template[List avaiavle templates]' \ + 'list-template[List available templates]' \ 'doc[Generate Erlang program documentation]' \ 'check-deps[Display to be fetched dependencies]' \ 'get-deps[Fetch dependencies]' \ diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli index 1569f2916..f93624565 100644 --- a/plugins/redis-cli/_redis-cli +++ b/plugins/redis-cli/_redis-cli @@ -8,7 +8,7 @@ _1st_arguments=( 'append:append a value to a key' 'auth:authenticate to the server' 'bgrewriteeaof:asynchronously rewrite the append-only file' - 'bgsave:asynchornously save the dataset to disk' + 'bgsave:asynchronously save the dataset to disk' 'blpop:remove and get the first element in a list, or block until one is available' 'brpop:remove and get the last element in a list, or block until one is available' 'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available' @@ -17,9 +17,9 @@ _1st_arguments=( # 'config resetstat: reset the stats returned by INFO' 'dbsize:return the number of keys in the selected database' # 'debug object:get debugging information about a key' - # 'debug setgfault:make the server crash' + # 'debug segfault:make the server crash' 'decr:decrement the integer value of a key by one' - 'decrby:decrement the integet value of a key by the given number' + 'decrby:decrement the integer value of a key by the given number' 'del:delete a key' 'discard:discard all commands issued after MULTI' 'echo:echo the given string' @@ -63,7 +63,7 @@ _1st_arguments=( 'mget:get the values of all the given keys' 'monitor:listen for all requests received by the server in real time' 'move:move a key to another database' - 'mset:set multiple keys to muliple values' + 'mset:set multiple keys to multiple values' 'msetnx:set multiple keys tom ultiple values, only if none of the keys exist' 'multi:mark the start of a transaction block' 'object:inspect the internals of Redis objects' @@ -122,7 +122,7 @@ _1st_arguments=( 'zrem:remove a member from a sorted set' 'zremrangebyrank:remove all members in a sorted set within the given indexes' 'zremrangebyscore:remove all members in a sorted set within the given scores' - 'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low' + 'zrevrange:return a range of members in a sorted set, by index, with scores ordered from high to low' 'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low' 'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low' 'zscore:get the score associated with the given member in a sorted set' diff --git a/plugins/rvm/README.md b/plugins/rvm/README.md index 1ed8d46a2..b0977f53a 100644 --- a/plugins/rvm/README.md +++ b/plugins/rvm/README.md @@ -18,3 +18,4 @@ plugins=(... rvm) | `rb21` | `rvm use ruby-2.1.2` | | `rvm-update` | `rvm get head` | | `gems` | `gem list` | +| `rvms` | `rvm gemset` | diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 53e809aaf..c5918f289 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,7 +1,8 @@ fpath=($rvm_path/scripts/zsh/Completion $fpath) alias rubies='rvm list rubies' -alias gemsets='rvm gemset list' +alias rvms='rvm gemset' +alias gemsets='rvms list' local ruby18='ruby-1.8.7' local ruby19='ruby-1.9.3' diff --git a/plugins/salt/_salt b/plugins/salt/_salt index 78d8611d2..a1c55f350 100644 --- a/plugins/salt/_salt +++ b/plugins/salt/_salt @@ -145,7 +145,7 @@ _master_options=( '(-v --verbose)'{-v,--verbose}'[Turn on command verbosity, display jid and active job queries]' '--hide-timeout[Hide minions that timeout]' '(-b --batch --batch-size)'{-b,--batch,--batch-size}'[Execute the salt job in batch mode, pass number or percentage to batch.]:Batch Size:' - '(-a --auth --eauth --extrenal-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:' + '(-a --auth --eauth --external-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:' '(-T --make-token)'{-T,--make-token}'[Generate and save an authentication token for re-use.]' '--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir/returners" -g "[^_]*.py(\:r)"' '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]' diff --git a/plugins/scala/_scala b/plugins/scala/_scala index f7511a647..ba7ac3874 100644 --- a/plugins/scala/_scala +++ b/plugins/scala/_scala @@ -190,7 +190,7 @@ Y_opts=( "-Yshow-symkinds[Print abbreviated symbol kinds next to symbol names]" "-Yshow-trees[Print detailed ASTs (requires -Xprint\:phase)]" "-Yshow-trees-compact[Print detailed ASTs in compact form (requires -Xprint\:)]" - "-Yshow-trees-stringified[Print stringifications along with detailed ASTs (requires -Xprint\:)]" + "-Yshow-trees-stringified[Print stringification along with detailed ASTs (requires -Xprint\:)]" "-Ystatistics[Print compiler statistics]" "-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)" diff --git a/plugins/scd/scd b/plugins/scd/scd index a7db6c265..7e9654b44 100755 --- a/plugins/scd/scd +++ b/plugins/scd/scd @@ -270,7 +270,7 @@ fi # Determine the last recorded directory if [[ -s ${SCD_HISTFILE} ]]; then - last_directory=${"$(tail -1 ${SCD_HISTFILE})"#*;} + last_directory=${"$(tail -n 1 ${SCD_HISTFILE})"#*;} fi # The "record" function adds its arguments to the directory index. diff --git a/plugins/sfdx/_sfdx b/plugins/sfdx/_sfdx index 42ee55970..3a441f257 100644 --- a/plugins/sfdx/_sfdx +++ b/plugins/sfdx/_sfdx @@ -900,7 +900,7 @@ case "$words[1]" in force:data:tree:export) _command_args=( '(-q|--query)'{-q,--query}'[soql query, or filepath of file containing a soql query, to retrieve records]' \ - '(-p|--plan)'{-p,--plan}'[generate mulitple sobject tree files and a plan definition file for aggregated import]' \ + '(-p|--plan)'{-p,--plan}'[generate multiple sobject tree files and a plan definition file for aggregated import]' \ '(-x|--prefix)'{-x,--prefix}'[prefix of generated files]' \ '(-d|--outputdir)'{-d,--outputdir}'[directory to store files]:file:_files' \ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ diff --git a/plugins/shell-proxy/README.md b/plugins/shell-proxy/README.md index 6f2cd13e0..b19888c56 100644 --- a/plugins/shell-proxy/README.md +++ b/plugins/shell-proxy/README.md @@ -1,42 +1,56 @@ -# Shell Proxy oh-my-zsh plugin +# shell-proxy plugin -This a pure user-space program, shell-proxy setter, written Python3 and Bash. +This a pure user-space program, shell-proxy setter, written in Python3 and Zsh. -100% only no side-effects, only effect **environment variables** and **aliases** +To use it, add `shell-proxy` to the plugins array in your zshrc file: -## Key feature +```zsh +plugins=(... shell-proxy) +``` + +## Key features -- Support Ubuntu, Archlinux, etc (Linux) -- Support macOS -- Support git via based-`$GIT_SSH` -- Support ssh, sftp, scp, slogin and ssh-copy-id via based-`alias` -- Built-in Auto-complete +- Supports macOS and Linux (Ubuntu, Archlinux, etc.) +- Supports git via setting `$GIT_SSH` +- Supports ssh, sftp, scp, slogin and ssh-copy-id via setting aliases +- Built-in autocomplete ## Usage -Method 1: +### Method 1 -`$DEFAULT_PROXY` is the proxy URL you will set +Set `SHELLPROXY_URL` environment variable to the URL of the proxy server: -Method 2: +```sh +SHELLPROXY_URL="http://127.0.0.1:8123" +proxy enable +``` -Write a program to `$HOME/.config/proxy` in the file. +### Method 2 -Example program: +Write a program file in `$HOME/.config/proxy` so that the proxy URL is defined dynamically. +Note that the program file must be executable. -```bash +Example: + +```sh #!/bin/bash -# The file path: $HOME/.config/proxy -if [[ "$OSTYPE" == "darwin"* ]]; then + +if [[ "$(uname)" = Darwin ]]; then echo "http://127.0.0.1:6152" # Surge Mac else echo "http://127.0.0.1:8123" # polipo fi ``` -Method 3: +### Method 3 -The working path of **Method 2** can be changed via `$CONFIG_PROXY` +Use [method 2](#method-2) but define the location of the program file by setting the +`SHELLPROXY_CONFIG` environment variable: + +```sh +SHELLPROXY_CONFIG="$HOME/.dotfiles/proxy-config" +``` ## Reference @@ -45,8 +59,4 @@ The working path of **Method 2** can be changed via `$CONFIG_PROXY` ## Maintainer -- <https://github.com/septs> - -## The oh-my-zsh plugin (shell-proxy) - -Public Domain +- [@septs](https://github.com/septs) diff --git a/plugins/shell-proxy/proxy.py b/plugins/shell-proxy/proxy.py index 97f4cf873..14f2944cc 100755 --- a/plugins/shell-proxy/proxy.py +++ b/plugins/shell-proxy/proxy.py @@ -5,16 +5,22 @@ from subprocess import check_output, list2cmdline cwd = os.path.dirname(__file__) ssh_agent = os.path.join(cwd, "ssh-agent.py") -user_proxy = os.environ.get("CONFIG_PROXY", os.path.expandvars("$HOME/.config/proxy")) +proxy_env = "SHELLPROXY_URL" +proxy_config = os.environ.get("SHELLPROXY_CONFIG") or os.path.expandvars("$HOME/.config/proxy") +usage="""shell-proxy: no proxy configuration found. + +Set `{env}` or create a config file at `{config}` +See the plugin README for more information.""".format(env=proxy_env, config=proxy_config) def get_http_proxy(): - default_proxy = os.environ.get("DEFAULT_PROXY") + default_proxy = os.environ.get(proxy_env) if default_proxy: return default_proxy - if os.path.isfile(user_proxy): - return check_output(user_proxy).decode("utf-8").strip() - raise Exception("Not found, Proxy configuration") + if os.path.isfile(proxy_config): + return check_output(proxy_config).decode("utf-8").strip() + print(usage, file=sys.stderr) + sys.exit(1) def make_proxies(url: str): @@ -53,8 +59,7 @@ class CommandSet: cmdline("echo", _) def usage(self): - cmdline("echo", "usage: proxy {enable,disable,status}") - self.status() + print("usage: proxy {enable,disable,status}", file=sys.stderr) def cmdline(*items): @@ -65,7 +70,7 @@ def main(): command = CommandSet() if len(sys.argv) == 1: command.usage() - sys.exit(-1) + sys.exit(1) getattr(command, sys.argv[1], command.usage)() diff --git a/plugins/shell-proxy/shell-proxy.plugin.zsh b/plugins/shell-proxy/shell-proxy.plugin.zsh index 315ade665..9d45b5269 100644 --- a/plugins/shell-proxy/shell-proxy.plugin.zsh +++ b/plugins/shell-proxy/shell-proxy.plugin.zsh @@ -1,16 +1,37 @@ #!/usr/bin/bash -# shellcheck disable=SC1090 - -__PROXY__="${0:A:h}/proxy.py" +# shellcheck disable=SC1090,SC2154 proxy() { - source <(env "DEFAULT_PROXY=$DEFAULT_PROXY" "$__PROXY__" "$1") + # deprecate $DEFAULT_PROXY, use SHELLPROXY_URL instead + if [[ -n "$DEFAULT_PROXY" && -z "$SHELLPROXY_URL" ]]; then + echo >&2 "proxy: DEFAULT_PROXY is deprecated, use SHELLPROXY_URL instead" + SHELLPROXY_URL="$DEFAULT_PROXY" + unset DEFAULT_PROXY + fi + + # deprecate CONFIG_PROXY, use SHELLPROXY_CONFIG instead + if [[ -n "$CONFIG_PROXY" && -z "$SHELLPROXY_CONFIG" ]]; then + echo >&2 "proxy: CONFIG_PROXY is deprecated, use SHELLPROXY_CONFIG instead" + SHELLPROXY_CONFIG="$CONFIG_PROXY" + unset CONFIG_PROXY + fi + + # the proxy.py script is in the same directory as this function + local proxy="${functions_source[$0]:A:h}/proxy.py" + + # capture the output of the proxy script and bail out if it fails + local output + output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" || + return $? + + # evaluate the output generated by the proxy script + source <(echo "$output") } _proxy() { - local -r commands=('enable' 'disable' 'status') - compset -P '*,' - compadd -S '' "${commands[@]}" + local -r commands=('enable' 'disable' 'status') + compset -P '*,' + compadd -S '' "${commands[@]}" } -compdef '_proxy' 'proxy' +compdef _proxy proxy diff --git a/plugins/sprunge/README.md b/plugins/sprunge/README.md index 28ed1834a..fb70d42eb 100644 --- a/plugins/sprunge/README.md +++ b/plugins/sprunge/README.md @@ -28,5 +28,5 @@ http://sprunge.us/XxjnKz - Sprunge accepts piped data, stdin redirection, text strings as input or filenames. Only one of these can be used at a time. - Argument precedence goes as follows: stdin > piped input > text strings. -- If a filename is mispelled or doesn't have the necessary path description, it will NOT +- If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but instead treat it as a text string. diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index 1d6914ec6..fa6a996d4 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -13,28 +13,24 @@ plugins=(... ssh-agent) **IMPORTANT: put these settings _before_ the line that sources oh-my-zsh** +### `agent-forwarding` + To enable **agent forwarding support** add the following to your zshrc file: ```zsh -zstyle :omz:plugins:ssh-agent agent-forwarding on +zstyle :omz:plugins:ssh-agent agent-forwarding yes ``` ----- +### `helper` -To **NOT load any identities on start** use the `lazy` setting. This is particularly -useful when combined with the `AddKeysToAgent` setting (available since OpenSSH 7.2), -since it allows to enter the password only on first use. _NOTE: you can know your -OpenSSH version with `ssh -V`._ +To set an **external helper** to ask for the passwords and possibly store +them in the system keychain use the `helper` style. For example: ```zsh -zstyle :omz:plugins:ssh-agent lazy yes +zstyle :omz:plugins:ssh-agent helper ksshaskpass ``` -You can enable `AddKeysToAgent` by passing `-o AddKeysToAgent=yes` to the `ssh` command, -or by adding `AddKeysToAgent yes` to your `~/.ssh/config` file [1]. -See the [OpenSSH 7.2 Release Notes](http://www.openssh.com/txt/release-7.2). - ----- +### `identities` To **load multiple identities** use the `identities` style (**this has no effect if the `lazy` setting is enabled**). For example: @@ -52,7 +48,22 @@ zstyle :omz:plugins:ssh-agent identities ~/.config/ssh/id_rsa ~/.config/ssh/id_r zstyle :omz:plugins:ssh-agent identities ~/.config/ssh/{id_rsa,id_rsa2,id_github} ``` ----- +### `lazy` + +To **NOT load any identities on start** use the `lazy` setting. This is particularly +useful when combined with the `AddKeysToAgent` setting (available since OpenSSH 7.2), +since it allows to enter the password only on first use. _NOTE: you can know your +OpenSSH version with `ssh -V`._ + +```zsh +zstyle :omz:plugins:ssh-agent lazy yes +``` + +You can enable `AddKeysToAgent` by passing `-o AddKeysToAgent=yes` to the `ssh` command, +or by adding `AddKeysToAgent yes` to your `~/.ssh/config` file [1]. +See the [OpenSSH 7.2 Release Notes](http://www.openssh.com/txt/release-7.2). + +### `lifetime` To **set the maximum lifetime of the identities**, use the `lifetime` style. The lifetime may be specified in seconds or as described in sshd_config(5) @@ -62,7 +73,15 @@ The lifetime may be specified in seconds or as described in sshd_config(5) zstyle :omz:plugins:ssh-agent lifetime 4h ``` ----- +### `quiet` + +To silence the plugin, use the following setting: + +```zsh +zstyle :omz:plugins:ssh-agent quiet yes +``` + +### `ssh-add-args` To **pass arguments to the `ssh-add` command** that adds the identities on startup, use the `ssh-add-args` setting. You can pass multiple arguments separated by spaces: @@ -80,15 +99,6 @@ ssh-add -K -c -a /run/user/1000/ssh-auth <identities> For valid `ssh-add` arguments run `ssh-add --help` or `man ssh-add`. ----- - -To set an **external helper** to ask for the passwords and possibly store -them in the system keychain use the `helper` style. For example: - -```zsh -zstyle :omz:plugins:ssh-agent helper ksshaskpass -``` - ## Credits Based on code from Joseph M. Reagle: https://www.cygwin.com/ml/cygwin/2001-06/msg00537.html diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 47dfef5b0..0d6a35b35 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -18,7 +18,7 @@ function _start_agent() { zstyle -s :omz:plugins:ssh-agent lifetime lifetime # start ssh-agent and setup environment - echo Starting ssh-agent... + zstyle -t :omz:plugins:ssh-agent quiet || echo >&2 "Starting ssh-agent ..." ssh-agent -s ${lifetime:+-t} ${lifetime} | sed '/^echo/d' >! "$ssh_env_cache" chmod 600 "$ssh_env_cache" . "$ssh_env_cache" > /dev/null @@ -78,7 +78,7 @@ function _add_identities() { if [[ -n "$helper" ]]; then if [[ -z "${commands[$helper]}" ]]; then - echo "ssh-agent: the helper '$helper' has not been found." + echo >&2 "ssh-agent: the helper '$helper' has not been found." else SSH_ASKPASS="$helper" ssh-add "${args[@]}" ${^not_loaded} < /dev/null return $? @@ -88,11 +88,9 @@ function _add_identities() { ssh-add "${args[@]}" ${^not_loaded} } -# test if agent-forwarding is enabled -zstyle -b :omz:plugins:ssh-agent agent-forwarding agent_forwarding - -# Add a nifty symlink for screen/tmux if agent forwarding -if [[ $agent_forwarding = "yes" && -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then +# Add a nifty symlink for screen/tmux if agent forwarding is enabled +if zstyle -t :omz:plugins:ssh-agent agent-forwarding \ + && [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen else _start_agent diff --git a/plugins/supervisor/_supervisorctl b/plugins/supervisor/_supervisorctl index 9f576c0c0..87cffab86 100644 --- a/plugins/supervisor/_supervisorctl +++ b/plugins/supervisor/_supervisorctl @@ -109,27 +109,27 @@ _supervisorctl_maintail() { _supervisorctl_start() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_restart] )) || _supervisorctl_restart() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_status] )) || _supervisorctl_status() { _arguments \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_stop] )) || _supervisorctl_stop() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_tail] )) || @@ -137,7 +137,7 @@ _supervisorctl_tail() { # TODO: add 'stderr' _arguments -s \ '-f[Continuous tail of named process stdout Ctrl-C to exit.]' \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } _supervisorctl "$@" diff --git a/plugins/supervisor/supervisor.plugin.zsh b/plugins/supervisor/supervisor.plugin.zsh index f11f0ed3f..ad5430275 100644 --- a/plugins/supervisor/supervisor.plugin.zsh +++ b/plugins/supervisor/supervisor.plugin.zsh @@ -1,4 +1,4 @@ -# DECLARION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor. +# DECLARATION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor. alias sup='sudo supervisorctl' alias supad='sudo supervisorctl add' diff --git a/plugins/suse/README.md b/plugins/suse/README.md index 06c6d9ef5..f37ec1695 100644 --- a/plugins/suse/README.md +++ b/plugins/suse/README.md @@ -62,7 +62,7 @@ plugins=(... suse) NOTE: `--no-refresh` is passed to zypper for speeding up the calls and avoid errors due to lack of root privileges. If you need to refresh the repositories, call `sudo zypper ref` (`zref` alias) -before runing these aliases. +before running these aliases. Related: [#9798](https://github.com/ohmyzsh/ohmyzsh/pull/9798). diff --git a/plugins/symfony2/README.md b/plugins/symfony2/README.md index 2946d0937..76233472f 100644 --- a/plugins/symfony2/README.md +++ b/plugins/symfony2/README.md @@ -17,7 +17,7 @@ plugins=(... symfony2) | `sfsr` | sf server:run | Run the dev server | | `sfcw` | sf cache:warmup | Use the Bundles warmer | | `sfroute` | sf debug:router | Show the different routes | -| `sfcontainer` | sf debug:contaner | List the different services | +| `sfcontainer` | sf debug:container | List the different services | | `sfgb` | sf generate:bundle | Generate a bundle | | `sfgc` | sf generate:controller | Generate a controller | | `sfgcom` | sf generate:command | Generate a command | diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md index 052fc6edc..146b58605 100644 --- a/plugins/systemadmin/README.md +++ b/plugins/systemadmin/README.md @@ -17,9 +17,9 @@ plugins=(... systemadmin) | path | `print -l $path` | Displays PATH with each entry on a separate line | | mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output | | psmem | `ps -e -orss=,args= \| sort -b -k1 -nr` | Display the processes using the most memory | -| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -10` | Display the top 10 processes using the most memory | +| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -n 10` | Display the top 10 processes using the most memory | | pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU | -| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU | +| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -n 10` | Display the top 10 processes using the most CPU | | hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history | ## Functions diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index a77f0069b..9a2129060 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -26,10 +26,10 @@ alias path='print -l $path' alias mkdir='mkdir -pv' # get top process eating memory alias psmem='ps -e -orss=,args= | sort -b -k1 -nr' -alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -10' -# get top process eating cpu if not work try excute : export LC_ALL='C' +alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10' +# get top process eating cpu if not work try execute : export LC_ALL='C' alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr' -alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -10' +alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -n 10' # top10 of the history alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' @@ -74,7 +74,7 @@ req20() { # top20 of Using tcpdump port 80 access to view http20() { - sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -20 + sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -n 20 } # top20 of Find time_wait connection @@ -99,14 +99,14 @@ accessip10() { # top20 of Most Visited file or page visitpage20() { - awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -20 + awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -n 20 } # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences consume100() { - awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100 - # if django website or other webiste make by no suffix language - # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100 + awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 + # if django website or other website make by no suffix language + # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 } # Website traffic statistics (G) diff --git a/plugins/terminitor/_terminitor b/plugins/terminitor/_terminitor index 1ce87c3ad..3615350e2 100644 --- a/plugins/terminitor/_terminitor +++ b/plugins/terminitor/_terminitor @@ -11,7 +11,7 @@ local -a _1st_arguments _1st_arguments=( 'create:create a Termfile in directory' 'delete:delete terminitor script' - 'edit:open termitor script' + 'edit:open terminitor script' 'fetch:clone the designated repo and run setup' 'help:Describe available tasks or one specific task' 'init:create initial root terminitor folder' diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md index 2ceaf1ad5..551814a39 100644 --- a/plugins/tmux/README.md +++ b/plugins/tmux/README.md @@ -39,3 +39,4 @@ The plugin also supports the following: | `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` | | `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) | | `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode | +| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled | diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index e52443a71..0ea3aa02a 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -76,7 +76,11 @@ function _zsh_tmux_plugin_run() { elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") fi - $tmux_cmd new-session + if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then + $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME + else + $tmux_cmd new-session + fi fi if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md index f72182f5c..9efef0732 100644 --- a/plugins/ubuntu/README.md +++ b/plugins/ubuntu/README.md @@ -19,7 +19,7 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other | acp | `apt-cache policy` | Display the package source priorities | | afs | `apt-file search --regexp` | Perform a regular expression apt-file search | | afu | `sudo apt-file update` | Generates or updates the apt-file package database | -| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded | +| aga | `sudo $APT autoclean` | Clears out the local repository of retrieved package files that can no longer be downloaded | | agb | `sudo $APT build-dep <source_pkg>` | Installs/Removes packages to satisfy the dependencies of a specified build pkg | | agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files | | agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation | diff --git a/plugins/vault/_vault b/plugins/vault/_vault index c5338dffa..f6bd3517e 100644 --- a/plugins/vault/_vault +++ b/plugins/vault/_vault @@ -53,7 +53,7 @@ mount_tune_args=( typeset -a mount_args mount_args=( $mount_tune_args - '(-path)-path=-[Mount point for the logical backend. This defauls to the type of the mount.]:path:' + '(-path)-path=-[Mount point for the logical backend. This defaults to the type of the mount.]:path:' '(-description)-description=-[Human-friendly description of the purpose for the mount. This shows up in the mounts command.]:description:' ) @@ -189,7 +189,7 @@ _vault_mounts() { } _vault_mount() { - # to find out how many types of backens are there + # to find out how many types of backends are there _arguments : \ ${general_args[@]} \ ${mount_args[@]} \ diff --git a/plugins/volta/README.md b/plugins/volta/README.md new file mode 100644 index 000000000..d5972d56c --- /dev/null +++ b/plugins/volta/README.md @@ -0,0 +1,11 @@ +# Volta + +This plugin provides completion for [Volta](https://volta.sh/). + +To use it add volta to the plugins array in your zshrc file. + +```bash +plugins=(... volta) +``` + +This plugin installs no aliases. diff --git a/plugins/volta/_volta b/plugins/volta/_volta new file mode 100644 index 000000000..295b80362 --- /dev/null +++ b/plugins/volta/_volta @@ -0,0 +1,298 @@ +#compdef volta + +autoload -U is-at-least + +_volta() { + typeset -A opt_args + typeset -a _arguments_options + local ret=1 + + if is-at-least 5.2; then + _arguments_options=(-s -S -C) + else + _arguments_options=(-s -C) + fi + + local context curcontext="$curcontext" state line + _arguments "${_arguments_options[@]}" \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +'-v[Prints the current version of Volta]' \ +'--version[Prints the current version of Volta]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +":: :_volta_commands" \ +"*::: :->Volta" \ +&& ret=0 + case $state in + (Volta) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:volta-command-$line[1]:" + case $line[1] in + (fetch) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +':tool[@version] -- Tools to fetch, like `node`, `yarn@latest` or `your-package@^14.4.3`.:_files' \ +&& ret=0 +;; +(install) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +':tool[@version] -- Tools to install, like `node`, `yarn@latest` or `your-package@^14.4.3`.:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +':tool -- The tool to uninstall, e.g. `node`, `npm`, `yarn`, or <package>:_files' \ +&& ret=0 +;; +(pin) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +':tool[@version] -- Tools to pin, like `node@lts` or `yarn@^1.14`.:_files' \ +&& ret=0 +;; +(ls) +_arguments "${_arguments_options[@]}" \ +'--format=[Specify the output format]: :(human plain)' \ +'(-d --default)-c[Show the currently-active tool(s)]' \ +'(-d --default)--current[Show the currently-active tool(s)]' \ +'(-c --current)-d[Show your default tool(s).]' \ +'(-c --current)--default[Show your default tool(s).]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +'::tool -- The tool to lookup - `all`, `node`, `yarn`, or the name of a package or binary.:_files' \ +&& ret=0 +;; +(list) +_arguments "${_arguments_options[@]}" \ +'--format=[Specify the output format]: :(human plain)' \ +'(-d --default)-c[Show the currently-active tool(s)]' \ +'(-d --default)--current[Show the currently-active tool(s)]' \ +'(-c --current)-d[Show your default tool(s).]' \ +'(-c --current)--default[Show your default tool(s).]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +'::tool -- The tool to lookup - `all`, `node`, `yarn`, or the name of a package or binary.:_files' \ +&& ret=0 +;; +(completions) +_arguments "${_arguments_options[@]}" \ +'-o+[File to write generated completions to]' \ +'--output=[File to write generated completions to]' \ +'-f[Write over an existing file, if any.]' \ +'--force[Write over an existing file, if any.]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +':shell -- Shell to generate completions for:(zsh bash fish powershell elvish)' \ +&& ret=0 +;; +(which) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +':binary -- The binary to find, e.g. `node` or `npm`:_files' \ +&& ret=0 +;; +(use) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +'::anything:_files' \ +&& ret=0 +;; +(setup) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +&& ret=0 +;; +(run) +_arguments "${_arguments_options[@]}" \ +'--node=[Set the custom Node version]' \ +'(--bundled-npm)--npm=[Set the custom npm version]' \ +'(--no-yarn)--yarn=[Set the custom Yarn version]' \ +'*--env=[Set an environment variable (can be used multiple times)]' \ +'(--npm)--bundled-npm[Forces npm to be the version bundled with Node]' \ +'(--yarn)--no-yarn[Disables Yarn]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +':command -- The command to run:_files' \ +'::args -- Arguments to pass to the command:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'--verbose[Enables verbose diagnostics]' \ +'(--verbose)--quiet[Prevents unnecessary output]' \ +&& ret=0 +;; + esac + ;; +esac +} + +(( $+functions[_volta_commands] )) || +_volta_commands() { + local commands; commands=( + "fetch:Fetches a tool to the local machine" \ +"install:Installs a tool in your toolchain" \ +"uninstall:Uninstalls a tool from your toolchain" \ +"pin:Pins your project's runtime or package manager" \ +"list:Displays the current toolchain" \ +"completions:Generates Volta completions" \ +"which:Locates the actual binary that will be called by Volta" \ +"use:" \ +"setup:Enables Volta for the current user / shell" \ +"run:Run a command with custom Node, npm, and/or Yarn versions" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'volta commands' commands "$@" +} +(( $+functions[_volta__completions_commands] )) || +_volta__completions_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta completions commands' commands "$@" +} +(( $+functions[_volta__fetch_commands] )) || +_volta__fetch_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta fetch commands' commands "$@" +} +(( $+functions[_volta__help_commands] )) || +_volta__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta help commands' commands "$@" +} +(( $+functions[_volta__install_commands] )) || +_volta__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta install commands' commands "$@" +} +(( $+functions[_volta__list_commands] )) || +_volta__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta list commands' commands "$@" +} +(( $+functions[_ls_commands] )) || +_ls_commands() { + local commands; commands=( + + ) + _describe -t commands 'ls commands' commands "$@" +} +(( $+functions[_volta__ls_commands] )) || +_volta__ls_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta ls commands' commands "$@" +} +(( $+functions[_volta__pin_commands] )) || +_volta__pin_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta pin commands' commands "$@" +} +(( $+functions[_volta__run_commands] )) || +_volta__run_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta run commands' commands "$@" +} +(( $+functions[_volta__setup_commands] )) || +_volta__setup_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta setup commands' commands "$@" +} +(( $+functions[_volta__uninstall_commands] )) || +_volta__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta uninstall commands' commands "$@" +} +(( $+functions[_volta__use_commands] )) || +_volta__use_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta use commands' commands "$@" +} +(( $+functions[_volta__which_commands] )) || +_volta__which_commands() { + local commands; commands=( + + ) + _describe -t commands 'volta which commands' commands "$@" +} + +_volta "$@"
\ No newline at end of file diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md index 664a063a3..27d6a228b 100644 --- a/plugins/xcode/README.md +++ b/plugins/xcode/README.md @@ -26,7 +26,7 @@ plugins=(... xcode) ### `xc` -Opens the current directory in Xcode as an Xcode project or a Swift package. This will open one of the `.xcworkspace`, `.xcodeproj` and `Package.swift` 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 or a Swift package. This will open one of the `.xcworkspace`, `.xcodeproj`, `.swiftpm` and `Package.swift` 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. ### `xx` diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index 41b9e37e4..3bd12cdec 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -7,7 +7,7 @@ alias xcsel='sudo xcode-select --switch' # source: https://gist.github.com/subdigital/5420709 function xc { local xcode_files - xcode_files=(${1:-.}/{*.{xcworkspace,xcodeproj},Package.swift}(N)) + xcode_files=(${1:-.}/{*.{xcworkspace,xcodeproj,swiftpm},Package.swift}(N)) if [[ ${#xcode_files} -eq 0 ]]; then echo "No Xcode files found in ${1:-the current directory}." >&2 diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn index 70ed55929..9173eca20 100644 --- a/plugins/yarn/_yarn +++ b/plugins/yarn/_yarn @@ -157,7 +157,7 @@ _yarn() { '(--emoji)--no-emoji[disable emoji in output]' \ '(--disable-pnp)'{--enable-pnp,--pnp}"[enable the Plug'n'Play installation]" \ '--flat[only allow one version of a package]' \ - '--focus[Focus on a single workspace by installing remote copies of its sibiling workspaces]' \ + '--focus[Focus on a single workspace by installing remote copies of its sibling workspaces]' \ '--force[install and build packages even if they were built before, overwrite lockfile]' \ "--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \ '--global-folder=[modules folder]:folder:_files -/' \ diff --git a/plugins/yum/yum.plugin.zsh b/plugins/yum/yum.plugin.zsh index 69abfc4ce..d36571133 100644 --- a/plugins/yum/yum.plugin.zsh +++ b/plugins/yum/yum.plugin.zsh @@ -7,7 +7,7 @@ alias ygl="yum grouplist" # list package groups alias yli="yum list installed" # print all installed packages alias ymc="yum makecache" # rebuilds the yum package list -alias yu="sudo yum update" # upgrate packages +alias yu="sudo yum update" # upgrade packages alias yi="sudo yum install" # install package alias ygi="sudo yum groupinstall" # install package group alias yr="sudo yum remove" # remove package diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index ebdec7c82..c2fdbed23 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -32,42 +32,44 @@ ########## COLOR ########### for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do - eval PR_$COLOR='%{$fg[${(L)COLOR}]%}' - eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}' + typeset -g PR_$COLOR="%b%{$fg[${(L)COLOR}]%}" + typeset -g PR_BRIGHT_$COLOR="%B%{$fg[${(L)COLOR}]%}" done - PR_RESET="%{$reset_color%}" -RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} " -RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} " -GREEN_END="${PR_RESET}${PR_BRIGHT_GREEN}>${PR_RESET}${PR_GREEN}>${PR_GREY}>${PR_RESET} " -GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}" -GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} " -DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" -VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" -VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" -VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}" + +RED_START="${PR_GREY}<${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} " +RED_END="${PR_BRIGHT_RED}>${PR_RED}>${PR_GREY}>${PR_RESET} " +GREEN_START="${PR_GREY}>${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}" +GREEN_END="${PR_BRIGHT_GREEN}>${PR_GREEN}>${PR_GREY}>${PR_RESET} " + +########## VCS ########### +VCS_DIRTY_COLOR="${PR_YELLOW}" +VCS_CLEAN_COLOR="${PR_GREEN}" +VCS_SUFFIX_COLOR="${PR_RED}› ${PR_RESET}" ########## SVN ########### -ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:" -ZSH_THEME_SVN_PROMPT_SUFFIX="" -ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" -ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" +ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RED}‹svn:" +ZSH_THEME_SVN_PROMPT_SUFFIX="${VCS_SUFFIX_COLOR}" +ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘" +ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔" ########## GIT ########### -ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" -ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" -ZSH_THEME_GIT_PROMPT_ADDED="${PR_RESET}${PR_YELLOW} ✚${PR_RESET}" -ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_RESET}${PR_YELLOW} ✹${PR_RESET}" -ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}" -ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}" -ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}" +ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RED}‹git:" +ZSH_THEME_GIT_PROMPT_SUFFIX="${VCS_SUFFIX_COLOR}" +ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘" +ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔" +ZSH_THEME_GIT_PROMPT_ADDED="${PR_YELLOW} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_YELLOW} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="${PR_YELLOW} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="${PR_YELLOW} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_YELLOW} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_YELLOW} ✭" # Get a fortune quote ps1_fortune() { - (( ${+commands[fortune]} )) && fortune + if (( ${+commands[fortune]} )); then + fortune + fi } # Obtain a command tip @@ -77,33 +79,27 @@ ps1_command_tip() { command wget -qO- https://www.commandlinefu.com/commands/random/plaintext elif (( ${+commands[curl]} )); then command curl -fsL https://www.commandlinefu.com/commands/random/plaintext - fi - } | sed 1d | sed '/^$/d' + fi + } | sed '1d;/^$/d' } -function precmd_adben { - prompt_header() { - if [[ "$ENABLE_COMMAND_TIP" = true ]]; then - ps1_command_tip - else - ps1_fortune - fi - } +# Show prompt header (fortune / command tip) +prompt_header() { + local header=$( + case "${ENABLE_COMMAND_TIP:-}" in + true) ps1_command_tip ;; + *) ps1_fortune ;; + esac + ) - PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" - - # set a simple variable to show when in screen - if [[ -n "${WINDOW}" ]]; then - SCREEN="" - fi + # Make sure to quote % so that they're not expanded by the prompt + echo -n "${header:gs/%/%%}" } # Context: user@directory or just directory prompt_context() { if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - echo -n "${PR_RESET}${PR_RED}$USERNAME@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" - else - echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + echo -n "${PR_RESET}${PR_RED}%n@%m" fi } @@ -111,16 +107,12 @@ prompt_context() { # Required for the prompt setopt prompt_subst -autoload zsh/terminfo -# Prompt -PROMPT='${PROMPT_HEAD} -${RED_START}$(prompt_context) -${GREEN_START_P1}' -RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}' +# Prompt: header, context (user@host), directory +PROMPT="${RED_START}${PR_YELLOW}\$(prompt_header)${PR_RESET} +${RED_START}\$(prompt_context)${PR_BRIGHT_YELLOW}%~${PR_RESET} +${GREEN_START} " +# Right prompt: vcs status + time +RPROMPT="\$(git_prompt_info)\$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}" # Matching continuation prompt -PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} ' - -# Prompt head -autoload -Uz add-zsh-hook -add-zsh-hook precmd precmd_adben +PROMPT2="${GREEN_START} %_ ${GREEN_START} " diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 1d2af3458..d939d546f 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -1,47 +1,46 @@ # af-magic.zsh-theme -# Repo: https://github.com/andyfleming/oh-my-zsh -# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme +# +# Author: Andy Fleming +# URL: http://andyfleming.com/ - -# settings -typeset +H return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -typeset +H my_gray="$FG[237]" -typeset +H my_orange="$FG[214]" - -# separator dashes size +# dashed separator size function afmagic_dashes { - local PYTHON_ENV="$VIRTUAL_ENV" - [[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV" - - if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then - echo $(( COLUMNS - ${#PYTHON_ENV} - 3 )) - else - echo $COLUMNS - fi + # check either virtualenv or condaenv variables + local python_env="${VIRTUAL_ENV:-$CONDA_DEFAULT_ENV}" + + # if there is a python virtual environment and it is displayed in + # the prompt, account for it when returning the number of dashes + if [[ -n "$python_env" && "$PS1" = \(* ]]; then + echo $(( COLUMNS - ${#python_env} - 3 )) + else + echo $COLUMNS + fi } -# primary prompt -PS1='$FG[237]${(l.$(afmagic_dashes)..-.)}%{$reset_color%} -$FG[032]%~$(git_prompt_info)$(hg_prompt_info) $FG[105]%(!.#.»)%{$reset_color%} ' -PS2='%{$fg[red]%}\ %{$reset_color%}' -RPS1='${return_code}' +# primary prompt: dashed separator, directory and vcs info +PS1="${FG[237]}\${(l.\$(afmagic_dashes)..-.)}%{$reset_color%} +${FG[032]}%~\$(git_prompt_info)\$(hg_prompt_info) ${FG[105]}%(!.#.»)%{$reset_color%} " +PS2="%{$fg[red]%}\ %{$reset_color%}" -# right prompt -(( $+functions[virtualenv_prompt_info] )) && RPS1+='$(virtualenv_prompt_info)' -RPS1+=' $my_gray%n@%m%{$reset_color%}%' +# right prompt: return code, virtualenv and context (user@host) +RPS1="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +if (( $+functions[virtualenv_prompt_info] )); then + RPS1+='$(virtualenv_prompt_info)' +fi +RPS1+=" ${FG[237]}%n@%m%{$reset_color%}" # git settings -ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]" +ZSH_THEME_GIT_PROMPT_PREFIX="${FG[075]}(${FG[078]}" ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="${FG[214]}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[075]})%{$reset_color%}" # hg settings -ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]" +ZSH_THEME_HG_PROMPT_PREFIX="${FG[075]}(${FG[078]}" ZSH_THEME_HG_PROMPT_CLEAN="" -ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}" -ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" +ZSH_THEME_HG_PROMPT_DIRTY="${FG[214]}*%{$reset_color%}" +ZSH_THEME_HG_PROMPT_SUFFIX="${FG[075]})%{$reset_color%}" # virtualenv settings -ZSH_THEME_VIRTUALENV_PREFIX=" $FG[075][" +ZSH_THEME_VIRTUALENV_PREFIX=" ${FG[075]}[" ZSH_THEME_VIRTUALENV_SUFFIX="]%{$reset_color%}" diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme index 3a4753fc1..f6d3ef82a 100644 --- a/themes/afowler.zsh-theme +++ b/themes/afowler.zsh-theme @@ -1,10 +1,10 @@ -if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi - -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' - -RPS1="${return_code}" +PROMPT='%m %B%F{blue}:: %b%F{green}%3~ $(hg_prompt_info)$(git_prompt_info)%B%(!.%F{red}.%F{blue})»%f%b ' +RPS1='%(?..%F{red}%? ↵%f)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + +ZSH_THEME_HG_PROMPT_PREFIX="%{$fg[magenta]%}hg:‹%{$fg[yellow]%}" +ZSH_THEME_HG_PROMPT_SUFFIX="%{$fg[magenta]%}› %{$reset_color%}" +ZSH_THEME_HG_PROMPT_DIRTY=" %{$fg[red]%}✗" +ZSH_THEME_HG_PROMPT_CLEAN="" diff --git a/themes/aussiegeek.zsh-theme b/themes/aussiegeek.zsh-theme index c2c7f65b9..2ded5c157 100644 --- a/themes/aussiegeek.zsh-theme +++ b/themes/aussiegeek.zsh-theme @@ -1,5 +1,5 @@ -PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color +PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(ruby_prompt_info)$fg_bold[blue] ]$reset_color $ ' # git theming ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green](" diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index cdae68d6c..42a70a018 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -1,32 +1,32 @@ -# ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +local user_host="%B%(!.%{$fg[red]%}.%{$fg[green]%})%n@%m%{$reset_color%} " +local user_symbol='%(!.#.$)' +local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}" -if [[ $UID -eq 0 ]]; then - local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}' - local user_symbol='#' -else - local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}' - local user_symbol='$' -fi - -local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}' -local git_branch='$(git_prompt_info)' +local vcs_branch='$(git_prompt_info)$(hg_prompt_info)' local rvm_ruby='$(ruby_prompt_info)' local venv_prompt='$(virtualenv_prompt_info)' ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" -PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt} +PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt} ╰─%B${user_symbol}%b " RPROMPT="%B${return_code}%b" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%}" + +ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX" +ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX" +ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY" +ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN" ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹" ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}" ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹" ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}" -ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX -ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX +ZSH_THEME_VIRTUALENV_PREFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX" +ZSH_THEME_VIRTUALENV_SUFFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX" diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index d6c417fc3..4f8be20d3 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -9,7 +9,7 @@ DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}\$(parse_git_dirty)" # Grab the current username: dallas DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" -# Use a % for normal users and a # for privelaged (root) users. +# Use a % for normal users and a # for privileged (root) users. DALLAS_PROMPT_CHAR_="%{$fg[white]%}%(!.#.%%)%{$reset_color%}" # For the git prompt, use a white @ and blue text for the branch name ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg[blue]%}" diff --git a/themes/emotty.zsh-theme b/themes/emotty.zsh-theme index 13adad78d..044b317e8 100644 --- a/themes/emotty.zsh-theme +++ b/themes/emotty.zsh-theme @@ -51,9 +51,9 @@ root_prompt="$emoji[skull]" warn_prompt="$emoji[collision_symbol]" vcs_unstaged_glyph="%{$emoji[circled_latin_capital_letter_m]$emoji2[emoji_style] %2G%}" -vcs_staged_glyph="%{$emoji[high_voltage_sign] %2G%}" -vcs_branch_glyph=$(print -P $'\Ue0a0') # -vcs_action_glyph=$(print -P $'\U276f') # ❯ +vcs_staged_glyph="%{$emoji[high_voltage_sign]%2G%}" +vcs_branch_glyph=$'\Ue0a0' # +vcs_action_glyph=$'\U276f' # ❯ red="$FG[001]" yellow="$FG[003]" diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme index f34f36f8a..43d4093b1 100644 --- a/themes/essembeh.zsh-theme +++ b/themes/essembeh.zsh-theme @@ -39,7 +39,7 @@ elif [[ -r /etc/debian_chroot ]]; then # prefix prompt in case of chroot ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} " elif [[ -r /.dockerenv ]]; then - # also prefix prompt inside a docker contrainer + # also prefix prompt inside a docker container ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[docker]%{$reset_color%} " fi if [[ $UID = 0 ]]; then diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index 2f0e77431..11d799a84 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -1,153 +1,124 @@ -functions rbenv_prompt_info >& /dev/null || rbenv_prompt_info(){} - function theme_precmd { - local TERMWIDTH - (( TERMWIDTH = ${COLUMNS} - 1 )) - - - ### - # Truncate the path if it's too long. - - PR_FILLBAR="" - PR_PWDLEN="" - - local promptsize=${#${(%):---(%n@%m:%l)---()--}} - local rubyprompt=`rvm_prompt_info || rbenv_prompt_info` - local rubypromptsize=${#${rubyprompt}} - local pwdsize=${#${(%):-%~}} - - if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then - ((PR_PWDLEN=$TERMWIDTH - $promptsize)) - else - PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" - fi - + local TERMWIDTH=$(( COLUMNS - ${ZLE_RPROMPT_INDENT:-1} )) + + PR_FILLBAR="" + PR_PWDLEN="" + + local promptsize=${#${(%):---(%n@%m:%l)---()--}} + local rubypromptsize=${#${(%)$(ruby_prompt_info)}} + local pwdsize=${#${(%):-%~}} + + # Truncate the path if it's too long. + if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then + (( PR_PWDLEN = TERMWIDTH - promptsize )) + elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then + PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}" + else + PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}" + fi } - -setopt extended_glob -theme_preexec () { - if [[ "$TERM" == "screen" ]]; then - local CMD=${1[(wr)^(*=*|sudo|-*)]} - echo -n "\ek$CMD\e\\" - fi -} - - -setprompt () { - ### - # Need this so the prompt will work. - - setopt prompt_subst - - - ### - # See if we can use colors. - - autoload zsh/terminfo - for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do - eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' - eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' - (( count = $count + 1 )) - done - PR_NO_COLOUR="%{$terminfo[sgr0]%}" - - ### - # Modify Git prompt - ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" - ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" - ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" - - ### - # See if we can use extended characters to look nicer. - # UTF-8 Fixed - - if [[ $(locale charmap) == "UTF-8" ]]; then - PR_SET_CHARSET="" - PR_SHIFT_IN="" - PR_SHIFT_OUT="" - PR_HBAR="─" - PR_ULCORNER="┌" - PR_LLCORNER="└" - PR_LRCORNER="┘" - PR_URCORNER="┐" - else - typeset -A altchar - set -A altchar ${(s..)terminfo[acsc]} - # Some stuff to help us draw nice lines - PR_SET_CHARSET="%{$terminfo[enacs]%}" - PR_SHIFT_IN="%{$terminfo[smacs]%}" - PR_SHIFT_OUT="%{$terminfo[rmacs]%}" - PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT' - PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT' - PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT' - PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT' - PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT' - fi - - - ### - # Decide if we need to set titlebar text. - - case $TERM in - xterm*) - PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' - ;; - screen) - PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' - ;; - *) - PR_TITLEBAR='' - ;; - esac - - - ### - # Decide whether to set a screen title - if [[ "$TERM" == "screen" ]]; then - PR_STITLE=$'%{\ekzsh\e\\%}' - else - PR_STITLE='' - fi - - - ### - # Finally, the prompt. - - PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ -$PR_CYAN$PR_ULCORNER$PR_HBAR$PR_GREY(\ -$PR_GREEN%$PR_PWDLEN<...<%~%<<\ -$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_GREY(\ -$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ -$PR_GREY)$PR_CYAN$PR_HBAR$PR_URCORNER\ - -$PR_CYAN$PR_LLCORNER$PR_BLUE$PR_HBAR(\ -$PR_YELLOW%D{%H:%M:%S}\ -$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_HBAR\ -$PR_HBAR\ ->$PR_NO_COLOUR ' - - # display exitcode on the right when >0 - return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" - RPROMPT=' $return_code$PR_CYAN$PR_HBAR$PR_BLUE$PR_HBAR\ -($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_NO_COLOUR' - - PS2='$PR_CYAN$PR_HBAR\ -$PR_BLUE$PR_HBAR(\ -$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\ -$PR_CYAN$PR_HBAR$PR_NO_COLOUR ' +function theme_preexec { + setopt local_options extended_glob + if [[ "$TERM" = "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi } -setprompt - autoload -U add-zsh-hook add-zsh-hook precmd theme_precmd add-zsh-hook preexec theme_preexec + + +# Set the prompt + +# Need this so the prompt will work. +setopt prompt_subst + +# See if we can use colors. +autoload zsh/terminfo +for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do + typeset -g PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}" + typeset -g PR_LIGHT_$color="%{$fg[${(L)color}]%}" +done +PR_NO_COLOUR="%{$terminfo[sgr0]%}" + +# Modify Git prompt +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} %{%G✚%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} %{%G✹%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} %{%G✖%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} %{%G➜%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} %{%G═%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} %{%G✭%}" + +# Use extended characters to look nicer if supported. +if [[ "${langinfo[CODESET]}" = UTF-8 ]]; then + PR_SET_CHARSET="" + PR_HBAR="─" + PR_ULCORNER="┌" + PR_LLCORNER="└" + PR_LRCORNER="┘" + PR_URCORNER="┐" +else + typeset -A altchar + set -A altchar ${(s..)terminfo[acsc]} + # Some stuff to help us draw nice lines + PR_SET_CHARSET="%{$terminfo[enacs]%}" + PR_SHIFT_IN="%{$terminfo[smacs]%}" + PR_SHIFT_OUT="%{$terminfo[rmacs]%}" + PR_HBAR="${PR_SHIFT_IN}${altchar[q]:--}${PR_SHIFT_OUT}" + PR_ULCORNER="${PR_SHIFT_IN}${altchar[l]:--}${PR_SHIFT_OUT}" + PR_LLCORNER="${PR_SHIFT_IN}${altchar[m]:--}${PR_SHIFT_OUT}" + PR_LRCORNER="${PR_SHIFT_IN}${altchar[j]:--}${PR_SHIFT_OUT}" + PR_URCORNER="${PR_SHIFT_IN}${altchar[k]:--}${PR_SHIFT_OUT}" +fi + +# Decide if we need to set titlebar text. +case $TERM in + xterm*) + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' + ;; + screen) + PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + ;; + *) + PR_TITLEBAR="" + ;; +esac + +# Decide whether to set a screen title +if [[ "$TERM" = "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' +else + PR_STITLE="" +fi + +# Finally, the prompt. +PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}\ +${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(\ +${PR_GREEN}%${PR_PWDLEN}<...<%~%<<\ +${PR_GREY})$(ruby_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\ +${PR_CYAN}%(!.%SROOT%s.%n)${PR_GREY}@${PR_GREEN}%m:%l\ +${PR_GREY})${PR_CYAN}${PR_HBAR}${PR_URCORNER}\ + +${PR_CYAN}${PR_LLCORNER}${PR_BLUE}${PR_HBAR}(\ +${PR_YELLOW}%D{%H:%M:%S}\ +${PR_LIGHT_BLUE}%{$reset_color%}$(git_prompt_info)$(git_prompt_status)${PR_BLUE})${PR_CYAN}${PR_HBAR}\ +${PR_HBAR}\ +>${PR_NO_COLOUR} ' + +# display exitcode on the right when > 0 +return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" +RPROMPT=' $return_code${PR_CYAN}${PR_HBAR}${PR_BLUE}${PR_HBAR}\ +(${PR_YELLOW}%D{%a,%b%d}${PR_BLUE})${PR_HBAR}${PR_CYAN}${PR_LRCORNER}${PR_NO_COLOUR}' + +PS2='${PR_CYAN}${PR_HBAR}\ +${PR_BLUE}${PR_HBAR}(\ +${PR_LIGHT_GREEN}%_${PR_BLUE})${PR_HBAR}\ +${PR_CYAN}${PR_HBAR}${PR_NO_COLOUR} ' diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index c8f0f4dd7..ea051c58e 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -10,7 +10,7 @@ function josh_prompt { prompt=" " branch=$(git_current_branch) - ruby_version=$(rvm_prompt_info || rbenv_prompt_info) + ruby_version=$(ruby_prompt_info) path_size=${#PWD} branch_size=${#branch} ruby_size=${#ruby_version} @@ -31,7 +31,7 @@ function josh_prompt { prompt=" $prompt" done - prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_current_branch)" + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(ruby_prompt_info)%{$reset_color%} $(git_current_branch)" echo $prompt } diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme index e05df9c9b..588ab6982 100644 --- a/themes/minimal.zsh-theme +++ b/themes/minimal.zsh-theme @@ -2,23 +2,25 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[white]%}]%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} " -ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX -ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX -ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY -ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN -ZSH_THEME_HG_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX -ZSH_THEME_HG_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX -ZSH_THEME_HG_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY -ZSH_THEME_HG_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN + +ZSH_THEME_SVN_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX" +ZSH_THEME_SVN_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX" +ZSH_THEME_SVN_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY" +ZSH_THEME_SVN_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN" + +ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX" +ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX" +ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY" +ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN" vcs_status() { - if [[ $(whence in_svn) != "" ]] && in_svn; then - svn_prompt_info - elif [[ $(whence in_hg) != "" ]] && in_hg; then - hg_prompt_info - else - git_prompt_info - fi + if (( ${+functions[in_svn]} )) && in_svn; then + svn_prompt_info + elif (( ${+functions[in_hg]} )) && in_hg; then + hg_prompt_info + else + git_prompt_info + fi } PROMPT='%2~ $(vcs_status)»%b ' diff --git a/themes/murilasso.zsh-theme b/themes/murilasso.zsh-theme index bc2b9b224..d46874c54 100644 --- a/themes/murilasso.zsh-theme +++ b/themes/murilasso.zsh-theme @@ -1,7 +1,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' -local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}$(ruby_prompt_info)%{$reset_color%}' local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}' PROMPT="${user_host}:${current_dir} ${rvm_ruby} diff --git a/themes/nicoulaj.zsh-theme b/themes/nicoulaj.zsh-theme index 333aa5e70..685cd1ade 100644 --- a/themes/nicoulaj.zsh-theme +++ b/themes/nicoulaj.zsh-theme @@ -6,7 +6,7 @@ # * Only shows the path on the left prompt by default. # * Crops the path to a defined length and only shows the path relative to # the current VCS repository root. -# * Wears a different color wether the last command succeeded/failed. +# * Wears a different color whether the last command succeeded/failed. # * Shows user@hostname if connected through SSH. # * Shows if logged in as root or not. # ------------------------------------------------------------------------------ diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme index 47b0b4fb1..c2ab7f4e6 100644 --- a/themes/pygmalion-virtualenv.zsh-theme +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -35,19 +35,20 @@ prompt_setup_pygmalion(){ } prompt_pygmalion_precmd(){ - setopt localoptions extendedglob + setopt localoptions nopromptsubst extendedglob local gitinfo=$(git_prompt_info) local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} - local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")" local prompt_length=${#exp_nocolor} + # add new line on prompt longer than 40 characters local nl="" - if [[ $prompt_length -gt 40 ]]; then - nl=$'\n%{\r%}'; + nl=$'\n%{\r%}' fi - PROMPT="$base_prompt$gitinfo$nl$post_prompt" + + PROMPT="${base_prompt}\$(git_prompt_info)${nl}${post_prompt}" } prompt_setup_pygmalion diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index b13adfd5f..be9ca3889 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -19,14 +19,14 @@ prompt_setup_pygmalion(){ } prompt_pygmalion_precmd(){ - setopt localoptions extendedglob + setopt localoptions nopromptsubst extendedglob local gitinfo=$(git_prompt_info) local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} - local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")" local prompt_length=${#exp_nocolor} - PROMPT="${base_prompt}${gitinfo}${post_prompt}" + PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}" } prompt_setup_pygmalion diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme index 2a4188c9d..5e2de7a87 100644 --- a/themes/refined.zsh-theme +++ b/themes/refined.zsh-theme @@ -33,8 +33,8 @@ autoload -Uz vcs_info zstyle ':vcs_info:*' enable hg bzr git zstyle ':vcs_info:*:*' unstagedstr '!' zstyle ':vcs_info:*:*' stagedstr '+' -zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c" -zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)" +zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s:%b" "%%u%c" +zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s:%b" "%u%c (%a)" zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" # Fastest possible way to check if repo is dirty @@ -70,6 +70,7 @@ preexec() { # Output additional information about paths, repos and exec time # precmd() { + setopt localoptions nopromptsubst vcs_info # Get version control info before we start outputting stuff print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" unset cmd_timestamp #Reset cmd exec time. diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index ef91c5ee3..287781d9e 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -1,130 +1,95 @@ -# Prompt -# -# Below are the color init strings for the basic file types. A color init -# string consists of one or more of the following numeric codes: -# Attribute codes: -# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed -# Text color codes: -# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white -# Background color codes: -# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white -function precmd { - - local TERMWIDTH - (( TERMWIDTH = ${COLUMNS} - 1 )) - - - ### - # Truncate the path if it's too long. - - PR_FILLBAR="" - PR_PWDLEN="" - - local promptsize=${#${(%):---(%n@%M:%l)---()}} - local pwdsize=${#${(%):-%~}} - local gitbranch="$(git_prompt_info)" - local rvmprompt="$(ruby_prompt_info)" - local gitbranchsize=${#${gitbranch:-''}} - local rvmpromptsize=${#${rvmprompt:-''}} - - if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then - ((PR_PWDLEN=$TERMWIDTH - $promptsize)) - else - PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}" - fi +function theme_precmd { + PR_FILLBAR="" + PR_PWDLEN="" + + local promptsize=${#${(%):--(%n@%M:)--(%l)-}} + local pwdsize=${#${(%):-%~}} + local gitbranchsize="${#${(%)$(git_prompt_info)}:-}" + local rvmpromptsize="${#${(%)$(ruby_prompt_info):-}}" + + # Truncate the path if it's too long. + if (( promptsize + pwdsize + rvmpromptsize + gitbranchsize > COLUMNS )); then + (( PR_PWDLEN = COLUMNS - promptsize )) + else + PR_FILLBAR="\${(l.$(( COLUMNS - (promptsize + pwdsize + rvmpromptsize + gitbranchsize) ))..${PR_SPACE}.)}" + fi } +function theme_preexec { + setopt local_options extended_glob + if [[ "$TERM" == "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi -setopt extended_glob + if [[ "$TERM" == "xterm" ]]; then + print -Pn "\e]0;$1\a" + fi -preexec () { - if [[ "$TERM" == "screen" ]]; then - local CMD=${1[(wr)^(*=*|sudo|-*)]} - echo -n "\ek$CMD\e\\" - fi - - if [[ "$TERM" == "xterm" ]]; then - print -Pn "\e]0;$1\a" - fi - - if [[ "$TERM" == "rxvt" ]]; then - print -Pn "\e]0;$1\a" - fi + if [[ "$TERM" == "rxvt" ]]; then + print -Pn "\e]0;$1\a" + fi } -setprompt () { -### -# Need this so the prompt will work. +autoload -U add-zsh-hook +add-zsh-hook precmd theme_precmd +add-zsh-hook preexec theme_preexec - setopt prompt_subst +# Set the prompt + +# Need this so the prompt will work. +setopt prompt_subst -### # See if we can use colors. +autoload zsh/terminfo +for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do + typeset -g PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}" + typeset -g PR_LIGHT_$color="%{$fg[${(L)color}]%}" +done +PR_NO_COLOUR="%{$terminfo[sgr0]%}" + +# Use extended characters to look nicer +PR_HBAR="-" +PR_ULCORNER="-" +PR_LLCORNER="-" +PR_LRCORNER="-" +PR_URCORNER="-" + +# Modify Git prompt +ZSH_THEME_GIT_PROMPT_PREFIX=" [" +ZSH_THEME_GIT_PROMPT_SUFFIX="]" + +# Modify RVM prompt +ZSH_THEME_RUBY_PROMPT_PREFIX=" [" +ZSH_THEME_RUBY_PROMPT_SUFFIX="]" - autoload zsh/terminfo - for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do - eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' - eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' - (( count = $count + 1 )) - done - PR_NO_COLOUR="%{$terminfo[sgr0]%}" - - -### -# See if we can use extended characters to look nicer. - - typeset -A altchar -# set -A altchar "${(s..)terminfo[acsc]}" - PR_SET_CHARSET="%{$terminfo[enacs]%}" - PR_HBAR=${altchar[q]:--} - PR_ULCORNER=${altchar[l]:--} - PR_LLCORNER=${altchar[m]:--} - PR_LRCORNER=${altchar[j]:--} - PR_URCORNER=${altchar[k]:--} - - ### - # Modify Git prompt - ZSH_THEME_GIT_PROMPT_PREFIX=" [" - ZSH_THEME_GIT_PROMPT_SUFFIX="]" - ### - # Modify RVM prompt - ZSH_THEME_RUBY_PROMPT_PREFIX=" [" - ZSH_THEME_RUBY_PROMPT_SUFFIX="]" - - -### # Decide if we need to set titlebar text. +case $TERM in + xterm*|*rxvt*) + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(ruby_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}' + ;; + screen) + PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + ;; + *) + PR_TITLEBAR="" + ;; +esac - case $TERM in - xterm*|*rxvt*) - PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}' - ;; - screen) - PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' - ;; - *) - PR_TITLEBAR='' - ;; - esac - - -### # Decide whether to set a screen title - if [[ "$TERM" == "screen" ]]; then - PR_STITLE=$'%{\ekzsh\e\\%}' - else - PR_STITLE='' - fi +if [[ "$TERM" == "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' +else + PR_STITLE="" +fi -### # Finally, the prompt. -# - PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ +PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ $PR_RED$PR_HBAR<\ -$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\ -$PR_RED>$PR_HBAR$PR_SPACE${(e)PR_FILLBAR}\ +$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(ruby_prompt_info)\ +$PR_RED>$PR_HBAR${(e)PR_FILLBAR}\ $PR_RED$PR_HBAR<\ $PR_GREEN%l$PR_RED>$PR_HBAR\ @@ -132,7 +97,3 @@ $PR_RED$PR_HBAR<\ %(?..$PR_LIGHT_RED%?$PR_BLUE:)\ $PR_LIGHT_BLUE%(!.$PR_RED.$PR_WHITE)%#$PR_RED>$PR_HBAR\ $PR_NO_COLOUR ' - -} - -setprompt diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 251b48827..45bbae2d1 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -5,10 +5,8 @@ # # Mar 2013 Yad Smood -typeset +H my_gray="$FG[247]" - # VCS -YS_VCS_PROMPT_PREFIX1=" %{$my_gray%}on%{$reset_color%} " +YS_VCS_PROMPT_PREFIX1=" %{$reset_color%}on%{$fg[blue]%} " YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}" YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" @@ -62,13 +60,13 @@ local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" PROMPT=" %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ %(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \ -%{$my_gray%}@ \ +%{$reset_color%}@ \ %{$fg[green]%}%m \ -%{$my_gray%}in \ +%{$reset_color%}in \ %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${hg_info}\ ${git_info}\ ${venv_info}\ \ -%{$my_gray%}[%*] $exit_code +[%*] $exit_code %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 8264762b6..293f48edf 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -34,11 +34,11 @@ function current_epoch() { function is_update_available() { local branch - branch=${"$(git -C "$ZSH" config --local oh-my-zsh.branch)":-master} + branch=${"$(cd "$ZSH"; git config --local oh-my-zsh.branch)":-master} local remote remote_url remote_repo - remote=${"$(git -C "$ZSH" config --local oh-my-zsh.remote)":-origin} - remote_url=$(git -C "$ZSH" config remote.$remote.url) + remote=${"$(cd "$ZSH"; git config --local oh-my-zsh.remote)":-origin} + remote_url=$(cd "$ZSH"; git config remote.$remote.url) local repo case "$remote_url" in @@ -56,25 +56,22 @@ function is_update_available() { # Get local HEAD. If this fails assume there are updates local local_head - local_head=$(git -C "$ZSH" rev-parse $branch 2>/dev/null) || return 0 + local_head=$(cd "$ZSH"; git rev-parse $branch 2>/dev/null) || return 0 - # Get remote HEAD. If we can't get it assume there are updates unless there is no connection: - # - curl: 6 (could not resolve) or 7 (could not connect) - # - wget: 4 (network unreachable) - # - fetch: 1 (no route to host) - local remote_head ret + # Get remote HEAD. If no suitable command is found assume there are updates + # On any other error, skip the update (connection may be down) + local remote_head remote_head=$( - curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null || { - [[ $? -eq 6 || $? -eq 7 ]] && exit 1 - } || wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null || { - [[ $? -eq 4 ]] && exit 1 - } || HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null || { - [[ $? -eq 1 ]] && exit 1 - } || exit 0 - ) - - # If can't fetch remote HEAD, return exit code - ret=$?; [[ -n "$remote_head" ]] || return $ret + if (( ${+commands[curl]} )); then + curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null + elif (( ${+commands[wget]} )); then + wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null + elif (( ${+commands[fetch]} )); then + HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null + else + exit 0 + fi + ) || return 1 # Compare local and remote HEADs [[ "$local_head" != "$remote_head" ]] @@ -136,6 +133,12 @@ function update_ohmyzsh() { return fi + # Test if Oh My Zsh directory is a git repository + if ! (cd "$ZSH" && LANG= git rev-parse &>/dev/null); then + echo >&2 "[oh-my-zsh] Can't update: not a git repository." + return + fi + # Check if there are updates available before proceeding if ! is_update_available; then return @@ -157,7 +160,8 @@ function update_ohmyzsh() { [[ "$option" != $'\n' ]] && echo case "$option" in [yY$'\n']) update_ohmyzsh ;; - [nN]) update_last_updated_file ;; + [nN]) update_last_updated_file ;& + *) echo "[oh-my-zsh] You can update manually by running \`omz update\`" ;; esac fi } diff --git a/tools/install.sh b/tools/install.sh index 7704107c8..47166059d 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -311,7 +311,7 @@ EOF # 1. Use the most preceding one based on $PATH, then check that it's in the shells file # 2. If that fails, get a zsh path from the shells file, then check it actually exists if ! zsh=$(command -v zsh) || ! grep -qx "$zsh" "$shells_file"; then - if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then + if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -n 1) || [ ! -f "$zsh" ]; then fmt_error "no zsh binary found or not present in '$shells_file'" fmt_error "change your default shell manually." return @@ -339,11 +339,11 @@ EOF # shellcheck disable=SC2183 # printf string has more %s than arguments ($RAINBOW expands to multiple arguments) print_success() { - printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET - printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET - printf '%s / __ \%s/ __ \ %s / __ `__ \%s/ / / / %s /_ / %s/ ___/%s __ \ %s\n' $RAINBOW $RESET - printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET - printf '%s\____/%s_/ /_/ %s /_/ /_/ /_/%s\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET + printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET + printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET + printf '%s / __ \\%s/ __ \\ %s / __ `__ \\%s/ / / / %s /_ / %s/ ___/%s __ \\ %s\n' $RAINBOW $RESET + printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET + printf '%s\\____/%s_/ /_/ %s /_/ /_/ /_/%s\\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET printf '%s %s %s %s /____/ %s %s %s %s....is now installed!%s\n' $RAINBOW $GREEN $RESET printf '\n' printf '\n' diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 7642858fe..994ffe9c9 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -182,12 +182,12 @@ if git pull --rebase --stat $remote $branch; then printf "${BLUE}%s \`${BOLD}%s${RESET}${BLUE}\`${RESET}\n" "You can see the changelog with" "omz changelog" fi - printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET - printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET - printf '%s / __ \%s/ __ \ %s / __ `__ \%s/ / / / %s /_ / %s/ ___/%s __ \ %s\n' $RAINBOW $RESET - printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET - printf '%s\____/%s_/ /_/ %s /_/ /_/ /_/%s\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET - printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET + printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET + printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET + printf '%s / __ \\%s/ __ \\ %s / __ `__ \\%s/ / / / %s /_ / %s/ ___/%s __ \\ %s\n' $RAINBOW $RESET + printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET + printf '%s\\____/%s_/ /_/ %s /_/ /_/ /_/%s\\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET + printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET printf '\n' printf "${BLUE}%s${RESET}\n\n" "$message" printf "${BLUE}${BOLD}%s %s${RESET}\n" "To keep up with the latest news and updates, follow us on Twitter:" "$(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)" |