Skip to content

Vim Configuration Guide

This document provides a simple Vim configuration setup to enhance usability.

Features

  • Line Numbers: Enables both absolute and relative numbering.
  • Syntax Highlighting: Improves readability for code files.
  • File Type Detection: Automatically detects and configures settings based on file type.
  • Color Scheme: Uses the elflord color scheme.

Configuration

Below is the complete Vim configuration:

sudo vim .vimrc

" Add numbers to each line on the left-hand side.
set number
set relativenumber

" Turn syntax highlighting on.
syntax on

" Disable compatibility with vi which can cause unexpected issues.
set nocompatible

" Enable file type detection.
filetype on

" Enable plugins and load plugin for the detected file type.
filetype plugin on

" Load an indent file for the detected file type.
filetype indent on

" Set color scheme to elflord.
colorscheme elflord

[optional] Apply to root

  • If you want to have this config for root/sudo as well.
    sudo cp .vimrc /root/.vimrc