Export indent to g:Context_indent_function by maxigit · Pull Request #45 · wellle/context.vim

g:Context_indent_function being a funcref has to start with an uppercase
(unless there is a way to get away with it)

I'm not expecting you to accept the pull request, it's just a proof of concept, it works in theory
but defining custom function seems a bit more tricky than expected.

Example for markdown and orgmode (and indentation)

function MyIndent(line)
  let line = getline(a:line)
  let headings = match(line, '^*\+\zs\s')+1
  if headings <= 0
    let headings = match(line, '^#\+\zs\s')+1
    if headings <= 0
      let headings = 5
    endif
  endif
  return indent(a:line)+headings
endfunction

let g:Context_indent_function = funcref("MyIndent")
let g:context_skip_regex = '^\s*$'

For some reason it hangs at the begining. I think context doesn't like to to start with a indent level of 5 on an empty file ....

#44