Sublime Forum

ActualVim - perfect Vim input for Sublime Text 3

#8

Mh, can’t get it to work…

Windows Server 2016 x64 German
Sublime Text 3 Build 3126 (32-bit)

I downloaded Neovim (32-bit) from https://ci.appveyor.com/api/projects/neovim/neovim/artifacts/build/Neovim.zip?branch=master&job=Configuration%3A%20MINGW_32

and extracted it into “D:\Tools”
So nvim.exe is now in “D:\Tools\Neovim\bin”

Download actualvim (“Download as zip”), renamed it from “actualvim-master.zip” into “actualvim.zip” and
extracted it into “D:\Tools\Sublime Text\Data\Packages”. Ofc it now resides in “…\Packages\actualvim”

Restarted Sublime Text. By default it doesn’t seem to create a .sublime-settings file so I created it myself:
“D:\Tools\Sublime Text\Data\Packages\User\ActualVim.sublime-settings”

Content:

    "enabled": true,
    "neovim_path": "D:\\Tools\\Neovim"
}

When I now restart Sublime Text I get this in the console:

(a lot of other reloading plugin messages with no errors)

reloading plugin TimeStamper.TimeStamper
plugins loaded
Traceback (most recent call last):
  File "./python3.3/subprocess.py", line 1104, in _execute_child
PermissionError: [WinError 5] Zugriff verweigert

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Tools\Sublime Text\sublime_plugin.py", line 210, in on_api_ready
    m.plugin_loaded()
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\neo.py", line 45, in plugin_loaded
    vim._setup()
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\neo.py", line 146, in _setup
    self.nv = neovim.attach('child', argv=[NEOVIM_PATH, '--embed'])
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\neovim\__init__.py", line 103, in attach
    child_session(argv) if session_type == 'child' else
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\neovim\msgpack_rpc\__init__.py", line 42, in child_session
    return session('child', argv)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\neovim\msgpack_rpc\__init__.py", line 18, in session
    loop = EventLoop(transport_type, *args, **kwargs)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\neovim\msgpack_rpc\event_loop\base.py", line 88, in __init__
    getattr(self, '_connect_{}'.format(transport_type))(*args)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\neovim\msgpack_rpc\event_loop\asyncio.py", line 101, in _connect_child
    self._loop.run_until_complete(coroutine)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\asyncio\base_events.py", line 466, in run_until_complete
    return future.result()
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\asyncio\futures.py", line 293, in result
    raise self._exception
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\asyncio\tasks.py", line 239, in _step
    result = coro.send(None)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\asyncio\base_events.py", line 1189, in subprocess_exec
    bufsize, **kwargs)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\asyncio\windows_events.py", line 373, in _make_subprocess_transport
    **kwargs)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\asyncio\base_subprocess.py", line 39, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\asyncio\windows_events.py", line 757, in _start
    bufsize=bufsize, **kwargs)
  File "D:\Tools\Sublime Text\Data\Packages\actualvim\lib\asyncio\windows_utils.py", line 204, in __init__
    stderr=stderr_wfd, **kwds)
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1110, in _execute_child
PermissionError: [WinError 5] Zugriff verweigert
Traceback (most recent call last):
  File "D:\Tools\Sublime Text\sublime_plugin.py", line 228, in on_api_ready
    attach_view(v)
  File "D:\Tools\Sublime Text\sublime_plugin.py", line 276, in attach_view
    check_view_event_listeners(view)
  File "D:\Tools\Sublime Text\sublime_plugin.py", line 270, in check_view_event_listeners
    listeners.append(cls(view))
TypeError: object() takes no parameters
warning: mnemonic I not found in menu caption Find
warning: mnemonic I not found in menu caption Find
Package Control: Skipping automatic upgrade, last run at 2017-02-27 14:23:05, next run at 2017-02-27 15:23:05 or after

I don’t know why there is a permission error (if this is related to actualvim loading nvim.exe?)

“Vintage” is in “ignored_packages”
as well as “Vintageous” (which I normally use)

Sublime Text runs with normal user rights.

0 Likes

#9

Sorry about that, the path needed to be to nvim.exe not just the neovim folder (I assume permission was denied on trying to execute a folder). I just added a check for this in latest master, so it will guess PATH/nvim.exe and PATH/bin/nvim.exe on windows.

As far as plugin settings, I said this in the main readme but not here - there’s a menu item and command palette option for opening the ActualVim user settings, and it will fill in the defaults if the settings didn’t exist yet.

1 Like

#10

No problem. Updated actualvim and pointed neovim_path directly to nvim.exe => It works, no error
messages any more

0 Likes

#11

Also note Windows ActualVim has an input performance problem I haven’t tracked down yet: https://github.com/lunixbochs/actualvim/issues/32#issuecomment-282717630

0 Likes

#12

Noticed that already.

Typing is rather jumpy / slow

0 Likes

#13

I improved the heuristics, and it should be a little better in latest master.

0 Likes

#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