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

Add installation instructions for Neovim #11

Merged
merged 1 commit into from
Jul 23, 2022
Merged

Add installation instructions for Neovim #11

merged 1 commit into from
Jul 23, 2022

Conversation

adrianocorrea
Copy link

No description provided.

@adrianocorrea
Copy link
Author

Hi @fmoralesc,

Congratulations on the plugin. Adding Quatro support for Vim and Neovim is an invaluable contribution to data scientists across the globe.

I have proposed the pull request above, which:

  1. Improves the documentation, adding installation instructions for packer.vim, one of the most popular package managers for people using Neovim (especially among users favouring a full-Lua Neovim setup)
  2. Improves the syntax highlights in README.md and
  3. Fixes a small typo in the installation instructions

It is a small contribution, but I hope it helps the project.

@fmoralesc
Copy link

I am not the maintainer of this plugin, I think that is @jjallaire. In any case, these changes (and the fork) look like a great initiative, vim-rmarkdown has not been mantained in quite a while.

@jjallaire jjallaire merged commit 2162473 into quarto-dev:master Jul 23, 2022
@jjallaire
Copy link

@cscheid We should also link to (or even allows this to be subsumed by) the other neovim related work you provided some help with. Could you update the README here accordingly?

@cscheid
Copy link
Collaborator

cscheid commented Jul 23, 2022

@jjallaire You're talking about https://github.com/jmbuhr/quarto-nvim/, I assume?

I know very very little about vim and neovim, but I think neovim plugins are not compatible with vim. @jmbuhr, do you mind sharing some of your expertise here?

@adrianocorrea adrianocorrea deleted the patch-1 branch July 23, 2022 20:58
@jmbuhr
Copy link

jmbuhr commented Jul 23, 2022

This is correct. Plugins that use only vim script can be used by both vim and neovim (unless it uses vimscript 9, which breaks backwardscompatibility and will not be ported to neovim). Neovim plugins however mostly make use of the lua integration and / or neovim specific features such as their lua api or the native language server protocol implementation and are thus not compatible with vim.

For example, quarto-nvim mostly just recommends such plugins to make use of neovims native integrations (lsp, treesitter etc.): https://github.com/jmbuhr/quarto-nvim/#recommended-plugins and only supplies a function to preview a quarto document or project.

The only thing that is missing compared to e.g. the VS Code extension is code completion and linting for code chunks that is specific to the language. I am working on this in a little script on the dev branch: https://github.com/jmbuhr/quarto-nvim/blob/dev/examples/run.lua
Because in theory all the pieces are already there. Treesitter has an AST of the document and I can already create a buffer with just the embedded language and attach a language server to it. But I still have to figure out the specifics of forwarding hovers, highlights, completions etc. to the buffer that has the qmd file like you do with the VS Code extension.

I would also be very happy if you have some thoughts on this or a specific implementation @adrianocorrea .

@jjallaire
Copy link

@jmbuhr I wonder if once you have all that working the way you want whether we should make your work the "official" vim/neovim integration?

@jmbuhr
Copy link

jmbuhr commented Jul 24, 2022

Sounds good :) Maybe even before that. The necessary features are already there and if it is official we might get lucky and have someone jump in with help for the code chunk treatment (new neovim plugins and contributors are multiplying so fast since the commitment to lua)

@jjallaire
Copy link

Okay, should we create a new repo called quarto-neovim to host that work? (and keep the existing quarto-vim as just syntax highlighting)

@jmbuhr
Copy link

jmbuhr commented Jul 24, 2022

Yes, or rather quarto-nvim (I think nvim is more common in plugin names than neovim). When I made a quarto extension for a journal format, @cderv and I figured out how to transfer the repo:
quarto-journals/article-format-template#1 (comment)
Do you want to handle it the same for quarto-dev?

@jjallaire
Copy link

I think it would be better to create a new repo (just so we don't inadvertently grant too many permissions to the main quarto-dev org). I could create the repo with no content, give you access to write to it, then you could push to it from your local copy and all history should be preserved.

@jjallaire
Copy link

Okay, I created this repo (https://github.com/quarto-dev/quarto-nvim) and made you the maintainer. If you follow the directions for "…or push an existing repository from the command line" you should be able to migrate the repo while preserving all commit history.

@jmbuhr
Copy link

jmbuhr commented Jul 24, 2022

ok, sounds good :) I am currently not on my main machine, so I will push tomorrow (well, it might still be today for you, I'm on central european time)

@adrianocorrea
Copy link
Author

@jmbuhr, is there a Quarto LSP already?

If not, a (temporary) code completion - one can use right away - is to set the document filetype to Quarto AND the embedded languages, similar to what is done when using web frameworks.

For example, one might type :set ft=python.django to use Python with Django, enabling both snippets. Similarly, one might type :set ft=quarto.r to enable snippets for both Quarto and R or type :set ft=quarto.r.python to use Quarto, R and Python snippets. The latter will enable both 'fun' and 'def' snippets, where 'fun' will create R functions and 'def' Python functions (assuming you are using LuaSnip with friendly-snippets, as you recommend in quarto-nvim-kickstarter). Since friendly-snippets did not include snippets for Quarto, I proposed a new pull request based on the VS Code extension. See #179.

Note that the above simplifies code maintenance, as you do not need to keep Python, R, Julia and Observable snippets up to date.

For syntax highlighting, we can add quarto-vim as a quarto-nvim dependency in Packer (or port the syntax/quarto.vim file to quarto-nvim, keeping both projects independent from each other).

I am not aware of an easy way to combine linters. Has this been implemented in quarto-vscode?

@jmbuhr
Copy link

jmbuhr commented Jul 26, 2022

Thank you for your ideas! I'll add my two cents tomorrow. Let's move this conversation over to the quarto-nvim repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants