Skip to content

Instantly share code, notes, and snippets.

@TG9541
Last active September 22, 2022 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TG9541/95279b2878628c225b629767b4deab8d to your computer and use it in GitHub Desktop.
Save TG9541/95279b2878628c225b629767b4deab8d to your computer and use it in GitHub Desktop.
VIM and NeoVIM installation notes

VIM and NeoVIM installation notes

In the context of Using R on a Raspberry Pi Zero W the following notes list the steps that were used to install vim and nvim from scratch on a Raspberry Pi Zero W. The steps should also work for PCs with a recent Debian or Ubuntu version.

I'm aware that nvim implements many features not available in vim but since nvim was designed to be coexist with vim - it can even use the same .vimrc - so why not make a common installation so that starting any of them for editing a config file works as expected.

The default .vimrv location can be used, which is ~/.vimrc (general notes on configuring vim can be found in idiomatic-vimrc).

The following ~/.vimrc settings contain the minimal vim-plug configuration for both vim and nvim:

" Specify a directory for plugins                
" - For Neovim: stdpath('data') . '/plugged'
"   " - Avoid using standard Vim directory names like 'plugin'          
call plug#begin('~/.vim/plugged')

" Make sure you use single quotes
Plug 'jalvesaq/Nvim-R', {'branch': 'stable'}

" Initialize plugin system
call plug#end()

Before starting vim, vim-plug needs to be installed:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

When starting vim it may complain that git needs to be install (sudo apt install git). The installation of Nvim-R in vim should start without further action.

From this point nvim can be installed (sudo apt install neovim). The nvim help page transition from vim now lists the following steps:

  1. To start the transition, create your |init.vim| (user config) file by entering the following commands:
:call mkdir(stdpath('config'), 'p')
:exe 'edit '.stdpath('config').'/init.vim'
  1. Add these contents to the file:
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc 

Now start nvim and issue :checkhealth - the output shoul look like this:

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $SSH_TTY='/dev/pts/0'

In nvim the vim-plug needs to be configured manually:

  • :PlugStatus to show managed plug-ins
  • :PlugInstall to load plug-ins

In both vim and nvim installed scripts and plug-ins can be listed with :scriptnames.

@TG9541
Copy link
Author

TG9541 commented Sep 21, 2022

Notes:

  • install colorout:
  • Ubuntu 22.04 default settings are in /usr/lib/R/library/base/R/Rprofile.
    • use ~/.Rprofile for local settings
  • Add Nvimr-R options to ~.vimrc

Tab settings in ~/.vimrc:

set tabstop=4
set shiftwidth=4
set expandtab

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