Improved rust, keybindings, org-mode export to HTML
Rust - added ftplugin/after/rust.lua for rust keybindings keybindings - <space>[ and <space>] to goto prev and next diagnosticsw Org mode - added option for HTML export with pandoc
This commit is contained in:
10
after/ftplugin/rust.lua
Normal file
10
after/ftplugin/rust.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<space>E",
|
||||
function()
|
||||
vim.cmd.RustLsp({ 'explainError', 'current' })
|
||||
end,
|
||||
{ silent = true, buffer = bufnr, desc = 'Rust: explain error at cursor' }
|
||||
)
|
||||
@@ -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', '<space>d', fzf.diagnostics_document, { desc = "Document diagnostics" })
|
||||
vim.keymap.set('n', '<space>D', fzf.diagnostics_workspace, { desc = "Workspace diagnostics" })
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { desc = "Popup diagnostics" })
|
||||
vim.keymap.set('n', '<space>s', fzf.lsp_document_symbols, { desc = "Doc symbols" })
|
||||
vim.keymap.set('n', '<space>c', fzf.lsp_code_actions, { desc = "Code Actions" })
|
||||
vim.keymap.set('n', '<space>[', vim.diagnostic.goto_prev, { desc = "Previous diagnostics" })
|
||||
vim.keymap.set('n', '<space>]', vim.diagnostic.goto_next, { desc = "Previous diagnostics" })
|
||||
|
||||
local gitsigns = require('gitsigns')
|
||||
vim.keymap.set('n', '<space>==', gitsigns.preview_hunk_inline, { desc = "Git hunk preview" })
|
||||
|
||||
@@ -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'
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user