Ответ на сообщение «Re: [Vim-latex-devel] Bug with mapleader = " "», 
присланное в 01:00:23 08 октября 2010, Пятница.
Отправитель: Mika Fischer:

> Also maybe an option not to set those mappings and let users set their
> own mappings would be useful.
It is the most useful option: I have to place
    function IMAP(...)
    endfunction
to my ftplugin/tex.vim in order not to have those very annoying insert mode 
mappings. Attached patch adds an option `g:latex_suite_omit_imap' that forbids 
using all IMAPs.

Текст сообщения:
> On Thu, Oct 7, 2010 at 22:17, ZyX <z...@np.by> wrote:
> > What problems do you have? If I do ``let g:mapleader="<Space>"'' before
> > loading tex file, everything works as expected. Maybe you tried to set
> > g:mapleader to literal space?
> 
> Yes, I did. I was under the impression that "<space>" would not work.
> I found some links to that effect:
> http://stackoverflow.com/questions/446269/can-i-use-space-as-mapleader-in-v
> im http://www.reddit.com/r/vim/comments/dh4u5/let_mapleader_space/
> 
> I have never tried it though. Maybe it's also an issue with missing
> quotes...
> 
> In any case the way vim-latex set the mappings was broken. I just
> changed it so that the behavior stays the same except for my problem.
> 
> > I think that ``g:mapleader'' should be replaced but not with
> > ``<Leader>'' but with ``g:latex_suite_mapleader'' or something like that.
> 
> I did not want to change this. But I agree it would make a lot of
> sense. Maybe this variable could then default to <Leader> to keep the
> current behavior?
> Also maybe an option not to set those mappings and let users set their
> own mappings would be useful.
> 
> Best,
>  Mika
> 
> ---------------------------------------------------------------------------
> --- Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Vim-latex-devel mailing list
> Vim-latex-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/vim-latex-devel
# HG changeset patch
# User ZyX <kp-...@yandex.ru>
# Date 1286487012 -14400
# Node ID 0418d50d2086a435ec14734b5257b1aa69d9de43
# Parent  f0d33dda4a2c1b8dab1a507dd915096af9f95a79
Added g:latex_suite_omit_imap option

diff -r f0d33dda4a2c -r 0418d50d2086 ftplugin/latex-suite/bibtex.vim
--- a/ftplugin/latex-suite/bibtex.vim	Thu Oct 07 20:19:23 2010 +0000
+++ b/ftplugin/latex-suite/bibtex.vim	Fri Oct 08 01:30:12 2010 +0400
@@ -125,10 +125,12 @@
 endif
 let s:done = 1
 
-call IMAP ('BBB', "\<C-r>=BibT('', '', 0)\<CR>", 'bib')
-call IMAP ('BBL', "\<C-r>=BibT('', 'o', 0)\<CR>", 'bib')
-call IMAP ('BBH', "\<C-r>=BibT('', 'O', 0)\<CR>", 'bib')
-call IMAP ('BBX', "\<C-r>=BibT('', 'Ox', 0)\<CR>", 'bib')
+if !exists('g:latex_suite_omit_imap')
+	call IMAP ('BBB', "\<C-r>=BibT('', '', 0)\<CR>", 'bib')
+	call IMAP ('BBL', "\<C-r>=BibT('', 'o', 0)\<CR>", 'bib')
+	call IMAP ('BBH', "\<C-r>=BibT('', 'O', 0)\<CR>", 'bib')
+	call IMAP ('BBX', "\<C-r>=BibT('', 'Ox', 0)\<CR>", 'bib')
+endif
 
 " BibT: function to generate a formatted bibtex entry {{{
 " three sample usages:
diff -r f0d33dda4a2c -r 0418d50d2086 ftplugin/latex-suite/diacritics.vim
--- a/ftplugin/latex-suite/diacritics.vim	Thu Oct 07 20:19:23 2010 +0000
+++ b/ftplugin/latex-suite/diacritics.vim	Fri Oct 08 01:30:12 2010 +0400
@@ -10,115 +10,117 @@
 	finish
 endif
 
-" \'{a} {{{
-call IMAP ('=a', "\\\'{a}", 'tex')
-call IMAP ('=b', "\\'{b}", 'tex')
-call IMAP ('=c', "\\'{c}", 'tex')
-call IMAP ('=d', "\\'{d}", 'tex')
-call IMAP ('=e', "\\'{e}", 'tex')
-call IMAP ('=f', "\\'{f}", 'tex')
-call IMAP ('=g', "\\'{g}", 'tex')
-call IMAP ('=h', "\\'{h}", 'tex')
-call IMAP ('=i', "\\'{\i}", 'tex')
-call IMAP ('=j', "\\'{j}", 'tex')
-call IMAP ('=k', "\\'{k}", 'tex')
-call IMAP ('=l', "\\'{l}", 'tex')
-call IMAP ('=m', "\\'{m}", 'tex')
-call IMAP ('=n', "\\'{n}", 'tex')
-call IMAP ('=o', "\\'{o}", 'tex')
-call IMAP ('=p', "\\'{p}", 'tex')
-call IMAP ('=q', "\\'{q}", 'tex')
-call IMAP ('=r', "\\'{r}", 'tex')
-call IMAP ('=s', "\\'{s}", 'tex')
-call IMAP ('=t', "\\'{t}", 'tex')
-call IMAP ('=u', "\\'{u}", 'tex')
-call IMAP ('=v', "\\'{v}", 'tex')
-call IMAP ('=w', "\\'{w}", 'tex')
-call IMAP ('=x', "\\'{x}", 'tex')
-call IMAP ('=y', "\\'{y}", 'tex')
-call IMAP ('=z', "\\'{z}", 'tex')
-call IMAP ('=A', "\\'{A}", 'tex')
-call IMAP ('=B', "\\'{B}", 'tex')
-call IMAP ('=C', "\\'{C}", 'tex')
-call IMAP ('=D', "\\'{D}", 'tex')
-call IMAP ('=E', "\\'{E}", 'tex')
-call IMAP ('=F', "\\'{F}", 'tex')
-call IMAP ('=G', "\\'{G}", 'tex')
-call IMAP ('=H', "\\'{H}", 'tex')
-call IMAP ('=I', "\\'{\I}", 'tex')
-call IMAP ('=J', "\\'{J}", 'tex')
-call IMAP ('=K', "\\'{K}", 'tex')
-call IMAP ('=L', "\\'{L}", 'tex')
-call IMAP ('=M', "\\'{M}", 'tex')
-call IMAP ('=N', "\\'{N}", 'tex')
-call IMAP ('=O', "\\'{O}", 'tex')
-call IMAP ('=P', "\\'{P}", 'tex')
-call IMAP ('=Q', "\\'{Q}", 'tex')
-call IMAP ('=R', "\\'{R}", 'tex')
-call IMAP ('=S', "\\'{S}", 'tex')
-call IMAP ('=T', "\\'{T}", 'tex')
-call IMAP ('=U', "\\'{U}", 'tex')
-call IMAP ('=V', "\\'{V}", 'tex')
-call IMAP ('=W', "\\'{W}", 'tex')
-call IMAP ('=X', "\\'{X}", 'tex')
-call IMAP ('=Y', "\\'{Y}", 'tex')
-call IMAP ('=Z', "\\'{Z}", 'tex')
-" }}}
-" \v{a} {{{
-call IMAP ('+a', "\\v{a}", 'tex')
-call IMAP ('+b', "\\v{b}", 'tex')
-call IMAP ('+c', "\\v{c}", 'tex')
-call IMAP ('+d', "\\v{d}", 'tex')
-call IMAP ('+e', "\\v{e}", 'tex')
-call IMAP ('+f', "\\v{f}", 'tex')
-call IMAP ('+g', "\\v{g}", 'tex')
-call IMAP ('+h', "\\v{h}", 'tex')
-call IMAP ('+i', "\\v{\i}", 'tex')
-call IMAP ('+j', "\\v{j}", 'tex')
-call IMAP ('+k', "\\v{k}", 'tex')
-call IMAP ('+l', "\\q l", 'tex')
-call IMAP ('+m', "\\v{m}", 'tex')
-call IMAP ('+n', "\\v{n}", 'tex')
-call IMAP ('+o', "\\v{o}", 'tex')
-call IMAP ('+p', "\\v{p}", 'tex')
-call IMAP ('+q', "\\v{q}", 'tex')
-call IMAP ('+r', "\\v{r}", 'tex')
-call IMAP ('+s', "\\v{s}", 'tex')
-call IMAP ('+t', "\\q t", 'tex')
-call IMAP ('+u', "\\v{u}", 'tex')
-call IMAP ('+v', "\\v{v}", 'tex')
-call IMAP ('+w', "\\v{w}", 'tex')
-call IMAP ('+x', "\\v{x}", 'tex')
-call IMAP ('+y', "\\v{y}", 'tex')
-call IMAP ('+z', "\\v{z}", 'tex')
-call IMAP ('+A', "\\v{A}", 'tex')
-call IMAP ('+B', "\\v{B}", 'tex')
-call IMAP ('+C', "\\v{C}", 'tex')
-call IMAP ('+D', "\\v{D}", 'tex')
-call IMAP ('+E', "\\v{E}", 'tex')
-call IMAP ('+F', "\\v{F}", 'tex')
-call IMAP ('+G', "\\v{G}", 'tex')
-call IMAP ('+H', "\\v{H}", 'tex')
-call IMAP ('+I', "\\v{\I}", 'tex')
-call IMAP ('+J', "\\v{J}", 'tex')
-call IMAP ('+K', "\\v{K}", 'tex')
-call IMAP ('+L', "\\v{L}", 'tex')
-call IMAP ('+M', "\\v{M}", 'tex')
-call IMAP ('+N', "\\v{N}", 'tex')
-call IMAP ('+O', "\\v{O}", 'tex')
-call IMAP ('+P', "\\v{P}", 'tex')
-call IMAP ('+Q', "\\v{Q}", 'tex')
-call IMAP ('+R', "\\v{R}", 'tex')
-call IMAP ('+S', "\\v{S}", 'tex')
-call IMAP ('+T', "\\v{T}", 'tex')
-call IMAP ('+U', "\\v{U}", 'tex')
-call IMAP ('+V', "\\v{V}", 'tex')
-call IMAP ('+W', "\\v{W}", 'tex')
-call IMAP ('+X', "\\v{X}", 'tex')
-call IMAP ('+Y', "\\v{Y}", 'tex')
-call IMAP ('+Z', "\\v{Z}", 'tex')
-" }}}
-call IMAP ('+}', "\\\"{a}", 'tex')
-call IMAP ('+:', "\\^{o}", 'tex')
+if !exists('g:latex_suite_omit_imap')
+	" \'{a} {{{
+	call IMAP ('=a', "\\\'{a}", 'tex')
+	call IMAP ('=b', "\\'{b}", 'tex')
+	call IMAP ('=c', "\\'{c}", 'tex')
+	call IMAP ('=d', "\\'{d}", 'tex')
+	call IMAP ('=e', "\\'{e}", 'tex')
+	call IMAP ('=f', "\\'{f}", 'tex')
+	call IMAP ('=g', "\\'{g}", 'tex')
+	call IMAP ('=h', "\\'{h}", 'tex')
+	call IMAP ('=i', "\\'{\i}", 'tex')
+	call IMAP ('=j', "\\'{j}", 'tex')
+	call IMAP ('=k', "\\'{k}", 'tex')
+	call IMAP ('=l', "\\'{l}", 'tex')
+	call IMAP ('=m', "\\'{m}", 'tex')
+	call IMAP ('=n', "\\'{n}", 'tex')
+	call IMAP ('=o', "\\'{o}", 'tex')
+	call IMAP ('=p', "\\'{p}", 'tex')
+	call IMAP ('=q', "\\'{q}", 'tex')
+	call IMAP ('=r', "\\'{r}", 'tex')
+	call IMAP ('=s', "\\'{s}", 'tex')
+	call IMAP ('=t', "\\'{t}", 'tex')
+	call IMAP ('=u', "\\'{u}", 'tex')
+	call IMAP ('=v', "\\'{v}", 'tex')
+	call IMAP ('=w', "\\'{w}", 'tex')
+	call IMAP ('=x', "\\'{x}", 'tex')
+	call IMAP ('=y', "\\'{y}", 'tex')
+	call IMAP ('=z', "\\'{z}", 'tex')
+	call IMAP ('=A', "\\'{A}", 'tex')
+	call IMAP ('=B', "\\'{B}", 'tex')
+	call IMAP ('=C', "\\'{C}", 'tex')
+	call IMAP ('=D', "\\'{D}", 'tex')
+	call IMAP ('=E', "\\'{E}", 'tex')
+	call IMAP ('=F', "\\'{F}", 'tex')
+	call IMAP ('=G', "\\'{G}", 'tex')
+	call IMAP ('=H', "\\'{H}", 'tex')
+	call IMAP ('=I', "\\'{\I}", 'tex')
+	call IMAP ('=J', "\\'{J}", 'tex')
+	call IMAP ('=K', "\\'{K}", 'tex')
+	call IMAP ('=L', "\\'{L}", 'tex')
+	call IMAP ('=M', "\\'{M}", 'tex')
+	call IMAP ('=N', "\\'{N}", 'tex')
+	call IMAP ('=O', "\\'{O}", 'tex')
+	call IMAP ('=P', "\\'{P}", 'tex')
+	call IMAP ('=Q', "\\'{Q}", 'tex')
+	call IMAP ('=R', "\\'{R}", 'tex')
+	call IMAP ('=S', "\\'{S}", 'tex')
+	call IMAP ('=T', "\\'{T}", 'tex')
+	call IMAP ('=U', "\\'{U}", 'tex')
+	call IMAP ('=V', "\\'{V}", 'tex')
+	call IMAP ('=W', "\\'{W}", 'tex')
+	call IMAP ('=X', "\\'{X}", 'tex')
+	call IMAP ('=Y', "\\'{Y}", 'tex')
+	call IMAP ('=Z', "\\'{Z}", 'tex')
+	" }}}
+	" \v{a} {{{
+	call IMAP ('+a', "\\v{a}", 'tex')
+	call IMAP ('+b', "\\v{b}", 'tex')
+	call IMAP ('+c', "\\v{c}", 'tex')
+	call IMAP ('+d', "\\v{d}", 'tex')
+	call IMAP ('+e', "\\v{e}", 'tex')
+	call IMAP ('+f', "\\v{f}", 'tex')
+	call IMAP ('+g', "\\v{g}", 'tex')
+	call IMAP ('+h', "\\v{h}", 'tex')
+	call IMAP ('+i', "\\v{\i}", 'tex')
+	call IMAP ('+j', "\\v{j}", 'tex')
+	call IMAP ('+k', "\\v{k}", 'tex')
+	call IMAP ('+l', "\\q l", 'tex')
+	call IMAP ('+m', "\\v{m}", 'tex')
+	call IMAP ('+n', "\\v{n}", 'tex')
+	call IMAP ('+o', "\\v{o}", 'tex')
+	call IMAP ('+p', "\\v{p}", 'tex')
+	call IMAP ('+q', "\\v{q}", 'tex')
+	call IMAP ('+r', "\\v{r}", 'tex')
+	call IMAP ('+s', "\\v{s}", 'tex')
+	call IMAP ('+t', "\\q t", 'tex')
+	call IMAP ('+u', "\\v{u}", 'tex')
+	call IMAP ('+v', "\\v{v}", 'tex')
+	call IMAP ('+w', "\\v{w}", 'tex')
+	call IMAP ('+x', "\\v{x}", 'tex')
+	call IMAP ('+y', "\\v{y}", 'tex')
+	call IMAP ('+z', "\\v{z}", 'tex')
+	call IMAP ('+A', "\\v{A}", 'tex')
+	call IMAP ('+B', "\\v{B}", 'tex')
+	call IMAP ('+C', "\\v{C}", 'tex')
+	call IMAP ('+D', "\\v{D}", 'tex')
+	call IMAP ('+E', "\\v{E}", 'tex')
+	call IMAP ('+F', "\\v{F}", 'tex')
+	call IMAP ('+G', "\\v{G}", 'tex')
+	call IMAP ('+H', "\\v{H}", 'tex')
+	call IMAP ('+I', "\\v{\I}", 'tex')
+	call IMAP ('+J', "\\v{J}", 'tex')
+	call IMAP ('+K', "\\v{K}", 'tex')
+	call IMAP ('+L', "\\v{L}", 'tex')
+	call IMAP ('+M', "\\v{M}", 'tex')
+	call IMAP ('+N', "\\v{N}", 'tex')
+	call IMAP ('+O', "\\v{O}", 'tex')
+	call IMAP ('+P', "\\v{P}", 'tex')
+	call IMAP ('+Q', "\\v{Q}", 'tex')
+	call IMAP ('+R', "\\v{R}", 'tex')
+	call IMAP ('+S', "\\v{S}", 'tex')
+	call IMAP ('+T', "\\v{T}", 'tex')
+	call IMAP ('+U', "\\v{U}", 'tex')
+	call IMAP ('+V', "\\v{V}", 'tex')
+	call IMAP ('+W', "\\v{W}", 'tex')
+	call IMAP ('+X', "\\v{X}", 'tex')
+	call IMAP ('+Y', "\\v{Y}", 'tex')
+	call IMAP ('+Z', "\\v{Z}", 'tex')
+	" }}}
+	call IMAP ('+}', "\\\"{a}", 'tex')
+	call IMAP ('+:', "\\^{o}", 'tex')
+endif
 
 " vim:fdm=marker:ff=unix:noet:ts=4:sw=4
diff -r f0d33dda4a2c -r 0418d50d2086 ftplugin/latex-suite/elementmacros.vim
--- a/ftplugin/latex-suite/elementmacros.vim	Thu Oct 07 20:19:23 2010 +0000
+++ b/ftplugin/latex-suite/elementmacros.vim	Fri Oct 08 01:30:12 2010 +0400
@@ -49,7 +49,9 @@
 		if !exists('s:doneOnce') && g:Tex_FontMaps
 			exe "vnoremap <silent> ".g:Tex_Leader.vislhs.
 				\" \<C-\\>\<C-N>:call VEnclose('\\text".vislhs."{', '}', '{\\".vislhs.a:fam." ', '}')<CR>"
-			exe 'call IMAP ("'.a:font.'", "\\text'.vislhs.'{<++>}<++>", "tex")'
+			if !exists("g:latex_suite_omit_imap")
+				exe 'call IMAP ("'.a:font.'", "\\text'.vislhs.'{<++>}<++>", "tex")'
+			endif
 		endif
 
 		" menu entry.
@@ -122,7 +124,7 @@
 
 " the \emph is special.
 if g:Tex_FontMaps | exe "vnoremap <silent> ".g:Tex_Leader."em \<C-\\>\<C-N>:call VEnclose('\\emph{', '}', '{\\em', '\\/}')<CR>" | endif
-if g:Tex_FontMaps | exe 'call IMAP ("FEM", "\\emph{<++>}<++>", "tex")' | endif
+if !exists('g:latex_suite_omit_imap') && g:Tex_FontMaps | exe 'call IMAP ("FEM", "\\emph{<++>}<++>", "tex")' | endif
 
 " }}}
 if g:Tex_Menus && g:Tex_FontMenus
diff -r f0d33dda4a2c -r 0418d50d2086 ftplugin/latex-suite/envmacros.vim
--- a/ftplugin/latex-suite/envmacros.vim	Thu Oct 07 20:19:23 2010 +0000
+++ b/ftplugin/latex-suite/envmacros.vim	Fri Oct 08 01:30:12 2010 +0400
@@ -71,7 +71,9 @@
 		let location = location.a:lhs.'\ ('.vlhs.')'
 
 		if g:Tex_EnvironmentMaps && !exists('s:doneOnce')
-			call IMAP(a:lhs, "\<C-r>=Tex_PutEnvironment('".a:name."')\<CR>", 'tex')
+			if !exists("g:latex_suite_omit_imap")
+				call IMAP(a:lhs, "\<C-r>=Tex_PutEnvironment('".a:name."')\<CR>", 'tex')
+			endif
 			exec 'vnoremap <silent> '.vlhs.' '.vrhs
 		endif
 
@@ -110,7 +112,9 @@
 		let location = location.'<tab>'.a:lhs.'\ ('.vlhs.')'
 
 		if g:Tex_EnvironmentMaps && !exists('s:doneOnce')
-			call IMAP(a:lhs, a:irhs, 'tex')
+			if !exists("g:latex_suite_omit_imap")
+				call IMAP(a:lhs, a:irhs, 'tex')
+			endif
 			exec 'vnoremap '.vlhs.' '.vrhs
 		endif
 
@@ -135,7 +139,9 @@
 
 	if g:Tex_SectionMaps && !exists('s:doneOnce')
 		exe 'vnoremap '.vlhs.' '.vrhs
-		call IMAP (a:lhs, "\\".a:name.'{<++>}<++>', 'tex')
+		if !exists("g:latex_suite_omit_imap")
+			call IMAP (a:lhs, "\\".a:name.'{<++>}<++>', 'tex')
+		endif
 	endif
 
 	if g:Tex_Menus && g:Tex_SectionMenus
diff -r f0d33dda4a2c -r 0418d50d2086 ftplugin/latex-suite/main.vim
--- a/ftplugin/latex-suite/main.vim	Thu Oct 07 20:19:23 2010 +0000
+++ b/ftplugin/latex-suite/main.vim	Fri Oct 08 01:30:12 2010 +0400
@@ -43,7 +43,7 @@
 " calculate the mapleader character.
 let s:ml = '<Leader>'
 
-if !exists('s:doneMappings')
+if !exists('s:doneMappings') && !exists("g:latex_suite_omit_imap")
 	let s:doneMappings = 1
 	" short forms for latex formatting and math elements. {{{
 	" taken from auctex.vim or miktexmacros.vim
@@ -150,7 +150,9 @@
 			let i = i + 1
 		endwhile
 	endfunction 
-	call s:ProtectLetters(32, 127)
+	if !exists("g:latex_suite_omit_imap")
+		call s:ProtectLetters(32, 127)
+	endif
 	" }}}
 	" vmaps: enclose selected region in brackets, environments {{{ 
 	" The action changes depending on whether the selection is character-wise
diff -r f0d33dda4a2c -r 0418d50d2086 ftplugin/latex-suite/packages/polski
--- a/ftplugin/latex-suite/packages/polski	Thu Oct 07 20:19:23 2010 +0000
+++ b/ftplugin/latex-suite/packages/polski	Fri Oct 08 01:30:12 2010 +0400
@@ -57,7 +57,9 @@
 function! TPackagePolskiTylda()
 	call IMAP (" ---", "~---", "tex")
 endfunction
-call TPackagePolskiTylda()
+if !exists("g:latex_suite_omit_imap")
+	call TPackagePolskiTylda()
+endif
 " --------8<-------------
 
 " Polskie znaki cudzyslowow 

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Vim-latex-devel mailing list
Vim-latex-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vim-latex-devel

Reply via email to