From edc449275b6c04445f58b108ca0937a87c1e8430 Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 27 Feb 2023 20:04:56 +0530 Subject: add zsh --- oh-my-zsh/plugins/fancy-ctrl-z/README.md | 14 ++++++++++++++ oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh | 12 ++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 oh-my-zsh/plugins/fancy-ctrl-z/README.md create mode 100644 oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh (limited to 'oh-my-zsh/plugins/fancy-ctrl-z') diff --git a/oh-my-zsh/plugins/fancy-ctrl-z/README.md b/oh-my-zsh/plugins/fancy-ctrl-z/README.md new file mode 100644 index 0000000..f1b1dfa --- /dev/null +++ b/oh-my-zsh/plugins/fancy-ctrl-z/README.md @@ -0,0 +1,14 @@ +# Use Ctrl-Z to switch back to Vim + +I frequently need to execute random commands in my shell. To achieve it I pause +Vim by pressing Ctrl-z, type command and press fg to switch back to Vim. +The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back +to Vim. I could not find a solution, so I developed one on my own that +works wonderfully with ZSH. + +Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/ + +Credits: +- original idea by @sheerun +- added to OMZ by @mbologna + diff --git a/oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh b/oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh new file mode 100644 index 0000000..82b9688 --- /dev/null +++ b/oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh @@ -0,0 +1,12 @@ +fancy-ctrl-z () { + if [[ $#BUFFER -eq 0 ]]; then + BUFFER="fg" + zle accept-line -w + else + zle push-input -w + zle clear-screen -w + fi +} +zle -N fancy-ctrl-z +bindkey '^Z' fancy-ctrl-z + -- cgit v1.2.3