aboutsummaryrefslogtreecommitdiff
path: root/runtime/ftplugin/python.vim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-05-04 19:18:16 -0400
committerGitHub <noreply@github.com>2021-05-04 19:18:16 -0400
commit4ad30f775e5564c539324b4818886f067d2ecd99 (patch)
tree97a554379bda7e5fc77e58c690db3f5a72db8c74 /runtime/ftplugin/python.vim
parent63d8a8f4e8b02e524d85aed08aa16c5d9815598c (diff)
parentd5b063aec1db95704b37a77fdbd968cb6b48cc3b (diff)
downloadrneovim-4ad30f775e5564c539324b4818886f067d2ecd99.tar.gz
rneovim-4ad30f775e5564c539324b4818886f067d2ecd99.tar.bz2
rneovim-4ad30f775e5564c539324b4818886f067d2ecd99.zip
Merge pull request #14424 from janlazo/vim-8.1.1726
vim-patch:8.1.1726,8.2.{296,860,1827,2388,2788,2790,2801}
Diffstat (limited to 'runtime/ftplugin/python.vim')
-rw-r--r--runtime/ftplugin/python.vim42
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