wsdjeg / vim-fetch

Make Vim handle line and column numbers in file names with a minimum of fuss
http://www.vim.org/scripts/script.php?script_id=5089
MIT License
312 stars 17 forks source link

cannot jump when cursor is on line number #27

Open aca opened 3 years ago

aca commented 3 years ago
~/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.

wsdjeg commented 3 years ago

What is your vim version and os?

aca commented 3 years ago

@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 commented 3 years ago
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.

wsdjeg commented 3 years ago

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