Skip to content

Commit e1fe684

Browse files
authored
feat: support trailing garbage on line
E.g if someone does a grep and gets output like this: $ grep -r TODO myfile:TODO add some stuff otherfile:TODO other stuff Then I like to just choose a file by double clicking the name and writing e.g. `vim myfile:TODO` without having to erase the TODO bit. This is accomplished by allowing zero digits in the line number. Pull request: #35
1 parent f25458b commit e1fe684

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

autoload/fetch.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ set cpoptions&vim
1010
let s:specs = {}
1111

1212
" - trailing colon, i.e. ':lnum[:colnum[:]]'
13-
let s:specs.colon = {'pattern': '\m\%(:\d\+\)\{1,2}\%(:.*\)\?'}
13+
let s:specs.colon = {'pattern': '\m\%(:\d*\)\{1,2}\%(.*\)\?'}
1414
function! s:specs.colon.parse(file) abort
1515
let l:file = substitute(a:file, self.pattern, '', '')
1616
let l:pos = split(matchstr(a:file, self.pattern), ':')
17-
return [l:file, ['cursor', [l:pos[0], get(l:pos, 1, 0)]]]
17+
return [l:file, ['cursor', [get(l:pos, 0, 0), get(l:pos, 1, 0)]]]
1818
endfunction
1919

2020
" - trailing parentheses, i.e. '(lnum[:colnum])'

0 commit comments

Comments
 (0)