indent.vim 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. " Vim syntax file
  2. " Language: indent(1) configuration file
  3. " Maintainer: Doug Kearns <dougkearns@gmail.com>
  4. " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
  5. " Last Change: 2021 Nov 17
  6. " indent_is_bsd: If exists, will change somewhat to match BSD implementation
  7. "
  8. " TODO: is the deny-all (a la lilo.vim nice or no?)...
  9. " irritating to be wrong to the last char...
  10. " would be sweet if right until one char fails
  11. if exists("b:current_syntax")
  12. finish
  13. endif
  14. let s:cpo_save = &cpo
  15. set cpo&vim
  16. setlocal iskeyword+=-,+
  17. syn match indentError '\S\+'
  18. syn keyword indentTodo contained TODO FIXME XXX NOTE
  19. syn region indentComment start='/\*' end='\*/'
  20. \ contains=indentTodo,@Spell
  21. syn region indentComment start='//' skip='\\$' end='$'
  22. \ contains=indentTodo,@Spell
  23. if !exists("indent_is_bsd")
  24. syn match indentOptions '-i\|--indent-level\|-il\|--indent-label'
  25. \ nextgroup=indentNumber skipwhite skipempty
  26. endif
  27. syn match indentOptions '-\%(bli\|c\%([bl]i\|[dip]\)\=\|di\=\|ip\=\|lc\=\|pp\=i\|sbi\|ts\|-\%(brace-indent\|comment-indentation\|case-brace-indentation\|declaration-comment-column\|continuation-indentation\|case-indentation\|else-endif-column\|line-comments-indentation\|declaration-indentation\|indent-level\|parameter-indentation\|line-length\|comment-line-length\|paren-indentation\|preprocessor-indentation\|struct-brace-indentation\|tab-size\)\)'
  28. \ nextgroup=indentNumber skipwhite skipempty
  29. syn match indentNumber display contained '\d\+\>'
  30. syn match indentOptions '-T'
  31. \ nextgroup=indentIdent skipwhite skipempty
  32. syn match indentIdent display contained '\h\w*\>'
  33. syn keyword indentOptions -bacc --blank-lines-after-ifdefs
  34. \ -bad --blank-lines-after-declarations
  35. \ -badp --blank-lines-after-procedure-declarations
  36. \ -bap --blank-lines-after-procedures
  37. \ -bbb --blank-lines-before-block-comments
  38. \ -bbo --break-before-boolean-operator
  39. \ -bc --blank-lines-after-commas
  40. \ -bfda --break-function-decl-args
  41. \ -bfde --break-function-decl-args-end
  42. \ -bl --braces-after-if-line
  43. \ -blf --braces-after-func-def-line
  44. \ -bls --braces-after-struct-decl-line
  45. \ -br --braces-on-if-line
  46. \ -brf --braces-on-func-def-line
  47. \ -brs --braces-on-struct-decl-line
  48. \ -bs --Bill-Shannon --blank-before-sizeof
  49. \ -c++ --c-plus-plus
  50. \ -cdb --comment-delimiters-on-blank-lines
  51. \ -cdw --cuddle-do-while
  52. \ -ce --cuddle-else
  53. \ -cs --space-after-cast
  54. \ -dj --left-justify-declarations
  55. \ -eei --extra-expression-indentation
  56. \ -fc1 --format-first-column-comments
  57. \ -fca --format-all-comments
  58. \ -gnu --gnu-style
  59. \ -h --help --usage
  60. \ -hnl --honour-newlines
  61. \ -kr --k-and-r-style --kernighan-and-ritchie --kernighan-and-ritchie-style
  62. \ -lp --continue-at-parentheses
  63. \ -lps --leave-preprocessor-space
  64. \ -nbacc --no-blank-lines-after-ifdefs
  65. \ -nbad --no-blank-lines-after-declarations
  66. \ -nbadp --no-blank-lines-after-procedure-declarations
  67. \ -nbap --no-blank-lines-after-procedures
  68. \ -nbbb --no-blank-lines-before-block-comments
  69. \ -nbbo --break-after-boolean-operator
  70. \ -nbc --no-blank-lines-after-commas
  71. \ -nbfda --dont-break-function-decl-args
  72. \ -nbfde --dont-break-function-decl-args-end
  73. \ -nbs --no-Bill-Shannon --no-blank-before-sizeof
  74. \ -ncdb --no-comment-delimiters-on-blank-lines
  75. \ -ncdw --dont-cuddle-do-while
  76. \ -nce --dont-cuddle-else
  77. \ -ncs --no-space-after-casts
  78. \ -ndj --dont-left-justify-declarations
  79. \ -neei --no-extra-expression-indentation
  80. \ -nfc1 --dont-format-first-column-comments
  81. \ -nfca --dont-format-comments
  82. \ -nhnl --ignore-newlines
  83. \ -nip --dont-indent-parameters --no-parameter-indentation
  84. \ -nlp --dont-line-up-parentheses
  85. \ -nlps --remove-preprocessor-space
  86. \ -npcs --no-space-after-function-call-names
  87. \ -npmt
  88. \ -npro --ignore-profile
  89. \ -nprs --no-space-after-parentheses
  90. \ -npsl --dont-break-procedure-type
  91. \ -nsaf --no-space-after-for
  92. \ -nsai --no-space-after-if
  93. \ -nsaw --no-space-after-while
  94. \ -nsc --dont-star-comments
  95. \ -nsob --leave-optional-blank-lines
  96. \ -nss --dont-space-special-semicolon
  97. \ -nut --no-tabs
  98. \ -nv --no-verbosity
  99. \ -o --output
  100. \ -o --output-file
  101. \ -orig --berkeley --berkeley-style --original --original-style
  102. \ -pcs --space-after-procedure-calls
  103. \ -pmt --preserve-mtime
  104. \ -prs --space-after-parentheses
  105. \ -psl --procnames-start-lines
  106. \ -saf --space-after-for
  107. \ -sai --space-after-if
  108. \ -saw --space-after-while
  109. \ -sc --start-left-side-of-comments
  110. \ -sob --swallow-optional-blank-lines
  111. \ -ss --space-special-semicolon
  112. \ -st --standard-output
  113. \ -ut --use-tabs
  114. \ -v --verbose
  115. \ -version --version
  116. \ -linux --linux-style
  117. if exists("indent_is_bsd")
  118. syn keyword indentOptions -ip -ei -nei
  119. endif
  120. if exists("c_minlines")
  121. let b:c_minlines = c_minlines
  122. else
  123. if !exists("c_no_if0")
  124. let b:c_minlines = 50 " #if 0 constructs can be long
  125. else
  126. let b:c_minlines = 15 " mostly for () constructs
  127. endif
  128. endif
  129. hi def link indentError Error
  130. hi def link indentComment Comment
  131. hi def link indentTodo Todo
  132. hi def link indentOptions Keyword
  133. hi def link indentNumber Number
  134. hi def link indentIdent Identifier
  135. let b:current_syntax = "indent"
  136. let &cpo = s:cpo_save
  137. unlet s:cpo_save