Skip to content

Commit dc228a0

Browse files
committed
chore: save config
1 parent 1b26f91 commit dc228a0

File tree

16 files changed

+779
-91
lines changed

16 files changed

+779
-91
lines changed

init.lua

Lines changed: 82 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ P.S. You can delete this when you're done too. It's your config now :)
4242
vim.g.mapleader = ' '
4343
vim.g.maplocalleader = ' '
4444

45+
vim.opt.textwidth = 80
4546
-- Install package manager
4647
-- https://github.com/folke/lazy.nvim
4748
-- `:help lazy.nvim.txt` for more info
@@ -218,6 +219,10 @@ vim.o.smartcase = true
218219
-- Keep signcolumn on by default
219220
vim.wo.signcolumn = 'yes'
220221

222+
-- Cursor UI
223+
vim.opt.cursorline = true
224+
-- vim.opt.guicursor = "i:block-blinkwait1000-blinkon500-blinkoff500";
225+
221226
-- Decrease update time
222227
vim.o.updatetime = 100
223228
vim.o.timeoutlen = 100
@@ -229,7 +234,6 @@ vim.o.completeopt = 'menuone,noselect'
229234
-- NOTE: You should make sure your terminal supports this
230235
vim.o.termguicolors = true
231236

232-
233237
-- [[ Basic Keymaps ]]
234238

235239
-- Keymaps for better default experience
@@ -240,6 +244,7 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
240244
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
241245
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
242246

247+
243248
-- [[ Highlight on yank ]]
244249
-- See `:help vim.highlight.on_yank()`
245250
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
@@ -269,8 +274,8 @@ vim.filetype.add({
269274
-- See `:help nvim-treesitter`
270275
require('nvim-treesitter.configs').setup {
271276
-- Add languages to be installed here that you want installed for treesitter
272-
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
273-
'dart', 'prisma', 'graphql', 'json', 'markdown' },
277+
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'ruby',
278+
'dart', 'prisma', 'graphql', 'json', 'markdown', 'kotlin', 'terraform' },
274279

275280
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
276281
auto_install = false,
@@ -335,6 +340,10 @@ require('nvim-treesitter.configs').setup {
335340

336341
vim.api.nvim_set_keymap('i', 'kj', '<ESC>', { noremap = true })
337342

343+
-- Git
344+
vim.keymap.set('n', '<leader>Go', '<Cmd>GitConflictChooseOurs<CR>', { desc = '[G]it Conflict Choose [o]urs' })
345+
vim.keymap.set('n', '<leader>Gt', '<Cmd>GitConflictChooseTheirs<CR>', { desc = '[G]it Conflict Choose [t]heirs' })
346+
338347
-- Diagnostic keymaps
339348
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
340349
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
@@ -353,7 +362,7 @@ vim.keymap.set("n", "<leader>vs", "<Cmd>vs<CR>", { desc = "[V]ertical [S]plit" }
353362
vim.keymap.set("n", "<leader>s", '<Cmd>w<CR>', { desc = "[S]ave file" })
354363

355364
-- Quit from terminal
356-
vim.api.nvim_set_keymap('t', '<Leader><ESC>', '<C-\\><C-n>', { noremap = true })
365+
-- vim.api.nvim_set_keymap('t', '<Leader><ESC>', '<C-\\><C-n>', { noremap = true })
357366
-- This function gets run when an LSP connects to a particular buffer.
358367
local on_attach = function(_, bufnr)
359368
-- NOTE: Remember that lua is a real programming language, and as such it is possible
@@ -371,7 +380,7 @@ local on_attach = function(_, bufnr)
371380
end
372381

373382
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
374-
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
383+
nmap('<leader>c', vim.lsp.buf.code_action, '[C]ode [A]ction')
375384

376385
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
377386
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
@@ -411,10 +420,12 @@ local servers = {
411420
-- gopls = {},
412421
-- pyright = {},
413422
-- rust_analyzer = {}
414-
tsserver = {},
423+
ts_ls = {},
415424
prismals = {},
416425
graphql = {},
417426
clangd = {},
427+
terraformls = {},
428+
kotlin_language_server = {},
418429
-- prettierd = {},
419430
-- html = { filetypes = { 'html', 'twig', 'hbs'} }
420431
lua_ls = {
@@ -471,23 +482,77 @@ vim.api.nvim_create_autocmd('LspAttach', {
471482
})
472483

473484
-- Ensure the servers above are installed
474-
local mason_lspconfig = require 'mason-lspconfig'
485+
local mason_lspconfig = require('mason-lspconfig')
475486
local lspconfig = require('lspconfig')
476487

477488
mason_lspconfig.setup {
478489
ensure_installed = vim.tbl_keys(servers),
490+
automatic_enable = false
479491
}
480492

481-
mason_lspconfig.setup_handlers {
482-
function(server_name)
483-
lspconfig[server_name].setup {
484-
capabilities = capabilities,
485-
on_attach = on_attach,
486-
settings = servers[server_name],
487-
filetypes = (servers[server_name] or {}).filetypes,
488-
}
489-
end
490-
}
493+
-- mason_lspconfig.setup_handlers {
494+
-- function(server_name)
495+
-- lspconfig[server_name].setup {
496+
-- capabilities = capabilities,
497+
-- on_attach = on_attach,
498+
-- settings = servers[server_name],
499+
-- filetypes = (servers[server_name] or {}).filetypes,
500+
-- automatic_enable = false
501+
-- }
502+
-- end
503+
-- }
504+
505+
lspconfig.gopls.setup({
506+
on_attach = on_attach,
507+
capabilities = capabilities,
508+
settings = {
509+
gopls = {
510+
["ui.inlayhint.hints"] = {
511+
compositeLiteralFields = true,
512+
constantValues = true,
513+
parameterNames = true,
514+
},
515+
},
516+
},
517+
})
518+
519+
lspconfig.lua_ls.setup({
520+
capabilities = capabilities,
521+
on_attach = on_attach,
522+
settings = {
523+
Lua = {
524+
telemetry = {
525+
enable = false,
526+
},
527+
},
528+
},
529+
on_init = function(client)
530+
if client.workspace_folders then
531+
local path = client.workspace_folders[1].name
532+
if
533+
path ~= vim.fn.stdpath("config")
534+
and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc"))
535+
then
536+
return
537+
end
538+
end
539+
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
540+
runtime = {
541+
version = "LuaJIT",
542+
},
543+
workspace = {
544+
checkThirdParty = false,
545+
library = {
546+
vim.env.VIMRUNTIME,
547+
"${3rd}/luv/library",
548+
},
549+
},
550+
})
551+
end,
552+
})
553+
554+
require("mason").setup()
555+
require("mason-lspconfig").setup()
491556

492557
capabilities.textDocument.completion.completionItem.snippetSupport = true
493558
-- lspconfig.dartls.setup({

lua/custom/plugins/avante.lua.skip

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
return {
2+
"yetone/avante.nvim",
3+
event = "VeryLazy",
4+
lazy = false,
5+
version = false, -- set this if you want to always pull the latest change
6+
opts = {
7+
-- add any opts here
8+
},
9+
config = function()
10+
require('avante').setup({
11+
-- provider = "ollama",
12+
-- vendors = {
13+
-- ollama = {
14+
-- __inherited_from = "openai",
15+
-- api_key_name = "",
16+
-- endpoint = "http://127.0.0.1:11434/v1",
17+
-- model = "mistral",
18+
-- },
19+
-- },
20+
provider = "claude", -- Recommend using Claude
21+
auto_suggestions_provider = "claude", -- Since auto-suggestions are a high-frequency operation and therefore expensive, it is recommended to specify an inexpensive provider or even a free provider: copilot
22+
claude = {
23+
endpoint = "https://api.anthropic.com",
24+
model = "claude-3-5-sonnet-20241022",
25+
temperature = 0,
26+
max_tokens = 4096,
27+
},
28+
-- claude = {
29+
-- endpoint = "https://api.anthropic.com",
30+
-- model = "claude-3-5-sonnet-20241022",
31+
-- temperature = 0,
32+
-- max_tokens = 4096,
33+
-- },
34+
---Specify the special dual_boost mode
35+
---1. enabled: Whether to enable dual_boost mode. Default to false.
36+
---2. first_provider: The first provider to generate response. Default to "openai".
37+
---3. second_provider: The second provider to generate response. Default to "claude".
38+
---4. prompt: The prompt to generate response based on the two reference outputs.
39+
---5. timeout: Timeout in milliseconds. Default to 60000.
40+
---How it works:
41+
--- When dual_boost is enabled, avante will generate two responses from the first_provider and second_provider respectively. Then use the response from the first_provider as provider1_output and the response from the second_provider as provider2_output. Finally, avante will generate a response based on the prompt and the two reference outputs, with the default Provider as normal.
42+
---Note: This is an experimental feature and may not work as expected.
43+
dual_boost = {
44+
enabled = false,
45+
first_provider = "openai",
46+
second_provider = "claude",
47+
prompt =
48+
"Based on the two reference outputs below, generate a response that incorporates elements from both but reflects your own judgment and unique perspective. Do not provide any explanation, just give the response directly. Reference Output 1: [{{provider1_output}}], Reference Output 2: [{{provider2_output}}]",
49+
timeout = 60000, -- Timeout in milliseconds
50+
},
51+
behaviour = {
52+
auto_suggestions = true, -- Experimental stage
53+
auto_set_highlight_group = true,
54+
auto_set_keymaps = true,
55+
auto_apply_diff_after_generation = false,
56+
support_paste_from_clipboard = false,
57+
minimize_diff = true, -- Whether to remove unchanged lines when applying a code block
58+
},
59+
mappings = {
60+
diff = {
61+
ours = "co",
62+
theirs = "ct",
63+
all_theirs = "ca",
64+
both = "cb",
65+
cursor = "cc",
66+
next = "]x",
67+
prev = "[x",
68+
},
69+
suggestion = {
70+
accept = "<M-l>",
71+
next = "<M-]>",
72+
prev = "<M-[>",
73+
dismiss = "<C-]>",
74+
},
75+
jump = {
76+
next = "]]",
77+
prev = "[[",
78+
},
79+
submit = {
80+
normal = "<CR>",
81+
insert = "<C-s>",
82+
},
83+
sidebar = {
84+
apply_all = "A",
85+
apply_cursor = "a",
86+
switch_windows = "<Tab>",
87+
reverse_switch_windows = "<S-Tab>",
88+
},
89+
},
90+
hints = { enabled = true },
91+
windows = {
92+
---@type "right" | "left" | "top" | "bottom"
93+
position = "right", -- the position of the sidebar
94+
wrap = true, -- similar to vim.o.wrap
95+
width = 30, -- default % based on available width
96+
sidebar_header = {
97+
enabled = true, -- true, false to enable/disable the header
98+
align = "center", -- left, center, right for title
99+
rounded = true,
100+
},
101+
input = {
102+
prefix = "> ",
103+
height = 8, -- Height of the input window in vertical layout
104+
},
105+
edit = {
106+
border = "rounded",
107+
start_insert = true, -- Start insert mode when opening the edit window
108+
},
109+
ask = {
110+
floating = false, -- Open the 'AvanteAsk' prompt in a floating window
111+
start_insert = true, -- Start insert mode when opening the ask window
112+
border = "rounded",
113+
focus_on_apply = "ours", -- which diff to focus after applying
114+
},
115+
},
116+
highlights = {
117+
diff = {
118+
current = "DiffText",
119+
incoming = "DiffAdd",
120+
},
121+
},
122+
diff = {
123+
autojump = true,
124+
list_opener = "copen",
125+
--- Override the 'timeoutlen' setting while hovering over a diff (see :help timeoutlen).
126+
--- Helps to avoid entering operator-pending mode with diff mappings starting with `c`.
127+
--- Disable by setting to -1.
128+
override_timeoutlen = 500,
129+
},
130+
})
131+
end,
132+
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
133+
build = "make",
134+
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
135+
dependencies = {
136+
"stevearc/dressing.nvim",
137+
"nvim-lua/plenary.nvim",
138+
"MunifTanjim/nui.nvim",
139+
--- The below dependencies are optional,
140+
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
141+
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
142+
"zbirenbaum/copilot.lua", -- for providers='copilot'
143+
{
144+
-- support for image pasting
145+
"HakonHarnes/img-clip.nvim",
146+
event = "VeryLazy",
147+
opts = {
148+
-- recommended settings
149+
default = {
150+
embed_image_as_base64 = false,
151+
prompt_for_file_name = false,
152+
drag_and_drop = {
153+
insert_mode = true,
154+
},
155+
-- required for Windows users
156+
use_absolute_path = true,
157+
},
158+
},
159+
},
160+
{
161+
-- Make sure to set this up properly if you have lazy=true
162+
'MeanderingProgrammer/render-markdown.nvim',
163+
opts = {
164+
file_types = { "markdown", "Avante" },
165+
},
166+
ft = { "markdown", "Avante" },
167+
},
168+
},
169+
}

lua/custom/plugins/codesnap.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
return {
2+
"mistricky/codesnap.nvim",
3+
build = "make",
4+
config = function()
5+
require("codesnap").setup({
6+
save_path = "~/Pictures",
7+
watermark = "",
8+
})
9+
end,
10+
11+
}

0 commit comments

Comments
 (0)