wsdjeg/vim-fetch

cannot jump when cursor is on line number

aca opened this issue · 4 comments

aca commented
~/src/k8s.io/ingress-nginx/internal/ingress/controller/nginx.go:665

If cursor is on the 665, we cannot jump to the file with error

E447: Can't find file "665" in path

It would be much better if we can jump to the file even if cursor is at line/column number.

aca commented

@wsdjeg

os: mac/linux 
vim: NVIM v0.5.0-d5adc8c

let l:cfile = expand('<cfile>')

After cursor ':' . This is expended to :665~
Native vim gF also doesn't handle this correctly, but It would be helpful if this plugin can solve this.

aca commented
function s:gF()
  try 
    execute "normal! gF"
  catch 
    try 
      execute "normal! bgF"
    catch
      execute "normal! bbgF"
    endtry
  endtry
endfunction
nnoremap gf :call <sid>gF()<cr>

Foolish workaround for this.

That means we should not use expand('<cfile>'), we should implement a new function to get the file path of under cursor.