diff runtime/ftplugin/python.vim @ 22565:17c4178f26ea

Update runtime files. Commit: https://github.com/vim/vim/commit/4f4d51a942cc2c6b3e936ee0f93f00c2d000065c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 11 13:57:40 2020 +0200 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Oct 2020 14:00:05 +0200
parents bd7461db24b3
children 8ae680be2a51
line wrap: on
line diff
--- 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
-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
+    setlocal expandtab tabstop=4 softtabstop=4 shiftwidth=4
 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