sysinit.vim 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. " Default Gentoo configuration file for neovim
  2. " Based on the default vimrc shipped by Gentoo with app-editors/vim-core
  3. " You can override any of these settings on a global basis via the
  4. " "/etc/vim/nvimrc.local" file, and on a per-user basis via "~/.nvimrc".
  5. " You may need to create these.
  6. " Neovim comes with sensible defaults, see:
  7. " https://github.com/neovim/neovim/issues/2676
  8. " Most of the general settings from Gentoo's vimrc have been dropped here.
  9. " We add only some necessary fixes and a few Gentoo specific settings.
  10. " {{{ Locale settings
  11. " If we have a BOM, always honour that rather than trying to guess.
  12. if &fileencodings !~? "ucs-bom"
  13. set fileencodings^=ucs-bom
  14. endif
  15. " Always check for UTF-8 when trying to determine encodings.
  16. if &fileencodings !~? "utf-8"
  17. " If we have to add this, the default encoding is not Unicode.
  18. let g:added_fenc_utf8 = 1
  19. set fileencodings+=utf-8
  20. endif
  21. " }}}
  22. " {{{ Fix &shell, see bug #101665.
  23. if "" == &shell
  24. if executable("/bin/bash")
  25. set shell=/bin/bash
  26. elseif executable("/bin/sh")
  27. set shell=/bin/sh
  28. endif
  29. endif
  30. "}}}
  31. " {{{ Our default /bin/sh is bash, not ksh, so syntax highlighting for .sh
  32. " files should default to bash. See :help sh-syntax and bug #101819.
  33. if has("eval")
  34. let is_bash=1
  35. endif
  36. " }}}
  37. " {{{ Autocommands
  38. if has("autocmd")
  39. augroup gentoo
  40. au!
  41. " Gentoo-specific settings for ebuilds. These are the federally-mandated
  42. " required tab settings. See the following for more information:
  43. " http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml
  44. " Note that the rules below are very minimal and don't cover everything.
  45. " Better to emerge app-vim/gentoo-syntax, which provides full syntax,
  46. " filetype and indent settings for all things Gentoo.
  47. au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab
  48. " In text files, limit the width of text to 78 characters, but be careful
  49. " that we don't override the user's setting.
  50. autocmd BufNewFile,BufRead *.txt
  51. \ if &tw == 0 && ! exists("g:leave_my_textwidth_alone") |
  52. \ setlocal textwidth=78 |
  53. \ endif
  54. " When editing a file, always jump to the last cursor position
  55. autocmd BufReadPost *
  56. \ if ! exists("g:leave_my_cursor_position_alone") |
  57. \ if line("'\"") > 0 && line ("'\"") <= line("$") |
  58. \ exe "normal g'\"" |
  59. \ endif |
  60. \ endif
  61. " When editing a crontab file, set backupcopy to yes rather than auto. See
  62. " :help crontab and bug #53437.
  63. autocmd FileType crontab set backupcopy=yes
  64. " If we previously detected that the default encoding is not UTF-8
  65. " (g:added_fenc_utf8), assume that a file with only ASCII characters (or no
  66. " characters at all) isn't a Unicode file, but is in the default encoding.
  67. " Except of course if a byte-order mark is in effect.
  68. autocmd BufReadPost *
  69. \ if exists("g:added_fenc_utf8") && &fileencoding == "utf-8" &&
  70. \ ! &bomb && search('[\x80-\xFF]','nw') == 0 && &modifiable |
  71. \ set fileencoding= |
  72. \ endif
  73. " Strip trailing spaces on write
  74. autocmd BufWritePre *.e{build,class}
  75. \ if ! exists("g:leave_my_trailing_space_alone") |
  76. \ :%s/\s\+$//e |
  77. \ endif
  78. augroup END
  79. endif " has("autocmd")
  80. " }}}
  81. " {{{ nvimrc.local
  82. if filereadable("/etc/vim/nvimrc.local")
  83. source /etc/vim/nvimrc.local
  84. endif
  85. " }}}
  86. " vim: set tw=80 sw=2 sts=2 et foldmethod=marker :