~yerinalexey/dotfiles

ref: 144a38b0aa0a39003633d53b77fe4e3ca29c054b dotfiles/nvim/hooks.vim -rw-r--r-- 1.9 KiB
144a38b0Alexey Yerin river,update-volume: fix old wob crashes 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
" Autocmd hooks

augroup vimrc
  au!

  " Hide line numbers in terminal windows
  au FileType floaterm setl nonumber norelativenumber

  " Spellcheck commit messages and markdown files
  au FileType gitcommit,markdown :setl spell

  " Reload sway when related config change
  au BufWritePost ~/.config/sway/*,~/.config/waybar/* :silent !swaymsg reload &

  " Filetype detection
  au BufRead,BufNewFile ~/.config/sway/* :setl ft=i3config
  au BufRead,BufNewFile tsconfig.json :setl ft=jsonc
  au BufRead,BufNewFile *.service :setl ft=cfg
  au BufRead,BufNewFile *.scd :setl ft=scdoc
  " Vim detects *.h files as C++ ¯\_(ツ)_/¯
  au BufRead,BufNewFile *.h :setl ft=c

  " Whitespace preferences
  au FileType c :setl ts=4 sts=4
  au FileType go :setl ts=4 sts=4
  au FileType sh,zsh :setl ts=4 sts=4
  au FileType scdoc :setl ts=4 sts=4
  au FileType html,css :setl et ts=2 sts=2
  au FileType markdown :setl et ts=2 sts=2
  au FileType vim :setl et
  au FileType gitcommit :setl et

  au BufRead,BufNewFile *.devlog :setl et ts=2 sts=2 tw=80 spell

  " Gemini things
  au FileType gemini :setl wrap tw=0
  au FileType gemini :nnoremap j gj
  au FileType gemini :nnoremap k gk

  " Plain text-ish
  au FileType plain,scdoc,markdown :setl tw=80

  " Qutebrowser editor and tut:
  " - Disable auto text wrapping, wrap view instead
  " - Enable spellcheck to prevent dumb mistakes
  " - And also filetype is plain text
  au BufRead,BufNewFile qutebrowser-editor-* :setl ft=plain tw=0 spell wrap

  " Mail stuff
  " Quotes are handled as comments for allowing to (un-)quote someone
  " with Commentary and remove > when joining lines
  au FileType mail :setl commentstring=>\ %s

  " Update Sourcehut patchset status. This complicated magic just finds
  " first paragraph (headers) of the mail and adds
  " X-Sourcehut-Patchset-Update: (cursor here) after it.
  au FileType mail :nmap <buffer> <leader>p gg}OX-Sourcehut-Patchset-Update:<space>
augroup END