Fundamentals 6 min read

Fix Vim Delete Key on macOS and Beautify the Status Bar with vim‑airline

This guide explains why the Delete (Backspace) key may not work in Vim on macOS, shows how to configure the backspace option in ~/.vimrc, and provides step‑by‑step instructions to install, configure, and theme the vim‑airline status‑line plugin.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Fix Vim Delete Key on macOS and Beautify the Status Bar with vim‑airline

Fix Delete/Backspace key in Vim on macOS

On macOS the Delete key (which functions as Backspace) does not delete characters in Insert mode when Vim is running in compatible mode or when the backspace option is empty. In compatible mode Vim mimics the original Vi behaviour, leaving backspace unset, which prevents deletion of indent, end‑of‑line and start‑of‑line characters.

Vim defines three possible values for the backspace option:

0   same as ":set backspace="   (Vi compatible)
1   same as ":set backspace=indent,eol"
2   same as ":set backspace=indent,eol,start"

Setting the option to 2 restores the expected Delete/Backspace behaviour. Add the following line to your ~/.vimrc (or edit the existing backspace setting):

" Enable Delete/Backspace in Insert mode
set backspace=2

Install and configure vim-airline to enhance the status line

vim-airline is a lightweight plugin that provides a configurable and attractive status line for Vim. The source repository is:

https://github.com/vim-airline/vim-airline

Installation can be performed manually by cloning the repository and copying the plugin file, or by using any Vim plugin manager.

# Manual installation
git clone https://github.com/vim-airline/vim-airline.git
cp vim-airline/plugin/airline.vim ~/.vim/plugin/
ls ~/.vim/plugin
# Expected output includes airline.vim and airline-themes.vim

After installation, add a basic configuration to ~/.vimrc. The example below sets custom separators, symbols, enables the tabline extension, selects the powerlineish theme, and includes common Vim settings that complement the airline configuration.

if !exists('g:airline_symbols')
  let g:airline_symbols = {}
endif
let g:airline_left_sep = '▶'
let g:airline_left_alt_sep = '❯'
let g:airline_right_sep = '◀'
let g:airline_right_alt_sep = '❮'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'

" Enable tabline extension
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme = 'powerlineish'

" General Vim options
set laststatus=2          " Always show status line
set encoding=utf-8
set t_Co=256
set fillchars+=stl:\ ,stlnc:\
set term=xterm-256color
set termencoding=utf-8
set nocompatible          " Disable Vi‑compatible mode
set number                " Show line numbers
syntax enable
set backspace=2           " Ensure Delete works as expected

Additional themes are available in the separate repository:

https://github.com/vim-airline/vim-airline-themes

To use a theme, clone the repository and place the theme files in ~/.vim/airline/themes/, then set let g:airline_theme = 'theme_name' in .vimrc.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

macOS.vimrcdelete-keyvim-airlinetext-editor
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.