Created
July 24, 2024 15:17
-
-
Save d3or/5636979a1b3c5ac683caa57ad3b17bb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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