Giter VIP home page Giter VIP logo

r-vim-runtime's Introduction

R-Vim-runtime

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

The runtime files are sent to both Vim and Neovim maintainers when the accumulated changes become important. That is, if you have a fairly up to date Vim or Neovim, you do not need to install the files from this respository.

You may copy the files to your personal ~/.vim or ~/.config/nvim directory, but, instead of copying the files and checking for updates manually, you may want to use a plugin manager like Vim-Plug, Vundle, Neobundle, or other.

In some systems, the first files sourced by Vim and Neovim are from the system directories. In this case, if you want up to date runtime files, you have to copy them to either Vim or Neovim runtime directories.

Options

The use of indentation options is explained in the official distribution. To see the documentation, please, in Vim or Neovim, do:

:help ft-r-indent

Known bugs

Syntax highlight bug

There is a syntax highlight problem in inline blocks when a variable name contains underline marks in Rmd files. The highlighting algorithm mistakenly interprets the underline as the beginning of an italicized word. Example:

This value will be wrongly highlighted: **`r a_b`**

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 indent_test.R. The current algorithm correctly indents the first 604 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 syntax and indentation bugs that were described above were reported when the runtime files were distributed with the Vim-R-plugin:

r-vim-runtime's People

Contributors

jalvesaq avatar jranke avatar klmr avatar jongbinjung avatar

Watchers

James Cloos avatar Frank Loesche avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.