Compare commits

..

No commits in common. "15d38795258b34c8864a65790eee4e63b309b1cd" and "d774c2867f5861e7c06f653937d42f438ad779e3" have entirely different histories.

2 changed files with 31 additions and 31 deletions

View File

@ -26,41 +26,37 @@ function build.set_dir(dirname)
build.dir = build_dir build.dir = build_dir
echo('Processing compile_commands.json with compdb ...', 'DiagnosticInfo') -- Invoke async function to avoid blocking the UI
local compile_commands = current_dir .. '/compile_commands.json' vim.schedule(function()
-- Post-process compile_commands.json with compdb as an async job to avoid echo('Processing compile_commands.json with compdb ...', 'DiagnosticInfo')
-- blocking the user interface
vim.fn.jobstart(
'compdb -p ' .. build.dir .. ' list > ' .. compile_commands, {
-- Restart clangd language server -- Post-process compile_commands.json with compdb
-- TODO: Configure cmake language server? local compile_commands = current_dir .. '/compile_commands.json'
on_exit = function() local output = vim.fn.systemlist(
vim.cmd [[ LspRestart clangd ]] 'compdb -p ' .. build.dir .. ' list > ' .. compile_commands)
echo('Build directory selected: ' .. dirname, 'DiagnosticInfo')
end,
-- Display any error messages to the user -- Remove any lines containing a compdb warning
on_stderr = function(_, output, _) local error = {}
-- Remove any lines containing a compdb warning local warning = 'WARNING:compdb'
local error = {} for _, line in ipairs(output) do
local warning = 'WARNING:compdb' if string.sub(line, 1, #warning) ~= warning then
for _, line in ipairs(output) do table.insert(error, line)
if string.sub(line, 1, #warning) ~= warning then end
table.insert(error, line) end
end
end
-- Display the error message if there was one -- Display the error message if there was one
if table.maxn(error) > 0 then if table.maxn(error) > 0 then
echo(vim.fn.join(error, '\n'), 'Error') echo(vim.fn.join(error, '\n'), 'Error')
return return
end end
end,
stderr_buffered = true, -- TODO: Configure cmake language server?
}
) -- Restart clangd language server
vim.cmd [[ LspRestart clangd ]]
echo('Build directory selected: ' .. dirname, 'DiagnosticInfo')
end)
end end
function build.select_dir(callback) function build.select_dir(callback)

View File

@ -43,3 +43,7 @@ vim.keymap.set('n', 'Q', '<nop>', {noremap = true})
-- Undo neovim's default mapping of Y to y$ -- Undo neovim's default mapping of Y to y$
vim.cmd('unmap Y') vim.cmd('unmap Y')
-- Move visually selected blocks around
vim.keymap.set('v', 'J', ":move '>+1<CR>gv=gv'")
vim.keymap.set('v', 'K', ":move '<-2<CR>gv=gv'")