xaizek / vim-includefixer (License: BSLv1) (since 2018-12-07)
Vim plugin to automatically categorize and alphabetize #include headers
Commit dec4dabd70965de12941c93d8a420846d55c1626

Reimplement ClearEmpty without use of :global
Don't remember why this was done.
Author: xaizek
Author date (UTC): 2016-09-03 19:15
Committer name: xaizek
Committer date (UTC): 2016-09-03 19:17
Parent(s): 8d542d8db89d522912e0c3ececa8c00d92684ed3
Signing key: 99DC5E4DB05F6BE2
Tree: 2f12b424892c17069b1dc1bb4d41e23822133a63
File Lines added Lines deleted
plugin/includefixer.vim 7 8
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
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vim-includefixer

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vim-includefixer

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master