You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
3.4 KiB

  1. # Luke's lf settings
  2. # Note on Image Previews
  3. # For those wanting image previews, like this system, there are four steps to
  4. # set it up. These are done automatically for LARBS users, but I will state
  5. # them here for others doing it manually.
  6. #
  7. # 1. ueberzug must be installed.
  8. # 2. The scope file (~/.config/lf/scope for me), must have a command similar to
  9. # mine to generate ueberzug images.
  10. # 3. A `set cleaner` line as below is a cleaner script.
  11. # 4. lf should be started through a wrapper script (~/.local/bin/lfub for me)
  12. # that creates the environment for ueberzug. This command can be be aliased
  13. # in your shellrc (`alias lf="lfub") or if set to a binding, should be
  14. # called directly instead of normal lf.
  15. # Basic vars
  16. set shellopts '-eu'
  17. set ifs "\n"
  18. set scrolloff 10
  19. set icons
  20. set period 1
  21. set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
  22. set cleaner '~/.config/lf/cleaner'
  23. set previewer '~/.config/lf/scope'
  24. # cmds/functions
  25. cmd open ${{
  26. case $(file --mime-type "$(readlink -f $f)" -b) in
  27. application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
  28. image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
  29. text/*|application/json|inode/x-empty) $EDITOR $fx;;
  30. image/x-xcf) gimp $f >/dev/null 2>&1 ;;
  31. image) display -- $f ;;
  32. audio/*) mpv --audio-display=no $f ;;
  33. video/*) mpv $f -quiet >/dev/null 2>&1 ;;
  34. application/pdf|application/vnd*|application/epub*) zathura $fx >/dev/null 2>&1 ;;
  35. esac
  36. }}
  37. cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
  38. cmd extract ${{
  39. clear; tput cup $(($(tput lines)/3)); tput bold
  40. set -f
  41. printf "%s\n\t" "$fx"
  42. printf "extract?[y/N]"
  43. read ans
  44. [ $ans = "y" ] && aunpack $fx
  45. }}
  46. cmd delete ${{
  47. clear; tput cup $(($(tput lines)/3)); tput bold
  48. set -f
  49. printf "%s\n\t" "$fx"
  50. printf "delete?[y/N]"
  51. read ans
  52. [ $ans = "y" ] && rm -rf -- $fx
  53. }}
  54. cmd moveto ${{
  55. clear; tput cup $(($(tput lines)/3)); tput bold
  56. set -f
  57. clear; echo "Move to where?"
  58. dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
  59. for x in $fx; do
  60. eval mv -iv \"$x\" \"$dest\"
  61. done &&
  62. notify-send "🚚 File(s) moved." "File(s) moved to $dest."
  63. }}
  64. cmd copyto ${{
  65. clear; tput cup $(($(tput lines)/3)); tput bold
  66. set -f
  67. clear; echo "Copy to where?"
  68. dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
  69. for x in $fx; do
  70. eval cp -ivr \"$x\" \"$dest\"
  71. done &&
  72. notify-send "📋 File(s) copied." "File(s) copies to $dest."
  73. }}
  74. cmd setbg "$1"
  75. cmd bulkrename $vidir
  76. # Bindings
  77. map <c-f> $lf -remote "send $id select '$(fzf)'"
  78. map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)"
  79. map gh
  80. map g top
  81. map D delete
  82. map E extract
  83. map C copyto
  84. map M moveto
  85. map <c-n> push :mkdir<space>
  86. map <c-r> reload
  87. map <c-s> set hidden!
  88. map <enter> shell
  89. map x $$f
  90. map X !$f
  91. map o &mimeopen $f
  92. map O $mimeopen --ask $f
  93. map A rename # at the very end
  94. map c push A<c-u> # new rename
  95. map I push A<c-a> # at the very beginning
  96. map i push A<a-b><a-b><a-f> # before extention
  97. map a push A<a-b> # after extention
  98. map B bulkrename
  99. map b $setbg $f
  100. map <c-e> down
  101. map <c-y> up
  102. map V push :!nvim<space>
  103. map W $setsid -f $TERMINAL >/dev/null 2>&1
  104. map Y $printf "%s" "$fx" | xclip -selection clipboard