Graf commitů

420 commitů

Autor SHA1 Zpráva Datum
Eric Nielsen
17b41952ce [utility] Revert "completion uses LS_COLORS for all OSTYPEs"
This reverts commit 2f0243e533.

Completion module does not depend on utility module anymore to set the
zstyle list-colors. Making modules independent from each other as much
as possible is a good thing.
2018-05-24 20:46:47 -05:00
Eric Nielsen
e70bee54f3 [completion] Update init.zsh and README.md
and use local string variable instead of "hardcoding" the string inside
`${}`.
2018-05-24 20:37:16 -05:00
AtomicCoding
a9828a8097 [completion] LS_COLORS independent of utility module
Completion module can now be loaded from an arbitrary location.

Closes #275
2018-05-24 20:15:27 -05:00
Eric Nielsen
3b7eeda8f7 [environment] Use setopt NO_FOO instead of unsetopt FOO
As used in other modules. Also easier to document in the comments and
README.

Replace table by bulleted list so it's possible to use `|` in the text
without breaking the Markdown rendering.
2018-05-18 13:54:48 -05:00
Eric Nielsen
e7275a9758
[input] Update README.md 2018-05-17 09:01:04 -05:00
Eric Nielsen
855c488b13 [utility] Use chmod and chown when in GNU
Same for the `lx` alias.

Also update the README.md. Replace table by bulleted list so it's
possible to use `|` in the text without breaking the Markdown rendering
(as it did for the table).
2018-05-16 19:05:55 -05:00
Eric Nielsen
e38b44cd7f [directory] Update README.md
Replace table by bulleted list so we can use `|` in the text without
breaking the Markdown rendering (as it did for the table).

Closes #272
2018-05-16 14:21:37 -05:00
Eric Nielsen
b7cb8d81c0 Update module README.md 2018-05-14 19:09:11 -05:00
Eric Nielsen
539f8ae8df [git] Move git-action to its own autoloadable file
instead of redefining the function constantly inside git-info.
2018-05-09 20:22:32 -05:00
Eric Nielsen
f11bb607c5 [git] Update git-branch-delete-interactive
so we don't suggest deleting remote branches when `git rev-parse`
failed. For example, it could fail if a remote tracking branch is gone.
2018-04-25 19:20:51 -05:00
Eric Nielsen
d371d80af2
Unify the for syntax
For short single commands, prefer a one-liner `for` with the zsh syntax:
```
for x (foo bar) print ${x}
```
Otherwise just place `; do` on the same line as the POSIX `for ... in`:
```
for x in foo bar; do
  print ${x}
done
```

Closes #268
2018-04-25 08:59:19 -05:00
Eric Nielsen
1aa7d7a401 [history-substring-search] Only load terminfo feature of zsh/terminfo
like we did for the input module in 7861145, and to make modules
independent of each other, as discussed in #261.
2018-04-24 09:04:44 -05:00
Eric Nielsen
4acd1b8533 Update comments in zimrc template
mainly to change "command correction prompts" to "spelling correction
prompt for commands" and make it clear that this is related to spelling
(and to the `SPROMPT` below that).
2018-04-24 08:59:58 -05:00
AtomicCoding
52604eb234 Add custom SPROMPT
Closes #263
2018-04-23 12:09:04 -05:00
Eric Nielsen
e29c4e9cde Use bindkey instead of set -o
Using `bindkey` is the preferred zsh way to do it.

As far as I checked, also `set -o emacs` defines a less complete set of
key bindings compared to `bindkey -e`.
2018-04-19 12:32:56 -05:00
Anton Shiryaev
acdb1d4bc7 Add .zimrc option 'zinput_mode'
Closes #261
2018-04-19 12:32:56 -05:00
Eric Nielsen
5768625356 [input] We also need the echoti feature of zsh/terminfo 2018-04-18 17:24:48 -05:00
Eric Nielsen
78611457f2 [input] Only load terminfo feature of zsh/terminfo
and use `-F` to check if the feature was not already loaded before.

Use terminfo elements for Backspace and Delete. Sort by terminfo element
keys.

Also simplify code, removing unnecessary double quotes, and replacing
if-then-fi with one command by one-liners.
2018-04-13 15:23:53 -05:00
Eric Nielsen
26dce76d28
[input] Use custom expand-or-complete in zsh < 5.3
as `expand-or-complete-with-redisplay` was added to fix an issue
reported with zsh 5.2 when completing with <Tab><Tab><Ctrl-C>. See #85.

Fixes #134. Closes #256
2018-04-13 15:15:54 -05:00
Eric Nielsen
8655867ca2 [git] Add completion for gbx and gbX
that use the git-branch-delete-interactive function.

Thanks to @Mikachu for helping with the completion function
implementation over the #zsh chat.

Closes #265
2018-04-13 15:13:43 -05:00
Eric Nielsen
13eb86d4c8 And also simplify functions glob in init.zsh
to match the change done in `login_init.zsh`.

Also call autoloaded function only when autoload succeeded.
2018-04-09 18:20:54 -05:00
Eric Nielsen
78e6d1fc91 Also still not zrecompile prompt_*_setup files
missed that on the last commit.
2018-04-09 18:12:34 -05:00
Eric Nielsen
d74ceedef7 Generic approach for zrecompiling scripts
* create digest of scripts in a `functions` directory that don't start
  with `_` (completion functions) and that don't have a `.` (function
  names cannot have that character)
* zrecompile any `.zsh` or `.zsh-theme` file that is not in a `*test*`
  directory (see 2a9a003), and that is a plain file with more than 1K of
  size.

instead of the fixed logic that was zrecompiling syntax-highlighting and
history-substring-search modules' scripts.

Closes #260
2018-04-09 18:09:07 -05:00
Eric Nielsen
468f99adfe [git] Remove extra line break from graph logs
so we have more vertical space for the actual log entries, instead of
having each one separated by a line just with graph lines. Also, this is
the default layout already, see `git log --graph --oneline` for example.
2018-04-09 12:07:37 -05:00
kiryph
3d46387981 [utility] Document that mkcd is run with -p
Closes #259
2018-04-06 12:59:35 -05:00
Eric Nielsen
2f0243e533 [utility] completion uses LS_COLORS for all OSTYPEs
GNU colours are used by the completion module for all `OSTYPE`s, for
colouring the files in the menu. We had lost that for BSD after previous
changes to this module.
2018-04-05 10:19:14 -05:00
Eric Nielsen
fd822d28bb Change order or module loading system
First choice is `init.zsh`, the script we use, introduced by Prezto.

Next choices are based on which are the most common init scripts in the
zsh-users repositories:

* `zsh-autosuggestions`, `zsh-history-substring-search` and
  `zsh-syntax-highlighting` have `${zmodule}.zsh`
* `zsh-completions` has `${zmodule}.plugin.zsh`

Latter format apparently was introduced by Oh-My-Zsh.

Leaving `${zmodule}.zsh-theme` and `${zmodule}.sh` as the last options.
2018-04-05 08:24:17 -05:00
Atomic Coding
2ea2ba2fc8 Update the module loading system
to load modules with `{module_name}.plugin.zsh` and `{module_name}.zsh`
in order to improve compatibility.

Closes ##257
2018-04-05 08:24:17 -05:00
Eric Nielsen
56b61e211d [completion] Simplify matcher-list syntax
Refactor using `+` instead of repeating the case insensitive pattern.
2018-04-03 08:57:30 -05:00
Andrés Calabrese
2a7797c2da Remove old link to meta module in README
Meta module was removed in e0a7c67

Closes #255
2018-04-03 08:52:04 -05:00
Eric Nielsen
e1a2a38a0f [completion] Prefer left-matching before fuzzy
all still being case insensitive.

Having just fuzzy matching returns too many matches in the average case.
2018-03-23 08:36:16 -05:00
Eric Nielsen
98eef4184a [completion] Improve fuzzy completion matching
This will present the menu in case of ambiguous matches, and also expand
by any separator, not just `[._-]`.

Based on the configuration suggested at
https://superuser.com/a/815317/637926

Closes #212
2018-03-22 11:41:21 -05:00
Eric Nielsen
017ff99851 [completion] Don't beep on an ambiguous completion
Remove beep when completion is shown. We don't want that to sound like
an error.
2018-03-01 08:25:33 +01:00
Eric Nielsen
cfdf36d76b [completion] Ask when completion list is long
To achieve this, we have to make sure that the following is not set:
* `zstyle ':completion:*:default' list-prompt '...'`

otherwise long completion lists will be paginated (without prompting).

The list is considered too long when it's greater than `${LISTMAX}`,
which has a value of 100 by default.

Also remove options being set (or unset) that are already the default,
namely:
* `AUTO_MENU <D>`
* `AUTO_LIST (-9) <D>`
* `MENU_COMPLETE (-Y)`

And remove the space character from the beginning of the messages.

Fixes #136. Closes #248
2018-03-01 08:25:33 +01:00
Eric Nielsen
20f16e4df3 [git] Remove glb alias and add glO
as there's actually no "brief" format originally in git (by "originally"
I mean the ones listed for `--format=<format>` in `man git-log`).
Also, we already fit in `glG` all the information that `glb` had.
So add `glO`, that is a one-line variant of `glG`.
Now we get nice symmetrical formats in `glg`/`glG` and in `glo`/`glO`.
2018-02-23 09:30:50 +01:00
Eric Nielsen
926627652f [git] Breaking changes in aliases and functions
Rename `gpS` (mnemonic "pretty-signature") and `glS` ("log-signature")
to `gcv` ("commit-verify") and `glv` ("log-verify") respectivelly,
so `v` is used to verify signatures, and `s`/`S` is used to sign.

Remove `git-commit-lost` and `git-stash-dropped`, as this could be
probably joined into one function that shows all lost commits, including
lost stashes, and also because there seems to be many different ways to
do this, as discussed in https://stackoverflow.com/q/89332/2654518.
An answer worth noting is https://stackoverflow.com/a/6455586/2654518.
If someone is using this, let's discuss on a new solution...

Remove Oh-My-Zsh compatibility from `git-branch-current`, and delete
`git_current_branch`. This compatibility was already partially broken at
c1b02c0, when we also updated the gitster prompt theme. Now this
function fails when in 'detached HEAD' state (is was returning the
commit hash in this state), which is what we would expect from the use
we make of it.

Closes #244
2018-02-23 09:28:10 +01:00
Oskar Grunning
6465970530 [git] Repair gCl alias
The no-pager option should be set on `git` and not `git diff`.

Closes #246
2018-02-15 18:44:13 +01:00
Eric Nielsen
de045ab70e [archive] Fix lzma typo
Looks like nobody uses it, as the same typo is present in Oh-My-Zsh and
Prezto...  :- )
2018-02-08 11:03:30 -05:00
Eric Nielsen
e244a123d8 [archive] Add unarchive completion
Closes zimfw/archive#1
2018-02-08 10:59:43 -05:00
Eric Nielsen
6af7892f91 [archive] Check unrar with commands array
“unrar-free returns the error code 1 when run without arguments, thus
failing the presence check.” as reported at sorin-ionescu/prezto#1383

Reformat code and use one-liners instead of if/then/fi. And we don’t
need to separate local definitions from assignments anymore starting
from zsh 5.2.
2018-02-07 18:27:59 -05:00
Eric Nielsen
2d1aea3b74 [prompt] Remove autoload -Uz colors
since we don't need that. We're using the newer '%F{red}color%f' code
instead.

Also use `PS1` instead of `PROMPT`, as suggested at `man zshcontrib`,
under "Writing Themes”.

Refactor code.
2018-02-07 18:15:17 -05:00
Eric Nielsen
451e51bd88 [git] Add git-branch-delete-interactive
that prompts if upstream remote branch(es) should be deleted too. As
with `git branch`, the function supports multiple branches as params,
and also the `-r`/`--remotes` param. Update `gbx` and `gbX` to use this
function.

Also update `git-stash-clear-interactive` to have multiple tests instead
of multiple nested `if`/`then`/`fi`. (Simpler syntax, IMHO)
2018-02-05 10:44:59 -05:00
Eric Nielsen
e9171405cf [prompt] steef: Update it to be customizable
and to have a help and a preview too.

Inspired by #192, and by having (few but) good prompt themes to serve as
starting points for the users to customize or implement their own.

Also removed the colors functions, since we don't need that. We're using
the newer '%F{red}color%f' code instead. (Actually all our themes are)

Closes #245
2018-01-22 17:37:35 -05:00
Eric Nielsen
fd9274ea91 [git] Show upstream branch name in gbl and gbL
being more verbose when listing branches.
2018-01-22 17:25:51 -05:00
Eric Nielsen
c501a1b64c [git] Review aliases and README.md
This complements the changes done in the last commit, and also fixes the
`glg` output, and removes the now unnecessary `--date=relative`
parameter from `glG`.

Although I insisted on the `--long-option` format on 8669a4f, I think
`rm -rf` is pretty common and recognizable, so revert to that.

Add missing aliases to README.md, and improve description of existing
ones. The main improvement is trying to be more concise, so instead of
repeating "records changes to the repository" multiple times, simply say
"commits", for example. Also try to use words that match the alias
letters, so for "gcs" say "shows" instead of "displays", for example.
2018-01-11 11:30:20 -05:00
Eric Nielsen
0a7451999e [git] Review all functions but ones using git fsck
as there are multiple solutions to list the lost commits and stashes,
but I could not find reliable ones. See
https://stackoverflow.com/q/89332/2654518.
Well, the current `git-commit-lost` and `git-stash-dropped`
implementations don't accurately work at least on the repositories I'm
working with.

The `git-hub` functions where removed at dcc3265, but aliases and docs
remained. Remove these.

Remove line break from `_git_log_oneline_format`, so it really occupies
one line. And change date format in `glG` output from committer date
(`%cd`) to relative author date (`%ar`) to conform with other formats.

Refactor remaining functions. Most of the changes refer to using the
already existing git error messages and return codes, instead of having
code that creates that. (Error messages for 'not in a git repository'
where not even consistent among functions, and there's were I started
this...)
The most drastic changes can be seen in `git-root`, then in `git-dir`
and `git-stash-clear-interactive`.
2018-01-10 10:25:25 -05:00
Eric Nielsen
4156606e67 [git-info] Move git-info function to functions dir
since we already have a function (`coalesce`) defined and both can now
get zcompiled into the same digest file.

Also, nest the `git-action` function to the scope where it's used.
2018-01-09 09:24:01 -05:00
Eric Nielsen
9a8cb227f3 [git-info] Define integer variables with -i
also multiple variables can be defined with `local` at the same line.
2018-01-08 17:20:10 -05:00
Eric Nielsen
7b70cffc0e [prompt] eriner: Simplify help message and use PS1
and `RPS1`, instead of `PROMPT` and `RPROMPT`, as suggested by the zsh
manual at `man zshcontrib`, under "Writing Themes":

> By convention, themes use `PS1`, `PS2`, `RPS1`, etc., rather than the
longer `PROMPT` and `RPROMPT`.
2018-01-08 12:22:35 -05:00
Eric Nielsen
ae133abca9 Compile functions.zwc for each functions directory
instead of a big single `functions.zwc` file containing functions from
all the `functions` subdirectories.

This solution here better suits the functions autoloading mechanism in
zsh, as documented in
http://zsh.sourceforge.net/Doc/Release/Functions.html#index-autoloading-functions

Given `~/.zim/modules/foo/functions` is in the `fpath`, autoload looks
for functions in the following files, picking the **newest one** in this
order:
* `~/.zim/modules/foo/functions.zwc`, which should contain all
  functions in the directory named `functions`
* `~/.zim/modules/foo/functions/function.zwc`
* `~/.zim/modules/foo/functions/function`

With this approach, we're also having individual entries back in `fpath`
for the `functions` subdirectory of each enabled module (as was the case
before commit 55df5a4).

This is also probably closest to the original plan at #86. The current
code was not compiling "*all* files in a folder into a single digest",
but instead compiling *all* files in *all* the functions folders into a
single digest, which was a bad idea. This commit fixes this.

Fixes #231. Fixes #232. Closes #234.

Closes #239
2018-01-08 11:56:18 -05:00