ref: 2da1dde5ea566f82ebe6532bc6d3b8670fd77ce8 dotfiles/vim/.vim/after/ftplugin/python.vim -rw-r--r-- 1.1 KiB
Prune vim configuration

- Remove configurations for plugins no longer in use
- Remove a few custom "plugins" that don't get used much/ever
More vim housekeeping
Set foldmethod for python files
Suppress errors from black
Re-enable vim python-compiler
Open pydoc output in scratch buffer
Move python autoload file under ft directory
Infer python version from file shebang, if possible
Refactor python autoload file

Create an async autoload function that wraps the jobs API of neovim and
vim, and use that new function to define the python#set_path() function.
Since that function runs asynchronously (and therefore has negligible
performance impact), run it on every new Python buffer when possible.

When the jobs API is not available, run the set_path() function
synchronously but cache the result for each directory.
Set python include path asynchronously (if possible)
Set textwidth to 88 for Python
Add autoformat plugin and touch up some ftplugins

Remove 'if &filetype' guards from ftplugins -- at worst they prevent
ftplugin "chaining" (e.g. the liquid ftplugin sources the html ftplugin)
and at best they.... don't really do anything.
Update python ftplugin
Clean up plugins and use more consistent conventions
Disable Jedi "smart" auto mappings

By default Jedi automatically inserts the "import" in "from <module>
import <item>" statements, which was super annoying, so I disabled it.

Also temporarily disabled Python auto-format on write, because the
condition 'executable("yapf")' is returning true even when yapf is not
installed in the current virtualenv. Need to find a more sophisticated
solution that is robust to the current virtual environment.
Improve and cleanup filetype plugins

* Combine C and C++ filetypes - having both was entirely redundant
* Add a tags ftplugin to make tags files act like tags browsers
* Add a few new projections for Cmake and C-family files
* Add a few new mappings:
  - <Space>t for :tags
  - <Space>r for :registers
  - <Space>m for :marks
  - <Space>M for :marks ABCDE...wxyz
[vim] Enable (optional) autoformatting for Python
[vim] Remove textwidth setting and set colorcolumn manually in Python
[vim] Python adjustments

* Set textwidth to 80
* Add 'path' to b:undo_ftplugin
* Set python include path to just the site-packages directory of the
* Make ALE use the current directory for pylint (so that it respects the
  .python-version file from pyenv)
* Remove q; mapping