Last active
May 17, 2019 20:20
-
-
Save jasimmk/7fb752fe1249904df5621dbe5cadc4d4 to your computer and use it in GitHub Desktop.
init.vim/~.vimrc
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 " required | |
filetype off " required | |
" set the runtime path to include vundle and init | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" pass path where vundle should install plugins | |
" call vundle#begin('~/somepath/here') | |
" let vundle manage vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tmhedberg/SimpylFold' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'vim-scripts/indentpython.vim' | |
Plugin 'vim-syntastic/syntastic' | |
Plugin 'nvie/vim-flake8' | |
Plugin 'jnurmine/Zenburn' | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plugin 'junegunn/fzf.vim' | |
Bundle 'Valloric/YouCompleteMe' | |
Plugin 'tpope/vim-vinegar' | |
Plugin 'mattn/gist-vim' | |
Plugin 'mattn/webapi-vim' | |
Plugin 'plytophogy/vim-virtualenv' | |
" All plugins must be added before the line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" Enable folding | |
set foldmethod=indent | |
set foldlevel=99 | |
" Enable folding with space | |
nnoremap <space> za | |
" Python indent | |
au BufNewFile,BufRead *.py set tabstop=4 | set softtabstop=4 | set shiftwidth=4 | set textwidth=79 | set expandtab | set autoindent | set fileformat=unix | |
" Html/CSS/JS width | |
au BufNewFile,BufRead *.js, *.html, *.css set tabstop=2 | set softtabstop=2 | set shiftwidth=2 | |
" Autowhitespace clean | |
"Flagging Unnecessary Whitespace | |
highlight BadWhitespace ctermbg=red guibg=darkred | |
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ | |
" UTF-8 | |
set encoding=utf-8 | |
" Autocompletion | |
let g:ycm_autoclose_preview_window_after_completion=1 | |
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
"python with virtualenv support | |
" py3 << EOF | |
" import os | |
" import sys | |
" if 'VIRTUAL_ENV' in os.environ: | |
" project_base_dir = os.environ['VIRTUAL_ENV'] | |
" activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') | |
" #execfile(activate_this, dict(__file__=activate_this)) | |
" exec(open(activate_this).read(), {'__file__': activate_this}) | |
" | |
" EOF | |
" Enable python syntax | |
let python_highlight_all=1 | |
syntax on | |
" Color scheme | |
if has('gui_running') | |
set background=dark | |
colorscheme solarized | |
else | |
colorscheme zenburn | |
endif | |
" Zenburn darkmode | |
call togglebg#map("<F5>") | |
" Line numbering | |
set nu | |
" Use OS clipboard | |
set clipboard=unnamed | |
"Airline settings | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#left_sep = ' ' | |
let g:airline#extensions#tabline#left_alt_sep = '|' | |
" `gf` opens file under cursor in a new vertical split | |
nnoremap gf :vertical wincmd f<CR> | |
" Fuzzy search | |
nnoremap <C-p> :Files<Cr> | |
" Personal key hacks | |
nnoremap <C-n> :tabnew<Cr> | |
nnoremap <C-w> :q<Cr> | |
nnoremap <C-s> :w<Cr> | |
nnoremap <C-q> :q!<Cr> | |
" Vim vinegar sidebar | |
let g:netrw_banner = 0 | |
let g:netrw_liststyle = 3 | |
let g:netrw_browse_split = 4 | |
let g:netrw_altv = 1 | |
let g:netrw_winsize = 25 | |
" Mass comment and uncomment | |
" Commenting blocks of code. | |
autocmd FileType c,cpp,java,scala let b:comment_leader = '// ' | |
autocmd FileType sh,ruby,python let b:comment_leader = '# ' | |
autocmd FileType conf,fstab let b:comment_leader = '# ' | |
autocmd FileType tex let b:comment_leader = '% ' | |
autocmd FileType mail let b:comment_leader = '> ' | |
autocmd FileType vim let b:comment_leader = '" ' | |
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> | |
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> | |
" Disable Nerdtree on boot | |
" augroup ProjectDrawer | |
" autocmd! | |
" autocmd VimEnter * :Vexplore | |
" augroup END | |
" Copy paste with vim and outside | |
noremap <Leader>y "*y | |
noremap <Leader>p "*p | |
noremap <Leader>Y "+y | |
noremap <Leader>P "+p | |
" Setting up global python host program | |
let g:python_host_prog = '/usr/local/bin/python2' " Python 2 | |
let g:python3_host_prog = '/usr/local/bin/python3' " Python 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment