Skip to content

Instantly share code, notes, and snippets.

@fredjoseph
Last active April 6, 2020 20:22
Show Gist options
  • Save fredjoseph/ea52e37d8b01568a87165fabf5f40632 to your computer and use it in GitHub Desktop.
Save fredjoseph/ea52e37d8b01568a87165fabf5f40632 to your computer and use it in GitHub Desktop.
[lf configuration file] configuration file for windows - Location : C:\Users\<user>\AppData\Local\lf\lfrc
# This configuration file adds some commands to lf file manager for windows.
# Requirements :
# - git-for-windows
# - highlight
# interpreter for shell commands (needs to be POSIX compatible)
set shell cmd
# set '-eu' options for shell commands
# These options are used to have safer shell commands. Option '-e' is used to
# exit on error and option '-u' is used to give error for unset variables.
# Option '-f' disables pathname expansion which can be useful when $f, $fs, and
# $fx variables contain names with '*' or '?' characters. However, this option
# is used selectively within individual commands as it can be limiting at
# times.
#set shellopts '-eu'
# set internal field separator (IFS) to "\n" for shell commands
# This is useful to automatically split file names in $fs and $fx properly
# since default file separator used in these variables (i.e. 'filesep' option)
# is newline. You need to consider the values of these options and create your
# commands accordingly.
set ifs "\n"
# leave some space at the top and the bottom of the screen
set scrolloff 10
# use enter for shell commands
map <enter> shell
# show documentation (overrides 'search-back' command)
map ? $lf -doc | less
# rename current file without overwrite
cmd rename %sh -c 'mv -i $f $0'
#cmd rename %sh -c 'if [ -e $0 ]; then echo file exists; else mv $f $0; fi'
map r push :rename<space>
map w $sh -c 'cd $f ; exec bash'
map i $highlight --out-format=ansi %f% | less -R
map I $less %f%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment