vim/Keyshort/Open/Follow the File Path Under Cursor
- Keyshort vim vim/Keyshort vim/Keyshort/Open
- Follow the File Path Under the Cursor
- Open the same target somewhere other than the current window
Keys Where the file opens gfthe current window <C-w>fa horizontal split <C-w>vthengfa vertical split <C-w>gfa new tab gFthe current window, on the line named by a path:12suffixgfin visual modethe current window, taking the whole selection as the name - There is no stock vertical-split form of
gf. Splitting the window first and following the path in the new one gets there in two keys. <C-o>returns from the jump and<C-i>moves forward again — see vim/Keyshort/Jump/Back and Forward.
- What decides whether the path resolves
isfnamedecides where the name starts and ends. Two characters a Logseq filename leans on are in it by default:_carries the triple underscore of a namespace, and%carries the%3Fthat stands in for a question mark.pathis the list of directories the search runs through. Its default.,,means the directory of the file being edited, then the editor's working directory.suffixesaddis empty on a Markdown buffer, so a target written without its.mdfails until the option is set.
- Where it stops
- A space ends the name early.
isfnameholds no space, sopages/A Page With Spaces.mdis read aspages/Aand the search fails. Selecting the whole path and pressinggfin visual mode opens it, since the visual form ignoresisfnameand takes the selection whole. - The list marker counts as part of a filename.
-is anisfnamecharacter, sogfwith the cursor on the-of a bullet reads that dash as the name. From the space after it onward, the whole path is in reach. - A buffer-local mapping that steps past the marker puts the key back in reach from column 1 — vim/Q/In (neo-)vim or LazyVim, how can I open a file whose path a Markdown document gives from the repo root? carries it.
- A space ends the name early.
- My Note
- A path written from the repository root — the shape a garden page uses for
journals/2026_08_24.md— resolves undergfonly while the editor's working directory is that root. vim/Q/In (neo-)vim or LazyVim, how can I open a file whose path a Markdown document gives from the repo root? has the setting that frees it from the working directory. - For a link written as Markdown rather than as a bare path, LazyVim/Q/In LazyVim, how can I open a Markdown link with a keyboard shortcut? compares
gfagainstgxandgdon the same target.
- A path written from the repository root — the shape a garden page uses for