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.

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