Skip to content

Instantly share code, notes, and snippets.

Last active October 13, 2023 05:29
  • Star 48 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Nvim-R-Tmux: An Integrated Working Environment for R

Nvim-R-Tmux: Neovim-based IDE for R

!!! This Gist tutorial is deprecated. Its new version is available here !!!

This is some red text.

  • Author: Thomas Girke
  • Last update: 18-Nov-2020

Table of Content

  1. Overview
  2. Installation
    1. Neovim
    2. Tmux
    3. R package colorout
    4. Nvim-R plugin
    5. Nerdtree
    6. Color Scheme
    7. Setup in user accounts of UCR's HPCC
  3. Usage and configuration
    1. Run R in built-in terminal emulator
    2. Run R in Tmux pane
  4. Config files
  5. Advanced topics
    1. R version toggle
    2. Install Neovim from source
    3. Install tmux from source
    4. Install pre-built R versions
    5. Install R from source

1. Overview

This page gives an overview of the installation and usage of the new Nvim-R plugin from Jakson Alves de Aquino, the developer of the original vim-R plugin. The new plugin now also supports the new extension of Vim called Neovim. The main advantages of Neovim compared to Vim are its better performance and its built-in terminal emulator facilitating the communication among Neovim and interactive programming environments such as R. Since the Vim and Neovim environments are managed independently, one can run them in parallel on the same system without interfering with each other. The Nvim-R project page can be found here and its main manual is here. The usage section below introduces how to use the plugin with or without Tmux.

Animated Screenshot of Nvim-R (from here):

2. Installation

2.1. Install Neovim for your OS

Neovim Version >= 0.1.7 is required for Nvim-R. For the installation, follow the instructions here. A sample config file for controlling Neovim, called init.vim, is given below. This or a similar init.vim file should be downloaded and saved to a user's home under ~/.config/nvim/init.vim.

Advanced: for more advanced users it may often become important to install the latest Neovim version. For this it can be very useful to download Neovim from its GitHub repos, and then install it from source following these instructions. Using a package management software available on a user's system may be more convenient, but this will often only allow the installation of older Neovim versions. More detailed instructions for installing Neovim from source are given below.

2.2. Install Tmux

The usage of Tmux with Nvim-R is highly recommended on Linux or OS X systems but not absolutely necessary. Supported Tmux versions are >=2.0. To upgrade Tmux to a more recent version, one can follow the instructions here. To install it from source, consult see intructions below here. If you get on Ubuntu 16.04 a locale-gen en_US.UTF-8 error, then the last step here fixes it. A sample config file for controlling Tmux, called .tmux.conf, is given below. This or a similar .tmux.conf file should be downloaded and saved to a user's home under ~/.tmux.conf.

2.3. Install R package colorout

The R package colorout is available on GitHub here. If it is not yet installed in an R environment, one can install it from within R via the devtools package as follows:


2.4. Install Nvim-R plugin for Neovim

2.4.1 Manual install

Download the latest *.vmb from here. Then open the downloaded file with nvim (neovim), and then run from nvim's command mode the following commands:

:packadd vimball
:so %
# press space bar a few times until install is complete!

2.4.2 Install with plugin manager

When new features become available in Nvim-R then one can get them immediately by installing the Nvim-R plugin from its GitHub repos directly. After downloading the repos, one can move its content (files and directories) manually to ~/.config/nvim or install it with a Neovim plugin manager that includes GitHub support. The following uses vim-plug as plugin manager. After installing vim-plug for neovim as outlined here one can install plugins by listing them at the end of the ~/.config/nvim/init.vim file as follows:

" Plugins will be downloaded under the specified directory.
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')                               
" Declare the list of plugins.                               
Plug 'jalvesaq/Nvim-R'                    
Plug 'preservim/nerdtree'
Plug 'jalvesaq/vimcmdline'
" List ends here. Plugins become visible to Vim after this call.                          
call plug#end()        

After this, the vim commands :PlugInstall, :PlugUpdate and :PlugClean will install, update and remove plugins accordingly. Note, when using vim-plug, the init.vim config file remains under .config/nvim and the plugins will be installed under ~/.local/share/nvim/plugged/.

The version information for the Nvim-R plugin can be returned from vim's command mode as follows.

:help nvim-r

2.5. Install Nerdtree (optional)

Download the Nerdtree vim plugin from here. Then extract to ~/.config/nvim with the following command. Note, if vim-plug is used as outlined under section 2.4.2 then Nerdtree will be installed automatically.

unzip -d ~/.config/nvim

2.6. Color Scheme (optional)

Jakson Alves de Aquino has developed the southernlights color scheme that works well with Nvim-R. To enable it, users want to save the file southernlights.vim from this repos to ~/.config/nvim/colors/ and add the recommended bash configurations to your .bashrc as described here. Note, this color scheme should be installed under ~/.config/nvim/colors/ even if a plugin manager is used that installs other plugins under ~/.local/share/nvim/plugged/.

2.7. Setup in user accounts of UCR's HPCC

Neovim and Tmux are already installed systemwide on the HPCC, but need to be loaded from the module system (step 1). What remains to be installed in each user's account are the plugins and configuration files as outlined below under steps 2-5. Alternatively, all required resources will be installed automatically by executing the command Install_Nvim-R_Tmux (old version was install_nvimRtmux) in a user's HPCC account.

  1. Add to your .bashrc the following lines
if [ -n "$MODULESHOME" ]; then
    module load neovim/0.6.0
    module load tmux/3.3
  1. Install Nvim-R plugin for Neovim as instructed here
  2. Save this init.vim sample file to ~/.config/nvim/init.vim
  3. Install Nerdtree plugin as instructed here
  4. Install southernlights color scheme as instructed here
  5. Now log out of the system and in again. After this start tmux and then open a .R or .Rmd file with nvim command. Next open a connected R session with the key combination \rf and then follow the usage instructions given here.

3. Usage and configuration

The usage of Neovim is almost identical to Vim. Two important differences are:

  1. The command for opening Neovim is nvim instead of vim.
  2. Plugins are usually stored under ~/.config/nvim/ and the counter part of the .vimrc config file is init.vim located at ~/.config/nvim/init.vim.

3.1. Run R in built-in terminal emulator (preferred solution)

Open a *.R or *.Rmd file with nvim and intialize a connected R session with \rf. This command can be remapped to other key combinations, e.g. uncommenting lines 10-12 in init.vim will remap it to the F2 key. Note, the resulting split window among Nvim and R behaves like a split viewport in nvim or vim meaning the usage of Ctrl-w w followed by i and Esc is important for navigation.

Important keybindings for nvim (vim):

  • \rf: opens vim-connected R session (R version toggle is outlined below)
  • spacebar: sends code from vim to R; here remapped in init.vim from default \l
  • :split or :vsplit: splits viewport (similar to pane split in tmux)
  • gz: maximizes size of viewport in normal mode (similar to Tmux's Ctrl-a z zoom utility)
  • Ctrl-w w: jumps cursor to R viewport and back; toggle between insert (i) and command (Esc) mode is required for navigation and controlling the environment.
  • Ctrl-w r: swaps viewports
  • Ctrl-w =: resizes splits to equal size
  • Ctrl-w 5< or 5>: resizes splits to left or right by 5 steps; change number as needed
  • Ctrl-w H or Ctrl-w K: toggles between horizontal/vertical splits
  • Ctrl-spacebar: omni completion for R objects/functions when nvim is in insert mode. Note, this has been remapped in init.vim from difficult to type default Ctrl-x Ctrl-o.
  • :h nvim-R: opens nvim-R's user manual; navigation works the same as for any Vim/Nvim help document
  • :Rhelp fct_name: opens help for a function from nvim's command mode with text completion support
  • Ctrl-s and Ctrl-x: freezes/unfreezes vim (some systems)

3.2. Run R in Tmux pane (historical solution)

To run R in a separate Tmux pane, include the following two lines in your init.vim. Note: with Neovim's built-in terminal emulator this option is not so important anymore, since Neovim's vim-r split is more robust and feature-rich. To incorporate the features of a terminal multiplexer like Tmux, one simply runs the environment within a Tmux session, where the vim-r splits are handled by Neovim rather than Tmux. Yet, running R in a sparate Tmux pane is still possible as outlined below.

- `let R_in_buffer=0`
- `let R_tmux_split=1`

Open a *.R or *.Rmd file with nvim and start R with \rf. Similarly as above, the \rf command can be remapped to other key combinations, e.g. uncommenting three lines containing F2 in init.vim will remap it to the F2 key. To navigate among the Nvim and R panes, the key combination Ctrl-w-o is important.

Important keybindings for Tmux panes:

  • Ctrl-a o: jumps cursor to next pane e.g. from Nvim to R console pane
  • Ctrl-a Ctrl-o: swaps panes
  • Ctrl-z z: maximizes (zooms into) active pane
  • Ctrl-a d: detaches from current session
  • tmux a: attaches to tmux session
  • tmux attach -t <id>: attaches to specific tmux session

Note, closing R in this setup will also close the corresponding Tmux pane. This is different from the behavior of the older vim-R plugin where the R pane stayed open and returned a shell after quitting R. This behavior can be useful to open a different R version or ssh into remote systems while maintaining the connected Nvim pane from where code can still be sent to the original pane. To achieve a similar behavior with the new Nvim-R plugin, one can use the following workaround:

  1. Switch cursor scope to R esssion (with Ctrl-a o) and then execute from R pane system("tmux set remain-on-exit on")
  2. Quit R with q(). This gives a dead pane that can be reactivated by starting a shell in it with the commands Ctrl-a and :respawn-pane bash

4. Config files

The following config files (or similar custom versions) should be saved to the following locations in a user's home directory:

  • File init.vim for Neovim: ~/.config/nvim/init.vim
  • File tmux.conf for Tmux: ~/.tmux.conf

5. Advanced topics

This section is only relevant for advanced users who require a high level of customization, e.g. for R package development.

5.1. R version toggle

Different R versions installed on a system can be loaded via specific keybinding in Nvim-R. The example below loads one of two R versions (e.g. R-release or R-development) with the keybindings \r1 or \r2, respectively. With a Tmux pane split both R versions can be loaded in a single terminal window simultaneously.

Screenshot of two different R versions loaded in one terminal window:

Note, the R version keybinding toggle was added by Jakson Alves de Aquino in April-2020. To obtain this feature, one needs to first download an Nvim-R version from Github (here) from April-2020 or later, and then move it to ~/.config/nvim, or use a Neovim plugin manager with GitHub support. Subsequently, the following lines need to be added to the ~/.config/nvim/init.vim file where \r1 and \r2 can be customized as needed, and the associated paths need to point to the corresponding R load bash scripts installed on a system. Currently, the latter need to be named explicitly 'R' to work with Nvim-R. To allow calling specific R versions from the command-line (outside of Nvim), one can use an alias in ~/.bashrc. For instance, include the following alias setting to open R's development version by typing R-dev on the command-line: alias R-dev='/usr/local/lib/R-devel/bin/R'. Optionally, one can also provide a custom path for packages installed in a user's home directory like this: alias R-dev='R_LIBS_USER=R_LIBS_USER=~/R/%p-library/%v_<my_subdir> /usr/local/lib/R-devel/bin/R'. The latter can be important for managing several Bioconductor versions that use the same R version (see here for additional details).

Lines to include in init.vim:

function StartRFromPath(path)
    let g:R_path = a:path
    let $R_LIBS_USER='~/R/%p-library/%v' " default path for packages installed in a user's home directory
    call StartR("R")

nmap \r1 :call StartRFromPath('/usr/bin')<CR>
nmap \r2 :call StartRFromPath('/usr/local/lib/R-devel/bin/')<CR>

To manage several Bioconductor versions for the same R version, one can define two or more R start up functions, e.g. one for release (StartRFromPath) and one for development (StartRdevFromPath), where R_LIBS_USER is assigned the corresponding path for packages installed in a user's home directory, e.g. ~/R/%p-library/%v_Bioc3.14 for development version.

Note, one can also load specific R versions manually by enabling one of the following two lines. The first one is enabled here in combination with the above R version toggle to allow loading of the default R version with Nvim-R's default keybinding \rf if that version's load script is located in /usr/bin/.

let R_path = '/usr/bin/' "to load default R (here release)
"let R_path = '/usr/local/lib/R-devel/bin/' "to load R-development

5.2. Install Neovim from source

General instructions for installing Neovim from source are available here. The corresponding prerequisites for the install are outlined here.

The following provides additional details that were required for installing the latest Neovim on Debian/Stretch, Debian/Buster and Ubuntu/18.04 systems (here nvim v0.5.0). Installs on other Linux systems will be similar, but the required dependency packages added in the first step may differ. The best way to find out is to install according to the official instruction guidelines here, and then address the depencies according to possible warning and/or error messages occuring during the install.

1. Install dependencies

sudo apt install cmake clang libtool libtool-bin libboost-all-dev gettext

2. Download latest Neovim from GitHub

git clone

3. Build Neovim from source (paths below install into ~/bin)

cd neovim
rm -r build/ # clear the CMake cache if 'build' is present from previous install                                  
make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/bin/neovim"                                                
make install

4. Include these lines in your .bashrc to load custom built Neovim with vim or nvim

export PATH="$HOME/bin/neovim/bin:$PATH"
alias vim=nvim

5. Now open Neovim and check from command mode its version

:version # type from command mode
NVIM v0.5.0-427-g1f56f9a4b # first returned line from 9-Apr-2020 install

5.3. Install tmux from source

Use the following steps to build and install tmux from source on Debian and/or Ubuntu. These instructions are derived from here.

cd ~/bin # optional step to manage custom installs under ~/bin
VERSION=3.3-rc # select tmux version to install from here:
sudo apt-get -y remove tmux
sudo apt-get -y install wget tar libevent-dev libncurses-dev
tar xf tmux-${VERSION}.tar.gz
rm -f tmux-${VERSION}.tar.gz
cd tmux-${VERSION}
sudo make install
cd -
sudo rm -rf /usr/local/src/tmux-*
sudo mv tmux-${VERSION} /usr/local/src

5.4. Install pre-built R versions

Current and historical versions of R can be downloaded for all common operating systems from CRAN here. Install instructions via binaries and OS specific package managers are given in the corresponding OS specific subdirectories of the same page. This is usually the preferred install solution for most users.

A basic workflow for installing and upgrading to a specific version of R (here for R-4.0.x under Debian Buster) would look like this. First, add the following line to your /etc/apt/sources.list file: deb buster-cran40/. If not available yet, add the proper key to your keyserver. For example: sudo apt-key adv --keyserver --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF' Next, run these commands, where the first two lines will install some typical dependencies. For additional details, open the CRAN instructions for installing R for your specific operating system here.

sudo apt install libcurl4-openssl-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt update
sudo apt upgrade
# sudo apt install -t buster-cran40 r-base r-base-dev # run this line if previous one doesn't trigger R install

Now continue under section 5.4.5 with the installation of important dependencies and R packages.

5.5. Install R from source

Instructions for installing R from source are provided in the corresponding install manuals from CRAN and RStudio. Source installs are mainly relevant for R package development routines to test code on specific R versions (e.g. development version). Typical R users not involved in package development may not need this and can follow the instructions linked under installing pre-built R versions.

The following outlines how to install any R version from source on Debian/Ubuntu systems. The given example installs the latest R development version after downloading it via svn or ftp/http. For comparison, a similar but not identical R source install setup by a user is described here.

1. Install dependencies (these may be installed already)

sudo apt install r-base r-base-dev \
    subversion \ 
    ccache \
    xorg-dev \
    default-jdk \
    libx11-dev \

2. Download R source via svn or ftp/http from the corresponding source download page, and save it to a target directory. The below svn command downloads the development version of R from trunk, and saves it to a directory called R-devel. The latter directory name can be customized as needed. An advantage of the svn download appoach is that it makes it easier to keep up with future incremental version updates during a develpment/release cycle. The R version options downloadable via svn can be looked up here:

mkdir ~/svn                                   
cd ~/svn 
svn co R-devel # downloads developer version of R from trunk

## Alternatively, look up latest R version and download it
# wget                                            
# gunzip R-devel_yyyy-mm-dd.tar.gz; tar -xvf R-devel_yyyy-mm-dd.tar

3. Build and install R

The following will build and install the R source stored under ~/svn/R-devel in /usr/local/lib/R-devel. The latter path is defined under '--prefix' below. This path can be changed to the desired install location on a system. For instance, installing R under /opt/ or in a user account under ~/bin/ would be common alternative locations. When installing it in your own user account, then drop sudo in the corresponding command(s) below. For tracking purposes it may be most convenient to generate for the below install commands a *.sh script named after a specific R version install (e.g. This way it will be easier to customize and track the install commands used for each instance of an R source install.

mkdir ~/svn/R-devel-build # in case of svn build in dedicated directory 
cd ~/svn/R-devel-build
../R-devel/configure \
    --prefix=/usr/local/lib/R-devel \
    --enable-R-shlib \
    --enable-BLAS-shlib \
    --enable-shared \
    --enable-static \
    --with-blas \
    --with-lapack \
    --with-libpng \
    --with-jpeglib \
    --with-cairo \
    --with-x \

sudo make install  

Troubleshooting: if you get under make an error like undefined reference to drot_ (e.g. on Ubuntu 18.04) then drop in configure the line:--with-blas. Most likely OpenBlas was already installed via sudo apt install lipopenblas-base. In this case the default OpenBlas will be used on a system.

To update the R development version via svn, run the following update steps, and then re-run under the ~/svn/R-devel-build directory the install of the previous code box.

cd ~/svn/R-devel
svn update

To check which optional features have been enabled for building R, one can do this from within R with:


4. Starting specific R versions

Add the following alias definition lines to your ~/.bashrc file. The first two lines may be optional if it is the default setting in a user's $PATH.

alias R='/usr/bin/R' 
alias Rscript='/usr/bin/Rscript' 
alias R-dev='/usr/local/lib/R-devel/bin/R'
alias Rscript-dev='/usr/local/lib/R-devel/bin/Rscript'

Now, one can load the release or development versions of R by typing on the command-line R or R-dev, respectively. In addition, the same R versions are called with Rscript and Rscript-dev, respectively.

5. Install common system dependencies

This installs a variety of system dependencies that are required by many R packages. Note, the texlive-full package is very large (5.2GB). If disk space is limited then one may want to skip its install or just install texlive instead (270MB).

sudo apt install build-essential \
    libcurl4-gnutls-dev \
    openjdk-7-* \
    libxml2-dev \
    libssl-dev \
    texlive-full \
    librsvg2-dev \
    libcairo2-dev \

For R Markdown one will need to have the command-line tool pandoc installed. On Debian/Ubuntu systems it can be installed via apt get install pandoc pandoc-citeproc. Alternatively, installing RStudio will include a pandoc version recommended by R Markdown. If command-line R cannot locate RStudio's pandoc version, then one can set the proper path in any R/Rmd script or in a user's .Rprofile file with Sys.setenv(RSTUDIO_PANDOC="<insert_path>"). The path (here <insert_path>) can be identified by running from RStudio: Sys.getenv("RSTUDIO_PANDOC").

6. Install common R packages

The R package collection devtools is required for many development tasks including the install of other R packages from GitHub directly. In addition, tidyverse is a collection of packages that are often required for many routine tasks, including ggplot2, dplyr and more.

Run the following package installs from R.

install.packages(c("devtools", "tidyverse"))

Now install Bioconductor's package manager from R.

if (!requireNamespace("BiocManager", quietly = TRUE)) 

After this one can install Bioconductor packages from R as follows.

BiocManager::install(c("GenomicFeatures", "AnnotationDbi"))

The Bioconductor version can be returned with this command.


For additional details see Bioconductor's package install page.

7. Simple uninstall

To remove the above R source installation, one can simply remove the following directories.

~/R/x86_64-pc-linux-gnu-library/<X.X> # Present when R packages were installed in user's home  

8. Troubleshooting

a. Graphics: X11 font problem

If certain R graphics libraries, such as ggplot2 or lattice, return X11 font problems (like 'X11 font -adobe-helvetica ... not found'), then it may be necessary to include the following or a similar X11 default setting in your ~/.Rprofile file. For additional details on this issue, these user postings may be helpful: post1 and post2. Note, the last line, options(bitmapType = 'cairo'), is necessary to address this rmarkdown::render() issue. Alternatively, for building R Markdown vignettes, this line can be included at the beginning of a vignette's YAML header under parameter: vignette:.

# default X11() setting
setHook(packageEvent("grDevices", "onLoad"),
	function(...) grDevices::X11.options(width = 8, height = 8, xpos = 0, pointsize = 10, type = "cairo"))
options(bitmapType = 'cairo')

On shared user systems, one can define these settings system-wide by including them in an file under file.path(R.home(), "etc/"). The content in the file could look like this:

   setHook(packageEvent("grDevices", "onLoad"),
   function(...) grDevices::X11.options(type='cairo'))                             

Additinal details on this is available in R's main documentation here.

b. ...


"""Nvim config file"""
" Save this file to ~/.config/nvim/init.vim
" Fixes weird character problem in some devel versions neovim under tmux sesssion. This might go away in future.
set guicursor=
" Uses color scheme southernlights from Jakson Alves de Aquino here:
" To enable it, save file southernlights.vim to ~/.config/nvim/colors/
colorscheme southernlights
" Preferred default settings
set nowrap
" start R with F2 key
" map <F2> <Plug>RStart
" imap <F2> <Plug>RStart
" vmap <F2> <Plug>RStart
" R version can be specified like this:
" let vimrplugin_r_path = "/opt/R/3.1.2-release/bin/R"
" Send selection or line to R with space bar, respectively.
vmap <Space> <Plug>RDSendSelection
nmap <Space> <Plug>RDSendLine
" Shortcut for R's assignment operator: 0 turns it off; 1 assigns underscore; 2 assigns two underscores
let R_assign = 2
" Ensures usage of your own ~/.tmux.conf file
let R_notmuxconf = 1
" Shows function arguments in a separate viewport during omni completion with Ctrl-spacebar (or Ctrl-x Ctrl-o:w)
" let R_show_args = 1
" Use Ctrl-Space to do omnicompletion
inoremap <C-Space> <C-x><C-o>
" Remove white background of status line at bottom of nvim viewport (default is 2)
set laststatus=1
"let R_in_buffer = 0
"let R_tmux_split = 1
"let R_applescript = 0
"let R_tmux_close = 0
" The following provides a zoom functionality, similar to Tmux's Ctrl-a z, by pressing 'gz' in normal mode.
function ZoomWindow()
let cpos = getpos(".")
tabnew %
call cursor(cpos[1], cpos[2])
normal! zz
nmap gz :call ZoomWindow()<CR>
"""NERDTree Plugin"""
" Installation
" - Download NERDTree plugin from here
" - unzip -d ~/.vim
" Usage
" - '?' opens quick help
" - 'zz' opens and 'q' closes NERDTree ('zz 'requires setting below)
" - 't' opens file in new tab
" - 'T' opens file in new tab silently
" - 'gt' and 'gT' switch between tabs
" - 'm' opens menu mode for creating/deleting files, 'Ctrl-c' to exit out of this mode
" Settings
" Opens NERDTree with custom shortcut, here 'zz'
let mapleader = "z"
nmap <leader>z :NERDTreeToggle<cr>
" Instruct NERDTree to always opens in the current folder
"set autochdir
"let NERDTreeChDirMode=2
"nnoremap <leader>n :NERDTree .<CR>
" Optional to show special NERDTree browser characters properly (e.g. on remote linux system)
let g:NERDTreeDirArrows=0
" Show bookmarks by default
let NERDTreeShowBookmarks=1
" ThG: install plugins with vim-plug plugin manager (here Nvim-R and nerdtree)
" Plugins will be downloaded under the specified directory.
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
" Declare the list of plugins.
Plug 'jalvesaq/Nvim-R'
Plug 'preservim/nerdtree'
Plug 'jalvesaq/vimcmdline'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
## ~/.tmux.conf - tmux terminal multiplexer config ##
## Save this file to ~/.tmux.conf
# fix for problem that vim sometimes doesn't open in old tmux session
# set -g default-terminal "screen-256color"
# set prefix key to ctrl+a until I have time to adapt
unbind C-b
set -g prefix C-a
# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix
# toggle last window like screen
bind-key C-a last-window
# confirm before killing a window or the server
bind-key k confirm kill-window
bind-key K confirm kill-server
# toggle statusbar
bind-key b set-option status
# ctrl+left/right cycles thru windows
bind-key -n C-right next
bind-key -n C-left prev
# open a man page in new window
bind / command-prompt "split-window 'exec man %%'"
# quick view of processes
bind '~' split-window "exec htop"
# scrollback buffer n lines
set -g history-limit 5000
# listen for activity on all windows
set -g bell-action any
# on-screen time for display-panes in ms
set -g display-panes-time 2000
# start window indexing at one instead of zero
set -g base-index 1
# enable wm window titles
set -g set-titles on
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux.#I.#W"
# ThG: set vi mode
set-window-option -g mode-keys vi
# ThG: force a reload of the .tmux.conf file with Ctrl-a r
unbind r
bind r source-file ~/.tmux.conf
# ThG: session initialization
# Start new session with .tmux-conf settings with: tmux attach
# Kill session entirely from a tmux session with: C-a: kill-session
new -n bash
neww -n tab1 #'cd ~/; bash'
neww -n tab2 #'cd ~/; bash'
neww -n tab3 #'cd ~/; bash'
neww -n tab4 #'cd ~/; bash'
neww -n tab5 #'cd ~/; bash'
select-window -t 2
# Maximizing and restoring panes
unbind +
bind + new-window -d -n tmp \; swap-pane -s tmp.0 \; select-window -t tmp
unbind -
bind - last-window \; swap-pane -s tmp.0 \; kill-window -t tmp
# Status bar 1 tab-based--------------------------------------------------------------
# set -g display-time 3000
# # default statusbar colors
# set -g status-fg black # ThG original was: white
# set -g status-bg white
# set -g status-attr default
# # default window title colors
# set-window-option -g window-status-fg black
# set-window-option -g window-status-bg white
# set-window-option -g window-status-attr dim
# # active window title colors
# set-window-option -g window-status-current-fg white
# set-window-option -g window-status-current-bg black
# set-window-option -g window-status-current-attr dim
# # command/message line colors
# set -g message-fg white
# set -g message-bg black
# set -g message-attr bright
# # center align the window list
# set -g status-justify left # centre
# # show some useful stats but only when tmux is started
# # outside of Xorg, otherwise dwm statusbar shows these already
# # set -g status-right "" # ThG: conflicts with time display
# set -g status-left ""
# if '[ -z "$DISPLAY" ]' 'set -g status-left "[#[fg=green] #H #[default]]"'
# if '[ -z "$DISPLAY" ]' 'set -g status-right "[ #[fg=magenta]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default] ][ #[fg=cyan,bright]%a %Y-%m-%d %H:%M #[default]]"'
# if '[ -z "$DISPLAY" ]' 'set -g status-right-length 50'
# Status bar 2 non-tab-based cyan color--------------------------------------------------------------
set -g display-time 3000
# default statusbar colors
set -g status-fg cyan # ThG original was: white
set -g status-bg default
# set -g status-attr default
set -g status-style default
# default window title colors
#set-window-option -g window-status-fg cyan
set-window-option -g window-status-style fg=cyan
#set-window-option -g window-status-bg default
set-window-option -g window-status-style bg=default
#set-window-option -g window-status-attr dim
set-window-option -g window-status-style dim
# active window title colors
#set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-style fg=white
#set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-style bg=default
#set-window-option -g window-status-current-attr bright
set-window-option -g window-status-current-style bright
# command/message line colors
#set -g message-fg white
set -g message-style fg=white
#set -g message-bg black
set -g message-style bg=black
#set -g message-attr bright
set -g message-style bright
# center align the window list
set -g status-justify centre # left
# show some useful stats but only when tmux is started
# outside of Xorg, otherwise dwm statusbar shows these already
# set -g status-right "" # ThG: conflicts with time display
set -g status-left ""
if '[ -z "$DISPLAY" ]' 'set -g status-left "[#[fg=green] #H #[default]]"'
if '[ -z "$DISPLAY" ]' 'set -g status-right "[ #[fg=magenta]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default] ][ #[fg=cyan,bright]%a %Y-%m-%d %H:%M #[default]]"'
if '[ -z "$DISPLAY" ]' 'set -g status-right-length 50'
Copy link

jdhayes commented Oct 23, 2018

Hey Thomas,
2.4 Has a link to sourcefourge that is being redirected to something else on vim's website.
I think what you wanted was to have it point to the latest vimball, so I updated my version here:

Copy link

It appears that the Tmux integration is not currently supported without further configuration changes (see

Copy link

tgirke commented Apr 2, 2020

With neovim this isn't necessary anymore, since you get the vim-r split from there. When run within a tmux session then you still get all the benefits from tmux as well.

Copy link

strazto commented May 2, 2020

Hey - I've recently stumbled upon (And contributed to) an R package, rvisidata that allows you to view dataframes from the terminal using the command-line visidata tool.

From what I understand, nvim-R may also support viewing of tabulated data, but depending on your requirements, you may find this visidata/rvisidata useful.

Copy link

tgirke commented Dec 12, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment