Skip to content

Commit 37615da

Browse files
authored
Fix text width of documentation (#597)
1 parent 102ef60 commit 37615da

2 files changed

Lines changed: 76 additions & 64 deletions

File tree

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ A longer example adding some custom behaviour:
9393
rconsole_width = 78,
9494
objbr_mappings = { -- Object browser keymap
9595
c = 'class', -- Call R functions
96-
['<localleader>gg'] = 'head({object}, n = 15)', -- Use {object} notation to write arbitrary R code.
96+
-- Use {object} notation to write arbitrary R code.
97+
['<localleader>gg'] = 'head({object}, n = 15)',
9798
v = function()
9899
-- Run lua functions
99100
require('r.browser').toggle_view()
@@ -218,9 +219,9 @@ firm commitment to backwards compatibility.
218219
- `R_source` and `after_R_start` have been replaced with more powerful `hook`
219220
options.
220221

221-
- `nvimpager`, which controls how R documentation is displayed, now has possible
222-
options `"split_h"`, `"split_v"`, `"tab"`, `"float"` (not implemented yet),
223-
and `"no"`.
222+
- `nvimpager`, which controls how R documentation is displayed, now has
223+
possible options `"split_h"`, `"split_v"`, `"tab"`, `"float"` (not
224+
implemented yet), and `"no"`.
224225

225226
- `open_pdf` replaces `openpdf` and `openhtml`; see the documentation for
226227
details.
@@ -314,15 +315,17 @@ firm commitment to backwards compatibility.
314315

315316
- `R-language-server` sets options for R.nvim's built-in language server.
316317

317-
- `max_paste_lines` sets the maximum number of lines to be pasted into R Console.
318+
- `max_paste_lines` sets the maximum number of lines to be pasted into R
319+
Console.
318320

319321
- `debug` enables support for debugging functions.
320322

321323
- `chunk_langs` changes configuration for code chunk languages.
322324

323325
## Screenshots and videos
324326

325-
None yet! Please let us know if you publish a video presenting R.nvim features 😃
327+
None yet! Please let us know if you publish a video presenting R.nvim features
328+
😃
326329

327330
## Troubleshooting
328331

@@ -332,7 +335,7 @@ None yet! Please let us know if you publish a video presenting R.nvim features
332335
`colorout::isColorOut()` which in previous `colorout` versions was unduly
333336
enabling the output colorizing.
334337

335-
## How R.nvim communicates with your R session
338+
## How R.nvim communicates with R
336339

337340
The diagram below shows how the communication between Neovim and R works.
338341
![Neovim-R communication](https://raw.githubusercontent.com/R-Nvim/R.nvim/main/nvimrcom.svg "Neovim-R communication")
@@ -356,8 +359,8 @@ server. When _nvimcom_ is loaded, it immediately starts a TCP client that
356359
connects to _rnvimserver_ (red arrows).
357360

358361
Some commands that you trigger are not pasted into R Console and do not output
359-
anything in the R Console; their results are seen in the editor itself. These are
360-
the commands to do auto completion (of names of objects and function
362+
anything in the R Console; their results are seen in the editor itself. These
363+
are the commands to do auto completion (of names of objects and function
361364
arguments), start and manipulate the Object Browser (`\ro`, `\r=` and `\r-`),
362365
call R help (`\rh` or `:Rhelp`), insert the output of an R command
363366
(`:Rinsert`), and format selected text (`:Rformat`).
@@ -377,8 +380,8 @@ but temporary files are used in a few cases.
377380
- [colorout](https://github.com/jalvesaq/colorout): a package to colorize R's
378381
output.
379382

380-
- [Ark](https://github.com/posit-dev/ark): a LSP server/DAP server/Jupyter kernel
381-
for R.
383+
- [Ark](https://github.com/posit-dev/ark): a LSP server/DAP server/Jupyter
384+
kernel for R.
382385

383386
- [southernlights](https://github.com/jalvesaq/southernlights): a colourscheme
384387
for vim.

doc/R.nvim.txt

Lines changed: 62 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ lists are built. To suppress these messages, add the following to your
509509
<
510510

511511
------------------------------------------------------------------------------
512-
4.4.1. Quarto YAML completion *R.nvim-quarto-completion*
512+
4.4.1. Quarto YAML completion *R.nvim-quarto-completion*
513513

514514
R.nvim provides intelligent YAML completion for Quarto documents and project
515515
files through integration with the YAML Language Server (yamlls). This feature
@@ -562,8 +562,8 @@ Neovim applies the built-in `LspReferenceText`, `LspReferenceRead`, and
562562
`LspReferenceWrite` highlight groups. You can customise them in your
563563
`init.lua`. For example:
564564
>lua
565-
vim.api.nvim_set_hl(0, "LspReferenceText", { bg = "#3F5865", fg = "white" })
566-
vim.api.nvim_set_hl(0, "LspReferenceRead", { link = "LspReferenceText" })
565+
vim.api.nvim_set_hl(0, "LspReferenceText", { bg = "#3F5865", fg = "white" })
566+
vim.api.nvim_set_hl(0, "LspReferenceRead", { link = "LspReferenceText" })
567567
vim.api.nvim_set_hl(0, "LspReferenceWrite", { bg = "#3a5a7a", fg = "white" })
568568
<
569569
Whether highlights are triggered automatically on `CursorHold` or manually
@@ -678,8 +678,9 @@ following:
678678
in the R Console, run either `debug(funcname)` or `debugonce(funcname)`
679679
where `funcname` is the name of the function (not quoted). R.nvim will
680680
send this command to R Console if you press <LocalLeader>bg in Normal
681-
mode with the cursor over the function name. Use `<LocalLeader>ud` with the cursor on a function to undebug it. An example of using
682-
`browser` is shown later in the documentation.
681+
mode with the cursor over the function name. Use `<LocalLeader>ud` with
682+
the cursor on a function to undebug it. An example of using `browser` is
683+
shown later in the documentation.
683684

684685
3. Call the function.
685686

@@ -992,7 +993,7 @@ You may close the window opened by `:RConfigShow` by simply pressing `q`.
992993
|rmarkdown_args| Further options to be passed to `rmarkdown::render()`
993994
|quarto_render_args| Options to be passed to `quarto::quarto_render()`
994995
|quarto_preview_args| Options to be passed to `quarto::quarto_preview()`
995-
|chunk_hl| How to highlight chunks in Quarto, Rmd, Rnoweb and Rtypst
996+
|chunk_hl| Chunk highlighting in Quarto, Rmd, Rnoweb and Rtypst
996997
|clear_line| Clear R Console line before sending a command
997998
|editing_mode| The mode defined in your `~/.inputrc`
998999
|pdfviewer| PDF application used to open PDF documents
@@ -1158,10 +1159,10 @@ options:
11581159
7. alacritty
11591160
8. xterm
11601161

1161-
If the value of `external_term` is `"default"`, the plugin runs the first terminal
1162-
emulator that it finds from the above list. If your favorite terminal emulator
1163-
is not selected, you may define it in your config. Below are some examples of
1164-
how to set the value of `external_term`:
1162+
If the value of `external_term` is `"default"`, the plugin runs the first
1163+
terminal emulator that it finds from the above list. If your favorite terminal
1164+
emulator is not selected, you may define it in your config. Below are some
1165+
examples of how to set the value of `external_term`:
11651166
>lua
11661167
external_term = "default" -- Run R in an external terminal
11671168
external_term = "konsole" -- Run R in konsole
@@ -1201,7 +1202,8 @@ be used to run R in a split pane. Examples:
12011202
Note: for `external_term = "kitty_split"`, Kitty must be ready to receive
12021203
remote commands. Example:
12031204
>sh
1204-
kitty --instance-group "kitty_sock" -o allow_remote_control=yes --listen-on unix:/tmp/.kitty_sock
1205+
kitty --instance-group "kitty_sock" -o allow_remote_control=yes \
1206+
--listen-on unix:/tmp/.kitty_sock
12051207
<
12061208
You will also need the option `enabled_layouts splits` in your Kitty config.
12071209

@@ -1229,7 +1231,8 @@ If R cannot find either `make` or `gcc` while trying to compile nvimcom, you
12291231
should add their directories to the beginning of the `PATH` environment
12301232
variable in your |init.lua|. Example:
12311233
>lua
1232-
vim.env.PATH = "C:\\rtools45\\mingw64\\bin;C:\\rtools45\\usr\\bin;" .. vim.env.PATH
1234+
vim.env.PATH = "C:\\rtools45\\mingw64\\bin;C:\\rtools45\\usr\\bin;" ..
1235+
vim.env.PATH
12331236
<
12341237
The plugin sets `$HOME` as the Windows register value for "Personal" "Shell
12351238
Folders" which is the same value set by R. However, if you have set `$HOME`
@@ -1258,15 +1261,15 @@ Valid values are "native" and "magrittr":
12581261
<
12591262

12601263
------------------------------------------------------------------------------
1261-
6.6. Object Browser and completion options *objbr_w*
1262-
*objbr_h*
1263-
*objbr_place*
1264-
*objbr_opendf*
1265-
*objbr_openlist*
1266-
*objbr_allnames*
1267-
*compl_data*
1268-
*objbr_mappings*
1269-
*objbr_placeholder*
1264+
6.6. Object Browser and completion options *objbr_w*
1265+
*objbr_h*
1266+
*objbr_place*
1267+
*objbr_opendf*
1268+
*objbr_openlist*
1269+
*objbr_allnames*
1270+
*compl_data*
1271+
*objbr_mappings*
1272+
*objbr_placeholder*
12701273
By default, the Object Browser will be created at the right of the script
12711274
window, and with 40 columns. Valid values for the Object Browser placement are
12721275
the combination of either "script" or "console" and "right", "left", "above",
@@ -1352,17 +1355,21 @@ change.
13521355
Completion lists are built in parallel, using all but two of the cores
13531356
reported by `parallel::detectCores()`. On systems where this number does not
13541357
reflect the resources actually available to the process, like an HPC
1355-
cluster where CPUs are allocated as portions of the total available on the hardware,
1356-
you can cap the number of cores with the `nvimcom.max_cpu_cores` option in your ~/.Rprofile:
1358+
cluster where CPUs are allocated as portions of the total available on the
1359+
hardware, you can cap the number of cores with the `nvimcom.max_cpu_cores`
1360+
option in your ~/.Rprofile:
13571361
>r
13581362
options(nvimcom.max_cpu_cores = 4)
13591363

1360-
This value can come from environment variables. For example, on an HPC cluster using
1361-
the Slurm scheduler, you can set the option to the value of the environment variable `SLURM_CPUS_PER_TASK` or, if it's not available (for example, you have not specified
1362-
`cpus-per-task` for the job and only get the default number of CPUs), then fall back to 2:
1364+
This value can come from environment variables. For example, on an HPC cluster
1365+
using the Slurm scheduler, you can set the option to the value of the
1366+
environment variable `SLURM_CPUS_PER_TASK` or, if it's not available (for
1367+
example, you have not specified `cpus-per-task` for the job and only get the
1368+
default number of CPUs), then fall back to 2:
13631369

13641370
>r
1365-
options(nvimcom.max_cpu_cores = max(2, as.numeric(Sys.getenv("SLURM_CPUS_PER_TASK"))))
1371+
options(nvimcom.max_cpu_cores =
1372+
max(2, as.numeric(Sys.getenv("SLURM_CPUS_PER_TASK"))))
13661373

13671374
It is possible to add a custom keymap through `objbr_mappings` table. The
13681375
keymap defined in this table will be available in the object browser only.
@@ -1417,18 +1424,19 @@ browser. Here you should define `objbr_placeholder` in your `config` table.
14171424
},
14181425
objbr_placeholder = '@@'
14191426
<
1420-
One might need to use special keys (e.g., <localleader>, <CR>, etc) when defining a
1421-
keymap. Lua allows the use *bracket notation* to use non-alphanumeric
1422-
characters in table keys.
1427+
One might need to use special keys (e.g., <localleader>, <CR>, etc) when
1428+
defining a keymap. Lua allows the use *bracket notation* to use
1429+
non-alphanumeric characters in table keys.
14231430
>lua
14241431
objbr_mappings = {
14251432
['<localleader>gg'] = 'head({object}, 30)',
14261433
},
14271434
<
1428-
You can also bind keys to Lua functions. For example, the following example binds
1429-
`e` to an anonymous function that fetches the definition of an R function
1430-
under the cursor and opens it in a new vim buffer. The code also binds `v` in the
1431-
object browser to toggle between the two view (i.e., `.Globalenv` and `Libraries`).
1435+
You can also bind keys to Lua functions. For example, the following example
1436+
binds `e` to an anonymous function that fetches the definition of an R
1437+
function under the cursor and opens it in a new vim buffer. The code also
1438+
binds `v` in the object browser to toggle between the two view (i.e.,
1439+
`.Globalenv` and `Libraries`).
14321440
>lua
14331441
objbr_mappings = {
14341442
['<localleader>gg'] = 'head',
@@ -1443,10 +1451,12 @@ object browser to toggle between the two view (i.e., `.Globalenv` and `Libraries
14431451
return
14441452
end
14451453

1446-
local temp_file = config.tmpdir .. '/function_def_' .. vim.env.RNVIM_ID .. '.R'
1454+
local temp_file = config.tmpdir .. '/function_def_' ..
1455+
vim.env.RNVIM_ID .. '.R'
14471456

14481457
-- Send R command to write the function definition to a temp file
1449-
local cmd = string.format('writeLines(deparse(%s), "%s")', object_name, temp_file)
1458+
local cmd = string.format('writeLines(deparse(%s), "%s")',
1459+
object_name, temp_file)
14501460
require('r.send').cmd(cmd)
14511461

14521462
-- Wait for R to execute the command and write the file
@@ -1518,7 +1528,8 @@ path to R in your config as in the examples:
15181528
R_path = "/path/to/my/preferred/R/version/bin"
15191529
R_path = "C:\\Program Files\\R\\R-4.3.3\\bin\\x64"
15201530
<
1521-
On Windows, Neovim will try to find the R install path in the Windows Registry.
1531+
On Windows, Neovim will try to find the R install path in the Windows
1532+
Registry.
15221533

15231534
The `R_path` variable can also be prefixed to the `PATH` environment variable.
15241535
So, it can include more than one directory separated by a `;` on Windows or a
@@ -1529,7 +1540,7 @@ RTools `bin` directories on Windows. Example:
15291540
<
15301541
By default `R_cmd` is `"R"` (the same as `R_app`) and will be used to run some
15311542
scripts in the background, such as:
1532-
>
1543+
>sh
15331544
R CMD build nvimcom
15341545
R CMD install nvimcom
15351546
R CMD BATCH current_script.R
@@ -1603,7 +1614,7 @@ features in your R.nvim config. Below are the default values:
16031614
signature = true, -- enable the signature help provider
16041615
implementation = true, -- enable the implementation provider
16051616
definition = true, -- enable the definition provider
1606-
use_git_files = true, -- use git to find R files, skipping gitignored files
1617+
use_git_files = true, -- use git to find R files
16071618
references = true, -- enable the references provider
16081619
document_highlight = true, -- enable the document highlight provider
16091620
document_symbol = true, -- enable the document symbol provider
@@ -1783,8 +1794,8 @@ you should put in your config:
17831794
>lua
17841795
R_prompt_str = "»"
17851796
<
1786-
Similarly, if the `continue` option in your `~/.Rprofile` has ANSI scape codes,
1787-
you should set the value of `R_continue_str`. Example:
1797+
Similarly, if the `continue` option in your `~/.Rprofile` has ANSI scape
1798+
codes, you should set the value of `R_continue_str`. Example:
17881799
>lua
17891800
R_continue_str = "…"
17901801
<
@@ -1963,7 +1974,7 @@ Console with the option `max_paste_lines` (default value = 20).
19631974

19641975
To produce a PDF document from the .tex file generated by either `Sweave()` or
19651976
`knit()` command, R.nvim calls:
1966-
>
1977+
>sh
19671978
latexmk -pdf -pdflatex="xelatex %O -file-line-error -interaction=nonstopmode -synctex=1 %S"
19681979
<
19691980
If `xelatex` is not installed, it will be replaced with `pdflatex` in the
@@ -2397,8 +2408,8 @@ The substring `%s` is replaced by the name of the object under the cursor, and
23972408
The data will be displayed in a new tab. Change the value of `how` to "split"
23982409
or "vsplit" to display the data in a split window.
23992410

2400-
If the default field delimiter (`\t`) causes problems in your case, you can change it
2401-
in your config. Valid values are `"\t"`, `";"` and `","`. Example:
2411+
If the default field delimiter (`\t`) causes problems in your case, you can
2412+
change it in your config. Valid values are `"\t"`, `";"` and `","`. Example:
24022413
>lua
24032414
csv_sep = ","
24042415
<
@@ -2542,8 +2553,8 @@ Current available functions are:
25422553
>lua
25432554
path_split_fun = { "here::here", "here", "file.path", "fs::path", "path" }
25442555

2545-
If the target string is detected as a URL, it will be split using the '/' character.
2546-
will be handled using the `paste0()` function.
2556+
If the target string is detected as a URL, it will be split using the '/'
2557+
character. will be handled using the `paste0()` function.
25472558

25482559

25492560
------------------------------------------------------------------------------
@@ -2583,14 +2594,14 @@ not want this, put in your config:
25832594
debug_jump = false
25842595
<
25852596
The highlighted debugged line incrementally moves down the buffer with code
2586-
execution and, with long scripts, it may stay at the bottom of the window as you
2587-
debug. You can hold the highlighted line in the middle of the window with
2597+
execution and, with long scripts, it may stay at the bottom of the window as
2598+
you debug. You can hold the highlighted line in the middle of the window with
25882599
>lua
25892600
debug_center = true
25902601
<
25912602

25922603
------------------------------------------------------------------------------
2593-
6.43. Code chunk languages *chunk_langs*
2604+
6.43. Code chunk languages *chunk_langs*
25942605

25952606
By default, R.nvim supports sending R, Python, Bash, and SQL code chunks
25962607
from Quarto and R Markdown documents to R. You can add support for
@@ -2663,15 +2674,15 @@ The Lua internals for R.nvim should be considered generally unstable and
26632674
subject to change without notice. There are some exceptions to this rule,
26642675
which are declared stable for the benefit of users:
26652676

2666-
r.run.action(rcmd, mode, args) *r.run.action()*
2677+
r.run.action(rcmd, mode, args) *r.run.action()*
26672678
Calls an R function on the word currently under the cursor
26682679

26692680
Parameters: ~
26702681
{rcmd} (string) The name of an R function
26712682
{mode} (string) The current mode (`"n"` or `"v"`)
26722683
{args} (string) Extra arguments to pass to `rcmd`
26732684

2674-
r.send.cmd(command) *r.send.cmd()*
2685+
r.send.cmd(command) *r.send.cmd()*
26752686
Calls an R function on the word currently under the cursor
26762687

26772688
Parameters: ~
@@ -2790,5 +2801,3 @@ See: https://www.vim.org/scripts/script.php?script_id=2628
27902801

27912802

27922803
vim:tw=78:ts=8:ft=help:norl
2793-
2794-

0 commit comments

Comments
 (0)