You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let full_content =join(readfile(a:path), "\n")" Get the content of `colors/sonokai.vim`
208
-
letft_content= []
209
-
let rootpath =sonokai#ft_rootpath(a:path)" Get the path to place the `after/ftplugin` directory.
210
-
callsubstitute(full_content, '" ft_begin.\{-}ft_end', '\=add(ft_content, submatch(0))', 'g')" Search for 'ft_begin.\{-}ft_end' (non-greedy) and put all the search results into a list.
211
-
for content inft_content
212
-
letft_list= []
213
-
callsubstitute(matchstr(matchstr(content, 'ft_begin:.\{-}{{{'), ':.\{-}{{{'), '\(\w\|-\)\+', '\=add(ft_list, submatch(0))', 'g')" Get the file types. }}}}}}
214
-
forftinft_list
215
-
callsonokai#ft_write(rootpath, ft, content)" Write the content.
208
+
letsyn_conent= []
209
+
let rootpath =sonokai#syn_rootpath(a:path)" Get the path to place the `after/syntax` directory.
210
+
callsubstitute(full_content, '" syn_begin.\{-}syn_end', '\=add(syn_conent, submatch(0))', 'g')" Search for 'syn_begin.\{-}syn_end' (non-greedy) and put all the search results into a list.
211
+
for content insyn_conent
212
+
letsyn_list= []
213
+
callsubstitute(matchstr(matchstr(content, 'syn_begin:.\{-}{{{'), ':.\{-}{{{'), '\(\w\|-\)\+', '\=add(syn_list, submatch(0))', 'g')" Get the file types. }}}}}}
214
+
forsyninsyn_list
215
+
callsonokai#syn_write(rootpath, syn, content)" Write the content.
216
216
endfor
217
217
endfor
218
-
callsonokai#ft_write(rootpath, 'text', "let g:sonokai_last_modified = '" . a:last_modified . "'")" Write the last modified time to `after/ftplugin/text/sonokai.vim`
callsonokai#syn_write(rootpath, 'text', "let g:sonokai_last_modified = '" . a:last_modified . "'")" Write the last modified time to `after/syntax/text/sonokai.vim`
callwritefile(['" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker fmr={{{,}}}:'], ft_path, 'a')
256
+
callwritefile(['" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker fmr={{{,}}}:'], syn_path, 'a')
257
257
endfunction"}}}
258
-
function!sonokai#ft_rootpath(path)"{{{
259
-
" Get the directory where `after/ftplugin` is generated.
260
-
if (matchstr(a:path, '^/usr/share') ==# '')" Return the plugin directory. The `after/ftplugin` directory should never be generated in `/usr/share`, even if you are a root user.
258
+
function!sonokai#syn_rootpath(path)"{{{
259
+
" Get the directory where `after/syntax` is generated.
260
+
if (matchstr(a:path, '^/usr/share') ==# '')" Return the plugin directory. The `after/syntax` directory should never be generated in `/usr/share`, even if you are a root user.
" Determine whether the current ftplugin files are up to date by comparing the last modified time in `colors/sonokai.vim` and `after/ftplugin/text/sonokai.vim`.
" Determine whether the current syntax files are up to date by comparing the last modified time in `colors/sonokai.vim` and `after/syntax/text/sonokai.vim`.
0 commit comments