Skip to main content

Ubuntu 26.04: Configure Vim

Install and configure Vim on Ubuntu 26.04 LTS with syntax highlighting, line numbers, and other useful settings.

May 22, 2026 4 min read
ubuntulinuxvimeditorconfiguration

Configure Vim for a more convenient editing experience than the default vi.

Install Vim

apt -y install vim

Configure Vim Settings

Create or edit the user-specific configuration file:

vi ~/.vimrc

Example configuration with common settings:

" use extended vim features (not compatible with vi)
set nocompatible

" character encoding
set encoding=utf-8

" file encodings
set fileencodings=utf-8

" file formats
set fileformats=unix,dos

" enable backups
set backup

" backup directory
set backupdir=~/backup

" search history size
set history=50

" ignore case in search
set ignorecase

" smart case sensitivity
set smartcase

" highlight search matches
set hlsearch

" incremental search
set incsearch

" show line numbers
set number

" visualize tabs and end-of-line
set list

" highlight matching parentheses
set showmatch

" enable auto-indent
set autoindent

" enable syntax highlighting
syntax on

" lighter comment color
highlight Comment ctermfg=LightCyan

" wrap long lines
set wrap

For system-wide settings, write the same options in /etc/vim/vimrc. Adjust parameters according to your preferences.