Skip to content

Instantly share code, notes, and snippets.

@ejhari
Created May 29, 2021 05:50
Show Gist options
  • Save ejhari/01018ffcf43f2d812371f6880e32d137 to your computer and use it in GitHub Desktop.
Save ejhari/01018ffcf43f2d812371f6880e32d137 to your computer and use it in GitHub Desktop.
vimrc
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
" Any valid git URL is allowed for plugin
" Shorthand notation for plugin
Plug 'morhetz/gruvbox'
" Initialize plugin system
call plug#end()
" Set colorscheme.
colorscheme gruvbox
" Set terminal colors.
set t_Co=256
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
" Indention Options
" New lines inherit the indentation of previous lines.
set autoindent
" Convert tabs to spaces.
set expandtab
" Enable indentation rules that are file-type specific.
"set filetype indent on
" When shifting lines, round the indentation to the nearest multiple of “shiftwidth”.
set shiftround
" When shifting, indent using four spaces.
set shiftwidth=4
" Insert “tabstop” number of spaces when the “tab” key is pressed.
set smarttab
" Indent using four spaces.
set tabstop=4
" Search Options
" Enable search highlighting.
set hlsearch
" Ignore case when searching.
set ignorecase
" Incremental search that shows partial matches.
set incsearch
" Automatically switch search to case-sensitive when search query contains an uppercase letter.
set smartcase
" Performance Options
" Limit the files searched for auto-completes.
set complete-=i
" Don’t update screen during macro and script execution.
set lazyredraw
" Text Rendering Options
" Always try to show a paragraph’s last line.
set display+=lastline
" Use an encoding that supports unicode.
set encoding=utf-8
" Avoid wrapping a line in the middle of a word.
set linebreak
" The number of screen lines to keep above and below the cursor.
set scrolloff=1
" The number of screen columns to keep to the left and right of the cursor.
set sidescrolloff=5
" Enable syntax highlighting.
syntax enable
" Enable line wrapping.
set wrap
" User Interface Options
" Always display the status bar.
set laststatus=2
" Always show cursor position.
set ruler
" Display command line’s tab complete options as a menu.
set wildmenu
" Highlight the line currently under cursor.
set cursorline
" Show line numbers on the sidebar.
set number
" Show line number on the current line and relative numbers on all other lines.
"set relativenumber
" Disable beep on errors.
set noerrorbells
" Flash the screen instead of beeping on errors.
set visualbell
" Enable mouse for scrolling and resizing.
set mouse=a
" Set the window’s title, reflecting the file currently being edited.
set title
" Use colors that suit a dark background.
set background=dark
" Code Folding Options
" Fold based on indention levels.
set foldmethod=indent
" Only fold up to three nested levels.
set foldnestmax=3
" Disable folding by default.
set nofoldenable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment