Linux install and configuration management utilities
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.

162 lines
3.2KB

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