Add opencode and notes/todo configuration
This commit is contained in:
+17
-21
@@ -47,14 +47,10 @@ _G.Config.leader_group_clues = {
|
||||
{ mode = 'n', keys = '<Leader>m', desc = '+Map' },
|
||||
{ mode = 'n', keys = '<Leader>o', desc = '+Other' },
|
||||
{ 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>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.
|
||||
-- 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>`.
|
||||
@@ -63,14 +59,20 @@ vim.keymap.set({'n', 'x'}, '<Leader>d', '"d', { desc = "Cut" })
|
||||
local nmap_leader = function(suffix, rhs, desc)
|
||||
vim.keymap.set('n', '<Leader>' .. suffix, rhs, { desc = desc })
|
||||
end
|
||||
|
||||
local xmap_leader = function(suffix, rhs, desc)
|
||||
vim.keymap.set('x', '<Leader>' .. suffix, rhs, { desc = desc })
|
||||
end
|
||||
|
||||
local vmap_leader = function(suffix, rhs, desc)
|
||||
vim.keymap.set('v', '<Leader>' .. suffix, rhs, { desc = desc })
|
||||
end
|
||||
|
||||
-- a is for 'AI'
|
||||
nmap_leader('ac', ':ClaudeCode<CR>', 'Toggle Claude')
|
||||
nmap_leader('af', ':ClaudeCodeFocus<CR>', 'Focus Claude')
|
||||
nmap_leader('ar', ':ClaudeCode --resume<CR>', 'Resume Claude')
|
||||
|
||||
nmap_leader('ac', ':lua require("opencode").toggle()<CR>', 'Toggle Opencode')
|
||||
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:
|
||||
-- - `<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('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')
|
||||
nmap_leader('sn', '<Cmd>lua ' .. session_new .. '<CR>', 'New')
|
||||
nmap_leader('sr', '<Cmd>lua MiniSessions.select("read")<CR>', 'Read')
|
||||
nmap_leader('sw', '<Cmd>lua MiniSessions.write()<CR>', 'Write current')
|
||||
|
||||
-- t is for 'Terminal'
|
||||
nmap_leader('tT', '<Cmd>horizontal term<CR>', 'Terminal (horizontal)')
|
||||
nmap_leader('tt', '<Cmd>vertical term<CR>', 'Terminal (vertical)')
|
||||
-- z if for notes and todos
|
||||
nmap_leader('zz', "<Cmd>ZkNotes {sort={'modified'}}<CR>", 'Notes picker')
|
||||
nmap_leader('zn', "<Cmd>ZkNew {title = vim.fn.input('Title: ')}<CR>", 'New note')
|
||||
nmap_leader('zt', "<Cmd>ZkTags<CR>", 'Notes tags')
|
||||
nmap_leader('zf', "<Cmd>ZkNotes {sort={'modified'}, match={vim.fn.input('Search: ')}}<CR>", 'Search')
|
||||
vmap_leader('zm', "<Cmd>'<,'>ZkMatch<CR>", "Search match")
|
||||
nmap_leader('zt', "<Cmd>e ~/notes/TODO.md<CR>", "Open TODOs")
|
||||
|
||||
-- stylua: ignore end
|
||||
|
||||
+73
-13
@@ -35,7 +35,8 @@ now_if_args(function()
|
||||
local languages = {
|
||||
-- These are already pre-installed with Neovim. Used as an example.
|
||||
'lua',
|
||||
'vimdoc',
|
||||
'html',
|
||||
'css',
|
||||
'markdown',
|
||||
'yaml',
|
||||
'toml',
|
||||
@@ -84,6 +85,10 @@ now_if_args(function()
|
||||
'lua_ls',
|
||||
'basedpyright',
|
||||
'ruff',
|
||||
'html',
|
||||
'css',
|
||||
'toml',
|
||||
'marksman',
|
||||
})
|
||||
end)
|
||||
|
||||
@@ -107,7 +112,7 @@ later(function()
|
||||
-- Make sure that necessary CLI tool is available
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
python = { 'ruff' }
|
||||
python = { 'ruff' },
|
||||
},
|
||||
})
|
||||
end)
|
||||
@@ -120,7 +125,7 @@ end)
|
||||
|
||||
-- Catppuccin =================================================================
|
||||
now_if_args(function()
|
||||
add({ source = "catppuccin/nvim", name = "catppuccin" })
|
||||
add({ source = 'catppuccin/nvim', name = 'catppuccin' })
|
||||
require('catppuccin').setup({
|
||||
flavour = 'mocha',
|
||||
transparent_background = true,
|
||||
@@ -130,6 +135,7 @@ now_if_args(function()
|
||||
float = {
|
||||
transparent = true,
|
||||
},
|
||||
compile_path = vim.fn.stdpath "cache" .. "/catppuccin",
|
||||
})
|
||||
vim.cmd('colorscheme catppuccin')
|
||||
end)
|
||||
@@ -152,14 +158,48 @@ later(function()
|
||||
end)
|
||||
|
||||
-- claudecode =================================================================
|
||||
later(function ()
|
||||
-- later(function ()
|
||||
-- add({
|
||||
-- source = 'coder/claudecode.nvim',
|
||||
-- depends = { 'folke/snacks.nvim' },
|
||||
-- })
|
||||
-- require('claudecode').setup({})
|
||||
-- end)
|
||||
--
|
||||
-- open code ==================================================================
|
||||
later(function()
|
||||
add({
|
||||
source = 'coder/claudecode.nvim',
|
||||
source = 'nickjvandyke/opencode.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 =========================================================================
|
||||
later(function()
|
||||
@@ -167,18 +207,38 @@ later(function()
|
||||
source = 'zk-org/zk-nvim',
|
||||
})
|
||||
require('zk').setup({
|
||||
picker = "minipick",
|
||||
picker = 'minipick',
|
||||
enabled = 'snacks',
|
||||
lsp = {
|
||||
config = {
|
||||
name = 'zk',
|
||||
cmd = {'zk', 'lsp' },
|
||||
cmd = { 'zk', 'lsp' },
|
||||
filetypes = { 'markdown' },
|
||||
},
|
||||
},
|
||||
auto_attach = {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user