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

gF doesn't open visually selected file:line:column in pwd #7

Closed sunaku closed 9 years ago

sunaku commented 9 years ago

Hello,

I have a LICENSE file in my present working directory and this text in my buffer:

LICENSE:9:15

Visually selecting the line (by typing V) and then typing gF raises this error:

Error detected while processing function fetch#visual..<SNR>340_dovisual:
line    2:
E447: Can't find file "LICENSE:9:15" in path
Press ENTER or type command to continue

Moreover, putting the cursor at the beginning of the line (on the L) and typing gF just opens the LICENSE file while completely ignoring the line and column information.

Thanks for your consideration. :sweat_smile:

kopischke commented 9 years ago

The behaviour in visual mode is expected: you have to select the file name only (i.e. “LICENSE”) for it to work. That is how Vim’s built-in gF works, and vim-fetch tries to extend, but not modify, built-in behaviour. Think of the selection as telling Vim “all of this is the file name, never mind that it contains characters not in isf”.

putting the cursor at the beginning of the line (on the L) and typing gF just opens the LICENSE file while completely ignoring the line and column information.

This, however, is most definitely not expected behaviour. I will look into it ASAP.

kopischke commented 9 years ago

I cannot reproduce this – in my tests, gF worked exactly as expected, jumping to the specified line and column. Could you check that you are actually executing vim-stay’s gF for me, please? Specifically, nmap gF should output:

n gF * :<C-u>call fetch#cfile(v:count1)<CR>

– note this needs to be an upper case “F”: lower case gf ignores jump specs. Also, do make sure that LICENSE actually has 9 or more lines of content: if it is shorter, vim-stay doesn’t jump anywhere, leaving you at the top of the file.

If that isn’t the issue either, I’ll need a log of what happens. With the cursor on “L”, do:

set verbosefile=/somewhere/you/will/find/it/stay.log
16verbose unsilent normal gF
set verbosefile=

and post the stay.log file (or its contents) somewhere where I can access it (please don’t paste it into the issue – it’s likely to be something between huge and humungous in size :)), and provide me with the output of version.

sunaku commented 9 years ago

Yes, :nmap gF shows me:

n  gF          * :<C-U>call fetch#cfile(v:count1)<CR> 

In normal mode, putting the cursor on L and typing gF does the right thing (it jumps to line 9, column 15). However in visual mode, with LICENSE:9:15 selected, it does not work as shown in this log file created by these commands:

:set verbosefile=/tmp/stay.log
:16verbose unsilent normal VgF
:set verbosefile=

I hope this helps. :sweat_smile:

kopischke commented 9 years ago

Good to hear it works in normal mode for you too :). For visual mode, you need to select only the file name part (i.e. ‘LICENSE’, not the ‘:9:15’ spec). This is how visual gF works in Vim without vim-fetch too: everything you select is considered to be the file name, line and column specs must come after that.

kopischke commented 9 years ago

Closing as this is designated behaviour. Let me know if there is anything else I can help with.