summaryrefslogtreecommitdiff
path: root/after/ftplugin/lua.lua
diff options
context:
space:
mode:
Diffstat (limited to 'after/ftplugin/lua.lua')
-rw-r--r--after/ftplugin/lua.lua16
1 files changed, 13 insertions, 3 deletions
diff --git a/after/ftplugin/lua.lua b/after/ftplugin/lua.lua
index dca196a..5011d56 100644
--- a/after/ftplugin/lua.lua
+++ b/after/ftplugin/lua.lua
@@ -1,3 +1,13 @@
-vim.keymap.set("n", "<Leader><Leader>x", "<CMD>source %<CR>", { desc = "Reloads the current config file" })
-vim.keymap.set("n", "<Leader>x", "<CMD>.lua<CR>", { desc = "Executes the current line" })
-vim.keymap.set("v", "<Leader>x", "<CMD>lua<CR>", { desc = "Executes the current selection" })
+vim.keymap.set("n", "<Leader><Leader>x", "<CMD>source %<CR>", { buffer = true, desc = "Reloads the current config file" })
+vim.keymap.set("n", "<Leader>x", "<CMD>.lua<CR>", { buffer = true, desc = "Executes the current line" })
+vim.keymap.set("v", "<Leader>x", "<CMD>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 })