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.

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