From 518676741fe729fc984d0258fd0f18a47f6fbe56 Mon Sep 17 00:00:00 2001 From: Integralist Date: Mon, 16 Jan 2017 09:36:21 +0000 Subject: [PATCH] Setup --- README.md | 17 +++++++++++++++++ autoload/mypy.vim | 14 ++++++++++++++ plugin/mypy.vim | 8 ++++++++ 3 files changed, 39 insertions(+) create mode 100644 README.md create mode 100644 autoload/mypy.vim create mode 100644 plugin/mypy.vim diff --git a/README.md b/README.md new file mode 100644 index 0000000..634f2d2 --- /dev/null +++ b/README.md @@ -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' +``` diff --git a/autoload/mypy.vim b/autoload/mypy.vim new file mode 100644 index 0000000..b69b628 --- /dev/null +++ b/autoload/mypy.vim @@ -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 diff --git a/plugin/mypy.vim b/plugin/mypy.vim new file mode 100644 index 0000000..cc749a8 --- /dev/null +++ b/plugin/mypy.vim @@ -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 mp :call mypy#ExecuteMyPy() +endif -- 2.45.2