Tuesday, January 14, 2025

Re: A gf mapping which opens a tab or window?

I'd do it like so
  1. :vs (or :s) Open the buffer in a new split. This keeps your position
  2. gf to the file under the cursor.
  3. <C-W>T Move the new split into a tab



On Sun, 12 Jan 2025, 11:45 BPJ, <bpj@melroch.se> wrote:
Apologies if I'm asking the bleeding obvious, but as so often I find it hard to find what I'm looking for in the help.

The `gf` mapping opens the file name under the cursor in the same window. I have a file with one (absolute) file path on each line, and would like to be able to open two or more of them in new tabs without closing that file. If I do `gf` and then `:tabe #` I "lose my position" in the file with paths. So is there a mapping or command which opens the filepath under the cursor in a new tab or at least a new window without losing my position in the file with the path, or how could one be created (it probably could, this being Vim, but I can't figure out how...)?

TIA,
/bpj

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CADAJKhDj145XNKwep5H%3D_4EOqRLewA%2BqZybfBGbkQZjp%3DKCg1w%40mail.gmail.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAOmRJrfNESO1ChTrpHhMW%2Bjyw9Djq%3DWCZKc5oF-0QrqR7ka8Dg%40mail.gmail.com.

No comments: