From eedcc258c26af53f54f68281df0e96e0ee456a7d Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Thu, 24 Dec 2020 02:28:25 +0300 Subject: [PATCH] cleanup --- etc/lf.csh | 17 ++++++++++------- etc/lf.zsh | 39 +++++++++++++++++++-------------------- etc/lfcd.csh | 15 ++++++++------- etc/lfcd.ps1 | 4 ++-- 4 files changed, 39 insertions(+), 36 deletions(-) diff --git a/etc/lf.csh b/etc/lf.csh index 54657e38..e9537dca 100644 --- a/etc/lf.csh +++ b/etc/lf.csh @@ -1,12 +1,15 @@ +# Autocompletion for tcsh shell. # -# For using these completions you must load it from .tcshrc +# You need to either copy the content of this file to your shell rc file +# (e.g. ~/.tcshrc) or source this file directly: # -# source ~/.config/lf/lf.csh +# set LF_COMPLETE = "/path/to/lf.csh" +# if ( -f "$LF_COMPLETE" ) then +# source "$LF_COMPLETE" +# endif # -set lf_args = "-command -cpuprofile -doc --help -last-dir-path -memprofile -remote -selection-path -server -version --version" -uncomplete lf -uncomplete lfcd +set LF_ARGS = "-command -cpuprofile -doc -last-dir-path -memprofile -remote -selection-path -server -version -help " -complete lf "C/-*/(${lf_args})/" -complete lfcd "C/-*/(${lf_args})/" +complete lf "C/-*/(${LF_ARGS})/" +complete lfcd "C/-*/(${LF_ARGS})/" diff --git a/etc/lf.zsh b/etc/lf.zsh index 937c034b..3d01cb00 100644 --- a/etc/lf.zsh +++ b/etc/lf.zsh @@ -1,29 +1,28 @@ #compdef lf -# For using these completions you must: -# - rename this file to _lf -# - add the containing folder to $fpath in .zshrc, like this: -# ''' -# fpath=(/path/to/folder/containing_lf $fpath) -# autoload -U compinit -# compinit -# ''' +# Autocompletion for zsh shell. # -# zsh completions for 'lf' -# automatically generated with http://github.com/RobSis/zsh-completion-generator +# You need to rename this file to _lf and add containing folder to $fpath in +# ~/.zshrc file: +# +# fpath=(/path/to/directory/containing/the/file $fpath) +# autoload -U compinit +# compinit +# + local arguments arguments=( - '-command[command to execute on client initialization]' - '-cpuprofile[path to the file to write the CPU profile]' - '-doc[show documentation]' - '-last-dir-path[path to the file to write the last dir on exit (to use for cd)]' - '-memprofile[path to the file to write the memory profile]' - '-remote[send remote command to server]' - '-selection-path[path to the file to write selected files on open (to use as open file dialog)]' - '-server[start server (automatic)]' - '-version[show version]' - '*:filename:_files' + '-command[command to execute on client initialization]' + '-cpuprofile[path to the file to write the CPU profile]' + '-doc[show documentation]' + '-last-dir-path[path to the file to write the last dir on exit (to use for cd)]' + '-memprofile[path to the file to write the memory profile]' + '-remote[send remote command to server]' + '-selection-path[path to the file to write selected files on open (to use as open file dialog)]' + '-server[start server (automatic)]' + '-version[show version]' + '*:filename:_files' ) _arguments -s $arguments diff --git a/etc/lfcd.csh b/etc/lfcd.csh index 3fa1d6b5..2487ee8c 100644 --- a/etc/lfcd.csh +++ b/etc/lfcd.csh @@ -1,13 +1,14 @@ -# Change working dir in shell to last dir in lf on exit. +# Change working dir in tcsh to last dir in lf on exit (adapted from ranger). # -# You need to either copy the content of this file to your shell rc file -# (e.g. ~/.tcshrc) or source this file directly: +# 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" +# 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: +# You may also like to assign a key to this command: # -# bindkey -c "^O" lfcd +# bindkey -c "^O" lfcd # + alias lfcd 'set _=`mktemp` && lf -last-dir-path=$_ "\!*" && set _=`cat $_ && rm -f $_` && [ -d "$_" ] && cd "$_"' diff --git a/etc/lfcd.ps1 b/etc/lfcd.ps1 index e128acde..210dd4af 100644 --- a/etc/lfcd.ps1 +++ b/etc/lfcd.ps1 @@ -4,14 +4,14 @@ # # You may also like to assign a key to this command: # -# You may put this in one of the profiles found in $PROFILE. -# # Set-PSReadLineKeyHandler -Chord Ctrl+o -ScriptBlock { # [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() # [Microsoft.PowerShell.PSConsoleReadLine]::Insert('lfcd.ps1') # [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() # } # +# You may put this in one of the profiles found in $PROFILE. +# $tmp = [System.IO.Path]::GetTempFileName() lf -last-dir-path="$tmp" $args