diff options
author | Aditya <bluenerd@protonmail.com> | 2023-02-27 20:04:56 +0530 |
---|---|---|
committer | Aditya <bluenerd@protonmail.com> | 2023-02-27 20:04:56 +0530 |
commit | edc449275b6c04445f58b108ca0937a87c1e8430 (patch) | |
tree | 9fd484d58145b616f29a78857cc0b1c8b1c18f05 /oh-my-zsh/plugins/fancy-ctrl-z | |
parent | 6f5424ca96c4221ef433f545642669e9c104d0ed (diff) |
add zsh
Diffstat (limited to 'oh-my-zsh/plugins/fancy-ctrl-z')
-rw-r--r-- | oh-my-zsh/plugins/fancy-ctrl-z/README.md | 14 | ||||
-rw-r--r-- | oh-my-zsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh | 12 |
2 files changed, 26 insertions, 0 deletions
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<Enter> 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 + |