diff options
Diffstat (limited to 'runtime/ftplugin/python.vim')
-rw-r--r-- | runtime/ftplugin/python.vim | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 64c1a87a69..000ddf52a3 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -3,7 +3,7 @@ " Maintainer: Tom Picton <tom@tompicton.co.uk> " Previous Maintainer: James Sully <sullyj3@gmail.com> " Previous Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: Sun 17 Mar 2019 +" Last Change: Mon, 5 October 2020 " https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif @@ -14,6 +14,7 @@ set cpo&vim setlocal cinkeys-=0# setlocal indentkeys-=0# setlocal include=^\\s*\\(from\\\|import\\) +setlocal define=^\\s*\\(def\\\|class\\) " For imports with leading .., append / and replace additional .s with ../ let b:grandparent_match = '^\(.\.\)\(\.*\)' @@ -38,7 +39,7 @@ setlocal comments=b:#,fb:- setlocal commentstring=#\ %s if has('python3') - setlocal omnifunc=python3complete#Complete + setlocal omnifunc=python3complete#Complete elseif has('python') setlocal omnifunc=pythoncomplete#Complete endif @@ -115,35 +116,18 @@ endif if !exists("g:python_recommended_style") || g:python_recommended_style != 0 " As suggested by PEP8. - setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 + setlocal expandtab tabstop=4 softtabstop=4 shiftwidth=4 endif -" First time: try finding "pydoc". -if !exists('g:pydoc_executable') - if executable('pydoc') - let g:pydoc_executable = 1 - else - let g:pydoc_executable = 0 - endif -endif - -" Windows-specific pydoc setup -if has('win32') || has('win64') - if executable('python') - " available as Tools\scripts\pydoc.py - let g:pydoc_executable = 1 - else - let g:pydoc_executable = 0 - endif -endif - -" If "pydoc" was found use it for keywordprg. -if g:pydoc_executable - if has('win32') || has('win64') - setlocal keywordprg=python\ -m\ pydoc\ - else - setlocal keywordprg=pydoc - endif +" Use pydoc for keywordprg. +" Unix users preferentially get pydoc3, then pydoc2. +" Windows doesn't have a standalone pydoc executable in $PATH by default, nor +" does it have separate python2/3 executables, so Windows users just get +" whichever version corresponds to their installed Python version. +if executable('python3') + setlocal keywordprg=python3\ -m\ pydoc +elseif executable('python') + setlocal keywordprg=python\ -m\ pydoc endif " Script for filetype switching to undo the local stuff we may have changed |