save
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
require("vxclutch.set")
|
||||
require("vxclutch.remap")
|
||||
require("vxclutch.lazy_init")
|
||||
|
||||
vim.cmd.colorscheme("coolurs")
|
||||
|
||||
33
nvim/.config/nvim/lua/vxclutch/lazy/colors.lua
Normal file
33
nvim/.config/nvim/lua/vxclutch/lazy/colors.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
function ColorMyPencils(color)
|
||||
color = color or "rose-pine"
|
||||
vim.cmd.colorscheme(color)
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
config = function()
|
||||
require("tokyonight").setup({
|
||||
style = "storm",
|
||||
transparent = true,
|
||||
terminal_colors = true,
|
||||
styles = {
|
||||
comments = { italic = false },
|
||||
keywords = { italic = false },
|
||||
sidebars = "dark",
|
||||
floats = "dark",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
config = function()
|
||||
require("rose-pine").setup({ disable_background = true })
|
||||
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
ColorMyPencils()
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -2,23 +2,40 @@ return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
{ "mason-org/mason.nvim", version = "^1.0.0" },
|
||||
{ "mason-org/mason-lspconfig.nvim", version = "^1.0.0" },
|
||||
"j-hui/fidget.nvim",
|
||||
"stevearc/conform.nvim",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"jcha0713/cmp-tw2css",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
|
||||
config = function()
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
float = { border = "rounded" },
|
||||
})
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local cmp_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
cmp_lsp.default_capabilities()
|
||||
)
|
||||
|
||||
vim.api.nvim_set_hl(0, "CmpNormal", {})
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
@@ -26,12 +43,32 @@ return {
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-e>"] = vim.NIL,
|
||||
}),
|
||||
window = {
|
||||
completion = {
|
||||
scrollbar = false,
|
||||
border = "rounded",
|
||||
winhighlight = "Normal:CmpNormal",
|
||||
},
|
||||
documentation = {
|
||||
scrollbar = false,
|
||||
border = "rounded",
|
||||
winhighlight = "Normal:CmpNormal",
|
||||
},
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{
|
||||
name = "nvim_lsp",
|
||||
max_item_count = 5,
|
||||
entry_filter = function(entry, _)
|
||||
return cmp.lsp.CompletionItemKind.Snippet ~= entry:get_kind()
|
||||
end,
|
||||
},
|
||||
{ name = "cmp-tw2css" },
|
||||
{ name = "luasnip" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
@@ -47,10 +84,13 @@ return {
|
||||
require("mason").setup()
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = false,
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"clangd",
|
||||
"gopls",
|
||||
"rust_analyzer",
|
||||
"tinymist",
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
@@ -79,15 +119,55 @@ return {
|
||||
cmd = { "clangd", "--header-insertion=iwyu" },
|
||||
})
|
||||
end,
|
||||
|
||||
["svelte"] = function()
|
||||
require("lspconfig").svelte.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = { "*.js", "*.ts" },
|
||||
callback = function(ctx)
|
||||
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
|
||||
["tinymist"] = function()
|
||||
require("lspconfig").tinymist.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
formatterMode = "typstyle",
|
||||
exportPdf = "never",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
local l = vim.lsp
|
||||
l.handlers["textDocument/hover"] = function(_, result, ctx, config)
|
||||
config = config or { border = "rounded", focusable = true }
|
||||
config.focus_id = ctx.method
|
||||
if not (result and result.contents) then return end
|
||||
local markdown_lines = l.util.convert_input_to_markdown_lines(result.contents)
|
||||
markdown_lines = vim.tbl_filter(function(line) return line ~= "" end, markdown_lines)
|
||||
if vim.tbl_isempty(markdown_lines) then return end
|
||||
return l.util.open_floating_preview(markdown_lines, "markdown", config)
|
||||
end
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*.vert", "*.frag" },
|
||||
callback = function() vim.cmd("set filetype=glsl") end,
|
||||
})
|
||||
|
||||
autocmd("LspAttach", {
|
||||
callback = function(e)
|
||||
local opts = { buffer = e.buf }
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
@@ -11,12 +11,11 @@ end
|
||||
-- Remove search highlight --
|
||||
map("n", "<Esc>", ":nohlsearch<CR>")
|
||||
|
||||
-- Quickfix
|
||||
map("n", "<leader>h", vim.lsp.buf.code_action)
|
||||
|
||||
-- Move lines --
|
||||
map("v", "J", ":m '>+1<CR>gv=gv")
|
||||
map("v", "K", ":m '>-2<CR>gv=gv")
|
||||
map("n", "<A-j>", ":m .+1<CR>==")
|
||||
map("n", "<A-k>", ":m .-2<CR>==")
|
||||
map("v", "<A-j>", ":m '>+1<CR>gv=gv")
|
||||
map("v", "<A-k>", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Scrolling --
|
||||
map("n", "<C-d>", "<C-d>zz")
|
||||
@@ -25,29 +24,9 @@ map("n", "<C-u>", "<C-u>zz")
|
||||
-- File navigation --
|
||||
map("n", "<leader>pv", ":Oil<CR>")
|
||||
|
||||
-- Terminal --
|
||||
map("t", "<C-k>", "<C-\\><C-n><C-w><C-k>")
|
||||
map("t", "<C-Space>", "<C-\\><C-n>:bd!<CR>")
|
||||
|
||||
-- Exec
|
||||
map("n", "<leader>x", ":.lua<CR>")
|
||||
map("n", "<leader><leader>x", ":source %<CR>")
|
||||
|
||||
-- LSP
|
||||
map("n", "gd", vim.lsp.buf.definition)
|
||||
map("n", "<leader>rn", vim.lsp.buf.rename, { noremap = true, silent = true })
|
||||
map('n', '<leader>h', function()
|
||||
local diag = vim.diagnostic.get(0) -- Get diagnostics for the current buffer
|
||||
if #diag > 0 then
|
||||
-- Try to resolve the first diagnostic (you can adjust logic for more advanced fixing)
|
||||
vim.lsp.buf.code_action({
|
||||
filter = function(action)
|
||||
return action.kind == "quickfix"
|
||||
end
|
||||
})
|
||||
end
|
||||
end, { desc = "LSP Quickfix for Current Diagnostic" })
|
||||
|
||||
|
||||
-- Window Controls
|
||||
map("n", "<C-h>", "<C-w><C-h>")
|
||||
|
||||
Reference in New Issue
Block a user