File plugin/includefixer.vim changed (mode: 100644) (index 16365f6..dac6348) |
... |
... |
function! s:RecordIncludes(includes, lines) |
89 |
89 |
call add(a:lines,line(".")) |
call add(a:lines,line(".")) |
90 |
90 |
endfunction |
endfunction |
91 |
91 |
|
|
92 |
|
function! s:ClearEmpty(start,end) |
|
|
92 |
|
function! s:ClearEmpty(start, end) |
93 |
93 |
" delete every empty line between the start and end ranges of includes |
" delete every empty line between the start and end ranges of includes |
94 |
|
if (line(".") < a:start) |
|
95 |
|
return |
|
96 |
|
elseif(line(".") > a:end) |
|
97 |
|
return |
|
98 |
|
endif |
|
99 |
|
execute 'delete _' |
|
|
94 |
|
for l:n in range(a:end, a:start, -1) |
|
95 |
|
if getline(l:n) =~ '^\s*$' |
|
96 |
|
execute l:n.'delete _' |
|
97 |
|
endif |
|
98 |
|
endfor |
100 |
99 |
endfunction |
endfunction |
101 |
100 |
|
|
102 |
101 |
function! s:IsModule(include, filename) |
function! s:IsModule(include, filename) |
|
... |
... |
function! s:FixIncludes() |
202 |
201 |
|
|
203 |
202 |
let l:start = l:lines[0] - 1 |
let l:start = l:lines[0] - 1 |
204 |
203 |
let l:end = l:lines[len(l:lines)-1] |
let l:end = l:lines[len(l:lines)-1] |
205 |
|
%g/^\s*$/call <SID>ClearEmpty(l:start, l:end) |
|
|
204 |
|
call s:ClearEmpty(l:start, l:end) |
206 |
205 |
" now we can delete all the includes |
" now we can delete all the includes |
207 |
206 |
%g/#include/d |
%g/#include/d |
208 |
207 |
|
|