Skip to content

Instantly share code, notes, and snippets.

@nmvega
Last active July 3, 2020 22:11
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 nmvega/97ab9e261ea872a45ecef43e91c80c0c to your computer and use it in GitHub Desktop.
Save nmvega/97ab9e261ea872a45ecef43e91c80c0c to your computer and use it in GitHub Desktop.
vimrc file configured to enable Python3 IDE behaviors.
" ========================================================================
" NOTE: Inline comments are not always allowed, so avoid them!
" ========================================================================
" ========================================================================
" SIMPLE SETUP INSTRUCTIONS (for any user).
" REMEMBER: If you update this file, update the GitHub Gist below, too!
" ========================================================================
" user$ cd ${HOME} && rm -rf ~/.vim/
" user$ curl -sLO https://gist.github.com/nmvega/97ab9e261ea872a45ecef43e91c80c0c/raw/.vimrc
" user$ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" user$ vim +PluginInstall +qall
" user$ /usr/bin/python3 ~/.vim/bundle/YouCompleteMe/install.py --clang-completer " Preferred.
" user$ /usr/bin/bash ~/.vim/bundle/YouCompleteMe/install.sh --clang-completer " But this works, too.
" ========================================================================
" ========================================================================
" Begin by setting up Vundle/Bundle package manager.
" ========================================================================
set nocompatible " required
filetype off " required
set encoding=utf-8
" ========================================================================
" Set the runtime path to include Vundle/Bundle and initialize.
" ========================================================================
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" ========================================================================
" Let Vundle manage Vundles/Bundles.
" ========================================================================
Plugin 'gmarik/Vundle.vim'
" ========================================================================
" ========================================================================
" Add desired Plugins/Bundles here, before the "call" command below.
" When adding a new Plugin/Bundle, start vim (with no file specified), and
" run this command: :PluginInstall
" ========================================================================
" =================================
" JavaScript and Node
" =================================
Plugin 'jelera/vim-javascript-syntax'
Plugin 'moll/vim-node'
" =================================
" =================================
" GIT interface
" =================================
Plugin 'tpope/vim-fugitive'
" =================================
" =================================
" Filesystem
" =================================
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
" =================================
" =================================
" HTML
" =================================
Plugin 'jtratner/vim-flavored-markdown'
Plugin 'suan/vim-instant-markdown'
Plugin 'nelstrom/vim-markdown-preview'
" =================================
" =================================
" Python sytax checkers
" =================================
" NOTE: 'nvie/vim-flake8' requires that the 'flake8'
" package be installed in active Python3 environment.
" =================================
Plugin 'nvie/vim-flake8'
Plugin 'vim-syntastic/syntastic'
" =================================
" =================================
" Auto-completion
" =================================
Plugin 'Valloric/YouCompleteMe'
Plugin 'davidhalter/jedi-vim'
Plugin 'ervandew/supertab'
" =================================
" =================================
" Code folding
" =================================
Plugin 'tmhedberg/SimpylFold'
" =================================
" =================================
" Colors! \o/
" =================================
Plugin 'jnurmine/Zenburn'
Plugin 'rafi/awesome-vim-colorschemes'
Plugin 'altercation/vim-colors-solarized'
" =================================
" ========================================================================
" Again, all of your Plugins must be added above, before the following lines.
" ========================================================================
call vundle#end() " required
filetype plugin indent on " required
" ========================================================================
" ========================================================================
" Next, with all of the plugins installed above, we can adjust settings
" that now exist for them below.
" ========================================================================
" ========================================================================
" VIM split-screen navigation keystrokes
" ========================================================================
nnoremap <C-J> <C-W><C-J> " Ctrl-j: Move to BELOW split.
nnoremap <C-K> <C-W><C-K> " Ctrl-k: Move to ABOVE split.
nnoremap <C-L> <C-W><C-L> " Ctrl-l: Move to RIGHT split.
nnoremap <C-H> <C-W><C-H> " Ctrl-h: Move to LEFT split.
" ========================================================================
" ========================================================================
" Additional keystroke mappings.
" ========================================================================
"nnoremap <buffer> <F9> :new | 0read !/usr/bin/env python3 #
"nnoremap <silent> <F5> :!sh;python3 %<CR>
"nnoremap <buffer> <F9> :execute '!/usr/bin/env python3' shellescape(@%, 1)<cr>
"nnoremap <buffer> <F9> :execute 'new | 0read !/usr/bin/env python3' expand('%')
" ========================================================================
" Set Solarized color scheme.
" - A 'Solarized' palate is available in 'Terminator', but this works better.
" - These settings also work in gvim(1) (available in vim-X11 RPM package).
" - Comment out the 'highlight' directive to disable transparent background.
" ========================================================================
set background=dark
"colorscheme solarized8
colorscheme anderson
highlight Normal ctermbg=none
set guifont=Monospace\ 16
" ========================================================================
" ========================================================================
" Settings for a Python IDE-like development, including for PEP8 standards.
" Again, this was gleaned from here: http://bit.ly/22BdUeD
" ========================================================================
" ========================================================================
" Various enablements / adjustments. =:)
" ========================================================================
syntax on
set encoding=utf-8
let python_highlight_all=1
"
" #############################################################
"SEE: https://github.com/nvie/vim-flake8
"SEE: https://stackoverflow.com/a/16522506/1336758
" #############################################################
let g:syntastic_python_checkers = ['flake8', 'pyflakes', 'pylint']
"let g:syntastic_python_flake8_args = '--ignore=E101,E111,E112,[... snip ...]'
" ========================================================================
" ========================================================================
" Spacing related directives.
" ========================================================================
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=160 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
" ========================================================================
" ========================================================================
" Enable code-folding using the <spacebar> key, instead of typing 'za' (default).
" ========================================================================
set foldmethod=indent
set foldlevel=99
nnoremap <space> za
" ========================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment