Update to personal config

This commit is contained in:
salomaestro
2024-09-29 01:54:16 +02:00
parent 59f23d053a
commit de44ebf3b9
6 changed files with 172 additions and 3 deletions

View File

@@ -6,7 +6,7 @@
local M = {} local M = {}
M.base46 = { M.base46 = {
theme = "onedark", theme = "bearded-arc",
-- hl_override = { -- hl_override = {
-- Comment = { italic = true }, -- Comment = { italic = true },

View File

@@ -3,6 +3,9 @@ local options = {
lua = { "stylua" }, lua = { "stylua" },
-- css = { "prettier" }, -- css = { "prettier" },
-- html = { "prettier" }, -- html = { "prettier" },
-- python = { "isort", "black" },
python = { "ruff" },
yaml = { "prettier" },
}, },
-- format_on_save = { -- format_on_save = {

View File

@@ -4,7 +4,7 @@ require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig" local lspconfig = require "lspconfig"
-- EXAMPLE -- EXAMPLE
local servers = { "html", "cssls" } local servers = { "html", "cssls", "ruff_lsp", "jedi_language_server", "yls", "lua_ls" }
local nvlsp = require "nvchad.configs.lspconfig" local nvlsp = require "nvchad.configs.lspconfig"
-- lsps with default config -- lsps with default config
@@ -22,3 +22,13 @@ end
-- on_init = nvlsp.on_init, -- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities, -- capabilities = nvlsp.capabilities,
-- } -- }
lspconfig.lua_ls.setup({
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
},
},
})

View File

@@ -3,8 +3,47 @@ require "nvchad.mappings"
-- add yours here -- add yours here
local map = vim.keymap.set local map = vim.keymap.set
local g = vim.g
local diag = vim.diagnostic
map("n", ";", ":", { desc = "CMD enter command mode" }) map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>") map("i", "jk", "<ESC>")
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>") -- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
map("n", "<leader>ca", function()
vim.lsp.buf.code_action()
end, { desc = "LSP code action" })
map("n", "<leader>tt", function()
require("base46").toggle_transparency()
end, { desc = "Toggle transparency" })
map("n", "J", "mzJ`z", { desc = "Concatenate line below cursor but does not move the cursor" })
map("n", "<leader>o", ':<c-u>call append(line("."), repeat([""], v:count1))<cr>', { desc = "Insert line below" })
map("n", "<leader>O", ':<c-u>call append(line(".")-1, repeat([""], v:count1))<cr>', { desc = "Insert line above" })
map("n", "<c-d>", "<c-d>zz")
map("n", "<c-u>", "<c-u>zz")
map("n", "<leader>lg", "<cmd> LazyGit<cr>", { desc = "LazyGit" })
-- Visual mode
map("v", "J", ":m '>+1<cr>gv=gv", { desc = "Move line w/indentation" })
map("v", "K", ":m '<-2<cr>gv=gv", { desc = "Move line w/indentation" })
map("v", ">", ">gv", { desc = "indent" })
map("v", "<", "<gv", { desc = "indent" })
-- Toggle diagnostics
g["diagnostics_active"] = true
function Toggle_diagnostics()
if g.diagnostics_active then
g.diagnostics_active = false
diag.disable()
else
g.diagnostics_active = true
diag.enable()
end
end
map("n", "<leader>lt", Toggle_diagnostics, { noremap = true, silent = true, desc = "Toggle vim diagnostics" })

View File

@@ -2,5 +2,19 @@ require "nvchad.options"
-- add yours here! -- add yours here!
-- local o = vim.o local o = vim.o
local opt = vim.opt
-- o.cursorlineopt ='both' -- to enable cursorline! -- o.cursorlineopt ='both' -- to enable cursorline!
o.scrolloff = 10
opt.relativenumber = true
local highlight_group = vim.api.nvim_create_augroup("yankhighlight", { clear = true })
vim.api.nvim_create_autocmd("textyankpost", {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = "*",
})

View File

@@ -1,8 +1,10 @@
local vim = vim
return { return {
{ {
"stevearc/conform.nvim", "stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save -- event = 'BufWritePre', -- uncomment for format on save
opts = require "configs.conform", opts = require "configs.conform",
event = { "BufReadPre", "BufNewFile" },
}, },
-- These are some examples, uncomment them if you want to see them work! -- These are some examples, uncomment them if you want to see them work!
@@ -13,6 +15,37 @@ return {
end, end,
}, },
{
"mfussenegger/nvim-lint",
lazy = true,
event = { "BufReadPre", "BufNewFile" },
config = function()
local lint = require "lint"
lint.linters_by_ft = {
python = { "ruff" },
yaml = { "yamllint" },
lua = { "selene" },
}
local ns = lint.get_namespace "ruff"
vim.diagnostic.config({ virtual_text = false, underline = false }, ns)
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>ld", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
end,
},
-- { -- {
-- "nvim-treesitter/nvim-treesitter", -- "nvim-treesitter/nvim-treesitter",
-- opts = { -- opts = {
@@ -22,4 +55,74 @@ return {
-- }, -- },
-- }, -- },
-- }, -- },
{
"rktjmp/paperplanes.nvim",
opts = {
provider = "dpaste.org",
},
},
{
"NvChad/nvcommunity",
{ import = "nvcommunity.git.diffview" },
{ import = "nvcommunity.git.lazygit" },
{ import = "nvcommunity.completion.copilot" },
{
"copilot.lua",
-- opts = {
-- ...
-- },
},
},
{
"folke/trouble.nvim",
opts = {}, -- for default options, refer to the configuration section for custom setup.
cmd = "Trouble",
keys = {
{
"<leader>tx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
{
"<leader>tX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)",
},
{
"<leader>cs",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>cl",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)",
},
{
"<leader>tL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)",
},
{
"<leader>tQ",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)",
},
},
},
{
"tpope/vim-surround",
lazy = false,
},
-- Install a plugin
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
} }