From c56632eeaa34a59116ce4663eaa89ceabd08756e Mon Sep 17 00:00:00 2001 From: David Beniamine Date: Tue, 9 Jun 2015 19:23:04 +0200 Subject: [PATCH] Complete on buffer instead of reading file --- ftplugin/todo.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index 0b1f868..f13492c 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -248,8 +248,8 @@ fun! TodoComplete(findstart, base) return start else let res = [] - let file = readfile(expand("%:p")) - for line in file + let lines=getline(1,"$") + for line in lines if line =~ " ".a:base let item={} let item.word=substitute(line,'.*\('.a:base.'\S*\).*','\1',"") @@ -257,7 +257,7 @@ fun! TodoComplete(findstart, base) let item.info="Context: ".substitute(line,'.*\s\(@\S\S*\).*','\1',"") elseif a:base =~ '@' let l:pr=[] - for line2 in file + for line2 in lines if line2 =~ l:item.word call add(l:pr,substitute(line2,'.*\s\(+\S\S*\).*','\1',"")) endif