This is for an indent function that should maintain the indentation should the cursor happen to be in a string region. It maintains the indentation when I hit
== in normal mode but changes when I open a new line in the same string.
if synIDattr(synID(line('.'), line('.'), 0), 'name') =~ 'string' return -1 else return correct_indentation endif
Running the function in insert mode returns an empty string:
<C-R>=synIDattr(synID(line('.'), line('.'), 0), 'name')
The docs don't mention anything about editing modes, just that it'll give different result when in gui mode from when in term mode