From 2648c3579a4d274ee46f83db1bd63af38fa9e0a7 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 28 Apr 2017 21:33:15 +0200 Subject: vim-patch:abd468ed0fbc Updated runtime files https://github.com/vim/vim/commit/abd468ed0fbcba391e7833feeaa7de3ced841455 --- runtime/ftplugin/python.vim | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'runtime/ftplugin/python.vim') diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index df5dab8afc..546e3bd560 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -2,7 +2,7 @@ " Language: python " Maintainer: James Sully " Previous Maintainer: Johannes Zellner -" Last Change: Wed, 29 June 2016 +" Last Change: Tue, 09 October 2016 " https://github.com/sullyj3/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif @@ -22,15 +22,25 @@ setlocal omnifunc=pythoncomplete#Complete set wildignore+=*.pyc -nnoremap ]] :call Python_jump('n', '\v%$\|^(class\|def)>', 'W') -nnoremap [[ :call Python_jump('n', '\v^(class\|def)>', 'Wb') -nnoremap ]m :call Python_jump('n', '\v%$\|^\s*(class\|def)>', 'W') -nnoremap [m :call Python_jump('n', '\v^\s*(class\|def)>', 'Wb') +let b:next_toplevel='\v%$\|^(class\|def\|async def)>' +let b:prev_toplevel='\v^(class\|def\|async def)>' +let b:next='\v%$\|^\s*(class\|def\|async def)>' +let b:prev='\v^\s*(class\|def\|async def)>' -xnoremap ]] :call Python_jump('x', '\v%$\|^(class\|def)>', 'W') -xnoremap [[ :call Python_jump('x', '\v^(class\|def)>', 'Wb') -xnoremap ]m :call Python_jump('x', '\v%$\|^\s*(class\|def)>', 'W') -xnoremap [m :call Python_jump('x', '\v^\s*(class\|def)>', 'Wb') +execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W')" +execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb')" +execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W')" +execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb')" + +execute "onoremap ]] :call Python_jump('o', '". b:next_toplevel."', 'W')" +execute "onoremap [[ :call Python_jump('o', '". b:prev_toplevel."', 'Wb')" +execute "onoremap ]m :call Python_jump('o', '". b:next."', 'W')" +execute "onoremap [m :call Python_jump('o', '". b:prev."', 'Wb')" + +execute "xnoremap ]] :call Python_jump('x', '". b:next_toplevel."', 'W')" +execute "xnoremap [[ :call Python_jump('x', '". b:prev_toplevel."', 'Wb')" +execute "xnoremap ]m :call Python_jump('x', '". b:next."', 'W')" +execute "xnoremap [m :call Python_jump('x', '". b:prev."', 'Wb')" if !exists('*Python_jump') fun! Python_jump(mode, motion, flags) range @@ -56,8 +66,10 @@ if has("browsefilter") && !exists("b:browsefilter") \ "All Files (*.*)\t*.*\n" endif -" As suggested by PEP8. -setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 +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') -- cgit From 4175dfac9a91e30d01e5aec6b45ed81e0288aaf9 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 20:43:11 +0100 Subject: vim-patch:01164a6546b4 Long overdue runtime update. https://github.com/vim/vim/commit/01164a6546b4c635daf96a1f17d1cb2d07f32a66 --- runtime/ftplugin/python.vim | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'runtime/ftplugin/python.vim') diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 546e3bd560..d52a338b5b 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -1,9 +1,10 @@ " Vim filetype plugin file " Language: python -" Maintainer: James Sully +" Maintainer: Tom Picton +" Previous Maintainer: James Sully " Previous Maintainer: Johannes Zellner -" Last Change: Tue, 09 October 2016 -" https://github.com/sullyj3/vim-ftplugin-python +" Last Change: Fri, 20 October 2017 +" https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -24,31 +25,51 @@ set wildignore+=*.pyc let b:next_toplevel='\v%$\|^(class\|def\|async def)>' let b:prev_toplevel='\v^(class\|def\|async def)>' +let b:next_endtoplevel='\v%$\|\S.*\n+(def\|class)' +let b:prev_endtoplevel='\v\S.*\n+(def\|class)' let b:next='\v%$\|^\s*(class\|def\|async def)>' let b:prev='\v^\s*(class\|def\|async def)>' +let b:next_end='\v\S\n*(%$\|^\s*(class\|def\|async def)\|^\S)' +let b:prev_end='\v\S\n*(^\s*(class\|def\|async def)\|^\S)' execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W')" execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb')" +execute "nnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0)" +execute "nnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)" execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W')" execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb')" +execute "nnoremap ]M :call Python_jump('n', '". b:next_end."', 'W', 0)" +execute "nnoremap [M :call Python_jump('n', '". b:prev_end."', 'Wb', 0)" execute "onoremap ]] :call Python_jump('o', '". b:next_toplevel."', 'W')" execute "onoremap [[ :call Python_jump('o', '". b:prev_toplevel."', 'Wb')" +execute "onoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0)" +execute "onoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)" execute "onoremap ]m :call Python_jump('o', '". b:next."', 'W')" execute "onoremap [m :call Python_jump('o', '". b:prev."', 'Wb')" +execute "onoremap ]M :call Python_jump('o', '". b:next_end."', 'W', 0)" +execute "onoremap [M :call Python_jump('o', '". b:prev_end."', 'Wb', 0)" execute "xnoremap ]] :call Python_jump('x', '". b:next_toplevel."', 'W')" execute "xnoremap [[ :call Python_jump('x', '". b:prev_toplevel."', 'Wb')" +execute "xnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0)" +execute "xnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)" execute "xnoremap ]m :call Python_jump('x', '". b:next."', 'W')" execute "xnoremap [m :call Python_jump('x', '". b:prev."', 'Wb')" +execute "xnoremap ]M :call Python_jump('x', '". b:next_end."', 'W', 0)" +execute "xnoremap [M :call Python_jump('x', '". b:prev_end."', 'Wb', 0)" if !exists('*Python_jump') - fun! Python_jump(mode, motion, flags) range + fun! Python_jump(mode, motion, flags, ...) range + let l:startofline = (a:0 >= 1) ? a:1 : 1 + if a:mode == 'x' normal! gv endif - normal! 0 + if l:startofline == 1 + normal! 0 + endif let cnt = v:count1 mark ' @@ -57,7 +78,9 @@ if !exists('*Python_jump') let cnt = cnt - 1 endwhile - normal! ^ + if l:startofline == 1 + normal! ^ + endif endfun endif -- cgit