marccodina / vim-python-ide

Python development config with asynchronous Vim Plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VIM Logo

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:

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       

Neovim

  • Dependency for Deoplete and NeoMake
  • Installation:
  • pip3 install neovim
    

Deoplete

  • An Asynchronous Completion Engine for Vim
  • Requirements:
  • Python 3
  • Vim 8+
  • Neovim (to be used as a server)

Neomake

  • Asynchronouse Linting Engine for Vim
  • Same requirements as Deoplete

Base16 (Optional)

Base16 is used to theme vim, it can also theme your terminal. Follow these steps to install:

  • Installing Base16
    git clone https://github.com/chriskempson/base16-shell.git ~/.config/base16-shell
    
    • Add the following to your shell config (Themes terminal + vim):
      • Bash + ZSH
        BASE16_SHELL=$HOME/.config/base16-shell/
        [ -n "$PS1" ] && [ -s $BASE16_SHELL/profile_helper.sh ] && eval "$($BASE16_SHELL/profile_helper.sh)"
        
      • Fish
        # Base16 Shell
        if status --is-interactive
            eval sh $HOME/.config/base16-shell/scripts/base16-default-dark.sh
        end
        
    • Add the following to your vimrc (Only theme vim):
      if filereadable(expand("~/.vimrc_background"))
        let base16colorspace=256
        source ~/.vimrc_background
      endif
      
  • If you dont want this feature simply remove this plugin from your vimrc and execute :PluginUpdate in vim, for proper removal delete the base16 plugin folder

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

Python

  • Python Mode - Python mode
    • Add the following to the bottom of your vimrc to prevent errors:
       python3 << EOF
       import vim
       import git
       def is_git_repo():
             try:
                 _ = git.Repo('.', search_parent_directories=True).git_dir
                 return "1"
             except:
                 return "0"
       vim.command("let g:pymode_rope = " + is_git_repo())
       EOF                 
      
  • PEP 8 Indentation - Python Indentation
  • Jinja - Syntax and Indentation
  • Neomake - An Asynchronous version of Syntastic
  • Deoplete - Asynchronous Compeletion Engine
  • Python Combined - Extra handling

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>

About

Python development config with asynchronous Vim Plugins

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Vim Script 80.9%Language:Shell 19.1%