Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd -> ctrl option in OS X #58

Open
trusktr opened this issue Apr 22, 2016 · 7 comments
Open

cmd -> ctrl option in OS X #58

trusktr opened this issue Apr 22, 2016 · 7 comments

Comments

@trusktr
Copy link
Contributor

trusktr commented Apr 22, 2016

Would be super nice if you could make command send ctrl key in OS X so it's easy to use command key as ctrl key (similar to the popular iTerm2 app for OS X).

@expipiplus1
Copy link

Neovim supports the GUI passing the command key already: neovim/neovim@99d4c8c

@trusktr
Copy link
Contributor Author

trusktr commented Apr 22, 2016

@expipiplus1 So, do I have to map everything? As in

map <d-a> <c-a>
map <d-b> <c-b>
map <d-c> <c-c>
map <d-d> <c-d>
map <d-e> <c-e>
" ...

I'd like just a global option that makes command behave as control (like iTerm), so that those mappings aren't even required. So, for example, I would like to only have to do

noremap <c-s> :w<cr>

instead of

map <d-s> <c-s>
noremap <c-s> :w<cr>

then pressing command+s would trigger <c-s>, not <d-s>.

The thing is, my caps lock key in OS X sends command. In iTerm, it converts all command to control, so I can press capslock+c and the terminal sees it as control+c. The idea here would be similar to that. Making a mapping for every single key is possible (and I'll do that if it's my only option), but a global setting would be nicer. This would need to be done on the app level (electron) probably.

@trusktr
Copy link
Contributor Author

trusktr commented Apr 22, 2016

Well, it works!

            map <d-a> <c-a>
            map <d-b> <c-b>
            map <d-c> <c-c>
            map <d-d> <c-d>
            map <d-e> <c-e>
            map <d-f> <c-f>
            map <d-g> <c-g>
            map <d-h> <c-h>
            map <d-i> <c-i>
            map <d-j> <c-j>
            map <d-k> <c-k>
            map <d-l> <c-l>
            map <d-m> <c-m>
            map <d-n> <c-n>
            map <d-o> <c-o>
            map <d-p> <c-p>
            map <d-q> <c-q>
            map <d-r> <c-r>
            map <d-s> <c-s>
            map <d-t> <c-t>
            map <d-u> <c-u>
            map <d-v> <c-v>
            map <d-w> <c-w>
            map <d-x> <c-x>
            map <d-y> <c-y>
            map <d-z> <c-z>

            " rest of mappings as normal...

LOL 😆

@trusktr
Copy link
Contributor Author

trusktr commented Apr 22, 2016

Wait, nevermind, it only works in terminal neovim (iTerm). Electron still intercepts things like command+c and invokes the edit->copy menu item, etc, etc.

If I try command+w (or capslock+w in my case) to do a window command, the electron closes the window! So, those mappings aren't the solution. It would have to be an electron setting to send command as control.

@trusktr
Copy link
Contributor Author

trusktr commented Apr 22, 2016

Hmmm, and I tried one that isn't intercepted by electron, but that doesn't even work:

map <d-s> <c-s>
noremap <c-s> :echo "hello"<cr>

but pressing command+s doesn't do anything.

@expipiplus1
Copy link

expipiplus1 commented Apr 22, 2016

neovim-e will have to implement this functionality, it looks as though iterm does it already.

Apologies for not being more clear in my earlier message, I was in a bit of a hurry.

@trusktr
Copy link
Contributor Author

trusktr commented Apr 23, 2016

@expipiplus1 It's all good! Asked at electron/electron: electron/electron#5261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants