initial commit
This commit is contained in:
commit
4b266c97e9
21 files changed
+2797
No files matched your search
@@ -0,0 +1,21 @@
|
||||
# change the directory to last dir on exit
|
||||
# adapted from the similar script for ranger
|
||||
#
|
||||
# you need to add something like the following to your shell rc file (e.g. ~/.bashrc):
|
||||
#
|
||||
# LFSH="$GOPATH/src/github.com/gokcehan/lf/etc/lf.sh"
|
||||
# if [ -f "$LFSH" ]; then
|
||||
# source "$LFSH"
|
||||
# bind '"\C-o":"\C-ulf\C-m"'
|
||||
# fi
|
||||
#
|
||||
|
||||
lf () {
|
||||
tmp="$(mktemp)"
|
||||
command lf -last-dir-path="$tmp" "$@"
|
||||
if [ -f "$tmp" ]; then
|
||||
dir="$(cat "$tmp")"
|
||||
[ "$dir" != "$(pwd)" ] && cd "$dir"
|
||||
fi
|
||||
rm -f "$tmp"
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
" use lf to select and open a file in vim
|
||||
" adapted from the similar script for ranger
|
||||
"
|
||||
" you need to add something like the following to your ~/.vimrc:
|
||||
"
|
||||
" let lfvim = $GOPATH . "/src/github.com/gokcehan/lf/etc/lf.vim"
|
||||
" if filereadable(lfvim)
|
||||
" exec "source " . lfvim
|
||||
" nnoremap <leader>l :<c-u>StartLF<cr>
|
||||
" endif
|
||||
"
|
||||
|
||||
function! StartLF()
|
||||
let temp = tempname()
|
||||
exec 'silent !lf -selection-path=' . shellescape(temp)
|
||||
if !filereadable(temp)
|
||||
redraw!
|
||||
return
|
||||
endif
|
||||
let names = readfile(temp)
|
||||
if empty(names)
|
||||
redraw!
|
||||
return
|
||||
endif
|
||||
exec 'edit ' . fnameescape(names[0])
|
||||
for name in names[1:]
|
||||
exec 'argadd ' . fnameescape(name)
|
||||
endfor
|
||||
redraw!
|
||||
endfunction
|
||||
command! -bar StartLF call StartLF()
|
||||
@@ -0,0 +1,88 @@
|
||||
# mc alike mode (single column)
|
||||
# you may also consider setting an alias for automatically splitting windows in tmux
|
||||
# (e.g. "alias mc='tmux split -h lf; lf'")
|
||||
#set ratios 1
|
||||
#set nopreview
|
||||
#set showinfo size
|
||||
|
||||
# leave some space at the top and the bottom of the screen
|
||||
set scrolloff 10
|
||||
|
||||
# mappings for pager and editor (change as you like)
|
||||
map i $less "$f"
|
||||
map e $vim "$f"
|
||||
|
||||
# use enter for shell commands
|
||||
map <cr> read-shell
|
||||
|
||||
# execute current file (must be executable)
|
||||
map x $"$f"
|
||||
map X !"$f"
|
||||
|
||||
# you can either set your opener to 'mimeopen'
|
||||
#set opener mimeopen
|
||||
# or set dedicated keys for specific actions
|
||||
map o &mimeopen "$f"
|
||||
map m !mimeopen --ask "$f"
|
||||
|
||||
# rename current file without overwrite
|
||||
cmd rename $[ -e "$1" ] || mv "$f" "$1"
|
||||
|
||||
# show disk usage
|
||||
cmd usage $du -h . | less
|
||||
|
||||
# make sure trash folder exists
|
||||
$mkdir -p $HOME/.trash
|
||||
|
||||
# move current file or selected files to trash folder
|
||||
# see 'man mv' or 'mv --help' for backup options
|
||||
cmd trash $IFS=':'; mv --backup=numbered $fx $HOME/.trash
|
||||
|
||||
# here be dragons
|
||||
#map dD trash
|
||||
|
||||
# common directories
|
||||
map gh cd ~
|
||||
map gr cd /
|
||||
|
||||
# easily toggle options
|
||||
map zp set preview!
|
||||
map zh set hidden!
|
||||
|
||||
# easily select what information to show
|
||||
map zn set showinfo none
|
||||
map zs set showinfo size
|
||||
map zt set showinfo time
|
||||
|
||||
# sort files and show the corresponding info
|
||||
map sn :set sortby name; set showinfo none;
|
||||
map ss :set sortby size; set showinfo size;
|
||||
map st :set sortby time; set showinfo time;
|
||||
|
||||
# sets internal field seperator (IFS) to ":"
|
||||
# useful for interactive use to automatically split file names in $fs and $fx
|
||||
# things may behave unexpectedly so use with caution
|
||||
#set ifs :
|
||||
|
||||
# extract the current file with the right command
|
||||
# xkcd link: https://xkcd.com/1168/
|
||||
cmd extract ${{
|
||||
case "$f" in
|
||||
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf "$f";;
|
||||
*.tar.gz|*.tgz) tar xzvf "$f";;
|
||||
*.tar.xz|*.txz) tar xJvf "$f";;
|
||||
*.zip) unzip "$f";;
|
||||
*.rar) unrar x "$f";;
|
||||
*.7z) 7z x "$f";;
|
||||
esac
|
||||
}}
|
||||
|
||||
# compress selected files with tar and gunzip
|
||||
# takes the name without '.tar.gz' suffix as an argument
|
||||
# (e.g. ":compress foo" creates "foo.tar.gz")
|
||||
cmd compress ${{
|
||||
mkdir "$1"
|
||||
IFS=':'; cp $fs "$1"
|
||||
tar czvf "$1.tar.gz" "$1"
|
||||
rm -rf "$1"
|
||||
}}
|
||||
Reference in new issue
Block a user