You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Ubuntu的Vim中通过Vundle安装Nvim-R插件?

Installing Nvim-R Plugin for R in Vim (Ubuntu + Vundle Setup)

Hey there! Since you're running Ubuntu, already have Vim configured with Vundle, and want to add R language support via the Nvim-R plugin, here's a straightforward, step-by-step guide to get everything working smoothly:

Step 1: Add Nvim-R to your Vundle plugin list

First, open your Vim configuration file with this terminal command:

vim ~/.vimrc

Locate the section between call vundle#begin() and call vundle#end(), then add this line to your plugin list:

Plugin 'jalvesaq/Nvim-R'

Save and exit Vim with :wq.

Step 2: Install the plugin via Vundle

Launch Vim again, then run the Vundle install command inside Vim:

:PluginInstall

Wait for the process to finish—you’ll see a confirmation message once Nvim-R is successfully installed.

To tailor Nvim-R to your workflow, add these common settings to your ~/.vimrc (place them after the Vundle section):

" Set path to your R executable (Ubuntu's default R is usually in PATH, so this works)
let R_app = "R"
" Specify command to launch R
let R_cmd = "R"
" Use Ubuntu's default terminal for R sessions (adjust to gnome-terminal if you prefer)
let R_term = "xterm"
" Enable line numbers for R files
autocmd FileType r setlocal number
" Auto-indent R code for cleaner formatting
autocmd FileType r setlocal autoindent

Save the changes and exit Vim.

Step 4: Verify the Installation

Create a test R file to check if everything works:

vim test.R

Add some simple R code, like:

print("Hello from Nvim-R!")
x <- 1:10
mean(x)

Now, launch the R session in Vim by pressing \r (backslash followed by r)—a terminal window with the R console should pop up. To run the entire file, press \rf; you’ll see the output in the R console right away.

If you hit any minor snags, double-check that your R installation works (run R in your terminal to confirm) and that Vundle is correctly set up.

内容的提问来源于stack exchange,提问作者minus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:07:44