Skip to content

Instantly share code, notes, and snippets.

@bpsagar
Last active June 8, 2020 13:56
Show Gist options
  • Save bpsagar/db807732c64edfae9ab5fffa87d01b42 to your computer and use it in GitHub Desktop.
Save bpsagar/db807732c64edfae9ab5fffa87d01b42 to your computer and use it in GitHub Desktop.
Vim configuration
syntax on
" Sane defaults
set noerrorbells
set nowrap
set nu
set ignorecase
set smartcase
set incsearch
set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smartindent
set ai "Auto indent
set si "Smart indent
set backspace=indent,eol,start
set nobackup
set nowb
set noswapfile
" For vim to read project level settings
set exrc
set secure
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
set colorcolumn=80
highlight ColorColumn ctermbg=0 guibg=lightgrey
" space open/closes folds
nnoremap <space> za
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')
" Declare the list of plugins.
" Plugin for status bar
Plug 'vim-airline/vim-airline'
" Plugin for git integration
Plug 'tpope/vim-fugitive'
" Plugin for commenting
Plug 'preservim/nerdcommenter'
" Plugin for color schemes
Plug 'morhetz/gruvbox'
" Plugin for autocomplete
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --all' }
" Plugin for Fuzzy Finder (Ctrl + P)
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
nnoremap <C-p> :FZF<cr>
" Plugin for configuring editor for different types of files
Plug 'editorconfig/editorconfig-vim'
" Plugin to show file tree side panel (Ctrl + O)
Plug 'preservim/nerdtree'
map <C-n> :NERDTreeToggle<CR>
" Plugin to make the code prettier
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] }
" Autoformats if the config is present in the folder
" let g:prettier#autoformat = 0
let g:prettier#autoformat_require_pragma = 0
let g:prettier#autoformat_config_present = 1
" A collection of language packages for Vim
Plug 'sheerun/vim-polyglot'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
" Apply grubbox color schemes
colorscheme gruvbox
set background=dark
" Project level search with ripgrep
nnoremap <C-F> :Rg<CR>
" GoTo Declaration shortcut
" let mapleader=" "
nnoremap <C-D> :YcmCompleter GoToDefinition<CR>
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
" Easier copy to clipboard
map <C-Y> "*y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment