Skip to content

Instantly share code, notes, and snippets.

@Axeltherabbit
Last active July 18, 2020 10:18
Show Gist options
  • Save Axeltherabbit/b61b5db45a16fe2029025f440157970b to your computer and use it in GitHub Desktop.
Save Axeltherabbit/b61b5db45a16fe2029025f440157970b to your computer and use it in GitHub Desktop.
python vimrc
"I use this vimrc for python
"you just need to install Vundle and run :PluginInstall into this file
"then complete the installation of Valloric/YouCompleteMe manually
"and install pylint, mypy, black in your python env
"If something goes wrong read the errors and fix them all :D
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
" ...
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
Plugin 'tmhedberg/SimpylFold'
let g:SimpylFold_docstring_preview=1
Plugin 'vim-scripts/indentpython.vim'
"PEP8 indentation
au BufNewFile, BufRead *.py
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79
\ set expandtab
\ set autoindent
\ set fileformat=unix
" highlight unnecessary whitespace
au BufRead, BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
" encoding
set encoding=utf-8
Bundle 'Valloric/YouCompleteMe'
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
"pylint and mypy checker
Plugin 'dense-analysis/ale'
" Check Python files with flake8 and pylint.
let b:ale_linters = ['flake8', 'pylint',"mypy"]
" Fix Python files with autopep8 and yapf.
let b:ale_fixers = ['autopep8', 'yapf']
" Disable warnings about trailing whitespace for Python files.
let b:ale_warn_about_trailing_whitespace = 0
"Black
Plugin 'psf/black'
autocmd BufWritePre *.py execute ':Black'
"more syntax things
let python_highlight_all=1
syntax on
"File tree and tabs
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
"open nerdtree at the startup
let g:nerdtree_tabs_open_on_console_startup=1
"Set TAB = open in a new tab
let NERDTreeMapOpenInTab='<TAB>'
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
"File search ctrl+p
Plugin 'kien/ctrlp.vim'
"Line numbering
set nu
"git in vim
Plugin 'tpope/vim-fugitive'
"PowerLine
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
"always shows the powerline
set laststatus=2
"share sys clipboard for copy and paste
set clipboard=unnamed
" CDC = Change to Directory of Current file
command CDC cd %:p:h
" quick switch through tabs ctrl+leftarrow and ctl+rightarrow
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
" cursor to click
set mouse=a
" All of your Plugins must be added before the following line
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