diff --git a/plugin/cpp_auto_include.vim b/plugin/cpp_auto_include.vim index 8252e58..944e0d1 100644 --- a/plugin/cpp_auto_include.vim +++ b/plugin/cpp_auto_include.vim @@ -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