Vim (for Vi Improved) is a screen-oriented text editor originally created for the Unix operating system. This guide install a configured Vim as the default system editor.

This howto is tested on:

  • Debian 10.0 Buster


Detect if sudo is available (“command” is used if not):

command type -f 'sudo' &>'/dev/null' && cmdProxy='sudo'

Environment setup

Install the software

${cmdProxy} apt install 'vim'


Define Vim default configuration:

vimConfig='" List mode: special characters are visible, line break is visible as $.
set list
" Enable line numbering.
set number
" Expand tabulations to spaces.
set expandtab
" Tabulation is displayed by a 2 characters blank space.
set tabstop=2
" Tabulation is replaced by 2 spaces characters.
set softtabstop=2
" Indentation width is 2 spaces.
set shiftwidth=2
" Do not create backup of edited files (prevent clutter).
set nobackup
" Use utf-8 encoding for edition.
set encoding=utf-8
" Store file with utf-8 encoding.
set fileencoding=utf-8
" Enable syntax colorization.
syn on'

Apply Vim default configuration for current user and root user:

command tee -a "${HOME}/.vimrc" <<< "${vimConfig}"
[ "${USER}" != "root" ] && ${cmdProxy} tee -a "/root/.vimrc" <<< "${vimConfig}"

Set Vim as the system’s default editor:

${cmdProxy} update-alternatives --set 'editor' "$(command -v 'vim.basic')"

Learn to use Vim with:

command vimtutor



Categories: Software


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.