-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
neovim integration? #18
Comments
As I understand, the neovim project is refactoring vim core itself. What would be involved with integrating VSCode with neovim? |
As far as I know, neovim offers the RPC protocol for communication. So a gui can communicate with the neovim core for example. Here are some example projects. Here is also a small overview on how this communication could look like. But I don't have a clue about anything beneath this theory. |
Whoa, that is actually really amazing! I'm curious as to its current state; of the example projects, none of them looked very complete. Nonetheless, looks super promising. |
I would seriously consider taking a look at this existing electron-integrated neovim implementation: https://github.com/coolwanglu/neovim-e It works really well. The challenge with integrating into VSCode is that neovim currently only exposes raw character/line draw command (this will be improved over time). VSCode's API likely will want something more rich than this. This is why that neovim-electron project uses canvas to paint everything. (For context, I'm a Vim emulator connoisseur, and file countless issues on various editor plugins that try to get the Vim feel right - in my experience, it takes a very very long time - and not a single one has achieved Vim's core editing experience. With much due respect to Vintageous (which does a very good job in general), even it doesn't replicate the undo/redo cursor position correctly (which is a critical part of the Vim editing experience) (but in that case because it's fundamentally limited by Sublime's API). |
How stable is Neovim on all three platforms? I'm against adopting Neovim wholesale at this point. My suggestion is that we continue with a port of Vim in TS without taking it too far. At the same time, we can explore certain functionality using Neovim (vimrc support, for example, if it provides that), and then converge on the choice that makes more sense: pure TS port or Neovim back-end. Also, we'll need some TS infrastructure anyway, primarily for keyboard handling, so we can implement a handful of commands in TS, see where we get and then adjust our approach wrt Neovim. |
I'm not sure, I've only tried it on Mac OS, but it's forked from Vim.
Yeah, don't someone like me stop you - seems like good stuff will come out of this! I'm just giving my perspective as a consumer of Vim emulators. A Vim emulator that only gets 98% right is almost worthless - no one ends up using them. It's the small subtleties that are the worst. Please consider it a great compliment to your fantastic work on Vintageous that I consider it "faithful enough to use". I just thought that there might be a faster path to getting there for |
FWIW, all reports I've heard say neovim is very stable, thanks in part to its dramatically expanded body of tests. A few reports are here. I do agree completely with @jordwalke's point of view here. I personally think it's only a matter of time before integrations like this replace emulations, in editors where it's practical to integrate. That said, I don't know of any great examples of integrations with existing editors yet. There might be some hidden challenges to doing this. |
Starting points for anyone who is interested in looking into this: Also you might want to read tarruda's blog post about his planned Smart UI protocol to get a sense of what's coming in the future. Some of the limitations he mentions in that post may already be removed (check the API), but I'm not certain. |
That "Smart UI Protocol" is exactly what I had in mind. In the mean time, I would even be happy with a canvas rendering of Vim inside of VSCode (which is almost trivial to accomplish thanks to neovim-e (electron example)). |
💯 This would be awesome, especially if i can still use all of VSCode's debugging features. This might even be the right thing to do given the current limited extension API. |
From my experience I can tell that neovim is very stable in mac OSX and in linux. And I would love to see it being integrated with vscode. |
Another happy |
FWIW, I've been using neovim-dot-app (https://github.com/rogual/neovim-dot-app) on OS X on production for a couple of months at least and it works really really well. Only minor issue I've seen so far is that the re-draws are a bit slow when scrolling too fast. |
This is still viable as an extension, but probably isn't going to be ours, given the amount of stuff we've already done... 😛 |
Wow, this got a lot of thumbs up. To the people that are thumbsing this up (and thumbsing down my previous comment): What particular, specific features of Neovim are you missing from VSCodeVim? (e.g. "plugins" is not very helpful, but "surround.vim" is.) |
@johnfn I didn't vote, but some Vim features are missing from all vim emulations: ex commands (there are hundreds of them), vim regex, jumplist, quickfix list, macros, marks (the non-obvious ones), vim's undo behavior, spellcheck (it's powerful and unique), vim completion (it's powerful and unique), viminfo (called "shared data" in Neovim). And lots of subtle details. |
@justinmk I know that there are lots of things missing from VSCodeVim, but I'm looking for the specific features that are missing that inspired you guys to upvote this thread, so we can target our efforts there. (There's no real point to work on, say, the quickfix list, if no one derives benefit from having it...) |
My support of true NeoVim integration has nothing to do with a particular feature but more so a general philosophy I've gained after trying and watching dozens of vim key bindings implementations miss very basic features. There are many nuanced pieces to vim's interaction language that it is inevitable that you will miss many of them and not even realize it. The amount of time required to integrate vim directly is a fraction of the time required to reimplement even the most basic vim interactions with high accuracy. I have only seen one plugin ever get the basics right and I've tried about twenty different attempted reimplementations thoroughly. It typically only takes two minutes of usage to spot a major defiiciency/bug even for projects that have been invested in for years. |
Unless you are going to invest massively in a VSCode vim emulator from scratch, or start with vim-mode-Plus and adapt it to VSCode, I do not have high hopes that the resulting experience will win over any true vim fans. I want to believe. I really do. I've just been burned too many times. I highly recommend embedding NeoVim or vim directly. |
@jordwalke Have you used VSCodeVIm? Could you please point out the areas in which it is deficient that bother you while using it? I mean, if you guys were like "I really desperately need 100% compatible viml evaluation because I use that every day" then that is complex enough that I would consider a NeoVim integration. But if you were just like "it's frustrating that the cursor ends up in the wrong place when I do [random command]," I mean, that's something we can work with. |
@johnfn For me personally, it's easier to say what I want from an IDE or higher-level editor, rather than enumerate the things I want from vim. To be clear, I want:
I don't care about VSCode's search/replace, find-in-files, code completion, text effects, or anything involving text-editing. |
@jordwalke I know that it seems like NeoVim is probably not as hard as implementing the remainder of those features. My current perspective a NeoVim port is the following:
To be clear, I'm not saying it's a bad idea, or that I won't do it. Just that it may be more work than it appears.
Like, if I went to that page and I saw that "Undo Tree History" was our most popular issue with 500 thumbs up, I would probably start considering a NeoVim port. 😉 But that hasn't proven to be the case. The scariest thing on that page by far is surround.vim, but even if that was a feature of Vim proper, I doubt it would take more than 2-3 days to implement. This is an extreme outlier. The rest of the missing features/bugs are almost certainly 30 minute to an hour jobs at worst. (Of course, I primarily designed VSCodeVim selfishly for my own use case, and it has 100% of the features that I care about. But that doesn't really help anyone but me, hehe...) As usual, I am open to changing my mind. I'd need to be convinced that a NeoVim port would be easier (1) than just implementing the missing features to round out the 90% case for the users of VSCodeVim (2). |
I love your optimism! I just tried the cursor position on undo/redo again, and it looks better than most other attempts, but still not "correct". See this example: Enter:
Visually select from the first
So that the final text is:
The hit escape, and undo/redo that change repeatedly. The cursor should remain on the first I only played with this for a couple minutes, so I could probably find a few more issues if you like. |
The other thing about all the challenges of integrating vim/neovim you mentioned - is that even if those things take time and don't start off perfect, it's okay. Vim users can switch if only a fraction of the VSCode vim integrations are supported because hey, it's exactly what they're used to and they get a handful of VSCode integrations. Some of the ones you mentioned aren't that hard, others are certainly more difficult, and others might not be that important afterall, when you can create a bridge between the VSCode config/feature and an existing Vim plugin. For example, imagine creating a conversion tool from VSCode snippets to Ultisnips (which is the standard in Vim snippets plugins) and doing that automatically. If I had such a configuration of Vim, I would even create a custom build of VSCode that strips out the standard editor so that my startup time could be super fast. |
To be clear, I do believe you could simply fix all of these issues (and make it more polished (the cursor selection appears visually to be a little flaky (but that's just styling))), but I only wanted to point out that I've seen this become an all-consuming task for developers. Some (like vmp) have been able to pull it off. |
I totally understand where you guys are coming from, and you've convinced me that, given unlimited time, I would definitely try my hand at a NeoVim port. Unfortunately, I barely have any time at all right now, so it seems like a more effective use of my resources to spend a few hours getting VSCodeVim from 94% to 97% than the same number of hours getting VSCodeNeoVim from 0% to ???%. I mean hey, if you guys wanna throw money at me to pursue NeoVim, I won't say no :P As it is though, I'm just trying to pursue the thing that benefits the most people with the limited amount of time that I can spend on this plugin. |
No problem. My only goal was to answer your question. |
Totally understandable and thanks for your work so far. You might also consider taking a look at |
First of all, I use VSCodeVim every day and have great respect for @johnfn's work. I also agree with @jordwalke
I've reported 30 issues like that. Some command I'm using 100 times a day like function foo() {
|
} it used to be broken this way: function foo() {|
} Others like A tremendous amount of man-hour has been put to developing Vim so the interaction between text and actions feels natural and consistent. Despite VSCodeVim's maintainers' great work, it'll still take a lot more effort to get everything right. Smart Protocol & msgpack APII briefly looked into making a Vim plugin for VSCode using msgpack API last summer. The old version is like "OK, send NeoVim a width and height, say 80x200, then send NeoVim a command string, NeoVim will send back a 80x200 2D array telling you what's on each position. Now redraw the screen yourself. That's impractical for integrating to VSCode, for obvious perf reason, but also because VSCode's language features will become much harder to implement on top of that. What I hoped, however, is NeoVim just be content as being a tool for text navigation & manipulation and leave everything else to VSCode. If instead of sending whole screen, NeoVim can send structured data like:
Then it would be much easier to implement a Vim extension in VSCode, or let VSCodeVim substitute its Vim State Machine with NeoVim. I remember seeing some progress in NeoVim 0.2 release blog draft by @justinmk but I lost it. Also remember some work was being done in NyaoVim. I was thinking about giving it another try once 0.2 is released. |
Some widgets are being externalized. Currently in Nvim 0.1.7 the popupmenu is externalized, so UIs can render it however they like. We're close to externalizing other widgets like wildmenu, statusline, tabline, and cursorline.
What perf reason? UIs should (and do) batch the redraws.
https://neovim.io/news/2016/11/
Also check out: https://github.com/extr0py/oni |
Thanks. I'm subscribing to #5269, and I'll try again once it's in NeoVim. Oni looks cool, but I'm worried how far it can go. |
Oni is still quite unstable , can't use for daily work. |
I've been monitoring other attempts at integrating NeoVim, but they appear to be blocked on very simple issues. e.g. I will continue to monitor these plugins to see when NeoVim gets into a usable state! |
That's really strange - I've had no problem with I think NeoVim will always have bugs. But Vim will also always have bugs, and so will any Vim emulator. I think it's just about how many bugs there are compared to the value the tools add. |
@jordwalke Yeah, not to say that dw doesn't work in NeoVim - that would be insane - just in extensions that use its remote functionality. I believe it has something to do with the remote msgpack API. Like I said before, if someone wants to fund me, I'll totally get started on a NeoVim plugin for VSCode today. 😁 Otherwise, I'll have to find some time elsewhere... |
I'm absolutely certain you would raise a great chunk of change on KickStarter. NeoVim + VSCode might be a nice project for that model because there's clearly a few simple steps along the way.
|
The "dw" RPC bug is a high priority. actualvim recently switched to Neovim, and the result is impressive (if you have Sublime Text 3, try it). It's very similar to the model I tried to describe above. It's about 1000 lines of code, and it blows away any other "vim mode". Sublime plugins and Vim plugins work. |
Ah @justinmk I didn't realize you were one of the main contributors to NeoVim! That explains some things... 😉 |
That alone is impossible as VSCode doesn't allow extensions to touch its DOM. |
I've been keeping track of this thread for sometime. I'd support a kickstarter to use neovim as the backend for the plugin. |
Same, I've been supporting neovim since the beginning for exactly this
application.
…On Mar 12, 2017 9:45 AM, "3cooper" ***@***.***> wrote:
I've been keeping track of this thread for sometime. I'd support a
kickstarter to use neovim as the backend for the plugin.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#18 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACLMYH-iv6DZk6SLGxyskfAqqZCagr61ks5rlAUYgaJpZM4Glx0s>
.
|
@johnfn One missing feature that I have started to heavily use in "real" vim (and neovim) is register support, which does not appear to work at all in VSCodeVim. For anybody who doesn't use it, you can type |
@clee Register support 100% works in VSCodeVim, aside from a few edge cases. Please open up an issue describing your problems! |
@johnfn When I tried it, it seemed like any non-register |
I've gotten a proof of concept working here! #1725 It should support all text-editing Ex commands. |
As we've started adding neovim integration, please leave all feedback in this issue: #1735 |
Maybe integration with an even smaller and modern codebase like |
Depends on the plugins. Many of them make sense. In any case, this is a solved problem: https://github.com/asvetliakov/vscode-neovim |
Are there any plans for neovim integration?
The text was updated successfully, but these errors were encountered: