From aad8108e25c17f3a0e3bbc68d350091b1e0ccdc8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 11 Feb 2012 04:41:08 +1300 Subject: Nicer structure for function. --- plugin/nextag.vim | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/plugin/nextag.vim b/plugin/nextag.vim index bc8e8eb..13ee404 100644 --- a/plugin/nextag.vim +++ b/plugin/nextag.vim @@ -23,19 +23,15 @@ function! s:MoveToSGMLTag(direction, mode, count) if a:mode == 'v' normal! gv endif - let l:flags = (a:direction == "next") ? "W" : "Wb" + let l:visualfix = a:mode == 'v' && a:direction == 'next' && &selection != 'exclusive' ? 1 : 0 for l:iteration in range(1, a:count) - call search("<\S*[^>]*>", l:flags) - if a:mode == 'v' - if a:direction == 'next' && &selection != 'exclusive' - normal! l - endif + call search("<\S*[^>]*>", a:direction == "next" ? "W" : "Wb") + if l:visualfix + normal! l endif endfor - if a:mode == 'v' - if a:direction == 'next' && &selection != 'exclusive' - normal! h - endif + if l:visualfix + normal! h endif endfunction -- cgit v1.2.3