Created
December 2, 2019 23:45
-
-
Save labs-stellios/66477084e1a53976cbbc9146892aa6d3 to your computer and use it in GitHub Desktop.
Vim configuration file
This file contains 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
" --------------------- | |
" General Configuration | |
" --------------------- | |
" Get arrow keys working | |
set nocompatible | |
" Enable 256 colors | |
set t_Co=256 | |
" Turn syntax highlighting on | |
" http://vimdoc.sourceforge.net/htmldoc/syntax.html#syntax | |
" https://realpython.com/vim-and-python-a-match-made-in-heaven/#macos-os-x | |
let python_highlight_all=1 | |
syntax on | |
" Configure code folding | |
" http://vim.wikia.com/wiki/Folding | |
set foldmethod=indent " Form a code fold from groups of lines with the same indentation | |
set foldlevelstart=10 " TODO: Fold code blocks larger than this on opening a file | |
" Enable the mouse in all modes | |
" http://vimdoc.sourceforge.net/htmldoc/options.html#'mouse' | |
set mouse=r | |
" Use a comma as the leader key | |
" http://learnvimscriptthehardway.stevelosh.com/chapters/06.html | |
let mapleader="," | |
" Load the color scheme | |
colorscheme gruvbox " http://vimdoc.sourceforge.net/htmldoc/syntax.html#:colorscheme | |
set background=dark " http://vimdoc.sourceforge.net/htmldoc/options.html#'background' | |
" Enable auto-indentation | |
"set autoindent | |
set smartindent | |
" Enable line numbers | |
set number | |
" Highlight the current line | |
set cursorline | |
" Configure tabs as two spaces | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set softtabstop=2 | |
" Enable tab-completion for the command line | |
set wildmenu | |
" Do NOT update the display while executing macros | |
set lazyredraw | |
" Highlight matching [{()}] | |
set showmatch | |
" Search as characters are entered | |
set incsearch | |
" Highlight search matches | |
set hlsearch | |
" Hide buffers instead of closing them | |
set hidden | |
" Do NOT keep backup files and keep swap files out of the working directory | |
set nobackup | |
set nowritebackup | |
set directory=/tmp | |
" ------------ | |
" Key Mappings | |
" ------------ | |
" Map <F2> to enter/exit paste mode | |
set pastetoggle=<F2> | |
" Map <leader><space> to disable search highlighting | |
nnoremap <leader><space> :nohlsearch<CR> | |
" Map F5 to remove all trailing whitespace | |
nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR> | |
" Map <space> to open/close code folds | |
nnoremap <space> za | |
" Map ctrl+a to select-all | |
nnoremap <C-A> ggVG | |
" Map shift+K on a word to look up its man page | |
runtime! ftplugin/man.vim | |
" -------------------- | |
" Plugin Configuration | |
" -------------------- | |
" airline plugin options | |
let g:airline_theme='gruvbox' | |
let g:airline#extensions#tabline#enabled = 1 | |
" NERDTree plugin options | |
" Close vim if the only window left open is NERDTree | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
" ------- | |
" Plugins | |
" ------- | |
call plug#begin('~/.vim/plugged') | |
" File explorer | |
Plug 'scrooloose/nerdtree' | |
" Fuzzy finder | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
" Fuzzy finder in vim | |
Plug 'junegunn/fzf.vim' | |
" Tab completion | |
Plug 'davidhalter/jedi-vim' | |
" Colorscheme (includes its own airline theme) | |
Plug 'morhetz/gruvbox' | |
" Syntax checking/highlighting | |
Plug 'scrooloose/syntastic' | |
" Status bar | |
Plug 'vim-airline/vim-airline' | |
" Initialize plugin system | |
call plug#end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment