From 73fa9df70e09d096f6f11f6030b1a978bf425c62 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Sat, 12 May 2018 00:00:33 +0200 Subject: [PATCH] Genesis --- README.md | 5 +++++ i3swallow.plugin.zsh | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 README.md create mode 100644 i3swallow.plugin.zsh diff --git a/README.md b/README.md new file mode 100644 index 0000000..6fc7f43 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# i3-swallow zsh plugin + +prefixes a command with `i3-swallow` by pressing Pos1 twice + +requires [i3-swallows](https://github.com/jamesofarrell/i3-swallow) diff --git a/i3swallow.plugin.zsh b/i3swallow.plugin.zsh new file mode 100644 index 0000000..f7c3e5d --- /dev/null +++ b/i3swallow.plugin.zsh @@ -0,0 +1,12 @@ +_i3swallow() { + [[ -z $BUFFER ]] && zle up-history + if [[ $BUFFER == i3-swallow\ * ]]; then + LBUFFER="${LBUFFER#sudo }" + else + LBUFFER="i3-swallow $LBUFFER" + fi +} +zle -N _i3swallow + +# Defined shortcut keys: [Pos1][Pos1] +bindkey "OHOH" _i3swallow