Skip to content

Instantly share code, notes, and snippets.

@ekzhang
Last active August 4, 2021 00:48
Show Gist options
  • Save ekzhang/d9b7ca1b33219cf9221951979c9d73df to your computer and use it in GitHub Desktop.
Save ekzhang/d9b7ca1b33219cf9221951979c9d73df to your computer and use it in GitHub Desktop.
" Begin vim-plug
set nocompatible
call plug#begin('~/.vim/plugged')
Plug 'VundleVim/Vundle.vim' " Vundle
Plug 'rstacruz/sparkup', {'rtp': 'vim/'} " Emmet-like HTML expansion
Plug 'w0ng/vim-hybrid' " Hybrid theme
Plug 'sheerun/vim-polyglot' " Enhanced language support
Plug 'scrooloose/nerdtree' " Tree explorer
Plug 'vim-scripts/delimitMate.vim' " Auto-close parens/quotes
Plug 'tpope/vim-sleuth' " Auto-detect indentation
Plug 'ervandew/supertab' " Tab completions
Plug 'vim-airline/vim-airline' " Airline
Plug 'vim-airline/vim-airline-themes' " Airline themes
call plug#end()
" End vim-plug
" Basic Configuration
set encoding=utf-8 " Change from latin1 to utf-8
set number " Line numbers
set cursorline " Highlight current line
set mouse=a " Enable mouse
set backspace=indent,eol,start " Make backspace normal
set whichwrap+=<,>,[,] " Make left/right wrapping normal
set tabstop=4 " 4-width tabs
set shiftwidth=4 " 4-width indents
set autoindent " Automatic indentation mode
set smartindent " Better indentation
set clipboard=unnamed " Fix clipboard
set autoread " Load changed files on disk
set autochdir " Change working directory
set timeoutlen=1000 ttimeoutlen=10 " Lower esc timeout
set laststatus=2 " Always show statusline
set wildmenu " Show autocomplete
set visualbell " Blink cursor on error
" Colorscheme-related Configuration
syntax on " Syntax highlighting
set background=dark " Theme
colorscheme hybrid " Theme
set termguicolors " Use true colors in terminal
" Macros
map <Tab> <C-W>W:cd %:p:h<CR>:<CR> " Switch split-panes with tab
" Plugin Configuration
let delimitMate_expand_cr = 1 " Expands return in brackets
let delimitMate_excluded_ft = "vim" " Exclude filetypes from delimitMate
" NERDTree
map <C-n> :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Airline
let g:airline_powerline_fonts = 1
let g:airline_theme='hybrid'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#tab_min_count = 2
let g:airline#extensions#tabline#show_buffers = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment