Commit graph

101 commits

Author SHA1 Message Date
Indrajit Raychaudhuri 3ea20cfbe8 utility: Make 'http-serve' handler faster for well known cases
In most systems, python2 or python3 command/soft-link would almost
always exist. In such cases, we don't need to invoke `python` to
detect the version. This should speed things up a bit as well.
2022-08-03 18:51:49 -05: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
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 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 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 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 7222fe5fd6 utility: Autoload helper functions for 'run-help'
Now that, prezto is configured to lookup more specific 'run-help'
function, autoload the known ones for utility.
2021-04-30 03:09:07 -05:00
Austin Sloane 4e7ab4b8b7
utility, helper: add aliases to use with termux terminal emulator (android) (#1859) 2020-07-20 16:07:53 -07:00
Kaspar Vollenweider f4ca9ebfc9 feat(helper): add os-type helper functions
Add the following functions:

- is-darwin
- is-linux
- is-bsd
- is-cygwin

And apply them everywhere I found code doing that what these functions do.
2020-03-19 11:49:11 -07:00
Kaleb Elwert 2873885d37 utility: fix safe-ops commands
Fixes #1699
2019-09-21 17:29:21 -07:00
monai b8d7e2cad8 Add zstyle option to disable zsh option CORRECT 2019-03-05 14:04:21 -08:00
Tercio Gaudencio Filho 1ed5331e84 Fix issue #1635. Option to disable GNU ls to group directories first. 2018-10-18 16:22:04 -05:00
Indrajit Raychaudhuri 992b9de505 doc: More copyediting and formatting for consistency 2018-10-12 12:04:49 -05:00
Ashish Gandhi b6b43eb331 Rename "Mac OS X" to "macOS" in comments
This only changes references in text for human consumption. It leaves
out renaming paths because that can cause breaking changes.

Related issue https://github.com/sorin-ionescu/prezto/issues/1449.
2018-04-16 15:53:48 -07:00
Kaleb Elwert 443021237a
Allow users to easily define LS_COLORS and LSCOLORS (#1546) 2018-03-30 17:47:05 -07:00
Diego Rabatone Oliveira b3c27bb164 Replace git with 'command git' (#1551)
to improve performance if git is aliased to hub or other wrappers.
2018-03-05 00:56:25 -08:00
Kaleb Elwert 742260b55f Remove support for pydf to make options more consistent
Closes #1388
2018-02-21 14:10:11 -08:00
Kaleb Elwert 82d3265ad5 utility: remove usage of noremoteglob until bugs can be fixed
Fixes #1443, #1521
2017-12-18 13:35:23 -08:00
Indrajit Raychaudhuri 2436806fce [utility] Simplify enabling 'diff' color conditions in wrapper function
Nested `if` can be removed for simple cases like these.
Also, doc cleanup.
2017-11-12 16:51:24 -08:00
Andrew Breckenridge 34d4897d0e Updates outdate Mac OS X to macOS 2017-09-07 11:30:05 -07:00
Samantha McVey 808d9d3579 Add zsh-help function for easily searching the zsh documentation (#1360)
* Add zsh-help function for easily searching the zsh documentation

Looks up things in the zsh documentation.
Usage: zsh-help [--all] search term(s)

Option --all will seach for the term anywhere, not just at the start of a
line. When not using --all it will search nicely for terms at the beginning
of the line, which in the zsh man pages is where terms that are explained
are located, allowing you to search the zsh man pages easily.

* Improve zsh-help to search section headings before other text

Provides a much easier way to search and access ZSH's manual. First checks for
terms at the start of the manual, then checks if it's at start of a line allowing
whitespace.

Clean up some of the code a bit and format it to have a proper header for the
zprezto project with author/email and description of the function.
2017-09-06 11:11:19 -07:00
Indrajit Raychaudhuri a60fe47359 [utility] Refactor rsync_scp wrapper function and add completion support
Changes:
- Rename `rsync_scp_wrap` to `noremoteglob` and make it more generally usable
- Enable completion support for commands wrapped with `noremoteglob`
- Tighten up internal variable usages
- Update documentation for 'noremoteglob' function
2017-07-22 13:13:52 -05:00
Indrajit Raychaudhuri ac628c9059 [general] Switch code block formatting to use fence formatting
Changes:
* Indented code block doesn't support syntax highlighting, use fenced
formatting (```) instead for better syntax highlighting
* Wrap commands/functions in backticks
* Typo fixes
2017-07-22 13:11:29 -05:00
Indrajit Raychaudhuri 608f291ad3 [utility] Reuse interactive aliases when 'safe-ops' is set
When `safe-ops` is set, we can reuse the aliases that are already available.
2017-07-21 09:35:14 -07:00
Indrajit Raychaudhuri cb4be65d29 [utility] Update documentation for 'safe-ops'
Update formatting and wordings to be more consistent with rest of prezto
documentation.
2017-07-17 19:57:32 -05:00
Indrajit Raychaudhuri f236344fc8 [utility] Remove premature call to compdef
This is a temporary fix to work-around a minor regression in 90071d3.
2017-07-15 00:54:15 -05:00
Kaleb Elwert 90071d3ad0 utility: fix completion for rsync and scp 2017-07-14 13:28:29 -07:00
Kaleb Elwert 17bc7530ba Update documentation on safeops 2017-07-11 11:58:56 -07:00
Kaleb Elwert aad91beb3c [utility] Move the safeops aliases into their own section and add XXi variants 2017-07-11 11:52:47 -07:00
Samantha McVey 2a75fba6a8 [utility] Add safe-ops zstyle option to disable safe rm/cp/ln/mv
Currently rm/cp/ln/mv are aliased to rm/cp/ln/mv -i so that it will
prompt before removing files.

Some people would not like this functionality and wish for an easy way to
disable it. This adds a new option:

zstyle ':prezto:module:utility' safe-ops yes/no

It is enabled by default even if zstyle is not set, but can be set to no
to disable these aliases.

This should resolve issue #205
2017-07-11 11:48:05 -07:00
Kaleb Elwert 7d5beeab51 Add comments into each of the function files to make them easier to find 2017-07-06 16:13:36 -07:00
Samantha McVey a876890afd [utility] scp/rsync glob local paths but don't glob remote paths
Adds a function which wraps rsync and scp so that remote paths are not globbed
but local paths are globbed. This is because the programs have their own
globbing for remote paths. The wrap function globs args starting in / and ./
and doesn't glob paths with : in it as these are interpreted as remote paths
by these programs unless the path starts with / or ./

Fixes issue #1125
2017-07-03 17:20:34 -07:00
Diego Rabatone Oliveira 7c172fc9a7 Fix #1337 by removing top alias to htop. (#1341)
Fixes #1337
2017-06-21 14:37:03 -07:00
Guillaume Subiron 81b41d2367 Add utility alias for pydf 2017-04-18 02:37:23 -07:00
Kaleb Elwert 600b4cc9e6 Add missing alias to utility README 2017-04-15 14:16:15 -07:00
Kaleb Elwert 38f0d2f34e Rework diff function
This removes --unified from the default options to make it possible to pass -y
without worrying about conflicting output formats.

diffu has also been added as an alias to make it easier to get output as a
unified diff.

Fixes #1231
2017-04-15 14:06:07 -07:00
Zhiming Wang 464a8d20a1 utility module: fix/improve colordiff call in diff
The new call is compatible with colordiff v1.0.8 - v.1.0.15 (might be
compatible with even earlier versions, but not tested), while the
original one breaks down under v1.0.14 and v1.0.15. See
https://github.com/daveewart/colordiff/issues/22.
2017-04-05 00:23:37 -07:00
Kyle Rich 4e35f701ca Add "sa" alias to make it easy to search aliases 2017-04-04 21:11:36 -07:00
Eduard Zintz 8913bcccd2 Use python3 for http-serve alias if available (#1193) 2017-04-03 13:27:06 -07:00
Sorin Ionescu cd5067668c Substitute command when alias is undefined 2015-05-19 18:24:04 -04:00
Sorin Ionescu b41f485528 Add missing parenthesis
The bug was introduced in 933c61b.
2015-02-22 23:52:41 -05:00
Sorin Ionescu 933c61b8f1 [Fix #776] Support GNU top 2015-02-22 21:42:11 -05:00
Sorin Ionescu 88aee30ae8 [Fix #762] Use $LOGNAME instead of $USER
$USER is deprecated.
2015-02-13 00:00:27 -05:00
Sorin Ionescu ba351df9fb [Fix #748] Set grep color for BSD and GNU 2014-12-08 18:13:25 -05:00