Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
b361f34
LSP completion
jalvesaq Oct 18, 2025
085b56b
rnvimserver as LSP
jalvesaq Oct 19, 2025
2ec9b4a
Escape documentation string for json
jalvesaq Oct 20, 2025
1b46cd7
Use only letters for the 'cls' field
jalvesaq Oct 20, 2025
983013c
bug fixes
jalvesaq Oct 20, 2025
5dfd67f
new get_word()
jalvesaq Oct 21, 2025
bbb6879
disable valgrind
jalvesaq Oct 21, 2025
a1e350d
Improve rhelp keyword completion
jalvesaq Oct 21, 2025
4ab6d34
Completion of chunk options
jalvesaq Oct 27, 2025
fbbea46
Correct way of setting environment variables
jalvesaq Oct 27, 2025
9f6c2a3
Handle shutdown method
jalvesaq Oct 27, 2025
4464c22
Add missing files
jalvesaq Oct 27, 2025
b1d53bd
Add debugging functions: on_init and on_attach
jalvesaq Oct 27, 2025
fe5d2b6
fix bug when completing function arguments
jalvesaq Oct 27, 2025
7c192aa
Disable on_init and on_attach
jalvesaq Oct 27, 2025
d2b88c5
Move resolve function to resolve.c
jalvesaq Oct 27, 2025
0146049
Move resolve() to resolve.c
jalvesaq Oct 27, 2025
7ed477c
Bug fixes
jalvesaq Oct 27, 2025
3b129f7
Bug fixes
jalvesaq Oct 28, 2025
40bb14a
Add r_ls config option
jalvesaq Oct 30, 2025
218abdb
Implement resolve of chunk options
jalvesaq Oct 30, 2025
0e529b1
Implement completion of @fig and @tbl
jalvesaq Oct 30, 2025
d4b4e99
Complete arguments of .GlobalEnv functions
jalvesaq Nov 1, 2025
3b11a16
Document some Lua functions
jalvesaq Nov 1, 2025
6d3e054
bug fixes
jalvesaq Nov 1, 2025
ed19ed0
Fix `\rh`
jalvesaq Nov 1, 2025
9fbedd3
Fix highlighting of negative float number
jalvesaq Nov 2, 2025
14151d7
Minor optimizations
jalvesaq Nov 2, 2025
9fbf34b
Less verbose
jalvesaq Nov 2, 2025
006ee9c
Improve formatting of doc (resolve event)
jalvesaq Nov 2, 2025
0069b48
Update `:checkhealth r`
jalvesaq Nov 2, 2025
2bc7077
Update Neovim version requirement in R.nvim.txt
jalvesaq Nov 2, 2025
cad90ca
Allow `\rf` after `\rq`
jalvesaq Nov 2, 2025
f4e2331
Use `source` instead of `short_src` from debug.getinfo()
jalvesaq Nov 2, 2025
d98cabc
Fix cppcheck warnings
jalvesaq Nov 3, 2025
ca87ea4
Fix selene warnings
jalvesaq Nov 3, 2025
7b0d1e4
Get tree-sitter captures from correct line and column
jalvesaq Nov 4, 2025
6109bb0
Remove from completion data no longer used default value of arguments
jalvesaq Nov 4, 2025
7de16a3
Complete only function arguments if base is NULL
jalvesaq Nov 5, 2025
7b1fae6
Remove excess of comments
jalvesaq Nov 5, 2025
4244baa
Compare r.cursor.get_first_obj with r.lsp.need_R_args
jalvesaq Nov 5, 2025
3b5c22a
Don't freeze if the cursor is on line 1
jalvesaq Nov 5, 2025
850b379
More keywords from R-exts.html
jalvesaq Nov 5, 2025
64689ed
Fix `:RInsert`
jalvesaq Nov 5, 2025
97f41bd
Don't delete second level config options
jalvesaq Nov 5, 2025
8383167
Run `is_in_quarto_yaml` less frequently
jalvesaq Nov 5, 2025
0cabc54
Hover and signature methods not implemented yet
jalvesaq Nov 5, 2025
23f8961
Implement `sortText` during completion
jalvesaq Nov 5, 2025
b96d0d5
Rename the resolve function
jalvesaq Nov 5, 2025
4107dfe
Delete outdated comments
jalvesaq Nov 5, 2025
af7c6a4
Fix completion of columns of piped data frames
jalvesaq Nov 5, 2025
fc36334
Begin implementation of hover
jalvesaq Nov 6, 2025
0dc387f
Bring back default value of function arguments
jalvesaq Nov 6, 2025
82de1a8
Fix order of function arguments
jalvesaq Nov 6, 2025
b95d836
Implement signatureHelp
jalvesaq Nov 6, 2025
40d7051
Fix fuzzy find
jalvesaq Nov 6, 2025
2031727
Fix bugs when config.register_treesitter is false
jalvesaq Nov 6, 2025
901fb86
Send null if there is nothing to send
jalvesaq Nov 6, 2025
2e72c38
Implement hover for .GlobalEnv
jalvesaq Nov 6, 2025
91793d0
Minor change in hover documentation
jalvesaq Nov 6, 2025
eb25311
Delete nvimcom_squo
jalvesaq Nov 6, 2025
f6737b8
Preserve the equal sign of argument items during resolve event
jalvesaq Nov 6, 2025
dc5a07b
Fix completion of columns of piped data.frame
jalvesaq Nov 7, 2025
abc3091
Remove semicolon from list of trigger characters, and don't set the v…
jalvesaq Nov 7, 2025
ce20d33
Update documentation
jalvesaq Nov 7, 2025
430941f
Add space after equals sign in argument completion (#451)
PMassicotte Nov 7, 2025
0aea9bb
Implement options to disable hover, signature, and completion
jalvesaq Nov 7, 2025
bd690f9
Attach the LSP server to all buffers
jalvesaq Nov 8, 2025
6dac2e1
Remove debugging messages
jalvesaq Nov 8, 2025
bc1b027
Fix sortOrder of arguments of .GlobalEnv functions
jalvesaq Nov 8, 2025
be5908c
Don't send empty signature [e.g. for(), while()]
jalvesaq Nov 8, 2025
e6d647a
Implement signature of .GlobalEnv functions
jalvesaq Nov 8, 2025
9b52315
Fix capabilities and sen null where there is no completion item
jalvesaq Nov 8, 2025
847b183
Use `* * * ` as thematic break instead of `---`
jalvesaq Nov 8, 2025
f6f77df
Check if word for signature is function
jalvesaq Nov 8, 2025
d53c7e9
Add tree=sitter parser for rout
jalvesaq Nov 8, 2025
04edadd
Add README to `tree_sitter_rout`.
jalvesaq Nov 8, 2025
e23badd
Don't run valgrind
jalvesaq Nov 8, 2025
1a47262
Fix opening list in Obj. Browser and hover over library data.frame
jalvesaq Nov 8, 2025
d835d69
Additional option to customize colors or hover window: Rout_follow_co…
jalvesaq Nov 8, 2025
cddf769
Update Obj Browser cls symbols
jalvesaq Nov 9, 2025
b52a806
Delete unused variable and update Makefile.win
jalvesaq Nov 9, 2025
3df3800
Changes:
jalvesaq Nov 9, 2025
b0b0554
Rename `tree_sitter_rout` as `tree-sitter-rout`
jalvesaq Nov 9, 2025
a1385a6
Give signature.c its own buffer to fill
jalvesaq Nov 9, 2025
51588e1
Fix bug introduced today
jalvesaq Nov 9, 2025
6d87d36
Show the output of summary() if method exists
jalvesaq Nov 9, 2025
efe2f2c
Replace Vim syntax (no longer works) with extension marks
jalvesaq Nov 9, 2025
da777af
Colorize some lines of the log
jalvesaq Nov 9, 2025
3440e0e
Improve grammar.js for summary of data.frames
jalvesaq Nov 9, 2025
aeaf037
Standardize the use of size_t (don't mix with unsigned long)
jalvesaq Nov 9, 2025
195ae35
Don't share the same buffer with various methods
jalvesaq Nov 9, 2025
2f2fca6
Ensure that vim.g.R_Nvim_status is set
jalvesaq Nov 9, 2025
2eb9cec
Set dynamically the value of `doc_width`
jalvesaq Nov 9, 2025
a781dcc
If a function is generic check the method according to the first argu…
jalvesaq Nov 11, 2025
05cf995
Dash instead of asterisks
jalvesaq Nov 11, 2025
8217e28
Increase nvimcom version
jalvesaq Nov 11, 2025
0011d4d
Check if variable is NULL
jalvesaq Nov 11, 2025
f68bce4
Remove gcc warnings
jalvesaq Nov 11, 2025
1973541
Lua: Remove code depending on nvim < 0.11.4
jalvesaq Nov 11, 2025
7469c22
Improve tree-sitter-rout
jalvesaq Nov 14, 2025
0ed9c88
Automatically compile rout tree-sitter parser
jalvesaq Nov 14, 2025
38d3dba
Delete remaining references to cmp-r
jalvesaq Nov 14, 2025
dfdc806
Suppress warning when getting method
jalvesaq Nov 14, 2025
610b24b
Fix completion of data.frame columns
jalvesaq Nov 14, 2025
f6ae623
increase nvimcom version
jalvesaq Nov 14, 2025
0b87823
Complete column of data.frames before starting R
jalvesaq Nov 14, 2025
e69cc91
Enable hover summary before sending the first line to R
jalvesaq Nov 14, 2025
a2d8f62
Check modification time of parser/rout.so
jalvesaq Nov 14, 2025
f35c02a
Check if tree-sitter is installed
jalvesaq Nov 14, 2025
698c20d
Get function name when arguments are in multiple lines
jalvesaq Nov 15, 2025
dcb0a6b
Fix completion of argument of type `language`
jalvesaq Nov 15, 2025
ecf9fb4
Don't run valgrind
jalvesaq Nov 15, 2025
c6c4ca8
Delete "tree-sitter-rout" directory
jalvesaq Nov 15, 2025
02e0c82
Add submodule tree-sitter-rout
jalvesaq Nov 15, 2025
125acb0
Set old current directory after copying rout.so to parser/
jalvesaq Nov 15, 2025
71cccf7
Update tree-sitter-rout submodule
jalvesaq Nov 15, 2025
12df128
Create `parser` directory if it doesn't exist
jalvesaq Nov 15, 2025
53815d1
Move check of rout parser to config.lua
jalvesaq Nov 15, 2025
4ba43c2
Fix rout parser generation
jalvesaq Nov 15, 2025
fcec021
Fix warning
jalvesaq Nov 15, 2025
1607f30
Improve building of ts parser with code from nvim-treesitter
jalvesaq Nov 15, 2025
071c6c0
Remove TREE_SITTER_JS_RUNTIME = "native"
jalvesaq Nov 16, 2025
f0568e9
Remove --abi restriction
jalvesaq Nov 16, 2025
b0bb626
Attempt to fix the no-response bug on Windows
jalvesaq Nov 16, 2025
0f5b80b
Remove PRI_SIZET macro
jalvesaq Nov 16, 2025
a30a199
Send empty list when there is no completion
jalvesaq Nov 17, 2025
11bf530
Always return empty list if there nothing to complete
jalvesaq Nov 17, 2025
f4ba78c
Fix text of hover for some functions:
jalvesaq Nov 17, 2025
1d69a6b
Delete TODO and FIXME inserted while developing the "lsp" branch
jalvesaq Nov 17, 2025
f17a298
vim.notify within vim.schedule
jalvesaq Nov 17, 2025
16ec635
Set binary mode for stdin and stderr on Windows
jalvesaq Nov 17, 2025
ae831f4
Check if buffer is NULL
jalvesaq Nov 17, 2025
cc6dc9d
Check if more variable are NULL
jalvesaq Nov 17, 2025
4684d7b
Enable logging
jalvesaq Nov 17, 2025
84049ce
Disable logging
jalvesaq Nov 17, 2025
6a3b046
Update nvimcom version number for merging
jalvesaq Nov 17, 2025
a7c71ba
Adjustments following Copilot suggestions
jalvesaq Nov 17, 2025
788203f
Normalize RNVIM_HOME on Windows
jalvesaq Nov 17, 2025
82f7c90
Merge branch 'main' into lsp
jalvesaq Nov 17, 2025
64d0350
Increase version number to 0.99.2
jalvesaq Nov 17, 2025
51037b3
Note on the README
jalvesaq Nov 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ nvimcom/src/apps/*.dll
nvimcom/src/apps/rnvimserver
nvimcom/src/apps/rnvimserver.exe
nvimcom/src/apps/compile_flags.txt
parser/
resources/__pycache__/
resources/*.pyc
resources/tree-sitter-rout/src
.tests
deps
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "tests/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter"]
path = tests/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter
url = https://github.com/nvim-treesitter/nvim-treesitter
[submodule "resources/tree-sitter-rout"]
path = resources/tree-sitter-rout
url = https://github.com/R-nvim/tree-sitter-rout
29 changes: 8 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

# R.nvim

**Note**: the autocompletion depending on
[nvim-cmp](https://github.com/hrsh7th/nvim-cmp) and
[cmp-r](https://github.com/R-nvim/cmp-r) was replaced by a built-in language
server. If you experience problems, please, report the bugs that you have
found, and configure your plugin manager to use version `0.99.1` of `R.nvim`.

R.nvim adds R support to Neovim, including:

- Communication with R via Neovim's built-in terminal or tmux
Expand Down Expand Up @@ -94,22 +100,7 @@ possible options. You can also consult the [Wiki](https://github.com/R-nvim/R.nv

### Autocompletion

R autocompletion should be configured via another plugin. We recommend
[cmp-r](https://github.com/R-nvim/cmp-r), which can be minimally configured
like so:

```lua
{
"R-nvim/cmp-r",
{
"hrsh7th/nvim-cmp",
config = function()
require("cmp").setup({ sources = {{ name = "cmp_r" }}})
require("cmp_r").setup({})
end,
},
},
```
R autocompletion is provided by a built-in language server.

Note that [languageserver](https://github.com/REditorSupport/languageserver)
can also be used for autocompletions, but using autocompletions from both
Expand Down Expand Up @@ -180,8 +171,7 @@ firm commitment to backwards compatibility.

- reStructuredText support (no longer seems to be widely used).

- Legacy omni-completion (we now recommend
[nvim-cmp](https://github.com/hrsh7th/nvim-cmp)).
- Legacy omni-completion (we now recommend the built-in LSP).

- Highlighting functions from `.GlobalEnv` (difficult to make compatible with
tree-sitter + LSP highlighting).
Expand Down Expand Up @@ -334,9 +324,6 @@ but temporary files are used in a few cases.

## See also:

- [cmp-r](https://github.com/R-nvim/cmp-r): autocompletion source for
[nvim-cmp](https://github.com/hrsh7th/nvim-cmp) using R.nvim as backend.

- [languageserver](https://github.com/REditorSupport/languageserver): a
language server for R.

Expand Down
208 changes: 135 additions & 73 deletions doc/R.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Authors: R.nvim team (see: https://github.com/R-nvim)

Version: 0.99.1
For Neovim >= 0.10.4
Version: 0.99.2
For Neovim >= 0.11.4

1. Overview |R.nvim-overview|
2. Main features |R.nvim-features|
Expand Down Expand Up @@ -41,7 +41,8 @@ Git pull requests are welcome.
- Send commands with the object under cursor as argument: help, args,
plot, print, str, summary, example, names.
- Send to R the Sweave, knit and LaTeX commands.
* Auto completion (with `cmp-r`):
* Built-in language server with hover, signature and completion
capabilities. The completion works for:
- R objects (.GlobalEnv and loaded packages).
- function arguments.
- knitr chunk options.
Expand Down Expand Up @@ -84,7 +85,7 @@ Before installing the plugin, you should install its dependencies:

Main dependencies:

Neovim >= 0.10.4:
Neovim >= 0.11.4:
https://github.com/neovim/neovim/releases
See also: https://github.com/neovim/neovim/wiki/Installing-Neovim

Expand All @@ -93,9 +94,6 @@ Main dependencies:
You have to enable highlighting by tree-sitter and install parsers for
`r`, `markdown`, `markdown_inline`, `rnoweb`, `yaml`, `latex`, and `csv`.

cmp-r (for auto-completion):
https://github.com/R-nvim/cmp-r

R >= 4.0.0:
http://www.r-project.org/

Expand Down Expand Up @@ -124,6 +122,10 @@ Main dependencies:
- `rmarkdown`: to generate final documents from Rmd.
- `styler`: to format R code.

The command line application `tree-sitter`, required to compile the
tree-sitter parser for "rout" file type which will properly highlight R
output shown in the hover and resolve windows from the language server.

Additional dependencies for editing Rnoweb documents:

latexmk: Automate the compilation of LaTeX documents.
Expand Down Expand Up @@ -460,10 +462,7 @@ In any case, the PDF viewer must be started by the R.nvim plugin. See


------------------------------------------------------------------------------
4.3. Auto-completion

If `cmp-r` (a source for `nvim-cmp`) is installed, Neovim can
automatically complete the names of R objects as you type them.
4.3. Language server's completion

R.nvim does not complete the names of all functions of all installed packages
(see |start_libs|); only of loaded libraries.
Expand Down Expand Up @@ -572,11 +571,10 @@ background):
<
Notes:

- If either the Object Browser is open or cmp-r is installed, the
list of .GlobalEnv objects will be automatically updated by R after each
successful command evaluation. This may slowdown R if its workspace has
too many objects, data.frames with too many columns or lists with too many
elements.
- The list of .GlobalEnv objects will be automatically updated by R after
each successful command evaluation. This may slowdown R if its workspace
has too many objects, data.frames with too many columns or lists with too
many elements.

- Names of objects are stupidly truncated if they occupy more than 62 bytes.
This means that Unicode sequences might be split and become invalid.
Expand All @@ -599,40 +597,7 @@ definitions.


------------------------------------------------------------------------------
4.6. Syntax highlight of .Rout files

You can set both foreground and background colors of R output in your
`init.lua`. The example below is for an interface of Neovim with
'termguicolors' (see |true-color|):
>lua
if vim.o.termguicolors then
vim.g.rout_color_input = "guifg=#9e9e9e"
vim.g.rout_color_normal = "guifg=#ff5f00"
vim.g.rout_color_number = "guifg=#ffaf00"
vim.g.rout_color_integer = "guifg=#feaf00"
vim.g.rout_color_float = "guifg=#fdaf00"
vim.g.rout_color_complex = "guifg=#fcaf00"
vim.g.rout_color_negnum = "guifg=#d7afff"
vim.g.rout_color_negfloat = "guifg=#d6afff"
vim.g.rout_color_date = "guifg=#00d7af"
vim.g.rout_color_true = "guifg=#5dd685"
vim.g.rout_color_false = "guifg=#ff5d5e"
vim.g.rout_color_inf = "guifg=#10aed7"
vim.g.rout_color_constant = "guifg=#5fafcf"
vim.g.rout_color_string = "guifg=#5fd7af"
vim.g.rout_color_error = "guifg=#ffffff guibg=#c40000"
vim.g.rout_color_warn = "guifg=#d00000"
vim.g.rout_color_index = "guifg=#d0d080"
end
<
If you prefer that R output is highlighted using your current `colorscheme`,
put in your `init.lua`:
>lua
vim.g.rout_follow_colorscheme = true
<

------------------------------------------------------------------------------
4.7. Debugging R functions (Unix only) *debug-R-functions*
4.6. Debugging R functions (Unix only) *debug-R-functions*

`R.nvim` has limited debugging facilities available on Unix systems (not
available on Windows). To debug a function with R.nvim you have to do the
Expand Down Expand Up @@ -709,7 +674,7 @@ defined by your colorscheme.


------------------------------------------------------------------------------
4.8 roxygen2 support *R.nvim-roxygen2*
4.7 roxygen2 support *R.nvim-roxygen2*

R.nvim supports the insertion of roxygen2 skeletons in R scripts. To insert a
new roxygen2 block, you can use the `:ROxygenize` command while the cursor is
Expand Down Expand Up @@ -754,10 +719,11 @@ on your system.
5.3. Object Browser and auto-completion limitations

New lines in list names and column names in data frames and matrices are
replaced with blank spaces in the data used by `cmp-r` and the Object Browser.
replaced with blank spaces in the data used by the language server which
affects completion and the Object Browser.

Objects from environments accessed with the `browser()` function are not
listed in the Object Browser or during auto-completion with `cmp-r`.
listed in the Object Browser or during completion.


------------------------------------------------------------------------------
Expand Down Expand Up @@ -910,8 +876,8 @@ You may close the window opened by `:RConfigShow` by simply pressing `q`.
|R_path| Directory where R is
|R_app|, |R_cmd| Names of R applications
|R_args| Arguments to pass to R
|start_libs| Objects for auto completion
|Rout_more_colors| More syntax highlighting in R output
|R-language-server| Options R.nvim's built-in language server
|Rout_options| More syntax highlighting in R output
|routnotab| Show output of R CMD BATCH in new window
|config_tmux| Don't use a specially built Tmux config file
|rconsole_height| Number of lines of R Console
Expand Down Expand Up @@ -1482,28 +1448,67 @@ The default value for |R_args| is an empty Lua table:
<

------------------------------------------------------------------------------
6.10. Auto-completion *start_libs*
6.10. Language server *R-language-server*

There are two ways of getting automatic completion of R objects names while
you type: using R.nvim's built-in completion system (as a source for
`nvim-cmp`) and using a language server. See:

https://github.com/jalvesaq/cmp-r
https://github.com/REditorSupport/languageserver
you type, signature help and hover support: using R.nvim's built-in language
server or using the R package `languageserver`. See:
https://github.com/REditorSupport/languageserver

The advantage of R.nvim's built-in system is the ability to complete objects
of the R's workspace (`.GlobalEnv`), including column names of data.frames.

Note: If you are using the `languageserver` package, you should disable its
auto completion feature in your `~/.Rprofile` to get completions from
`cmp-r`:
Note: If you are using the `languageserver` package, you should disable in
your `~/.Rprofile` the features that overlap with R.nvim's ones:
>r
options(languageserver.server_capabilities =
list(completionProvider = FALSE,
completionItemResolve = FALSE))
list(hoverProvider = FALSE,
signatureHelpProvider = FALSE,
completionProvider = FALSE,
completionItemResolve = FALSE))
<
Alternatively, you can disable or change R.nvim's built-in language server
features in your R.nvim config. Below are the default values:
>lua
r_ls = {
completion = true, -- enable the completion provider
hover = true, -- enable the hover provider
signature = true, -- enable the signature help provider
doc_width = 0,
fun_data_1 = { "select", "rename", "mutate", "filter" },
fun_data_2 = { ggplot = { "aes" }, with = { "*" } },
quarto_intel = nil,

}
<
If you prefer to get completions from the language server, `cmp-r` should
not be installed.
Meaning of optons:

- `completion`: Enable the completion provider

- `hover`: Enable the hover provider

- `signature`: Enable the signature help provider

- `doc_width`: The expected maximum width of the floating documentation
window. The default value will be between 30 and 80 columns, depending
on the screen width.

- `fun_data_1`: List of functions that receive a `data.frame` as its first
argument and for which the `data.frame`s columns names should be
completed. This option is overridden by `g:R_fun_data_1`. Default:
`{'select', 'rename', 'mutate', 'filter'}`.

- `fun_data_2`: Dictionary with parent functions as keys. The value of each
key is a list of functions that are expected to be nested in the parent
function which receives a data.frame as its first arguments. Column names
of the `data.frame` are completed as arguments of the nested function.
This option is overridden by `g:R_fun_data_1`.
Default: `{ggplot = {'aes'}, with = {'*'}}`.

- `quarto_intel`: Path to `yaml-intelligence-resources.json` which is part
of `quarto` application and has all necessary information for completion
of valid YAML options in an Quarto document. Default: `nil` (R.nvim will
try to find the file).

The list of objects for auto completion is built dynamically as the libraries
are loaded by R. If R is running, only the names of objects in .GlobalEnv and
Expand All @@ -1514,20 +1519,77 @@ names completed. However, you can set the value of `start_libs` if you want
that objects of specific packages are available for auto completion even if R
is not running yet. Below is the default value of `start_libs`:
>lua
start_libs = "base,stats,graphics,grDevices,utils,methods"
start_libs = "base,stats,graphics,grDevices,utils,datasets,methods"
<
------------------------------------------------------------------------------
6.11. Rout highlighting *Rout_more_colors*
6.11. Rout highlighting *Rout_options*

By default, the R commands in .Rout files are highlighted with the color of
comments, and only the output of commands has some of its elements highlighted
(numbers, strings, index of vectors, warnings and errors).
By default, the R commands in .Rout files are highlighted in a gray color, and
only the output of commands has some of its elements highlighted (numbers,
strings, index of vectors, warnings and errors).

If you prefer that R commands in the R output are highlighted as they are in R
scripts, put the following in your config:
*Rout_more_colors*
>lua
Rout_more_colors = true
<
*Rout_follow_colorscheme*
The colors of R output do not match the colors of your colorscheme by default
The rationale is that the highlighting of code should help the user to grasp
the code structure while highlighting of output should help the user to focus
on the most important part of the results: the numbers. However, if you prefer
the highlighting of Rout files (and R output in the built-in Neovim terminal)
to follow your colorscheme, put in R.nvim config:
>lua
Rout_follow_colorscheme = true
<
You can also set both foreground and background colors of R output in your
`init.lua`. Because the syntax highlighting uses a traditional Vim syntax
script, its configuration is through Vim global variables, as in the example
below:
>lua
if vim.o.termguicolors then
vim.g.rout_color_input = "guifg=#9e9e9e"
vim.g.rout_color_normal = "guifg=#ff5f00"
vim.g.rout_color_number = "guifg=#ffaf00"
vim.g.rout_color_integer = "guifg=#feaf00"
vim.g.rout_color_float = "guifg=#fdaf00"
vim.g.rout_color_complex = "guifg=#fcaf00"
vim.g.rout_color_negnum = "guifg=#d7afff"
vim.g.rout_color_negfloat = "guifg=#d6afff"
vim.g.rout_color_date = "guifg=#00d7af"
vim.g.rout_color_true = "guifg=#5dd685"
vim.g.rout_color_false = "guifg=#ff5d5e"
vim.g.rout_color_inf = "guifg=#10aed7"
vim.g.rout_color_constant = "guifg=#5fafcf"
vim.g.rout_color_string = "guifg=#5fd7af"
vim.g.rout_color_error = "guifg=#ffffff guibg=#c40000"
vim.g.rout_color_warn = "guifg=#d00000"
vim.g.rout_color_index = "guifg=#d0d080"
end
<
A subset of `Rout` highlighting groups is used to highlight the hover window
from R.nvim built-in language server when hovering over a `data.frame` or
`numeric` object. In this case, the language server will display the output of
either `summary()` or `str()` and you can change the foreground colors by
setting the value of `r_ls.rout_fg_colors` elements, as in the example:
>lua
r_ls = {
rout_fg_colors = {
Normal = "#ff5f00",
Number = "#ffaf00",
Negnum = "#d7afff",
Constant = "#5fafcf",
False = "#ffd5e",
True = "#5dd685",
Inf = "#10aed7",
}
}
<
If `Rout_follow_colorscheme` is `true` the colors of you colorscheme will be
used in the hover floating window too.

When syntax highlighting .Rout files, R.nvim considers "> " as the prompt
string and "+ " as the continuation string. If you have defined different
prompt and continuation strings in your `~/.Rprofile`, R.nvim will try to get
Expand Down
Loading