From 2ad786a41b29277530ebb4c50bcb65f3971d4901 Mon Sep 17 00:00:00 2001 From: yan Date: Thu, 19 Apr 2012 17:55:41 -0700 Subject: [PATCH] Added Ctrl-x,Ctrl-l to zsh to insert output of last command --- README.md | 1 + zsh/aliases.zsh | 1 + zsh/last-command.zsh | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 zsh/last-command.zsh diff --git a/README.md b/README.md index 92effc6..9734122 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ mnemonic aliases. Please feel free to edit them: * Vim mode * Bash style ctrl-R for reverse history finder + * Ctrl-x,Ctrl-l to insert output of last command * Fuzzy matching - if you mistype a directory name, tab completion will fix it ### How To Customize ZSH diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 00a5627..11e568d 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -100,6 +100,7 @@ alias gz='tar -zcvf' # Ruby alias c='script/console --irb=pry' +alias ts='thin start' alias ms='mongrel_rails start' # Vim/ctags "mctags = make ctags", using the ruby specific version diff --git a/zsh/last-command.zsh b/zsh/last-command.zsh new file mode 100644 index 0000000..9f7486b --- /dev/null +++ b/zsh/last-command.zsh @@ -0,0 +1,7 @@ +# Use Ctrl-x,Ctrl-l to get the output of the last command +zmodload -i zsh/parameter +insert-last-command-output() { +LBUFFER+="$(eval $history[$((HISTCMD-1))])" +} +zle -N insert-last-command-output +bindkey "^X^L" insert-last-command-output