Wikia

Vim Tips Wiki

Changes: Current buffer based menus

Edit

Back to page

(Change to TipImported template + severe manual clean)
(Move categories to tip template)
 
Line 9: Line 9:
 
|version=6.0
 
|version=6.0
 
|rating=2/2
 
|rating=2/2
  +
|category1=
  +
|category2=
 
}}
 
}}
 
If you have different menus for different filetypes, and you want to have only the menu relevant to current buffer displayed, you can use this approach:
 
If you have different menus for different filetypes, and you want to have only the menu relevant to current buffer displayed, you can use this approach:

Latest revision as of 00:48, April 25, 2008

Tip 214 Printable Monobook Previous Next

created February 14, 2002 · complexity intermediate · author Tomas Zellerin · version 6.0


If you have different menus for different filetypes, and you want to have only the menu relevant to current buffer displayed, you can use this approach:

In your vimrc:

au BufEnter * if exists('b:BuffEnter')|exec b:BuffEnter|endif
au BufLeave * if exists('b:BuffEnter')|exec b:BuffLeave|endif

In appropriate ftplugin/?.vim, there are assigned commands to create or destroy the menus - here typed in directly, may be of course call to a menu-generating function or whatever.

let b:BuffEnter='amenu C.added ...'
let b:BuffLeave='unmenu! C|unmenu C'

CommentsEdit

Around Wikia's network

Random Wiki