Add opencode and notes/todo configuration

This commit is contained in:
2026-02-27 10:29:46 +01:00
parent ae2297dfbb
commit 35f0723076
2 changed files with 91 additions and 35 deletions
+17 -21
View File
@@ -47,14 +47,10 @@ _G.Config.leader_group_clues = {
{ mode = 'n', keys = '<Leader>m', desc = '+Map' }, { mode = 'n', keys = '<Leader>m', desc = '+Map' },
{ mode = 'n', keys = '<Leader>o', desc = '+Other' }, { mode = 'n', keys = '<Leader>o', desc = '+Other' },
{ mode = 'n', keys = '<Leader>s', desc = '+Session' }, { mode = 'n', keys = '<Leader>s', desc = '+Session' },
{ mode = 'n', keys = '<Leader>t', desc = '+Terminal' },
{ mode = 'x', keys = '<Leader>g', desc = '+Git' }, { mode = 'x', keys = '<Leader>g', desc = '+Git' },
{ mode = 'x', keys = '<Leader>z', desc = '+Notes' },
} }
-- Comodities
vim.keymap.set({'n', 'x'}, '<Leader>y', '"y', { desc = "Yank" })
vim.keymap.set({'n', 'x'}, '<Leader>d', '"d', { desc = "Cut" })
-- Helpers for a more concise `<Leader>` mappings. -- Helpers for a more concise `<Leader>` mappings.
-- Most of the mappings use `<Cmd>...<CR>` string as a right hand side (RHS) in -- Most of the mappings use `<Cmd>...<CR>` string as a right hand side (RHS) in
-- an attempt to be more concise yet descriptive. See `:h <Cmd>`. -- an attempt to be more concise yet descriptive. See `:h <Cmd>`.
@@ -63,14 +59,20 @@ vim.keymap.set({'n', 'x'}, '<Leader>d', '"d', { desc = "Cut" })
local nmap_leader = function(suffix, rhs, desc) local nmap_leader = function(suffix, rhs, desc)
vim.keymap.set('n', '<Leader>' .. suffix, rhs, { desc = desc }) vim.keymap.set('n', '<Leader>' .. suffix, rhs, { desc = desc })
end end
local xmap_leader = function(suffix, rhs, desc) local xmap_leader = function(suffix, rhs, desc)
vim.keymap.set('x', '<Leader>' .. suffix, rhs, { desc = desc }) vim.keymap.set('x', '<Leader>' .. suffix, rhs, { desc = desc })
end end
local vmap_leader = function(suffix, rhs, desc)
vim.keymap.set('v', '<Leader>' .. suffix, rhs, { desc = desc })
end
-- a is for 'AI' -- a is for 'AI'
nmap_leader('ac', ':ClaudeCode<CR>', 'Toggle Claude')
nmap_leader('af', ':ClaudeCodeFocus<CR>', 'Focus Claude') nmap_leader('ac', ':lua require("opencode").toggle()<CR>', 'Toggle Opencode')
nmap_leader('ar', ':ClaudeCode --resume<CR>', 'Resume Claude') nmap_leader('af', ':lua require("opencode").select()<CR>', 'Execute Opencode action...')
nmap_leader('aa', ':luat require("opencode").ask("@this: ", { submit = true })', 'Ask Opencode')
-- b is for 'Buffer'. Common usage: -- b is for 'Buffer'. Common usage:
-- - `<Leader>bs` - create scratch (temporary) buffer -- - `<Leader>bs` - create scratch (temporary) buffer
@@ -176,19 +178,13 @@ nmap_leader('oz', '<Cmd>lua MiniMisc.zoom()<CR>', 'Zoom toggle')
nmap_leader('om', '<Cmd>Mason<CR>', 'Open Mason') nmap_leader('om', '<Cmd>Mason<CR>', 'Open Mason')
nmap_leader('ou', '<Cmd>DepsUpdate<CR>', 'Update plugins') nmap_leader('ou', '<Cmd>DepsUpdate<CR>', 'Update plugins')
-- s is for 'Session'. Common usage:
-- - `<Leader>sn` - start new session
-- - `<Leader>sr` - read previously started session
-- - `<Leader>sd` - delete previously started session
local session_new = 'MiniSessions.write(vim.fn.input("Session name: "))'
nmap_leader('sd', '<Cmd>lua MiniSessions.select("delete")<CR>', 'Delete') -- z if for notes and todos
nmap_leader('sn', '<Cmd>lua ' .. session_new .. '<CR>', 'New') nmap_leader('zz', "<Cmd>ZkNotes {sort={'modified'}}<CR>", 'Notes picker')
nmap_leader('sr', '<Cmd>lua MiniSessions.select("read")<CR>', 'Read') nmap_leader('zn', "<Cmd>ZkNew {title = vim.fn.input('Title: ')}<CR>", 'New note')
nmap_leader('sw', '<Cmd>lua MiniSessions.write()<CR>', 'Write current') nmap_leader('zt', "<Cmd>ZkTags<CR>", 'Notes tags')
nmap_leader('zf', "<Cmd>ZkNotes {sort={'modified'}, match={vim.fn.input('Search: ')}}<CR>", 'Search')
-- t is for 'Terminal' vmap_leader('zm', "<Cmd>'<,'>ZkMatch<CR>", "Search match")
nmap_leader('tT', '<Cmd>horizontal term<CR>', 'Terminal (horizontal)') nmap_leader('zt', "<Cmd>e ~/notes/TODO.md<CR>", "Open TODOs")
nmap_leader('tt', '<Cmd>vertical term<CR>', 'Terminal (vertical)')
-- stylua: ignore end -- stylua: ignore end
+73 -13
View File
@@ -35,7 +35,8 @@ now_if_args(function()
local languages = { local languages = {
-- These are already pre-installed with Neovim. Used as an example. -- These are already pre-installed with Neovim. Used as an example.
'lua', 'lua',
'vimdoc', 'html',
'css',
'markdown', 'markdown',
'yaml', 'yaml',
'toml', 'toml',
@@ -84,6 +85,10 @@ now_if_args(function()
'lua_ls', 'lua_ls',
'basedpyright', 'basedpyright',
'ruff', 'ruff',
'html',
'css',
'toml',
'marksman',
}) })
end) end)
@@ -107,7 +112,7 @@ later(function()
-- Make sure that necessary CLI tool is available -- Make sure that necessary CLI tool is available
formatters_by_ft = { formatters_by_ft = {
lua = { 'stylua' }, lua = { 'stylua' },
python = { 'ruff' } python = { 'ruff' },
}, },
}) })
end) end)
@@ -120,7 +125,7 @@ end)
-- Catppuccin ================================================================= -- Catppuccin =================================================================
now_if_args(function() now_if_args(function()
add({ source = "catppuccin/nvim", name = "catppuccin" }) add({ source = 'catppuccin/nvim', name = 'catppuccin' })
require('catppuccin').setup({ require('catppuccin').setup({
flavour = 'mocha', flavour = 'mocha',
transparent_background = true, transparent_background = true,
@@ -130,6 +135,7 @@ now_if_args(function()
float = { float = {
transparent = true, transparent = true,
}, },
compile_path = vim.fn.stdpath "cache" .. "/catppuccin",
}) })
vim.cmd('colorscheme catppuccin') vim.cmd('colorscheme catppuccin')
end) end)
@@ -152,14 +158,48 @@ later(function()
end) end)
-- claudecode ================================================================= -- claudecode =================================================================
later(function () -- later(function ()
-- add({
-- source = 'coder/claudecode.nvim',
-- depends = { 'folke/snacks.nvim' },
-- })
-- require('claudecode').setup({})
-- end)
--
-- open code ==================================================================
later(function()
add({ add({
source = 'coder/claudecode.nvim', source = 'nickjvandyke/opencode.nvim',
depends = { 'folke/snacks.nvim' }, depends = { 'folke/snacks.nvim' },
}) })
require('claudecode').setup({})
end vim.g.opencode_opts = {
) provider = {
enabled = 'terminal',
terminal = {
width = math.floor(vim.o.columns * 0.5),
},
},
}
-- 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 ========================================================================= -- zk =========================================================================
later(function() later(function()
@@ -167,18 +207,38 @@ later(function()
source = 'zk-org/zk-nvim', source = 'zk-org/zk-nvim',
}) })
require('zk').setup({ require('zk').setup({
picker = "minipick", picker = 'minipick',
enabled = 'snacks',
lsp = { lsp = {
config = { config = {
name = 'zk', name = 'zk',
cmd = {'zk', 'lsp' }, cmd = { 'zk', 'lsp' },
filetypes = { 'markdown' }, filetypes = { 'markdown' },
}, },
}, },
auto_attach = { auto_attach = {
enabled = true, enabled = true,
} },
}) })
end end)
)
-- checkmate ====================================================================
now_if_args(function()
add({
source = 'bngarren/checkmate.nvim',
})
require('checkmate').setup({
files = { '/home/mds/notes/TODO.md' },
})
end)
-- render-markdown.nvim ========================================================
now_if_args(function ()
add({
source = 'MeanderingProgrammer/render-markdown.nvim',
})
require('render-markdown').setup({
enabled = true,
file_types = {'markdown', 'vimwiki'},
})
end)