You've already forked dotfiles
configurations and using newer built-in functionality in the 0.12.x versions of Neovim. Further work is needed for treesitter updates, cleanup of the conversion work and testing to verify old functionality isn't lessened to get the benefits of a cleaner config and vastly faster load times.
37 lines
912 B
Lua
37 lines
912 B
Lua
return {
|
|
execute = function(type)
|
|
-- Mapping of filetypes to commands
|
|
local command_table = {
|
|
build = {
|
|
rust = 'cargo build',
|
|
},
|
|
run = {
|
|
java = 'java %',
|
|
python = 'python %',
|
|
rust = 'cargo run',
|
|
},
|
|
test = {
|
|
cpp = 'make test',
|
|
python = 'pytest',
|
|
rust = 'cargo test',
|
|
},
|
|
benchmark = {
|
|
rust = 'cargo bench',
|
|
},
|
|
upload = {
|
|
cpp = 'make upload',
|
|
}
|
|
}
|
|
|
|
-- Save the file
|
|
vim.api.nvim_command('write')
|
|
|
|
local command = command_table[type][vim.bo.filetype]
|
|
|
|
if command ~= nil then
|
|
-- Run command in a new terminal buffer
|
|
vim.cmd('terminal ' .. command)
|
|
end
|
|
end
|
|
}
|