Commit graph

430 commit

作者 SHA1 備註 提交日期
Matt Hamilton
2436a6da28 [completion] Fix ssh completion for ~/.ssh/config
I think this change results in the _expected_ behavior. Users can always
override this by overriding the zstyle, as that is a benefit of using
zstyles.

Ref: https://www.zsh.org/mla/users/2015/msg00467.html

and `which _ssh_hosts`

Fixes #46. Closes #294.
2018-09-27 14:26:26 -05:00
Eric Nielsen
edd4e82d8a
[ssh] Update init.zsh
based on https://stackoverflow.com/a/48509425/2654518, which is based on
http://rabexc.org/posts/pitfalls-of-ssh-agents

Current code has a few issues: depends on `SSH_AUTH_SOCK` and
`SSH_AGENT_PID` env variables, which might not be available in every
shell session; and tries to create a new socket for agent-forwarding by
checking `SSH_AUTH_SOCKET` instead of `SSH_AUTH_SOCK`.

Also, it's safer to create the env file with 066 mode and in the user
home directory.

About not using `$` inside `(( ))`, this is what the the section
ARITHMETIC EVALUATION in zshmisc(1) says:

> Named parameters and subscripted arrays can be referenced by name
> within an arithmetic expression without using the parameter expansion
> syntax.

And according to http://www.bash2zsh.com/zsh_refcard/refcard.pdf:

> `var` (does not require `$` in front unless some substitution e.g.
> `${#var}` is needed, `$` is error if `var` is to be modified)

Closes #292
2018-09-17 15:38:48 -05:00
Eric Nielsen
df672688de [history-substring-search] Fix bindkey back to what works
Just binding ^[[A/^[[B does not work for some terminals, while not
binding them breaks zle widgets on other terminals. That's how crazy it
can get  :- (

Fixes #293. Fixes #295.
2018-09-17 15:32:44 -05:00
Eric Nielsen
fe2cb6b9f5 [history-substring-search] Fix incompatibility with zle-line-init widget
See https://github.com/zsh-users/zsh-history-substring-search/issues/70
and comment by @molovo:

     I was already binding keys _after_ `zle-line-init`, but I'm pulling
     keycodes out of the `terminfo` module, which reports up
     (`$terminfo[kcuu1]`) as `^[0A` instead of `^[[A`. Binding `^[[A`
     manually mean up/down works with history-substring-search both
     before and after `zle-line-init`, but if I bind `$terminfo[kcuu1]`
     (`^[0a`), up/down only works *before* `zle-line-init`.

Closes #286
2018-09-16 12:01:52 -05:00
Eric Nielsen
c9d1be395d [prompt] Simplify short_pwd function
We don't need a second variable.
2018-09-13 10:10:49 -05:00
Sebastian Stammler
236eb14d59 [pacman] add yay to SUID handling AUR helpers
Closes #279
2018-08-21 02:02:46 -04:00
Eric Nielsen
903954985f [utility] Move GNU-only code down
so `lx` is defined after the general `ls` aliases, and also so we keep
the "condom" aliases were they were before commit 0dfce9e8.
2018-06-16 21:49:20 -05:00
Lucas Sunsi
4b0a6f9c7c Source syntax-highlighting after completion
syntax-highlighting should be sourced after compinit (see
https://github.com/zsh-users/zsh-syntax-highlighting#why-must-zsh-syntax-highlightingzsh-be-sourced-at-the-end-of-the-zshrc-file),
and history-substring-search should be sourced after syntax-highlighting
(see https://github.com/zsh-users/zsh-history-substring-search#usage).

Closes #276
2018-05-31 19:17:04 -05:00
Eric Nielsen
214330ddc9 [utility] The GNU ls alias is colours-related
Ops.
2018-05-24 21:09:06 -05:00
Eric Nielsen
0dfce9e8b7 [utility] Some GNU aliases are not colours-related
and they were mistakenly inside the Colours scope. Move them out of
there.

Still using the same `(( ${+commands[dircolors]} ))` test because it
works well with MacOS with coreutils installed without the `g` prefix,
for example.
2018-05-24 20:58:31 -05:00
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