- name changes :menukeyequiv ==> :macmenukey :action ==> :macaction - updated docs and $VIM/gvimrc to reflect the above change - added fontSizeUp/Down to Action list in docs - added "Enter/Leave Fullscreen" menu items to Window menu - 'transparency' range changed to 0-100

git-svn-id: http://macvim.googlecode.com/svn/trunk@306 96c4425d-ca35-0410-94e5-3396d5c13a8f
This commit is contained in:
Bjorn Winckler
2007-10-11 16:53:02 +00:00
parent b6d330d46d
commit f57179ff00
4 changed files with 76 additions and 67 deletions
+4 -2
View File
@@ -13,10 +13,12 @@
// NOTE: Colors in MMBackend are stored as unsigned ints on the form 0xaarrggbb
// whereas colors in Vim are int without the alpha component.
// whereas colors in Vim are int without the alpha component. Also note that
// 'transp' is assumed to be a value between 0 and 100.
#define MM_COLOR(col) ((unsigned)( ((col)&0xffffff) | 0xff000000 ))
#define MM_COLOR_WITH_TRANSP(col,transp) \
((unsigned)( ((col)&0xffffff) | (((unsigned)(255-(transp))&0xff)<<24) ))
((unsigned)( ((col)&0xffffff) \
| ((((unsigned)((((100-(transp))*255)/100)+.5f))&0xff)<<24) ))
// This constant controls how often the command queue may be flushed. If it is
+3 -3
View File
@@ -651,8 +651,8 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
name:(char*)name
tip:(char*)tip
icon:(char*)icon
keyEquivalent:menu->ke_key
modifiers:menu->ke_mods
keyEquivalent:menu->mac_key
modifiers:menu->mac_mods
action:action
atIndex:idx];
@@ -1024,7 +1024,7 @@ mch_set_mouse_shape(int shape)
void
ex_action(eap)
ex_macaction(eap)
exarg_T *eap;
{
if (!gui.in_use) {
+48 -43
View File
@@ -36,7 +36,7 @@ aunmenu File.-SEP4-
aunmenu File.Exit
aunmenu File.Save-Exit
an <silent> 10.290 File.New\ Window :action newWindow:<CR>
an <silent> 10.290 File.New\ Window :maca newWindow:<CR>
an 10.295 File.New\ Tab :tabnew<CR>
an 10.328 File.-SEP0- <Nop>
an <silent> 10.330 File.Close\ Window<Tab>:qa :confirm qa<CR>
@@ -44,24 +44,27 @@ an 10.331 File.Close<Tab>:q :confirm q<CR>
"an 10.331 File.Close\ Tab :tabclose<CR>
an 20.460 Edit.-SEP4- <Nop>
an 20.465.10 Edit.Font.Show\ Fonts :action orderFrontFontPanel:<CR>
an 20.465.10 Edit.Font.Show\ Fonts :maca orderFrontFontPanel:<CR>
an 20.465.20 Edit.Font.-SEP5- <Nop>
an 20.465.30 Edit.Font.Bigger :action fontSizeUp:<CR>
an 20.465.40 Edit.Font.Smaller :action fontSizeDown:<CR>
an 20.470 Edit.Special\ Characters\.\.\. :action orderFrontCharacterPalette:<CR>
an 20.465.30 Edit.Font.Bigger :maca fontSizeUp:<CR>
an 20.465.40 Edit.Font.Smaller :maca fontSizeDown:<CR>
an 20.470 Edit.Special\ Characters\.\.\. :maca orderFrontCharacterPalette:<CR>
" Window menu (should be next to Help so give it a high priority)
aunmenu Window
an <silent> 9900.300 Window.Minimize :action performMiniaturize:<CR>
an <silent> 9900.310 Window.Zoom :action performZoom:<CR>
an 9900.320 Window.-SEP1- <Nop>
an <silent> 9900.300 Window.Minimize :maca performMiniaturize:<CR>
an <silent> 9900.310 Window.Zoom :maca performZoom:<CR>
an 9900.320 Window.-SEP1- <Nop>
" TODO! Grey out if no tabs are visible.
an <silent> 9900.330 Window.Previous\ Tab :tabprevious<CR>
an <silent> 9900.340 Window.Next\ Tab :tabnext<CR>
an 9900.350 Window.-SEP2- <Nop>
an <silent> 9900.360 Window.Bring\ All\ To\ Front :action arrangeInFront:<CR>
an <silent> 9900.330 Window.Previous\ Tab :tabprevious<CR>
an <silent> 9900.340 Window.Next\ Tab :tabnext<CR>
an 9900.350 Window.-SEP2- <Nop>
an 9900.360 Window.Enter\ Fullscreen :set fu<CR>
an 9900.370 Window.Leave\ Fullscreen :set nofu<CR>
an 9900.380 Window.-SEP3- <Nop>
an <silent> 9900.390 Window.Bring\ All\ To\ Front :maca arrangeInFront:<CR>
@@ -163,41 +166,43 @@ endif " exists("macvim_hig_shift_movement")
" Menu key equivalents (these should always have the 'D' modifier set)
"
menukeyequiv File.New\ Window <D-n>
menukeyequiv File.New\ Tab <D-t>
macmenukey File.New\ Window <D-n>
macmenukey File.New\ Tab <D-t>
menukeyequiv File.Open\.\.\. <D-o>
menukeyequiv File.Open\ Tab\.\.\. <D-T>
menukeyequiv File.Close\ Window <D-W>
"menukeyequiv File.Close\ Tab <D-w>
menukeyequiv File.Close <D-w>
menukeyequiv File.Save <D-s>
menukeyequiv File.Save\ As\.\.\. <D-S>
menukeyequiv File.Print <D-p>
macmenukey File.Open\.\.\. <D-o>
macmenukey File.Open\ Tab\.\.\. <D-T>
macmenukey File.Close\ Window <D-W>
"macmenukey File.Close\ Tab <D-w>
macmenukey File.Close <D-w>
macmenukey File.Save <D-s>
macmenukey File.Save\ As\.\.\. <D-S>
macmenukey File.Print <D-p>
menukeyequiv Edit.Undo <D-z>
menukeyequiv Edit.Redo <D-Z>
menukeyequiv Edit.Cut <D-x>
menukeyequiv Edit.Copy <D-c>
menukeyequiv Edit.Paste <D-v>
menukeyequiv Edit.Select\ All <D-a>
menukeyequiv Edit.Special\ Characters\.\.\. <D-M-t>
menukeyequiv Edit.Font.Bigger <D-=>
menukeyequiv Edit.Font.Smaller <D-->
macmenukey Edit.Undo <D-z>
macmenukey Edit.Redo <D-Z>
macmenukey Edit.Cut <D-x>
macmenukey Edit.Copy <D-c>
macmenukey Edit.Paste <D-v>
macmenukey Edit.Select\ All <D-a>
macmenukey Edit.Special\ Characters\.\.\. <D-M-t>
macmenukey Edit.Font.Bigger <D-=>
macmenukey Edit.Font.Smaller <D-->
menukeyequiv Tools.Spelling.To\ Next\ error <D-;>
menukeyequiv Tools.Spelling.Suggest\ Corrections <D-:>
menukeyequiv Tools.Make <D-b>
menukeyequiv Tools.List\ Errors <D-l>
menukeyequiv Tools.List\ Messages <D-L>
menukeyequiv Tools.Next\ Error <D-C-Right>
menukeyequiv Tools.Previous\ Error <D-C-Left>
menukeyequiv Tools.Older\ List <D-C-Up>
menukeyequiv Tools.Newer\ List <D-C-Down>
macmenukey Tools.Spelling.To\ Next\ error <D-;>
macmenukey Tools.Spelling.Suggest\ Corrections <D-:>
macmenukey Tools.Make <D-b>
macmenukey Tools.List\ Errors <D-l>
macmenukey Tools.List\ Messages <D-L>
macmenukey Tools.Next\ Error <D-C-Right>
macmenukey Tools.Previous\ Error <D-C-Left>
macmenukey Tools.Older\ List <D-C-Up>
macmenukey Tools.Newer\ List <D-C-Down>
menukeyequiv Window.Minimize <D-m>
menukeyequiv Window.Previous\ Tab <D-{>
menukeyequiv Window.Next\ Tab <D-}>
macmenukey Window.Minimize <D-m>
macmenukey Window.Previous\ Tab <D-{>
macmenukey Window.Next\ Tab <D-}>
macmenukey Window.Enter\ Fullscreen <D-Enter>
macmenukey Window.Leave\ Fullscreen <D-S-Enter>
" Restore the previous value of 'cpoptions'.
+21 -19
View File
@@ -208,14 +208,14 @@ than the default?) then post them to vim_mac.
==============================================================================
4. Menus *macvim-menus*
*:menukeyequiv*
*:macm* *:macmenukey*
MacVim has a special way of binding keys to menu items that differs from other
Vim GUI ports. A menu binding is called a "key equivalent" in Mac OS X
terminology, this is displayed on the right side of a menu item. The
":menukeyequiv" command is used to set the key equivalent of a menu item.
This command takes two parameters, the first names the menu item to bind to,
the second gives the key combination. For example: >
:menukeyequiv File.New\ Tab <D-t>
":macmenukey" command is used to set the key equivalent of a menu item. This
command takes two parameters, the first names the menu item to bind to, the
second gives the key combination. For example: >
:macmenukey File.New\ Tab <D-t>
This sets the key equivalent of the "New Tab" menu item under the "File" menu
to Cmd+t.
@@ -224,31 +224,31 @@ Note that key equivalents:
* take precedence over normal mappings made with ":map"
* can only be modified during startup (e.g. in .gvimrc)
It is possible to reset a key equivalent by calling :menukeyequiv with a menu
It is possible to reset a key equivalent by calling :macmenukey with a menu
name but no key. This is so that the default key equivalents can be reset in
"~/.gvimrc". For example, if you would like to free up <D-s> (which is the
key equivalent of "File.Save") then add the following line to "~/.gvimrc": >
menukeyequiv File.Save
macmenukey File.Save
Now you can use :map to bind <D-s> to whatever you like.
It is not necessary to reset a key equivalent if all you want to do is to
change the key equivalent of a menu item. For example, say you want to use
<D-M-Right> as the key equivalent for "Next Tab", then add the following line
to "~/.gvimrc": >
menukeyequiv Window.Next\ Tab <D-M-Right>
macmenukey Window.Next\ Tab <D-M-Right>
<
*:action*
*:maca* *:macaction*
It is typical for menu items in Cocoa applications to bind to Objective-C
selectors. To support this, MacVim introduces the ":action" command. This
selectors. To support this, MacVim introduces the ":macaction" command. This
command takes the name of an action message as its only parameter. (An action
message is an Objective-C message with "void" return type and a single
parameter of type "id".) For example, the "New Window" menu item on the
"File" menu is created in the following manner: >
:an 10.290 File.New\ Window :action newWindow:<CR>
:an 10.290 File.New\ Window :macaction newWindow:<CR>
Note 1: A menu item which is bound to ":action" will automatically be bound to
that action in all modes (as if ":an" was used). It is not possible to bind
to ":action" in one mode only.
Note 1: A menu item which is bound to ":macaction" will automatically be bound
to that action in all modes (as if ":an" was used). It is not possible to
bind to ":macaction" in one mode only.
Note 2: The action is "nil-targeted", which means it is passed down the first
responder chain.
@@ -263,6 +263,8 @@ Here is a random assortment of actions from Actions.plist which might be
useful.
Action Description ~
fontSizeDown: Decrease font size
fontSizeUp: Increase font size
newWindow: Open a new (empty) window
orderFrontCharacterPalette: Show the the "Special Characters" dialog
orderFrontFontPanel: Show the Font panel
@@ -271,11 +273,11 @@ selectNextWindow: Select next window (similar to <D-`>)
selectPreviousWindow: Select previous window (similar to <S-D-`>)
As an example, to map <C-z> to performZoom: you could do something like this: >
:map <silent> <C-z> :action performZoom:<CR>
:map <silent> <C-z> :macaction performZoom:<CR>
A better way to map to performZoom: would be to set the key equivalent of the
menu item "Window.Zoom" to the above action. This can be done by adding the
following line to "~/.gvimrc": >
menukeyequiv Window.Zoom <D-C-z>
macmenukey Window.Zoom <D-C-z>
(Note that key equivalents must contain the 'D' flag.)
==============================================================================
@@ -365,8 +367,8 @@ To get around this, set 'tabpagemax' to something big in your
.gvimrc file (e.g. ":set tabpagemax=100").
Scenario: ~
You want to open a file in a tab in an already opened window, but
typing "gvim filename" in Terminal opens it up in a separate window.
You want to open a file in a tab in an already opened window, but typing
"mvim filename" in Terminal opens it up in a separate window.
Solution: ~
Use the |--remote-tab| switch. If you have several windows open you
might have to specify which window you want the file to open in by using the
@@ -374,7 +376,7 @@ might have to specify which window you want the file to open in by using the
"VIM" or "VIM3" --- this is the server name of that window. So to open a file
named "foobar.txt" in a window whose title ends in "VIM3" you would type (the
order of the arguments matters): >
gvim --servername VIM3 --remote-tab foobar.txt
mvim --servername VIM3 --remote-tab foobar.txt
For more information, consult the |client-server| manual page.
Scenario: ~