big update change from packer to lazy and other

This commit is contained in:
gameloader 2024-09-13 12:21:24 +08:00
parent 3c42e0a450
commit 51cd63ca77
17 changed files with 381 additions and 444 deletions

View File

@ -1,6 +1,6 @@
require("basic").load_default_options()
require("plugins")
require("plugin")
require("keybindings")
@ -8,7 +8,6 @@ require("keybindings")
require("plugin-config/buffer_line")
require("plugin-config/treesitter")
require("plugin-config/telescope")
require("plugin-config/whichkey")
require("plugin-config/comment")
require("plugin-config/vimtex")
require("plugin-config/mason")
@ -17,7 +16,7 @@ require("plugin-config/notify")
require("plugin-config/nvim-autopairs")
require("plugin-config/lua_snip")
require("plugin-config/table-mode")
require("plugin-config/gp")
-- require("plugin-config/gp")
require("plugin-config/mkdnflow")
require("plugin-config/project")
-- require("plugin-config/alpha")
@ -29,6 +28,7 @@ require("plugin-config/jaq")
require("plugin-config/toggleterm")
require("plugin-config/indent-blankline")
require("plugin-config/lazygit")
require("plugin-config/iron")
require("autocmd")
require("lsp")

60
lazy-lock.json Normal file
View File

@ -0,0 +1,60 @@
{
"AdvancedNewFile.nvim": { "branch": "main", "commit": "9b4576dcf916d848148241e7269c9cd78f299b22" },
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"bufferline.nvim": { "branch": "main", "commit": "243893ba9d5d1049dd451a25cab32ec7f8f67bcf" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-omni": { "branch": "main", "commit": "4ef610bbd85a5ee4e97e09450c0daecbdc60de86" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" },
"dressing.nvim": { "branch": "master", "commit": "c5775a888adbc50652cb370073fcfec963eca93e" },
"everforest": { "branch": "master", "commit": "93b89630861a4c8a1be07bc54f6d53487acb2e57" },
"flutter-tools.nvim": { "branch": "main", "commit": "ea1d398f543a54ba95357c3b8bb9d6f68eaec36c" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"gp.nvim": { "branch": "main", "commit": "f4cbbf489fb621ae8f4e512c38ae234ce1157fa7" },
"hop.nvim": { "branch": "v2", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" },
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
"iron.nvim": { "branch": "master", "commit": "e6b78ec1bc56eab63b3a9112d348b3d79836b672" },
"jaq-nvim": { "branch": "master", "commit": "236296aae555657487d1bb4d066cbde9d79d8cd4" },
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" },
"lazygit.nvim": { "branch": "main", "commit": "2432b447483f42ff2e18b2d392cb2bb27e495c08" },
"live-command.nvim": { "branch": "main", "commit": "79f89a2e3472e69fe00d4df50605e323d30f2d09" },
"lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" },
"lspkind-nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"material.nvim": { "branch": "main", "commit": "ac8f02e97e359b7d258c0a00ec0949fe880790ad" },
"mini.nvim": { "branch": "main", "commit": "5c72e4d74e05f50325641e5fa921fca97a24cb13" },
"mkdnflow.nvim": { "branch": "main", "commit": "d459bd7ce68910272038ed037c028180161fd14d" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" },
"neocodeium": { "branch": "main", "commit": "d2c968ce714cbab1de99dd254e0baa412e4aec92" },
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-autopairs": { "branch": "master", "commit": "fd2badc24e675f947162a16c124d395bde80dbd6" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-dap": { "branch": "master", "commit": "90616ae6ae40053103dc66872886fc26b94c70c8" },
"nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "3497eb39bf413a57ab5b7e7e2e192683e462148c" },
"nvim-lspconfig": { "branch": "master", "commit": "bb682c167a0878338b4313b55538953d1c039085" },
"nvim-luapad": { "branch": "master", "commit": "176686eb616a5ada5dfc748f2b5109194bbe8a71" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-treesitter": { "branch": "master", "commit": "4af16a10b7f1e79275f712a1c6dcf725d301a303" },
"nvim-web-devicons": { "branch": "master", "commit": "9154484705968658e9aab2b894d1b2a64bf9f83d" },
"persistent-breakpoints.nvim": { "branch": "main", "commit": "4b199b1dcfd136cac8b0fa9c8dbbdeb81463f7a9" },
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "c5a14e0550699a7db575805cdb9ddc969ba0f1f5" },
"telescope.nvim": { "branch": "master", "commit": "927c10f748e49c543b2d544c321a1245302ff324" },
"toggleterm.nvim": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" },
"vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" },
"vimtex": { "branch": "master", "commit": "539a203f19531c6b9d2d1b093ee8911fb7050bbc" },
"which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" }
}

View File

@ -17,11 +17,10 @@ end
function set_colorscheme()
local colorschemes = vim.fn.getcompletion("", "color")
local desired_colorscheme = "material"
local desired_colorscheme = "material-lighter"
if vim.tbl_contains(colorschemes, desired_colorscheme) then
vim.cmd("colorscheme " .. desired_colorscheme)
vim.g.material_style = "lighter"
else
vim.cmd("colorscheme default")
end

View File

@ -66,7 +66,6 @@ M.load_default_options = function()
-- set leaderkey to space
mapleader = " ",
maplocalleader = "\\",
copilot_node_command = "~/.nodenv/versions/16.17.0/bin/node",
codeium_filetypes = {
tex = false,
},

View File

@ -8,10 +8,18 @@ local wk = require("which-key")
-- basic operation for write and quit
-- 文件写入退出基本操作
wk.register({
["<Leader>s"] = { ":w!<CR>", "Save File" },
["<Leader>q"] = { ":qa<CR>", "Quit All" },
["<Leader>S"] = { ":wa<CR>", "Save All" },
wk.add({
{ "<Leader>s", ":w!<CR>", desc = "Save File" },
{ "<Leader>q", ":qa<CR>", desc = "Quit All" },
{ "<Leader>S", ":wa<CR>", desc = "Save All" },
})
-- iron related
wk.add({
{ "<leader>i", group = "Iron" },
{ "<leader>il", "<Cmd>lua require('iron.core').send_line()<CR>", desc = "Send line" },
{ "<leader>if", "<Cmd>lua require('iron.core').send_file()<CR>", desc = "Send file" },
{ "<leader>ic", "<Cmd>lua require('iron.core').send_until_cursor()<CR>", desc = "Send to cursor" },
})
-- lsp 回调快捷键设置
@ -34,33 +42,29 @@ end
map("n", ",", ":Jaq<CR>", opt)
-- markdown related
-- markdown 相关
wk.register({
["<Leader>m"] = { ":MarkdownPreview<CR>", "Markdown preview" },
wk.add({
{ "<Leader>m", ":MarkdownPreview<CR>", desc = "Markdown preview" },
})
-- git related
-- git 相关
wk.register({
["<Leader>g"] = { ":LazyGit<CR>", "Open lazygit" },
})
-- file related
-- 文件相关操作
wk.register({
["<Leader><Tab>"] = { "<C-^>", "Last file" },
wk.add({
{ "<Leader>g", ":LazyGit<CR>", desc = "Open lazygit" },
})
wk.register({
["<Leader>f"] = {
name = "+File",
p = { ":Telescope projects<CR>", "Open project" },
r = { ":Telescope oldfiles<CR>", "Recent files" },
b = { ":Telescope file_browser<CR>", "File browser" },
n = { ":AdvancedNewFile<CR>", "New file" },
s = { ":Telescope live_grep<CR>", "Search in project" },
f = { ":Telescope find_files<CR>", "Search file" },
c = { ":source $MYVIMRC<CR>", "Reload config file" },
},
-- file related
wk.add({
{ "<Leader><Tab>", "<C-^>", desc = "Last file" },
})
wk.add({
{ "<Leader>f", group = "File" },
{ "<Leader>fp", ":Telescope projects<CR>", desc = "Open project" },
{ "<Leader>fr", ":Telescope oldfiles<CR>", desc = "Recent files" },
{ "<Leader>fb", ":Telescope file_browser<CR>", desc = "File browser" },
{ "<Leader>fn", ":AdvancedNewFile<CR>", desc = "New file" },
{ "<Leader>fs", ":Telescope live_grep<CR>", desc = "Search in project" },
{ "<Leader>ff", ":Telescope find_files<CR>", desc = "Search file" },
{ "<Leader>fc", ":source $MYVIMRC<CR>", desc = "Reload config file" },
})
-- jk map to esc
@ -68,19 +72,16 @@ wk.register({
map("i", "jk", "<Esc>", opt)
-- window operate by which-key
-- 窗口操作(使用which-key快捷键设置)
wk.register({
["<Leader>w"] = {
name = "+Window",
h = { "<C-w>h", "To left" },
j = { "<C-w>j", "To up" },
k = { "<C-w>k", "To down" },
l = { "<C-w>l", "To right" },
s = { ":sp<CR>", "Split window" },
v = { ":vsplit<CR>", "Vsplit window" },
d = { ":close<CR>", "Close window" },
o = { ":only<CR>", "Close others" },
},
wk.add({
{ "<Leader>w", group = "Window" },
{ "<Leader>wh", "<C-w>h", desc = "To left" },
{ "<Leader>wj", "<C-w>j", desc = "To up" },
{ "<Leader>wk", "<C-w>k", desc = "To down" },
{ "<Leader>wl", "<C-w>l", desc = "To right" },
{ "<Leader>ws", ":sp<CR>", desc = "Split window" },
{ "<Leader>wv", ":vsplit<CR>", desc = "Vsplit window" },
{ "<Leader>wd", ":close<CR>", desc = "Close window" },
{ "<Leader>wo", ":only<CR>", desc = "Close others" },
})
-- base operation for visual mode
@ -91,15 +92,6 @@ map("v", ">", ">gv", opt)
-- neoTree
map("n", "T", ":NeoTreeFocusToggle<CR>", opt)
-- Packer
wk.register({
["<Leader>p"] = {
name = "+Packer",
i = { ":PackerSync<CR>", "PackerSync" },
s = { ":PackerStatus<CR>", "PackerStatus" },
c = { ":PackerClean<CR>", "PackerClean" },
},
})
-- 定义开关quickfix窗口的函数
@ -121,32 +113,37 @@ local function toggle_quickfix()
end
-- Bufferline and buffer related
wk.register({
["<Leader>b"] = {
name = "+Buffer",
k = { ":bd!<CR>", "Kill buffer" },
o = { ":BufferLineCloseRight<CR>:BufferLineCloseLeft<CR>", "Close other buffer" },
b = { ":Telescope buffers<CR>", "Open buffers" },
n = { ":ls<CR>", "Buffer numbers" },
c = { ":noh<CR>", "Cancel highlight" },
C = { ":call setqflist([], 'r')<CR>", "Clear quickfix" },
q = {
function()
toggle_quickfix()
end,
"Toggle quickfix",
},
s = { ":Telescope current_buffer_fuzzy_find<CR>", "Searching in buffer" },
},
})
wk.register({
["<Leader>j"] = { ":HopLineStart<CR>", "Quick jump line" },
wk.add({
{ "<Leader>b", group = "Buffer" },
{ "<Leader>bk", ":bd!<CR>", desc = "Kill buffer" },
{ "<Leader>bo", ":BufferLineCloseRight<CR>:BufferLineCloseLeft<CR>", desc = "Close other buffer" },
{ "<Leader>bb", ":Telescope buffers<CR>", desc = "Open buffers" },
{ "<Leader>bn", ":ls<CR>", desc = "Buffer numbers" },
{ "<Leader>bc", ":noh<CR>", desc = "Cancel highlight" },
{ "<Leader>bC", ":call setqflist([], 'r')<CR>", desc = "Clear quickfix" },
{ "<Leader>bq", function() toggle_quickfix() end, desc = "Toggle quickfix" },
{ "<Leader>bs", ":Telescope current_buffer_fuzzy_find<CR>", desc = "Searching in buffer" },
})
-- 快速切换主题
wk.register({
["<Leader>c"] = { ":Telescope colorscheme<CR>", "Quick change colortheme" },
wk.add({
{ "<Leader>j", ":HopLineStart<CR>", desc = "Quick jump line" },
})
wk.add({
{ "<Leader>c", group = "ChatGPT" },
{ "<Leader>cb", ":%GpAppend<CR>", desc = "gpt response by buffer" },
})
-- use gp to interact with chatgpt to write code
map("v", "<C-g>r", ":<C-u>'<,'>GpRewrite<cr>", opt)
map("v", "<C-g>a", ":<C-u>'<,'>GpAppend<cr>", opt)
-- 快速切换主题
-- wk.register({
-- ["<Leader>c"] = { ":Telescope colorscheme<CR>", "Quick change colortheme" },
-- })
map("n", "<Tab>", "za", opt)
-- insert 模式下ctrl a e跳转开头结尾
map("i", "<C-a>", "<C-o>I", opt)
@ -160,18 +157,25 @@ map("i", "<C-h>", "<C-o>:BufferLineCyclePrev<CR>", opt)
map("i", "<C-l>", "<C-o>:BufferLineCycleNext<CR>", opt)
-- Mason
wk.register({
["<Leader>l"] = {
name = "+Lsp",
i = { ":LspInstall<CR>", "Install lsp" },
I = { ":MasonInstall ", "Install any" },
r = { ":LspRestart<CR>", "Lsp restart" },
m = { ":Mason<CR>", "Mason info" },
u = { ":MasonUninstall<CR>", "Uninstall lsp" },
U = { ":MasonUninstallAll<CR>", "Unistall all" },
l = { ":LspInfo<CR>", "Lsp infos" },
R = { vim.lsp.buf.rename, "Buffer var rename" },
},
wk.add({
{ "<Leader>l", group = "Lsp" },
{ "<Leader>li", ":LspInstall<CR>", desc = "Install lsp" },
{ "<Leader>lI", ":MasonInstall ", desc = "Install any" },
{ "<Leader>lr", ":LspRestart<CR>", desc = "Lsp restart" },
{ "<Leader>lm", ":Mason<CR>", desc = "Mason info" },
{ "<Leader>lu", ":MasonUninstall<CR>", desc = "Uninstall lsp" },
{ "<Leader>lU", ":MasonUninstallAll<CR>", desc = "Unistall all" },
{ "<Leader>ll", ":LspInfo<CR>", desc = "Lsp infos" },
{ "<Leader>lR", vim.lsp.buf.rename, desc = "Buffer var rename" },
})
-- dap keymaps
wk.add({
{ "<Leader>d", group = "Debug" },
{ "<Leader>dr", ":lua require('dap').continue()<CR>", desc = "Start debug" },
{ "<Leader>db", ":lua require('dap').toggle_breakpoint()<CR>", desc = "Set breakpoint" },
{ "<Leader>dc", ":lua require('dap').clear_breakpoints()<CR>", desc = "Clear breakpoint" },
{ "<Leader>de", ":lua require'dap'.close()<CR>:lua require'dap'.terminate()<CR>:lua require'dap.repl'.close()<CR>:lua require'dapui'.close()<CR>:DapVirtualTextDisable<CR><C-w>o<CR>", desc = "Stop debug" },
})
-- cmpeletion keys
@ -198,24 +202,6 @@ pluginKeys.cmp = function(cmp)
}
end
-- dap keymaps
wk.register({
["<Leader>d"] = {
name = "+Debug",
r = { ":lua require('dap').continue()<CR>", "Start debug" },
b = { ":lua require('dap').toggle_breakpoint()<CR>", "Set breakpoint" },
c = { ":lua require('dap').clear_breakpoints()<CR>", "Clear breakpoint" },
e = {
":lua require'dap'.close()<CR>"
.. ":lua require'dap'.terminate()<CR>"
.. ":lua require'dap.repl'.close()<CR>"
.. ":lua require'dapui'.close()<CR>"
.. ":DapVirtualTextDisable<CR>"
.. "<C-w>o<CR>",
"Stop debug",
},
},
})
map("i", "<C-d>", ":lua require'dap'.continue()<CR>", opt)
map("n", "<C-n>", ":lua require'dap'.step_into()<CR>", opt)
map("n", "<C-o>", ":lua require'dap'.step_over()<CR>", opt)
@ -245,6 +231,7 @@ function SetKeybinds()
["c"] = { ":FlutterCopyProfilerUrl<CR>", "FlutterCopyProfilerUrl" },
["w"] = { ":FlutterDevTools<CR>", "FlutterDevTools" },
}, opts)
-- elseif fileTy == "sh" then
-- wk.register({
-- ["W"] = { ":w<CR>", "test write" },

1
lua/lsp/config/astro.lua Normal file
View File

@ -0,0 +1 @@
return require("lsp.config.basic_config")

View File

@ -8,21 +8,22 @@ local servers = {
lua_ls = require("lsp.config.lua"), -- lua/lsp/config/lua.lua
clangd = require("lsp.config.clangd"),
gopls = require("lsp.config.gopls"),
astro = require("lsp.config.astro"),
-- eslint = require("lsp.config.eslint"),
-- r_language_server = require("lsp.config.r"),
-- csharp_ls = require("lsp.config.csharp"),
omnisharp = require("lsp.config.csharp"),
-- bashls = require("lsp.config.bash"),
pyright = require("lsp.config.pyright"),
-- pyright = require("lsp.config.pyright"),
marksman = require("lsp.config.marksman"),
pylsp = require("lsp.config.pylsp"),
-- texlab = require("lsp.config.texlab"),
volar = require("lsp.config.vue"),
-- volar = require("lsp.config.vue"),
-- html = require("lsp.config.html"),
-- cssls = require("lsp.config.css"),
-- emmet_ls = require("lsp.config.emmet"),
-- jsonls = require("lsp.config.json"),
tsserver = require("lsp.config.ts"),
ts_ls = require("lsp.config.ts"),
-- rust_analyzer = require("lsp.config.rust"),
-- yamlls = require("lsp.config.yamlls"),
-- remark_ls = require("lsp.config.markdown"),

View File

@ -1,21 +1,10 @@
local db = require("dashboard")
local function foot()
-- local total_plugins = #vim.tbl_keys(packer_plugins)
local function get_table_size(t)
local count = 0
for _, __ in pairs(t) do
count = count + 1
end
return count
end
local opt, start = require("packer.plugin_utils").list_installed_plugins()
local plugin_count = get_table_size(opt) + get_table_size(start)
local datetime = os.date(" %d-%m-%Y  %H:%M:%S")
local version = vim.version()
local nvim_version_info = "  v" .. version.major .. "." .. version.minor .. "." .. version.patch
return datetime .. "" .. plugin_count .. " plugins" .. nvim_version_info
return datetime .. nvim_version_info
end
db.setup({

View File

@ -1,8 +1,8 @@
local conf = {
-- required openai api key
openai_api_key = os.getenv("OPENAI_API_KEY"),
openai_api_key = "",
-- api endpoint (you can change this to azure endpoint)
openai_api_endpoint = "https://api.openai.com/v1/chat/completions",
openai_api_endpoint = "https://api1.zhtec.xyz/v1/chat/completions",
-- openai_api_endpoint = "https://$URL.openai.azure.com/openai/deployments/{{model}}/chat/completions?api-version=2023-03-15-preview",
-- prefix for all commands
cmd_prefix = "Gp",
@ -13,7 +13,7 @@ local conf = {
-- directory for storing chat files
chat_dir = vim.fn.stdpath("data"):gsub("/$", "") .. "/gp/chats",
-- chat model (string with model name or table with model name and parameters)
chat_model = { model = "gpt-4", temperature = 1.1, top_p = 1 },
chat_model = { model = "gpt-4o", temperature = 1.1, top_p = 1 },
-- chat model system prompt (use this to specify the persona/role of the AI)
chat_system_prompt = "You are a general AI assistant.",
-- chat custom instructions (not visible in the chat but prepended to model prompt)
@ -90,32 +90,32 @@ local conf = {
whisper_tempo = "1.75",
-- example hook functions (see Extend functionality section in the README)
hooks = {
InspectPlugin = function(plugin, params)
print(string.format("Plugin structure:\n%s", vim.inspect(plugin)))
print(string.format("Command params:\n%s", vim.inspect(params)))
end,
-- hooks = {
-- InspectPlugin = function(plugin, params)
-- print(string.format("Plugin structure:\n%s", vim.inspect(plugin)))
-- print(string.format("Command params:\n%s", vim.inspect(params)))
-- end,
-- GpImplement rewrites the provided selection/range based on comments in the code
Implement = function(gp, params)
local template = "Having following from {{filename}}:\n\n"
.. "```{{filetype}}\n{{selection}}\n```\n\n"
.. "Please rewrite this code according to the comment instructions."
.. "\n\nRespond only with the snippet of finalized code:"
-- GpImplement rewrites the provided selection/range based on comments in the code
-- Implement = function(gp, params)
-- local template = "Having following from {{filename}}:\n\n"
-- .. "```{{filetype}}\n{{selection}}\n```\n\n"
-- .. "Please rewrite this code according to the comment instructions."
-- .. "\n\nRespond only with the snippet of finalized code:"
gp.Prompt(
params,
gp.Target.rewrite,
nil, -- command will run directly without any prompting for user input
gp.config.command_model,
template,
gp.config.command_system_prompt
)
end,
-- gp.Prompt(
-- params,
-- gp.Target.rewrite,
-- nil, -- command will run directly without any prompting for user input
-- gp.config.command_model,
-- template,
-- gp.config.command_system_prompt
-- )
-- end,
-- your own functions can go here, see README for more examples like
-- :GpExplain, :GpUnitTests.., :GpBetterChatNew, ..
},
-- your own functions can go here, see README for more examples like
-- :GpExplain, :GpUnitTests.., :GpBetterChatNew, ..
-- },
}
-- call setup on your config

View File

@ -0,0 +1,40 @@
local iron = require("iron.core")
iron.setup({
config = {
-- Whether a repl should be discarded or not
scratch_repl = true,
-- Your repl definitions come here
repl_definition = {
sh = {
-- Can be a table or a function that
-- returns a table (see below)
command = { "zsh" },
},
python = {
command = { "ipython" },
format = require("iron.fts.common").bracketed_paste,
},
},
-- How the repl window will be displayed
-- See below for more information
repl_open_cmd = require("iron.view").split("30%"),
},
-- Iron doesn't set keymaps by default anymore.
-- You can set them here or manually add keymaps to the functions in iron.core
-- If the highlight is on, you can change how it looks
-- For the available options, check nvim_set_hl
keymaps = {
visual_send = "<space>iv",
},
highlight = {
italic = true,
},
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
})
-- iron also has a list of commands, see :h iron-commands for all available commands
-- vim.keymap.set("n", "<space>rs", "<cmd>IronRepl<cr>")
-- vim.keymap.set("n", "<space>rr", "<cmd>IronRestart<cr>")
-- vim.keymap.set("n", "<space>rf", "<cmd>IronFocus<cr>")
-- vim.keymap.set("n", "<space>ih", "<cmd>IronHide<cr>")

View File

@ -18,7 +18,6 @@ end
require("lualine").setup({
options = {
icons_enabled = true,
-- theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
@ -33,7 +32,7 @@ require("lualine").setup({
tabline = 1000,
winbar = 1000,
},
theme = "material-nvim",
theme = "ayu_light",
},
sections = {
lualine_a = { "mode" },

View File

@ -6,8 +6,8 @@ require("toggleterm").setup({
return vim.o.columns * 0.4
end
end,
open_mapping = [[<C-\>]],
insert_mapping = true,
-- open_mapping = [[<C-\>]],
-- insert_mapping = true,
start_in_insert = true,
autochdir = true,
auto_scroll = false, -- automatically scroll to the bottom on terminal output

View File

@ -1,71 +0,0 @@
require("which-key").setup{
plugins = {
marks = true, -- shows a list of your marks on ' and `
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = {
enabled = false, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 20, -- how many suggestions should be shown in the list?
},
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
presets = {
operators = true, -- adds help for operators like d, y, ... and registers them for motion / text object completion
motions = true, -- adds help for motions
text_objects = true, -- help for text objects triggered after entering an operator
windows = true, -- default bindings on <c-w>
nav = true, -- misc bindings to work with windows
z = true, -- bindings for folds, spelling and others prefixed with z
g = true, -- bindings for prefixed with g
},
},
-- add operators that will trigger motion and text object completion
-- to enable all native operators, set the preset / operators plugin above
operators = { gc = "Comments" },
key_labels = {
-- override the label used to display some keys. It doesn't effect WK in any other way.
-- For example:
-- ["<space>"] = "SPC",
-- ["<cr>"] = "RET",
-- ["<tab>"] = "TAB",
},
icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group
},
popup_mappings = {
scroll_down = '<c-d>', -- binding to scroll down inside the popup
scroll_up = '<c-u>', -- binding to scroll up inside the popup
},
window = {
border = "none", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0
},
layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns
align = "left", -- align columns left, center or right
},
ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate
show_help = true, -- show help message on the command line when the popup is visible
triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specify a list manually
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding
-- most people should not need to change this
i = { "j", "k" },
v = { "j", "k" },
},
-- disable the WhichKey popup for certain buf types and file types.
-- Disabled by deafult for Telescope
disable = {
buftypes = {},
filetypes = { "TelescopePrompt" },
},
}

37
lua/plugin.lua Normal file
View File

@ -0,0 +1,37 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--branch=stable",
lazyrepo,
lazypath,
})
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
{ import = "plugins" },
-- -- 插件配置放在这里
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "" } },
-- automatically check for plugin updates
checker = { enabled = false, frequency = 604800 },
})

View File

@ -1,221 +0,0 @@
return require("packer").startup(function()
-- Packer can manage itself
use("wbthomason/packer.nvim")
-- lua 调试
use("rafcamlet/nvim-luapad")
------------------ themes --------------------------
-- use({
-- "navarasu/onedark.nvim",
-- })
use("folke/tokyonight.nvim")
use("sainnhe/everforest")
use("marko-cerovac/material.nvim")
-----------------------------------------------------------------------------------------
-- a good terminal
-- 一个好的nvim内终端
use({ "akinsho/toggleterm.nvim", tag = "*" })
-- make live command
-- 实时命令
use({ "smjonas/live-command.nvim" })
-- lazygit support
-- 使用lazygit接口
use("kdheepak/lazygit.nvim")
----------------- markdown --------------------
-- markdown preview
-- markdown自动预览
use({
"iamcco/markdown-preview.nvim",
})
-- markdown flow and enhance
-- markdown 流程和增强
use({ "jakewvincent/mkdnflow.nvim" })
-- orgmode support
-- orgmode 支持
-- use({ "nvim-orgmode/orgmode" })
-- nvim-tree for file manage
-- use({
-- "kyazdani42/nvim-tree.lua",
-- requires = "kyazdani42/nvim-web-devicons",
-- })
use({
"nvim-neo-tree/neo-tree.nvim",
branch = "v2.x",
requires = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
})
----------------latex------------------
use("lervag/vimtex")
-- vim dashboard
-- vim 开始界面
use({
"glepnir/dashboard-nvim",
requires = { "nvim-tree/nvim-web-devicons" },
})
-- smooth neovim scroll
-- 顺滑的neovim滚动
-- use("karb94/neoscroll.nvim")
-- bufferline on the top
-- 顶部状态栏
use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" })
-- treesitter
use({
"nvim-treesitter/nvim-treesitter",
run = function()
require("nvim-treesitter.install").update({ with_sync = true })
end,
})
--------------------- file related -------------------------------
-- telescope
use({
"nvim-telescope/telescope.nvim",
requires = { { "nvim-lua/plenary.nvim" } },
})
-- telescope-file-browser
use({ "nvim-telescope/telescope-file-browser.nvim" })
-- create new file
-- 快捷创建新文件
use("Mohammed-Taher/AdvancedNewFile.nvim")
-- project
-- 项目管理
use({
"ahmedkhalf/project.nvim",
})
-- whick-key
use({
"folke/which-key.nvim",
})
--------------------- buffer related -----------------
-- indent-blankline
-- 竖向加竖线显示对齐
use({ "lukas-reineke/indent-blankline.nvim" })
-- comment
use({
"numToStr/Comment.nvim",
})
-- hop plugin
-- 快速跳转
use({
"phaazon/hop.nvim",
branch = "v2", -- optional but strongly recommended
})
-- lualine for bottom stausline
-- 底部状态栏
use({
"nvim-lualine/lualine.nvim",
requires = { "nvim-tree/nvim-web-devicons", opt = true },
})
-- notify
-- 弹窗消息通知
use({
"rcarriga/nvim-notify",
})
-- autopairs
-- 自动补全括号
use({
"windwp/nvim-autopairs",
})
-- coderunner
-- 代码运行
use({ "is0n/jaq-nvim" })
-- cmake support
-- cmake 支持
-- use("Civitasv/cmake-tools.nvim")
------------------- lsp --------------------------
-- mason for lsp dap linter and others
use({
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
})
-- null-ls for formatter and others
-- null-ls 用于格式化和其他
use({
"jose-elias-alvarez/null-ls.nvim",
})
-- flutter support
use({
"akinsho/flutter-tools.nvim",
requires = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim", -- optional for vim.ui.select
},
})
-- -- 补全引擎
use("hrsh7th/nvim-cmp")
-- Snippet 引擎
use({ "L3MON4D3/LuaSnip" })
use("hrsh7th/vim-vsnip")
-- 补全源
use("hrsh7th/cmp-vsnip")
use({ "ray-x/lsp_signature.nvim" })
use({ "saadparwaiz1/cmp_luasnip" })
use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp }
use("hrsh7th/cmp-buffer") -- { name = 'buffer' },
use("hrsh7th/cmp-path") -- { name = 'path' }
use("hrsh7th/cmp-omni") -- { name = 'omni' }
use("hrsh7th/cmp-cmdline") -- { name = 'cmdline' }
use("hrsh7th/cmp-nvim-lsp-signature-help") -- { name = 'nvim_lsp_signature_help' }
-- 常见编程语言代码段
use("rafamadriz/friendly-snippets")
-- UI 增强
use("onsails/lspkind-nvim")
-- copilot 增强
-- use("github/copilot.vim")
-- Remove the `use` here if you're using folke/lazy.nvim.
use({
"Exafunction/codeium.vim",
})
------------------- repl ----------------------
use({ "hkupty/iron.nvim" })
------------------- dap -----------------------
-- dap for neovim
-- dap ui和适配器
use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap", "theHamsta/nvim-dap-virtual-text" } })
-- persistent breakpoints
-- 持久化断点
use({ "Weissle/persistent-breakpoints.nvim" })
------------------ gpt -----------------------
-- gpt for coding
-- gpt辅助代码
use("robitx/gp.nvim")
end)

98
lua/plugins/list.lua Normal file
View File

@ -0,0 +1,98 @@
return {
{ "rafcamlet/nvim-luapad" },
{ "echasnovski/mini.nvim", version = false },
{ "sainnhe/everforest" },
{ "marko-cerovac/material.nvim" },
{ "akinsho/toggleterm.nvim", version = "*" },
{ "smjonas/live-command.nvim" },
{ "kdheepak/lazygit.nvim" },
{
"iamcco/markdown-preview.nvim",
build = function()
vim.fn["mkdp#util#install"]()
end,
},
{ "jakewvincent/mkdnflow.nvim" },
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v2.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
},
{ "lervag/vimtex" },
{
"glepnir/dashboard-nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
},
{
"akinsho/bufferline.nvim",
version = "v3.*",
dependencies = "nvim-tree/nvim-web-devicons",
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
{ "nvim-telescope/telescope-file-browser.nvim" },
{ "Mohammed-Taher/AdvancedNewFile.nvim" },
{ "ahmedkhalf/project.nvim" },
{ "folke/which-key.nvim" },
{ "lukas-reineke/indent-blankline.nvim" },
{ "numToStr/Comment.nvim" },
{
"phaazon/hop.nvim",
branch = "v2",
},
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
},
{ "rcarriga/nvim-notify" },
{ "windwp/nvim-autopairs" },
{ "is0n/jaq-nvim" },
{
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
},
{ "jose-elias-alvarez/null-ls.nvim" },
{
"akinsho/flutter-tools.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim",
},
},
{ "hrsh7th/nvim-cmp" },
{ "L3MON4D3/LuaSnip" },
{ "hrsh7th/vim-vsnip" },
{ "hrsh7th/cmp-vsnip" },
{ "ray-x/lsp_signature.nvim" },
{ "saadparwaiz1/cmp_luasnip" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "hrsh7th/cmp-omni" },
{ "hrsh7th/cmp-cmdline" },
{ "hrsh7th/cmp-nvim-lsp-signature-help" },
{ "rafamadriz/friendly-snippets" },
{ "onsails/lspkind-nvim" },
{ "Vigemus/iron.nvim" },
{
"rcarriga/nvim-dap-ui",
dependencies = {
"mfussenegger/nvim-dap",
"theHamsta/nvim-dap-virtual-text",
},
},
{ "nvim-neotest/nvim-nio" },
{ "Weissle/persistent-breakpoints.nvim" },
{ "robitx/gp.nvim" },
}

19
lua/plugins/whichkey.lua Normal file
View File

@ -0,0 +1,19 @@
return {
{
"folke/which-key.nvim",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
},
}