Commit graph

382 commits

Author SHA1 Message Date
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
Eric Nielsen
313d157c9e [autosuggestions] Update submodule to version v0.4.2 2018-01-05 12:30:56 -05:00
Eric Nielsen
3c96d0b8e1 Revert "Also zrecompile functions starting with _"
This reverts commit 07d32caaae.

Now I get the intention of not zcompiling or autoloading functions whose
names start with `_` or `.`: these are indented to be used by the com-
pletion system and dumped into the `.zcompdump ` file.

See
http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-compinit
2018-01-03 11:48:52 -05:00
Brottweiler
6f8be83920 Update to new repo URL
from `Eriner/zim` to the new `zimfw/zimfw`.

Closes #238
2018-01-03 10:30:12 -05:00
Eric Nielsen
07d32caaae Also zrecompile functions starting with _
This was causing issues with https://github.com/jocelynmallon/zshmarks,
that has a `functions/_jump_showmarks_deletemarks` file.

Fixes #231
2018-01-02 12:27:05 -05:00
Eric Nielsen
5387adb78e [utility] Change colour blue to bold blue
Since some terminal colour schemes have a too dark blue color that does
not go well with a black background. And since some people actually use
such colour schemes!  :- )

Fixes #225
2017-12-01 17:28:02 -05:00
Eric Nielsen
20c3f79743 [git] Change colour blue to bold blue
Since some terminal colour schemes have a too dark blue color that does
not go well with a black background. And since some people actually use
such colour schemes!  :- )

Fixes #228
2017-12-01 17:23:34 -05:00
Eric Nielsen
9d0851ed95 [utility] Use "our" ls colors in GNU too
They were only being applied to BSD. Also, GNU uses `LS_COLORS`, and BSD
only uses `LSCOLORS`. Keeping these consistent, with same color scheme,
in both GNU and BSD.

Simplify arithmetic command expression without using `${var}`
substitution, but `var` instead. The second construct does not fail if
`var` is not defined, but defaults its value to `0` in that case.
2017-12-01 07:45:55 -05:00
Eric Nielsen
1716ed6fea Revert "[utility] BSD uses LSCOLORS and GREP_COLOR"
This reverts commit 6022fe46c5.

Current code only works in a GNU with coreutils installed for `ls`, and
only with a `grep` that supports colors (not a Busybox one, for example)

Fixes #230
2017-12-01 07:45:55 -05:00
Eric Nielsen
4004d109cf Revert "fix typo'd var; otherwise colors would never apply"
This reverts commit abbeeb9d37.

That was not a typo
2017-12-01 07:22:28 -05:00
Matt Hamilton
abbeeb9d37 fix typo'd var; otherwise colors would never apply 2017-11-29 18:47:37 -05:00
Wellington Mendoza
f6304a06cc [git] Update log colour scheme
Use yellow commit hash, cyan author, blue date, and auto ref names

Closes #228
2017-11-29 10:33:03 -05:00
Eric Nielsen
39e961117d
[prompt] eriner: Add help, preview, parameters
and refactor code, inlining auxiliary functions inside
`prompt_eriner_main`.

Theme colors are now customizable with parameters. Also, it works better
with light backgrounds by using `%Sstandout%s` for the segments which
were originally using black as foreground color (intended for dark
backgrounds).

The help explains the parameters, and the preview shows one color
variation.

Fixes #169. Closes #226.
2017-11-29 09:07:53 -05:00
Eric Nielsen
bc742f0023
[completion] Remove smart editor completion
as Vim can open archives, and Emacs can virtually open everything  :- )

I suggest we don't try to be smart here.

Closes #229
2017-11-29 09:06:41 -05:00
Eric Nielsen
bd380e8e18
[spectrum] Delete submodule
The following was introduced in zsh 5.0:

> %F, %K, %f, %k allow colouring of prompts both using ANSI colour names
  and values supported by individual terminal emulators.

making this submodule obsolete.

See http://zsh.sourceforge.net/releases.html

Closes #224
2017-11-29 09:05:12 -05:00
Eric Nielsen
41c2232166 [utility] Move mkcd to functions subdirectory
Now that we have a general digest file that can contain all the
functions from all active modules, we can add functions to any of them
without the need to update the `fpath`.
2017-11-24 21:05:48 -05:00
Eric Nielsen
6022fe46c5 [utility] BSD uses LSCOLORS and GREP_COLOR
and GNU uses LS_COLORS and GREP_COLORS. So change logic to only set
these environment variables for each OSTYPE.

Also original code was setting the `ls` alias with `-G` instead of
`--color=auto` if in a GNU without `dircolors`. Fix that too.

Simplify arithmetic command expression without using `${var}`, but
`var` instead. The second construct does not fail if `var` is not
defined, but defaults its value to `0` in that case.

Closes #225
2017-11-24 19:14:23 -05:00
Eric Nielsen
e4e0c55ef3 Ignore *.zwc.old files when compiling functions
These files are generated by `zrecompile`.

Also update the .gitignore file.

Closes #218
2017-11-24 19:08:39 -05:00
Eric Nielsen
e0a7c679e0 [meta] Move zmanage to function in init.zsh
and delete the meta module altogether.

Also refactor `tools/zim_issue` to use `tools/zim_info`, use local
variables, and print the output directly without the need of the
intermediate `issue_md` array.

Closes #218
2017-11-24 19:08:39 -05:00
Eric Nielsen
a8244a555a [template] Add new templates/zlogin
that sources `login_init.zsh`.

Also refactor templates/zshrc to use a one-liner instead of if/then/fi.

Closes #218
2017-11-24 19:08:29 -05:00
Eric Nielsen
fc84b645e9 [template] Move templates/zlogin to login_init.zsh
so it's not a template anymore and can be under version control, instead
of being manually updated by the user, as currently is the case with
`~/.zlogin` and `${ZIM_HOME}/templates/zlogin`.

Closes #218
2017-11-24 19:08:25 -05:00
Eric Nielsen
8ba34e68e5 [completion] Don't zcompile the zcompdump file
as this is already being done in `zlogin`. Centralizing all the
compilation in one place.

Closes #218
2017-11-24 19:08:20 -05:00
Eric Nielsen
ab3b20f8cd [tools] Clean zcompdump_file and .zwc.old files
Consider the `zcompdump_file` variable, that could be defined in
`.zimrc`, when cleaning the cache.

A custom zcompdump_file would not be cleaned from the cache without this
correction.

Also remove *.zwc.old files from cache, as zrecompile also generates
these.

Closes #218
2017-11-24 19:08:17 -05:00
Eric Nielsen
55df5a4755 [template] Use zrecompile and create digest file
for the autoloaded functions. According to the `zshbuiltins`
documentation:

    Files containing multiple compiled functions are called `digest'
    files,  and are intended to be used as elements of the FPATH/fpath
    special array.

Compile all module init files, instead of some selected ones.
This didn't impact performance much (time to run async block in zlogin
when from 0.22s to 0.25s on my machine).

Also refactor the zim `init.zsh` script, and do not unset `zmodules`
anymore because we need it in zlogin.

Didn't manage to make adding the prompt `prompt_*_setup` functions to
the digest file work, so kept these separate.

Fixes #86. Closes #218.
2017-11-24 19:08:11 -05:00
Eric Nielsen
8aa086c481 [prompt] pure: Update submodule to version 1.6.0 2017-11-01 17:56:25 -05:00
Eric Nielsen
3e31167e70 [completion] Update submodule to version 0.27.0 2017-11-01 17:49:00 -05:00
Eric Nielsen
ee7cb6581d [prompt] pure: Update submodule 2017-10-23 10:01:08 -05:00
Eric Nielsen
b190231682 [archive] Remove _gzip_bin and _bzip2_bin refs
as these variables are not being set anymore.

Fixes #220
2017-10-23 09:54:08 -05:00
djape
01e2766e8c [archive] Support for multipart 7zip archives
Cover all multipart archives created by 7zip

Closes  #221
2017-10-14 10:28:03 -05:00
Matt Hamilton
8fbd143b01 set defaults for bz2 and gz compression utils
Fix #220
2017-10-08 16:38:38 -04:00
Eric Nielsen
5564c87338 [completion] Update submodule 2017-10-03 12:17:07 -05:00
Eric Nielsen
23b8265f87 [prompt] lean: Update submodule
Fixes #209
2017-10-02 11:59:27 -05:00
Eric Nielsen
8ba9621f48 [prompt] Add sp to the prompt_opts array
in our custom themes.

With zsh starting at version 5.4, when using the `prompt_opts` array,
`nopromptsp` will be set unless the array contains a `sp`. This was
introduced in zsh at
43e55a9bcd (diff-bb10d67e7a8561b66a53a805f3c77a40R233)

Fixes #209
2017-10-01 20:41:43 -05:00
Eric Nielsen
a4f6b757be [template] Add zcompile of git-info to zlogin
and declare `zim_mods` as a local variable.
Also minor formatting changes.

Closes #215
2017-09-26 15:23:30 +02:00
Eric Nielsen
d0429dc0bb [environment] Remove path separator from WORDCHARS
So individual path elements can be edited with backward-kill-word and
backward-word/forward-word keys.

Fixes #206.
2017-09-21 19:23:14 -05:00
Matt Hamilton
d40b6cf928 [prompt] pass prompt prams from zprompt_theme
While normally it's a good thing that zsh doesn't auto-expand on spaces,
in this case we want to split on spaces into distinct words, that way
the values are passed to `prompt` in multiple params.

Fixes #178
2017-09-18 09:18:20 -04:00
Matt Hamilton
54faa20468 [pacman] detect pkg regardless of compress method 2017-09-18 09:18:12 -04:00
Eric Nielsen
2a9a003271 [template] don't compile highlighters test-data
for syntax-highlighting submodule. See discussion on
https://github.com/zsh-users/zsh-syntax-highlighting/pull/443

Fixes #205
2017-09-11 14:27:12 -05:00
Eric Nielsen
29e2043b99 [syntax-highlighting] Update submodule to version 0.6.0 2017-09-11 09:48:55 -05:00