Skip to content

Instantly share code, notes, and snippets.

@matthewepler
Created August 28, 2020 16:01
Show Gist options
  • Save matthewepler/b37e73a466b8ee71182b0a0fba707da5 to your computer and use it in GitHub Desktop.
Save matthewepler/b37e73a466b8ee71182b0a0fba707da5 to your computer and use it in GitHub Desktop.
" ---------------
set nocompatible " be IMproved, required by Vundle
filetype off " required by Vundle
syntax on
set hidden " allows for use of split windows
set wildmenu " Better command-line completion
set showcmd " Show partial commands in the last line of the screen
set ignorecase " Use case insensitive search...
set smartcase " ...except when using capital letters
set backspace=indent,eol,start
set autoindent
set ruler
set laststatus=2 " Always display the status line
set visualbell " Use visual bell instead of beeping...
set t_vb= " ...but no flash or beep
set mouse=a " Enable use of the mouse for all modes
set cmdheight=2 " Set the command window height to 2 lines
set number " Display line numbers on the left
set notimeout ttimeout ttimeoutlen=200 " Quickly time out on keycodes, but never time out on mappings
set clipboard=unnamed " use OSX clipboard
set cursorline " highlight current line where cursor is
set hlsearch
set encoding=utf-8
set guifont=Roboto\ Mono\ for\ Powerline:h13
set swapfile
set dir=~/swp
set rnu
" -------------
" INDENTATION
" -------------
set shiftwidth=4
set softtabstop=4
set expandtab
set shiftwidth=4
set tabstop=4
"-------------------
" KEYS AND MAPPINGS
" ------------------
let mapleader = ","
nnoremap <leader>r :exec '!python' shellescape(@%, 1)<CR>
" set a debug trace
nnoremap <leader>s yyP^Cimport ipdb; ipdb.set_trace(context=5)<Esc>
" see the python docs
nnoremap <buffer> <leader>d :<C-u>execute "!pydoc3 " . expand("<cword>")<CR>
" go-to-definition via gutentags + ctrlp plugins
map <silent> <leader>jd :CtrlPTag<cr><c-\>w
"-------------------
" OTHER VIM SETTINGS
" ------------------
" netrw file browser setings
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
" let g:netrw_altv = 1
let g:netrw_winsize = 25
"-------------------
" PLUGIN SETTINGS
" ------------------
" virtual env plugin settings
let g:virtualenv_auto_activate=1
let g:virtualenv_directory = '~/venvs/'
" " ale completion/linting settings
let g:ale_pattern_options = {
\ '*': {'ale_fixers': ['remove_trailing_lines', 'trim_whitespace']},
\'\.py$': {'ale_linters': ['pylint']},
\'ale_fixers': ['autopep8', 'black', 'reorder-python-imports'],
\}
let g:ale_patterns_options_enabled=1
let g:ale_lint_on_enter=0
let g:ale_lint_on_text_changed=0
let g:ale_lint_on_save=1
let g:ale_fix_on_save = 1
let g:ale_open_list=1
let g:ale_set_loclist=1
let g:ale_set_quicklist=0
set completeopt+=noinsert
let g:ale_completion_enabled=1
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" : "\<TAB>"
" integration with airline status bar
let g:airline#extensions#ale#enabled=1
" shows whole list of linting errors
let g:ale_sign_error = '●'
let g:ale_sign_warning = '.'
" gutentag settings
let g:gutentags_ctags_exclude = ['*.css', '*.html', '*.pyc']
let g:gutentags_cache_dir = '~/.vim/gutentags'
" ---------
" COLORS
" ---------
" set termguicolors
set background=dark
colorscheme zenburn
let g:solarized_termcolors=256
" ----------------
" LANGUAGE PREFS
" ----------------
" Python
au BufNewFile,BufRead *.py
\ set tabstop=4
\ softtabstop=4
\ shiftwidth=4
\ textwidth=79
\ expandtab
\ autoindent
\ fileformat=unix
" JS/HTML/CSS
au BufNewFile,BufRead *.js,*.html,*.css
\ set tabstop=2
\ softtabstop=2
\ shiftwidth=2
" YAML
au BufNewFile,BufRead *.yml,*.yaml
\ set tabstop=2
\ softtabstop=2
\ shiftwidth=2
"" -----------
" VUNDLE
" -----------
set rtp+=~/.vim/bundle/Vundle.vim " set the runtime path to include Vundle and initialize
call vundle#begin()
" Plugins (to install run :PluginInstall)
Plugin 'VundleVim/Vundle.vim' " let Vundle manage Vundle, required
""commenting
Plugin 'https://tpope.io/vim/commentary.git'
"" linting
Plugin 'dense-analysis/ale'
"" colors
" Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
" super searching
Plugin 'kien/ctrlp.vim'
" powerline
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" virtual environment support
Plugin 'https://github.com/plytophogy/vim-virtualenv.git'
" tag generation and management
Plugin 'ludovicchabant/vim-gutentags'
" Tim Pope's surround
Plugin 'tpope/vim-surround'
" For saving sessions (with Tmux)
Plugin 'tpope/vim-obsession'
" for navigating panes in tmux and vim
Plugin 'christoomey/vim-tmux-navigator'
" autocomplete
Plugin 'valloric/youcompleteme'
" python autoindentation
Plugin 'vim-scripts/indentpython.vim'
" solarized8
Plugin 'lifepillar/vim-solarized8'
" black for code formatting
" Plugin 'psf/black'
" let g:black_virtualenv='~/venvs/black'
" autocmd BufWritePre *.py execute ':Black'
call vundle#end() " required
filetype plugin indent on " required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment