VimRC - VI on Steroids
25 Jun 2013Vim has been one of my favorite tool from text editing to IDE and what not. But with great power, comes great features and responsibilities. So I would like to share my vimrc settings that I use in my day to day workflow. I find in really helpful and productive.
First of all if you are new to rc files. RC stands for Run Command in Unix terms, which would basically load sets of configuration before loading the application.
In case if you don’t have vimrc you can create one using vi
vim ~/.vimrc
Then you can Copy and Paste the following text.
Save the File and Restart vi and if you are interested in deeper dive I found this link really helpful.
http://newbiedoc.sourceforge.net/text_editing/vim.html.en
""""""""""""" | |
" Basics | |
"""""""""""" | |
syntax on | |
set background=dark | |
set ruler " Show the line number on the bar | |
set showmatch " Show matching parenthesis | |
set more " Use more prompt | |
set autoread " Watch for file changes | |
set confirm " Dialog Box to Confirm | |
set number " Display Line Numbers | |
set hidden " Re-use the same window and switch from an unsaved buffer without saving it first | |
set showmode | |
set showcmd " Show partial commands in the last line of the Screen | |
set wildmenu " Better command line completion | |
set autoindent smartindent " Auto/smart indent | |
set wrap " Wrap lines | |
set smarttab " Tab and Backspace are smart | |
set tabstop=4 " 6 spaces | |
set shiftwidth=4 | |
set expandtab " Using spaces instead of tabs | |
set hlsearch " Highlist Searches | |
set ignorecase smartcase " Use case insensitive Search, except when using capital letters | |
set scrolloff=5 " keep at least 5 lines above/below | |
set sidescrolloff=5 " keep at least 5 lines left/right | |
set history=200 | |
set backspace=indent,eol,start | |
set linebreak | |
set cmdheight=2 " command line two lines high | |
set undolevels=1000 " 1000 undos | |
set updatecount=100 " switch every 100 chars | |
set complete=.,w,b,u,U,t,i,d " do lots of scanning on tab completion | |
set ttyfast " we have a fast terminal | |
set noerrorbells " No error bells please | |
set shell=bash | |
set fileformats=unix | |
set ff=unix | |
filetype on " Enable filetype detection | |
filetype indent on " Enable filetype-specific indenting | |
filetype plugin on " Enable filetype-specific plugins | |
set wildmode=longest:full | |
""""""""""""" | |
" Mapping | |
"""""""""""" | |
" Yank till end of line | |
map Y y$ | |
" Map <C-L> (redraw screen) to turn off search highlighting until the next | |
" search | |
nnoremap <C-L> :nohl<CR><C-L> | |
" Map <Space> to / (Search) and <Ctrl>+<Space) for ? (Backward Search) | |
map <space> / | |
map <c-space> ? | |
" Remove the Windows ^M - when the encodings gets messed up | |
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm |