Quantcast

MacVim, remapping Alt-key as Ctrl-key

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MacVim, remapping Alt-key as Ctrl-key

bobby wankenoby
I am a MacVim user, and I would like to know if it's possible to make the Alt-Option key behave as a Ctrl key.

Thanks for your time gentlemen.

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MacVim, remapping Alt-key as Ctrl-key

Chris Schneider
OS Settings can do it for sure - go to System Preferences => Keyboard => Modifier Keys and change to your liking.


On Wed, Mar 6, 2013 at 8:19 AM, bobby wankenoby <[hidden email]> wrote:
I am a MacVim user, and I would like to know if it's possible to make the Alt-Option key behave as a Ctrl key.

Thanks for your time gentlemen.

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.



--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
 
---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MacVim, remapping Alt-key as Ctrl-key

bobby wankenoby
But I don't want to change the behaviour of my Option keys for my whole OS, I know how to do that, and how to do it in iTerm2 too.

What I need is to change it in MacVim, just it.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MacVim, remapping Alt-key as Ctrl-key

Chris Schneider
I dont have any idea if you can do it at the vim level, but it looks like this tool can do key remapping per application. See that the example has excel-only mappings. Maybe play with this a bit?

http://pqrs.org/macosx/keyremap4macbook/document-private-xml.html.en

- Chris Schneider

On Mar 6, 2013, at 2:42 PM, bobby wankenoby <[hidden email]> wrote:

But I don't want to change the behaviour of my Option keys for my whole OS, I
know how to do that, and how to do it in iTerm2 too.

What I need is to change it in MacVim, just it.






--
View this message in context: http://vim.1045645.n5.nabble.com/MacVim-remapping-Alt-key-as-Ctrl-key-tp5714335p5714341.html
Sent from the Vim - Mac mailing list archive at Nabble.com.

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
 
---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MacVim, remapping Alt-key as Ctrl-key

Aaron Cruz
In reply to this post by bobby wankenoby
On Wednesday, March 6, 2013 4:19:59 PM UTC+1, bobby wankenoby wrote:
> I am a MacVim user, and I would like to know if it's possible to make the Alt-Option key behave as a Ctrl key.
>
> Thanks for your time gentlemen.

Here is an excerpt from my .vimrc that may get you started. Sorry not more specific, buit I don't have time for experimenting.
Plus, this snippet is useful as well :)

The key mappings are
M = Cmd
D = Option
C = Ctrl

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Move a line of text using ALT+[jk] or Comamnd+[jk] on mac
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z

if has("mac") || has("macunix")
  nmap <D-j> <M-j>
  nmap <D-k> <M-k>
  vmap <D-j> <M-j>
  vmap <D-k> <M-k>
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MacVim, remapping Alt-key as Ctrl-key

bobby wankenoby
In reply to this post by Chris Schneider
Yes, I couldn't find a way of doing it in MacVim, but you are right Chris, KeyRemap4Macbook did the trick. It is a FANTASTIC piece of software, the documentation is just excellent, I recommend it to everybody in difficult mapping situations.
It allows you to customize mappings for each app, in an xml file that you can open from inside the app. It's absolutely poka-yoke.
This is what I wrote in private.xml, for my situation:

<appdef>
    <appname>MacVim</appname>
    <equal>org.vim.MacVim</equal>
</appdef>


<item>
    <name>Change Right Option key to Control</name>
    <identifier>private.remap_rightOption_to_control</identifier>
        <only>MacVim</only>
    <autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::CONTROL_R</autogen>
  </item>

Problem solved!
Loading...