Skip to content

Commit 9b6e7d1

Browse files
committed
Change file type canonicalization to treat C as C++
Please refer to the inline comments for more details. This will hopefully fix issue #91 on GitHub: #91 PS. I've completely removed the objc/objcpp grouping because I don't know these languages so I don't know what grouping would be correct anyway. Until a user with an informed opinion chimes in it's better to just remove this grouping.
1 parent d251fdb commit 9b6e7d1

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

autoload/xolox/easytags.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: September 17, 2014
3+
" Last Change: October 20, 2014
44
" URL: http://peterodding.com/code/vim/easytags/
55

6-
let g:xolox#easytags#version = '3.7'
6+
let g:xolox#easytags#version = '3.8'
77
let g:xolox#easytags#default_pattern_prefix = '\C\<'
88
let g:xolox#easytags#default_pattern_suffix = '\>'
99

autoload/xolox/easytags/filetypes.vim

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: June 20, 2014
3+
" Last Change: October 20, 2014
44
" URL: http://peterodding.com/code/vim/easytags/
55

66
" This submodule of the vim-easytags plug-in translates between back and forth
@@ -110,8 +110,22 @@ endfunction
110110

111111
" }}}1
112112

113-
" Define the default file type groups.
114-
call xolox#easytags#filetypes#add_group('c', 'cpp', 'objc', 'objcpp')
113+
" Define the default file type groups. It's important that C normalizes to C++
114+
" because of the following points:
115+
"
116+
" - Vim and Exuberant Ctags consistently treat *.h files as C++. I guess this
117+
" is because A) the filename extension is ambiguous and B) C++ is a
118+
" superset of C so the mapping makes sense.
119+
"
120+
" - Because of the above point, when you use file type specific tags files
121+
" and you're editing C source code you'll be missing everything defined in
122+
" your *.h files. Depending on your programming style those tags might be
123+
" redundant or they might not be.
124+
"
125+
" To solve this dilemma the vim-easytags plug-in groups the C and C++ file
126+
" types together and tells Exuberant Ctags to treat it all as C++ because C++
127+
" is a superset of C.
128+
call xolox#easytags#filetypes#add_group('cpp', 'c')
115129
call xolox#easytags#filetypes#add_group('html', 'htmldjango')
116130

117131
" Define the default file type mappings.

0 commit comments

Comments
 (0)