annotate runtime/ftplugin/json5.vim @ 33624:420ceec75ea7

runtime(json5): Add new ftplugin (#13385) Commit: https://github.com/vim/vim/commit/d5dc58aeed1b3e76527685d04906afd634d45949 Author: dkearns <dougkearns@gmail.com> Date: Fri Oct 20 05:00:12 2023 +1100 runtime(json5): Add new ftplugin (https://github.com/vim/vim/issues/13385) Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 19 Oct 2023 20:15:03 +0200
parents
children 8ae680be2a51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33624
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Vim filetype plugin file
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " Language: JSON5
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 " Last Change: 2023 Oct 19
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 if exists("b:did_ftplugin")
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 finish
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endif
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 let b:did_ftplugin = 1
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let s:cpo_save = &cpo
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 set cpo&vim
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 setlocal commentstring=//\ %s
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 setlocal formatoptions-=t formatoptions+=croql
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let b:undo_ftplugin = "setl fo< com< cms<"
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 let b:browsefilter = "JSON5 Files (*.json5)\t*.json5\n" ..
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 \ "JSON Files (*.json)\t*.json\n" ..
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 \ "All Files (*.*)\t*.*\n"
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 let b:undo_ftplugin ..= " | unlet! b:browsefilter"
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 endif
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let &cpo = s:cpo_save
420ceec75ea7 runtime(json5): Add new ftplugin (#13385)
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 unlet s:cpo_save