Created
September 12, 2015 17:19
-
-
Save murarisumit/5f795e266b0f6c4aa534 to your computer and use it in GitHub Desktop.
vimrc file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'bling/vim-airline' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'sjl/gundo.vim' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'fholgado/minibufexpl.vim' | |
Plugin 'fugalh/desert.vim' | |
Plugin 'nvie/vim-flake8' | |
Plugin 'vim-scripts/HTML-AutoCloseTag' | |
Plugin 'othree/html5.vim' | |
Plugin 'tmhedberg/SimpylFold' | |
call vundle#end() " required | |
colorscheme desert | |
"========http://unix.stackexchange.com/questions/75430/vi-vim-how-to-automatically-strip-trailing-spaces-on-save | |
function! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
" Often files are not necessarily identified by extension, if so use e.g.: | |
autocmd BufWritePre * if &ft =~ 'sh\|perl\|python' | :call <SID>StripTrailingWhitespaces() | endif | |
"=============================| | |
autocmd BufNewFile,BufReadPost *.md set filetype=markdown | |
"Move across single line in editor, other than wrapped line | |
nnoremap j gj | |
nnoremap k gk | |
" Yank from the cursor to the end of the line, to be consistent with C and D. | |
nnoremap Y y$ <ESC> | |
" Jump to start and end of line using the home row keys. | |
nnoremap H ^ | |
nnoremap L $ | |
" Quick escape from insert mode. | |
inoremap jj <ESC> | |
"==========airline============ | |
"For airline plugin, for displaying it everytime. By-default it comes only when windows is splitted | |
set laststatus=1 | |
set guifont=Liberation\ Mono\ for\ Powerline\ 10 | |
let g:airline_powerline_fonts = 1 | |
"================================ | |
"Color theme for windows | |
syntax enable | |
"Gundo pluginA | |
"nnoremap u :GundoToggle<CR> | |
"=====python mode plugin | |
map <leader>g <C-c>g | |
"============ | |
"Set relative line Number in editor | |
set relativenumber | |
set tabstop=4 "Each tab is of 4 | |
set shiftwidth=4 "While shifting move(<) move 4 place, equal to tabstop | |
set expandtab "Insert spaces Instead of inserting tab character | |
set autoindent " always set autoindenting on | |
set smartindent " copy the previous indentation on autoindenting | |
set number " always show line numbers | |
set showmatch " set show matching parenthesis | |
set ignorecase " ignore case when searching | |
set smartcase " ignore case if search pattern is all lowercase, | |
" case-sensitive otherwise | |
set hlsearch " highlight search terms | |
set incsearch " show search matches as you type | |
set ruler "Show status bar | |
set history=1000 " remember more commands and search history | |
set undolevels=1000 " use many muchos levels of undo | |
set wildignore=*.swp,*.bak,*.pyc,*.class | |
set title " change the terminal's title | |
set cursorline "Highlight current line | |
set cindent "stricter rules for C programs | |
" Use visual bell instead of beeping when doing something wrong | |
set visualbell | |
"I dont like Vim to ever write a backup file. I prefer more modern ways of protecting against data loss. | |
set nobackup | |
set noswapfile | |
"Finally, indenting intelligence is enabled based on the syntax rules for the file type. | |
filetype plugin on | |
set omnifunc=syntaxcomplete#Complete | |
syntax on | |
"Pasting large amounts of text into Vim. You can temporarily switch to “paste mode”, simply by setting the following option: | |
set pastetoggle=<F2> | |
noremap ; : | |
"Save file with w!! if you've forgot to open file with sudo | |
cmap w!! w !sudo tee % >/dev/null | |
"\===========/Changing leader | |
let mapleader="\<space>" | |
"Cut copy paste in vim | |
map <leader>d "+d | |
map <leader>y "+y | |
map <leader>p "+p | |
"============ Windows switch ====== | |
" split and switch to new pane | |
" vertical | |
nnoremap <leader>v <C-w>v | |
" horizontal | |
nnoremap <leader>s <C-w>s | |
" Move one viewport to down | |
nnoremap <leader>j <C-w>j | |
" Move one viewport to | |
nnoremap <leader>k <C-w>k | |
" Move one viewport to left | |
nnoremap <leader>h <C-w>h | |
" Move one viewport up | |
nnoremap <leader>l <C-w>l | |
" Move within different viewports | |
nnoremap <leader>w <C-w>w | |
" Increase size of viewport by one line | |
" For <leader>+ has to press shift key which wasn't possible | |
nnoremap <leader>= <C-w>= | |
" Reduce size of viewport by one line | |
nnoremap <leader>- <C-w>- | |
"===================================== | |
"=== Was gettng bottom line disappear while spiltting , adding this line helped=========== | |
if has("gui_running") | |
set guioptions-=L | |
set guioptions-=T " remove toolbar | |
set guioptions-=r " remove right-hand scroll bar | |
"set guioptions-=m " remove menu bar | |
end | |
"=======Youcompleteme========= | |
noremap <leader>g :YcmCompleter GoTo<CR> | |
"============================= | |
"====Open and close code folding====== | |
nnoremap <leader>f za | |
noremap <C-F> zM | |
set foldmethod=indent | |
" allow tab and shift+tab to | |
" tab selection in visual mode | |
vmap <Tab> >gv | |
vmap <S-Tab> <gv | |
"Remove search highlight by pressing Enter key | |
nnoremap <silent> <CR> :noh<CR><CR> | |
"Open vim file | |
nnoremap <silent> <Leader>ev :vsp<CR>:e ~/Dropbox/vimrc.vim<CR> | |
" When I close a tab, remove the buffer | |
set nohidden |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment