neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

indent.vim (7200B)


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