atom / vim-mode

Next generation vim support for atom
MIT License
1.72k stars 250 forks source link

Instead of emulating Vim... #436

Closed trusktr closed 9 years ago

trusktr commented 9 years ago

I'd recommend starting up a headless instance of neovim and letting Atom's text area be a view controlled by both neovim and Atom.

Send all keystrokes to neovim and let neovim decide what needs to happen to the text buffer from those keystrokes, then receive neovim's view update and update Atom's text area. When a combination is not recognized by or mapped in neovim, neovim can send that back and Atom can take over (for example, command+c can be sent back to Atom, and Atom can send neovim a y or yy depending on the mode, etc. Or, if the keystroke combo comes back to Atom and would do a normal Atom operation, then do the operation on the Atom's text area, then send the the update to neovim.

One of neovim's main goals is to make a clean separation of core and view, so that anyone can easily integrate part or all of neovim's text-manipulation functionality into their own GUIs. But even though that's not finished yet, it's still possible to subscribe to neovim's (vim's) old GUI mechanism just like Gvim, MacVim, and several Qt-based vim GUIs do.

I've tried each and every vim emulation out there and I cannot leave vim for any of them. Emulators cannot compete with the customizations of my vimrc.

It would be so much awesome if you guys decided to support neovim's movement. As you said, this vim emulation is "far from finished (Vim wasn't built in a day)", and from what I've observed of every other emulation attempt, it might remain far from finished. Adopting neovim will get you closer to the end result faster, ultimately.

I'm not familiar with how Atom's plugin system works. Is it flexible enough to allow neovim integration as an Atom plugin?

trusktr commented 9 years ago

P.S. Here's a Node.js interface for NeoVim, still in it's early stages. It shows what the future beholds...

EDIT: Ah! Apparently there's already a proof of concept of Atom+NeoVim. :)

tcoopman commented 9 years ago

This would be awesome, but I think this should be a different plugin?

maxbrunsfeld commented 9 years ago

Yeah, I agree that it's a great idea, but should probably be a different plugin. Atom's vim-mode interoperates with Atom's key-mapping and command systems, and can be customized through the same interface as the rest of Atom. @trusktr, it seems like you're talking about using Atom's UI as a front-end for Neovim. Also cool.

trusktr commented 9 years ago

@maxbrunsfeld It's possible to intercept keystrokes before sending them to neovim, and that way they can be mapped to Atom actions before being sent to neovim. Atom keybindings would take precedence, then anything that isn't bound can be sent to neovim. There could be an option to choose which of Atom or NeoVim handles keystrokes first. Eclim has such an option (the wrapper for embedding vim in Eclipse).

But yeah, NeoVim's text manipulation specialty plus Atom's amazing GUI would be a super nice combo.

zcbenz commented 9 years ago

@carlosdcastillo had made a package that demonstrated bridging Atom with Neovim: https://github.com/carlosdcastillo/vim-mode, it is still pre-alpha but looks promising.

There is also a similar discussion in Neovim: https://www.bountysource.com/issues/5826537-idea-atom-editor-as-a-front-end-for-neovim.

trusktr commented 9 years ago

Once I have some extra cash from my new job... :D

maxbrunsfeld commented 9 years ago

I'm going to close this; I think it could be interesting, but should definitely be a separate package.