Gentoo syntax files and xptemplates

42 views
Skip to first unread message

Krzysztof

unread,
Jan 8, 2012, 6:47:59 AM1/8/12
to xptem...@googlegroups.com
Hi,

I recently started using gentoo distribution.
I have used xptemplates for some time.
Gentoo is so kind(or not so kind) that it distributes vim files for
its specific files but not so kind to change filetype to sth like
gentoo-*.
For example vi /etc/make.conf -c":echo &ft"
will yeld gentoo-make-conf.

This causes problem with xptemplates because It can't find matching
file type.
Problem code
file: plugin/classes/FiletypeScope.vim line 29 (in my git version)
fun! s:SetSnippetLoaded( filename ) dict "{{{
let self.loadedSnipFiles[ a:filename ] = 1

let fn = substitute(a:filename, '\\', '/', 'g')
let shortname = matchstr(fn, '\Vftplugin\/\zs\w\+\/\.\*\ze.xpt.vim')
let self.loadedSnipFiles[shortname] =
endfunction "}}}

I the same is for 0.4.8.1220.
One solution is patch below, it may fix some other problems.
Second is to add some gentoo file matching to xptemplates .

Proposed patch :
diff --git a/plugin/classes/FiletypeScope.vim
b/plugin/classes/FiletypeScope.vim index 8a3b96f..a37c2d6 100644
--- a/plugin/classes/FiletypeScope.vim
+++ b/plugin/classes/FiletypeScope.vim
@@ -31,7 +31,9 @@ fun! s:SetSnippetLoaded( filename ) dict "{{{

let fn = substitute(a:filename, '\\', '/', 'g')
let shortname = matchstr(fn,'\Vftplugin\/\zs\w\+\/\.\*\ze.xpt.vim')
- let self.loadedSnipFiles[shortname] = 1
+ if ( shortname != "" )
+ let self.loadedSnipFiles[shortname] = 1
+ endif
endfunction "}}}

dr-dr xp

unread,
Jan 10, 2012, 9:41:09 PM1/10/12
to xptem...@googlegroups.com
I'm going to have a try within  gentoo. According to your description xpt fails to extract short name of plugin file, right?

Downloading ISO..


--
You received this message because you are subscribed to the Google Groups "xptemplate" group.
To post to this group, send email to xptem...@googlegroups.com.
To unsubscribe from this group, send email to xptemplate+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xptemplate?hl=en.




--
要了几天饱饭就不记得西北风啥味了

Krzysztof

unread,
Jan 11, 2012, 1:16:49 PM1/11/12
to xptem...@googlegroups.com
Don't think ISO and whole system is needed.
Gentoo ships some files like

/usr/share/vim/vimfiles/ftdetect/gentoo.vim

which in turn provide some additional functionality for system
configuration files.
The one above contains:

" make.conf
au BufNewFile,BufRead make.{conf,globals}
\ set filetype=gentoo-make-conf

second ones like

/usr/share/vim/vimfiles/syntax/gentoo-make-conf.vim

provide syntax highlighting.
But using the xptemplates at first time for that file results in error:

Error detected while processing function
XPTemplateStart..<SNR>52_GetContextFTObj..XPTsnippetFileInit..<SNR>37_CheckAndSetSnippetLoaded..<SNR>37_SetSnippetLoaded:
line 6: E713: Cannot use empty key for Dictionary

after that everything is ok.
I can send you the file in question if you want.

dr-dr xp

unread,
Jan 12, 2012, 12:45:22 PM1/12/12
to xptem...@googlegroups.com
oh i see.

I've used too strict regular expression. Now all of the chars except "/" can be used by filetype.

New release updated on both vim.org and github.


--
要了几天饱饭就不记得西北风啥味了

Krzysztof

unread,
Jan 12, 2012, 5:57:27 PM1/12/12
to xptem...@googlegroups.com
On Fri, 13 Jan 2012 01:45:22 +0800
dr-dr xp <drd...@gmail.com> wrote:

Checked. Works. Great.

Thanks.

Reply all
Reply to author
Forward
0 new messages