Compare commits

...

5 Commits

5 changed files with 91 additions and 14 deletions

View File

@ -30,7 +30,7 @@ return {
{ "<C-A-i>", "<cmd>AvanteToggle<cr>", desc = "Avante Chat Toggle" }, { "<C-A-i>", "<cmd>AvanteToggle<cr>", desc = "Avante Chat Toggle" },
}, },
opts = { opts = {
provider = "ollama", providers = {
ollama = { ollama = {
{{ if .ollamaKey -}} {{ if .ollamaKey -}}
api_key_name = "OLLAMA_API_KEY", api_key_name = "OLLAMA_API_KEY",
@ -38,8 +38,15 @@ return {
endpoint = {{ .ollamaUrl | quote }}, endpoint = {{ .ollamaUrl | quote }},
model = "qwen2.5-coder:7b", model = "qwen2.5-coder:7b",
disable_tools = true, -- Open-source models often do not support tools. disable_tools = true, -- Open-source models often do not support tools.
-- Fix: Always show `ollama: API key not set, continuing without authentication`
parse_api_key = function()
return vim.env.OLLAMA_API_KEY
end,
},
}, },
provider = "ollama",
behaviour = { behaviour = {
auto_suggestions = false, -- Experimental stage auto_suggestions = false, -- Experimental stage
auto_set_highlight_group = true, auto_set_highlight_group = true,

View File

@ -513,6 +513,7 @@ return {
return old_set_win(self, window) return old_set_win(self, window)
end end
-- 調整展開後tree線條顏色 -- 調整展開後tree線條顏色
vim.api.nvim_set_hl(0, "NeoTreeIndentMarker", { fg = "#3c3c3c" }) vim.api.nvim_set_hl(0, "NeoTreeIndentMarker", { fg = "#3c3c3c" })
-- vim.api.nvim_set_hl(0, "NeoTreeExpander", { fg = "#00FF00" }) -- vim.api.nvim_set_hl(0, "NeoTreeExpander", { fg = "#00FF00" })
@ -520,6 +521,29 @@ return {
-- vim.keymap.set("n", "<leader>e", "<Cmd>Neotree reveal<CR>") -- vim.keymap.set("n", "<leader>e", "<Cmd>Neotree reveal<CR>")
-- 讓document_symbols不要出現winbar
-- vim.api.nvim_create_autocmd("WinNew", {
-- callback = function(args)
-- vim.defer_fn(function()
-- local state = require("neo-tree.sources.manager").get_state("document_symbols")
-- if state and state.winid and vim.api.nvim_win_is_valid(state.winid) then
-- vim.api.nvim_win_set_option(state.winid, "winbar", "")
-- end
-- end, 100)
-- end,
-- })
local function keep_clear_winbar()
local state = require("neo-tree.sources.manager").get_state("document_symbols")
if state and state.winid and vim.api.nvim_win_is_valid(state.winid) then
vim.api.nvim_win_set_option(state.winid, "winbar", "")
end
vim.defer_fn(keep_clear_winbar, 100) -- 300ms 後再執行自己一次
end
keep_clear_winbar() -- 啟動
-- 自動命令:啟動時自動顯示 Neo-tree -- 自動命令:啟動時自動顯示 Neo-tree
vim.api.nvim_create_autocmd("VimEnter", { vim.api.nvim_create_autocmd("VimEnter", {
callback = function() callback = function()

View File

@ -0,0 +1,45 @@
-- if true then return {} end
return {
{
"lewis6991/hover.nvim",
config = function()
require("hover").setup {
init = function()
-- Require providers
require("hover.providers.lsp")
-- require('hover.providers.gh')
-- require('hover.providers.gh_user')
-- require('hover.providers.jira')
-- require('hover.providers.dap')
-- require('hover.providers.fold_preview')
-- require('hover.providers.diagnostic')
-- require('hover.providers.man')
-- require('hover.providers.dictionary')
-- require('hover.providers.highlight')
end,
preview_opts = {
border = 'single'
},
-- Whether the contents of a currently open hover window should be moved
-- to a :h preview-window when pressing the hover keymap.
preview_window = false,
title = true,
mouse_providers = {
'LSP'
},
mouse_delay = 600
}
-- Setup keymaps
vim.keymap.set("n", "K", require("hover").hover, {desc = "hover.nvim"})
vim.keymap.set("n", "gK", require("hover").hover_select, {desc = "hover.nvim (select)"})
vim.keymap.set("n", "<C-p>", function() require("hover").hover_switch("previous") end, {desc = "hover.nvim (previous source)"})
vim.keymap.set("n", "<C-n>", function() require("hover").hover_switch("next") end, {desc = "hover.nvim (next source)"})
-- Mouse support
vim.keymap.set('n', '<MouseMove>', require('hover').hover_mouse, { desc = "hover.nvim (mouse)" })
vim.o.mousemoveevent = true
end,
}
}

View File

@ -19,6 +19,7 @@ M.lsp_servers = {
-- "ts_ls", -- TypeScript目前暫時不需要先註解掉 -- "ts_ls", -- TypeScript目前暫時不需要先註解掉
"marksman", -- Markdown "marksman", -- Markdown
"yamlls", -- YAML "yamlls", -- YAML
"lua_ls", -- LUA
} }
-- 過濾 nil 值 -- 過濾 nil 值

View File

@ -7,10 +7,10 @@ require("lsp.config.cmp")
-- position_encoding param is required in vim.lsp.util.make_position_params. Defaulting to position encoding of the first client. -- position_encoding param is required in vim.lsp.util.make_position_params. Defaulting to position encoding of the first client.
-- 目前無法處理,需要等待大多數來自 plugin 尚未更新以配合 Neovim 0.10+的套件修正,先手動抑制 -- 目前無法處理,需要等待大多數來自 plugin 尚未更新以配合 Neovim 0.10+的套件修正,先手動抑制
-- 臨時抑制這類 LSP 訊息 -- 臨時抑制這類 LSP 訊息
vim.notify = function(msg, log_level, _) -- vim.notify = function(msg, log_level, _)
if msg:match("position_encoding param is required") then -- if msg:match("position_encoding param is required") then
return -- return
end -- end
vim.api.nvim_notify(msg, log_level, {}) -- vim.api.nvim_notify(msg, log_level, {})
end -- end