|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a new buffer is created with no filename, it's often because I want
to paste text into it without being bothered by autoindent or tab
translation, and so I'd rather Vim just accepted the text as literal
input without trying to indent it for me.
Similarly, for CSV files or Vim help files, space-based automatic
indentation is undesirable or not meaningful. It's better to allow Tab
to insert literal tab characters in this case, especially if it's a
classic Unix-style tab-separated file.
However, these settings should definitely be set on buffers which
actually do have virtually any other filetype.
I don't really like that long `if` condition there--it might be better
to find some way to simulate a case/switch structure instead.
I originally wanted to include a "negative match" in the `autocmd`
definition, which I imagined looking something like this:
autocmd FileType '',csv,help,text call FileTypeIndentConfig(&filetype)
autocmd FileType !'',csv,help,text call FileTypeIndentConfig(&filetype)
However I can't find anything in the Vim :help or by searching online
that suggests this is possible. This function-based approach seems good
enough for now.
This hasn't been tested on old versions of Vim yet.
|