vimrc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. " some custom commands
  2. "
  3. " insert mom templates
  4. command Tmomc :r ~/.vim/templates/chapter.mom
  5. command Tmomg :r ~/.vim/templates/general.mom
  6. command Tmomr :r ~/.vim/templates/recipe.mom
  7. command Tmome :r ~/.vim/templates/english.mom
  8. command Tmd :r ~/.vim/templates/md.html
  9. command Tman :r ~/.vim/templates/man.1
  10. command Tmh :r ~/.vim/templates/man.html
  11. command Ttex :r ~/.vim/templates/general.tex
  12. command Tmit :r ~/.vim/templates/mit
  13. command Tuni :r ~/.vim/templates/uni
  14. " run groff+refer on file
  15. command Groff :w|!sh -c 'p="%"; refer -PS -e -p ~/Documents/bib ${p::-4}.mom | groff -mom -Tpdf > ${p::-4}.pdf'
  16. command Grofft :w|!sh -c 'p="%"; refer -PS -e -p ~/Documents/bib ${p::-4}.mom | groff -mom -T ascii | sed -b "s/\x1b[^m]*m//g" > ${p::-4}.txt'
  17. command Man :w|!sh -c 'p="%"; mandoc -T html "$p" | tail -n +17 | cat ~/.vim/templates/man.html - > "$p".html'
  18. command Tex :w|!sh -c 'p="%"; pdflatex "$p"'
  19. command Bib :w|!sh -c 'p="%"; biber "${p::-4}"'
  20. command Md :w|!sh -c 'p="%"; cmark --unsafe ${p::-3}.md | h2p - ${p::-3}.pdf'
  21. " nice line numbers
  22. set number
  23. set relativenumber
  24. command Nonum :set nonumber norelativenumber
  25. " syntax hilighting
  26. syntax on
  27. color pablo
  28. " vimwiki
  29. set nocompatible
  30. filetype plugin on
  31. " vimrc sane defaults
  32. filetype plugin indent on
  33. set showcmd " Show (partial) command in status line.
  34. set showmatch " Show matching brackets.
  35. set ignorecase " Do case insensitive matching
  36. set smartcase " Do smart case matching
  37. set incsearch " Incremental search
  38. set autowrite " Automatically save before commands like :next and :make
  39. set hidden " Hide buffers when they are abandoned
  40. set mouse=a " Enable mouse usage (all modes)
  41. " fmt stuffs
  42. set textwidth=60
  43. set formatoptions-=t
  44. " 2 space tabbing for nix files
  45. autocmd Filetype nix setlocal ts=2 sw=2 expandtab autoindent
  46. " jump to last position after opening
  47. if has("autocmd")
  48. au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  49. endif