Juila + Vim

Hello! Does anyone have a good working setup of Julia and vim? I’m using the LanguageServer, but it seems to have a lot of issues / is slow and crashes a lot. Are there any alternatives?

Side question, what’s your workflow look like with vim? Repl on the side? A jupyter notebook running?

2 Likes

I use vim slime to push code through gnu screen. This works well for me. The language server integration I never got working satisfactory. Like you said: crashes a lot and is in general buggy at least on my system. Ultisnips has some nice Julia snippets included.

I’ve tried switching back to vim recently, after becoming frustrated by Atom’s partial macro support, but did not have a good experience with autocomplete. Any text entry would spike one of my CPU cores to 100% for a few seconds and spin up my laptop fan as if I was running benchmarks. Not great for battery life.

I experienced this issue with both @ExpandingMan’s config and the suggested config on the LanguageServer.jl wiki.

Atom also occasionally has similar tagging/autocomplete performance issues, but is more likely to get into a good state with responsive tagging that works mostly as expected. It’s not perfect though, and still misses some completions or lags sometimes.

Compromise for me now is to use Atom (with vim mode) for most development, and launch real vim if I need to make a more involved edit that would benefit from macros or other plugins. This workflow is not ideal, and I hope we can find a better solution in this thread.

1 Like

I use the julia-vim plugin; as for flow, I have (i use i3wm as window manager):

  • 1 tmux session with several windows, each window with a vim instance, multiple files edited pertinent to individual packages
  • 1 tmux session (floating i3 window), multiple windows for REPL instances, multiple panes for code that
  • 1 tmux session, multiple windows, for documentation/quick searches/etc.

Screenshot, just for laughs: Friday's night coding sessions. by zgornel on DeviantArt

3 Likes

Nice! I like the screenshot!

I haven’t tried @ExpandingMan’s config, I’ll have to give that a shot. The only features I really want are syntax highlighting and syntax checking. Autocomplete is nice to have, but I can live without if it means making vim usable.

1 Like

I’m facing this exact issue.

I’ve been “spoiled” with NVimR since my current course is focusing on R.

There are three features it has in particular that I as a novice appreciate and think would be valuable for coders of all levels:

  1. Documentaion lookup from the source code (put the cursor over any function/method and do a hotkey combination and you get the lookup for the object without leaving vim)
  2. Object browser
  3. Running code directly (I see that this should be somewhat replicable with vim-slime but haven’t tried it myself)

So far I’ve found the julia-vim plugin is the only thing which works 100% reliably and without any noticeable performance issues. With julia-vim you can get Base documentation with the K binding.

I haven’t had luck yet with setting up LanguageServer. The most recent and reasonable-looking config I’ve found was @joshbode’s config from here: Omni completion broken with LanguageClient-neovim · Issue #261 · julia-vscode/LanguageServer.jl · GitHub

Even with that as a guide I found setup surprisingly difficult (eg I think LanguageServer is only compatible with Julia 1.2 right now) and for the moment I’m back to using julia-vim.

4 Likes

I am quite happy with julia-vim. It does a perfect job with the latex to unicode conversion of special symbols.

Regarding auto-completion, the built-in auto-completion of vim (ctrl+N) works reasonably well if you have opened some files of your project (I assume that it looks among the words in the opened buffers). So far, this has been more than enough for my use cases. But, of course, a more “smart” auto-completion machinery would be also nice.

1 Like

I’ve using julia-vim for some time now. I recently realized that my scrolling has become super slow when working on .jl files. I’m pretty sure it has something to do with julia-vim since it works alright if I delete that plugin. I’m on mac btw, but similar issues in my linux system as well.

Is there anything where I just have the syntax highlighting? I can live without autocomplete and latex-unicode conversion for now.

1 Like

I use vimteractive, google it! It makes a nice Julia + VIM IDE

4 Likes

julia-vim is about as minimal as it gets, I suspect, and it could well be the syntax highlighting which causes the difficulty because writing efficient syntax patterns isn’t always easy. I’ve never had any trouble though; all I know is that it works really well on my linux machine.

You could report the issue on the julia-vim repo and the author might be able to help.

2 Likes

Vimteractive looks pretty neat! I’ve been looking for a more natural editor + REPL flow, I’ll give this a try!

More natural than what?

Well, more natural than my crude poke, copy, and paste flow. I’ve only recently started exploring Julia and I’m trying to be intentional about the REPL habits I develop, coming from a mobile software background which did not emphasize REPL/exploration based development.

Revise has been wonderful from the REPL side. I’ve bounced around editors, though, so vimteractive piques my interest.

Maybe I’ll end up just with julia-vim and the REPL?

1 Like

julia-vim with slimux should be good enough. add plugins to tmux such as continuum and you can go back to tmux sessions even after reboot.

1 Like

Sorry to bump an old thread, but I recently switched to Vim and I am also experiencing the same thing. If I take out the syntax highlighting, it becomes fast, but as soon as I add syntax highlighting, the terminal becomes laggy and slow as hell. Have you found a solution to this predicament yet?

edit: For now, I’m just using it with disabled syntax highlighting, but I would love to get it back. If anybody has any ideas, it would be very much appreciated. If not, I’ll try to open an issue on Github or something.

1 Like

I didn’t find a permanent solution yet. It might just have been my macos.

What worked for me was using Alacritty terminal emulator and getting rid of some of my superfluous vim plugins. But with alacritty I need to use tmux, which I am not a big fan of.

Which os do you use? I suggest reworking your vimrc and terminal emulator to see if it works.

Also, I never got around to opening a github issue, but go for it, I would be interested in a better solution as well.

As a data point, I use vim and vim-julia on Linux and have no problems at all with speed. Have you tried using gvim instead of running vim on the terminal?

If all you need is tabs, I recommend tabbed. It’s very lightweight and just works.

1 Like

Thanks :), will check it out.