xaizek / vim-preamble (License: Unspecified) (since 2018-12-07)
Preamble Vim plugin by Mel Davis with a couple of fixes.
Commit 8d0547fcde5d73575823977badd8ba97892ac352

Fix preamble detection for python
Author: xaizek
Author date (UTC): 2014-11-02 15:57
Committer name: xaizek
Committer date (UTC): 2014-11-02 15:57
Parent(s): d910694d908d777b4d4186eb32f22574346f5f0f
Signing key:
Tree: 8762ad05b1307066a09c44cd7e97527967cd40d9
File Lines added Lines deleted
autoload/Preamble.vim 23 2
File autoload/Preamble.vim changed (mode: 100644) (index 50afd57..d9d06e4)
... ... fun! s:Length()
179 179 if !is_blankline if !is_blankline
180 180 let synId = synID(line_pos, 1, 1) let synId = synID(line_pos, 1, 1)
181 181 let realSynId = synIDtrans(synId) let realSynId = synIDtrans(synId)
182 if (synIDattr( realSynId, 'name' ) != 'Comment') | break | endif
182 let attrName = synIDattr( realSynId, 'name' )
183 if attrName != 'Comment' && !s:IsInString(line_pos)
184 break
185 endif
183 186 endif endif
184 187
185 188 let line_pos = line_pos + 1 let line_pos = line_pos + 1
186 189 endwhile endwhile
187 190
188 191 return line_pos-1 return line_pos-1
189 endfunction
192 endfunction
193
194
195 " ========================================================
196 " IsInString: Checks whether line is part of a string
197 "
198 " This is important for example for python, which
199 " doesn't have multiline comments and multiline string
200 " literals are used instead.
201 " ========================================================
190 202
203 fun! s:IsInString(line)
204 for id in synstack(a:line, 1)
205 let attrName = synIDattr(synIDtrans(id), 'name')
206 if attrName == 'String'
207 return 1
208 endif
209 endfor
210 return 0
211 endfunction
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-preamble

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

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