From 74eab96637b39ac5bfdb22af3dc1e62f54724b93 Mon Sep 17 00:00:00 2001 From: Nicholas Christopoulos Date: Thu, 19 Dec 2019 21:11:23 +0200 Subject: [PATCH] [t]csh files added (lfcd,lf-complete) (#264) * [t]csh files added (lfcd,lf-complete) * rename lf-complete.csh to lf.csh * rename lf-complete.csh to lf.csh; i forgot the comment-line * convert ^O esc-code to ^O string --- etc/lf.csh | 12 ++++++++++++ etc/lfcd.csh | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 etc/lf.csh create mode 100644 etc/lfcd.csh diff --git a/etc/lf.csh b/etc/lf.csh new file mode 100644 index 00000000..54657e38 --- /dev/null +++ b/etc/lf.csh @@ -0,0 +1,12 @@ +# +# For using these completions you must load it from .tcshrc +# +# source ~/.config/lf/lf.csh +# +set lf_args = "-command -cpuprofile -doc --help -last-dir-path -memprofile -remote -selection-path -server -version --version" + +uncomplete lf +uncomplete lfcd + +complete lf "C/-*/(${lf_args})/" +complete lfcd "C/-*/(${lf_args})/" diff --git a/etc/lfcd.csh b/etc/lfcd.csh new file mode 100644 index 00000000..3fa1d6b5 --- /dev/null +++ b/etc/lfcd.csh @@ -0,0 +1,13 @@ +# Change working dir in shell to last dir in lf on exit. +# +# You need to either copy the content of this file to your shell rc file +# (e.g. ~/.tcshrc) or source this file directly: +# +# setenv LF_HOME "${HOME}/.config/lf" +# [ -e "${LF_HOME}/lfcd.csh" ] && source "${LF_HOME}/lfcd.csh" +# +# You may also like to assign a key to this command: +# +# bindkey -c "^O" lfcd +# +alias lfcd 'set _=`mktemp` && lf -last-dir-path=$_ "\!*" && set _=`cat $_ && rm -f $_` && [ -d "$_" ] && cd "$_"'