Another copy of my dotfiles. Because I don't completely trust GitHub.
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.

148 lines
3.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. # Yeet's lf settings
  2. # Basic vars
  3. set previewer lf-ueberzug-previewer
  4. set cleaner lf-ueberzug-cleaner
  5. set preview true
  6. set drawbox true
  7. set icons true
  8. set ignorecase true
  9. set shell zsh
  10. set ifs "\n"
  11. set scrolloff 10
  12. set period 1
  13. set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
  14. # cmds/functions
  15. cmd open ${{
  16. case $(file --mime-type $f -b) in
  17. image/vnd.djvu|application/pdf|application/octet-stream) setsid -f zathura $fx >/dev/null 2>&1 ;;
  18. text/*) $EDITOR $fx;;
  19. image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
  20. image/svg+xml) display -- $f ;;
  21. image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | sxiv -aio 2>/dev/null | lf-select ;;
  22. audio/*) mpv --audio-display=no $f ;;
  23. video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
  24. application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
  25. *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
  26. esac
  27. }}
  28. cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
  29. cmd select_dir ${{
  30. echo $f > /tmp/lf-chrome-choosed
  31. lf -remote "send $id quit"
  32. }}
  33. cmd extract ${{
  34. clear; tput cup $(($(tput lines)/3)); tput bold
  35. set -f
  36. printf "%s\n\t" "$fx"
  37. printf "extract?[y/N]"
  38. read ans
  39. [ $ans = "y" ] && ext $fx
  40. }}
  41. cmd moveto ${{
  42. clear; tput cup $(($(tput lines)/3)); tput bold
  43. set -f
  44. clear; echo "Move to where?"
  45. dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/bm-dirs | fzf | sed 's|~|$HOME|' )" &&
  46. for x in $fx; do
  47. eval mv -iv \"$x\" \"$dest\"
  48. done &&
  49. notify-send "File(s) moved." "File(s) moved to $dest."
  50. }}
  51. cmd copyto ${{
  52. clear; tput cup $(($(tput lines)/3)); tput bold
  53. set -f
  54. clear; echo "Copy to where?"
  55. dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/bm-dirs | fzf | sed 's|~|$HOME|' )" &&
  56. for x in $fx; do
  57. eval cp -ivr \"$x\" \"$dest\"
  58. done &&
  59. notify-send " File(s) copied." "File(s) copies to $dest."
  60. }}
  61. cmd setbg ${{
  62. echo "$fx" > /tmp/c
  63. echo convert "$fx" "$HOME/.local/backgrounds/wall.jpg" > /tmp/d
  64. convert "$fx" "$HOME/.local/backgrounds/wall.jpg"
  65. feh --no-fehbg --bg-fill "$HOME/.local/backgrounds/wall.jpg"
  66. }}
  67. cmd git_branch ${{
  68. git branch | fzf | xargs git checkout
  69. pwd_shell=$(pwd)
  70. lf -remote "send $id updir"
  71. lf -remote "send $id cd \"$pwd_shell\""
  72. }}
  73. cmd on-cd &{{
  74. # display git repository status in your prompt
  75. source /usr/share/git/completion/git-prompt.sh
  76. GIT_PS1_SHOWDIRTYSTATE=auto
  77. GIT_PS1_SHOWSTASHSTATE=auto
  78. GIT_PS1_SHOWUNTRACKEDFILES=auto
  79. GIT_PS1_SHOWUPSTREAM=auto
  80. GIT_PS1_COMPRESSSPARSESTATE=auto
  81. git=$(__git_ps1 " [GIT BRANCH:> %s]") || true
  82. fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m$git\033[0m"
  83. lf -remote "send $id set promptfmt \"$fmt\""
  84. }}
  85. cmd bulkrename $vidir
  86. cmd targz %tar cvzf "$f.tar.gz" "$f"
  87. # Bindings
  88. map <c-f> $lf -remote "send $id select '$(fzf)'"
  89. map gh
  90. map gg top
  91. map D $rm -r "$fx"
  92. map E extract
  93. map T targz
  94. map C copyto
  95. map M moveto
  96. map <c-n> push :mkdir<space>
  97. map <c-r> reload
  98. map <c-s> set hidden!
  99. map <enter> shell
  100. map x $$f
  101. map X !$f
  102. map o &mimeopen $f
  103. map O $mimeopen --ask $f
  104. map A rename # at the very end
  105. map r push A<c-u> # new rename
  106. map I push A<c-a> # at the very beginning
  107. map i push A<a-b><a-b><a-f> # before extention
  108. map a push A<a-b> # after extention
  109. map B bulkrename
  110. map b setbg
  111. map <c-e> down
  112. map <c-y> up
  113. map V push :!vim<space>
  114. map cd push !cd<space>
  115. map sd select_dir
  116. # Movement
  117. map ~ cd ~
  118. map g/ cd /
  119. map gm cd /media
  120. map gd cd ~/.dotfiles
  121. map gc cd ~/.config
  122. map gs cd ~/.local/bin
  123. # Git Mappings
  124. map gib :git_branch
  125. map gip ${{clear; git pull --rebase || true; echo "press ENTER"; read ENTER}}
  126. map gis ${{clear; git status; echo "press ENTER"; read ENTER}}
  127. map gil ${{clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit}}