Skip to content

Instantly share code, notes, and snippets.

@jc00ke
Created June 26, 2023 04:22
Show Gist options
  • Save jc00ke/caa17795450cc4603cb0006a8fc65ef6 to your computer and use it in GitHub Desktop.
Save jc00ke/caa17795450cc4603cb0006a8fc65ef6 to your computer and use it in GitHub Desktop.
" from https://github.com/aduros/dotfiles/blob/eab476fc62e74e46cb41bb5c094cede7a28a014f/home/.config/nvim/options.vim#L27
autocmd BufNewFile,BufRead *.hx set filetype=haxe
autocmd BufNewFile,BufRead *.jsfl set filetype=javascript
autocmd BufNewFile,BufRead ~/.config/dunst/dunstrc set filetype=dosini
autocmd BufNewFile,BufRead ~/.config/polybar/config set filetype=dosini
autocmd BufNewFile,BufRead ~/.config/tridactyl/tridactylrc set filetype=vim
autocmd BufNewFile,BufRead ~/.config/zathura/zathurarc set filetype=config
autocmd BufNewFile,BufRead ~/.lesskey set filetype=config
" Reload certain files on write
autocmd BufWritePost ~/.config/dconf-settings.ini silent !dconf load / < <afile>
autocmd BufWritePost ~/.config/dunst/dunstrc silent !killall dunst && notify-send "Test" > /dev/null
autocmd BufWritePost ~/.config/i3/config silent !i3-msg reload > /dev/null
autocmd BufWritePost ~/.Xresources silent !xrdb <afile> > /dev/null
autocmd BufWritePost ~/.lesskey silent !lesskey <afile> > /dev/null
" Make shebang scripts executable on write
function! MakeExecutable ()
if getline(1) =~ "^#!"
exec "silent !chmod +x '" . expand("%:p") . "'"
filetype detect
endif
endfunction
autocmd BufWritePost * call MakeExecutable()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment