Updated patch with a couple of text objects (]] and ]m) defined on top of my 
previous n and v maps.

Regarding the maintenance I know nothing about the formalities yet but I 
promise to get informed ASAP.

Cheers
--
Carlos

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
>From 0b00f3c692a59590ae03e571cfa6d37b4d2e1f44 Mon Sep 17 00:00:00 2001
From: memeplex <[email protected]>
Date: Fri, 31 Jul 2015 12:31:37 -0300
Subject: [PATCH] Python plugin: movements in visual mode.

---
 runtime/ftplugin/python.vim | 50 +++++++++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim
index 75c7e87..f5e03a9 100644
--- a/runtime/ftplugin/python.vim
+++ b/runtime/ftplugin/python.vim
@@ -1,8 +1,8 @@
 " Vim filetype plugin file
 " Language:	python
 " Maintainer:	Johannes Zellner <[email protected]>
-" Last Change:	2014 Feb 09
 " Last Change By Johannes: Wed, 21 Apr 2004 13:13:08 CEST
+" Last Change:	Fri Jul 31 12:29:55 ART 2015 ([email protected])
 
 if exists("b:did_ftplugin") | finish | endif
 let b:did_ftplugin = 1
@@ -21,28 +21,38 @@ setlocal omnifunc=pythoncomplete#Complete
 
 set wildignore+=*.pyc
 
-nnoremap <silent> <buffer> ]] :call <SID>Python_jump('/^\(class\\|def\)')<cr>
-nnoremap <silent> <buffer> [[ :call <SID>Python_jump('?^\(class\\|def\)')<cr>
-nnoremap <silent> <buffer> ]m :call <SID>Python_jump('/^\s*\(class\\|def\)')<cr>
-nnoremap <silent> <buffer> [m :call <SID>Python_jump('?^\s*\(class\\|def\)')<cr>
+nnoremap <silent> <buffer> ]] :<C-U>call <SID>Python_jump(0, 0, 1)<CR>
+nnoremap <silent> <buffer> [[ :<C-U>call <SID>Python_jump(1, 0, 1)<CR>
+nnoremap <silent> <buffer> ]m :<C-U>call <SID>Python_jump(0, 0, 0)<CR>
+nnoremap <silent> <buffer> [m :<C-U>call <SID>Python_jump(1, 0, 0)<CR>
+
+vnoremap <silent> <buffer> ]] :<C-U>call <SID>Python_jump(0, 1, 1)<CR>
+vnoremap <silent> <buffer> [[ :<C-U>call <SID>Python_jump(1, 1, 1)<CR>
+vnoremap <silent> <buffer> ]m :<C-U>call <SID>Python_jump(0, 1, 0)<CR>
+vnoremap <silent> <buffer> [m :<C-U>call <SID>Python_jump(1, 1, 0)<CR>
+
+onoremap <silent> <buffer> ]] :<C-U>execute 'normal ]][[V' . v:count1 . ']]'<CR>
+onoremap <silent> <buffer> ]m :<C-U>execute 'normal ]m[mV' . v:count1 . ']m'<CR>
 
 if !exists('*<SID>Python_jump')
-  fun! <SID>Python_jump(motion) range
-      let cnt = v:count1
-      let save = @/    " save last search pattern
-      mark '
-      while cnt > 0
-	  silent! exe a:motion
-	  let cnt = cnt - 1
-      endwhile
-      call histdel('/', -1)
-      let @/ = save    " restore last search pattern
-  endfun
+    fun! <SID>Python_jump(back, visual, top)
+        let n = v:count1
+        let pattern = '^' . (a:top ? '' : '\s*') . '\(class\|def\)'
+        if a:visual
+            normal gv
+            let pattern = '\n' . pattern
+        endif
+        let pattern = '\(\%^\|\%$\|' . pattern . '\)'
+        mark '
+        for _ in range(1, n)
+            call search(pattern, 'W' . (a:back ? 'b' : ''))
+        endfor
+    endfun
 endif
 
 if has("browsefilter") && !exists("b:browsefilter")
     let b:browsefilter = "Python Files (*.py)\t*.py\n" .
-		       \ "All Files (*.*)\t*.*\n"
+                       \ "All Files (*.*)\t*.*\n"
 endif
 
 " As suggested by PEP8.
@@ -50,11 +60,7 @@ setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
 
 " 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
+    let g:pydoc_executable = executable('pydoc') == 1
 endif
 " If "pydoc" was found use it for keywordprg.
 if g:pydoc_executable
-- 
2.4.5

Raspunde prin e-mail lui