echo "'".a:name."' not found"returnendifecho l:listlet l:input=input("Which?\n")if strlen(l:input)==0returnendifif strlen(substitute(l:input, "[0-9]", "", "g"))>0echo "Not a number"returnendifif l:input<1 || l:input>l:numecho "Out of range"returnendiflet l:line=matchstr("\n".l:list, "".l:input."\t[^\n]*")let l:lineno=matchstr(l:line,":[0-9]*:")let l:lineno=substitute(l:lineno,":","","g")"echo "".l:linelet l:line=substitute(l:line, "^[^\t]*\t", "", "")"echo "".l:linelet l:line=substitute(l:line, "\:.*", "", "")"echo "".l:line"echo "\n".l:lineexecute ":e ".l:lineexecute "normal ".l:lineno."gg"endfunctioncommand! -nargs=1 Grep :call Grep("<args>")function! Find(name)let l:_name = substitute(a:name, "\\s", "*", "g")let l:list=system("find . -iname '*".l:_name."*' -not -name \"*.class\" -and-not -name \"*.swp\" | perl -ne 'print \"$.\\t$_\"'")let l:num=strlen(substitute(l:list, "[^\n]", "", "g"))if l:num < 1echo "'".a:name."' not found"returnendifif l:num != 1echo l:listlet l:input=input("Which ? (<enter>=nothing)\n")if strlen(l:input)==0returnendifif strlen(substitute(l:input, "[0-9]", "", "g"))>0echo "Not a number"returnendif
Add a Comment