1
0
Fork 0
mirror of synced 2024-11-14 12:09:03 -05:00
Commit graph

302 commits

Author SHA1 Message Date
Matt Hamilton
126e950056 remove broken quote in fasd function 2017-05-30 06:30:30 -07:00
Matt Hamilton
8f395be650 Fix fasd regression from #180
Fixes #186
2017-05-29 09:54:23 -07:00
ℳichiel ℛoos
fcf060482b [environment] Use zsh style tests for empty vars
Closes #180
2017-05-17 15:59:49 -05:00
ℳichiel ℛoos
c58f9015ec [fasd] Use zsh style tests for empty vars
Closes #180
2017-05-17 15:59:38 -05:00
Eric Nielsen
872926c84c [utility] Use one-liner instead of "if then fi"
in recent tests included, to keep code simpler.
2017-05-15 08:59:17 -05:00
ℳichiel ℛoos
f15d6e4e02 [utility] Don't overwrite existing env variables
Environment variables set in `.zshenv` should not be overwritten.
However, it is sourced before Zim loads, making Zim overwrite the
settings.

Fixes #175. Closes #179
2017-05-15 08:49:06 -05:00
Matt Hamilton
4ad8f8db8e [syntax-highlighting] update submodule 2017-04-30 09:03:36 -07:00
Matt Hamilton
7d389add76 [prompt] pure: update submodule 2017-04-30 09:03:25 -07:00
Matt Hamilton
0e2094afef [prompt] liquidprompt: update submodule 2017-04-30 09:03:12 -07:00
Matt Hamilton
60968c428d [prompt] lean: update submodule 2017-04-30 09:02:58 -07:00
Matt Hamilton
903e8aa24d [completion] update submodule 2017-04-30 09:02:46 -07:00
Eric Nielsen
c8820313ef Fix liquidprompt preview
breaking the current prompt after `prompt -p`. Actually liquidprompt is
pretty invasive in the way it is implemented, defining extra
`prompt_on`, `prompt_off` and `prompt_OFF` functions to switch it after
it is executed.

Fixes #112, Closes #165
2017-04-30 09:01:36 -07:00
Henrique Silva
d97ff6bd07 Support dynamic title on urxvt
Closes #151
2017-04-30 09:01:14 -07:00
Eric Nielsen
dca1803ced [prompt] Don't expand git_info in eriner theme
to avoid the git-info vulnerability to execute an arbitrary command, as
reported in #158.

Fixes #158 (for eriner theme), Closes #168
2017-04-17 23:17:53 -05:00
Eric Nielsen
d771fd88fb [prompt] Range segment in eriner as in magicmace
This reverts commit eee6e911d2.

As suggested in
https://github.com/Eriner/zim/pull/142#issuecomment-283806756 (and
"thumb-upped" by Tmplt). The Ranger segment was introduced in eriner
theme by Tmplt in https://github.com/Eriner/zim/pull/64. He also added
it to the magicmace theme.
2017-04-17 16:31:07 -05:00
Eric Nielsen
3c2730d0c4 [git-info] Remove dependency on git-dir function
from the git module.
Also now making all git calls with `command`.

Fixes #161 (again), Closes #164
2017-04-12 20:21:26 -05:00
Eric Nielsen
9de30b97b1 Remove is-true function
that was only being used in the `git` and `git-info` modules to check
the output of `git rev-parse --is-inside-work-tree`. The code depending
on this function was already changed.

Closes #163
2017-04-11 17:50:09 -07:00
Eric Nielsen
b34a75e4d8 Remove git dependency on is-true function
The function is currently only being used for checking the result of
`git rev-parse --is-inside-work-tree`. Checking for the return code of
the command is enough.
2017-04-11 17:50:07 -07:00
Eric Nielsen
262f4992e9 Remove git-info dependency on is-true function
from `git` module. Actually, the function is a little bit of
over-engineering and it's currently only being used for checking the
result of `git rev-parse --is-inside-work-tree`, even in the `git`
module code.

Checking for the return code of `git rev-parse --is-inside-work-tree` is
enough. Also refactored other portions of the code where return codes
are being checked.

Fixes #161, Closes #162
2017-04-11 17:49:47 -07:00
Joe Moon
43096df5cb [environment] Fix url-quote-magic
`url-quote-magic` automatically escapes characters that fit a URI scheme
as you type. From what I can tell from the commit history, this was
mistakenly placed in `else` branch of the nested conditional instead of
at the end of the outermost conditional.

Closes #160
2017-04-11 13:29:53 -05:00
Eric Nielsen
53a3cd7933 Fix git-info arbitrary command execution exposure
The contents of git_info are subject to expansion by the shell. Avoid
putting raw ref names in the prompt to protect the user from arbitrary
code execution via specially crafted ref names (e.g., a ref named
'$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' would execute 'sudo rm -rf /' when the
prompt is drawn). Instead, put the ref names in new global variables and
reference these variables from git_info.

See:
- https://github.com/njhartwell/pw3nage
- 8976500cbb

Fixes #158, Closes #159
2017-03-30 10:17:03 -07:00
Eric Nielsen
f3e673a52b Rewrite steeef theme using git-info
This uses the verbose mode to be able to display indexed, unindexed and
untracked files indicators. This is the last theme left to be migrated
to git-info, and the first one to use its verbose mode.

Originally, the theme also supported svn via vcs_info. The svn support
is lost in this rewrite. Maybe if a new svn-info module is introduced to
Zim...

Closes #157
2017-03-29 19:40:07 -07:00
Eric Nielsen
0df896c3f1 Change git-info verbose mode implementation
so it behaves alike the non-verbose mode. For example, in the "merge"
special action context, files are being reported as both indexed and
unindexed by `git diff-index` and `git diff-files` commands in
non-verbose mode. That was not the case with the regular expressions
used in the verbose mode.
2017-03-29 19:40:03 -07:00
Sebastian S
449634a99e git-commit-list: fix typo
command is written with two m, not three.

Closes #156
2017-03-29 12:57:05 -07:00
Eric Nielsen
ae771c878f Rewrite minimal theme using git-info
As previous migrations of themes to git-info, this does not use its
verbose mode, so a repo with just untracked files is not considered
dirty.

It uses the newly-introduced `diverged` context and `coalesce` function
from git-info.

Closes #152
2017-03-27 13:56:47 -07:00
Eric Nielsen
d56bddf4b1 Add coalesce function to git-info
that will be used by the minimal theme, and could be used for future
themes too. Prezto had this, but we diminished its necessity by
simplifying how git-info works.
2017-03-27 13:56:47 -07:00
Eric Nielsen
a844454a65 Remove undocumented git-info configuration
`prompt.showinfo` for enabling or disabling it globally or per
repository. It can be globally disabled by not loading the `git-info`
module at all, and prompts currently will not break (and in the future
should still not break) if the module is not loaded.

This removes one git call that is used to check for the
`prompt.showinfo` configuration value.
2017-03-27 13:56:47 -07:00
Eric Nielsen
53aef5a05c Add diverged context to git-info
that, when defined, will be set if branch is both ahead and behind of
remote. If not defined, the `ahead` and `behind` contexts will still be
set, as how they worked previously.
2017-03-27 13:56:47 -07:00
Eric Nielsen
76cf486d5d Only evaluate prompt_gitster_status once
replacing its contents directly into the `PROMPT`, instead of calling
the function continuously.

Closes #150
2017-03-27 13:56:47 -07:00
Eric Nielsen
c7b2232378 Inline is-true function body, as other functions
defined in Zim. Instead of creating an additional `is-true() { }`
function scope.

Closes #148
2017-03-27 13:56:45 -07:00
Eric Nielsen
4b95df9a5f Fix magicmace errors when git-info not enabled
and add a comment stating that the theme requires the `git-info` module.
Also make better usage of the arithmetic command `(( ))`.

Closes #146
2017-03-08 06:20:19 -08:00
Eric Nielsen
176d2ab4d3 Fix gitster theme errors when git-info not enabled
and add a comment stating that the theme requires the `git-info` module.

Closes #145, fixes #144
2017-03-08 06:20:02 -08:00
Eric Nielsen
597d611d7b Fix eriner theme errors when git-info not enabled
as it was incorrectly testing for the `${+functions[git-info]}`.

Closes #142
2017-03-08 06:19:56 -08:00
Eric Nielsen
eee6e911d2 Add Ranger segment to eriner theme
instead of having the Ranger indicator at the status segment, likewise
the magicmace theme.
2017-03-08 06:17:39 -08:00
Eric Nielsen
a469e147cc Rewrite eriner theme using the Zim git-info module
Based on my rewrite of the Agnoster theme, uses simpler segment drawing
functions and only relies on local variables. Uses git-info module in
non-verbose mode, so a repo with only untracked files will not count as
dirty (but dirty state is computed faster). Also took the freedom of
adding an extra space character after the 'r' for the Ranger segment,
and after the dirty indicator for the Git segment. Everything else looks
and behaves exactly the same as the original prompt.
2017-03-08 06:17:39 -08:00
Matt Hamilton
cf0bb77a37 [syntax-highlighting] update submodule 2017-03-08 06:17:35 -08:00
Matt Hamilton
5ef14a64f1 [prompt] pure: update submodule 2017-03-08 06:17:25 -08:00
Matt Hamilton
9416c7de90 [prompt] liquidprompt: update submodule 2017-03-08 06:17:08 -08:00
Matt Hamilton
9d9b6c2ec9 [prompt] lean: update submodule 2017-03-08 06:16:56 -08:00
Matt Hamilton
269f8399d2 [completion] update submodule 2017-03-08 06:16:42 -08:00
Nils Reusse
7d952adf2b [utility] fix warning when logging in on tty
... ${terminfo[colors}, variable not set. Check that the variable
exists before checking for colors.

Closes #125
2017-01-29 14:33:18 -08:00
Tomas Slusny
61ff6019b1 [fasd] Fix completion
- Fix word completion for fasd
- Fix initialization script to have all fasd-related functions inside it
  (functions was not called properly when they was in separate files)
- Add another alias `v` for fasd that will access recently used files
  from .viminfo

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>

Fixes #111, Closes #133
2017-01-22 10:37:36 -08:00
Matt Hamilton
cc34e3f310 [environment] add customizable term title
Adds customizable terminal/window title. Set `${ztermtitle}` in `.zimrc`
to use this functionality.

Check the notes added in templates/zimrc for additional usage info.

Closes #52
2017-01-21 08:54:32 -08:00
Matt Hamilton
bf5e3a8c6b [prompt] lean: update submodule 2017-01-21 08:23:43 -08:00
Matt Hamilton
dcc066c1fa [prompt] pure: update submodule 2017-01-21 08:23:28 -08:00
Eric Nielsen
c1b02c06d0 Remove git_prompt_info and parse_git_dirty
as they were only being used by gitster prompt theme and kept for
Oh-My-Zsh compatibility. The newly introduced git-info module (inspired
by the git-info Prezto function) provides a more powerful
implementation than the Oh-My-Zsh inspired git_prompt_info.

Updated gitster to use the git-info module.

Closes #124
2017-01-19 05:10:19 -08:00
Eric Nielsen
9f4c21cee8 Update git-info README.md
to fix the "Special Action Contexts" title mistakenly being "Untracked
Contexts", and other minor changes.
2017-01-16 10:26:17 -08:00
Eric Nielsen
708f17b18f Update magicmace theme to use the git-info module 2017-01-16 10:26:17 -08:00
Eric Nielsen
cabf368847 Add git-info module
based on the Prezto git module
[function](https://github.com/sorin-ionescu/prezto/blob/master/modules/git/functions/git-info)
and further refactored and simplified.

What changed:
- Commit format only in 'detached HEAD' state, so
  `$(coalesce "%b" "%c")` is not needed, because you only get one of
  those.
- Removed the `added`, `deleted`, `modified`, `renamed` and `unmerged`
  verbose contexts.
- `git status` is only used in verbose mode.
- In non-verbose mode, the `untracked` context is not available, and
  also untracked files are not considered for computing the `dirty`
  context. Using `git status` or checking for untracked files is
  [expensive](https://gist.github.com/sindresorhus/3898739).
2017-01-16 10:26:17 -08:00
Gordon Gao
9529245cbb use setopt NO_CLOBBER instead of unsetopt CLOBBER
Closes #117
2017-01-11 22:16:07 -08:00
Matt Hamilton
b021ba6817 [syntax-highlighting] update submodule 2017-01-05 22:36:00 -08:00
Matt Hamilton
cb8617d3f4 [prompt] pure: update submodule
Closes #113
2017-01-05 22:34:00 -08:00
Matt Hamilton
1073feb097 [prompt] lean: update submodule 2017-01-05 22:33:37 -08:00
Matt Hamilton
ca129aa00c [substring-search] update submodule 2017-01-05 22:33:13 -08:00
Matt Hamilton
e267e46f98 [completion] update submodule 2017-01-05 22:32:33 -08:00
Matt Hamilton
9f9cc34273 [syntax-highlighting] update submodule 2016-12-11 09:49:24 -08:00
Matt Hamilton
02a68bea57 [prompt] lean: update submodule
Closes #110
2016-12-11 09:48:47 -08:00
Matt Hamilton
081e4f30d0 [completion] update submodule 2016-12-11 09:48:30 -08:00
Matt Hamilton
b55ed8ad27 [syntax-highlighting] update submodule 2016-12-01 23:51:59 -08:00
Matt Hamilton
5798afae97 [prompt] pure: update submodule 2016-12-01 23:51:59 -08:00
Matt Hamilton
edfa747047 [prompt] liquidprompt: update submodule 2016-12-01 23:51:59 -08:00
Matt Hamilton
7da3437b3f [prompt] lean: update submodule 2016-12-01 23:51:59 -08:00
Matt Hamilton
0e56fa4901 [completion] update submodule 2016-12-01 23:51:59 -08:00
Xiao-Ou Zhang
d91d9e3efe [input] Fix typo in README
Closes #102
2016-12-01 23:51:59 -08:00
Eric Nielsen
76ff1bdb3c Add less or more as default PAGER
Set `less` (if available) or `more` as `PAGER`, if `PAGER` is not set.

Closes #101
2016-12-01 23:51:59 -08:00
Eric Nielsen
7a289c4c0d Add less termcap colour variables
Set `less` termcap colour variables, and update the module README.md.
Change the code to enclose all colour logic within a
`(( ${terminfo[colors]} >= 8 ))` condition.
Check if `PAGER` is set before setting the `lm` alias.

Keeping the British "colour" spelling. :-)

Closes #101
2016-12-01 23:51:59 -08:00
Matt Hamilton
1801faf39c [pacman] keep old packages for auru
The choice to remove these packages should be up to the administrator.
Having an old -git package around after experiencing an upstream issue
is always handy.
2016-12-01 23:50:37 -08:00
Matt Hamilton
1f0ed84938 [syntax-highlighting] update submodule 2016-10-25 16:17:30 -07:00
Matt Hamilton
ee9559eb74 [prompt] pure: update submodule 2016-10-25 16:17:14 -07:00
Matt Hamilton
99a45de4d6 [prompt] liquidprompt: update submodule 2016-10-25 16:16:57 -07:00
Matt Hamilton
ebdcaf80cd [substring-search] update submodule 2016-10-25 16:16:30 -07:00
Matt Hamilton
6b31e32711 [completion] update submodule 2016-10-25 16:15:49 -07:00
Eric Nielsen
7519f17645 [input] fix prompt after <Tab><Tab><Ctrl-C>
The issue is fixed by adding `zle redisplay` after `zle
expand-and-complete` for the expand-and-complete key binding. An
additional `print -n '...'` is also included to show an indicator while
the menu is loading, and that is purely cosmetic.

There's still one glitch: the prompt jumps one line up after
<Tab><Tab><Ctrl-C>. This was observed in Prezto too.

Fixes #85, closes #89
2016-10-25 16:13:49 -07:00
Eric Nielsen
0a9d105107 [utility] Simplify correction prompt config
For `setopt CORRECT`. Let the user uncomment a line with the `setopt`
directly in the configuration file, instead of having a flag variable
for it.

Closes #90
2016-10-25 16:12:40 -07:00
Sebastian Stammler
e24fed015c [pacman] Add pacI alias to install without syncing
Closes #99
2016-10-25 16:11:16 -07:00
Shaun Hammill
50f74bc56c [meta] zmanage: rescope usage to local variable
Closes #100
2016-10-25 16:06:19 -07:00
Matt Hamilton
b1d5c00d5f [git] fix 'ggL' alias typo
Credit to @toogley for discovering the typo here:
https://github.com/sorin-ionescu/prezto/pull/1157

Since zim and prezto share the same git aliases, it is applicable here
as well.
2016-09-28 04:32:23 -07:00
Eric Nielsen
695d46284c [meta] use uname -a to prevent OS conflicts
Fix `uname` calls with `-o` parameter, as this is not BSD compatible.
As per @Eriner, use `uname -a` instead as a "catch-all" parameter.

Fixes #75, Closes #79
2016-09-28 03:02:10 -07:00
Matt Hamilton
d2458b1a8f [syntax-highlighting] update submodule 2016-09-27 16:40:16 -07:00
Matt Hamilton
e209799a5c [prompt] pure: update submodule 2016-09-27 16:40:00 -07:00
Matt Hamilton
b5134b8ab2 [prompt] liquidprompt: update submodule 2016-09-27 16:39:35 -07:00
Matt Hamilton
ccd441b197 [completion] update submodule 2016-09-27 16:39:21 -07:00
Eric Nielsen
f812c1bb6a [debug] Refactor debug module
Use `$PS4` debugging prompt to generate timestamps, instead of GNU `date`.
This also keeps timestamps and respective command together, something
that `paste` could not guarantee given some commands may have multiple lines.

The prompt timestamp has a precision of 6 decimals. The `printf "%12.9f\n"`
instruction with 9 decimals was kept to keep producing "the **SAME** output".
This could be replaced to `printf "%12.6f\n"` to make the output
smaller.
Also, only the first line of commands with multiple lines are saved, to
keep the output format backwards-compatible.

Closes #84
2016-09-27 15:59:02 -07:00
Eric Nielsen
40ef228286 [prompt] magicmace: fix tab completion
The offender was `print -P`, where `-P` does [prompt
expansion](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Prompt-Expansion).

I took the freedom to also change a few things:
Move the `add-zsh-hook precmd` up,
add `prompt_magicmace_` prefix to all function names,
add `COLOR_` prefix to all color global variables,
and move assignment to `PROMPT` to `prompt_magicmace_setup`.

Fixes #70, Closes #81
2016-09-27 15:58:45 -07:00
Matt Hamilton
d551b90050 [meta] add zim_debug tool
Closes #51
2016-09-06 13:05:17 -07:00
Matt Hamilton
d55939e528 [meta] add zim_issue template builder 2016-09-05 16:34:27 -07:00
Matt Hamilton
a9c8269291 [prompt] pure: update submodule 2016-09-04 08:46:06 -07:00
Matt Hamilton
0fa860ef84 [completion] update submodule 2016-09-04 08:45:54 -07:00
Matt Hamilton
e2ef8f1bb5 [syntax-highlighting] update submodule 2016-09-04 08:45:32 -07:00
Matt Hamilton
f7d3cdf812 [meta] add module and fixup tools 2016-09-02 18:28:29 -07:00
Matt Hamilton
fc45c8e328 [syntax-highlighting] update submodule 2016-08-30 09:29:30 -07:00
Matt Hamilton
882441c625 [syntax-highlighting] update submodule 2016-08-21 11:38:02 -07:00
Juraj Fiala
a1341265b9 [input] Add PageUp/Down to navigate history
Incredibly useful when combined history-substring-search and/or a laptop keyboard.

Closes #72
2016-08-15 23:14:54 -07:00
Matt Hamilton
e49fdbd260 [syntax-highlighting] update submodule 2016-08-15 20:32:44 -07:00
Fernando Barillas
1b44eb6404 [prompt] Add lean prompt: github.com/miekg/lean
Closes #71
2016-08-15 20:31:17 -07:00
Matt Hamilton
bb81ab09b9 [syntax-highlighting] update submodule 2016-08-11 18:14:11 -07:00
Matt Hamilton
8ff67e0987 [completion] update submodule 2016-08-11 18:13:53 -07:00
Matt Hamilton
8ac887e8e9 [prompt] pure: update submodule 2016-07-27 19:41:05 -07:00
Tmplt
0a33a3de90 [prompt] magicmace: add theme
Closes #69
2016-07-27 19:36:43 -07:00
Matt Hamilton
5556897150 [syntax-highlighting] update submodule 2016-07-26 13:51:04 -07:00