This commit is contained in:
Ben Harris 2020-02-26 15:26:00 -05:00
parent 9307af0b25
commit 2fd57e8772
15 changed files with 229 additions and 16 deletions

3
.gitmodules vendored
View File

@ -26,3 +26,6 @@
[submodule "vim/.vim/bundle/vim-fish"]
path = vim/.vim/bundle/vim-fish
url = https://github.com/dag/vim-fish
[submodule "lf/lf"]
path = lf/lf
url = https://github.com/gokcehan/lf

View File

@ -16,7 +16,7 @@ endif
install:
@make $(UNAME)
Linux: bash fzf fish git mutt byobu weechat vim nvim gnupg bin
Linux: bash bin byobu fish git gnupg lf mutt nvim vim weechat
Windows: bash git vim
Other: bash git vim
@ -28,6 +28,7 @@ clean:
stow -t "$$HOME" -D fish
stow -t "$$HOME" -D git
stow -t "$$HOME" -D gnupg
stow -t "$$HOME" -D lf/.config
stow -t "$$HOME" -D mutt
stow -t "$$HOME" -D nvim
stow -t "$$HOME" -D vim
@ -37,7 +38,7 @@ bash:
@printf "$(YELLOW)--- bash -----------------------------------------------\n$(RESET)"
stow -t "$$HOME" bash
bin:
bin: lf
@printf "$(YELLOW)--- bin ------------------------------------------------\n$(RESET)"
mkdir -p "$$HOME/bin"
stow -t "$$HOME" bin
@ -66,6 +67,13 @@ gnupg:
chmod 700 "$$HOME/.gnupg"
stow -t "$$HOME" gnupg
lf:
@printf "$(YELLOW)--- lf --------------------------------------------------\n$(RESET)"
git submodule update --remote --init -- lf/lf
cd lf/lf; CGO_ENABLED=0 go build -ldflags="-s -w" -o ../../bin/bin/lf
mkdir -p ~/.trash
stow -t "$$HOME" lf
mutt:
@printf "$(YELLOW)--- mutt -----------------------------------------------\n$(RESET)"
stow -t "$$HOME" mutt
@ -89,4 +97,4 @@ nuke:
@printf "$(RED)--- nuking existing files ------------------------------\n$(RESET)"
rm -rf ~/.byobu ~/.config/fish ~/.fzf ~/.bash*
.PHONY: bash fzf fish git vim nvim mutt byobu weechat gnupg bin clean install nuke Windows Linux Other
.PHONY: bash fzf fish git vim nvim lf mutt byobu weechat gnupg bin clean install nuke Windows Linux Other

1
bin/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
bin/lf

12
bootstrap.sh Executable file → Normal file
View File

@ -5,14 +5,16 @@ RELEASE="$2"
PKGLIST="${DISTRO}.pkglist"
[ -z $DISTRO -o -z $RELEASE ] && \
echo "usage: sudo $0 <distro> <release>" && exit 1
printf "usage: sudo %s <distro> <release>\n" "$0" && exit 1
[[ $(id -u) != 0 ]] && \
echo "re-run this as root" && exit 1
printf "re-run this as root\n" && exit 1
# make sure we have sources
echo "deb https://apt.syncthing.net/ syncthing stable" > /etc/apt/sources.list.d/syncthing.list
echo "deb https://weechat.org/${DISTRO} ${RELEASE} main" > /etc/apt/sources.list.d/weechat.list
printf "deb https://mirror.bhh.sh/syncthing/ syncthing stable\n" \
> /etc/apt/sources.list.d/syncthing.list
printf "deb https://mirror.bhh.sh/weechat/%s %s main \n" "${DISTRO}" "${RELEASE}" \
> /etc/apt/sources.list.d/weechat.list
apt update
apt upgrade -y
@ -21,7 +23,7 @@ apt full-upgrade -y
apt install -y $(xargs < ${PKGLIST})
echo -n "install makefiles? [y/n]"
printf "install makefiles? [y/n]"
read answer
[[ "$answer" = "y" ]] && \

View File

@ -0,0 +1,11 @@
complete -c lf -o command -r -d 'command to execute on client initialization'
complete -c lf -o cpuprofile -r -d 'path to the file to write the CPU profile'
complete -c lf -o doc -d 'show documentation'
complete -c lf -o last-dir-path -r -d 'path to the file to write the last dir on exit (to use for cd)'
complete -c lf -o memprofile -r -d 'path to the file to write the memory profile'
complete -c lf -o remote -x -d 'send remote command to server'
complete -c lf -o selection-path -r -d 'path to the file to write selected files on open (to use as open file dialog)'
complete -c lf -o server -d 'start server (automatic)'
complete -c lf -o version -d 'show version'
complete -c lf -o help -d 'show help'

View File

@ -1,3 +1,4 @@
function fish_user_key_bindings
fzf_key_bindings
fzf_key_bindings
bind \co 'lfcd; commandline -f repaint'
end

View File

@ -1,5 +1,4 @@
function is_git
git rev-parse --verify HEAD >/dev/null ^&1
# keeping ^ for now for v2 backwards compatibility
git rev-parse --verify HEAD >/dev/null 2>&1
end

View File

@ -0,0 +1,27 @@
function lfcd
set tmp (mktemp)
set fid (mktemp)
lf -command '$printf $id > "'$fid'"' -last-dir-path=$tmp $argv
set id (cat $fid)
set archivemount_dir "/tmp/__lf_archivemount_"$id
if test -f "$archivemount_dir"
for line in (cat $archivemount_dir)
umount "$line"
rm -rf "$line"
end
end
if test -f "$tmp"
set dir (cat $tmp)
rm -f "$tmp"
if test -d "$dir"
if test "$dir" != (pwd)
cd "$dir"
end
end
end
end

115
lf/.config/lf/lfrc Normal file
View File

@ -0,0 +1,115 @@
# interpreter for shell commands (needs to be POSIX compatible)
set shell sh
# 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
# execute current file (must be executable)
map x $$f
map X !$f
# dedicated keys for file opener actions
map o &mimeopen $f
map O $mimeopen --ask $f
# define a custom 'open' command
# This command is called 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 ${{
case "$f" in
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2|*.tar.gz|*.tgz|*.tar.xz|*.txz|*.zip|*.rar|*.iso)
mntdir="$f-archivemount"
[ ! -d "$mntdir" ] && {
mkdir "$mntdir"
archivemount "$f" "$mntdir"
echo "$mntdir" >> "/tmp/__lf_archivemount_$id"
}
lf -remote "send $id cd \"$mntdir\""
lf -remote "send $id reload"
;;
*)
case $(file --mime-type $f -b) in
text/*)
$EDITOR $fx
;;
*)
for f in $fx; do
setsid $OPENER $f > /dev/null 2> /dev/null &
done
;;
esac
;;
}}
# define a custom 'rename' command without prompt for overwrite
cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
map r push :rename<space>
# move current file or selected files to trash folder
# (also see 'man mv' for backup/overwrite options)
cmd trash %set -f; mv $fx ~/.trash
cmd delete ${{
set -f
printf "$fx\n"
printf "delete?[y/n]"
read ans
[ $ans = "y" ] && rm -rf $fx
}}
# use '<delete>' key for either 'trash' or 'delete' command
map <delete> trash
# map <delete> delete
# extract the current file with the right command
# (xkcd link: https://xkcd.com/1168/)
cmd extract ${{
set -f
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 current file or selected files with tar and gunzip
cmd tar ${{
set -f
mkdir $1
cp -r $fx $1
tar czf $1.tar.gz $1
rm -rf $1
}}
# compress current file or selected files with zip
cmd zip ${{
set -f
mkdir $1
cp -r $fx $1
zip -r $1.zip $1
rm -rf $1
}}

1
lf/.stow-local-ignore Normal file
View File

@ -0,0 +1 @@
lf

1
lf/lf Submodule

@ -0,0 +1 @@
Subproject commit 3c5abbbc5dafa2eff0593a8e27aadb3f325d2d43

@ -1 +1 @@
Subproject commit da2c785221810b3d57479bb4b3678aabf32f3b88
Subproject commit c337eef1b735906411577f488e977be69506ef08

View File

@ -187,7 +187,7 @@ tilde.local_hostname
tilde.usermode
tilde.command = "/msg operserv login ${sec.data.pass}"
tilde.command_delay
tilde.autojoin = "#meta,#secret-sudoers,#admin,#opers,#music,#politics,#gopher,#tildeverse,#idlerpg,#tilderadio,#minecraft,#tildelinux,#cosmic,#institute,#.tilde,#tildetel,#thunix,#theasylum,#aussie,#uucp,#projects,#hamradio,#vim,#black,#pink,#~,#netnews,#bots,#ctrl-c,#radiofreqs,#envs,#wilde,#tildegames,#tildenet,#gemini,#club,#zine,#team,#summit,#adventofcode,#geocities,#services,#security,#zaphod,#helpdesk,#radiobot,#honeypot,#flamewars,#chaos :10:20,secretsudoteam,adminsonly"
tilde.autojoin = "#meta,#secret-sudoers,#admin,#opers,#music,#politics,#gopher,#tildeverse,#idlerpg,#tilderadio,#minecraft,#tildelinux,#cosmic,#institute,#.tilde,#tildetel,#thunix,#theasylum,#aussie,#uucp,#projects,#hamradio,#vim,#black,#pink,#~,#netnews,#bots,#ctrl-c,#radiofreqs,#envs,#wilde,#tildegames,#tildenet,#gemini,#club,#zine,#team,#summit,#adventofcode,#geocities,#services,#security,#zaphod,#helpdesk,#radiobot,#honeypot,#flamewars :10:20,secretsudoteam,adminsonly"
tilde.autorejoin
tilde.autorejoin_delay
tilde.connection_timeout
@ -359,7 +359,7 @@ sdf.local_hostname
sdf.usermode
sdf.command
sdf.command_delay
sdf.autojoin = "#sdf,#gopher,#anonradio,#helpdesk,#spanish :kick:20:75"
sdf.autojoin = "#sdf,#gopher,#anonradio,#helpdesk,#spanish,#minecraft :kick:20:75"
sdf.autorejoin
sdf.autorejoin_delay
sdf.connection_timeout
@ -445,7 +445,7 @@ oftc.local_hostname
oftc.usermode
oftc.command
oftc.command_delay
oftc.autojoin = "#debian-devel,#fish"
oftc.autojoin = "#debian-devel,#fish,#debian-offtopic"
oftc.autorejoin
oftc.autorejoin_delay
oftc.connection_timeout
@ -846,3 +846,46 @@ anope.msg_quit
anope.notify
anope.split_msg_max_length
anope.charset_message
unix.addresses = "unix.chat/6697"
unix.proxy
unix.ipv6
unix.ssl = on
unix.ssl_cert
unix.ssl_password
unix.ssl_priorities
unix.ssl_dhkey_size
unix.ssl_fingerprint
unix.ssl_verify = off
unix.password
unix.capabilities
unix.sasl_mechanism
unix.sasl_username
unix.sasl_password
unix.sasl_key
unix.sasl_timeout
unix.sasl_fail
unix.autoconnect
unix.autoreconnect
unix.autoreconnect_delay
unix.nicks
unix.nicks_alternate
unix.username
unix.realname
unix.local_hostname
unix.usermode
unix.command = "/ns identify ${sec.data.unix.chat}"
unix.command_delay
unix.autojoin = "#unix"
unix.autorejoin
unix.autorejoin_delay
unix.connection_timeout
unix.anti_flood_prio_high
unix.anti_flood_prio_low
unix.away_check
unix.away_check_max_nicks
unix.msg_kick
unix.msg_part
unix.msg_quit
unix.notify
unix.split_msg_max_length
unix.charset_message

View File

@ -19,7 +19,7 @@ suggestion_delimiter_word = cyan
commands = "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic"
default_dict = "en"
during_search = off
enabled = on
enabled = off
real_time = off
suggestions = 2
word_min_length = 2

View File

@ -486,6 +486,7 @@ meta-a = "/input jump_smart"
meta-b = "/input move_previous_word"
meta-d = "/input delete_next_word"
meta-f = "/input move_next_word"
meta-g = "/go"
meta-h = "/input hotlist_clear"
meta-jmeta-f = "/buffer -"
meta-jmeta-l = "/buffer +"