Mercurial > vim
annotate runtime/ftplugin/c.vim @ 34153:c7779252fab5 v9.1.0037
patch 9.1.0037: Calling get_breakindent_win() repeatedly when computing virtcol
Commit: https://github.com/vim/vim/commit/5b0722b86445158f0b502ffc48a5847b0d0187bd
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed Jan 17 20:42:53 2024 +0100
patch 9.1.0037: Calling get_breakindent_win() repeatedly when computing virtcol
Problem: Calling get_breakindent_win() repeatedly when computing
virtual column, and get_breakindent_win() does a STRCMP() on
the whole line since patch 9.0.0016.
Solution: Cache the result, since the line doesn't change.
(zeertzjq)
closes: #13879
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 17 Jan 2024 20:45:03 +0100 |
parents | 8ae680be2a51 |
children | 7c7432a53a6c |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin file |
2 " Language: C | |
32770
4027cefc2aab
Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents:
28379
diff
changeset
|
3 " Maintainer: The Vim Project <https://github.com/vim/vim> |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
4 " Last Change: 2023 Aug 22 |
32770
4027cefc2aab
Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents:
28379
diff
changeset
|
5 " Former Maintainer: Bram Moolenaar <Bram@vim.org> |
7 | 6 |
7 " Only do this when not done yet for this buffer | |
8 if exists("b:did_ftplugin") | |
9 finish | |
10 endif | |
11 | |
12 " Don't load another plugin for this buffer | |
13 let b:did_ftplugin = 1 | |
14 | |
233 | 15 " Using line continuation here. |
348 | 16 let s:cpo_save = &cpo |
7 | 17 set cpo-=C |
18 | |
19303 | 19 let b:undo_ftplugin = "setl fo< com< ofu< cms< def< inc< | if has('vms') | setl isk< | endif" |
7 | 20 |
21 " Set 'formatoptions' to break comment lines but not other lines, | |
22 " and insert the comment leader when hitting <CR> or using "o". | |
23 setlocal fo-=t fo+=croql | |
24 | |
19303 | 25 " These options have the right value as default, but the user may have |
26 " overruled that. | |
27 setlocal commentstring& define& include& | |
28 | |
502 | 29 " Set completion with CTRL-X CTRL-O to autoloaded function. |
30 if exists('&ofu') | |
31 setlocal ofu=ccomplete#Complete | |
32 endif | |
33 | |
7 | 34 " Set 'comments' to format dashed lists in comments. |
28379 | 35 " Also include ///, used for Doxygen. |
36 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,:// | |
7 | 37 |
38 " In VMS C keywords contain '$' characters. | |
39 if has("vms") | |
40 setlocal iskeyword+=$ | |
41 endif | |
42 | |
1621 | 43 " When the matchit plugin is loaded, this makes the % command skip parens and |
12756
3b26420fc639
Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
44 " braces in comments properly. |
25836 | 45 if !exists("b:match_words") |
46 let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' | |
47 let b:match_skip = 's:comment\|string\|character\|special' | |
48 let b:undo_ftplugin ..= " | unlet! b:match_skip b:match_words" | |
49 endif | |
1621 | 50 |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
51 " Win32 and GTK can filter files in the browse dialog |
3682 | 52 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") |
7 | 53 if &ft == "cpp" |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
54 let b:browsefilter = "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n" .. |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
55 \ "C Header Files (*.h)\t*.h\n" .. |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
56 \ "C Source Files (*.c)\t*.c\n" |
22 | 57 elseif &ft == "ch" |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
58 let b:browsefilter = "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" .. |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
59 \ "C Header Files (*.h)\t*.h\n" .. |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
60 \ "C Source Files (*.c)\t*.c\n" |
7 | 61 else |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
62 let b:browsefilter = "C Source Files (*.c)\t*.c\n" .. |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
63 \ "C Header Files (*.h)\t*.h\n" .. |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
64 \ "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" .. |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
65 \ "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
66 endif |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
67 if has("win32") |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
68 let b:browsefilter ..= "All Files (*.*)\t*\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
69 else |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
32770
diff
changeset
|
70 let b:browsefilter ..= "All Files (*)\t*\n" |
7 | 71 endif |
25836 | 72 let b:undo_ftplugin ..= " | unlet! b:browsefilter" |
7 | 73 endif |
348 | 74 |
75 let &cpo = s:cpo_save | |
76 unlet s:cpo_save |