diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-10-29 06:39:10 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-10-29 06:44:02 +0100 |
commit | 5c4a4217352edf82d32c03e6bec8c64b8f16a28c (patch) | |
tree | 80e4033cb4ac954fd463eb1a790e1fed0248b47d /runtime/ftplugin/python.vim | |
parent | c7513368f0e84da7ff3968c5b2912fa6ad15ab05 (diff) | |
download | rneovim-5c4a4217352edf82d32c03e6bec8c64b8f16a28c.tar.gz rneovim-5c4a4217352edf82d32c03e6bec8c64b8f16a28c.tar.bz2 rneovim-5c4a4217352edf82d32c03e6bec8c64b8f16a28c.zip |
vim-patch:98ef233e14fa
Update runtime files. Convert a couple of help files to utf-8.
https://github.com/vim/vim/commit/98ef233e14faaaf42e0342da1803d493ce0337b2
Diffstat (limited to 'runtime/ftplugin/python.vim')
-rw-r--r-- | runtime/ftplugin/python.vim | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 56f19cb323..ee271efaaf 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: Wed, 20 December 2017 +" Last Change: Sun, 18 March 2018 " https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif @@ -14,7 +14,25 @@ set cpo&vim setlocal cinkeys-=0# setlocal indentkeys-=0# setlocal include=^\\s*\\(from\\\|import\\) -setlocal includeexpr=substitute(v:fname,'\\.','/','g') + +" For imports with leading .., append / and replace additional .s with ../ +let b:grandparent_match = '^\(.\.\)\(\.*\)' +let b:grandparent_sub = '\=submatch(1)."/".repeat("../",strlen(submatch(2)))' + +" For imports with a single leading ., replace it with ./ +let b:parent_match = '^\.\(\.\)\@!' +let b:parent_sub = './' + +" Replace any . sandwiched between word characters with / +let b:child_match = '\(\w\)\.\(\w\)' +let b:child_sub = '\1/\2' + +setlocal includeexpr=substitute(substitute(substitute( + \v:fname, + \b:grandparent_match,b:grandparent_sub,''), + \b:parent_match,b:parent_sub,''), + \b:child_match,b:child_sub,'g') + setlocal suffixesadd=.py setlocal comments=b:#,fb:- setlocal commentstring=#\ %s |