172 lines
4.0 KiB
Plaintext
172 lines
4.0 KiB
Plaintext
#set promptfmt "[\033[33m%u\033[01;31m@\033[00;32m%h\033[00m]:\033[34;1m%d\033[0m\033[1m%f\033[0m"
|
|
|
|
map ~ cd ~
|
|
map . set hidden!
|
|
map <tab> filter
|
|
map <c-f> filter
|
|
|
|
# Uppercase bindings don't trigger type to search
|
|
map U $ncdu -x --color dark
|
|
|
|
set ratios '2:3'
|
|
set tabstop 4
|
|
set drawbox
|
|
|
|
set incsearch
|
|
set incfilter
|
|
|
|
set previewer slatefm-preview
|
|
map I $LESSOPEN='| slatefm-preview %s' less -R $f
|
|
cmap <s-tab> $LESSOPEN='| slatefm-preview %s' less -R $f
|
|
|
|
# hook change directory
|
|
cmd on-cd &{{
|
|
# show the pwd in the titlebar
|
|
# '&' commands run silently in background (which is what we want here),
|
|
# but are not connected to stdout.
|
|
# To make sure our escape sequence still reaches stdout we pipe it to /dev/tty
|
|
printf "\033]0;%s\007" "$USER@$HOSTNAME:$PWD" > /dev/tty
|
|
|
|
# We need the width to decode on the promptformat
|
|
w="$(tput cols < /dev/tty 0> /dev/tty)"
|
|
|
|
if [ "$w" -gt 50 ]; then
|
|
fmt="[\033[33m%u\033[01;31m@\033[00;32m%h\033[00m]:\033[34;1m%d\033[0m"
|
|
lf -remote "send $id set ratios 2:3"
|
|
lf -remote "send $id set preview"
|
|
else
|
|
fmt="\033[34;1m%d\033[0m\033[1m$(pwdshort)\033[0m"
|
|
lf -remote "send $id set nopreview"
|
|
lf -remote "send $id set ratios 1"
|
|
fi
|
|
lf -remote "send $id set promptfmt \"$fmt\""
|
|
|
|
if [ -n "$TMUX" ]; then
|
|
tmux rename-window "[$(basename "$PWD")]"
|
|
fi
|
|
|
|
#Integrate with slatectx
|
|
if command -v "slatectx-get-context-name" >/dev/null && [ -n "$XDG_RUNTIME_DIR" ] && mkdir -p "$XDG_RUNTIME_DIR/slatectx-pwd/" ; then
|
|
printf "%s" "$PWD" > "$XDG_RUNTIME_DIR/slatectx-pwd/$(slatectx-get-context-name)"
|
|
fi
|
|
|
|
}}
|
|
|
|
&{{
|
|
# cd to the given slatectx
|
|
if command -v "slatectx-get-context-name" >&- && [ -n "$XDG_RUNTIME_DIR" ] ; then
|
|
shell_slatectx_context_pwd="$XDG_RUNTIME_DIR/slatectx-pwd/$(slatectx-get-context-name)"
|
|
[ -f "$shell_slatectx_context_pwd" ] && lf -remote "send $id cd \"$(cat "$shell_slatectx_context_pwd" | sed 's/["\]/\\\0/g')\""
|
|
else
|
|
lf -remote "cd ."
|
|
fi
|
|
}}
|
|
|
|
map . ${{
|
|
export | fzf
|
|
}}
|
|
|
|
# tabbing with tmux!
|
|
|
|
cmd new-tab ${{
|
|
[ "$TMUX" ] && tmux new-window -c "$PWD" lf
|
|
}}
|
|
|
|
map <c-t> new-tab
|
|
|
|
map <a-0> ${{ [ "$TMUX" ] && tmux select-window -t ":0" }}
|
|
map <a-1> ${{ [ "$TMUX" ] && tmux select-window -t ":1" }}
|
|
map <a-2> ${{ [ "$TMUX" ] && tmux select-window -t ":2" }}
|
|
map <a-3> ${{ [ "$TMUX" ] && tmux select-window -t ":3" }}
|
|
map <a-4> ${{ [ "$TMUX" ] && tmux select-window -t ":4" }}
|
|
map <a-5> ${{ [ "$TMUX" ] && tmux select-window -t ":5" }}
|
|
map <a-6> ${{ [ "$TMUX" ] && tmux select-window -t ":6" }}
|
|
map <a-7> ${{ [ "$TMUX" ] && tmux select-window -t ":7" }}
|
|
map <a-8> ${{ [ "$TMUX" ] && tmux select-window -t ":8" }}
|
|
map <a-9> ${{ [ "$TMUX" ] && tmux select-window -t ":9" }}
|
|
|
|
# Aliases
|
|
|
|
# :q is THE natural way to quit a program …
|
|
# Not really, just what my spinal cord translates a "quit" to
|
|
cmd q quit
|
|
cmd y copy
|
|
cmd d cut
|
|
cmd p paste
|
|
cmd r rename
|
|
# Type to search and related bindings
|
|
|
|
# command mode mappings
|
|
#cmap <c-space> push <enter><enter>
|
|
cmap <up> search-prev
|
|
cmap <down> search-next
|
|
#cmap <backspace> push <esc><left>
|
|
cmap <c-e> $$EDITOR "$f"
|
|
|
|
# normal mode commands
|
|
map <f-2> set hidden!
|
|
map <f-4> $$SHELL
|
|
map <f-5> reload
|
|
|
|
map <enter> open
|
|
map <esc> clear
|
|
map <backspace2> updir
|
|
|
|
map <delete> %trash-put -i -- "$f"
|
|
map T %trash-put -i -- "$f"
|
|
|
|
map F search
|
|
map R rename
|
|
map Q quit
|
|
|
|
map D cut
|
|
map Y copy
|
|
map P paste
|
|
|
|
map N search-prev
|
|
map M search-next
|
|
map <c-up> search-prev
|
|
map <c-down> search-next
|
|
|
|
map <c-space> open
|
|
map <insert> push $mkdir<space>-p<space>
|
|
|
|
#type to search
|
|
map a push <c-f>a
|
|
map b push <c-f>b
|
|
map c push <c-f>c
|
|
map d push <c-f>d
|
|
map e push <c-f>e
|
|
map f push <c-f>f
|
|
map g push <c-f>g
|
|
map h push <c-f>h
|
|
map i push <c-f>i
|
|
map j push <c-f>j
|
|
map k push <c-f>k
|
|
map l push <c-f>l
|
|
map m push <c-f>m
|
|
map n push <c-f>n
|
|
map o push <c-f>o
|
|
map p push <c-f>p
|
|
map q push <c-f>q
|
|
map r push <c-f>r
|
|
map s push <c-f>s
|
|
map t push <c-f>t
|
|
map u push <c-f>u
|
|
map v push <c-f>v
|
|
map w push <c-f>w
|
|
map x push <c-f>x
|
|
map y push <c-f>y
|
|
map z push <c-f>z
|
|
|
|
map 0 push <c-f>0
|
|
map 1 push <c-f>1
|
|
map 2 push <c-f>2
|
|
map 3 push <c-f>3
|
|
map 4 push <c-f>4
|
|
map 5 push <c-f>5
|
|
map 6 push <c-f>6
|
|
map 7 push <c-f>7
|
|
map 8 push <c-f>8
|
|
map 9 push <c-f>9
|