Skip to content

Instantly share code, notes, and snippets.

@mattgd
Last active January 15, 2018 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattgd/795e305ee50285ec9b003a9b3ec7ea8c to your computer and use it in GitHub Desktop.
Save mattgd/795e305ee50285ec9b003a9b3ec7ea8c to your computer and use it in GitHub Desktop.
My Vim configuration.
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" .py file settings
au BufNewFile,BufRead *.py
\ set tabstop=2 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
filetype plugin indent on
" Show existing tab with 2 spaces width
set tabstop=2
" When indenting with '>', use 2 spaces width
set shiftwidth=2
" On pressing tab, insert 2 spaces
set expandtab
" Set encoding
set encoding=utf-8
" Enable line numbers
set nu
" Mark trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
let python_highlight_all=1
syntax on
" Vundle plugins
Plugin 'dracula/vim'
Plugin 'nvie/vim-flake8'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdcommenter'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline'
Plugin 'ajh17/VimCompletesMe'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-surround'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
color dracula
" Always show statusline
set laststatus=2
" Airline
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" Airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
autocmd VimEnter * wincmd p
" Syntastic settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Always show git gutter
set signcolumn=yes
" Ctrl + P mapping
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlPLastMode'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_extensions = ['buffertag', 'tag', 'line', 'dir']
" Add line to avoid typing too many characters on a line
set colorcolumn=81
" Allow for session saving and loading using keys
" Quick write session with F2
map <F2> :mksession! ~/vim_session <cr>
" Load session with F3
map <F3> :source ~/vim_session <cr>
au BufRead,BufNewFile * start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment