mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 00:29:43 -04:00
nvim config changes
This commit is contained in:
parent
e1ae3a9363
commit
9fe0dece82
2 changed files with 52 additions and 133 deletions
|
|
@ -2,52 +2,15 @@
|
||||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||||
-- Add any additional autocmds here
|
-- Add any additional autocmds here
|
||||||
|
|
||||||
require("which-key").register({
|
require("which-key").add({
|
||||||
w = {
|
{ "<leader>wd", "<cmd>bd<CR> | close<CR>", mode = "n", desc = "Delete window & buffer" },
|
||||||
d = {
|
{ "<leader>wD", "<cmd>close<CR>", mode = "n", desc = "Delete window" },
|
||||||
"<cmd>bd<CR> | close<CR>",
|
{ "<leader>t", "<cmd>:new | setlocal nonumber norelativenumber | resize 10 | terminal<CR>", mode = "n", desc = "Open Terminal" }
|
||||||
"Delete window and buffer"
|
|
||||||
},
|
|
||||||
D = {
|
|
||||||
"<cmd>close<CR>",
|
|
||||||
"Delete window only",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
t = {
|
|
||||||
"<cmd>:new | setlocal nonumber norelativenumber | resize 10 | set winfixheight | terminal<CR>",
|
|
||||||
"Open Terminal",
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
prefix = "<leader>",
|
|
||||||
})
|
|
||||||
|
|
||||||
require("notify").setup({
|
|
||||||
background_colour = "#000000",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local lsp = require("lsp-zero").preset({})
|
local lsp = require("lsp-zero").preset({})
|
||||||
|
local cmp_nvim_lsp = require "cmp_nvim_lsp"
|
||||||
--require("null-ls").setup({
|
local cmp = require("cmp")
|
||||||
-- -- you can reuse a shared lspconfig on_attach callback here
|
|
||||||
-- on_attach = function(client, bufnr)
|
|
||||||
-- if client.supports_method("textDocument/formatting") then
|
|
||||||
-- vim.api.nvim_clear_autocmds({ group = vim.api.nvim_create_augroup("LspFormatting", {}), buffer = bufnr })
|
|
||||||
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
-- group = augroup,
|
|
||||||
-- buffer = bufnr,
|
|
||||||
-- callback = function()
|
|
||||||
-- vim.lsp.buf.format({
|
|
||||||
-- bufnr = bufnr,
|
|
||||||
-- filter = function(client)
|
|
||||||
-- return client.name == "null-ls"
|
|
||||||
-- end,
|
|
||||||
-- })
|
|
||||||
-- vim.lsp.buf.formatting_sync()
|
|
||||||
-- end,
|
|
||||||
-- })
|
|
||||||
-- end
|
|
||||||
-- end,
|
|
||||||
--})
|
|
||||||
|
|
||||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
lsp.setup_servers({
|
lsp.setup_servers({
|
||||||
|
|
@ -65,48 +28,16 @@ lsp.setup_servers({
|
||||||
"vuels"
|
"vuels"
|
||||||
--"arduino-language-server"
|
--"arduino-language-server"
|
||||||
})
|
})
|
||||||
|
|
||||||
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls())
|
|
||||||
|
|
||||||
lsp.setup()
|
lsp.setup()
|
||||||
|
|
||||||
local cmp_nvim_lsp = require "cmp_nvim_lsp"
|
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls())
|
||||||
|
require("lspconfig").clangd.setup {
|
||||||
--require("lspconfig").clangd.setup {
|
capabilities = cmp_nvim_lsp.default_capabilities(),
|
||||||
-- capabilities = cmp_nvim_lsp.default_capabilities(),
|
cmd = {
|
||||||
-- cmd = {
|
"clangd",
|
||||||
-- "clangd",
|
"--offset-encoding=utf-16",
|
||||||
-- "--offset-encoding=utf-16",
|
|
||||||
-- },
|
|
||||||
--}
|
|
||||||
|
|
||||||
require("lspconfig").cssls.setup {
|
|
||||||
settings = {
|
|
||||||
css = {
|
|
||||||
validate = true,
|
|
||||||
lint = {
|
|
||||||
unknownAtRules = "ignore"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scss = {
|
|
||||||
validate = true,
|
|
||||||
lint = {
|
|
||||||
unknownAtRules = "ignore"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
less = {
|
|
||||||
validate = true,
|
|
||||||
lint = {
|
|
||||||
unknownAtRules = "ignore"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
--require("lspconfig").volar.setup({
|
|
||||||
-- filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
|
|
||||||
--})
|
|
||||||
|
|
||||||
require("lspconfig").nil_ls.setup {
|
require("lspconfig").nil_ls.setup {
|
||||||
settings = {
|
settings = {
|
||||||
["nil"] = {
|
["nil"] = {
|
||||||
|
|
@ -119,8 +50,17 @@ require("lspconfig").nil_ls.setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local cmp = require("cmp")
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
|
enabled = function()
|
||||||
|
-- disable completion in comments
|
||||||
|
local context = require("cmp.config.context")
|
||||||
|
-- keep command mode completion enabled when cursor is in a comment
|
||||||
|
if vim.api.nvim_get_mode().mode == "c" then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("comment")
|
||||||
|
end
|
||||||
|
end,
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
require("luasnip").lsp_expand(args.body)
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
|
@ -137,37 +77,14 @@ cmp.setup({
|
||||||
return vim_item
|
return vim_item
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- other configurations...
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
enabled = function()
|
|
||||||
-- disable completion in comments
|
|
||||||
local context = require("cmp.config.context")
|
|
||||||
-- keep command mode completion enabled when cursor is in a comment
|
|
||||||
if vim.api.nvim_get_mode().mode == "c" then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("comment")
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
mapping = {
|
mapping = {
|
||||||
["<Down>"] = cmp.mapping.select_next_item(),
|
-- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings
|
||||||
["<Up>"] = cmp.mapping.select_prev_item(),
|
["<C-p>"] = cmp.mapping.select_next_item(),
|
||||||
["<C-p>"] = cmp.mapping.scroll_docs(-4),
|
["<C-n>"] = cmp.mapping.select_prev_item(),
|
||||||
["<C-n>"] = cmp.mapping.scroll_docs(4),
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
--["<Tab>"] = cmp.mapping(function(fallback)
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
-- if cmp.visible() then
|
["<C-y>"] = cmp.mapping.confirm(),
|
||||||
-- cmp.select_next_item()
|
|
||||||
-- elseif cmp.completed then
|
|
||||||
-- cmp.confirm({ select = true })
|
|
||||||
-- else
|
|
||||||
-- fallback()
|
|
||||||
-- end
|
|
||||||
--end, { "i", "s" }),
|
|
||||||
--["<S-Tab>"] = cmp.mapping.select_prev_item(),
|
|
||||||
|
|
||||||
["<CR>"] = cmp.mapping(function(fallback)
|
["<CR>"] = cmp.mapping(function(fallback)
|
||||||
fallback()
|
fallback()
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
|
|
|
||||||
|
|
@ -45,23 +45,6 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
--[[
|
|
||||||
{
|
|
||||||
"jackMort/ChatGPT.nvim",
|
|
||||||
event = "VeryLazy",
|
|
||||||
config = function()
|
|
||||||
require("chatgpt").setup({
|
|
||||||
api_key_cmd = "pass show api/chatgpt-apikey",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
dependencies = {
|
|
||||||
"MunifTanjim/nui.nvim",
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]]
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
config = function()
|
config = function()
|
||||||
|
|
@ -94,10 +77,29 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ "NoahTheDuke/vim-just", ft = { "just" }, },
|
||||||
"NoahTheDuke/vim-just",
|
{ "L3MON4D3/LuaSnip",
|
||||||
ft = { "just" },
|
version = "v2.*",
|
||||||
|
build = "make install_jsregexp",
|
||||||
|
--dependencies = { "rafamadriz/friendly-snippets" },
|
||||||
},
|
},
|
||||||
|
--{ "rafamadriz/friendly-snippets" },
|
||||||
|
--[[
|
||||||
|
{
|
||||||
|
"jackMort/ChatGPT.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
require("chatgpt").setup({
|
||||||
|
api_key_cmd = "pass show api/chatgpt-apikey",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
dependencies = {
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
--]]
|
||||||
|
|
||||||
{ "williamboman/mason.nvim", enabled = false },
|
{ "williamboman/mason.nvim", enabled = false },
|
||||||
{ "williamboman/mason-lspconfig.nvim", enabled = false },
|
{ "williamboman/mason-lspconfig.nvim", enabled = false },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue