From bfd330a271933c3372fcfa8ce052970746c8e9dd Mon Sep 17 00:00:00 2001 From: David Briscoe Date: Tue, 10 May 2022 12:36:43 -0700 Subject: Ensure cinoptions is set to a known value (#24) Fix `set cinoptions=#1` causes incorrect define indenting. To get correct glsl indentation, we want default 'cinoptions'. It's useful to `set cinoptions=#1` (to allow most filetypes to use # comments), so we should ensure we're using a known set of indent options and revert to the default. The user can still customize cinoptions in ~/.vim/after/indent/glsl.vim. ## Test ```vim :set cinoptions=#1 :edit test.glsl gg=G ``` ```glsl // test.glsl #define PI 4 #define TAU 8 // line gets 1 space indent float f(float x) { return x * 2; } ``` --- indent/glsl.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/indent/glsl.vim b/indent/glsl.vim index 56c817d..bb54dd8 100644 --- a/indent/glsl.vim +++ b/indent/glsl.vim @@ -7,5 +7,6 @@ endif setlocal autoindent cindent setlocal formatoptions+=roq +setlocal cinoptions& " vim:set sts=2 sw=2 : -- cgit v1.2.3