107 points · by jkarni · 13y ago · 111 comments
This works using Vim's NetBeans control protocol (inside Vim, do `:help netbeans` to get an overview. Also see the VimSocket class in vim.py) and minimal help from a simple VT100 emulator I wrote (found in term.py).
Open the command panel (cmd|ctrl+shift+p) and run the "ActualVim: Monitor TTY" command if you want to see what's going on in the terminal for any open view.
I actually wrote the first Vim emulation mode in Sublime Text a couple years back ( https://github.com/lunixbochs/sublimevim ) that possibly inspired the other similar plugins. I consistently ran into enough unsupported motions with both my own and other plugins that I caved and wrote ActualVim.
OT It's funny how conditioned I am to seeing __Beans and instantly dismissing it as something I can't be bothered to look into. Silly biased me; it looks like a really powerful protocol.
I think it's meant to be used the other way - using Vim as your frontend to edit code while using NetBeans to manage the project, lint, compile, etc - but it had enough functionality I was able to barely make it work the other way.
eclim[1] is probably an excellent reference-implementation of both approaches. Did you look at it, and if so was it useful?
If you use vim as is you may not notice much, but vim will forever be limited to responding only to user interaction with no hope of ever getting any kind of timers, async actions or event loop.
Try making a simple clock for your status line that updates every second. You can't. And it will never be possible. Because vim is broken.
I can't comment on the code structure of Vim but it does not matter to me because end product is working fine for me for 5+ years. Also bad code structure did not stop continuous development of Vim. Just for example there were 1000 patches added to the core before Vim version was changed from 7.3 to 7.4 within 2 years. Important features like more python binding, lua bindings were added during this time. Even if you see the current patch log of 7.4 ftp://ftp.vim.org/pub/vim/patches/7.4/README 68 patches were added since 7.4 release.
Though async future is not built-in there are several plugins for doing async operation, for example vim-dispatch[1] and vimproc. Vimproc is more widely used. See Unite.vim[3] , neocomplete[4], VimShell[5] for demonstration. I would specially point to VimShell because with the help of it you can run REPL inside Vim and pass buffer content to it. Also there is YouCompleteMe[6] which provides FAST autocomplete.
[1](https://github.com/tpope/vim-dispatch/)
[2](https://github.com/Shougo/vimproc.vim/)
[3](https://github.com/Shougo/unite.vim)
[4](https://github.com/Shougo/neocomplete.vim)
> WTF are you talking about? Vim have may have many demerits but segfaults is not on that list. If segfaults are that frequent you described then people would have jumped ship already.
Vim is all segfaults once you introduce async, and it's highly unstable during any dev work. On any given day visit the Vim dev mailing list and scroll down. Today I see:
Scrolling in a c file segfaults: https://groups.google.com/forum/#!topic/vim_dev/teRV3RyDtzc
Referencing an old buffer seg faults: https://groups.google.com/forum/#!topic/vim_dev/Mssm8pKtnGM
Segfault opening a readme: https://groups.google.com/forum/#!topic/vim_dev/SE31YUccJN4
Segfault selecting a lot of text: https://groups.google.com/forum/#!topic/vim_dev/yzVqZ3qogho
Segfault on autocompletion: https://groups.google.com/forum/#!topic/vim_dev/lqcn57eRGGs
Segfault on tab switching: https://groups.google.com/forum/#!topic/vim_dev/Vc9Z8rfe22w
Just keep scrolling, the segfaults never stop.
> Though async future is not built-in there are several plugins for doing async operation, for example...
For your other point, some plugins fake async using a cursorhold hack that break vim for users who use leader keys. That is they insert fake key strokes. Vimproc actually quits on cursorhold:
https://github.com/Shougo/vimproc.vim/blob/master/autoload/v...
That's right thess plugins inserts keys to trigger autocommand. I would like you to go ahead and type a long vim command using leader keys and see if that works for you. When a plugin inserts keys while you are inserting keys everything stops and you have to start over.
Go ahead, go implement a clock with a plugin that updates every second. I bet that plugin fakes user interaction. It doesn't work.
Edit: Also nice on the downvotes, perhaps explain how my post is wrong in addition to downvoting. Everything I have said are matters of fact. Are my facts wrong?
Given the Macbook-heavy nature of HN, that's probably what leokun is talking about.
[^1]: https://groups.google.com/forum/#!topic/vim_dev/-4pqDJfHCsM%...
https://groups.google.com/forum/#!searchin/vim_dev/kans/vim_...
It's clearly an unsafe operation that wont work with async/timed code, because the buffer may be null at that point, but Bram's response is how do you reproduce it? How do you reproduce it? It's a segfault on an unsafe pointer! It crashes vim. Anyway, the way to reproduce it and all the other segfaults I encountered is to develop a plugin using the timers in that patch.
So nope, vim is broken, and that patch will never see the light of day. Those guys put months of work into that patch and Bram is like "I don't have time." His instincts are right. The patch would ruin vim for anyone using timers.
As a result your neat little Vim2 reboot thing will not be nearly as useful for a long time, so you've lost backwards compatibility for what? Cleaner internals? Doesn't really benefit the end user much. :)
From my point of view it is a very dependable text editor with lots of room for customizability and an unparalleled text editing paradigm.
How many ifdefs it has, the length of its source files or its use of pointers don't matter to me because they have zero negative effect on my workflow. I like Vim as it is, I don't feel limited in any way.
The impossibility to make a clock in a text editor is not an indication that it's broken: it's a sign that you should buy a wristwatch.
As others have said, how in the world are you having these kinds of issues?
It seems rather silly to complain about missing functionality that doesn't achieve the tools core value prop.
To borrow your situation, if you are already using the mouse it's distracting to have to use the keyboard.
Apart from that, many people like the looks of Sublime, and (at least for me) the Sublime text view scrolls a lot better for large documents than either Vim, MacVim, or Emacs.
Edit: I'm not a Sublime user, I switched from longtime Vim to Emacs + Evil a couple of months ago and couldn't be happier (well, I'd like better scrolling, but I mostly jump anyway)
As for jumping around while in insert mode, I totally understand that instinct but it goes against the grain of Vim. Don't spend extra time in insert mode.
I think the real problem with Vim is that you have to wrangle it with a lot of tweaks to make it sane and comfortable and that's a rabbit hole a lot of people (justifiably) don't want to go down. Sublime is very friendly, I like it a lot, Vim demands a long weekend of your life to customize but it really does leapfrog everything once you get it right.
... I for one, look forward to running emacs in sublime, and in an eterm in emacs running vim, which will of course, be running subvim, full circle.
Vim feels a lot like Linux to me. When I was young I loved Linux as I really enjoyed tweaking it and hacking on it. But now I just want my OS to work and get out of the way, so I use OSX. I want the "OSX of editors", which is probably Sublime. But man do I love vim's text manipulation.
When I was a .NET dev, Visual Studio+viemu was pretty much perfect. Text manipulation via vim, project management via VS. viemu is the only vi emulator I've found that is really well done.
ctrl+h ctrl+h - takes you to the sidebar where you can navigate using j, k, h, l
ctrl+h - move to pane to the left
ctrl+l - move to pane to the right
ctrl+shift+h - move and create pane to the right
ctrl+shift+l - move and create pane to the left
.. and a few others
0: https://github.com/guillermooo/Vintageous/ 1: https://github.com/kylefinley/dotfiles/blob/master/sublime/U...
Edit: formatting
http://www.emacswiki.org/emacs/LightTable
http://www.emacswiki.org/emacs/MiniMap
http://www.emacswiki.org/emacs/Evil
https://github.com/emacs-helm/helm (go to anything)
With this you can use Sublime Text's UI (chrome, file browser, and smooth scrolling—all better than Vim's) with Vim's input mode. Best of both worlds.
In that case, you have at least Vintage, Vintageous, and my original project sublimevim (that was mostly a proof of concept before we had any of this) as "vim-mode" in Sublime Text.
Also can you check the console when opening a file to make sure there's no error?
There are ways to get around it, but getting the error in the editor window is very nice for dummies like me.