comparison runtime/ftplugin/javascript.vim @ 21991:bbca88cd13d5

Update runtime files. Commit: https://github.com/vim/vim/commit/207f009326c8f878defde0e594d7d9ed9860106e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 30 17:20:20 2020 +0200 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Sun, 30 Aug 2020 17:30:06 +0200
parents 53938adac247
children 8ae680be2a51
comparison
equal deleted inserted replaced
21990:8086857308b9 21991:bbca88cd13d5
1 " Vim filetype plugin file 1 " Vim filetype plugin file
2 " Language: Javascript 2 " Language: Javascript
3 " Maintainer: Doug Kearns <dougkearns@gmail.com> 3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
4 " Last Change: 2008 Jun 15 4 " Last Change: 2020 Jun 23
5 " URL: http://gus.gscit.monash.edu.au/~djkea2/vim/ftplugin/javascript.vim 5 " Contributor: Romain Lafourcade <romainlafourcade@gmail.com>
6 6
7 if exists("b:did_ftplugin") 7 if exists("b:did_ftplugin")
8 finish 8 finish
9 endif 9 endif
10 let b:did_ftplugin = 1 10 let b:did_ftplugin = 1
11 11
12 let s:cpo_save = &cpo 12 let s:cpo_save = &cpo
13 set cpo-=C 13 set cpo-=C
14 14
15 " Set 'formatoptions' to break comment lines but not other lines, 15 " Set 'formatoptions' to break comment lines but not other lines,
16 " " and insert the comment leader when hitting <CR> or using "o". 16 " and insert the comment leader when hitting <CR> or using "o".
17 setlocal formatoptions-=t formatoptions+=croql 17 setlocal formatoptions-=t formatoptions+=croql
18 18
19 " Set completion with CTRL-X CTRL-O to autoloaded function. 19 " Set completion with CTRL-X CTRL-O to autoloaded function.
20 if exists('&ofu') 20 if exists('&ofu')
21 setlocal omnifunc=javascriptcomplete#CompleteJS 21 setlocal omnifunc=javascriptcomplete#CompleteJS
24 " Set 'comments' to format dashed lists in comments. 24 " Set 'comments' to format dashed lists in comments.
25 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// 25 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
26 26
27 setlocal commentstring=//%s 27 setlocal commentstring=//%s
28 28
29 " Change the :browse e filter to primarily show Java-related files. 29 " Change the :browse e filter to primarily show JavaScript-related files.
30 if has("gui_win32") 30 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
31 let b:browsefilter="Javascript Files (*.js)\t*.js\n" . 31 let b:browsefilter =
32 \ "All Files (*.*)\t*.*\n" 32 \ "JavaScript Files (*.js)\t*.js\n"
33 \ .. "JSX Files (*.jsx)\t*.jsx\n"
34 \ .. "JavaScript Modules (*.es, *.es6, *.cjs, *.mjs, *.jsm)\t*.es;*.es6;*.cjs;*.mjs;*.jsm\n"
35 \ .. "Vue Templates (*.vue)\t*.vue\n"
36 \ .. "JSON Files (*.json)\t*.json\n"
37 \ .. "All Files (*.*)\t*.*\n"
33 endif 38 endif
34 39
35 let b:undo_ftplugin = "setl fo< ofu< com< cms<" 40 " The following suffixes should be implied when resolving filenames
41 setlocal suffixesadd+=.js,.jsx,.es,.es6,.cjs,.mjs,.jsm,.vue,.json
42
43 " The following suffixes should have low priority
44 " .snap jest snapshot
45 setlocal suffixes+=.snap
46
47 " Remove irrelevant part of 'path'.
48 " User is expected to augment it with contextually-relevant paths
49 setlocal path-=/usr/include
50
51 " Matchit configuration
52 if exists("loaded_matchit")
53 let b:match_ignorecase = 0
54 let b:match_words =
55 \ '\<do\>:\<while\>,'
56 \ .. '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,'
57 \ .. '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>'
58 endif
59
60 " Set 'define' to a comprehensive value
61 let &l:define =
62 \ '\(^\s*(*async\s\+function\|(*function\)'
63 \ .. '\|^\s*\(\*\|static\|async\|get\|set\|\i\+\.\)'
64 \ .. '\|^\s*\(\ze\i\+\)\(([^)]*).*{$\|\s*[:=,]\)'
65 \ .. '\|^\s*\(export\s\+\|export\s\+default\s\+\)*\(var\|let\|const\|function\|class\)'
66 \ .. '\|\<as\>'
67
68 let b:undo_ftplugin =
69 \ "setl fo< ofu< com< cms< sua< su< def< pa<"
70 \ .. "| unlet! b:browsefilter b:match_ignorecase b:match_words"
36 71
37 let &cpo = s:cpo_save 72 let &cpo = s:cpo_save
38 unlet s:cpo_save 73 unlet s:cpo_save
74
75 " vim: textwidth=78 tabstop=8 shiftwidth=4 softtabstop=4 expandtab