Giter VIP home page Giter VIP logo

vim_pyde's Introduction

Vim Python Development Environment - Vim PyDE

 _    ___              ____        ____  ______
| |  / (_)___ ___     / __ \__  __/ __ \/ ____/
| | / / / __ `__ \   / /_/ / / / / / / / __/
| |/ / / / / / / /  / ____/ /_/ / /_/ / /___
|___/_/_/ /_/ /_/  /_/    \__, /_____/_____/
                         /____/

Welcome to the GitHub repository of the Vim PyDE!

Here you can find instruction on how to set up the Vim PyDE and how to use it. Please not that Vim PyDE is just a collection of Vim plugins, set-up together to work without problems and for convenient Python development.

At the moment, Vim PyDE is only for macOS.


Table of contents

  1. Introduction
  2. How to set-up Vim PyDE
  3. Plugins used
  4. Working with files
  5. Debugging
  6. Git integration
  7. Virtual environments
  8. Terminal and REPL
  9. View and change settings
  10. Spelling

Introduction

Through the years, I have gathered some Vim plugins that can allow a nice experience to work with Vim and Python. I have set-up these plugins to work without conflicts, and bundled them altogether in a easily re-usable code.

Vim PyDE offers all, if not more, of the functionality that one can find in standard Python IDEs, like PyCharm or VSCode. This is mostly due to the work of the developers of the plugins and, of course, due to the powerful Vim.

Please note that this repository is offered without any warranty and it should be used by your own responsibility. All plugins maintain their licences, since this code is just a Vim set-up that uses plugins.

Finally, to use Vim PyDE it is required some familiarity with Vim. For example, one should already know how to quit Vim or how to navigate around. Most of the extra functionality is covered by the used plugins and the remaining is explained here.


How to set-up Vim PyDE

To set-up Vim PyDE you have to use Homebrew and Plug. Homebrew is a package manager for macOS and Plug is a plugin manager for Vim.

Then, to set-up Vim PyDE you have to:

  1. Clone this repository somewhere on your computer by using:

    git clone https://github.com/dr-costas/myvim_files

    This will create the directory myvim_files which will call now ROOT directory.

  2. Execute the set-up script set_up_vim.py from within the ROOT directory and using the following flags:

    • --install-vim to install Vim using Homebrew.
    • --install-plug to install Plug.
    • --install-fonts to install NERDFonts for Vim
    • --install-plugins to install the plugins for Vim PyDE

    For example, to use all the above flags, you can do from inside ROOT directory:

    python set_up_vim.py --install-vim --install-plug --install-fonts --install-plugins

    All the above should be installed. The only reason for not installing them is if you already have them installed. For example, you might already have some NERDFonts installed and you do not need new all you already have installed Vim from Homebrew.

And your are ready!


Plugins used

Multiple plugins are used in order to make Vim PyDE happen. These will be listed here in alphabetical order, together with links to their GitHub repository.

  • Auto-pairs: The auto-pairs plugin allows to insert or delete brackets, quotes, etc., in pairs

  • Black: Black is the "uncompromising" Python code formatter.

  • CoC: Conquest of Completion (CoC) is a completion plugin and a platform with various add-ons.

  • CSV: CSV is a plugin for handling and nicely formatting CSV files.

  • FzF: FzF is a plugin that provides a wrapper function for the functionalities of the Fuzzy Finder.

  • Gruvbox: Gruvbox is a retro color scheme for Vim, and the color scheme currently used by Vim PyDE.

  • IndentLine: IndentiLine is a Vim plugin to display line indentation.

  • LightLine: LightLine is a status and tabline plugin.

  • LightLineBuffer: LightLineBuffer is a plugin to display open buffers in the LightLine.

  • NERDCommenter: NERDCommenter is a plugin that offers flexible commenting functionalities.

  • NERDTree: NERDTree is a file explorer for Vim.

  • NERDTree Git: NERDtree Git is a plugin to display git status of files in NERDTree.

  • Python syntax: Python syntax is a Python syntax highlighting plugin.

  • Tagbar: Tabgbar is a plugin that displays project structure/class outline.

  • Vim-Devicons: Vim-Devicons is a plugin that adds icons to files at NERDTree.

  • Vim-Fugitive: Vim-Fugitive is a git wrapper for Vim.

  • Vim-Gitgutter: Vim-Gitgutter id a plugin that shows git diff in the sign column.

  • Vim-Markdown: Vim-Markdown is a plugin that offers markdown syntax highlighting.

  • Vim-Pydocstring: Vim-Pydocstring offers generation of docstrings templates.

  • Vim-REPL: Vim-REPL is a plugin that offers REPL functionalities for Vim.

  • Vim-Templates: Vim-Templates offers usage of templates for file types.

  • Vimspector: Vimspector is a Vim debugger with full functionalities.

  • Vim-Startify: Vim-Startify is a plugin that adds a nice and fancy start screen.

  • Vim-Surround: Vim -Surround provides fast ways to alter and add surroundings, e.g. brackets.


Working with files

To explore, open, move, and delete, you can use the provided functionality from NERDTree. Typical movements and operations are described in the NERDTRee's GitHub or help file.

To add a new file, you either use NERDTree or the Vim-Templates plugin. Currently, templates exist for Python files (.py), YAML files (.yaml), Vimspector settings (.vimspector.json), and Vim specific files. A full list of the templates can be see at the ROOT/templates directory.

For example, to start a new file in the current buffer you can do:

:e my_python_file.py

and the new file my_python_file.py will open, having the pre-specified structure from the Python file template. If you want to edit the template, you can consult the Vim-Templates plugin documentation.


Debugging

Debugging is happening by the Vimspector plugin. Vimspector needs a settings file in the project's root folder or somewhere visible for Vimspector (check at the Vimspector's documentation for other than project's root folder locations).

To generate a Vimspector settings file, you can use the Vim-Templates and the provided template for Vimspector JSON file. Just do vsp .vimspector.json and the template will be created in the Vim's current working directory.

Vimspector has some available mappings for its operations. You can see those mappings at the Vimspector's GitHub. Additionally, Vim PyDE has the following added mappings:

Mapping Function
<leader>F3 Completely close Vimspector
<leader>F4 Fresh start of Vimspector
<leader>dF9 Delete all breakpoints

Git integration

Git is integrated in Vim PyDE through Vim-Fugitive plugin. This plugin offers typical commit/push/pull functions (and many more) through the :Git command. For example, a git commit would be:

:Git commit % -m "A commit"

where % means the file at the current active buffer.


Virtual environments

Virtual environments are handled through the coc-pyright add on of the CoC plugin. Basically, this means that you do not have to do anything, just log into your virtual environment before open Vim and coc-pyright will take care everything else.


Terminal and REPL

There are two ways to open and work in a terminal from Vim PyDE. The first is using the built in functionality from Vim and the second is by using the Vim-REPL plugin. Vim-PyDE offers mappings for both.

For the first case, you can use the mapping <leader>(C-T) (leader key plus Ctrl+T) and the terminal will open at the belowright position of the current buffer. Plus the environmental variable PYTHONPATH will be set as PYTHONPATH=$PYTHONPATH:..

For the second case, you can use the mapping <leader>zb and the terminal will open below everything, without setting up the PYTHONPATH.

To open the Python REPL, you can use the mapping <leader>zp. Additionally, you can check at the Vim-REPL documentation what other functionalities you can have. For example, Vim-REPL plugin allows to send code from a Python file directly to the REPL console for execution.


View and change settings

Settings of Vim PyDE are divided in two categories. First are the settings that are for Vim and then are the settings that affect the plugins. Vim settings are in the ROOT/vim_settings/ files.

All settings of Vim PyDE are either available from the used plugins or from the files in the ROOT/plugins_settings directory.

From the above two directories, you can see all settings and also modify them to you taste.


Spelling

Spelling and thesaurus are provided by Vim. For more info you can check the Vim's spelling documentation.


That's all folks!

vim_pyde's People

Contributors

dr-costas avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

maximilianpavon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.