Advertisement
Guest User

fishconfig

a guest
Feb 25th, 2021
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.32 KB | None | 0 0
  1. ## Set environment
  2. set TERM "xterm-256color"
  3. set EDITOR "micro"
  4. set VISUAL "kate"
  5. set fish_greeting
  6.  
  7. ## Source .profile to apply its values
  8. source ~/.profile
  9.  
  10. ## Lambda theme https://github.com/hasanozgan/theme-lambda
  11. function fish_prompt
  12. # Cache exit status
  13. set -l last_status $status
  14.  
  15. # Just calculate these once, to save a few cycles when displaying the prompt
  16. if not set -q __fish_prompt_hostname
  17. set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
  18. end
  19. if not set -q __fish_prompt_char
  20. switch (id -u)
  21. case 0
  22. set -g __fish_prompt_char '#'
  23. case '*'
  24. set -g __fish_prompt_char (set_color F00; echo λ)
  25. end
  26. end
  27.  
  28. # Setup colors
  29. #use extended color pallete if available
  30. #if [[ $terminfo[colors] -ge 256 ]]; then
  31. # turquoise="%F{81}"
  32. # orange="%F{166}"
  33. # purple="%F{135}"
  34. # hotpink="%F{161}"
  35. # limegreen="%F{118}"
  36. #else
  37. # turquoise="%F{cyan}"
  38. # orange="%F{yellow}"
  39. # purple="%F{magenta}"
  40. # hotpink="%F{red}"
  41. # limegreen="%F{green}"
  42. #fi
  43. set -l normal (set_color normal)
  44. set -l white (set_color FFFFFF)
  45. set -l turquoise (set_color 5fdfff)
  46. set -l orange (set_color df5f00)
  47. set -l hotpink (set_color df005f)
  48. set -l blue (set_color blue)
  49. set -l limegreen (set_color 87ff00)
  50. set -l purple (set_color af5fff)
  51.  
  52. # Configure __fish_git_prompt
  53. set -g __fish_git_prompt_char_stateseparator ' '
  54. set -g __fish_git_prompt_color 5fdfff
  55. set -g __fish_git_prompt_color_flags df5f00
  56. set -g __fish_git_prompt_color_prefix white
  57. set -g __fish_git_prompt_color_suffix white
  58. set -g __fish_git_prompt_showdirtystate true
  59. set -g __fish_git_prompt_showuntrackedfiles true
  60. set -g __fish_git_prompt_showstashstate true
  61. set -g __fish_git_prompt_show_informative_status true
  62.  
  63. set -l current_user (whoami)
  64.  
  65. # Line 1
  66. echo -n $white'╭─'$hotpink$current_user$white' at '$orange$__fish_prompt_hostname$white' in '$limegreen(pwd|sed "s=$HOME=⌁=")$turquoise
  67. __fish_git_prompt " (%s)"
  68. echo
  69.  
  70. # Line 2
  71. echo -n $white'╰'
  72. # support for virtual env name
  73. if set -q VIRTUAL_ENV
  74. echo -n "($turquoise"(basename "$VIRTUAL_ENV")"$white)"
  75. end
  76. echo -n $white'─'$__fish_prompt_char $normal
  77. end
  78.  
  79. # Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
  80. function __history_previous_command
  81. switch (commandline -t)
  82. case "!"
  83. commandline -t $history[1]; commandline -f repaint
  84. case "*"
  85. commandline -i !
  86. end
  87. end
  88.  
  89. function __history_previous_command_arguments
  90. switch (commandline -t)
  91. case "!"
  92. commandline -t ""
  93. commandline -f history-token-search-backward
  94. case "*"
  95. commandline -i '$'
  96. end
  97. end
  98.  
  99. if [ $fish_key_bindings = fish_vi_key_bindings ];
  100. bind -Minsert ! __history_previous_command
  101. bind -Minsert '$' __history_previous_command_arguments
  102. else
  103. bind ! __history_previous_command
  104. bind '$' __history_previous_command_arguments
  105. end
  106.  
  107. ## Fish command history
  108. function history
  109. builtin history --show-time='%F %T '
  110. end
  111.  
  112. function backup --argument filename
  113. cp $filename $filename.bak
  114. end
  115.  
  116. ## Copy DIR1 DIR2
  117. function copy
  118. set count (count $argv | tr -d \n)
  119. if test "$count" = 2; and test -d "$argv[1]"
  120. set from (echo $argv[1] | trim-right /)
  121. set to (echo $argv[2])
  122. command cp -r $from $to
  123. else
  124. command cp $argv
  125. end
  126. end
  127.  
  128. ## Useful aliases
  129. alias ls='exa -al --color=always --group-directories-first' # preferred listing
  130. alias la='exa -a --color=always --group-directories-first' # all files and dirs
  131. alias ll='exa -l --color=always --group-directories-first' # long format
  132. alias lt='exa -aT --color=always --group-directories-first' # tree listing
  133. alias l.="exa -a | egrep '^\.'"
  134.  
  135. alias aup="pamac upgrade --aur"
  136. alias grubup="sudo update-grub"
  137. alias fixpacman="sudo rm /var/lib/pacman/db.lck"
  138. alias tarnow='tar -acf '
  139. alias untar='tar -zxvf '
  140. alias wget='wget -c '
  141. alias psmem='ps auxf | sort -nr -k 4'
  142. alias psmem10='ps auxf | sort -nr -k 4 | head -10'
  143. alias upd='sudo reflector --latest 5 --age 2 --fastest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist && sudo pacman -Syu && fish_update_completions'
  144. alias ..='cd ..'
  145. alias ...='cd ../..'
  146. alias ....='cd ../../..'
  147. alias .....='cd ../../../..'
  148. alias ......='cd ../../../../..'
  149. alias dir='dir --color=auto'
  150. alias vdir='vdir --color=auto'
  151. alias grep='grep --color=auto'
  152. alias fgrep='fgrep --color=auto'
  153. alias egrep='egrep --color=auto'
  154. alias hw='hwinfo --short' #Hardware Info
  155. alias big="expac -H M '%m\t%n' | sort -h | nl" #Sort installed packages according to size in MB (expac must be installed)
  156.  
  157. #get fastest mirrors
  158. alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
  159. alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
  160. alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
  161. alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
  162.  
  163.  
  164. ## Import colorscheme from 'wal' asynchronously
  165. if type "wal" >> /dev/null 2>&1
  166. cat ~/.cache/wal/sequences
  167. end
  168.  
  169. ## Run paleofetch if session is interactive
  170. if status --is-interactive
  171. paleofetch
  172. end
  173.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement