Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native vim support #222

Closed
paniash opened this issue Dec 19, 2020 · 17 comments
Closed

Native vim support #222

paniash opened this issue Dec 19, 2020 · 17 comments

Comments

@paniash
Copy link

paniash commented Dec 19, 2020

Hi!

I was wondering if there are plans to send this plugin to the official Vim repo. That would help ensure native support with runtime files instead of relying on a plugin.

Thanks!

@paniash
Copy link
Author

paniash commented Dec 19, 2020

I've opened an issue regarding this on the official vim repo. To the maintainers of this wonderful plugin, it'd be great to see this merged directly into vim. Thanks!

vim/vim#7498 (comment)

@paniash
Copy link
Author

paniash commented Jun 30, 2021

Any updates on this? @carlobaldassi

@clason
Copy link
Contributor

clason commented Jul 30, 2021

Just to make clear: we're not talking about the full plugin here; just the syntax, indent, and ftplugin files. This requires no changes to this plugin since you can override whatever is upstreamed (other filetype plugins do the same) -- all that is required of you is to give explicit permission for these files to be included in vim (and for @carlobaldassi to be listed as maintainer).

(This would also be relevant for #269 since it would give (neo)vim users an option for a "light-weight" Julia editing experience if they don't need the L2U substitution.)

@clason
Copy link
Contributor

clason commented Aug 3, 2021

@carlobaldassi If you do not want to give permission, that is of course your prerogative, but then I'd appreciate it if you came out and said so -- then I'd drop this issue and move on with my life.

@carlobaldassi
Copy link
Contributor

I have absolutely no problems with giving permission. Also, I certainly don't want to have people's lives hanging on it...
My real doubt is, in fact, about the L2U functionality, which is included in the plugins for the Julia language in the each and every other editor. Thus, I think it would be ideal if it worked the same in vim too. If it didn't, I wonder how many people will discover that the plugin for doing that exists.
Anyway, I guess that unless we can separately include the L2U plugin too into vim, that won't happen. This is why I haven't had the time to explore how to propose the inclusion in a way that makes sense yet.

@clason
Copy link
Contributor

clason commented Aug 3, 2021

Sorry, I could have phrased this better -- the point is that I have time to do this now and follow up until it gets merged, but that will change later.

And I'm sorry if I gave the impression that I was down on the L2U functionality -- it's really nice and works smoothly (even on the commandline, which was surely not trivial to pull off!)

My proposal would be to just add the syntax highlighting and indentation files so that Julia files look nice out of the box. This is not hard, and I can do that both for vim and neovim.

I do not suggest including the L2U functionality; this essential part of editing Julia files would stay in this plugin. (If you're worried that this would make julia-vim "less attractive", I wouldn't worry -- people will still want to use it just for that!) I can't speak for vim, but it's definitely not a candidate for including in neovim...

I also do not suggest removing the highlight files from julia-vim -- presumably, you want to keep improving them and adapting them to the newest versions of Julia. (Another reason to keep using the plugin ;)) If there are (big) enough changes, we can repeat the exercise of getting the latest versions into (neo)vim. This is pretty much how other language support in vim works, too (there's a full-featured language plugin, and the static "basics" are pulled in regularly).

To summarize, no change at all would be needed for julia-vim -- you'd just be "donating" the basic vim files to make (neo)vim work nicer out-of-the box.

@carlobaldassi
Copy link
Contributor

Yes, I suppose that including a bare version of the plugin files is the only way for inclusion in vim, I don't really see any other way. So @clason if you want to take care of that, I'd be grateful. Otherwise, I'll do it myself when I have the time. After it's included, I also have no problem maintaining it whenever there are significant changes, of course.
(Aside: to clarify, I'm not worried that people won't use the plugin per se, I'm worried that people will consider vim support inferior to other editors. It's entirely possible that I'm overthinking it though. We'll see.)

@clason
Copy link
Contributor

clason commented Aug 3, 2021

Yes, I suppose that including a bare version of the plugin files is the only way for inclusion in vim, I don't really see any other way. So @clason if you want to take care of that, I'd be grateful.

I'd be happy to!

After it's included, I also have no problem maintaining it whenever there are significant changes, of course.

You wouldn't have to maintain the vim files in addition; just this plugin like you've been doing. The point is just that if somebody opens an issue about Julia syntax highlighting in vim, Bram will say "please report the issue at julia-vim, and when it's fixed there, we'll just pull in their change".

(Aside: to clarify, I'm not worried that people won't use the plugin per se, I'm worried that people will consider vim support inferior to other editors. It's entirely possible that I'm overthinking it though. We'll see.)

I think people value vim for different things than, say, VS Code, so I wouldn't worry. In any case, thank you for maintaining this plugin! Without your work, (neo)vim wouldn't be a viable Julia editor at all!

@clason
Copy link
Contributor

clason commented Aug 4, 2021

Done: vim/vim#8700

Filetype detection is already merged in vim/vim@0eec851, syntax and indent files will be part of the next update of the runtime files.

@brammool
Copy link

brammool commented Aug 4, 2021

My script to check runtime files finds a few problems:
The syntax file does not set and restore 'cpo', which is needed for the line continuation. The other files do.

Invalid expression: "'\U00-\U08' . '\U0A-\U1F'

Ftplugin file julia.vim: Vim(call):E117: Unknown function:
julia_blocks#remove_mappings in b:undo_ftplugin from julia.vim

@clason
Copy link
Contributor

clason commented Aug 4, 2021

I'll fix the first and last problem on my PR (sorry, the last one slipped through my efforts!)

For the second, should these be escaped differently:

let s:nonid_chars = '\U00-\U08' . '\U0A-\U1F' .
      \             '\U21-\U28' . '\U2A-\U2F' . '\U3A-\U40' . '\U5B-\U5E' . '\U60' . '\U7B\U7C' .
      \             '\U7E-\UA1' . '\UA7\UA8' . '\UAB-\UAD' . '\UAF\UB1\UB4' . '\UB6-\UB8' . '\UBB\UBF' . '\UD7\UF7'

@clason
Copy link
Contributor

clason commented Aug 4, 2021

@brammool sorry to ask this, but maybe the second problem is an issue with your script? If I select these lines and :'<,'>source them, I get that error -- but when I source a script containing (only) these lines with :source %, it works fine?

@clason
Copy link
Contributor

clason commented Aug 4, 2021

or is it just that the continuation operator . should be at the start of the new line instead of the end of the old one?

@clason
Copy link
Contributor

clason commented Aug 4, 2021

@carlobaldassi my fixes are in https://github.com/clason/vim/commit/14a394a928dae34df8d6ae18730fabaf74e53e50 in case you want to apply them as well. (I can also make a PR when we're done if you prefer that.)

carlobaldassi pushed a commit that referenced this issue Aug 4, 2021
This is common practice in syntax files and needed for, e.g., line
continuation to work properly (see discussion in #222).
@clason
Copy link
Contributor

clason commented Aug 15, 2021

Runtime files have been merged in vim and neovim now, so this can be closed now. Thanks for your help!

(For neovim, don't forget to make distclean before rebuilding!)

@paniash
Copy link
Author

paniash commented Aug 15, 2021

@clason Are the runtime files available only with the next release of neovim or is it possible to make it available for v0.5?

Thanks for following up on this issue btw! Much appreciated. 😃

@clason
Copy link
Contributor

clason commented Aug 15, 2021

They will not be backported, no, so if you don't want to use nightlies or build from master, you'll have to wait until 0.6.

@paniash paniash closed this as completed Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants