Skip to content

Instantly share code, notes, and snippets.

@alimranahmed
Last active March 14, 2017 07:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alimranahmed/5d65b77fc3f31cfbf4a5552003a0a942 to your computer and use it in GitHub Desktop.
Save alimranahmed/5d65b77fc3f31cfbf4a5552003a0a942 to your computer and use it in GitHub Desktop.
Minimal .vimrc for programmer without any plugin
"Change the leader key from \\ to comma
let mapleader = ','
"Show line number of row
set number
"Write automatically when close the buffer
set autowriteall
"Limit the Text window with 80 character
set colorcolumn=120
"Indent automatically depends on file type
filetype indent on
set autoindent smartindent
"Set syntext on
"syntax on
"Check spelling
"set spell
"set highlight search(hlsearch) word while search worked typing(incsearch)
set hlsearch incsearch title ruler
"show matching
set showmatch
"highlight cursor line
"set cursorline
"Case insensitive search
set ignorecase
"And so is Artificial Intellegence!
set smartcase
"Wrap text instead of being on one line
set lbr
"size of a hard tabstop
set tabstop=4
"size of an "indent"
set shiftwidth=4
set expandtab
set smarttab
"a combination of spaces and tabs are used to simulate tab stops at a width
"other than the (hard)tabstop
set softtabstop=4
"Show auto complete menus
set wildmenu
"ctrl+tab for completion list
set wildmode=list:longest,full
"Show edition mode
set showmode
"Necessary for lots of cool vim things
set nocompatible
"This shows what you are typing as a command. I love this!
set showcmd
"Enable mouse support in console
"set mouse=a
"keep at least 5 lines above/below
set scrolloff=5
"keep at least 5 lines left/right
set sidescrolloff=5
"Make backspace of vim like other editor
set backspace=indent,eol,start
"---------------Mappings-----------
"Save when Ctrl+s pressed
"Don't forget to add the following line in .zshrc or .bashrc file
"stty -ixon -ixoff
nnoremap <C-s> :w<CR>
inoremap <C-s> <Esc>:w<CR>
"Save and quit when Ctrl+x pressed
nnoremap <C-x> :x<CR>
inoremap <C-x> <Esc>:x<CR>
"Ctrl+t open an new tab
nnoremap <C-t> :tabnew<CR>
inoremap <C-t> <Esc>:tabnew<CR>
"Ctrl+j for next tab and ctrl+k for previous tab
nnoremap <C-j> :tabnext<CR>
inoremap <C-j> <Esc>:tabnext<CR>
nnoremap <C-k> :tabprev<CR>
inoremap <C-k> <Esc>:tabprev<CR>
"Hide highlighted search when ,<space> pressed
nnoremap <leader><space> :nohlsearch<CR>
"Map Esc to jk
inoremap jk <esc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment