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.

141 lines
3.7 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 extract ${{
  30. clear; tput cup $(($(tput lines)/3)); tput bold
  31. set -f
  32. printf "%s\n\t" "$fx"
  33. printf "extract?[y/N]"
  34. read ans
  35. [ $ans = "y" ] && ext $fx
  36. }}
  37. cmd moveto ${{
  38. clear; tput cup $(($(tput lines)/3)); tput bold
  39. set -f
  40. clear; echo "Move to where?"
  41. dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/bm-dirs | fzf | sed 's|~|$HOME|' )" &&
  42. for x in $fx; do
  43. eval mv -iv \"$x\" \"$dest\"
  44. done &&
  45. notify-send "File(s) moved." "File(s) moved to $dest."
  46. }}
  47. cmd copyto ${{
  48. clear; tput cup $(($(tput lines)/3)); tput bold
  49. set -f
  50. clear; echo "Copy to where?"
  51. dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/bm-dirs | fzf | sed 's|~|$HOME|' )" &&
  52. for x in $fx; do
  53. eval cp -ivr \"$x\" \"$dest\"
  54. done &&
  55. notify-send " File(s) copied." "File(s) copies to $dest."
  56. }}
  57. cmd setbg ${{
  58. echo "$fx" > /tmp/c
  59. echo convert "$fx" "$HOME/.local/backgrounds/wall.jpg" > /tmp/d
  60. convert "$fx" "$HOME/.local/backgrounds/wall.jpg"
  61. feh --no-fehbg --bg-fill "$HOME/.local/backgrounds/wall.jpg"
  62. }}
  63. cmd git_branch ${{
  64. git branch | fzf | xargs git checkout
  65. pwd_shell=$(pwd)
  66. lf -remote "send $id updir"
  67. lf -remote "send $id cd \"$pwd_shell\""
  68. }}
  69. cmd on-cd &{{
  70. # display git repository status in your prompt
  71. source /usr/share/git/completion/git-prompt.sh
  72. GIT_PS1_SHOWDIRTYSTATE=auto
  73. GIT_PS1_SHOWSTASHSTATE=auto
  74. GIT_PS1_SHOWUNTRACKEDFILES=auto
  75. GIT_PS1_SHOWUPSTREAM=auto
  76. GIT_PS1_COMPRESSSPARSESTATE=auto
  77. git=$(__git_ps1 " [GIT BRANCH:> %s]") || true
  78. fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m$git\033[0m"
  79. lf -remote "send $id set promptfmt \"$fmt\""
  80. }}
  81. cmd bulkrename $vidir
  82. cmd targz %tar cvzf "$f.tar.gz" "$f"
  83. # Bindings
  84. map <c-f> $lf -remote "send $id select '$(fzf)'"
  85. map gh
  86. map gg top
  87. map D $rm -r "$fx"
  88. map E extract
  89. map T targz
  90. map C copyto
  91. map M moveto
  92. map <c-n> push :mkdir<space>
  93. map <c-r> reload
  94. map <c-s> set hidden!
  95. map <enter> shell
  96. map x $$f
  97. map X !$f
  98. map o &mimeopen $f
  99. map O $mimeopen --ask $f
  100. map A rename # at the very end
  101. map r push A<c-u> # new rename
  102. map I push A<c-a> # at the very beginning
  103. map i push A<a-b><a-b><a-f> # before extention
  104. map a push A<a-b> # after extention
  105. map B bulkrename
  106. map b setbg
  107. map <c-e> down
  108. map <c-y> up
  109. map V push :!vim<space>
  110. map cd push !cd<space>
  111. # Movement
  112. map ~ cd ~
  113. map g/ cd /
  114. map gm cd /media
  115. map gd cd ~/.dotfiles
  116. map gc cd ~/.config
  117. map gs cd ~/.local/bin
  118. # Git Mappings
  119. map gib :git_branch
  120. map gip ${{clear; git pull --rebase || true; echo "press ENTER"; read ENTER}}
  121. map gis ${{clear; git status; echo "press ENTER"; read ENTER}}
  122. 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}}