vim-fetch icon indicating copy to clipboard operation
vim-fetch copied to clipboard

cannot jump when cursor is on line number

Open aca opened this issue 5 years ago • 4 comments

~/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 avatar Sep 26 '20 19:09 aca

What is your vim version and os?

wsdjeg avatar Sep 30 '20 11:09 wsdjeg

@wsdjeg

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

https://github.com/wsdjeg/vim-fetch/blob/dd674b50b261275a6a75cab6929b7bb7c5c4acba/autoload/fetch.vim#L185

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 avatar Oct 01 '20 12:10 aca

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.

aca avatar Feb 20 '21 14:02 aca

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

wsdjeg avatar Feb 20 '21 14:02 wsdjeg