1
0
Fork 0
mirror of synced 2024-11-22 15:25:34 -05:00
Commit graph

654 commits

Author SHA1 Message Date
Eric Nielsen
ab41c4484d [completion] Add options to README.md
Prefer `setopt NO_FOO` instead of `unsetopt FOO`, as former is easier to
document in the README.

Stick with the following style for the README:

* Header 1 with the module name is in `lowercase`.
* Other headers are in `Sentence case`. Common header names that should
  be consistently used are `Aliases`, `Contributing`, `Functions`,
  `Settings`, and `Zsh options`.
2018-12-15 16:54:32 -05:00
Eric Nielsen
81a52a5d7d [history] Use fc -l instead of history
`history` is equivalent to `fc -l`, and `fc` is the actual Zsh builtin.

Add the `-n` flag to suppress event numbers when listing.
2018-12-15 08:10:29 -05:00
Eric Nielsen
af11392473 [history] Remove EXTENDED_HISTORY and INC_APPEND_HISTORY
as they are not required (not even recommended) to be set along with
`SHARE_HISTORY`. See zshoptions(1) on `SHARE_HISTORY`:

> This option ... also causes your typed commands to be appended to the
> history file (the latter is like specifying `INC_APPEND_HISTORY`,
> which should be turned off if this option is in effect). The history
> lines are also output with timestamps ala `EXTENDED_HISTORY` ...

Also update copy in comments and in the README. Stick with the following
style for the README:

* Header 1 with the module name is in `lowercase`.
* Other headers are in `Sentence case`. Common header names that should
  be consistently used are `Aliases`, `Functions`, `Settings`, and
  `Zsh options`.
* The names `Zim` and `Zsh` always appear capitalized, even in the
  middle of sentences.

Closes #313
2018-12-15 08:10:29 -05:00
Eric Nielsen
b4ae40652d Update README.md instructions and formatting
Add a first step to explicitly start the Zsh shell, as some issues were
reported before because users were skipping this. See #214 for example.

Also mention `~/.zlogin` as part of the uninstalling process.

Use the following formatting styles:
* Headers >1 are in `Sentence case`.
* The names `Zim` and `Zsh` always appear capitalized, even in the
  middle of sentences.
* Prefer

      code indented with 4 spaces

  instead of
  ```
  code fenced by lines with three back-ticks
  ```

Closes #315
2018-12-15 07:58:03 -05:00
Eric Nielsen
7ccdcf35ee [git] Add missing items in README.md
namely, the `gfu` alias, the `git-branch-delete-interactive` function,
and a couple of commands that are shadowed.

Command `gm` was reported in #59, and `grc` was reported in #139.
2018-12-13 14:47:25 -05:00
Eric Nielsen
2004fb320b [archive] Support unarchive of multiple files
so we can do `unarchive *.tar.gz` for example.

Update README and compdef accordingly.
2018-12-07 12:55:06 -05:00
Marko Kaznovac
1e3cee4715 Don't track new files in submodules from main repo
Prevent main repo `git status` reporting submodules having new files.
New files are usually zcompiled zsh files.
There's no way to .gitignore from main repo specific files in submodules

Closes #297
2018-11-26 22:12:49 -05:00
Eric Nielsen
c50a0153d2 [completion] Update submodule to version 0.29.0 2018-11-26 21:33:30 -05:00
Eric Nielsen
5fb3d4ea08 [autosuggestions] Update submodule to version v0.5.0
Main change we're interested in with this release is:
> Change `config.zsh` to keep previously set values of config vars
> https://github.com/zsh-users/zsh-autosuggestions/issues/335

Fixes #301
2018-11-26 18:22:58 -05:00
Eric Nielsen
2e3ba7996b
[archive] Allow archives in any directory
Current code will create an archive in the current directory with:

    % archive ../test.tar.gz test.*

or will complain that the following archive doesn't exist in the current
directory (given it actually exists in the parent one):

    % unarchive ../test.tar.gz

Fix that and allow archives in any directory.

Other changes:

* Use `<required_param>` instead of `[required_param]` in the usage text
* Don't explictly check if archive exists in `unarchive`, but let the
  respective tool fail with its own message

Closes #312
2018-11-24 22:45:08 -05:00
Eric Nielsen
13ba167baf [input] Put necessary double quotes back
My fault, I removed them in commit 78611457, but they are necessary.
Without them, we are getting the following error when one of the
terminfo[] values is empty:

    init.zsh:14: bad set of key/value pairs for associative array

Fixes #310
2018-11-21 17:54:24 -05:00
Eric Nielsen
a05890e8b4
Use cat to concatenate files in installation
Update installation instructions in README.md to use cat. Also add blank
lines at the end (instead of beginning) of template files, since they're
prepended (not appended) to existing files.

See difference of output between print and cat (zlogin having a blank
like at the end):

    % print -rn "$(<zlogin)$(<test)"
    #
    # User configuration sourced by login shells
    #

    # Initialize zim
    [[ -s ${ZIM_HOME}/login_init.zsh ]] && source ${ZIM_HOME}/login_init.zsh# Hello world
    % cat zlogin test
    #
    # User configuration sourced by login shells
    #

    # Initialize zim
    [[ -s ${ZIM_HOME}/login_init.zsh ]] && source ${ZIM_HOME}/login_init.zsh

    # Hello world

Fixes #94. Fixes #280. Closes #300
2018-11-21 11:58:30 -05:00
Ezinwa Okpoechi
7dfd617497 [git] Make gpf alias safer
Fixes #303. Closes #304.

As a reference,
https://github.com/k88hudson/git-flight-rules/blob/master/README.md#i-want-to-delete-or-remove-my-last-commit
also recommends using --force-with-lease.
2018-11-20 18:45:03 -05:00
Eric Nielsen
d259e19dd8 Don't need to use array[@] ouside double quotes
In  double  quotes,  array  elements  are put into separate words when
using `"${(@)array}"` or `"${array[@]}"`. See zshexpn(1).

Also according to the Zsh documentation, these forms preserve empty
elements of the array.
2018-11-19 19:43:21 -05:00
Eric Nielsen
268a570ae3 [utility] Use CLICOLOR for coloured output in BSD
instead of aliasing `ls` to `ls -G`.
CLICOLOR is detected not only by `ls`, but by `tree` too (starting with
version 1.8.0). See http://mama.indstate.edu/users/ice/tree/changes.html

It's probably more widely used by other tools too.
2018-11-19 17:13:45 -05:00
Eric Nielsen
1c23ea1604 [archive] Support archive of multiple files
not just one directory.

Also use shorter versions of the `tar` parameters, since we were using a
mixture of the short and long ones among `archive` and `unarchive`.

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 #308
2018-11-14 20:32:37 -05:00
Eric Nielsen
2c5e7c02ea [archive] Add missing bzip2 extensions
We already had .tar.bz2, .tbz, .tbz2 and .bz2
We were missing .tar.bz and .bz

Noticed this in the pull request #308 by @Konfekt.
2018-11-14 20:20:52 -05:00
Bryan Hyshka
60b0910f6d [pacman] Add pikaur to list of AUR helpers that handle SUID
`pikaur` (https://github.com/actionless/pikaur) handles sudo
authentication itself.

Closes #302
2018-10-19 08:32:34 -05:00
Eric Nielsen
364d6b831d [prompt] steeef: Fix git-info stashed zstyle
Only define it if it's non-empty. New git-info changes will consider
zstyles to be defined even if they are empty.
2018-10-10 18:24:45 -05:00
Eric Nielsen
270b5d0390 [git-info] Simplify functions
Add missing local variable set.
Replace `>/dev/null 2>&1` by `&>/dev/null`.
Check return value of zstyle (if zero), instead of resulting string
value (if non-empty).
2018-10-02 20:02:06 -05:00
Eric Nielsen
35c5daf791
[pacman] Remove dependency from completion module
The completion module has specific code for the pacman module, and we
want to make modules independent from each other.

Plus, as far as I checked, most of the pacman wrappers/frontends are
already packaged with zsh completion out of the box. I'm not an Arch
user, but I checked the repos of the ones in
https://wiki.archlinux.org/index.php/AUR_helpers#Pacman_wrappers and
these contain zsh completion scripts:

* aura: https://github.com/aurapm/aura/blob/master/aura/doc/completions/_aura
* pacaur: https://github.com/rmarquis/pacaur/blob/master/zsh.completion
* pakku: https://github.com/kitsunyan/pakku/blob/master/completion/zsh.patch
* pikaur: https://github.com/actionless/pikaur/blob/master/packaging/usr/share/zsh/site-functions/_pikaur
* trizen: https://github.com/trizen/trizen/blob/master/zsh.completion
* yay: https://github.com/Jguer/yay/blob/master/completions/zsh

I didn't find zsh completions for the ones listed below, so I added a
compdef function for them inside the pacman module itself:

* aurman
* packer-aur
* wrapaur
* yaourt

Closes #296
2018-10-01 08:17:22 -05:00
Marko Kaznovac
e5639c8fa7 [prompt] pure: Update submodule to version 1.8.0
changelog:
https://github.com/sindresorhus/pure/compare/v1.6.0...v1.8.0

Closes #298
2018-09-30 10:42:17 -05:00
Eric Nielsen
6b5d422a0a [completion] Update submodule to version 0.28.0 2018-09-28 13:20:36 -05:00
Eric Nielsen
1deef75aac [autosuggestions] Update submodule to version v0.4.3 2018-09-28 13:17:33 -05:00
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