Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active August 28, 2018 10:31
Show Gist options
  • Save YumaInaura/a9fce6dbc9949f7cb1fd9efba0d42d0e to your computer and use it in GitHub Desktop.
Save YumaInaura/a9fce6dbc9949f7cb1fd9efba0d42d0e to your computer and use it in GitHub Desktop.
Zsh / Zle — Keep buffer after accept-line widget example

Zsh / Zle — Keep buffer after accept-line widget example

Script example

#!/usr/bin/env zsh -eu

accept-line-and-restore-buffer() {
  local buffer="$BUFFER"
  zle kill-whole-line
  zle accept-line
  print -z "$buffer"
}

zle -N accept-line-and-restore-buffer

bindkey ^T^E accept-line-and-restore-buffer

zsh/accept-line-and-restore-buffer at 83295f6b549c2268f4a541d59436b68b22f86cf0 · YumaInaura/zsh

Try

source file

Input some string to console and push key Ctrl+TE.

Maybe

There is a better way but i have not found.

Versions

  • zsh 5.5.1 (x86_64-apple-darwin17.5.0)

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment