diff options
Diffstat (limited to 'lua/user/keys.lua')
| -rw-r--r-- | lua/user/keys.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lua/user/keys.lua b/lua/user/keys.lua index fe9e3af..e007260 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -177,6 +177,17 @@ map("n", "<leader>cd", ":cd %:p:h<CR>:pwd<CR>") -- Open the current file in the default program (on Mac this should just be just `open`) map('n', '<leader>o', ':!xdg-open %<cr><cr>') +-- URL handling +if vim.fn.has("mac") == 1 then + map("", "gx", '<Cmd>call jobstart(["open", expand("<cfile>")], {"detach": v:true})<CR>', {}) +elseif vim.fn.has("unix") == 1 then + map("", "gx", '<Cmd>call jobstart(["xdg-open", expand("<cfile>")], {"detach": v:true})<CR>', {}) +elseif vim.fn.has("wsl") == 1 then + map("", "gx", '<Cmd>call jobstart(["wslview", expand("<cfile>")], {"detach": v:true})<CR>', {}) +else + map[''].gx = {'<Cmd>lua print("Error: gx is not supported on this OS!")<CR>'} +end + -- Toggle completion map("n", "<Leader>tc", ":lua require('user.mods').toggle_completion()<CR>") |
