view runtime/syntax/testdir/input/vim_ex_let_heredoc.vim @ 36025:d02e26727718

runtime(vim): Update base-syntax, improve :let-heredoc highlighting Commit: https://github.com/vim/vim/commit/7884cc74188caea6e42b1456ed90c8a7189dda7c Author: Doug Kearns <dougkearns@gmail.com> Date: Fri Aug 23 18:01:35 2024 +0200 runtime(vim): Update base-syntax, improve :let-heredoc highlighting The end marker is not required to match the indent of :let when "trim" is specified, it may also appear without leading whitespace as normal. closes: #15564 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Fri, 23 Aug 2024 18:15:12 +0200
parents 5436a3321231
children
line wrap: on
line source

" Vim :let heredoc command
" VIM_TEST_SETUP let g:vimsyn_folding = "h"
" VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax


let foo =<< END
line1
line2
END

  let foo =<< END
line1
line2
END


" trim

let foo =<< trim END
  line1
  line2
END

  let foo =<< trim END
    line1
    line2
  END


" interpolation

let foo =<< eval END
line{1 + 0}
line{1 + 1}
END

  let foo =<< eval END
line{1 + 0}
line{1 + 1}
END

let foo =<< trim eval END
  line{1 + 0}
  line{1 + 1}
END

  let foo =<< trim eval END
    line{1 + 0}
    line{1 + 1}
  END

" no interpolation (escaped { and })

let foo =<< eval END
line{{1 + 0}}
line{{1 + 1}}
END

  let foo =<< eval END
line{{1 + 0}}
line{{1 + 1}}
END

let foo =<< trim eval END
  line{{1 + 0}}
  line{{1 + 1}}
END

  let foo =<< trim eval END
    line{{1 + 0}}
    line{{1 + 1}}
  END


" no interpolation

let foo =<< END
line{1 + 0}
line{1 + 1}
END

  let foo =<< END
line{1 + 0}
line{1 + 1}
END

let foo =<< trim END
  line{1 + 0}
  line{1 + 1}
END

  let foo =<< trim END
    line{1 + 0}
    line{1 + 1}
  END


" end marker must not be followed by whitespace

" assert_equal(foo, ["END "])
let foo =<< END
END 
END

" assert_equal(foo, [" END "])
let foo =<< END
 END 
END

" assert_equal(foo, ["END "])
let foo =<< trim END
  END 
END

" assert_equal(foo, ["END "])
  let foo =<< trim END
    END 
  END


" end marker must be vertically aligned with :let (if preceded by whitespace)

" assert_equal(foo, ["END"])
let foo =<< trim END
  END
END

  " assert_equal(foo, ["END"])
  let foo =<< trim END
    END
  END

" assert_equal(foo, ["END "])
let foo =<< trim END
END 
END

  " assert_equal(foo, ["END"])
  let foo =<< trim END
    END
  END

  " assert_equal(foo, ["END "])
  let foo =<< trim END
    END 
  END

  " assert_equal(foo, ["END"])
  let foo =<< trim END
     END
  END

  " assert_equal(foo, ["END "])
  let foo =<< trim END
     END 
  END

  " assert_equal(foo, ["END "])
  let foo =<< trim END
END 
END

  " assert_equal(foo, ["END"])
  let foo =<< trim END
 END
END

  " assert_equal(foo, ["END"])
  let foo =<< trim END
   END
END


" end markers

let foo =<< !@#$%^&*()_+
line1
line2
!@#$%^&*()_+

let foo =<< 0!@#$%^&*()_+
line1
line2
0!@#$%^&*()_+

let foo =<< A!@#$%^&*()_+
line1
line2
A!@#$%^&*()_+

" error - leading lowercase character
let foo =<< a!@#$%^&*()_+
line1
line2
a!@#$%^&*()_+