diff --git a/after/ftplugin/rust.lua b/after/ftplugin/rust.lua new file mode 100644 index 0000000..bb4c573 --- /dev/null +++ b/after/ftplugin/rust.lua @@ -0,0 +1,10 @@ +local bufnr = vim.api.nvim_get_current_buf() + +vim.keymap.set( + "n", + "E", + function() + vim.cmd.RustLsp({ 'explainError', 'current' }) + end, + { silent = true, buffer = bufnr, desc = 'Rust: explain error at cursor' } +) diff --git a/lua/lsp.lua b/lua/lsp.lua index 9d47a40..28c3c08 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -44,13 +44,15 @@ local on_attach = function(client, bufnr) vim.lsp.buf.format({ async = true }) end, { desc = "LSP Format buffer", unpack(bufopts) }) - -- 2024-09-09 - some ccflow commands + -- 2024-09-09 - some ccflow commands for diagnostics, symbols and code actions local fzf = require('fzf-lua') vim.keymap.set('n', 'd', fzf.diagnostics_document, { desc = "Document diagnostics" }) vim.keymap.set('n', 'D', fzf.diagnostics_workspace, { desc = "Workspace diagnostics" }) vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Popup diagnostics" }) vim.keymap.set('n', 's', fzf.lsp_document_symbols, { desc = "Doc symbols" }) vim.keymap.set('n', 'c', fzf.lsp_code_actions, { desc = "Code Actions" }) + vim.keymap.set('n', '[', vim.diagnostic.goto_prev, { desc = "Previous diagnostics" }) + vim.keymap.set('n', ']', vim.diagnostic.goto_next, { desc = "Previous diagnostics" }) local gitsigns = require('gitsigns') vim.keymap.set('n', '==', gitsigns.preview_hunk_inline, { desc = "Git hunk preview" }) diff --git a/lua/plugins.lua b/lua/plugins.lua index b963bd5..6fc4bfb 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -88,6 +88,25 @@ require("lazy").setup({ org_agenda_files = '~/orgfiles/**/*', org_default_notes_file = '~/orgfiles/refile.org', org_todo_keywords = { 'TODO(t)', 'STARTED(s)', 'PLANNED(p)', '|', 'DONE(d)', 'UNPLANNED(u)' }, + org_custom_exports = { + f = { + label = 'Export to HTML format', + action = function(exporter) + local current_file = vim.api.nvim_buf_get_name(0) + local target = vim.fn.fnamemodify(current_file, ':p:r') .. '.html' + local command = { 'pandoc', current_file, '-o', target } + local on_success = function(output) + print('Success!') + vim.api.nvim_echo({ { table.concat(output, '\n') } }, true, {}) + end + local on_error = function(err) + print('Error!') + vim.api.nvim_echo({ { table.concat(err, '\n'), 'ErrorMsg' } }, true, {}) + end + return exporter(command, target, on_success, on_error) + end + } + }, }) -- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option @@ -503,4 +522,9 @@ require("lazy").setup({ vim.g.tidal_sc_enable = 1 end, }, + + -- debugging support, needed for things like rustaceanvim + { + 'mfussenegger/nvim-dap' + }, })