dkearns | 04e5363 | 2024-04-11 06:18:37 +1000 | [diff] [blame] | 1 | vim9script |
| 2 | |
| 3 | # Vim comments |
| 4 | |
| 5 | # Vim9-script comment |
| 6 | |
| 7 | # string only recognised with leading char |
| 8 | "useless string" |
| 9 | |
| 10 | function! Foo() |
| 11 | " Legacy-script comment |
| 12 | # 42 " comment |
| 13 | endfunction |
| 14 | |
| 15 | def! Bar() |
| 16 | # Vim9-script comment |
| 17 | "useless string" # comment |
| 18 | enddef |
| 19 | |
| 20 | command -count FooCommand { |
| 21 | # Vim9-script comment |
| 22 | "useless string" # comment |
| 23 | } |
| 24 | |
| 25 | autocmd BufNewFile * { |
| 26 | # Vim9-script comment |
| 27 | "useless string" # comment |
| 28 | } |
| 29 | |
| 30 | |
dkearns | 059cbe8 | 2024-06-12 03:27:53 +1000 | [diff] [blame] | 31 | # Multiline comments |
| 32 | |
| 33 | # comment |
| 34 | \ continuing comment |
| 35 | \ continuing comment |
| 36 | |
Doug Kearns | c29b533 | 2025-04-26 20:14:15 +0200 | [diff] [blame] | 37 | var foo = 42 # commment |
| 38 | \ continuing comment |
| 39 | \ continuing comment |
| 40 | |
dkearns | 059cbe8 | 2024-06-12 03:27:53 +1000 | [diff] [blame] | 41 | # :Foo |
| 42 | \ arg1 |
| 43 | #\ comment |
| 44 | \ arg2 |
| 45 | |
| 46 | echo "TOP" |
| 47 | |
| 48 | |
| 49 | # Line-continuation comments |
| 50 | |
| 51 | :Foo |
| 52 | #\ line continuation comment |
| 53 | \ arg1 |
| 54 | #\ line continuation comment |
| 55 | \ arg2 |
| 56 | |
| 57 | |
Doug Kearns | b9ffbf5 | 2025-04-27 19:17:06 +0200 | [diff] [blame] | 58 | # Expression comments |
| 59 | |
| 60 | var foo = { # comment |
| 61 | # comment |
| 62 | bar: 42, # comment |
| 63 | # comment |
| 64 | # comment |
| 65 | baz: 42 # comment |
| 66 | # comment |
| 67 | } # comment |
| 68 | |
| 69 | |
dkearns | 04e5363 | 2024-04-11 06:18:37 +1000 | [diff] [blame] | 70 | # Issue: #13047 |
| 71 | |
| 72 | if !exists(":DiffOrig") |
| 73 | command DiffOrig vert new | set bt=nofile | r ++edit %% | 0d_ | diffthis |
| 74 | \ | wincmd p | diffthis |
| 75 | endif |
| 76 | |
| 77 | |
| 78 | # Issue: #11307 and #11560 |
| 79 | |
| 80 | # This is what we call " blah |
Doug Kearns | b9ffbf5 | 2025-04-27 19:17:06 +0200 | [diff] [blame] | 81 | |
| 82 | |
| 83 | # PR: #14975 |
| 84 | # https://github.com/vim/vim/pull/14975#issuecomment-2832643115 |
| 85 | |
| 86 | var d = { |
| 87 | a: 0, |
| 88 | # a ' quote {{{ |
| 89 | #}}} |
| 90 | b: 0, |
| 91 | } |
| 92 | |