glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.
GNU General Public License v3.0
4.65k stars 143 forks source link

Use CMD key as CTRL key in Neovim #1545

Closed martin-braun closed 1 year ago

martin-braun commented 1 year ago

On MacOS, I use karabiner to map my outer-most fn key to cmd, so I can use bindings like I am on Windows. On Terminal windows I then swap fn with ctrl to have the ctrl key on the outer most position.

I need the same setup for embedded Neovim in the browser. I use the Arc Browser. I thought about adding the fn-ctrl swap rule to Arc, but then I have to copy and paste everything using the physical ctrl key, which is less ideal.

It would be nice if I could remap keys only for the Neovim iframe. Mapping the cmd-key in macOS within Neovim doesn't work either.

justinmk commented 1 year ago

if I could remap keys only for the Neovim iframe

if exists('g:started_by_firenvim')

Mapping the cmd-key in macOS within Neovim doesn't work either.

I just tried mapping cmd-a in firenvim on this page, it works:

nnoremap <d-a> ifoo<esc>
justinmk commented 1 year ago

It sounds like you want to remap cmd to ctrl for all mappings. That would mean another layer of remappings:

  1. your OS / window manager
  2. chrome
  3. firenvim
  4. nvim
martin-braun commented 1 year ago

 @justinmk thanks, it was a problem on my end, indeed it works. Good job.

It sounds like you want to remap cmd to ctrl for all mappings.  

Yes, but no. Too many conflicts at this point. Just the basic stuff to use Neovim conveniently. Thanks again!