Here are some text and indent Vim settings that you can put in the vimrc file to customize your editor. See :h options.txt for complete reference.

  • filetype plugin indent on enables loading of plugin and indent files
    • these files become active based on the type of the file to influence syntax highlighting, indentation, etc
    • :echo $VIMRUNTIME gives your installation directory (indent and plugin directories would be present in this path)
    • see :h vimrc-filetype, :h :filetype-overview and :h filetype.txt for more details
  • set autoindent copy indent from the current line when starting a new line
    • useful for files not affected by indent setting
    • see also :h smartindent
  • set textwidth=80 guideline for Vim to automatically move to a new line with 80 characters as the limit
    • white space is used to break lines, so a line can still be greater than the limit if there's no white space
    • default is 0 which disables this setting
  • set colorcolumn=80 create a highlighted vertical bar at column number 80
  • set shiftwidth=4 number of spaces to use for indentation (default is 8)
  • set tabstop=4 width for the tab character (default is 8)
  • set expandtab use spaces for tab expansion
  • set cursorline highlight the line containing the cursor

Video demo:


info See also my Vim Reference Guide and curated list of resources for Vim.