mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 11:10:04 +08:00
Compare commits
3 Commits
76ae250f75
...
fe67bf23b8
Author | SHA1 | Date | |
---|---|---|---|
|
fe67bf23b8 | ||
|
c1acb0a4b1 | ||
|
8cda9e8b72 |
@ -227,6 +227,7 @@ function! SpaceVim#layers#core#plugins() abort
|
|||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/nerdcommenter', { 'loadconf' : 1, 'merged' : 0, 'on_map' : ['<Plug>NERDCommenter', '<Plug>Commenter']}])
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/nerdcommenter', { 'loadconf' : 1, 'merged' : 0, 'on_map' : ['<Plug>NERDCommenter', '<Plug>Commenter']}])
|
||||||
|
|
||||||
if exists('*matchaddpos')
|
if exists('*matchaddpos')
|
||||||
|
let g:loaded_matchit = 1
|
||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-matchup', {'merged' : 0, 'on_event' : 'BufReadPost'}])
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-matchup', {'merged' : 0, 'on_event' : 'BufReadPost'}])
|
||||||
endif
|
endif
|
||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/gruvbox', {'loadconf' : 1, 'merged' : 0}])
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/gruvbox', {'loadconf' : 1, 'merged' : 0}])
|
||||||
|
@ -100,7 +100,7 @@ endfunction
|
|||||||
function! SpaceVim#layers#edit#plugins() abort
|
function! SpaceVim#layers#edit#plugins() abort
|
||||||
let plugins = [
|
let plugins = [
|
||||||
\ [g:_spacevim_root_dir . 'bundle/vim-repeat'],
|
\ [g:_spacevim_root_dir . 'bundle/vim-repeat'],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/vim-emoji'],
|
\ [g:_spacevim_root_dir . 'bundle/vim-emoji', {'on_event' : 'BufReadPost'}],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/vim-grammarous', {'merged' : 0, 'on_cmd' : ['GrammarousCheck', 'GrammarousReset']}],
|
\ [g:_spacevim_root_dir . 'bundle/vim-grammarous', {'merged' : 0, 'on_cmd' : ['GrammarousCheck', 'GrammarousReset']}],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/vim-expand-region', { 'loadconf' : 1}],
|
\ [g:_spacevim_root_dir . 'bundle/vim-expand-region', { 'loadconf' : 1}],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/vim-textobj-user'],
|
\ [g:_spacevim_root_dir . 'bundle/vim-textobj-user'],
|
||||||
|
@ -119,7 +119,7 @@ function! SpaceVim#layers#lang#python#plugins() abort
|
|||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/jedi-vim', { 'on_ft' : 'python',
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/jedi-vim', { 'on_ft' : 'python',
|
||||||
\ 'if' : has('python') || has('python3')}])
|
\ 'if' : has('python') || has('python3')}])
|
||||||
endif
|
endif
|
||||||
call add(plugins, ['heavenshell/vim-pydocstring',
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-pydocstring',
|
||||||
\ { 'on_cmd' : 'Pydocstring'}])
|
\ { 'on_cmd' : 'Pydocstring'}])
|
||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-python-pep8-indent',
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-python-pep8-indent',
|
||||||
\ { 'on_ft' : 'python'}])
|
\ { 'on_ft' : 'python'}])
|
||||||
|
@ -79,9 +79,9 @@ let s:NVIM_VERSION = SpaceVim#api#import('neovim#version')
|
|||||||
|
|
||||||
function! SpaceVim#layers#ui#plugins() abort
|
function! SpaceVim#layers#ui#plugins() abort
|
||||||
let plugins = [
|
let plugins = [
|
||||||
\ [g:_spacevim_root_dir . 'bundle/vim-cursorword', {'merged' : 0}],
|
\ [g:_spacevim_root_dir . 'bundle/vim-cursorword', {'merged' : 0, 'on_event' : ['CursorMoved', 'CursorMovedI']}],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/tagbar',
|
\ [g:_spacevim_root_dir . 'bundle/tagbar',
|
||||||
\ {'loadconf' : 1, 'merged' : 0}],
|
\ {'loadconf' : 1, 'merged' : 0, 'on_cmd' : ['TagbarToggle', 'Tagbar']}],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/tagbar-makefile.vim',
|
\ [g:_spacevim_root_dir . 'bundle/tagbar-makefile.vim',
|
||||||
\ {'merged': 0}],
|
\ {'merged': 0}],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/tagbar-proto.vim', {'merged': 0}],
|
\ [g:_spacevim_root_dir . 'bundle/tagbar-proto.vim', {'merged': 0}],
|
||||||
@ -101,7 +101,7 @@ function! SpaceVim#layers#ui#plugins() abort
|
|||||||
if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version())
|
if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version())
|
||||||
\ || has('nvim-0.6.0')
|
\ || has('nvim-0.6.0')
|
||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/indent-blankline.nvim',
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/indent-blankline.nvim',
|
||||||
\ { 'merged' : 0}])
|
\ { 'merged' : 0, 'on_event' : ['BufReadPost']}])
|
||||||
else
|
else
|
||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/indentLine',
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/indentLine',
|
||||||
\ { 'merged' : 0}])
|
\ { 'merged' : 0}])
|
||||||
|
@ -168,6 +168,8 @@ call s:install_manager()
|
|||||||
|
|
||||||
|
|
||||||
function! SpaceVim#plugins#begin(path) abort
|
function! SpaceVim#plugins#begin(path) abort
|
||||||
|
let g:unite_source_menu_menus =
|
||||||
|
\ get(g:,'unite_source_menu_menus',{})
|
||||||
let g:unite_source_menu_menus.AddedPlugins =
|
let g:unite_source_menu_menus.AddedPlugins =
|
||||||
\ {'description':
|
\ {'description':
|
||||||
\ 'All the Added plugins'
|
\ 'All the Added plugins'
|
||||||
|
183
bundle/vim-pydocstring/.gitignore
vendored
Normal file
183
bundle/vim-pydocstring/.gitignore
vendored
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
### https://raw.github.com/github/gitignore/85bf08b19a77c62d7b6286c2db8811f2ff373b0f/Global/Vim.gitignore
|
||||||
|
|
||||||
|
# Swap
|
||||||
|
[._]*.s[a-v][a-z]
|
||||||
|
!*.svg # comment out if you don't need vector files
|
||||||
|
[._]*.sw[a-p]
|
||||||
|
[._]s[a-rt-v][a-z]
|
||||||
|
[._]ss[a-gi-z]
|
||||||
|
[._]sw[a-p]
|
||||||
|
|
||||||
|
# Session
|
||||||
|
Session.vim
|
||||||
|
Sessionx.vim
|
||||||
|
|
||||||
|
# Temporary
|
||||||
|
.netrwhist
|
||||||
|
*~
|
||||||
|
# Auto-generated tag files
|
||||||
|
tags
|
||||||
|
# Persistent undo
|
||||||
|
[._]*.un~
|
||||||
|
|
||||||
|
|
||||||
|
### https://raw.github.com/github/gitignore/85bf08b19a77c62d7b6286c2db8811f2ff373b0f/Python.gitignore
|
||||||
|
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
pip-wheel-metadata/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# celery beat schedule file
|
||||||
|
celerybeat-schedule
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
|
||||||
|
### https://raw.github.com/github/gitignore/85bf08b19a77c62d7b6286c2db8811f2ff373b0f/Global/macOS.gitignore
|
||||||
|
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
# App
|
||||||
|
doq
|
||||||
|
vader.vim/
|
376
bundle/vim-pydocstring/CHANGES.rst
Normal file
376
bundle/vim-pydocstring/CHANGES.rst
Normal file
@ -0,0 +1,376 @@
|
|||||||
|
Version 2.5.0
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Aug 22th 2020
|
||||||
|
|
||||||
|
- Add ignore_init option
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/py-doq/releases/tag/0.8.0
|
||||||
|
|
||||||
|
Version 2.4.0
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Dec 6th 2020
|
||||||
|
|
||||||
|
- Remove blank line at Neovim
|
||||||
|
|
||||||
|
Neovim add blank line to the end of file when PydocstringFormat executed.
|
||||||
|
This behavior is not expected and fix as Vim's behavior.
|
||||||
|
|
||||||
|
Version 2.3.7
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Dec 6th 2020
|
||||||
|
|
||||||
|
- Fix PydocstringFormat also fixed
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/123
|
||||||
|
|
||||||
|
Thx @tsuyoshicho
|
||||||
|
|
||||||
|
Version 2.3.6
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Dec 6th 2020
|
||||||
|
|
||||||
|
- Remove unnecessary complete
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/119
|
||||||
|
|
||||||
|
Thx @tsuyoshicho
|
||||||
|
|
||||||
|
Version 2.3.5
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Dec 6th 2020
|
||||||
|
|
||||||
|
- Fix buffer local mapping
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/118
|
||||||
|
|
||||||
|
Thx @tsuyoshicho
|
||||||
|
|
||||||
|
Version 2.3.4
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Nov 12th 2020
|
||||||
|
|
||||||
|
- Add option f and n for ln command
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/112
|
||||||
|
|
||||||
|
Thx @roachsinai
|
||||||
|
|
||||||
|
Version 2.3.3
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Nov 11th 2020
|
||||||
|
|
||||||
|
- Add support for smarttab / shiftwidth
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/110
|
||||||
|
|
||||||
|
Thx @brentyi
|
||||||
|
|
||||||
|
Version 2.3.2
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Jul 12th 2020
|
||||||
|
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
- PydocstringFormat deletes file contents if docstrings already present
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/105
|
||||||
|
|
||||||
|
Thx @jrwrigh @edkirk30
|
||||||
|
|
||||||
|
Version 2.3.1
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Apr 30th 2020
|
||||||
|
|
||||||
|
- Document fix
|
||||||
|
|
||||||
|
- Add README note regarding vim-plug and venv
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/95
|
||||||
|
|
||||||
|
Thx @acamso
|
||||||
|
|
||||||
|
Version 2.3.0
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Apr 28th 2020
|
||||||
|
|
||||||
|
- Minor changes
|
||||||
|
|
||||||
|
- Add support for Neovim
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/89
|
||||||
|
|
||||||
|
Thx @brentyi, @nkakouros
|
||||||
|
|
||||||
|
Version 2.2.0
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on Mar 31th 2020
|
||||||
|
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
- Fix can use relative path
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/82
|
||||||
|
|
||||||
|
Thx @Trashcleaner
|
||||||
|
|
||||||
|
- Add exception feature
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/79
|
||||||
|
|
||||||
|
Thx @JPFrancoia
|
||||||
|
|
||||||
|
|
||||||
|
Version 2.1.0
|
||||||
|
-------------
|
||||||
|
Released on Mar 3rd 2020
|
||||||
|
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
- Emits error only if in vim
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/72
|
||||||
|
|
||||||
|
Thx @nkakouros
|
||||||
|
|
||||||
|
Version 2.0.0
|
||||||
|
-------------
|
||||||
|
Released on Feb 22th 2020
|
||||||
|
|
||||||
|
Version 2.0.0
|
||||||
|
|
||||||
|
Version 1.0.0
|
||||||
|
-------------
|
||||||
|
Released on Feb 9th 2020
|
||||||
|
|
||||||
|
Last version of pure Vim script
|
||||||
|
|
||||||
|
Version 0.7.0
|
||||||
|
-------------
|
||||||
|
Released on Jan 18th 2020
|
||||||
|
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
- default value as dict create wrong docstring
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/61
|
||||||
|
|
||||||
|
Thx @LucaZampieri
|
||||||
|
|
||||||
|
Version 0.6.0
|
||||||
|
-------------
|
||||||
|
Released on Jun 30th 2018
|
||||||
|
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
- indent doesn't work with `{{_return_type_}}` or `{{_nested_indent_}}`
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/51
|
||||||
|
|
||||||
|
Thx @JPFrancoia
|
||||||
|
|
||||||
|
Version 0.5.0
|
||||||
|
-------------
|
||||||
|
Released on Jun 30th 2018
|
||||||
|
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
- Generate missing param
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/44
|
||||||
|
|
||||||
|
Version 0.4.0
|
||||||
|
-------------
|
||||||
|
Released on May 6th 2018
|
||||||
|
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
- Default parameter problem
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/46
|
||||||
|
|
||||||
|
Version 0.3.0
|
||||||
|
-------------
|
||||||
|
Released on Dec 10th 2017
|
||||||
|
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
- Nested typed args(e.g `List[int, int, int]`) are broken
|
||||||
|
- Cosmetic changes
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/40
|
||||||
|
|
||||||
|
|
||||||
|
Version 0.2.0
|
||||||
|
-------------
|
||||||
|
Released on Nov 19th 2017
|
||||||
|
|
||||||
|
- Minor changes
|
||||||
|
|
||||||
|
- Notice template `{{_return_type_}}` does not add extra blank
|
||||||
|
- Now template shows as is
|
||||||
|
|
||||||
|
Version 0.1.6
|
||||||
|
-------------
|
||||||
|
Released on Nov 18th 2017
|
||||||
|
|
||||||
|
- Minor changes
|
||||||
|
|
||||||
|
- Change function name camelCase to snake_case
|
||||||
|
- Change variable name camelCase to snake_case
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/34
|
||||||
|
|
||||||
|
Version 0.1.5
|
||||||
|
-------------
|
||||||
|
Released on Nov 18th 2017
|
||||||
|
|
||||||
|
- Fix bug
|
||||||
|
|
||||||
|
- Invalid space after {{_header_}}
|
||||||
|
- Document's custom template section was wrong
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/34
|
||||||
|
|
||||||
|
Thx @themightyoarfish
|
||||||
|
|
||||||
|
Version 0.1.4
|
||||||
|
-------------
|
||||||
|
Released on Sep 10th 2017
|
||||||
|
|
||||||
|
- Fix bug
|
||||||
|
|
||||||
|
Template does not exist exception at set wildignore=*.txt
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/32
|
||||||
|
|
||||||
|
Thx @demonye
|
||||||
|
|
||||||
|
Version 0.1.3
|
||||||
|
-------------
|
||||||
|
Released on Jul 18th 2017
|
||||||
|
|
||||||
|
- Fix bug
|
||||||
|
|
||||||
|
Do not ignore `.`.
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/28
|
||||||
|
|
||||||
|
Released on July 2nd 2017
|
||||||
|
|
||||||
|
- Fix bug
|
||||||
|
|
||||||
|
Variable type mismatch for: argTemplate
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/25
|
||||||
|
|
||||||
|
Thx @oxo42
|
||||||
|
|
||||||
|
Version 0.1.2
|
||||||
|
-------------
|
||||||
|
Released on Mar 25th 2017
|
||||||
|
|
||||||
|
- Fix bug
|
||||||
|
|
||||||
|
Ignored indent when docstring start with `'''`.
|
||||||
|
|
||||||
|
Delete blank line if `{{_returnType_}}` not exists.
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/19
|
||||||
|
|
||||||
|
Thx @brainscience
|
||||||
|
|
||||||
|
Version 0.1.1
|
||||||
|
-------------
|
||||||
|
Released on Feb 12th 2017
|
||||||
|
|
||||||
|
- Fix bug
|
||||||
|
|
||||||
|
If none typed arg, lack of last `:`.
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/17
|
||||||
|
|
||||||
|
Version 0.1.0
|
||||||
|
-------------
|
||||||
|
Released on Dec 25th 2016
|
||||||
|
|
||||||
|
- Add type-hint
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/15
|
||||||
|
|
||||||
|
Thx @letientai299
|
||||||
|
|
||||||
|
Version 0.0.9
|
||||||
|
-------------
|
||||||
|
Released on Nov 20th 2016
|
||||||
|
|
||||||
|
- Add Vader integration tests
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/14
|
||||||
|
|
||||||
|
Thx @letientai299
|
||||||
|
|
||||||
|
Version 0.0.8
|
||||||
|
-------------
|
||||||
|
Released on Sep 1th 2016
|
||||||
|
|
||||||
|
- Fix add expand to allow relative path
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/pull/12
|
||||||
|
|
||||||
|
thx @ning-yang
|
||||||
|
|
||||||
|
Version 0.0.7
|
||||||
|
-------------
|
||||||
|
Released on June 1th 2016
|
||||||
|
|
||||||
|
- add ``_nested_indent_`` template variable.
|
||||||
|
|
||||||
|
see https://github.com/heavenshell/vim-pydocstring/issues/3#issuecomment-222584162
|
||||||
|
|
||||||
|
Thx @pirDOL
|
||||||
|
|
||||||
|
Version 0.0.6
|
||||||
|
-------------
|
||||||
|
Released on January 17th 2016
|
||||||
|
|
||||||
|
- add ``pydocstring_enable_mapping`` option.
|
||||||
|
|
||||||
|
Thx @nfischer
|
||||||
|
|
||||||
|
Version 0.0.5
|
||||||
|
-------------
|
||||||
|
Released on September 28th 2015
|
||||||
|
|
||||||
|
- Tiny refactoring.
|
||||||
|
|
||||||
|
Version 0.0.4
|
||||||
|
-------------
|
||||||
|
Released on September 14th 2015
|
||||||
|
|
||||||
|
- Enable to use ``async`` keyword
|
||||||
|
|
||||||
|
|
||||||
|
Version 0.0.3
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on December 14th 2013
|
||||||
|
|
||||||
|
- Fix issue#5
|
||||||
|
|
||||||
|
Version 0.0.2
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on December 06th 2013
|
||||||
|
|
||||||
|
- Add template variables for Numpy style docstring
|
27
bundle/vim-pydocstring/LICENSE
Normal file
27
bundle/vim-pydocstring/LICENSE
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
Copyright (c) 2010-2020, Shinya Ohyanagi.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of Shinya Ohyanagi, Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
7
bundle/vim-pydocstring/Makefile
Normal file
7
bundle/vim-pydocstring/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.PHONY: install
|
||||||
|
install:
|
||||||
|
bash lib/install.sh
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf lib/doq lib/venv
|
157
bundle/vim-pydocstring/README.rst
Normal file
157
bundle/vim-pydocstring/README.rst
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
vim-pydocstring
|
||||||
|
===============
|
||||||
|
|
||||||
|
.. image:: https://github.com/heavenshell/vim-pydocstring/workflows/build/badge.svg?branch=master
|
||||||
|
:target: https://github.com/heavenshell/vim-pydocstring
|
||||||
|
|
||||||
|
.. image:: ./assets/vim-pydocstring.gif
|
||||||
|
|
||||||
|
vim-pydocstring is a generator for Python docstrings and is capable of automatically
|
||||||
|
|
||||||
|
* inserting one-line docstrings
|
||||||
|
* inserting multi-line docstrings
|
||||||
|
|
||||||
|
This plugin is heavily inspired by `phpdoc.vim <http://www.vim.org/scripts/script.php?script_id=1355>`_ and `sonictemplate.vim <https://github.com/mattn/sonictemplate-vim>`_.
|
||||||
|
|
||||||
|
Install
|
||||||
|
-------
|
||||||
|
|
||||||
|
Since version 2, vim-pydocstring requires `doq <https://pypi.org/project/doq/>`_.
|
||||||
|
|
||||||
|
You can install following command.
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
$ make install
|
||||||
|
|
||||||
|
Note
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
Activated venv needs to be deactivated before install doq.
|
||||||
|
|
||||||
|
This can be automated with vim-plug.
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
Plug 'heavenshell/vim-pydocstring', { 'do': 'make install', 'for': 'python' }
|
||||||
|
|
||||||
|
If you want install doq manually, you can install from PyPi.
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
$ python3 -m venv ./venv
|
||||||
|
$ ./venv/bin/pip3 install doq
|
||||||
|
|
||||||
|
Then set installed `doq <https://pypi.org/project/doq/>`_ path:
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
$ which doq
|
||||||
|
let g:pydocstring_doq_path = path/to/doq
|
||||||
|
|
||||||
|
Note
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
vim-pydocstring support Vim8.
|
||||||
|
|
||||||
|
Neovim works since v2.2.0, but if something wrong, send me pull requests to fix it.
|
||||||
|
|
||||||
|
If you want use old version checkout `1.0.0 <https://github.com/heavenshell/vim-pydocstring/releases/tag/1.0.0>`_
|
||||||
|
|
||||||
|
Basic usage
|
||||||
|
-----------
|
||||||
|
|
||||||
|
1. Move your cursor on a `def` or `class` keyword line,
|
||||||
|
2. type `:Pydocstring` and
|
||||||
|
3. watch a docstring template magically appear below the current line
|
||||||
|
|
||||||
|
Format all
|
||||||
|
----------
|
||||||
|
|
||||||
|
type `:PydocstringFormat` will insert all docstrings to current buffer.
|
||||||
|
|
||||||
|
Settings
|
||||||
|
--------
|
||||||
|
|
||||||
|
Pydocstring depends on ``shiftwidth`` if ``smarttab`` is set, otherwise
|
||||||
|
``softtabstop``. For the latter, you need to set like ``set softtabstop=4``.
|
||||||
|
|
||||||
|
Example ``.vimrc``
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
autocmd FileType python setlocal tabstop=4 shiftwidth=4 smarttab expandtab
|
||||||
|
|
||||||
|
Or:
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
|
||||||
|
|
||||||
|
Pydocstring use ftplugin, so `filetype plugin on` required.
|
||||||
|
|
||||||
|
Key map
|
||||||
|
-------
|
||||||
|
|
||||||
|
If you want change default keymapping, set following to your `.vimrc`.
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
nmap <silent> <C-_> <Plug>(pydocstring)
|
||||||
|
|
||||||
|
Or, if you want disable default keymapping, you can set like following.
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
let g:pydocstring_enable_mapping = 0
|
||||||
|
|
||||||
|
Formatter
|
||||||
|
---------
|
||||||
|
|
||||||
|
You can set built-in formatter(Sphinx, Numpy, Google).
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
let g:pydocstring_formatter = 'numpy'
|
||||||
|
|
||||||
|
|
||||||
|
Custom template
|
||||||
|
---------------
|
||||||
|
|
||||||
|
You can set custom template. See `example <https://github.com/heavenshell/py-doq/tree/master/examples>`_.
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
let g:pydocstring_templates_path = '/path/to/custom/templates'
|
||||||
|
|
||||||
|
Exceptions
|
||||||
|
----------
|
||||||
|
|
||||||
|
If you want add exceptions to docstring, create custom template
|
||||||
|
and visual select source block and hit `:'<,'>Pydocstring` and then
|
||||||
|
excptions add to docstring.
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
def foo():
|
||||||
|
"""Summary of foo.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
Exception:
|
||||||
|
"""
|
||||||
|
raise Exception('foo')
|
||||||
|
|
||||||
|
Ignore generate __init__ docstring
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
If you want ignore to generate `__init__` docstring, you can set like following.
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
let g:pydocstring_ignore_init = 1
|
||||||
|
|
||||||
|
Thanks
|
||||||
|
------
|
||||||
|
|
||||||
|
The idea of venv installation is from `vim-lsp-settings <https://github.com/mattn/vim-lsp-settings>`_.
|
||||||
|
Highly applicate `@mattn <https://github.com/mattn/>`_ and all vim-lsp-settings contributors.
|
241
bundle/vim-pydocstring/autoload/pydocstring.vim
Normal file
241
bundle/vim-pydocstring/autoload/pydocstring.vim
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
" Insert Docstring.
|
||||||
|
" Author: Shinya Ohyanagi <sohyanagi@gmail.com>
|
||||||
|
" WebPage: http://github.com/heavenshell/vim-pydocstriong/
|
||||||
|
" Description: Generate Python docstring to your Python script file.
|
||||||
|
" License: BSD, see LICENSE for more details.
|
||||||
|
" NOTE: This module is heavily inspired by php-doc.vim and
|
||||||
|
" sonictemplate.vim
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
let g:pydocstring_templates_path = get(g:, 'pydocstring_templates_path', '')
|
||||||
|
let g:pydocstring_formatter = get(g:, 'pydocstring_formatter', 'sphinx')
|
||||||
|
let g:pydocstring_doq_path = get(
|
||||||
|
\ g:,
|
||||||
|
\ 'pydocstring_doq_path',
|
||||||
|
\ printf('%s/lib/doq', expand('<sfile>:p:h:h'))
|
||||||
|
\ )
|
||||||
|
let g:pydocstring_ignore_init = get(g:, 'pydocstring_ignore_init', 0)
|
||||||
|
|
||||||
|
let s:results = []
|
||||||
|
|
||||||
|
function! s:get_indent_width() abort
|
||||||
|
" Get indentation width
|
||||||
|
return &smarttab ? &shiftwidth : &softtabstop
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:get_range() abort
|
||||||
|
" Get visual mode selection.
|
||||||
|
let mode = visualmode(1)
|
||||||
|
if mode == 'v' || mode == 'V' || mode == ''
|
||||||
|
let start_lineno = line("'<")
|
||||||
|
let end_lineno = line("'>")
|
||||||
|
return {'start_lineno': start_lineno, 'end_lineno': end_lineno}
|
||||||
|
endif
|
||||||
|
let current = line('.')
|
||||||
|
return {'start_lineno': 0, 'end_lineno': '$'}
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:insert_docstring(docstrings, end_lineno) abort
|
||||||
|
let paste = &g:paste
|
||||||
|
let &g:paste = 1
|
||||||
|
|
||||||
|
silent! execute 'normal! ' . a:end_lineno . 'G$'
|
||||||
|
let current_lineno = line('.')
|
||||||
|
" If current position is bottom, add docstring below.
|
||||||
|
if a:end_lineno == current_lineno
|
||||||
|
silent! execute 'normal! O' . a:docstrings['docstring']
|
||||||
|
else
|
||||||
|
silent! execute 'normal! o' . a:docstrings['docstring']
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &g:paste = paste
|
||||||
|
silent! execute 'normal! ' . a:end_lineno . 'G$'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:callback(msg, indent, start_lineno) abort
|
||||||
|
let msg = join(a:msg, '')
|
||||||
|
" Check needed for Neovim
|
||||||
|
if len(msg) == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let docstrings = reverse(json_decode(msg))
|
||||||
|
silent! execute 'normal! 0'
|
||||||
|
let length = len(docstrings)
|
||||||
|
for docstring in docstrings
|
||||||
|
let lineno = 0
|
||||||
|
if length > 1
|
||||||
|
call cursor(a:start_lineno + docstring['start_lineno'] - 1, 1)
|
||||||
|
let lineno = search('\:\(\s*#.*\)*$', 'n') + 1
|
||||||
|
else
|
||||||
|
let lineno = search('\:\(\s*#.*\)*$', 'n') + 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:insert_docstring(docstring, lineno)
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:format_callback(msg, indent, start_lineno) abort
|
||||||
|
call extend(s:results, a:msg)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:exit_callback(msg) abort
|
||||||
|
unlet s:job " Needed for Neovim
|
||||||
|
let length = len(s:results)
|
||||||
|
if length
|
||||||
|
if length == 1 && s:results[0] == ''
|
||||||
|
let s:results = []
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let view = winsaveview()
|
||||||
|
silent execute '% delete'
|
||||||
|
|
||||||
|
" Hack for Neovima PydocstringFormat
|
||||||
|
" Neovim add blank line to the end of list
|
||||||
|
if has('nvim') && s:results[-1] == ''
|
||||||
|
call remove(s:results, -1)
|
||||||
|
endif
|
||||||
|
call setline(1, s:results)
|
||||||
|
call winrestview(view)
|
||||||
|
let s:results = []
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:execute(cmd, lines, indent, start_lineno, cb, ex_cb) abort
|
||||||
|
if !executable(expand(g:pydocstring_doq_path))
|
||||||
|
redraw
|
||||||
|
echohl Error
|
||||||
|
echo '`doq` not found. Install `doq`.'
|
||||||
|
echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:results = []
|
||||||
|
if has('nvim')
|
||||||
|
if exists('s:job')
|
||||||
|
call jobstop(s:job)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:job = jobstart(a:cmd, {
|
||||||
|
\ 'on_stdout': {_c, m, _e -> a:cb(m, a:indent, a:start_lineno)},
|
||||||
|
\ 'on_exit': {_c, m, _e -> a:ex_cb(m)},
|
||||||
|
\ 'stdout_buffered': v:true,
|
||||||
|
\ })
|
||||||
|
|
||||||
|
if exists('*chansend')
|
||||||
|
" Neovim >0.3.0
|
||||||
|
call chansend(s:job, a:lines)
|
||||||
|
call chanclose(s:job, 'stdin')
|
||||||
|
else
|
||||||
|
" Legacy API
|
||||||
|
call jobsend(s:job, a:lines)
|
||||||
|
call jobclose(s:job, 'stdin')
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
if exists('s:job') && job_status(s:job) != 'stop'
|
||||||
|
call job_stop(s:job)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:job = job_start(a:cmd, {
|
||||||
|
\ 'callback': {_, m -> a:cb([m], a:indent, a:start_lineno)},
|
||||||
|
\ 'exit_cb': {_, m -> a:ex_cb([m])},
|
||||||
|
\ 'in_mode': 'nl',
|
||||||
|
\ })
|
||||||
|
|
||||||
|
let channel = job_getchannel(s:job)
|
||||||
|
if ch_status(channel) ==# 'open'
|
||||||
|
call ch_sendraw(channel, a:lines)
|
||||||
|
call ch_close_in(channel)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:create_cmd(style, omissions) abort
|
||||||
|
if a:omissions ==# ''
|
||||||
|
let cmd = printf(
|
||||||
|
\ '%s --style=%s --formatter=%s --indent=%s',
|
||||||
|
\ expand(g:pydocstring_doq_path),
|
||||||
|
\ a:style,
|
||||||
|
\ g:pydocstring_formatter,
|
||||||
|
\ s:get_indent_width()
|
||||||
|
\ )
|
||||||
|
else
|
||||||
|
let cmd = printf(
|
||||||
|
\ '%s --style=%s --formatter=%s --omit=%s --indent=%s',
|
||||||
|
\ expand(g:pydocstring_doq_path),
|
||||||
|
\ a:style,
|
||||||
|
\ g:pydocstring_formatter,
|
||||||
|
\ a:omissions,
|
||||||
|
\ s:get_indent_width()
|
||||||
|
\ )
|
||||||
|
endif
|
||||||
|
if g:pydocstring_templates_path !=# ''
|
||||||
|
let cmd = printf('%s --template_path=%s', cmd, expand(g:pydocstring_templates_path))
|
||||||
|
endif
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! pydocstring#format() abort
|
||||||
|
let lines = printf("%s\n", join(getbufline(bufnr('%'), 1, '$'), "\n"))
|
||||||
|
let cmd = s:create_cmd('string', '')
|
||||||
|
let cmd = g:pydocstring_ignore_init ? printf('%s --ignore_init', cmd) : cmd
|
||||||
|
|
||||||
|
let indent = s:get_indent_width()
|
||||||
|
let end_lineno = line('.')
|
||||||
|
call s:execute(
|
||||||
|
\ cmd,
|
||||||
|
\ lines,
|
||||||
|
\ indent,
|
||||||
|
\ end_lineno,
|
||||||
|
\ function('s:format_callback'),
|
||||||
|
\ function('s:exit_callback')
|
||||||
|
\ )
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! pydocstring#insert(...) abort
|
||||||
|
let range = s:get_range()
|
||||||
|
let pos = getpos('.')
|
||||||
|
|
||||||
|
let line = getline('.')
|
||||||
|
let indent = matchstr(line, '^\(\s*\)')
|
||||||
|
|
||||||
|
let space = repeat(' ', s:get_indent_width())
|
||||||
|
let indent = indent . space
|
||||||
|
if len(indent) == 0
|
||||||
|
let indent = space
|
||||||
|
endif
|
||||||
|
|
||||||
|
silent! execute 'normal! 0'
|
||||||
|
|
||||||
|
let is_not_range = range['start_lineno'] == 0 && range['end_lineno'] == '$'
|
||||||
|
if is_not_range
|
||||||
|
let start_lineno = line('.')
|
||||||
|
let end_lineno = search('\:\(\s*#.*\)*$')
|
||||||
|
else
|
||||||
|
let start_lineno = range['start_lineno']
|
||||||
|
let end_lineno = range['end_lineno']
|
||||||
|
endif
|
||||||
|
call setpos('.', pos)
|
||||||
|
|
||||||
|
let cmd = s:create_cmd('json', 'self,cls')
|
||||||
|
let lines = join(getline(start_lineno, end_lineno), "\n")
|
||||||
|
if is_not_range
|
||||||
|
let lines = printf("%s\n%s%s", lines, indent, 'pass')
|
||||||
|
let cmd = printf('%s --ignore_exception', cmd)
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:execute(
|
||||||
|
\ cmd,
|
||||||
|
\ lines,
|
||||||
|
\ indent,
|
||||||
|
\ start_lineno,
|
||||||
|
\ function('s:callback'),
|
||||||
|
\ function('s:exit_callback')
|
||||||
|
\ )
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
213
bundle/vim-pydocstring/doc/pydocstring.txt
Normal file
213
bundle/vim-pydocstring/doc/pydocstring.txt
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
*pydocstring.txt* Generate Python docstring to your Python code.
|
||||||
|
|
||||||
|
Version: 2.5.0
|
||||||
|
Author: Shinya Ohynagi <sohyanagi@gmail.com>
|
||||||
|
Repository: http://github.com/heavenshell/vim-pydocstring/
|
||||||
|
License: BSD, see LICENSE for more details.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
CONTENTS *pydocstring-vim-contents*
|
||||||
|
|
||||||
|
Introduction |pydocstring-introduction|
|
||||||
|
Install |pydocstring-install|
|
||||||
|
Tutorial |pydocstring-tutorial|
|
||||||
|
Template |pydocstring-template|
|
||||||
|
Variables |pydocstring-variables|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
INTRODUCTION *pydocstring-vim-introduction*
|
||||||
|
|
||||||
|
|Pydocstring| is a generater of Python docstring.
|
||||||
|
|
||||||
|
* Insert one-line docstring.
|
||||||
|
* Insert multi-line docstring.
|
||||||
|
|
||||||
|
This plugin is heavily inspired by phpdoc.vim and sonictemplate.vim.
|
||||||
|
- phpdoc.vim
|
||||||
|
http://www.vim.org/scripts/script.php?script_id=1355
|
||||||
|
- sonictemplate.vim
|
||||||
|
https://github.com/mattn/sonictemplate-vim
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
INSTALL *pydocstring-vim-install*
|
||||||
|
|
||||||
|
Install the distributed files into Vim runtime directory which is usually
|
||||||
|
~/.vim/, or $HOME/vimfiles on Windows.
|
||||||
|
|
||||||
|
If you install pathogen that provided from Tim Pope, you should extract the
|
||||||
|
file into 'bundle' directory.
|
||||||
|
|
||||||
|
Pydocstring v2 is support only Vim8 and depends on `doq`.
|
||||||
|
|
||||||
|
Install `doq` first.
|
||||||
|
>
|
||||||
|
$ make install
|
||||||
|
>
|
||||||
|
If you want install `doq` manually, you can install from `PyPi`.
|
||||||
|
>
|
||||||
|
$ python3 -m venv ./venv
|
||||||
|
$ ./venv/bin/pip3 install doq
|
||||||
|
<
|
||||||
|
Than set installed `doq` path to |g:pydocstring_doq_path|.
|
||||||
|
|
||||||
|
Activated venv needs to be deactivated before insatll doq.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
TUTORIAL *pydocstring-vim-tutorial*
|
||||||
|
|
||||||
|
1. def keyword.
|
||||||
|
Define function to your code.
|
||||||
|
>
|
||||||
|
def foo(arg1, arg2):
|
||||||
|
pass
|
||||||
|
<
|
||||||
|
Set cursor on `def` line and type following.
|
||||||
|
>
|
||||||
|
:Pydocstring
|
||||||
|
<
|
||||||
|
Then docstring put under `def` line.
|
||||||
|
>
|
||||||
|
def foo(arg1, arg2):
|
||||||
|
"""foo.
|
||||||
|
|
||||||
|
:param arg1:
|
||||||
|
:param arg2:
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
<
|
||||||
|
|
||||||
|
2. class keyword.
|
||||||
|
Define class to your code.
|
||||||
|
>
|
||||||
|
class Foo(object):
|
||||||
|
def foo(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def arg1(self, arg1):
|
||||||
|
pass
|
||||||
|
<
|
||||||
|
Set cursor on `class` line and type following.
|
||||||
|
>
|
||||||
|
:Pydocstring
|
||||||
|
<
|
||||||
|
Then one-line docstring put under `class` line.
|
||||||
|
>
|
||||||
|
class Foo(object):
|
||||||
|
"""Foo."""
|
||||||
|
|
||||||
|
def foo(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def bar(self, arg1):
|
||||||
|
pass
|
||||||
|
<
|
||||||
|
Set cursor on `def foo` line and type following.
|
||||||
|
>
|
||||||
|
:Pydocstring
|
||||||
|
<
|
||||||
|
Then one-line docstring put under `def foo` line.
|
||||||
|
>
|
||||||
|
class Foo(object):
|
||||||
|
"""Foo."""
|
||||||
|
|
||||||
|
def foo(self):
|
||||||
|
"""foo."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def bar(self, arg1):
|
||||||
|
pass
|
||||||
|
<
|
||||||
|
Set cursor on `def bar` line and type following.
|
||||||
|
>
|
||||||
|
:Pydocstring
|
||||||
|
<
|
||||||
|
Then one-line docstring put under `def bar` line.
|
||||||
|
>
|
||||||
|
class Foo(object):
|
||||||
|
"""Foo."""
|
||||||
|
|
||||||
|
def foo(self):
|
||||||
|
"""foo."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def bar(self, arg1):
|
||||||
|
"""bar.
|
||||||
|
|
||||||
|
:param arg1:
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
<
|
||||||
|
3. Visual select format
|
||||||
|
>
|
||||||
|
class Foo(object):
|
||||||
|
def foo(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def bar(self, arg1):
|
||||||
|
pass
|
||||||
|
<
|
||||||
|
Visual select `v3j` and type following
|
||||||
|
>
|
||||||
|
:'<,'>Pydocstring
|
||||||
|
<
|
||||||
|
|
||||||
|
Then docstrings put under `class Foo(object):` and `def bar` line.
|
||||||
|
>
|
||||||
|
class Foo(object):
|
||||||
|
"""Foo."""
|
||||||
|
|
||||||
|
def foo(self):
|
||||||
|
"""foo."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
4. Format current buffer
|
||||||
|
|
||||||
|
type following
|
||||||
|
>
|
||||||
|
:PydocstringFormat
|
||||||
|
<
|
||||||
|
Then docstrings will put under class, def keywords.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
TEMPLATE *pydocstring-vim-template*
|
||||||
|
|
||||||
|
If you don't like default docstring, You can modify docstring template.
|
||||||
|
>
|
||||||
|
let g:pydocstring_templates_path = '/path/to/your/template/directory'
|
||||||
|
<
|
||||||
|
You can create custom template.
|
||||||
|
See `tests/templates' for example.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
VARIABLES *pydocstring-vim-variables*
|
||||||
|
|
||||||
|
pydocstring_formatter *g:pydocstring_formatter*
|
||||||
|
Formatter option.
|
||||||
|
'sphinx', 'google', 'numpy'
|
||||||
|
Default value is 'sphinx'
|
||||||
|
|
||||||
|
g:pydocstring_templates_path *g:pydocstring_templates_path*
|
||||||
|
Path to your own template file.
|
||||||
|
Refer template/pydocstring/ about the default value.
|
||||||
|
|
||||||
|
g:pydocstring_doq_path *g:pydocstring_doq_path*
|
||||||
|
Path to doq command.
|
||||||
|
Default value is 'lib/doq'
|
||||||
|
|
||||||
|
g:pydocstring_enable_mapping *g:pydocstring_enable_mapping*
|
||||||
|
Disable this option to prevent pydocstring from creating any
|
||||||
|
key mapping to the `:Pydocstring` command.
|
||||||
|
Note: this value is overridden if you explicitly create a
|
||||||
|
mapping in your vimrc, such as if you do:
|
||||||
|
|
||||||
|
nmap <silent> <C-m> <Plug>(pydocstring)
|
||||||
|
|
||||||
|
Default value is '1'
|
||||||
|
|
||||||
|
g:pydocstring_ignore_init *g:pydocstring_ignore_init*
|
||||||
|
Ignore to generate __init__ method docstring.
|
||||||
|
This option only available at `:PydocstringFormat`
|
||||||
|
Default value is '0'
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:
|
28
bundle/vim-pydocstring/ftplugin/python/pydocstring.vim
Normal file
28
bundle/vim-pydocstring/ftplugin/python/pydocstring.vim
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
" File: pydocstring.vim
|
||||||
|
" Author: Shinya Ohyanagi <sohyanagi@gmail.com>
|
||||||
|
" Version: 2.5.0
|
||||||
|
" WebPage: http://github.com/heavenshell/vim-pydocstring/
|
||||||
|
" Description: Generate Python docstring to your Python script file.
|
||||||
|
" License: BSD, see LICENSE for more details.
|
||||||
|
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" version check
|
||||||
|
if !has('nvim') && (!has('channel') || !has('job'))
|
||||||
|
echoerr '+channel and +job are required for pydocstring.vim'
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
command! -buffer -nargs=0 -range=0 Pydocstring call pydocstring#insert(<q-args>, <count>, <line1>, <line2>)
|
||||||
|
command! -buffer -nargs=0 PydocstringFormat call pydocstring#format()
|
||||||
|
|
||||||
|
nnoremap <silent> <buffer> <Plug>(pydocstring) :call pydocstring#insert()<CR>
|
||||||
|
if get(g:, 'pydocstring_enable_mapping', 1)
|
||||||
|
if !hasmapto('<Plug>(pydocstring)', 'n')
|
||||||
|
nmap <silent> <buffer> <C-l> <Plug>(pydocstring)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
Loading…
Reference in New Issue
Block a user