|
1 | | -============================================================================ |
2 | | - *quarto.nvim* |
| 1 | +*quarto.txt* Quarto mode for neovim. |
3 | 2 |
|
4 | | -This plugin helps you author quarto documents. |
5 | | -Learn more about quarto here: https://quarto.org/. |
| 3 | +============================================================================== |
| 4 | +Table of Contents *quarto-table-of-contents* |
6 | 5 |
|
| 6 | +1. quarto-nvim |quarto-quarto-nvim| |
| 7 | + - Setup |quarto-setup| |
| 8 | + - Usage |quarto-usage| |
| 9 | + - Configure |quarto-configure| |
| 10 | + - Language support (WIP) |quarto-language-support-(wip)| |
| 11 | + - Available Commnds |quarto-available-commnds| |
| 12 | + - Recommended Plugins |quarto-recommended-plugins| |
7 | 13 |
|
8 | | - *quarto.quartoPreview()* |
9 | | -quartoPreview() |
| 14 | +============================================================================== |
| 15 | +1. quarto-nvim *quarto-quarto-nvim* |
10 | 16 |
|
11 | | - require'quarto'.QuartoPreview() |
| 17 | +Quarto-nvim provides tools for working on quarto <https://quarto.org/> |
| 18 | +manuscripts in neovim. |
12 | 19 |
|
13 | | - *QuartoPreview* |
14 | | -QuartoPreview |
| 20 | +**Note**: Some functionality has been refactored into its own library |
| 21 | +otter.nvim <https://github.com/jmbuhr/otter.nvim> for better extensibility. |
15 | 22 |
|
16 | | - Run quarto preview on the current file or project. |
| 23 | +SETUP *quarto-setup* |
17 | 24 |
|
18 | | - :QuartoPreview |
| 25 | +Install the plugin from GitHub with your favourite neovim plugin manager e.g. |
19 | 26 |
|
| 27 | +packer.nvim <https://github.com/wbthomason/packer.nvim>: |
20 | 28 |
|
| 29 | +> |
| 30 | + use { 'quarto-dev/quarto-nvim', |
| 31 | + requires = { |
| 32 | + 'neovim/nvim-lspconfig', |
| 33 | + 'jmbuhr/otter.nvim' |
| 34 | + } |
| 35 | + } |
| 36 | +< |
21 | 37 |
|
22 | 38 |
|
23 | | - vim:tw=78:ts=8:ft=help:norl: |
| 39 | +or lazy <https://github.com/folke/lazy.nvim> |
| 40 | + |
| 41 | +> |
| 42 | + { 'quarto-dev/quarto-nvim', |
| 43 | + dependencies = { |
| 44 | + 'jmbuhr/otter.nvim', |
| 45 | + 'neovim/nvim-lspconfig' |
| 46 | + }, |
| 47 | +< |
| 48 | + |
| 49 | + |
| 50 | +or vim-plug <https://github.com/junegunn/vim-plug> |
| 51 | + |
| 52 | +> |
| 53 | + Plug 'quarto-dev/quarto-nvim' |
| 54 | + Plug 'neovim/nvim-lspconfig' |
| 55 | + Plug 'jmbuhr/otter.nvim' |
| 56 | +< |
| 57 | + |
| 58 | + |
| 59 | +USAGE *quarto-usage* |
| 60 | + |
| 61 | +PREVIEW ~ |
| 62 | + |
| 63 | +Use the command |
| 64 | + |
| 65 | +> |
| 66 | + QuartoPreview |
| 67 | +< |
| 68 | + |
| 69 | + |
| 70 | +or access the function from lua, e.g. to create a keybinding: |
| 71 | + |
| 72 | +> |
| 73 | + local quarto = require'quarto' |
| 74 | + vim.keymap.set('n', '<leader>qp', quarto.quartoPreview, {silent = true, noremap = true}) |
| 75 | +< |
| 76 | + |
| 77 | + |
| 78 | +Then use the keyboard shortcut to open `quarto preview` for the current file or |
| 79 | +project in the active working directory in the neovim integrated terminal in a |
| 80 | +new tab. |
| 81 | + |
| 82 | +CONFIGURE *quarto-configure* |
| 83 | + |
| 84 | +You can pass a lua table with options to the setup function. It will be merged |
| 85 | +with the default options, which are shown below in the example (i.e. if you |
| 86 | +are fine with the defaults you don’t have to call the setup function). |
| 87 | + |
| 88 | +> |
| 89 | + require'quarto'.setup{ |
| 90 | + debug = false, |
| 91 | + closePreviewOnExit = true, |
| 92 | + lspFeatures = { |
| 93 | + enabled = false, |
| 94 | + languages = { 'r', 'python', 'julia' }, |
| 95 | + diagnostics = { |
| 96 | + enabled = true, |
| 97 | + triggers = { "BufWrite" } |
| 98 | + }, |
| 99 | + completion = { |
| 100 | + enabled = false, |
| 101 | + }, |
| 102 | + }, |
| 103 | + keymap = { |
| 104 | + hover = 'K', |
| 105 | + definition = 'gd' |
| 106 | + } |
| 107 | + } |
| 108 | +< |
| 109 | + |
| 110 | + |
| 111 | +LANGUAGE SUPPORT (WIP) *quarto-language-support-(wip)* |
| 112 | + |
| 113 | +DEMO ~ |
| 114 | + |
| 115 | + |
| 116 | +https://user-images.githubusercontent.com/17450586/209436101-4dd560f4-c876-4dbc-a0f4-b3a2cbff0748.mp4 |
| 117 | + |
| 118 | +USAGE ~ |
| 119 | + |
| 120 | +Enable quarto-nvim’s lsp features by configuring it with |
| 121 | + |
| 122 | +> |
| 123 | + require'quarto'.setup{ |
| 124 | + lspFeatures = { |
| 125 | + enabled = true, |
| 126 | + } |
| 127 | + } |
| 128 | +< |
| 129 | + |
| 130 | + |
| 131 | +Or explicitly run |
| 132 | + |
| 133 | +> |
| 134 | + QuartoActivate |
| 135 | + QuartoDiagnostics |
| 136 | +< |
| 137 | + |
| 138 | + |
| 139 | +or |
| 140 | + |
| 141 | +> |
| 142 | + lua require'quarto'.activate |
| 143 | + lua require'quarto'.enableDiagnostics |
| 144 | +< |
| 145 | + |
| 146 | + |
| 147 | +After enabling the language features, you can open the hover documentation for |
| 148 | +R, python and julia code chunks with `K` (or configure a different shortcut). |
| 149 | + |
| 150 | +AUTOCOMPLETION ~ |
| 151 | + |
| 152 | +`quarto-nvim` now comes with a completion source for nvim-cmp |
| 153 | +<https://github.com/hrsh7th/nvim-cmp> to deliver swift autocompletion for code |
| 154 | +in quarto code chunks. With the quarto language features enabled, you can add |
| 155 | +the source in your `cmp` configuration: |
| 156 | + |
| 157 | +> |
| 158 | + -- ... |
| 159 | + sources = { |
| 160 | + { name = 'otter' }, |
| 161 | + } |
| 162 | + -- ... |
| 163 | +< |
| 164 | + |
| 165 | + |
| 166 | +R DIAGNOSTICS CONFIGURATION ~ |
| 167 | + |
| 168 | +To make diagnostics work with R you have to configure the linter a bit, since |
| 169 | +the language buffers in the background separate code with blank links, which we |
| 170 | +want to ignore. Otherwise you get a lot more diagnostics than you probably |
| 171 | +want. Add file `.lintr` to your home folder and fill it with: |
| 172 | + |
| 173 | +> |
| 174 | + linters: linters_with_defaults( |
| 175 | + trailing_blank_lines_linter = NULL, |
| 176 | + trailing_whitespace_linter = NULL |
| 177 | + ) |
| 178 | +< |
| 179 | + |
| 180 | + |
| 181 | +You can now also enable other lsp features, such as the show hover function and |
| 182 | +shortcut, independent of showing diagnostics by enabling lsp features but not |
| 183 | +enabling diagnostics. |
| 184 | + |
| 185 | +OTHER EDGECASES ~ |
| 186 | + |
| 187 | +Other languages might have similar issues (e.g. I see a lot of warnings about |
| 188 | +whitespace when activating diagnostics with `lua`). If you come across them and |
| 189 | +have a fix, I will be very happy about a pull request! Or, what might |
| 190 | +ultimately be the cleaner way of documenting language specific issues, an entry |
| 191 | +in the wiki <https://github.com/quarto-dev/quarto-nvim/wiki>. |
| 192 | + |
| 193 | +AVAILABLE COMMNDS *quarto-available-commnds* |
| 194 | + |
| 195 | +> |
| 196 | + QuartoPreview |
| 197 | + QuartoClosePreview |
| 198 | + QuartoHelp <..> |
| 199 | + QuartoActivate |
| 200 | + QuartoDiagnostics |
| 201 | + QuartoHover |
| 202 | +< |
| 203 | + |
| 204 | + |
| 205 | +RECOMMENDED PLUGINS *quarto-recommended-plugins* |
| 206 | + |
| 207 | +Quarto works great with a number of existing plugins in the neovim ecosystem. |
| 208 | +You can find semi-opinionated but still minimal configurations for `nvim` and |
| 209 | +`tmux`, for use with quarto, R and python in these two repositories: |
| 210 | + |
| 211 | + |
| 212 | +- https://github.com/jmbuhr/quarto-nvim-kickstarter |
| 213 | +- https://github.com/jmbuhr/tmux-kickstarter |
| 214 | + |
| 215 | + |
| 216 | +Generated by panvimdoc <https://github.com/kdheepak/panvimdoc> |
| 217 | + |
| 218 | +vim:tw=78:ts=8:noet:ft=help:norl: |
0 commit comments