Skip to content

Instantly share code, notes, and snippets.

@a-shevtsov
Last active March 7, 2019 00:23
Show Gist options
  • Save a-shevtsov/3bfac1a5f1f58035a606f96d1631e179 to your computer and use it in GitHub Desktop.
Save a-shevtsov/3bfac1a5f1f58035a606f96d1631e179 to your computer and use it in GitHub Desktop.
My Vim config
set nocompatible " be iMproved, required
filetype off " required
" turn on syntax highlighting
syntax on
" Change highlighting colors
highlight Search ctermbg=Magenta
highlight Search ctermfg=Yellow
" Set background for visual mode
highlight Visual cterm=NONE ctermbg=8 ctermfg=NONE guibg=NONE
" Show relative line numbers
set relativenumber
" make vim try to detect file types and load plugins for them
filetype on
filetype plugin on
filetype indent on
" by default, in insert mode backspace won't delete over line breaks, or
" automatically-inserted indentation, let's change that
set backspace=indent,eol,start
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Keep Plugin commands between vundle#begin/end.
Plugin 'fatih/vim-go' " Go development plugin
Plugin 'hashivim/vim-terraform' " Terraform highligthing
Plugin 'itchyny/lightline.vim' " A light and configurable statusline/tabline plugin
Plugin 'rosstimson/bats.vim' " BATS syntax highlighting
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} " A parser for a condensed HTML format
Plugin 'scrooloose/nerdcommenter' " Vim plugin for intensely orgasmic commenting
Plugin 'scrooloose/nerdtree' " A tree explorer plugin
Plugin 'tpope/vim-fugitive' " Git wrapper
Plugin 'tpope/vim-surround' " Quoting/parenthesizing made simple
Plugin 'vim-scripts/VimCompletesMe' " Autocompletion for Vim
Plugin 'vim-syntastic/syntastic' " Syntax checking plugin
Plugin 'wincent/command-t' " Fast file navigation for VIM
Plugin 'w0rp/ale' " Python linter
" All of your Plugins must be added before the following line
call vundle#end() " required
" This is for powerline to show nicer graphics
set encoding=utf-8
" Use 256 colors if available
if &term =~ "256"
set t_Co=256
endif
" lightline setting
set laststatus=2
" Create shortcut for paste toggle. Disables auto-indent
set pastetoggle=<f2>
" Disable arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" Configure shortcut for NERDTree
map <silent> <C-k>b :NERDTreeToggle<CR>
" Start NERDTree automatically if no files were specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Set default shift width to 2 spaces
set sw=2
" Enable folding by syntax and make Vim open all folds by default
set fdm=syntax
set foldlevel=99
" Set max line width in Python
let g:syntastic_python_flake8_args = "--max-line-length=120"
" Change indent settings for certain file types
autocmd Filetype sh setlocal ts=2 sw=2 expandtab
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab
autocmd Filetype json setlocal ts=2 sw=2 expandtab
autocmd Filetype groovy setlocal ts=2 sw=2 expandtab
autocmd Filetype javascript setlocal ts=2 sw=2 expandtab
autocmd Filetype go setlocal ts=8 sw=8
" Tell Vim to tream Jenkinsfile as Groovy script
au BufNewFile,BufRead Jenkinsfile setf groovy
" Tell Vim to treat Berksfile as Ruby script
au BufNewFile,BufRead Berksfile setf ruby
" Show tabs and trailing spaces
set list
set listchars=tab:>-,trail:•
" NERD Commenter uses leader key so let's map space to leader key (\ by default)
map <Space> <leader>
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Close NERDTree after opening a file
let g:NERDTreeQuitOnOpen = 1
" Ignore vim-go version requirement
let g:go_version_warning = 0
" Enable vim-terraform
let g:terraform_align=1
" Configure autocompletion to use vim's command line completion
autocmd FileType vim let b:vcm_tab_complete = 'vim'
" Check Python files with pylint
let b:ale_linters = ['pylint']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment