about summary refs log tree commit diff stats
path: root/modules/by-name/zs/zsh/config/edit_command_line.zsh
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-21 22:39:32 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-21 22:39:32 +0200
commit67fc567939eec10fcea47cd3569d1682698a5724 (patch)
tree5b7e6381822de15020de6cee73969acb630f78a1 /modules/by-name/zs/zsh/config/edit_command_line.zsh
parentbuild(treewide): Update (diff)
downloadnixos-config-67fc567939eec10fcea47cd3569d1682698a5724.tar.gz
nixos-config-67fc567939eec10fcea47cd3569d1682698a5724.zip
feat(modules/zsh): Nearly completely rewrite
New features:
  - The `vi` mode is now actually useful
  - The whole history search/suggestion has been integrated into `atuin`
  - The `edit-command-line` plugin does no longer print useless stuff
  - and miscellaneous other things.
Diffstat (limited to 'modules/by-name/zs/zsh/config/edit_command_line.zsh')
-rw-r--r--modules/by-name/zs/zsh/config/edit_command_line.zsh25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/by-name/zs/zsh/config/edit_command_line.zsh b/modules/by-name/zs/zsh/config/edit_command_line.zsh
new file mode 100644
index 00000000..1d51a4e8
--- /dev/null
+++ b/modules/by-name/zs/zsh/config/edit_command_line.zsh
@@ -0,0 +1,25 @@
+#! /usr/bin/env zsh
+
+autoload -Uz edit-command-line
+
+wrapped_edit-command-line() {
+    # This overrides a print implementation in my shell lib
+    print() {
+        # FIXME: `print` is called in the following way from `edit-command-line`
+        # (from: https://raw.githubusercontent.com/zsh-users/zsh/refs/heads/master/Functions/Zle/edit-command-line):
+        #   ```
+        #   (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1]
+        #   ```
+        # This results in the error, that the `-r|-n` arguments are mutually exclusive with
+        # the `-` arg. I'm sure, that this is not a bug (as it's been in there for quite
+        # some time now), and ignoring it just seems to work.
+        # But I should either really fix this or find a explanation *why* they are doing
+        # it. <2024-10-21>
+        builtin print "$*" 2>/dev/null
+    }
+
+    # Execute the original `edit-command-line`
+    edit-command-line
+}
+
+zle -N edit-command-line wrapped_edit-command-line