Skip to content

Commit

Permalink
Place before namespace if no include found
Browse files Browse the repository at this point in the history
In case you use this in header files, it would be better to look for a
namespace declaration then putting it on top, where the guard header
should be.
  • Loading branch information
m42e committed Dec 17, 2015
1 parent 6946d4a commit 8600479
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugin/cpp_auto_include.vim
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ module CppAutoInclude
VIM::lines.each_with_index do |l, i|
if l =~ /^\s*#\s*include/
includes << [l, i+1]
elsif l =~ /^\s*namespace/ and includes.length == 1
includes << ['', i]
else
content << l.gsub(/\/\/[^"]*(?:"[^"']*"[^"]*)*$/,'') << "\n"
end
Expand Down

0 comments on commit 8600479

Please sign in to comment.