Skip to content

Instantly share code, notes, and snippets.

@d3or
Created July 24, 2024 15:17
Show Gist options
  • Save d3or/5636979a1b3c5ac683caa57ad3b17bb1 to your computer and use it in GitHub Desktop.
Save d3or/5636979a1b3c5ac683caa57ad3b17bb1 to your computer and use it in GitHub Desktop.
local M = {}
function M.setup()
local file_paths = {
block = './tests/core/block.test.ts',
transaction = './tests/core/transaction.test.ts',
wallet = './tests/accounts/wallet.test.ts',
consensus = './tests/network/consensus.test.ts',
mempool = './tests/network/mempool.test.ts',
-- Add more as needed
}
vim.api.nvim_create_user_command('Ot', function(opts)
local file_path = file_paths[opts.args]
if file_path then
vim.cmd('edit ' .. file_path)
else
print('Unknown command: ' .. opts.args)
end
end, {
nargs = 1,
complete = function(ArgLead)
return vim.tbl_filter(function(cmd)
return cmd:match('^' .. ArgLead)
end, vim.tbl_keys(file_paths))
end,
})
end
return M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment