update config

This commit is contained in:
Phil Nguyen 2025-08-31 15:01:47 +07:00
parent 83001f7fcc
commit 58b4de78b0
2 changed files with 121 additions and 7 deletions

100
init.lua
View File

@ -1397,9 +1397,97 @@ require('lazy').setup({
-- tag = "v0.10", -- uncomment to pin to a specific release -- tag = "v0.10", -- uncomment to pin to a specific release
init = function() init = function()
-- wiki.vim configuration goes here, e.g. -- wiki.vim configuration goes here, e.g.
vim.g.wiki_root = '~/Documents/wiki' vim.g.wiki_root = '~/Documents/Developer/'
end, end,
}, },
{
'NickvanDyke/opencode.nvim',
dependencies = {
-- Recommended for better prompt input, and required to use opencode.nvim's embedded terminal — otherwise optional
{ 'folke/snacks.nvim', opts = { input = { enabled = true } } },
},
---@type opencode.Opts
opts = {
-- Your configuration, if any — see lua/opencode/config.lua
},
keys = {
-- Recommended keymaps
{
'<leader>oA',
function()
require('opencode').ask()
end,
desc = 'Ask opencode',
},
{
'<leader>oa',
function()
require('opencode').ask '@cursor: '
end,
desc = 'Ask opencode about this',
mode = 'n',
},
{
'<leader>oa',
function()
require('opencode').ask '@selection: '
end,
desc = 'Ask opencode about selection',
mode = 'v',
},
{
'<leader>ot',
function()
require('opencode').toggle()
end,
desc = 'Toggle embedded opencode',
},
{
'<leader>on',
function()
require('opencode').command 'session_new'
end,
desc = 'New session',
},
{
'<leader>oy',
function()
require('opencode').command 'messages_copy'
end,
desc = 'Copy last message',
},
{
'<S-C-u>',
function()
require('opencode').command 'messages_half_page_up'
end,
desc = 'Scroll messages up',
},
{
'<S-C-d>',
function()
require('opencode').command 'messages_half_page_down'
end,
desc = 'Scroll messages down',
},
{
'<leader>op',
function()
require('opencode').select_prompt()
end,
desc = 'Select prompt',
mode = { 'n', 'v' },
},
-- Example: keymap for custom prompt
{
'<leader>oe',
function()
require('opencode').prompt 'Explain @cursor and its context'
end,
desc = 'Explain code near cursor',
},
},
},
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
-- init.lua. If you want these files, they are in the repository, so you can just download them and -- init.lua. If you want these files, they are in the repository, so you can just download them and
@ -1410,12 +1498,12 @@ require('lazy').setup({
-- Here are some example plugins that I've included in the Kickstart repository. -- Here are some example plugins that I've included in the Kickstart repository.
-- Uncomment any of the lines below to enable them (you will need to restart nvim). -- Uncomment any of the lines below to enable them (you will need to restart nvim).
-- --
-- require 'kickstart.plugins.debug', require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line', require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint', require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs', require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree', -- require 'kickstart.plugins.neo-tree',
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config. -- This is the easiest way to modularize your config.

View File

@ -4,5 +4,31 @@
return { return {
'windwp/nvim-autopairs', 'windwp/nvim-autopairs',
event = 'InsertEnter', event = 'InsertEnter',
opts = {}, config = function()
require('nvim-autopairs').setup({
check_ts = true,
ts_config = {
lua = { 'string' }, -- it will not add a pair on that treesitter node
javascript = { 'template_string' },
java = false, -- don't check treesitter on java
},
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
offset = 0, -- Offset from pattern match
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'PmenuSel',
highlight_grey = 'LineNr',
},
})
-- Integration with nvim-cmp
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
} }