From 6c4bffca663fff0e31803dc53a90d3e3481fc870 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Thu, 25 Nov 2010 16:01:50 +0100 Subject: [PATCH 1/3] Added a plugin for reloading .zshrc with F5 --- plugins/refresh/refresh.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 plugins/refresh/refresh.plugin.zsh diff --git a/plugins/refresh/refresh.plugin.zsh b/plugins/refresh/refresh.plugin.zsh new file mode 100644 index 000000000..425ed91ec --- /dev/null +++ b/plugins/refresh/refresh.plugin.zsh @@ -0,0 +1,8 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------ +# Simple ZLE widget that binds F5 to "source ~/.zshrc". +# ------------------------------------------------------------------------------ + +_refresh() { source ~/.zshrc } +zle -N _refresh +bindkey '^[[15~' _refresh From 2b61ddee5b80134268c925ad70fd6ad8c1e35393 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Wed, 1 Dec 2010 17:09:15 +0100 Subject: [PATCH 2/3] Allow to use another key Use $terminfo to get key codes --- plugins/refresh/refresh.plugin.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) mode change 100644 => 100755 plugins/refresh/refresh.plugin.zsh diff --git a/plugins/refresh/refresh.plugin.zsh b/plugins/refresh/refresh.plugin.zsh old mode 100644 new mode 100755 index 425ed91ec..7e369a8bc --- a/plugins/refresh/refresh.plugin.zsh +++ b/plugins/refresh/refresh.plugin.zsh @@ -1,8 +1,16 @@ #!/usr/bin/env zsh # ------------------------------------------------------------------------------ # Simple ZLE widget that binds F5 to "source ~/.zshrc". +# +# You can bind it to another ikey by setting the REFRESH_KEY +# environment variable, for example to bind F4 instead of F5: +# export REFRESH_KEY=$terminfo[kf4] # ------------------------------------------------------------------------------ +# Default key is F5. +DEFAULT_REFRESH_KEY=$terminfo[kf5] + _refresh() { source ~/.zshrc } zle -N _refresh -bindkey '^[[15~' _refresh +bindkey ${REFRESH_KEY:-$DEFAULT_REFRESH_KEY} _refresh + From 4cc7c05a74d9343da261f1001e6ae312c2f2f1b3 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Wed, 1 Dec 2010 17:12:45 +0100 Subject: [PATCH 3/3] Fix typo --- plugins/refresh/refresh.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/refresh/refresh.plugin.zsh b/plugins/refresh/refresh.plugin.zsh index 7e369a8bc..bbfda3028 100755 --- a/plugins/refresh/refresh.plugin.zsh +++ b/plugins/refresh/refresh.plugin.zsh @@ -2,7 +2,7 @@ # ------------------------------------------------------------------------------ # Simple ZLE widget that binds F5 to "source ~/.zshrc". # -# You can bind it to another ikey by setting the REFRESH_KEY +# You can bind it to another key by setting the REFRESH_KEY # environment variable, for example to bind F4 instead of F5: # export REFRESH_KEY=$terminfo[kf4] # ------------------------------------------------------------------------------