From a03d01e58ec1bc1a7c599210aa5ed5edd7303c5a Mon Sep 17 00:00:00 2001 From: David Beniamine Date: Fri, 18 Dec 2015 10:17:26 +0100 Subject: [PATCH] Get linescount in a more conventional way This should solve issue #5 see https://github.com/dbeniamine/todo.txt-vim/issues/5 --- autoload/todo.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/todo.vim b/autoload/todo.vim index e1e0177..ddf164f 100644 --- a/autoload/todo.vim +++ b/autoload/todo.vim @@ -188,11 +188,12 @@ function! todo#HierarchicalSort(symbol, symbolsub, dolastsort) " Count the number of lines let l:position= todo#GetCurpos() - execute "silent normal g\" - let l:linecount=str2nr(split(v:statusmsg)[7]) + execute "silent normal G" + let l:linecount=getpos(".")[1] if(exists("g:Todo_txt_debug")) echo "Linescount: ".l:linecount endif + execute "silent normal gg" " Get all the groups names let l:groups=GetGroups(a:symbol,1,l:linecount) @@ -205,6 +206,9 @@ function! todo#HierarchicalSort(symbol, symbolsub, dolastsort) execute 'sort'.l:sortmode.' /.\{-}\ze'.a:symbol.'/' for l:g in l:groups let l:pat=a:symbol.l:g.'.*$' + if(exists("g:Todo_txt_debug")) + echo l:pat + endif normal gg " Find the beginning of the group let l:groupBegin=search(l:pat,'c')