Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

jalvesaq/R-Vim-runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R-Vim-runtime

This repository used to contain the development versions of R related runtime files distributed with both Vim and Neovim.

The runtime files were sent to both Vim and Neovim maintainers when the accumulated changes became important.

Known bugs

Indentation bugs

Indentation of R code is slow because the algorithm deals with many specific cases. If you are interested in either improving the indent/r.vim script or rewriting it, please, look at the file tests/indent_test.R. The current algorithm correctly indents the first 613 lines. A new script should be both faster and more accurate.

If either Vim or Neovim indents your code wrongly you may get the correct indentation by adding braces and line breaks to it. For example, try to indent the code below:

# This code will be wrongly indented:
levels(x) <- ## nl == nL or 1
    if (nl == nL) as.character(labels)
    else paste(labels, seq_along(levels), sep = "")
class(x) <- c(if(ordered) "ordered", "factor")


# But this one will be correctly indented:
levels(x) <- ## nl == nL or 1
    if (nl == nL)
        as.character(labels)
    else
        paste(labels, seq_along(levels), sep = "")
class(x) <- c(if(ordered) "ordered", "factor")

The indentation algorithm also fails to correctly indent multiline strings. Example:

# This is a multiline string:
paste("A
      =", 2)

# This is the same string, but written in a single line
# to avoid indentation issues:
paste("A\n =     ", 2)

See also:

Some indentation bugs that were described above were reported when the runtime files were distributed with the Vim-R-plugin:

About

Vim runtime scripts of file types that include R code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published