~dricottone/vim-mypy

518676741fe729fc984d0258fd0f18a47f6fbe56 — Integralist 7 years ago 27ec181
Setup
3 files changed, 39 insertions(+), 0 deletions(-)

A README.md
A autoload/mypy.vim
A plugin/mypy.vim
A README.md => README.md +17 -0
@@ 0,0 1,17 @@
# vim-mypy

Vim plugin for executing Python's optional static type checker [MyPy](http://mypy-lang.org/)

## Install

### [Pathogen](https://github.com/tpope/vim-pathogen)

```bash
git clone https://github.com/integralist/vim-mypy ~/.vim/bundle/vim-mypy
```

### [Vundle](https://github.com/gmarik/vundle)

```
Plugin 'integralist/vim-mypy'
```

A autoload/mypy.vim => autoload/mypy.vim +14 -0
@@ 0,0 1,14 @@
" The autoload script allows the function to be defined
" without loading it, until, the user actually calls it
"
" This helps reduce the startup time for Vim
" As plugin/mypy.vim only contains simple logic/mappings
" All functional aspects of code is defined in autoload
"
" Add mypy# prefix to any calls for ExecuteMyPy
" Vim will search in this autoload directory for the function

function ExecuteMyPy()
  silent !clear
  execute "!mypy " . bufname("%")
endfunction

A plugin/mypy.vim => plugin/mypy.vim +8 -0
@@ 0,0 1,8 @@
if !executable("mypy")
  echom "The mypy executable was not found in your runtime path"
else
  command! Mypy call mypy#ExecuteMyPy()

  " Following mapping is only applied to current buffer
  nnoremap <buffer> <localleader>mp :call mypy#ExecuteMyPy()<cr>
endif