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,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" },
},
}