cleanup
This commit is contained in:
parent
f59227c5f9
commit
c93738a6ec
@ -41,7 +41,7 @@ since it is better if they are handled by external tools.
|
||||
|
||||
See [releases](https://github.com/gokcehan/lf/releases) for pre-built binaries.
|
||||
|
||||
If you like to build from the source, you can use:
|
||||
If you like to build from the source:
|
||||
|
||||
go get -u github.com/gokcehan/lf
|
||||
|
||||
|
11
etc/lf.sh
11
etc/lf.sh
@ -1,14 +1,17 @@
|
||||
# change the directory to last dir on exit
|
||||
# adapted from the similar script for ranger
|
||||
# Change working dir in shell to last dir in lf on exit (adapted from ranger).
|
||||
#
|
||||
# you need to add something like the following to your shell rc file (e.g. ~/.bashrc):
|
||||
# You need to either copy the content of this file to your shell rc file
|
||||
# (e.g. ~/.bashrc) or source this file directly using something like:
|
||||
#
|
||||
# LFSH="$GOPATH/src/github.com/gokcehan/lf/etc/lf.sh"
|
||||
# if [ -f "$LFSH" ]; then
|
||||
# source "$LFSH"
|
||||
# bind '"\C-o":"\C-ulf\C-m"'
|
||||
# fi
|
||||
#
|
||||
# You may also like to assign a key to this command:
|
||||
#
|
||||
# bind '"\C-o":"\C-ulf\C-m"'
|
||||
#
|
||||
|
||||
lf () {
|
||||
tmp="$(mktemp)"
|
||||
|
15
etc/lf.vim
15
etc/lf.vim
@ -1,16 +1,19 @@
|
||||
" use lf to select and open a file in vim
|
||||
" adapted from the similar script for ranger
|
||||
" Use lf to select and open a file in vim (adapted from ranger).
|
||||
"
|
||||
" you need to add something like the following to your ~/.vimrc:
|
||||
" You need to either copy the content of this file to your ~/.vimrc or source
|
||||
" this file directly using something like:
|
||||
"
|
||||
" 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
|
||||
"
|
||||
" You may also like to assign a key to this command:
|
||||
"
|
||||
" nnoremap <leader>l :<c-u>LF<cr>
|
||||
"
|
||||
|
||||
function! StartLF()
|
||||
function! LF()
|
||||
let temp = tempname()
|
||||
exec 'silent !lf -selection-path=' . shellescape(temp)
|
||||
if !filereadable(temp)
|
||||
@ -28,4 +31,4 @@ function! StartLF()
|
||||
endfor
|
||||
redraw!
|
||||
endfunction
|
||||
command! -bar StartLF call StartLF()
|
||||
command! -bar LF call LF()
|
||||
|
@ -1,20 +1,21 @@
|
||||
# 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'")
|
||||
# You may also consider setting an alias to automatically split windows in tmux
|
||||
# (e.g. "alias mc='tmux split -h lf; lf'").
|
||||
#set ratios 1
|
||||
#set nopreview
|
||||
#set showinfo size
|
||||
|
||||
# set shell interpreter accordingly
|
||||
# Some systems use more efficient shell implementations for non-interactive use
|
||||
# (e.g. `dash`) mapped to `/bin/sh`. By setting this option here we can tell
|
||||
# `lf` to use this implementation for shell commands. This can decrease the
|
||||
# startup times of commands but may also change the syntax that you are used to
|
||||
# (e.g. non-POSIX features provided by your regular shell).
|
||||
set shell /bin/sh
|
||||
#set shell /bin/sh
|
||||
|
||||
# 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 internal field seperator (IFS) to ':'
|
||||
# This is especially useful for interactive use to automatically split file
|
||||
# names in $fs and $fx. Things may behave unexpectedly so use with caution.
|
||||
#set ifs ':'
|
||||
|
||||
# leave some space at the top and the bottom of the screen
|
||||
@ -46,7 +47,7 @@ map i $less "$f"
|
||||
map e $vim "$f"
|
||||
|
||||
# mapping to spawn a shell in working directory
|
||||
# see also etc/lf.sh as an alternative workflow
|
||||
# (see also etc/lf.sh as an alternative workflow)
|
||||
map w $$SHELL
|
||||
|
||||
# execute current file (must be executable)
|
||||
@ -57,9 +58,10 @@ map X !"$f"
|
||||
map o &mimeopen "$f"
|
||||
map O $mimeopen --ask "$f"
|
||||
|
||||
# `open-file` is called by `open` when current file is not a directory
|
||||
# you may want to use either file extensions or mime types with `file`
|
||||
# below uses an editor for text files and a file opener for the rest
|
||||
# define a custom `open-file` command
|
||||
# `open-file` is called by `open` when current file is not a directory. You may
|
||||
# want to use either file extensions and/or mime types here. Below uses an
|
||||
# editor for text files and a file opener for the rest.
|
||||
cmd open-file ${{
|
||||
case $(file --mime-type "$f" -b) in
|
||||
text/*) IFS=':'; vim $fx;;
|
||||
@ -77,11 +79,11 @@ cmd usage $du -h . | less
|
||||
$mkdir -p $HOME/.trash
|
||||
|
||||
# move current file or selected files to trash folder
|
||||
# see 'man mv' or 'mv --help' for backup options
|
||||
# (see 'man mv' or 'mv --help' for backup options)
|
||||
cmd trash $IFS=':'; mv --backup=numbered $fx $HOME/.trash
|
||||
|
||||
# extract the current file with the right command
|
||||
# xkcd link: https://xkcd.com/1168/
|
||||
# (xkcd link: https://xkcd.com/1168/)
|
||||
cmd extract ${{
|
||||
case "$f" in
|
||||
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf "$f";;
|
||||
@ -93,9 +95,9 @@ cmd extract ${{
|
||||
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")
|
||||
# compress marked files with tar and gunzip
|
||||
# This command takes the output name without '.tar.gz' suffix as an argument
|
||||
# (e.g. "compress foo" creates "foo.tar.gz").
|
||||
cmd compress ${{
|
||||
mkdir "$1"
|
||||
IFS=':'; cp $fs "$1"
|
||||
|
Loading…
Reference in New Issue
Block a user