Linux install and configuration management utilities
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

169 lignes
3.5KB

  1. #
  2. # Setup
  3. #
  4. set -U fish_greeting ''
  5. function fish_user_key_bindings
  6. # ctrl-del
  7. bind \e\[3\;5~ kill-word
  8. # ctrl-backspace
  9. bind \cH backward-kill-path-component
  10. end
  11. #
  12. # Variables
  13. #
  14. fish_add_path ~/.local/bin
  15. fish_add_path ~/.go/bin
  16. fish_add_path ~/.volta/bin/node
  17. fish_add_path ~/.spicetify
  18. set -gx TERM xterm-256color
  19. set -gx VISUAL emacsclient -c
  20. set -gx EDITOR nvim
  21. # Yubikey
  22. set -gx SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
  23. set -gx GPG_TTY (tty)
  24. gpg-connect-agent updatestartuptty /bye >/dev/null
  25. #
  26. # Functions
  27. #
  28. # Shorthand
  29. abbr -a g git
  30. function ls; exa $argv; end
  31. function ll; exa -l $argv; end
  32. function vim; nvim $argv; end
  33. function k; kubectl $argv; end
  34. function ka; kubectl $argv --all-namespaces; end
  35. function kw; watch -n1 "kubectl $argv"; end
  36. function kx; kubectl config use-context $argv; end
  37. # Dotfiles management
  38. function dots
  39. if test (count $argv) -eq 1
  40. if test "$argv[1]" = "ls"
  41. dots ls-tree --full-tree -r --name-only HEAD
  42. return
  43. end
  44. if test "$argv[1]" = "sync"
  45. for f in (dots ls-files --modified)
  46. dots add $f
  47. end
  48. dots commit -m "$(date +'%d %b %Y %T')"
  49. dots push
  50. return
  51. end
  52. end
  53. git --git-dir=$HOME/.dotfiles --work-tree=$HOME $argv
  54. end
  55. # Reload fish configuration
  56. function reload
  57. . ~/.config/fish/config.fish
  58. end
  59. # Editor shorthand
  60. function e
  61. emacsclient -nc $argv[1]
  62. end
  63. function ez
  64. set target (f $argv)
  65. if test -f $target
  66. e $target
  67. else
  68. return 1
  69. end
  70. end
  71. function v
  72. nvim $argv[1]
  73. end
  74. function vz
  75. set target (f $argv)
  76. if test -f $target
  77. v $target
  78. else
  79. return 1
  80. end
  81. end
  82. # Process Management
  83. set ps "-ax" "-o" "pid,user,pcpu,pmem,start_time,cmd"
  84. function pg
  85. ps $ps | head -n1
  86. ps $ps -h | rg -v rg | rg $argv
  87. end
  88. function pk
  89. if test (count $argv) -gt 0
  90. set pids (pg $argv | tail -n +2 | awk '{print $1}')
  91. else
  92. set pids (ps $ps -h | fzf -m | awk '{print $1}')
  93. end
  94. if test -n "$pids"
  95. for pid in $pids
  96. kill $pid
  97. end
  98. echo "Killed $(count $argv)"
  99. else
  100. return 1
  101. end
  102. end
  103. # Archive creation
  104. function tcz
  105. set dir $argv[1]
  106. tar cvfz "$dir.tar.gz" "$dir"
  107. end
  108. function tcj
  109. set dir $argv[1]
  110. tar cvfJ "$dir.tar.xz" "$dir"
  111. end
  112. function tx
  113. tar xvf $argv[1]
  114. end
  115. # Clipboard
  116. function clip
  117. xclip -sel c
  118. end
  119. #
  120. # Theme: Tomorrow Night Bright
  121. #
  122. set -U fish_color_normal normal
  123. set -U fish_color_command c397d8
  124. set -U fish_color_quote b9ca4a
  125. set -U fish_color_redirection 70c0b1
  126. set -U fish_color_end c397d8
  127. set -U fish_color_error d54e53
  128. set -U fish_color_param 7aa6da
  129. set -U fish_color_comment e7c547
  130. set -U fish_color_match --background=brblue
  131. set -U fish_color_selection white --bold --background=brblack
  132. set -U fish_color_search_match bryellow --background=brblack
  133. set -U fish_color_history_current --bold
  134. set -U fish_color_operator 00a6b2
  135. set -U fish_color_escape 00a6b2
  136. set -U fish_color_cwd green
  137. set -U fish_color_cwd_root red
  138. set -U fish_color_valid_path --underline
  139. set -U fish_color_autosuggestion 969896
  140. set -U fish_color_user brgreen
  141. set -U fish_color_host normal
  142. set -U fish_color_cancel --reverse
  143. set -U fish_pager_color_prefix normal --bold --underline
  144. set -U fish_pager_color_progress brwhite --background=cyan
  145. set -U fish_pager_color_completion normal
  146. set -U fish_pager_color_description B3A06D
  147. set -U fish_pager_color_selected_background --background=brblack