From 73e94b84bbe9bebfe612438507a53885485938cb Mon Sep 17 00:00:00 2001 From: Salmanul Farzy Date: Sun, 14 Jan 2018 14:15:28 +0530 Subject: [PATCH 1/7] Don't set auto_name_dirs because it messes up prompts This was ported from Oh-My-Zsh and since have been disabled in it. Explained in more detail rvm/rvm/issues/3091#issuecomment-60083194 Related: #998, #1081 --- modules/directory/init.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/directory/init.zsh b/modules/directory/init.zsh index 47191dfe..8abc1e24 100644 --- a/modules/directory/init.zsh +++ b/modules/directory/init.zsh @@ -16,7 +16,6 @@ setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack. setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. setopt PUSHD_TO_HOME # Push to home directory when no argument is given. setopt CDABLE_VARS # Change directory to a path stored in a variable. -setopt AUTO_NAME_DIRS # Auto add variable-stored paths to ~ list. setopt MULTIOS # Write to multiple descriptors. setopt EXTENDED_GLOB # Use extended globbing syntax. unsetopt CLOBBER # Do not overwrite existing files with > and >>. From e32a96be72a2a6708c90e91f17036cfbc3ef270d Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Wed, 24 Jan 2018 13:47:20 -0800 Subject: [PATCH 2/7] pacman: Simplify support for AUR helpers There are a number of things happening here. - Extra support for yaourt has been removed - Docs have been updated to explicitly call out that AUR helpers are not officially supported - aurutils has been suggested to make common operations easier - A utility function called aurget (similar to aurfetch from aurutils) has been added to make cloning AUR repos easier. Fixes #1531 --- modules/pacman/README.md | 40 ++++++++++++++++----------------------- modules/pacman/init.zsh | 12 ++++++++---- modules/pacman/yaourt.zsh | 18 ------------------ 3 files changed, 24 insertions(+), 46 deletions(-) delete mode 100644 modules/pacman/yaourt.zsh diff --git a/modules/pacman/README.md b/modules/pacman/README.md index 855c8efa..86929b40 100644 --- a/modules/pacman/README.md +++ b/modules/pacman/README.md @@ -8,23 +8,20 @@ Settings -------- It is possible to use a Pacman frontend with the pacman aliases provided by this -package as long as that frontend supports the same command line options (Such as -[Pacaur][2] or [Yaourt][3]). +package as long as that frontend supports the same command line options (The +[AUR Helpers][2] page has a good comparison which lists if the command line +options are pacman compatible). -To enable a Pacman frontend, for example, [Pacaur][2], add the following line to -*zpreztorc*: +Please note that installing packages with an AUR Helper is not officially +supported by Archlinux. It is currently recommended to manually build AUR +packages using the [provided instructions][3]. The [aurtools][4] project has a +set of small utilities to make this easier. -```sh -zstyle ':prezto:module:pacman' frontend 'pacaur' -``` - -If you have enabled color globally in *zpreztorc*, you may disable it for certain -commands. - -To disable `yaourt` highlighting, add the following line to *zpreztorc*: +To enable a Pacman frontend, add the following line to *zpreztorc*, substituting +`pacman_frontend` with the name of the frontent: ```sh -zstyle ':prezto:module:pacman:yaourt' color 'no' +zstyle ':prezto:module:pacman' frontend 'pacman_frontend' ``` Aliases @@ -50,28 +47,23 @@ Aliases ### Frontends -#### Yaourt - -Note that there are currently potential security concerns relating to yaourt, so -other frontends are recommended. - - - `pacc` manages *.pac\** files. - Functions --------- + - `aurget` clone an aur package - `pacman-list-explicit` lists explicitly installed pacman packages. - `pacman-list-disowned` lists pacman disowned files. Authors ------- -*The authors of this module should be contacted via the [issue tracker][4].* +*The authors of this module should be contacted via the [issue tracker][5].* - [Benjamin Boudreau](https://github.com/dreur) - [Sorin Ionescu](https://github.com/sorin-ionescu) [1]: http://www.archlinux.org/pacman/ -[2]: https://github.com/rmarquis/pacaur -[3]: http://archlinux.fr/yaourt-en -[4]: https://github.com/sorin-ionescu/prezto/issues +[2]: https://wiki.archlinux.org/index.php/AUR_helpers#Comparison_table +[3]: https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages +[4]: https://github.com/AladW/aurutils +[5]: https://github.com/sorin-ionescu/prezto/issues diff --git a/modules/pacman/init.zsh b/modules/pacman/init.zsh index a5cacf2c..88c977f6 100644 --- a/modules/pacman/init.zsh +++ b/modules/pacman/init.zsh @@ -23,10 +23,6 @@ zstyle -s ':prezto:module:pacman' frontend '_pacman_frontend' if (( $+commands[$_pacman_frontend] )); then alias pacman="$_pacman_frontend" - - if [[ -s "${0:h}/${_pacman_frontend}.zsh" ]]; then - source "${0:h}/${_pacman_frontend}.zsh" - fi else _pacman_frontend='pacman' _pacman_sudo='sudo ' @@ -81,4 +77,12 @@ fi # upgrades outdated packages. alias pacU="${_pacman_sudo}${_pacman_frontend} --sync --refresh --sysupgrade" +function aurget { + local target_dir="$1" + if [[ -n "$2" ]]; then + target_dir="$2" + fi + git clone "https://aur.archlinux.org/$1" "$target_dir" +} + unset _pacman_{frontend,sudo} diff --git a/modules/pacman/yaourt.zsh b/modules/pacman/yaourt.zsh deleted file mode 100644 index 819fad16..00000000 --- a/modules/pacman/yaourt.zsh +++ /dev/null @@ -1,18 +0,0 @@ -# -# Defines Yaourt aliases. -# -# Authors: -# Sorin Ionescu -# - -# -# Aliases -# - -# Disable color. -if ! zstyle -t ':prezto:module:pacman:yaourt' color; then - alias pacman='yaourt --nocolor' -fi - -# Manages .pac* files. -alias pacc='yaourt -C' From 54d2a76731041ccefd0f19e17fd87e970081cea7 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Wed, 24 Jan 2018 14:01:14 -0800 Subject: [PATCH 3/7] pacman: fix mistake where aurutils should be used, not aurtools --- modules/pacman/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/pacman/README.md b/modules/pacman/README.md index 86929b40..a619a747 100644 --- a/modules/pacman/README.md +++ b/modules/pacman/README.md @@ -14,7 +14,7 @@ options are pacman compatible). Please note that installing packages with an AUR Helper is not officially supported by Archlinux. It is currently recommended to manually build AUR -packages using the [provided instructions][3]. The [aurtools][4] project has a +packages using the [provided instructions][3]. The [aurutils][4] project has a set of small utilities to make this easier. To enable a Pacman frontend, add the following line to *zpreztorc*, substituting From 0b62639ad5ede91f118f427f70e21a47dda5bdd4 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Thu, 25 Jan 2018 20:59:21 +0100 Subject: [PATCH 4/7] Set INTERACTIVE_COMMENTS by default This allows using # to comment lines in the interactive shell --- modules/editor/init.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index ed57a102..50c87288 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -14,8 +14,8 @@ fi # Options # -# Beep on error in line editor. -setopt BEEP +setopt BEEP # Beep on error in line editor. +setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell. # # Variables From 906ac99e203a5b193b0df78b6c53819e0cf56ab1 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Thu, 25 Jan 2018 12:41:58 -0800 Subject: [PATCH 5/7] Move INTERACTIVE_COMMENTS from editor to environment --- modules/editor/init.zsh | 1 - modules/environment/init.zsh | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 50c87288..0c39c0a6 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -15,7 +15,6 @@ fi # setopt BEEP # Beep on error in line editor. -setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell. # # Variables diff --git a/modules/environment/init.zsh b/modules/environment/init.zsh index 79e98a4a..4f3bbfe3 100644 --- a/modules/environment/init.zsh +++ b/modules/environment/init.zsh @@ -32,10 +32,11 @@ fi # General # -setopt COMBINING_CHARS # Combine zero-length punctuation characters (accents) - # with the base character. -setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. -unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed. +setopt COMBINING_CHARS # Combine zero-length punctuation characters (accents) + # with the base character. +setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell. +setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. +unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed. # # Jobs From 904eef5fa5152f6d3b12fc1d0d7c0b7af5818e84 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 26 Jan 2018 14:52:11 -0800 Subject: [PATCH 6/7] Add `pound-toggle` zle widget to work around the buggy built-in `pound-insert` Refs #1533, #1534 --- modules/editor/init.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 0c39c0a6..3c4c9df6 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -241,6 +241,24 @@ function glob-alias { } zle -N glob-alias +# Toggle the comment character at the start of the line. This is meant to work +# around a buggy implementation of pound-insert in zsh. +function pound-toggle { + if [[ "$BUFFER" = '#'* ]]; then + # Because of an oddity in how zsh handles the cursor when the buffer size + # changes, we need to make this check before we modify the buffer and let + # zsh handle moving the cursor back if it's past the end of the line. + if [[ $CURSOR != $#BUFFER ]]; then + (( CURSOR -= 1 )) + fi + BUFFER="${BUFFER:1}" + else + BUFFER="#$BUFFER" + (( CURSOR += 1 )) + fi +} +zle -N pound-toggle + # Reset to default key bindings. bindkey -d @@ -276,6 +294,10 @@ if (( $+widgets[history-incremental-pattern-search-backward] )); then history-incremental-pattern-search-forward fi +# Toggle comment at the start of the line. +bindkey -M emacs "$key_info[Escape];" pound-toggle + + # # Vi Key Bindings # From 282b478fd2eb6658c063d4f32b9856201e5b886c Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 26 Jan 2018 18:14:10 -0800 Subject: [PATCH 7/7] Add vi-pound-insert as # in vicmd mode Fixes #1534 --- modules/editor/init.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 3c4c9df6..085947ef 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -243,6 +243,9 @@ zle -N glob-alias # Toggle the comment character at the start of the line. This is meant to work # around a buggy implementation of pound-insert in zsh. +# +# This is currently only used for the emacs keys because vi-pound-insert has +# been reported to work properly. function pound-toggle { if [[ "$BUFFER" = '#'* ]]; then # Because of an oddity in how zsh handles the cursor when the buffer size @@ -294,7 +297,9 @@ if (( $+widgets[history-incremental-pattern-search-backward] )); then history-incremental-pattern-search-forward fi -# Toggle comment at the start of the line. +# Toggle comment at the start of the line. Note that we use pound-toggle which +# is similar to pount insert, but meant to work around some issues that were +# being seen in iTerm. bindkey -M emacs "$key_info[Escape];" pound-toggle @@ -317,6 +322,9 @@ else bindkey -M vicmd "/" history-incremental-search-forward fi +# Toggle comment at the start of the line. +bindkey -M vicmd "#" vi-pound-insert + # # Emacs and Vi Key Bindings #