-4

I am referring to this particular plugin http://vim.wikia.com/wiki/Open_file_under_cursor

I tried searching in vim site but i am not able to find it. Googled a lot as well , but no luck.

Can anyone point me to the correct link?

Dante May Code
  • 11,177
  • 9
  • 49
  • 81
Kelly
  • 213
  • 1
  • 6
  • 21

1 Answers1

6

This is not a plugin. This behavior is built into vim. Simply position your cursor over the filename and type gf.

If the current file has unsaved changes, you will see an error at the bottom of your window stating so, and the file will not open. Likewise if the file does not exist.

Jeff
  • 12,147
  • 10
  • 51
  • 87
  • Thanks Jeff it worked. How do i switch back to the original file? – Kelly Dec 15 '12 at 06:00
  • Ctrl-O See also [this answer](http://stackoverflow.com/a/1728413/353278), which says you can `set hidden` to jump back and forth between *unsaved* files. sounds useful. – Jeff Dec 15 '12 at 06:03
  • @Kelly, add `set hidden` to your `~/.vimrc`, use `` to switch to the previous buffer and, above all, read `:h buffers`. – romainl Dec 15 '12 at 06:20
  • Try to keep distance from netrw as much as possible, install this https://github.com/tyru/open-browser.vim or any other plugin or custom code in your `vimrc`/`init.vim` and for your own health "keep distance from netrw" (look at this for example https://github.com/vim/vim/issues/4738, after reading that you may think you should keep distance from vim itself too, in that case you may consider installing Neovim, Neovim is expected to eventually get rid of netrw) – Sassan Aug 12 '19 at 12:07
  • @Sassan there is no mention of netrw here... Maybe you posted in the wrong thread? – Jeff Aug 12 '19 at 12:14
  • @Jeff if you run `map gx` you'll see `n gx NetrwBrowseX` which means `gx` is implemented with netrw, sorry should've mention how it's related – Sassan Aug 14 '19 at 20:26
  • @sassan this post is about gf, not gx – Jeff Aug 14 '19 at 20:27
  • Sorry, I'm not deleting my comments so that people who read your answer get warned about `gx` too as a bonus, `gf` is fine. – Sassan Aug 15 '19 at 14:58