Skip to content

Commit e76f4f4

Browse files
committed
Merge pull request #1 from vas-and-tor/master
add more useful includes and functions
2 parents 8eef820 + d4d22b3 commit e76f4f4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

plugin/cpp_auto_include.vim

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,32 @@ module CppAutoInclude
8282

8383
# header, std namespace, keyword complete (false: no auto remove #include), unioned regex
8484
HEADER_STD_COMPLETE_REGEX = [
85-
['cstdio', false, true , R[F['s?scanf', 'puts', 's?printf', 'f?gets'], C['FILE']] ],
85+
['cstdio', false, true , R[F['s?scanf', 'puts', 's?printf', 'f?gets', '(?:get|put)char', 'getc'], C['FILE','std(?:in|out|err)','EOF']] ],
8686
['cassert', false, true , R[F['assert']] ],
87-
['cstring', false, true , R[F['mem(?:cpy|set|n?cmp)', 'str(?:len|n?cmp|n?cpy|error)']] ],
88-
['cstdlib', false, true , R[F['system','abs','ato[if]','strto[dflu]+','free','exit','l?abs','s?rand(?:_r|om)?'], C['EXIT_[A-Z]*', 'NULL']] ],
89-
['cmath', false, false, R[F['pow[fl]?','a?(?:sin|cos|tan)[hl]*', 'exp[m12fl]*', 'fabs[fl]?', 'log[210fl]+', 'nan[fl]?', '(?:ceil|floor)[fl]?', 'l?l?round', 'sqrt[fl]?'], C['M_[A-Z24_]*', 'NAN', 'INFINITY', 'HUGE_[A-Z]*']] ],
90-
['cstrings', false, true , R[F['b(?:cmp|copy|zero)', 'strn?casecmp']] ],
87+
['cstring', false, true , R[F['mem(?:cpy|set|n?cmp)', 'str(?:len|n?cmp|n?cpy|error|cat|str|chr)']] ],
88+
['cstdlib', false, true , R[F['system','abs','ato[if]', 'itoa', 'strto[dflu]+','free','exit','l?abs','s?rand(?:_r|om)?','qsort'], C['EXIT_[A-Z]*', 'NULL']] ],
89+
['cmath', false, true , R[F['pow[fl]?','a?(?:sin|cos|tan)[hl]*', 'atan2[fl]?', 'exp[m12fl]*', 'fabs[fl]?', 'log[210fl]+', 'nan[fl]?', '(?:ceil|floor)[fl]?', 'l?l?round[fl]?', 'sqrt[fl]?'], C['M_[A-Z24_]*', 'NAN', 'INFINITY', 'HUGE_[A-Z]*']] ],
90+
['strings.h', false, true , R[F['b(?:cmp|copy|zero)', 'strn?casecmp']] ],
9191
['typeinfo', false, true , R[C['typeid']] ],
9292
['new', true , true , R[F['set_new_handler'], C['nothrow']] ],
9393
['limits', true , true , R[T['numeric_limits']] ],
94-
['algorithm', true , false, R[F['(?:stable_|partial_)?sort(?:_copy)?', 'unique(?:_copy)', 'reverse(?:_copy)', 'nth_element', '(?:lower|upper)_bound', 'binary_search', '(?:prev|next)_permutation']] ],
94+
['algorithm', true , true , R[F['(?:stable_|partial_)?sort(?:_copy)?', 'unique(?:_copy)?', 'reverse(?:_copy)?', 'nth_element', '(?:lower|upper)_bound', 'binary_search', '(?:prev|next)_permutation', 'min', 'max', 'count', 'random_shuffle', 'swap']] ],
9595
['numeric', true , true , R[F['partial_sum', 'accumulate', 'adjacent_difference', 'inner_product']] ],
9696
['iostream', true , true , R[C['c(?:err|out|in)']] ],
97-
['sstream', true , true , R[C['[io]stringstream']] ],
97+
['sstream', true , true , R[C['[io]?stringstream']] ],
9898
['bitset', true , true , R[T['bitset']] ],
9999
['complex', true , true , R[T['complex']] ],
100100
['deque', true , true , R[T['deque']] ],
101-
['priority_queue', true , true , R[T['priority_queue']] ],
101+
['queue', true , true , R[T['queue','priority_queue']] ],
102102
['list', true , true , R[T['list']] ],
103103
['map', true , true , R[T['(?:multi)?map']] ],
104104
['set', true , true , R[T['(?:multi)?set']] ],
105105
['vector', true , true , R[T['vector']] ],
106+
['iomanip', true , true , R[F['setprecision', 'setbase', 'setw'], C['fixed', 'hex']]],
107+
['fstream', true , true , R[T['fstream']] ],
108+
['ctime', false, true , R[F['time', 'clock'], C['CLOCKS_PER_SEC']]],
106109
['string', true , true , R[C['string']] ],
110+
['utility', true , true , R[T['pair'], F['make_pair']] ],
107111
]
108112

109113
USING_STD = 'using namespace std;'

0 commit comments

Comments
 (0)