rework keymaps and plugin config
- Change leader from space to comma - Move opencode keymaps into plugin config - Move picker keymaps from <leader>p to <leader>f - Change buffer delete mapping from bd to bk - Add DAP debugging keymaps and dap-view - Remove zk-nvim, checkmate plugins - Add claude-code, conjure, scnvim plugins - Update LSP servers: replace basedpyright with ty, add gopls/clojure_lsp/harper_ls/tinymist - Enable inlay hints on LspAttach - Enable go/sql/typst tree-sitter - Add htmlhint formatter - Configure opencode with snacks terminal
This commit is contained in:
+141
-95
@@ -13,11 +13,6 @@ local add, later = MiniDeps.add, MiniDeps.later
|
||||
local now_if_args = _G.Config.now_if_args
|
||||
|
||||
-- Tree-sitter ================================================================
|
||||
|
||||
-- Tree-sitter is a tool for fast incremental parsing. It converts text into
|
||||
-- a hierarchical structure (called tree) that can be used to implement advanced
|
||||
-- and/or more precise actions: syntax highlighting, textobjects, indent, etc.
|
||||
--
|
||||
now_if_args(function()
|
||||
add({
|
||||
source = 'nvim-treesitter/nvim-treesitter',
|
||||
@@ -43,6 +38,9 @@ now_if_args(function()
|
||||
'python',
|
||||
'javascript',
|
||||
'typst',
|
||||
'go',
|
||||
'sql',
|
||||
'typst',
|
||||
-- Add here more languages with which you want to use tree-sitter
|
||||
-- To see available languages:
|
||||
-- - Execute `:=require('nvim-treesitter').get_available()`
|
||||
@@ -67,52 +65,42 @@ now_if_args(function()
|
||||
end)
|
||||
|
||||
-- Language servers ===========================================================
|
||||
|
||||
-- Language Server Protocol (LSP) is a set of conventions that power creation of
|
||||
-- language specific tools. It requires two parts:
|
||||
-- - Server - program that performs language specific computations.
|
||||
-- - Client - program that asks server for computations and shows results.
|
||||
--
|
||||
-- Add it now if file (and not 'mini.starter') is shown after startup.
|
||||
now_if_args(function()
|
||||
add('neovim/nvim-lspconfig')
|
||||
|
||||
-- Use `:h vim.lsp.enable()` to automatically enable language server based on
|
||||
-- the rules provided by 'nvim-lspconfig'.
|
||||
-- Use `:h vim.lsp.config()` or 'after/lsp/' directory to configure servers.
|
||||
-- Uncomment and tweak the following `vim.lsp.enable()` call to enable servers.
|
||||
vim.lsp.enable({
|
||||
'lua_ls',
|
||||
'basedpyright',
|
||||
'ty',
|
||||
'ruff',
|
||||
'html',
|
||||
'css',
|
||||
'toml',
|
||||
'marksman',
|
||||
'gopls',
|
||||
'clojure_lsp',
|
||||
'harper_ls',
|
||||
'tinymist'
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end)
|
||||
|
||||
-- Formatting =================================================================
|
||||
|
||||
-- Programs dedicated to text formatting (a.k.a. formatters) are very useful.
|
||||
-- Neovim has built-in tools for text formatting (see `:h gq` and `:h 'formatprg'`).
|
||||
-- They can be used to configure external programs, but it might become tedious.
|
||||
--
|
||||
-- The 'stevearc/conform.nvim' plugin is a good and maintained solution for easier
|
||||
-- formatting setup.
|
||||
later(function()
|
||||
add('stevearc/conform.nvim')
|
||||
|
||||
-- See also:
|
||||
-- - `:h Conform`
|
||||
-- - `:h conform-options`
|
||||
-- - `:h conform-formatters`
|
||||
require('conform').setup({
|
||||
-- Map of filetype to formatters
|
||||
-- Make sure that necessary CLI tool is available
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
python = { 'ruff' },
|
||||
html = { 'htmlhint' },
|
||||
},
|
||||
})
|
||||
end)
|
||||
@@ -135,7 +123,7 @@ now_if_args(function()
|
||||
float = {
|
||||
transparent = true,
|
||||
},
|
||||
compile_path = vim.fn.stdpath "cache" .. "/catppuccin",
|
||||
compile_path = vim.fn.stdpath('cache') .. '/catppuccin',
|
||||
})
|
||||
vim.cmd('colorscheme catppuccin')
|
||||
end)
|
||||
@@ -157,88 +145,146 @@ later(function()
|
||||
require('gitsigns').setup({})
|
||||
end)
|
||||
|
||||
-- claudecode =================================================================
|
||||
-- later(function ()
|
||||
-- add({
|
||||
-- source = 'coder/claudecode.nvim',
|
||||
-- depends = { 'folke/snacks.nvim' },
|
||||
-- })
|
||||
-- require('claudecode').setup({})
|
||||
-- end)
|
||||
--
|
||||
-- open code ==================================================================
|
||||
-- opencode ===================================================================
|
||||
local opencode_cmd = "opencode --port"
|
||||
|
||||
later(function()
|
||||
add({
|
||||
source = 'nickjvandyke/opencode.nvim',
|
||||
depends = { 'folke/snacks.nvim' },
|
||||
})
|
||||
|
||||
vim.g.opencode_opts = {
|
||||
provider = {
|
||||
enabled = 'terminal',
|
||||
terminal = {
|
||||
width = math.floor(vim.o.columns * 0.5),
|
||||
},
|
||||
require('snacks').setup({ picker = { enabled = true } })
|
||||
|
||||
---@type snacks.terminal.Opts
|
||||
local snacks_terminal_opts = {
|
||||
win = {
|
||||
position = "right",
|
||||
enter = false,
|
||||
},
|
||||
}
|
||||
|
||||
-- Handle `opencode` events
|
||||
-- vim.api.nvim_create_autocmd('User', {
|
||||
-- pattern = 'OpencodeEvent:*', -- Optionally filter event types
|
||||
-- callback = function(args)
|
||||
-- ---@type opencode.cli.client.Event
|
||||
-- local event = args.data.event
|
||||
-- ---@type number
|
||||
-- local port = args.data.port
|
||||
--
|
||||
-- -- See the available event types and their properties
|
||||
-- vim.notify(vim.inspect(event))
|
||||
-- -- Do something useful
|
||||
-- if event.type == 'session.idle' then
|
||||
-- vim.notify('`opencode` finished responding')
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
end)
|
||||
|
||||
-- zk =========================================================================
|
||||
later(function()
|
||||
add({
|
||||
source = 'zk-org/zk-nvim',
|
||||
})
|
||||
require('zk').setup({
|
||||
picker = 'minipick',
|
||||
enabled = 'snacks',
|
||||
lsp = {
|
||||
config = {
|
||||
name = 'zk',
|
||||
cmd = { 'zk', 'lsp' },
|
||||
filetypes = { 'markdown' },
|
||||
},
|
||||
---@type opencode.Opts
|
||||
vim.g.opencode_opts = {
|
||||
server = {
|
||||
start = function()
|
||||
require("snacks.terminal").open(opencode_cmd, snacks_terminal_opts)
|
||||
end,
|
||||
},
|
||||
auto_attach = {
|
||||
enabled = true,
|
||||
},
|
||||
})
|
||||
end)
|
||||
}
|
||||
|
||||
-- checkmate ====================================================================
|
||||
now_if_args(function()
|
||||
add({
|
||||
source = 'bngarren/checkmate.nvim',
|
||||
})
|
||||
require('checkmate').setup({
|
||||
files = { '/home/mds/notes/TODO.md' },
|
||||
})
|
||||
vim.keymap.set({ "n", "x" }, "<leader>aa", function()
|
||||
require("opencode").ask("@this: ", { submit = true })
|
||||
end, { desc = "Ask opencode" })
|
||||
|
||||
vim.keymap.set({ "n", "x" }, "<leader>ap", function()
|
||||
require("opencode").select()
|
||||
end, { desc = "Select opencode" })
|
||||
|
||||
vim.keymap.set({ "n", "t" }, "<leader>ac", function()
|
||||
require("snacks.terminal").toggle(opencode_cmd, snacks_terminal_opts)
|
||||
end, { desc = "Toggle opencode" })
|
||||
end)
|
||||
|
||||
-- render-markdown.nvim ========================================================
|
||||
now_if_args(function ()
|
||||
now_if_args(function()
|
||||
add({
|
||||
source = 'MeanderingProgrammer/render-markdown.nvim',
|
||||
})
|
||||
require('render-markdown').setup({
|
||||
enabled = true,
|
||||
file_types = {'markdown', 'vimwiki'},
|
||||
file_types = { 'markdown', 'vimwiki' },
|
||||
latex = { enabled = false }
|
||||
})
|
||||
end)
|
||||
|
||||
-- nvim-dap ====================================================================
|
||||
--
|
||||
later(function()
|
||||
add({
|
||||
source = 'mfussenegger/nvim-dap',
|
||||
depends = {
|
||||
'nvim-neotest/nvim-nio',
|
||||
'mfussenegger/nvim-dap-python',
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
},
|
||||
})
|
||||
|
||||
add({
|
||||
source = 'igorlfs/nvim-dap-view',
|
||||
})
|
||||
|
||||
local dap = require('dap')
|
||||
local dap_view = require('dap-view')
|
||||
local dap_python = require('dap-python')
|
||||
|
||||
dap_view.setup({})
|
||||
require('nvim-dap-virtual-text').setup({
|
||||
commented = true, -- Show virtual text alongside comment
|
||||
})
|
||||
|
||||
dap_python.setup('python3')
|
||||
end)
|
||||
|
||||
-- claude code =================================================================
|
||||
now_if_args(function()
|
||||
add({
|
||||
source = "coder/claudecode.nvim",
|
||||
depends = { "folke/snacks.nvim" }
|
||||
})
|
||||
require("claudecode").setup()
|
||||
vim.keymap.set({ "n", "x" }, "<leader>co", "<cmd>ClaudeCode<cr>", { desc = "Open Claude Code" })
|
||||
end)
|
||||
|
||||
-- conjure =====================================================================
|
||||
later(function()
|
||||
add({
|
||||
source = 'Olical/conjure',
|
||||
})
|
||||
end
|
||||
)
|
||||
|
||||
-- Typst ========================================================================
|
||||
now_if_args(function()
|
||||
vim.keymap.set("n", "<leader>tt", "<cmd>LspTinymistExportPdf<cr>", { desc = "Export Typst to PDF" })
|
||||
end)
|
||||
|
||||
|
||||
-- Supercollider ===============================================================
|
||||
later(function()
|
||||
add({
|
||||
source = 'davidgranstrom/scnvim'
|
||||
})
|
||||
local scnvim = require("scnvim")
|
||||
local map = scnvim.map
|
||||
local map_expr = scnvim.map_expr
|
||||
|
||||
scnvim.setup({
|
||||
keymaps = {
|
||||
["<M-e>"] = map("editor.send_line", { "i", "n" }),
|
||||
["<C-e>"] = {
|
||||
map("editor.send_block", { "i", "n" }),
|
||||
map("editor.send_selection", "x"),
|
||||
},
|
||||
["<CR>"] = map("postwin.toggle"),
|
||||
["<M-CR>"] = map("postwin.toggle", "i"),
|
||||
["<M-L>"] = map("postwin.clear", { "n", "i" }),
|
||||
["<C-s>"] = map("signature.show", { "n", "i" }),
|
||||
["<C-.>"] = map("sclang.hard_stop", { "n", "x", "i" }),
|
||||
["<leader>st"] = map("sclang.start"),
|
||||
["<leader>sk"] = map("sclang.recompile"),
|
||||
["<F1>"] = map_expr("s.boot"),
|
||||
["<F2>"] = map_expr("s.meter"),
|
||||
},
|
||||
editor = {
|
||||
highlight = {
|
||||
color = "IncSearch",
|
||||
},
|
||||
},
|
||||
postwin = {
|
||||
float = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user