-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
143 lines (127 loc) · 3.44 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
vim.g.mapleader = " "
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
local lazy_config = require "configs.lazy"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
},
{ import = "plugins" },
}, lazy_config)
require("codecompanion").setup {
display = {
action_palette = {
provider = "telescope",
opts = {
show_default_actions = true,
show_default_prompt_library = true,
},
},
},
adapters = {
groq = function()
return require("codecompanion.adapters").extend("openai", {
env = {
api_key = "cmd: pass show groq_key",
},
name = "Groq",
url = "https://api.groq.com/openai/v1/chat/completions",
schema = {
model = {
default = "qwen-2.5-coder-32b",
choices = {
"llama-3.3-70b-versatile",
"llama-3.2-90b-text-preview",
"llama-3.2-11b-text-preview",
"mixtral-8x7b-32768",
"llama-3.1-70b-versatile",
"qwen-2.5-coder-32b",
},
},
},
max_tokens = {
default = 4096,
},
temperature = {
default = 1,
},
handlers = {
form_messages = function(self, messages)
for i, msg in ipairs(messages) do
-- Remove 'id' and 'opts' properties from all messages
msg.id = nil
msg.opts = nil
-- Ensure 'name' is a string if present, otherwise remove it
if msg.name then
msg.name = tostring(msg.name)
else
msg.name = nil
end
-- Ensure only supported properties are present
local supported_props = { role = true, content = true, name = true }
for prop in pairs(msg) do
if not supported_props[prop] then
msg[prop] = nil
end
end
end
return { messages = messages }
end,
},
})
end,
},
strategies = {
chat = {
adapter = "groq",
},
inline = { adapter = "groq" },
agent = { adapter = "groq" },
},
}
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "options"
require "nvchad.autocmds"
vim.schedule(function()
require "mappings"
end)
-- conform disable auto format
vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then
vim.b.disable_autoformat = true
else
vim.g.disable_autoformat = true
end
end, {
desc = "disable autoformat-on-save",
bang = true,
})
vim.api.nvim_create_user_command("FormatEnable", function()
vim.b.disable_autoformat = false
vim.g.disable_autoformat = false
end, {
desc = "Re-enable autoformat-on-save",
})
-- oil
require("oil").setup()
-- ssh remote
require("telescope").load_extension "remote-sshfs"
-- require('remote-sshfs').setup{
-- connections = {
-- ssh_configs = {
-- vim.fn.expand "$HOME" .. "/.ssh/config"
-- }
-- }
-- }