Indentation in vim and neovim

Topics: NeoVim, vim

This note gives Vim and Neovim commands for converting existing indentation between tabs and spaces, including the settings that determine tab width.

To convert spaces to tabs, execute the command :set noexpandtab, followed by :retab!.

Vice versa, you can convert tabs to spaces with the command sequence:

:set expandtab
:set tabstop=2
:set shiftwidth=2
:retab

Subtopics

Bookmarks

Questions