Sublime Forum

ActualVim - perfect Vim input for Sublime Text 3

#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

#34

I signed up just to say thanks for this great plugin. It’s brilliant being able to have vim input methods combined with sublime expandability, really liking it. Thanks to both yourself and the Neovim guys!

0 Likes

#35

Hi, really looking forward to trying ActualVim, but was wondering if you could help me out first… I’m not all that familiar with GitHub. Could you expand your description of step 2 (“clone actualvim into your package directory (or install via Package Control)” a bit? Or link to a how-to page for how one would go about cloning something into a package directory? (And where would I likely find my package directory? I assume you mean Sublime Text 3’s package directory?)

Thanks!

0 Likes

#36

You should install it with Package Control, and make sure to have neovim >= 0.2.2

0 Likes

#37

The package that this post is talking about is available in Package Control directly right now, so it should be enough to just select Package Control: Install Package from the command palette and then select ActualVim from the package list and you’re good to go.

If a Sublime package exists in a GitHub or BitBucket repository but is not available in Package Control, the easiest way to get it installed would be to select Package Control: Add Repository from the command palette. In the input area at the bottom of the window, paste in the full URL of the repository (https:// and all), and hit enter.

Once you do that, the package will be listed in the package list as if it was naturally there.

The worst case scenario is a Sublime package that’s not hosted on GitHub or BitBucket. In that case you need to take manual steps.

That generally requires you to go into the Packages folder (available via Preferences > Browse Packages... in Sublime) in a command prompt or terminal and manually do a git clone repository-url type operation. It’s best to do this while Sublime isn’t running so that it doesn’t try to load the package before the operation is complete.

This can be more complicated, and things aren’t automatically updated for you, so I would personally consider this the Path of Last Resort :tm:, all else being equal. In particular, it requires you to be quite familiar with the command line in general and git in particular.

0 Likes

#38

Thank you for your reply. I’m not familiar with Sublime Text at all, so it took me a while to realize that “Package Control” is part of Sublime, not part of GitHub.

I “installed” neovim (though “install” is stretching things, since it’s a standalone exe), apparently v0.2.3:

C:\bin\Neovim\bin>nvim --version
NVIM v0.2.3-580-gec62f925a
Build type: RelWithDebInfo
LuaJIT 2.0.5

Then in Sublime I installed Package Manager (I think via Tools->Install Package Manager, though that option is no longer available since I installed it). Then I went to Preferences->Package Settings->ActualVim Settings and it opened an editor buffer of apparently a file named “ActualVim.sublime-settings”. But no matter what I do in that editor window I cannot change anything in it. I see where I think I’m supposed to edit the file:

"neovim_path": "",

I can click on that line and the cursor blinks where I clicked, but it will not let me edit it. No key does anything in that window. Also, now if I open any other file, it won’t let me edit those either! So in a Windows command window I go to C:\Users\minichm\AppData\Roaming\Sublime Text 3\Packages\ActualVim and search (grep recursively) for any file containing “neovim_path”, and I find this file: ./Packages/ActualVim/settings.py. Using a different editor, I changed this line…

"neovim_path": "",

…to this:

"neovim_path": "C:\\bin\\Neovim",

…then I re-open Sublime, and go to Preferences->Package Settings->ActualVim Settings again, and again it opened an editor buffer of apparently a file named “ActualVim.sublime-settings”. That line is still the same (it still says "neovim_path": "",). And I still can’t edit any file I load into Sublime; I can click anywhere and the cursor goes there, but no key I hit does anything.

Any ideas?

0 Likes

#39

The file opened by ActualVim Settings is your user settings, which is in the Packages/User/ directory

0 Likes

#40

The Tools > Install Package Control menu option is only displayed if Package Control isn’t already installed, so this is normal.

I don’t use this particular package, but it looks as though the reason this happens is that once the package is installed, it wants to talk to the neovim that you installed in order to work, but with it not being available, you can’t edit anything.

I would presume that the solution to this would be one of the following:

  1. Modify the PATH on your system to include the path you installed neovim at and then restart Sublime so that the plugin will find it
  2. While you have the ActualVim.sublime-settings file open in Sublime, select Package Control: Disable Package from the command palette and disable ActualVim, which should restore normal editing functionality. Edit the file with the appropriate path and use Package Control: Enable Package to re-enable ActualVim.
  3. Use Preferences > Browse Packages... to open the Packages folder, then go into the User package, and edit the ActualVim.sublime-settings file with another editor to set the neovim_path as appropriate, and restart Sublime.

The settings.py that you edited is most likely the part of the package that generates the initial ActualVim.sublime.settings in your User path for you, so modifying that file is unlikely to have any effect on anything once the file is already there.

0 Likes

Sublime is unable to load ActualVim plugin