summaryrefslogtreecommitdiffstats
path: root/.config/nvim/plugin/50-follow.lua
blob: 1e48cd561c6a365afe4eebd49ec11319096b9695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Following file names and URLs inside Neovim. The engine lives in
-- `lua/dotfiles/follow.lua`; per-scheme behavior is registered by the feature
-- that owns it — see 50-notes.lua (`notes://` and `[[wiki-links]]`) and
-- 50-nvim-help.lua (`nvim-help://`).

local follow = require("dotfiles.follow")

-- Add `'` to the list of characters included in `<cfile>` because `'` is a valid URI character
vim.opt.isfname:append("'")

vim.keymap.set({ "n", "x" }, "<Leader>gg", function()
	follow.follow("edit")
end, { desc = "Edit URL/file in current window" })
vim.keymap.set({ "n", "x" }, "<Leader>gs", function()
	follow.follow("split")
end, { desc = "Edit URL/file in split window" })
vim.keymap.set({ "n", "x" }, "<Leader>gv", function()
	follow.follow("vsplit")
end, { desc = "Edit URL/file in vertically split window" })