Commit Graph

2138 Commits

Author SHA1 Message Date
Indrajit Raychaudhuri 48291f68e8 general: Reformat runcom documentation 2021-07-07 09:56:22 -05:00
Indrajit Raychaudhuri 2451239713 general: Clarify relative ordering of modules in docs 2021-07-07 09:56:22 -05:00
Daniel Carrillo 98f6306d1e Merge upstream/master 2021-07-01 14:30:56 +02:00
Indrajit Raychaudhuri f3c92ffeb3 utility: Pipe diff output through colordiff Instead of aliasing
`colordiff` behaves better as `stdin` filter. This is useful in
retaining color escape sequences when used with `less`.
2021-06-24 17:45:29 -05:00
Thomas Blaschke 866d5dfccd Add conda to the list of requirements
If conda is not in the list of requirements, the scripts exit too early in case pyenv is not installed and the module is configured with:

 zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on' 
 zstyle ':prezto:module:python' conda-init 'on'

Tested on Amazon EC2 Linux for Deeplearning AMI 47.0 and MacOS 11.4
2021-06-23 23:22:09 -05:00
Daniel Carrillo dc66c17728 Merge upstream/master 2021-06-17 13:12:16 +02:00
Roman Perepelitsa 061a7b961c prompt: update powerlevel10k submodule to v1.15.0
Release notes:

  - https://github.com/romkatv/powerlevel10k/releases/tag/v1.15.0
2021-06-10 09:32:20 -05:00
Indrajit Raychaudhuri 6833fcd2f2 node: Cleanup and optimize 'node' module
Changes:
- Simplify nodenv and nvm initialization
- Check for availability of `nodenv` or `nvm` function instead of command
- Unset local variables outside condition block
2021-06-01 21:43:11 -05:00
Indrajit Raychaudhuri f1e24d3fd8 completion: Unset local variable outside condition block
Unset `curl_prefix` outside condition block so that it is always
cleared. Also, avoid `brew --prefix <foo>` since it is triggering ruby
in fallback flow when `<foo>` is not present.

Also, apply minor formatting tweaks.
2021-06-01 14:48:30 -05:00
Indrajit Raychaudhuri 37443368c1 ruby: Cleanup and optimize 'ruby' module
Changes:
- Honor `$RBENV_ROOT` or `RVM_DIR` if set but, no need to set it
  explicitly if not set. Instead, let the respective initialization
  scripts take care of that.
- Reverse `rbenv` vs `rvm` selection order, preferring `rbenv` instead.
- Check for availability of `rbenv` or `rvm` function instead of command
  to validate requirements. In a properly configured and initialized
  shell, `rbenv` or `rvm` will be available as function.
- Adhere to more idiomatic Zsh operation and minimize redundant syntaxes.

For additional rationale, see: https://github.com/rbenv/rbenv/wiki/Why-rbenv%3F
2021-06-01 14:31:26 -05:00
Indrajit Raychaudhuri afe59b293b python: Update pyenv initialization flow per pyenv 2.0
In pyenv 2.0 onwards, it is not enough anymore to initialize pyenv in
shell by just calling `pyenv init -`. We also need to update `path` to
include pyenv shims by calling `pyenv init --path`.

Also, honor `$PYENV_ROOT` if set but, no need to set it explicitly if
not set. Instead, let the initialization script take care of that.
2021-06-01 14:29:39 -05:00
Indrajit Raychaudhuri f0942e6dda python: Optimize completion for loading lazily on demand
Move `pip` to separate completion definition delegating to pip to do
all the completion work.

Since the completion is loaded lazily on-demand, it avoids the
performance overhead during Zsh initialization.

Implementation note:
The helper function `_pip_completion` implementation is based on the
official pip completion function (which can be generated with
`pip completion --zsh`) adhering to the newer compsys style.

See: 'man zshcompsys' for more details.
2021-06-01 14:29:39 -05:00
Indrajit Raychaudhuri d686da3c03 python: Reformat and apply visual cleanup
Changes:
- Fallback to `virtualenvwrapper` without `pyenv` wrapper if `python` is
  available in path, regardless of whether `brew` is available.
- Look up for availability of `python2` and `python3`, not just `python`.
- Check for existence of path before adding to global `$path` array.
- Adhere to more idiomatic Zsh operation and minimize redundant syntaxes.
- Prefer looking up `$functions` for fully initialized `pyenv`.
2021-06-01 14:29:39 -05:00
Indrajit Raychaudhuri 9037fda36d completion: Avoid double-quoting LS_COLORS for completion
Double-quoting `LS_COLORS` prevents it from loading in environment,
which isn't what we want.
2021-05-25 18:12:45 -05:00
Ehren Kret 53033bc5d9 Fix broken source commands in node module
Placing `--no-use` inside the quoted string results in source
attempting to load a file which literally ends with ` --no-use`
instead of passing --no-use as an argument.
2021-05-24 11:33:49 -05:00
Indrajit Raychaudhuri 7052e2a002 completion: Skip completion lookup for key-only brewed curl
Skip lookup for `_curl` completion function to avoid fallback
completion having higher priority.
2021-05-23 19:40:32 -05:00
Indrajit Raychaudhuri 979144d0e4 git: Update minimum required git version to 2.11
Git 2.11+ has more versatile `submodule`, `fetch`, `rebase` options for
common use-cases.
2021-05-21 13:40:49 -05:00
hidekuro c4a8f446c6 git: Use `update` instead of `foreach` in alias 'gSu'
Modern `git` can use `submodule` option `update` instead of `foreach`
to achieve approximately similar outcome.

To allows call without assuming that all submodules will have default
branch as `master`, the preferred approach would be to call
`git submodule update --remote --recursive` after registering the
correct branch for submodule in `.gitmodules`:

```
git config -f .gitmodules submodule.<path>.branch <branch>
```

For more discussion, see: https://stackoverflow.com/a/33835815

Signed-off-by: Indrajit Raychaudhuri <irc@indrajit.com>
2021-05-21 13:40:49 -05:00
Indrajit Raychaudhuri a3643f124e git: Optimize scripts for git helper functions
Optimize git internal calls and adjustment git helper functions to use
more idiomatic Zsh conventions avoiding external calls.
2021-05-21 13:40:49 -05:00
Indrajit Raychaudhuri efebe3efec git: Alias and function cleanup and formatting for clarity
Changes:
- Prefer longer form of git switch for better clarity.
- Move `-S` (`--gpg-sign`) in all the alias definitions to  the end to
  allow custom keyid.
- Simplify operations in helper functions git native calls.
- Apply minor reformatting and rearranging.
2021-05-21 13:40:49 -05:00
Indrajit Raychaudhuri 9459a716bf node: Add handy aliases for 'npm'
Add standard `npm` aliases that are used frequently.
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri 28ec39d9b2 node: Add environment variable to store 'n' cache
See: https://github.com/tj/n#installation for details.
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri 9f37fc9841 node: Optimize completions for loading lazily on demand
Move `grunt` and `gulp` to separate completion definitions wrapping
`grunt --completion=zsh` and `gulp --completion=zsh` respectively.

Since the completions are loaded lazily on demand, they avoid the
performance overhead during Zsh initialization.

Additionally, remove `npm` completion since it is already bundled with
Zsh for quite a while.
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri f84075b8d4 node: Prefer nodenv over nvm when available
Reverse `nodenv` vs `nvm` selection order, preferring `nodenv` instead.

For additional rationale, see: https://github.com/nodenv/nodenv/wiki/Why-nodenv%3F
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri af46875c5e node: Revamp and optimize 'node' module
Changes:
- nodenv and nvm now honors (and prioritizes) `$XDG_CONFIG_HOME` over
  `$HOME` to lookup local nodenv/nvm installation.
- Make `nvm` loading lazy (via `--no-use` argument).
- Remove redundant NODENV_ROOT or NVM_DIR, respective script already
  set them up.
- Adhere to more idiomatic Zsh operation and minimize external command
  usage (like `sed`).
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri c6b59f8bb1 completion: Set standard style used by 'list-colors'
Set `LS_COLORS` if not already available so that it is available as
standard style `list-colors`.

This needs to be explicitly set in completion module to ensure that the
variable is available even if 'utility' module is not loaded earlier.
2021-05-21 13:37:40 -05:00
Indrajit Raychaudhuri 515d70f639 utility: Add support for 'aria2c' in 'get' alias
`get` alias now supports `aria2c` via optional `zstyle`.

To configure `aria2c` to be used for `get`, use:
zstyle -s ':prezto:module:utility:download' helper 'aria2c'

Note that we still fall back to `curl` when the desired download helper
isn't available.
2021-05-21 13:35:51 -05:00
Indrajit Raychaudhuri 7980dd91c9 gnu-utility: Add more utility commands and rearrange
Add missing `basenc`, `egrep`, `fgrep` etc. and reformat a bit.
2021-05-21 13:33:58 -05:00
Indrajit Raychaudhuri e07fd052d7 utility: Simplify conditional block for 'make' helper
Further, remove redundant `function` clause as per Prezto convention.
2021-05-21 13:33:07 -05:00
Indrajit Raychaudhuri d3d79bbe74 utility: Use Zsh native mechanism to detect GNU 'du'
Skip additional call to `grep` and use Zsh native mechanism to detect
GNU version of `du`.

Further, Remove redundant `function` clause as per Prezto convention.
2021-05-21 13:33:07 -05:00
Indrajit Raychaudhuri 6eb4021556 utility: Remove redundant `function` clause in 'diff'
We don't use `function` clause in Prezto by convention.
2021-05-21 13:33:07 -05:00
Indrajit Raychaudhuri d51e5ce40f utility: Always use 'git' fallback for 'wdiff' wrapper
Use `git` fallback (if present) even when color is off and `wdiff` is
not present.

Further, remove redundant `function` clause as per Prezto convention.
2021-05-21 13:33:07 -05:00
Indrajit Raychaudhuri 6c5657be8e zprofile: Don't exit 'less' when everything fits the screen
This aligns better with default `less` behavior and allows for
'growable content' when `less` is used as a substitute for `tail`.
2021-05-21 13:31:43 -05:00
Indrajit Raychaudhuri fae5e493ec utility: Check best-fit Python version for 'http-serve'
When creating `http-serve` alias, first check if Python is actually
available. And, if available, apply the most specific version.
2021-05-21 13:30:36 -05:00
Indrajit Raychaudhuri 2368c9142b utility: Honor pre-defined COLOR settings for grep
Honor `GREP_COLOR` or `GREP_COLORS` if already defined for coloring
`grep` output.
2021-05-21 13:27:52 -05:00
Indrajit Raychaudhuri 1ff9421f7b general: Update documentation better qualifying runcom paths
Zsh and Prezto files don't always reside in `~/`. Instead, they have
a more spec compliant location (`${ZDOTDIR:-$HOME}/`). Make them
unambiguous in the documentation. Likewise, for `$GNUPGHOME`.

Further, add instruction for optionally setting up Prezto in
`$XDG_CONFIG_HOME`.

While at this, also add clarification on relative ordering of some of
the modules, apply more formatting tweaks and doc improvements.
2021-05-21 12:31:02 -05:00
Indrajit Raychaudhuri 424d4cb779 utility: Detect GNU 'ls' before applying the relevant tweaks
Detect `ls` provided by GNU Core Utilities upfront before applying
the relevant settings and aliases.

The revised logic takes the following aspects into consideration:
- `is-callable 'dircolors'` is not a sufficient test for verifying if
  the `ls` in scope is _also_ provided by GNU Core Utilities. `ls` can
  continue to be the one provided by BSD Core Utilities because of its
  precedence in `$path`.
- The `ls` in scope anyway can be either GNU Utils provided or BSD Utils
  provided depending on either `$path` precedence, soft link (via
  `ln -s`), or wrapper function (via 'gnu-utility' module).
- So instead of '_guessing_' the possible one, just detect if it is from
  GNU Utils and apply the relevant settings and aliases.
- Note that GNU prefixed `ls` (`gls`) is intentionally not honored in
  this case to avoid possible conflict/shadowing with other `gls`
  callable (can happen if 'git' module is used, for example).
  Besides, honoring `gls` would imply we honor other commands (like
  `mv`, `rm` etc.) to be consistent. We have a module 'gnu-utils'
  dedicated for that after all.
2021-05-21 11:50:18 -05:00
Indrajit Raychaudhuri b14aca307d prompt: Update async helper to 1.8.5 2021-05-12 01:32:54 -05:00
Indrajit Raychaudhuri 0628b91028 completion: Update zsh-completions submodule to 0.33.0 2021-05-06 21:23:20 -05:00
Indrajit Raychaudhuri be61026920 general: Apply submodules' path change in doc and `zprezto-update`
We need to accommodate cases where a submodule local path (or remote)
URL can change. Accordingly, update instruction and `zprezto-update`
function to synchronizes submodules' remote URL configuration setting
to the updated value automatically.
2021-05-05 14:13:01 -05:00
bXV0ZQ 95d223aa8a prompt: Fix git submodule path for 'pure' with actual path
WARNING: This will require synchronizing submodules' remote URL
configuration setting to the value specified in `.gitmodules` by doing:
`git submodule sync --recursive` in your Prezto location.

Signed-off-by: Indrajit Raychaudhuri <irc@indrajit.com>
2021-05-05 14:13:01 -05:00
Indrajit Raychaudhuri 742c1ea26f history: use external `mv` command for HISTFILE migration
This will make sure the actual external command `mv` is used instead of
wrapper function.
2021-05-05 12:21:42 -05:00
Indrajit Raychaudhuri d80e393f78 general: Reformat documentation with better formatting and wording
General purpose reformating and rewording in (a few places). This should
also make markdown linting happier.

Prefer back-ticks wherever useful and use `console` for code blocks to
be executed on terminal.

Also, update references links wherever possible (including update from
'http://' to 'https://').
2021-05-05 12:21:04 -05:00
Indrajit Raychaudhuri 8edc5e9323 environment: Simplify nested conditional block
Avoid unnecessary nesting for conditional block.
2021-05-05 12:13:02 -05:00
Indrajit Raychaudhuri d04a6ef459 rsync: Recommend Homebrew or MacPorts rsync for macOS
Bundled `rsync` is 2.6.x which is too old. Prefer 3.2.x from Homebrew
or MacPorts instead.
2021-05-05 12:03:48 -05:00
Indrajit Raychaudhuri 788aa3d158 rsync: Check for new rsync before applying newer options
The newer options for extended attributes or file-flags got reliable
only after rsync v3.1.
2021-05-05 12:03:48 -05:00
Indrajit Raychaudhuri 261d3b8224 rsync: Remove broken HFS+ specific compression flag
Remove `--protect-decmpfs` by default since hfs-compression specific
changes have been marked by upstream as broken since 3.1.3 and there is
little likelihood of that changing.
2021-05-05 11:51:25 -05:00
Indrajit Raychaudhuri 68300e6de4 node: Fixup nvm path detection for Homebrew based nvm
Prefer using `brew --prefix nvm` instead of just `brew --prefix` and
actually use the variable `nvm_prefix` once detected and set up.
2021-05-05 11:50:59 -05:00
Indrajit Raychaudhuri e87a9b0a93 completion: Add completion for keg-only brewed curl when available
As curl bundled with macOS does not include `_curl` definitions, one
way to make `_curl` available is to install curl from Homebrew.

However, since curl from Hombrew is _keg-only_, its function path needs
to be explicitly included.
2021-05-05 11:49:57 -05:00
Indrajit Raychaudhuri 509c5ca80f history: Move HISTFILE path to more conventional one
Change default `HISTFILE` path from `~/.zhistory` to more conventional
`~/.zsh_history`. This aligns better with Debian variants, macOS and
Oh My Zsh.

This would provide an easier onboarding experience to users coming to
Prezto from standard (framework free) zsh or from Oh My Zsh.

For existing Prezto users, we attempt to automatically rename old
`HISTFILE` to new one iff the old one exists and the new one doesn't.
However, if both old and new `HISTFILE` exist and the old one is more
recent, we just alert the user about what changed with a suggested way
to accommodate the change.
2021-05-02 03:35:12 -05:00