Sublime Forum

ActualVim - perfect Vim input for Sublime Text 3

#14

It’s a lot better with the latest changes. Thanks for adding them!

0 Likes

#15

Hello @lunixbochs,

thanks a lot for the wonderful plugin!

Recently I decided to finally abandon Emacs and returned back to (n)vim, but your plugin makes me enthusiastic to-revive usage of my ST3 licenses and get best of both worlds. :smile:

I bet that (n)vim might have better plugins/completions, etc. for some stuff - eg. vim-go for Go language, while ST3 is strong(er) in some other fields like web technology (HTML, CSS, SASS etc.).

Caveats sections lists some currently problematic area, but I wonder, in general, is it possible/feasible to e.g. use both (n)vim/ST3 completion plugins at the same time without enabling/disabling ActualVim globally and/or locally?

0 Likes

#16

This is already implemented. I expose the Sublime completions to vim as a completefunc, so you can hit ^X^U to get Sublime completions while Vim is enabled. I’m also going to hopefully remove the insert-mode input interception so Sublime can still show automatic completion/snippet popups, at which point I’ll query Vim for completion data too to make this work both ways.

The caveat is just that sublime won’t auto-suggest completions as you type, not that they don’t work.

Multiple selection should work extremely well when it’s done, but will take a bit of work to get going (I basically need to track selection 100% on Sublime side, and dispatch a different key to vim per selection, kinda… or wait for official neovim support for it).

The “undo” thing isn’t a huge issue right now (you should mostly just use vim undo), and the insert hack idea that will fix suggestion popups should fix undo too.

0 Likes

#17

OK, I’ve to test it further…

That will be cool as well. :+1:

What about ST3’s status bar to show me when I issuing normal mode’s stuff, e.g. to enter current date via
:!r date

?

One of the thing which I regularly use in vim and won’t give it up so easily is reformat-paragraph feature:
visual-mode j (for selection) gq
so, why e.g. the above snippet cannot produce result immediately, but I’ve to ‘leave’ (n)vim-mode by e.g. pressing Esc or something, iow. is it just a feature required to make the whole bridge working?

0 Likes

#18

I’ve asked for the ability to anchor a phantom to the bottom of a view in Sublime. I don’t have any good ways to display that information yet (but :command line and search should show up in status bar right now)

so, why e.g. the above snippet cannot produce result immediately, but I’ve to ‘leave’ (n)vim-mode by e.g. pressing Esc or something, iow. is it just a feature required to make the whole bridge working?

This should be fixed in Neovim 0.2, which was recently released.

0 Likes

#19

Hmm…trying with
:r !date
example, I do not see anything?

[quote]This should be fixed in Neovim 0.2, which was recently released.
[/quote]

Great…I’m waiting to be released for my Fedora (f25) distro…

0 Likes

#20

I can’t really guarantee anything before neovim 0.2, but I definitely see the status/search/command line on mine.

0 Likes

#21

Hmmm…which OS do you use?

0 Likes

#22

I’m on OS X.

0 Likes

#23

It would be nice if some Linux user can confirm whether there is an issue here? (I have access to neither Mac nor Win OS-es…)

0 Likes

#24

You can debug the screen scraper (yes, that’s how I get the status line right now) with the Sublime console:

import ActualVim; print(ActualVim.neo.vim.screen)

import ActualVim; print(ActualVim.neo.vim.status_line)

Neovim is rather easy to build yourself as well, and you can set neovim_path in your ActualVim settings if you want to test a local build.

If status_line has the typed command but it’s not in the Sublime status bar, I know where the issue probably lies and have an easy fix if so.

0 Likes

#25

After issuing the:

:r !date

command, I get the following:

`import ActualVim; print(ActualVim.neo.vim.screen)

:r /date
`

and

import ActualVim; print(ActualVim.neo.vim.status_line)

which shows the blank state of cursor.

[quote]Neovim is rather easy to build yourself as well, and you can set neovim_path in your ActualVim settings if you want to test a local build.
[/quote]

Do you believe that 0.20 should behave better in this regard? In that case I’m going to try to build from the source…

Edit: I built nvim from the source (0.2.1-x), but the issue is still present.

In my case status_line is blank?

0 Likes

#26

Printing ActualVim.neo.vim.screen should print a lot more than the command line. Have you customized your vim status line in init.vim? I don’t really have a way of supporting that yet. I’m waiting on neovim external command line support.

If you’ve customized, you can check the g:actualvim variable from vim config to disable plugins inside ActualVim.

0 Likes

#27

Ahh, my mistake…I forgot that my init.vim is symlinked to the vim’s one. It works now… :cry:

When does neovim plan to support that?

0 Likes

#28

A decent substitute for now would be the ability to pin variable-height minihtml across the bottom of a view like the vim status bar, but I don’t know how to convince Sublime to add that, so I’m waiting on both sides for now :slight_smile:

I PoC’d a major hack that’s actually pretty good until you scroll or want to read the text at the bottom:

But I’m holding out for something more like this (at which point I’d personally just hide the Sublime status bar entirely)

0 Likes

#29

I think that would entail crossing the bridge of providing an HTML “view” style, like we have a editor view and an image view. The downside of this is that once we cross that bridge the next request is going to be supporting floating and table layout, which are far more involved than the basic block and inline layout we’ve supported so far.

It would probably also require changing how we do pane layout – for instance, if someone wants a full-width bar to be above the status bar, but below output views.

1 Like

#30

It would probably also require changing how we do pane layout – for instance, if someone wants a full-width bar to be above the status bar, but below output views.

I understand that’s probably harder, but I definitely don’t want to go there for now. Is there no way to special-case this? (I’d almost be able to do this with output panes, but they’re mutually exclusive, have some quirks, and I can’t control the size).

Status bar view, an on_modified callback with edit deltas (you already have that information for undo history, right? :slight_smile: ), and some way of intercepting insert-mode input that doesn’t break Sublime’s insertion hooks (snippet/autocomplete popup, word grouping on undo) and I’ll be out of your hair for a while I promise :wink: (the second two I can work around in horrifying ways, like putting regions on all cursors and tracking them or building a C plugin that does view diffs without going through Python at all, but I have no good recourse for the status bar at all)

0 Likes

#31

I just installed this today and am enjoying it thus far. Quick question… is it possible to set by default that a new document opens in Normal mode by default? I checked the settings file but didn’t find an obvious setting…

0 Likes

#32

Right here: https://github.com/lunixbochs/ActualVim/blob/master/neo.py#L226

if self.av != av, you’ll need to self.nv.input('<c-\\><c-n>')

Open an issue or PR on GitHub and I’ll get around to testing/adding as default behavior soon. One problem is losing selection on view switch.

0 Likes

#33

I’ve made a few releases in the last few days. If you haven’t tried ActualVim since the initial neovim port, it’s now significantly faster and has several new features including:

  • support for the external command line from neovim 0.2.1.
  • viewport positions are bidirectionally synced (with heuristics to prevent glitches/jumping!), which allows you to use commands like zz now (and gets us closer to having good highlight syncing)
  • ActualVim Settings improvements. The settings.vim.modes section is fun because it lets you set view settings based on the current vim mode. Pair that with the new key bypass settings e.g. "av:ctrl+n": true in normal mode and you get more control over which keys are passed to vim vs Sublime based on the active vim mode. You can also set vim buffer options, cli arguments, and other things in here.

Here’s a changelog from the past few days (versions 0.9.12-0.9.14):

  • fix #130 (backspace fails after clicking with mouse while in insert mode)
  • implement external cmdline
  • implement pasting in cmdline (partial fix of #50 - cut and other native manipulations are unsupported for now)
  • add settings av:mode:<name> usable in keybinding contexts: #105 (comment)
  • fix #118 (wrong cursor position after paste)
  • sync viewport position to/from vim (fixes #111 and #62)
  • add support for per-mode key bypasses (see issue #117)
  • windows: detect neovim chocolatey install
  • non-osx: bypass ctrl+n and ctrl+w in normal mode in default settings
0 Likes