开发者

Menu items messed up while using MacVim with Vim Latex

开发者 https://www.devze.com 2022-12-30 17:15 出处:网络
I just installed macvim yesterday and I have been trying to install vim latex today. The one thing I am confused about is the menu items on the top bar:

I just installed macvim yesterday and I have been trying to install vim latex today.

The one thing I am confused about is the menu items on the top bar:

-------------------------------------------------------------------------------
<apple icon> File Edit Tools Syntax TeX-Suite TeX-Environments TeX-Elements
-------------------------------------------------------------------------------
                                    | Packages >  |_____
                                    | Templates > | 1: |
                                    | Macros >    | 2: |
                                    |-----------  | 3: |
                                    | Compile     | 4: |
                                    | View        |-----
                                    | ...         |
                                     -------------

So in words if you go TeX-Suite -> Templates there is a sub menu with menu items: 1: 2: 3: 4:.

Now I know that these开发者_运维百科 templates live here:

% pwd
/Users/me/.vim/ftplugin/latex-suite/templates
% ls
IEEEtran.tex            article.tex             report.tex              report_two_column.tex

and they are named correctly.

Also I know that the :TTemplate vim command should do the same thing. When I type that I get this result:

Choose a template file:
(1) IEEEtran    (2) article
(3) report      (4) report_two_column

Enter number or name of file :  

So I am thinking that this must be a bug in MacVim. Is this a reasonable assumption? Any fixes?


The problem is that vim-latex puts the template name after the <Tab> when they set up the menus (see ":h menu"). This text is supposed to show a hint as to what command to use to access that particular menu item (e.g. File->Save has ":w" after <Tab>) and on most platforms it is displayed flush right on the menu items. However, on Mac OS X it is only possible to show keyboard shortcuts to the right in a menu item, so the text is instead displayed in a popup window if you let the mouse hover over the menu item for a while.

The only way to get around this problem is to edit the vim-latex menu files and delete the <Tab> from each menu command.


I just installed vim-latex on OS X. To get the templates menu items to show up I changed the line

exe "amenu ".g:Tex_TemplatesMenuLocation."&".i.":<Tab>".fname." ".

to

exe "amenu ".g:Tex_TemplatesMenuLocation."&".fname." ".

in the file ~/.vim/ftplugin/latex-suite/templates.vim. To get the items under TeX-Suite -> Macros to show up I changed the lines

exe "amenu ".g:Tex_MacrosMenuLocation."&Delete.&".i.":<tab>".fname." :call <SID>DeleteMacro('".fname."')<CR>"
exe "amenu ".g:Tex_MacrosMenuLocation."&Edit.&".i.":<tab>".fname."   :call <SID>EditMacro('".fname."')<CR>"
exe "imenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fname." <C-r>=<SID>ReadMacro('".fname."')<CR>"
exe "nmenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fname." i<C-r>=

to

<SID>ReadMacro('".fname."')<CR>"
        exe "amenu ".g:Tex_MacrosMenuLocation."&Delete.&".fname." :call <SID>DeleteMacro('".fname."')<CR>"
        exe "amenu ".g:Tex_MacrosMenuLocation."&Edit.&".fname."   :call <SID>EditMacro('".fname."')<CR>"
        exe "imenu ".g:Tex_MacrosMenuLocation."&".fname." <C-r>=<SID>ReadMacro('".fname."')<CR>"
        exe "nmenu ".g:Tex_MacrosMenuLocation."&".fname." i<C-r>=<SID>ReadMacro('".fname."')<CR>"

in ~/.vim/ftplugin/latex-suite/custommacros.vim.

0

精彩评论

暂无评论...
验证码 换一张
取 消