vim 7 on os x and keyboard shortcuts

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

vim 7 on os x and keyboard shortcuts

Alan Schmitt
Hi,

I've been using Vim 7 on OS X and I've noticed a difference with the  
binary version of 6.3 I used to use: the "command-something"  
shortcuts do not work anymore (such as "command-S" to save).

Another bigger problem I have is the following:
If I have "nopaste" set, then pasting is all wrong (as if I was using  
a terminal Vim). But if I have "paste" set, then I cannot use  
"command-V" to paste (this results in <D-v> being printed), so I need  
to use the menu (which is painful as it requires the mouse).

If you have a suggestion to recover the previous behavior, I'd be  
very happy.

Alan Schmitt

--
The hacker: someone who figured things out and made something cool  
happen.
.O.
..O
OOO



PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Chris Allen
On 11/10/05, Alan Schmitt <[hidden email]> wrote:
> Another bigger problem I have is the following:
> If I have "nopaste" set, then pasting is all wrong (as if I was using
> a terminal Vim). But if I have "paste" set, then I cannot use
> "command-V" to paste (this results in <D-v> being printed), so I need
> to use the menu (which is painful as it requires the mouse).

You can use "*p or "*P, instead, of course.  GVim on OS X will also
allow you to map the command key to some degree, and you can use a
mapping to "*p or "*P with the <d-v> you've noticed.

HTH,
Chris Allen
Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Alan Schmitt
On 11 oct. 05, at 12:04, Chris Allen wrote:

> You can use "*p or "*P, instead, of course.  GVim on OS X will also
> allow you to map the command key to some degree, and you can use a
> mapping to "*p or "*P with the <d-v> you've noticed.

Thanks, this is a really useful suggestion, I'll try it right now.

Alan

--  
The hacker: someone who figured things out and made something cool  
happen.
.O.
..O
OOO



PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

A.J.Mechelynck
In reply to this post by Alan Schmitt
Alan Schmitt wrote:

> Hi,
>
> I've been using Vim 7 on OS X and I've noticed a difference with the
> binary version of 6.3 I used to use: the "command-something" shortcuts
> do not work anymore (such as "command-S" to save).
>
> Another bigger problem I have is the following:
> If I have "nopaste" set, then pasting is all wrong (as if I was using a
> terminal Vim). But if I have "paste" set, then I cannot use "command-V"
> to paste (this results in <D-v> being printed), so I need to use the
> menu (which is painful as it requires the mouse).
>
> If you have a suggestion to recover the previous behavior, I'd be very
> happy.
>
> Alan Schmitt
>
> --The hacker: someone who figured things out and made something cool
> happen.
> .O.
> ..O
> OOO
>
>

Method I (which I don't like, but some people do): Try

        :runtime mswin.vim

and see if you get your mappings back.

Method II: Do it the Vim way:

"Save" is

        :w<Enter>

where <Enter> means "hit the Enter (or Return) key".
"Save as..." is

        :saveas foobar.txt<Enter>

where foobar.txt is the new file name.
"Save as..." (with forced overwriting) is

        :saveas! foobar.txt<Enter>

"Paste from clipboard" (after cursor) is

        "*p

"Paste from clipboard" (before cursor) is

        "*P

"Copy (yank) visually selected area to clipboard" is

        "*y

"Cut (delete) visually selected area to clipboard" is

        "*d

etc.

All these commands start from Normal mode, not Insert mode and not
Select mode. To execute them from Insert mode, either prefix them with
Ctrl-O, or switch to Normal mode with Esc (if you're not using the
so-called "Easy Vim") or with Ctrl-L (if you are). To go back to Insert
mode, use a (append after cursor), i (insert before cursor) or Esc (only
if using "Easy Vim"). To switch from Select mode (where typing a
printable key replaces the selection) to Visual mode (where it doesn't),
hit Ctrl-G.

The "* can be omitted if you just want to cut-and-paste internally to
Vim without going through the OS clipboard.


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Chris Allen
On 11/10/05, A. J. Mechelynck <[hidden email]> wrote:
> Method I (which I don't like, but some people do): Try
>
>         :runtime mswin.vim
>
> and see if you get your mappings back.

That won't get him what he wants at all, really.  Apples include a
special command key similar to the Meta key (but *distinct* from the
Alt key, in the Sun style).  There is no real reason that Vim should
respect traditional Apple command bindings except that they are
standard across every well behaved application, which means it can be
a real habit to hit them.  Better, then, if they do what you expect
rather than sticking <d-X> into your files for you ;)

HTH,
Chris Allen
Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

A.J.Mechelynck
Chris Allen wrote:

> On 11/10/05, A. J. Mechelynck <[hidden email]> wrote:
>> Method I (which I don't like, but some people do): Try
>>
>>         :runtime mswin.vim
>>
>> and see if you get your mappings back.
>
> That won't get him what he wants at all, really.  Apples include a
> special command key similar to the Meta key (but *distinct* from the
> Alt key, in the Sun style).  There is no real reason that Vim should
> respect traditional Apple command bindings except that they are
> standard across every well behaved application, which means it can be
> a real habit to hit them.  Better, then, if they do what you expect
> rather than sticking <d-X> into your files for you ;)
>
> HTH,
> Chris Allen


If the Apple Cmd key is not equivalent to the Windows Ctrl key, then use
Method II ("the Vim way"), which you snipped.

Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Lukas Muehlethaler
Dear Alan,

if you compiled your own binary, you can get the Mac keyboard shortcuts
for Vim 7.0aa in three simple steps.

1- Download the file gvimrc from

http://macvim.org/OSX/files/

2- In the Terminal:

    cd Desktop
    cp gvimrc  /Applications/Vim.app/

3- Restart Vim.app

That's it. The shortcuts appear in the menu.

If you use Vim 7.0aa binary for OS 10.3 (by by Da Woon Jung) from
macvim.org you can enable the shortcuts.

1- Open /Applications/Vim.app/gvimrc with your favorite text editor :o)

2- Comment out the word `finish' (I think it's on line 9)

3- Restart Vim.app

The binary for OS 10.4 seems to have Mac keyboard shortcuts "out of the
box".

Good luck!

Lukas

Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Bram Moolenaar

Lukas Muehlethaler wrote:

> if you compiled your own binary, you can get the Mac keyboard shortcuts
> for Vim 7.0aa in three simple steps.
>
> 1- Download the file gvimrc from
>
> http://macvim.org/OSX/files/
>
> 2- In the Terminal:
>
>     cd Desktop
>     cp gvimrc  /Applications/Vim.app/
>
> 3- Restart Vim.app
>
> That's it. The shortcuts appear in the menu.
>
> If you use Vim 7.0aa binary for OS 10.3 (by by Da Woon Jung) from
> macvim.org you can enable the shortcuts.
>
> 1- Open /Applications/Vim.app/gvimrc with your favorite text editor :o)
>
> 2- Comment out the word `finish' (I think it's on line 9)
>
> 3- Restart Vim.app
>
> The binary for OS 10.4 seems to have Mac keyboard shortcuts "out of the
> box".

What should we do for Vim 7?  Include the Mac keyboard shortcuts by
default or not?  I suppose having default mappings for keys that
otherwise don't do anything wouldn't hurt someone.

I don't like changing the menus, it breaks the translation.  Most people
will know the Command-key shortcuts anyway.

--
A)bort, R)etry, D)o it right this time

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Lukas Muehlethaler
I am sure that Benji Fisher, the author of the file "gvimrc" (below),
will be able to help you decide. Perhaps you can include the Mac
keyboard shortcuts by default and ask Benji to revise "gvimrc" so that
it displays only the keyboard shortcuts in the (English) menus? Whoever
will want to display the shortcuts could then download "gvimrc" from
macvim.org and adapt it to the language of her/his system (if
necessary).

Just an idea from a Vim-Newbie

On Oct 11, 2005, at 2:37 PM, Bram Moolenaar wrote:

>
> Lukas Muehlethaler wrote:
>
>> if you compiled your own binary, you can get the Mac keyboard
>> shortcuts
>> for Vim 7.0aa in three simple steps.
>>
>> 1- Download the file gvimrc from
>>
>> http://macvim.org/OSX/files/
>>
>> 2- In the Terminal:
>>
>>     cd Desktop
>>     cp gvimrc  /Applications/Vim.app/
>>
>> 3- Restart Vim.app
>>
>> That's it. The shortcuts appear in the menu.
>>
>> If you use Vim 7.0aa binary for OS 10.3 (by by Da Woon Jung) from
>> macvim.org you can enable the shortcuts.
>>
>> 1- Open /Applications/Vim.app/gvimrc with your favorite text editor
>> :o)
>>
>> 2- Comment out the word `finish' (I think it's on line 9)
>>
>> 3- Restart Vim.app
>>
>> The binary for OS 10.4 seems to have Mac keyboard shortcuts "out of
>> the
>> box".
>
> What should we do for Vim 7?  Include the Mac keyboard shortcuts by
> default or not?  I suppose having default mappings for keys that
> otherwise don't do anything wouldn't hurt someone.
>
> I don't like changing the menus, it breaks the translation.  Most
> people
> will know the Command-key shortcuts anyway.
>
> --
> A)bort, R)etry, D)o it right this time
>
>  /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net 
>  \\\
> ///        Sponsor Vim, vote for features --
> http://www.Vim.org/sponsor/ \\\
> \\\              Project leader for A-A-P -- http://www.A-A-P.org     
>   ///
>  \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html 
>  ///
>

Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

A.J.Mechelynck
Lukas Muehlethaler wrote:

> I am sure that Benji Fisher, the author of the file "gvimrc" (below),
> will be able to help you decide. Perhaps you can include the Mac
> keyboard shortcuts by default and ask Benji to revise "gvimrc" so that
> it displays only the keyboard shortcuts in the (English) menus? Whoever
> will want to display the shortcuts could then download "gvimrc" from
> macvim.org and adapt it to the language of her/his system (if necessary).
>
> Just an idea from a Vim-Newbie
>
> On Oct 11, 2005, at 2:37 PM, Bram Moolenaar wrote:
[...]

The menus are set by $VIMRUNTIME/menu.vim and their translations into
other languages are defined by vim.mo files in language-dependent
subdirectories somewhere. Creating different menu entries for Mac than
for other platforms would mean adding their translations to all the
language translation files (some 30 of them at the moment). That (IIUC)
is why Bram was reluctant to put the Mac shortcuts (instead of the Vim
shortcuts) into the right side of the menu texts.

Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Alan Schmitt
In reply to this post by Lukas Muehlethaler
On 11 oct. 05, at 19:13, Lukas Muehlethaler wrote:

> Dear Alan,
>
> if you compiled your own binary, you can get the Mac keyboard  
> shortcuts for Vim 7.0aa in three simple steps.
>
> 1- Download the file gvimrc from
>
> http://macvim.org/OSX/files/
>
> 2- In the Terminal:
>
>    cd Desktop
>    cp gvimrc  /Applications/Vim.app/
>
> 3- Restart Vim.app
>
> That's it. The shortcuts appear in the menu.
Thanks a lot. I grabbed it and put the shortcut that I want in my  
own .gvimrc. I did not modify the menus, though (as I never use them).

Alan

--
The hacker: someone who figured things out and made something cool  
happen.
.O.
..O
OOO



PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Alan Schmitt
In reply to this post by Bram Moolenaar
On 11 oct. 05, at 20:37, Bram Moolenaar wrote:

> What should we do for Vim 7?  Include the Mac keyboard shortcuts by
> default or not?  I suppose having default mappings for keys that
> otherwise don't do anything wouldn't hurt someone.

It would be great. The binary version I downloaded had them and even  
though I used Vim on Linux for a while, I've quickly got use to some  
of them.

Alan

--
The hacker: someone who figured things out and made something cool  
happen.
.O.
..O
OOO



PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

Gareth Oakes-2
In reply to this post by A.J.Mechelynck
Hi there,

> The menus are set by $VIMRUNTIME/menu.vim and their translations into
> other languages are defined by vim.mo files in language-dependent
> subdirectories somewhere. Creating different menu entries for Mac than
> for other platforms would mean adding their translations to all the
> language translation files (some 30 of them at the moment). That (IIUC)
> is why Bram was reluctant to put the Mac shortcuts (instead of the Vim
> shortcuts) into the right side of the menu texts.

So what you're suggesting we need is a language-independent method of
inserting text into the menu items? :)

-G
Reply | Threaded
Open this post in threaded view
|

Re: vim 7 on os x and keyboard shortcuts

A.J.Mechelynck
Gareth Oakes wrote:

> Hi there,
>
>> The menus are set by $VIMRUNTIME/menu.vim and their translations into
>> other languages are defined by vim.mo files in language-dependent
>> subdirectories somewhere. Creating different menu entries for Mac than
>> for other platforms would mean adding their translations to all the
>> language translation files (some 30 of them at the moment). That (IIUC)
>> is why Bram was reluctant to put the Mac shortcuts (instead of the Vim
>> shortcuts) into the right side of the menu texts.
>
> So what you're suggesting we need is a language-independent method of
> inserting text into the menu items? :)
>
> -G

No, I'm agreeing with Bram when he says that whoever _distributes_ Vim
should (if possible) avoid changing the menu texts or keybindings. The
_user_, who normally will use only one menu language, is not bound by
that limitation.


Best regards,
Tony.