On Fri, Jul 25, 2014 at 5:37 AM, ozhan fenerci <o_fene...@yahoo.com.tr> wrote: > Dear Friends, > > I am using vim-latex suite for my writing in Latex. I would like to use it > for not only tex docs but also other formats such as Sphinx. My questions: > > 1) How to load vim-latex suite for files written in Sphinx (say that, my file > has extension like " myfile.rst") > > 2) I would like to use IMAP() and placeholder functionality of vim-latex > (and its place holder functionality) for some shortcuts for such as " > :math:`x^2` " in Sphinx, which is equivalent $x^2$ in Latex. For example, > whenever I write 'MM' in file, I want it to refer a shortcut to ":math:` > placeholder`" > > > In general, it would be great to extend vim-latex functionality to docs > written in other formats. > > > Best Regards, > Ozhan
Hi Ozhan, It sounds like you don't necessarily want to load all of it. I made a simple plugin with IMAPs for C/C++ and HTML code. The gist of it is listed below. These are ripped from my ~/.vim/ftplugin/c.vim. Hope this helps. I may upload my plugins to github or something, but I'll have to be careful about license stuff first. Cheers, Mike " get access to IMAP() runtime plugin/imaps.vim " SafeLet comes from latex-suite (vim-latex) " SafeLet: checks for value before giving default value {{{ " Description: The function takes in a single argument and splits it into 2 " parts, the first being the first <CWORD> found. this is taken " as a variable name and the next part is assigned to it " depending on whether the variable already exists or not. " handles the case where the next part is quoted or not. " All these calls work: " CLet g:varname = 1 " CLet g:varname = '1' " CLet g:varname = 'foo bar' " CLet g:varname = "foo\nbar" " CLet g:varname = foo bar function! <SID>SafeLet(arg) let name = matchstr(a:arg, '^\s*\zs\(\S\+\)\ze\s*=') let value = matchstr(a:arg, '=\s*\zs.*\ze') let value = substitute(value, '\s*$', '', '') if !exists(name) if value =~ "^'\\|^\"" exec "let ".name." = ".value else exe "let ".name." = value" endif endif endfunction com! -nargs=+ CLet :call <SID>SafeLet(<q-args>) CLet g:C_leader = '`' " We need funny placeholders so code indentation works right. CLet b:Imap_PlaceHolderStart = ";<" CLet b:Imap_PlaceHolderEnd = ">;" " real plugin has more of these CLet g:C_idiom_if = "if (<++>) {\<cr><++>\<cr>}<++>" " make the IMAPs function! s:IMAPs (ft) call IMAP ('if(', g:C_idiom_if, a:ft) call IMAP ('if()', g:C_idiom_if, a:ft) " etc. endfunction " make the IMAPs for both C and C++ filetypes if !exists ('s:sourced_imaps') let s:sourced_imaps=1 call s:IMAPs ('c') call s:IMAPs ('cpp') endif ------------------------------------------------------------------------------ Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk _______________________________________________ Vim-latex-devel mailing list Vim-latex-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vim-latex-devel