mirror of
https://github.com/cap153/nvim.git
synced 2026-01-08 04:07:35 +08:00
添加vscode neovim相关配置
This commit is contained in:
parent
59f0ba6a45
commit
d1f5f0a2c8
12 changed files with 217 additions and 57 deletions
|
|
@ -1,5 +1,6 @@
|
|||
return {
|
||||
"saghen/blink.cmp",
|
||||
enabled = not vim.g.vscode, -- 在vscode-neovim禁用
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
"Kaiser-Yang/blink-cmp-avante",
|
||||
|
|
@ -49,6 +50,12 @@ return {
|
|||
documentation = { auto_show = true, auto_show_delay_ms = 500 },
|
||||
-- 不预选第一个项目,选中后自动插入该项目文本
|
||||
list = { selection = { preselect = false, auto_insert = true } },
|
||||
-- 针对菜单的外观配置
|
||||
-- menu = {
|
||||
-- min_width = 15,
|
||||
-- max_height = 10,
|
||||
-- border = "single", -- Defaults to `vim.o.winborder` on nvim 0.11+
|
||||
-- },
|
||||
},
|
||||
-- 指定文件类型启用/禁用
|
||||
enabled = function()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ return {
|
|||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "lsp_status" },
|
||||
lualine_x = {},
|
||||
lualine_y = { "encoding", "fileformat", "progress" },
|
||||
lualine_y = { "encoding", "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
},
|
||||
|
|
|
|||
125
lua/lazy/plugins/dap.lua
Normal file
125
lua/lazy/plugins/dap.lua
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
{
|
||||
"igorlfs/nvim-dap-view",
|
||||
opts = {
|
||||
switchbuf = "useopen,uselast,newtab",
|
||||
-- 开启控制栏按钮
|
||||
winbar = {
|
||||
controls = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
vim.keymap.set("n", "<F5>", function()
|
||||
require("dap").continue()
|
||||
end)
|
||||
vim.keymap.set("n", "<F10>", function()
|
||||
require("dap").step_over()
|
||||
end)
|
||||
vim.keymap.set("n", "<F11>", function()
|
||||
require("dap").step_into()
|
||||
end)
|
||||
vim.keymap.set("n", "<F12>", function()
|
||||
require("dap").step_out()
|
||||
end)
|
||||
vim.keymap.set("n", "<Leader>b", function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end)
|
||||
vim.keymap.set("n", "<Leader>B", function()
|
||||
require("dap").set_breakpoint()
|
||||
end)
|
||||
vim.keymap.set("n", "<Leader>lp", function()
|
||||
require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: "))
|
||||
end)
|
||||
vim.keymap.set("n", "<Leader>dr", function()
|
||||
require("dap").repl.open()
|
||||
end)
|
||||
vim.keymap.set("n", "<Leader>dl", function()
|
||||
require("dap").run_last()
|
||||
end)
|
||||
vim.keymap.set({ "n", "v" }, "<Leader>dh", function()
|
||||
require("dap.ui.widgets").hover()
|
||||
end)
|
||||
vim.keymap.set({ "n", "v" }, "<Leader>dp", function()
|
||||
require("dap.ui.widgets").preview()
|
||||
end)
|
||||
vim.keymap.set("n", "<Leader>df", function()
|
||||
local widgets = require("dap.ui.widgets")
|
||||
widgets.centered_float(widgets.frames)
|
||||
end)
|
||||
vim.keymap.set("n", "<Leader>ds", function()
|
||||
local widgets = require("dap.ui.widgets")
|
||||
widgets.centered_float(widgets.scopes)
|
||||
end)
|
||||
-- 自动切换和关闭
|
||||
local dap, dv = require("dap"), require("dap-view")
|
||||
dap.listeners.before.attach["dap-view-config"] = function()
|
||||
dv.open()
|
||||
end
|
||||
dap.listeners.before.launch["dap-view-config"] = function()
|
||||
dv.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dap-view-config"] = function()
|
||||
dv.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dap-view-config"] = function()
|
||||
dv.close()
|
||||
end
|
||||
-- 在 nvim-dap-view 文件类型中将 q 映射为 quit
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "dap-view", "dap-view-term", "dap-repl" }, -- dap-repl is set by `nvim-dap`
|
||||
callback = function(evt)
|
||||
vim.keymap.set("n", "q", "<C-w>q", { buffer = evt.buf })
|
||||
end,
|
||||
})
|
||||
-- 如果没有窗口包含缓冲区,请创建一个新选项卡
|
||||
dap.defaults.fallback.switchbuf = "usevisible,usetab,newtab"
|
||||
dap.adapters.gdb = {
|
||||
type = "executable",
|
||||
command = "gdb",
|
||||
args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
|
||||
}
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "gdb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopAtBeginningOfMainSubprogram = false,
|
||||
},
|
||||
{
|
||||
name = "Select and attach to process",
|
||||
type = "gdb",
|
||||
request = "attach",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
pid = function()
|
||||
local name = vim.fn.input("Executable name (filter): ")
|
||||
return require("dap.utils").pick_process({ filter = name })
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
{
|
||||
name = "Attach to gdbserver :1234",
|
||||
type = "gdb",
|
||||
request = "attach",
|
||||
target = "localhost:1234",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
}
|
||||
dap.configurations.cpp = dap.configurations.c
|
||||
dap.configurations.rust = dap.configurations.c
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,9 +1,20 @@
|
|||
-- ===
|
||||
-- === explorer tree 文件列表
|
||||
-- ===
|
||||
|
||||
-- 判断当前环境是否是vscode映射不同命令打开yazi
|
||||
if vim.g.vscode then
|
||||
-- VSCode Neovim environment
|
||||
local vscode = require("vscode")
|
||||
vim.keymap.set("n", "tt", function()
|
||||
vscode.action("yazi-vscode.toggle")
|
||||
end, { noremap = true, silent = true, desc = "Toggle Yazi (VSCode)" })
|
||||
end
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"mikavilpas/yazi.nvim",
|
||||
enabled = not vim.g.vscode,
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
-- check the installation instructions at
|
||||
|
|
@ -34,17 +45,3 @@ return {
|
|||
vim.g.loaded_netrwPlugin = 1
|
||||
end,
|
||||
}
|
||||
-- return {
|
||||
-- "rolv-apneseth/tfm.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- opts = {
|
||||
-- enable_cmds = true,
|
||||
-- },
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "tt",
|
||||
-- ":Tfm<CR>",
|
||||
-- desc = "TFM - new tab",
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
|
|
|
|||
|
|
@ -6,25 +6,24 @@ return {
|
|||
config = function()
|
||||
opts = {}
|
||||
local highlight = {
|
||||
"RainbowBlue",
|
||||
"RainbowViolet",
|
||||
"RainbowRed",
|
||||
"RainbowYellow",
|
||||
"RainbowBlue",
|
||||
"RainbowOrange",
|
||||
"RainbowGreen",
|
||||
"RainbowViolet",
|
||||
"RainbowOrange",
|
||||
"RainbowCyan",
|
||||
}
|
||||
|
||||
local hooks = require("ibl.hooks")
|
||||
-- create the highlight groups in the highlight setup hook, so they are reset
|
||||
-- every time the colorscheme changes
|
||||
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
||||
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#61AFEF" })
|
||||
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#C678DD" })
|
||||
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#E06C75" })
|
||||
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
|
||||
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
|
||||
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
|
||||
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
|
||||
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
|
||||
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#E5C07B" })
|
||||
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
|
||||
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
|
||||
end)
|
||||
|
||||
|
|
|
|||
14
lua/lazy/plugins/markdownpreview.lua
Normal file
14
lua/lazy/plugins/markdownpreview.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
"cap153/peek.nvim",
|
||||
event = { "VeryLazy" },
|
||||
build = "deno task --quiet build:fast",
|
||||
config = function()
|
||||
require("peek").setup({
|
||||
port = 9000,
|
||||
-- app = { "firefox-esr", "-private-window" },
|
||||
app = { "google-chrome-stable", "--app=http://localhost:9000/?theme=dark", "--incognito" },
|
||||
})
|
||||
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
|
||||
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
|
||||
end,
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ map:cmd('<space>v', 'SymbolsOutline')
|
|||
|
||||
return {
|
||||
'simrat39/symbols-outline.nvim',
|
||||
enabled = not vim.g.vscode,
|
||||
config = function()
|
||||
require("symbols-outline").setup {
|
||||
width = 20,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,16 @@
|
|||
return {
|
||||
"HiPhish/rainbow-delimiters.nvim",
|
||||
config = function()
|
||||
require("rainbow-delimiters.setup").setup({})
|
||||
require("rainbow-delimiters.setup").setup({
|
||||
highlight = {
|
||||
"RainbowDelimiterBlue",
|
||||
"RainbowDelimiterViolet",
|
||||
"RainbowDelimiterRed",
|
||||
"RainbowDelimiterYellow",
|
||||
"RainbowDelimiterGreen",
|
||||
"RainbowDelimiterOrange",
|
||||
"RainbowDelimiterCyan",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
config = function()
|
||||
vim.keymap.set("n", "[c", function()
|
||||
require("treesitter-context").go_to_context(vim.v.count1)
|
||||
end, { silent = true })
|
||||
-- 前往上下文开始处,winbar相同快捷键更细致
|
||||
-- vim.keymap.set("n", "[c", function()
|
||||
-- require("treesitter-context").go_to_context(vim.v.count1)
|
||||
-- end, { silent = true })
|
||||
require'treesitter-context'.setup{
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue