/vim-python-ide

Python development config

Primary LanguageVim scriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Imgur

screenshot

Table of contents

Getting Started

A script shell will get a copy of the vimrc up and running on your local machine for testing purposes. The script will install the vimrc and compile the YouCompleteMe plugin:

Bash

sh -c "$(curl -fsSL https://raw.githubusercontent.com/jarolrod/vim-python-ide/master/setup.sh)"

Fish

curl -fsSL https://raw.githubusercontent.com/jarolrod/vim-python-ide/master/setup.sh | sh       

YouCompleteMe

YouCompleteMe must be compiled for it to work. The install script handles the compiling, but if something goes wrong then do the following:

  1. Make sure the following is included in your vimrc where all the vundle plugins are placed:
Plugin 'Valloric/YouCompleteMe'

MacOS

  1. Assuming you already have MacVim installed, install Cmake through brew
brew install cmake
  1. Navigate to YouCompleteMe bundle folder and run the compile script
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
  1. Reference the YouCompleteMe README.md for any other configuration

Linux

Make sure you have Cmake and Python 3 Headers, they can be downloaded through your distributions package manager. Then run:

cd ~/.vim/bundle/YouCompleteMe
python3 ./install.py --clang-completer

DevIcons (Optional)

This plugin is used to show file icons in NerdTree and requires additional steps to install:

  • Must install a patched font that contains required glyphs:
    • Arch Linux
    • Everyone Else
    • Set vim encoding to UTF-8
      set encoding=utf8
      
    • Set vim font to NerdFont
      set guifont=<FONT_NAME> <FONT_SIZE>
      
    • Add glyphs to Airline
      let g:airline_powerline_fonts = 1
      
  • If you dont want this feature simply remove this plugin from your vimrc and execute :PluginUpdate in vim, for proper removal delete the devicons plugin folder

Alternatively:

  • Cherry pick the parts you like from my vimrc and add it to yours

Plugins

Code and Project Navigation

Snippets

Extra

Key-Bindings

Python

let g:pymode_run_bind='<F5>'
imap <F5> <Esc>:w<CR>:!clear;python %<CR>

Switching Between Buffers

nmap <F9> :bprev<CR>
nmap <F10> :bnext<CR>

Toggle Relative Numbering

nnoremap <F4> :set relativenumber!<CR>

Comfortable Motion Scrolling

let g:comfortable_motion_scroll_down_key = "j"
let g:comfortable_motion_scroll_up_key = "k"  
nnoremap <silent> <C-d> :call comfortable_motion#flick(g:comfortable_motion_imp    ulse_multiplier * winheight(0) * 2)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(g:comfortable_motion_imp    ulse_multiplier * winheight(0) * -2)<CR>
nnoremap <silent> <C-f> :call comfortable_motion#flick(g:comfortable_motion_imp    ulse_multiplier * winheight(0) * 4)<CR>
nnoremap <silent> <C-b> :call comfortable_motion#flick(g:comfortable_motion_imp    ulse_multiplier * winheight(0) * -4)<CR>

NerdTree Toggle

  • NerdTree wil automatically open when vim is launched in terminal without a file
nmap " :NERDTreeToggle<CR>

Disable Arrow Keys

no <down> <Nop>
no <left> <Nop>
no <right> <Nop>
no <up> <Nop>

ino <down> <Nop>
ino <left> <Nop>
ino <right> <Nop>
ino <up> <Nop>
                                                                               
vno <down> <Nop>
vno <left> <Nop>
vno <right> <Nop>
vno <up> <Nop>