FreeBSD

Install VIM on FreeBSD 15 / 14

FreeBSD ships with vi in the base system, but most users prefer VIM for its syntax highlighting, split windows, and extensibility. VIM is available as a binary package and installs in seconds.

Original content from computingforgeeks.com - post 5239

Last verified: March 2026 | Tested on FreeBSD 15.0-RELEASE, VIM 9.2.0204

Install VIM on FreeBSD

The console version of VIM (no GUI) is the right choice for servers:

pkg install -y vim

Verify the installed version:

vim --version | head -2

You should see VIM 9.2 with the “Huge version without GUI” label:

VIM - Vi IMproved 9.2 (2026 Feb 14, compiled Mar 21 2026 01:07:22)
Included patches: 1-204

VIM installs to /usr/local/bin/vim along with vimdiff, vimtutor, rview, and rvim.

Available VIM Flavors

FreeBSD packages VIM in several flavors depending on your needs:

PackageDescription
vimConsole version, no GUI (recommended for servers)
vim-gtk3GTK3 GUI version for desktop
vim-gtk2GTK2 GUI version (legacy)
vim-tinyMinimal build with reduced features
vim-x11X11 GUI version

Set VIM as the Default Editor

FreeBSD does not set a default EDITOR variable out of the box. To make VIM the default editor for crontab -e, visudo, and other tools that check this variable, add it to your shell profile:

echo 'export EDITOR=vim' >> ~/.profile
echo 'export VISUAL=vim' >> ~/.profile
source ~/.profile

For all users on the system, add it to /etc/profile instead.

Basic VIM Configuration

Create a ~/.vimrc with sensible defaults:

vi ~/.vimrc

Add the following configuration:

syntax on
set number
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
set hlsearch
set incsearch
set ignorecase
set smartcase
set ruler
set showcmd
set wildmenu
colorscheme desert

This enables syntax highlighting, line numbers, 4-space tabs, search highlighting, and the desert color scheme. Run vimtutor from the command line if you are new to VIM, it walks you through the basics interactively.

Conclusion

VIM is a one-command install on FreeBSD and the /usr/local/bin/vim binary works immediately after pkg install. Set EDITOR=vim in your profile so every tool that opens a text editor uses VIM by default. For more on managing packages and services on FreeBSD, see our dedicated guide.

Related Articles

FreeBSD FreeBSD Jails with VNET Networking on FreeBSD 15 FreeBSD How To Configure NFS Server and NFS client on FreeBSD 14 FreeBSD Install FreeBSD 14 on KVM or VirtualBox (Easy 2024 Guide) Databases Install MariaDB 11.4 on FreeBSD 15

Leave a Comment

Press ESC to close