FreeBSD Install VIM Editor Without X11 GUI

Q. I’m running FreBSD on an old PC and find that all the visual bells and whistles in FreeBSD X11 are really slowing things down. How do I install vim text editor under FreeBSD without using GUI (gvim) version? How do I build vim port without X11 GUI?

A. You can easily build VIM without X11 under FreeBSD. First, update your ports tree, using portsnap command, enter:
# portsnap fetch update
Install vim without X11, enter:
# cd /usr/ports/editors/vim
# make WITHOUT_X11=yes install clean

ADVERTISEMENTS

Optional: vim configuration

Copy /usr/local/share/vim/vimXY/vimrc_example.vim to /usr/local/share/vimrc, enter:
# cp /usr/local/share/vim/vim72/vimrc_example.vim /usr/local/share/vimrc
Create your ~/.vimrc file, enter:
$ vi ~/.vimrc
Add customization:

set nocompatible 
filetype on
filetype indent on
filetype plugin on
set laststatus=2
syntax on

Save and close the file. Set bash alias, enter:
$ echo "alias vi='vim'" >> ~/.bashrc
Setup INPUTRC for bash, enter:
# echo 'export INPUTRC=/usr/local/etc/inputrc' >> /etc/profile
Finally, create /usr/local/etc/inputrc, enter:
# cat >> /usr/local/etc/inputrc
Append config:

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
6 comments… add one
  • Kusal Jan 17, 2009 @ 13:08

    Thank you

  • Mel Jan 27, 2009 @ 19:22

    Alternate:

    # echo 'WITH_VIM_OPTIONS=yes' >>/etc/make.conf

    You can now choose vim options using the standard configuration dialog.

  • gooonmunster Mar 8, 2009 @ 20:41

    Is it possible to get firefox to run on Freebsd without X11, KDE or GNOME?

    • 🐧 nixCraft Mar 8, 2009 @ 21:43

      Noop, you cannot install Firefox without X11.

  • ub3rst4r Apr 9, 2014 @ 5:06

    I was having troubles pasting text via PuTTY (by using the right mouse button), it turns it out it’s because the mouse is enabled. I commented out the following code in /usr/local/share/vim/vimrc:

    if has('mouse')
     set mouse=a
    endif
    

    Should be:

    " if has('mouse')
    "  set mouse=a
    " endif
    
  • Markus Effinger Sep 30, 2017 @ 19:32

    I found this post when looking for a terminal only version of vim. However there seems to be a simpler approach: just install vim-lite with pkg install vim-lite
    This is what I found in the nixCraft blog.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.