Files
neovim/runtime/plugin/nvim.lua
marshmallow af6e6ccf3d feat(vim.ui): vim.ui.open, "gx" without netrw
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Co-authored-by: ii14 <59243201+ii14@users.noreply.github.com>
2023-07-04 23:45:00 +02:00

29 lines
889 B
Lua

vim.api.nvim_create_user_command('Inspect', function(cmd)
if cmd.bang then
vim.print(vim.inspect_pos())
else
vim.show_pos()
end
end, { desc = 'Inspect highlights and extmarks at the cursor', bang = true })
vim.api.nvim_create_user_command('InspectTree', function(cmd)
if cmd.mods ~= '' or cmd.count ~= 0 then
local count = cmd.count ~= 0 and cmd.count or ''
local new = cmd.mods ~= '' and 'new' or 'vnew'
vim.treesitter.inspect_tree({
command = ('%s %s%s'):format(cmd.mods, count, new),
})
else
vim.treesitter.inspect_tree()
end
end, { desc = 'Inspect treesitter language tree for buffer', count = true })
if vim.g.use_lua_gx == nil or vim.g.use_lua_gx == true then
vim.keymap.set({ 'n', 'x' }, 'gx', function()
local uri = vim.fn.expand('<cfile>')
vim.ui.open(uri)
end, { desc = 'Open URI under cursor with system app' })
end