vimrc customization

Here is the copy of my .vimrc file. Hope this would help you as well.

" User - Raxesh Oriya
" ---------------------------

" Map ctrl+s to save changes  
nnoremap <C-s> <Esc>:w<CR>
vnoremap <C-s> <Esc>:w<CR>
inoremap <C-s> <Esc>:w<CR>

" Remove all trailing whitespace on F5 key press
nnoremap <silent> <F5> :let _s=@/ <Bar> :%s/\s\+$//e <Bar> :let @/=_s <Bar> :nohl <Bar> :unlet _s <CR>

" highlight when 80 characters crossed 
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
augroup vimrc_autocmds
    autocmd!
    autocmd BufEnter,WinEnter * call matchadd('OverLength', '\%>80v.\+', -1)
augroup END

" Map Ctrl+c to copy contain in clipboard register
vmap <C-c> "+y

" Map Ctrl+x to cut contain in clipboard register
vmap <C-x> "+d

" Set relativenumber so I don't need to count the lines
set relativenumber

" Set line number
se nu

" Do nothing when I press ctrl+z
nnoremap <c-z> <nop>

" It helps in case insensitive search
set ignorecase

" Map TAB key to work as a ESC, easy to change mode from INSERT to NORMAL
imap <C-@> <ESC>

" Change colorschme from default
colorscheme evening

" highlight current line
set cursorline          

" It helps in case insensitive search
set ignorecase

" Map TAB key to work as a ESC, easy to change mode from INSERT to NORMAL
imap <C-@> <ESC>

" Change colorschme from default
"colorscheme evening

" highlight current line
set cursorline          

" move vertically by visual line
nnoremap j gj
nnoremap k gk

" add line with single key stroke
nnoremap + mao<esc>`a
nnoremap - maO<esc>`a

" Map space key into normal mode 
nnoremap <space> i<space><esc>

" Set shift tab for auto-indentation
set shiftwidth=4

" show existing tab with 4 spaces width
set tabstop=4

" On pressing tab, insert 4 spaces
set expandtab

Comments

Popular posts from this blog

MBR partitioning with 'parted' utility

Replace default splash screen in Yocto

Disk Partitioning: MBR vs GPT