Skip to content



This feature is available for the following hostgroups and their respective subhostgroups:

  • machine_protection/linux

NeoVIM (nvim) is a fork of the terminal text editor VIM. More information about nvim can be found here.

The following is an explanation for my (Oskari's) nvim configuration.

My configuration is split into 4 distinct files:

  • init.vim: Contains the plugin initialization and sources the other files.
  • base.vim: Contains basic nvim setup.
  • plugin.vim: Contains plugin specific setup.
  • mapping.vim: Contains custom keyboard mappings.

These files should be placed in the directory $(HOME)/.config/nvim/.

Plugin installation

My nvim configuration uses the plugin vim-plug to manage plugins, which must be installed manually using the following Linux command. In case the following command does not work for you, various installation instructions can be found on the vim-plug repo.

sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \'

The desired plugins can then be defined as in the following code snippet, which shows the content of the init.vim file. In order for the plugins to be installed, the command PlugInstall has to be called inside nvim.

call plug#begin()

Plug 'tpope/vim-surround' " Gives commands to easily manipulate surrounding characters such as () and ''
Plug 'jiangmiao/auto-pairs' " Automatically pairs up surrounding characters such as () and ''
Plug 'vim-airline/vim-airline' " Nice status line
Plug 'airblade/vim-gitgutter' " Show git information in signcolumn
Plug 'dracula/vim', { 'as': 'dracula' } " Awesome colorscheme
Plug 'vim-python/python-syntax' " Better python syntax highlighting

call plug#end()

source ~/.config/nvim/base.vim
source ~/.config/nvim/plugin.vim
source ~/.config/nvim/mapping.vim

Base setup

The following code snippet shows the content of the file base.vim. This file contains the vanilla nvim configuration. I've added comments to each setting for ease of understanding.

syntax on " Enable syntax highlighting
colo dracula " Use the dracula colorscheme

set autoread " Automatically update to external changes
set wrap " Wrap text when line doesnt fit terminal width
set linebreak " Prefer placing linebreaks breaking at whitespace
let &showbreak='  ↪ ' " Place arrow to indicate a linebreak
set showcmd " Show command in bottom of screen
set listchars=extends:→ " Insert arrows when text goes off screen
set listchars+=precedes:← " Same as previous
set shiftwidth=4 " Round to nearest multiple of 4 when shifting lines
set tabstop=4 " Tabs = 4 characters
set hlsearch " Highlight all matches for current search
set incsearch " Highlight matches as search pattern is being typed
set inccommand=split " Show effect of search/replace command as it is being typed
set autoindent " Automatically follow indentation of current line
set timeoutlen=1000 ttimeoutlen=0 " Adjust command wait times
set number "Enable line numbers
set relativenumber " Make line numbers relative to cursor
set scrolloff=5 " Keep 5 lines above and below cursor when scrolling
set sidescrolloff=10 " Keep 10 lines on either side of cursor when scrolling
set cursorline " Highlight the cursors current line
set signcolumn=yes " Always show signcolumn
set concealcursor= " Never conceal when cursor is on line
set conceallevel=3 " Conceal formatting in certain formats such as json and markdown
set mouse=a " Enable the use of the mouse
set formatoptions+=j " Automatically delete comment characters when joining lines using ctrl-j

Plugin setup

The following code snippet shows the content of the file plugin.vim. This file contains plugin specific settings.

"""""""""" Dracula
let g:dracula_colorterm=0
let g:dracula_italic=1 " Enable the use of italics for comments and strings

"""""""""" python-syntax
let g:python_highlight_all = 1 " Enable all extra python syntax

Custom mappings

The following code snippet shows the content of the file mapping.vim. This file contains my custom keyboard mappings. I change the mapleader to the spacebar, so a command like <Leader>w would mean pressing the spacebar and then w.

"""""""""" Basic
let mapleader=" "

" Save
nnoremap <Leader>w :w<CR>

" Remove search highlight
nnoremap <Leader>s :noh<CR>

" Quick search and replace
nnoremap S :%s//g<Left><Left>

" Quick search
nnoremap <Leader>S :vimgrep '' % \| cwin<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>

" Disable vim EX mode
nnoremap Q <nop>

"""""""""" vim-gitgutter

" Hunk shortcuts, goto next/previous hunk
nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk)