summaryrefslogtreecommitdiff
path: root/after/ftplugin/lua.lua
blob: 46c34b51dfedd3da117a40045a843605242525b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
vim.keymap.set("n", "<Leader><Leader>x", "<CMD>source %<CR>", { buffer = true, desc = "Reloads the current config file" })
vim.keymap.set("n", "g==", ":.lua<CR>", { buffer = true, desc = "Executes the current line" })
vim.keymap.set("v", "g==", ":lua<CR>", { buffer = true, desc = "Executes the current selection" })

-- Open neovim plugins in github.
vim.keymap.set("n", "gx", function()
  local path = vim.fn.expand('<cWORD>')
  local url = path:match([[^["']([^/]+/[^/]+)["'],?$]])
  if url then
    path = "https://github.com/" .. url
  end
  vim.ui.open(path)
end, { buffer = true })