diff --git a/after/ftplugin/rust.lua b/after/ftplugin/rust.lua index bb4c573..15e7005 100644 --- a/after/ftplugin/rust.lua +++ b/after/ftplugin/rust.lua @@ -6,5 +6,26 @@ vim.keymap.set( function() vim.cmd.RustLsp({ 'explainError', 'current' }) end, - { silent = true, buffer = bufnr, desc = 'Rust: explain error at cursor' } + { silent = true, buffer = bufnr, desc = 'RustLSP: explain error at cursor' } +) + + +-- show run targets +vim.keymap.set( + "n", + "", + function() + vim.cmd.RustLsp({ 'runnables' }) + end, + { silent = true, buffer = bufnr, desc = 'RustLSP: show runnables' } +) + +-- run last target +vim.keymap.set( + "n", + "", + function() + vim.cmd.RustLsp({ 'runnables', bang = true }) + end, + { silent = true, buffer = bufnr, desc = 'RustLSP: show runnables' } ) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 1aaff72..75f29f5 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -23,6 +23,9 @@ vim.keymap.set('n', 'T', ":Neotree reveal", { desc = "File Manager" -- calendar vim.keymap.set('n', 'c', ":Calendar -split=horizontal -position=below -height=12", { desc = "Show calendar" }) +-- Open current file in browser (chromium) +vim.keymap.set('n', 'o', ":silent !chromium '%'", { desc = "Open in browser" }) + -- -- configure workspaces -- also add a custom picker to fzf diff --git a/lua/lsp.lua b/lua/lsp.lua index 28c3c08..8223a74 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -11,17 +11,25 @@ require('mason').setup({ require('mason-lspconfig').setup({ -- A list of servers to automatically install if they're not already installed ensure_installed = { - 'pylsp', 'lua_ls', -- 'rust_analyzer', -- handled by rust mrcjkb/rustaceanvim 'yamlls', 'ts_ls', 'gopls', - 'pylsp', 'clangd', }, }) +-- lsp format selected range +function LSPRangeFormatFunction() + vim.lsp.buf.format({ + async = true, + range = { + ["start"] = vim.api.nvim_buf_get_mark(0, "<"), + ["end"] = vim.api.nvim_buf_get_mark(0, ">"), + } + }) +end -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer @@ -43,6 +51,7 @@ local on_attach = function(client, bufnr) vim.keymap.set("n", "f", function() vim.lsp.buf.format({ async = true }) end, { desc = "LSP Format buffer", unpack(bufopts) }) + vim.keymap.set("v", "f", LSPRangeFormatFunction, { desc = "LSP Format region" }) -- 2024-09-09 - some ccflow commands for diagnostics, symbols and code actions local fzf = require('fzf-lua') diff --git a/lua/plugins.lua b/lua/plugins.lua index 6fc4bfb..376368b 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -94,7 +94,7 @@ require("lazy").setup({ 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 command = { 'pandoc', '--filter', 'pandoc-plot', current_file, '--standalone', '--output', target } local on_success = function(output) print('Success!') vim.api.nvim_echo({ { table.concat(output, '\n') } }, true, {}) @@ -224,7 +224,7 @@ require("lazy").setup({ section_separators = {}, disabled_filetypes = { statusline = {}, - winbar = {}, + winbar = { "neo-tree" }, }, ignore_focus = {}, always_divide_middle = true, @@ -263,7 +263,8 @@ require("lazy").setup({ }, inactive_winbar = { lualine_a = { - { breadcrumb, + { + breadcrumb, color = { bg = '#101010', fg = '#999999' }, draw_empty = true } @@ -339,7 +340,8 @@ require("lazy").setup({ }, -- treesitter asciidoc support - { "cpkio/nvim-treesitter-asciidoc" }, + -- // NOTE.2025-01-17 seems to be broken + -- { "cpkio/nvim-treesitter-asciidoc" }, -- Greeter to run on NeoVim startup @@ -424,9 +426,10 @@ require("lazy").setup({ dashboard.section.header.val = vim.split(adjustedLogo, '\n') dashboard.section.buttons.val = { + dashboard.button('h', ' Browse ~', 'Neotree'), dashboard.button('n', ' New file', ':ene startinsert '), - dashboard.button('u', '󱐥 Update plugins', 'Lazy update'), dashboard.button('s', ' Settings', 'WorkspacesOpen config-nvim'), + dashboard.button('u', '󱐥 Update plugins', 'Lazy update'), dashboard.button('w', ' Workspaces', 'WorkspacesOpen'), dashboard.button('q', '󰤆 Quit', 'qa'), } @@ -527,4 +530,13 @@ require("lazy").setup({ { 'mfussenegger/nvim-dap' }, + + -- show indent markers + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + ---@module "ibl" + ---@type ibl.config + opts = {}, + }, })