Reworked nvim config
This commit is contained in:
@@ -30,7 +30,7 @@ dofile(vim.g.base46_cache .. "defaults")
|
||||
dofile(vim.g.base46_cache .. "statusline")
|
||||
|
||||
require "options"
|
||||
require "nvchad.autocmds"
|
||||
require "autocmds"
|
||||
|
||||
vim.schedule(function()
|
||||
require "mappings"
|
||||
|
||||
47
dot_config/nvim/lua/autocmds.lua
Normal file
47
dot_config/nvim/lua/autocmds.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
require "nvchad.autocmds"
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "java",
|
||||
command = "setlocal shiftwidth=4 tabstop=4",
|
||||
})
|
||||
|
||||
vim.filetype.add {
|
||||
extension = {
|
||||
yml = "yaml.ansible",
|
||||
},
|
||||
}
|
||||
|
||||
-- Nvim Tree
|
||||
local function open_nvim_tree(data)
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
if not directory then
|
||||
return
|
||||
end
|
||||
|
||||
-- change to the directory
|
||||
vim.cmd.cd(data.file)
|
||||
|
||||
-- open the tree
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "QuitPre" }, {
|
||||
callback = function()
|
||||
vim.cmd "NvimTreeClose"
|
||||
end,
|
||||
})
|
||||
|
||||
-- venv
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "*.py",
|
||||
callback = function()
|
||||
local venv = vim.fn.finddir(".venv", vim.fn.getcwd() .. ";")
|
||||
if venv ~= "" then
|
||||
require("venv-selector").retrieve_from_cache()
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -96,9 +96,8 @@ M.ui = {
|
||||
},
|
||||
|
||||
cmp = {
|
||||
style = "atom_colored"
|
||||
}
|
||||
|
||||
style = "atom_colored",
|
||||
},
|
||||
}
|
||||
|
||||
M.nvdash = {
|
||||
@@ -123,7 +122,6 @@ M.nvdash = {
|
||||
|
||||
{ txt = "─", hl = "NvDashFooter", no_gap = true, rep = true },
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
M.term = {
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
if (vim.fn.has('macunix')) then
|
||||
|
||||
return {}
|
||||
|
||||
else
|
||||
|
||||
if (vim.loop.os_uname().sysname == "Linux") then
|
||||
return {
|
||||
ensure_installed = {
|
||||
"lua-language-server",
|
||||
"luacheck",
|
||||
"stylua",
|
||||
|
||||
"codespell",
|
||||
|
||||
@@ -19,6 +15,7 @@ return {
|
||||
"taplo",
|
||||
|
||||
"jdtls",
|
||||
"gradle-language-server",
|
||||
|
||||
"clangd",
|
||||
|
||||
@@ -34,4 +31,9 @@ return {
|
||||
"ansible-lint",
|
||||
},
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
return {}
|
||||
|
||||
end
|
||||
|
||||
@@ -16,17 +16,17 @@ local servers = {
|
||||
"dockerls",
|
||||
"ansiblels",
|
||||
"jsonls",
|
||||
"solidity_ls_nomicfoundation",
|
||||
-- "solidity_ls_nomicfoundation",
|
||||
"eslint",
|
||||
"ts_ls",
|
||||
"gradle_ls",
|
||||
}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
vim.lsp.config(lsp, {
|
||||
for _, name in ipairs(servers) do
|
||||
vim.lsp.config(name, {
|
||||
on_init = on_init,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.lsp.enable(lsp)
|
||||
vim.lsp.enable(name)
|
||||
end
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
local function open_nvim_tree(data)
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
if not directory then
|
||||
return
|
||||
end
|
||||
|
||||
-- change to the directory
|
||||
vim.cmd.cd(data.file)
|
||||
|
||||
-- open the tree
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "QuitPre" }, {
|
||||
callback = function() vim.cmd("NvimTreeClose") end,
|
||||
})
|
||||
|
||||
return {
|
||||
renderer = {
|
||||
|
||||
@@ -43,16 +43,16 @@ map("n", "<leader>lr", "<CMD> lua require 'nvchad.lsp.renamer' ()<CR>", { desc
|
||||
|
||||
-- Diagnostic
|
||||
map("n", "<leader>dd", function()
|
||||
vim.diagnostic.jump({ count = 1, float = false })
|
||||
vim.diagnostic.jump { count = 1, float = false }
|
||||
end, { desc = "LSP next diag" })
|
||||
|
||||
map("n", "<leader>df", function()
|
||||
vim.diagnostic.jump({ count = 1, float = true })
|
||||
vim.diagnostic.jump { count = 1, float = true }
|
||||
end, { desc = "LSP next diag" })
|
||||
|
||||
map("n", "<leader>ds", function()
|
||||
vim.diagnostic.jump({ count = -1, float = true })
|
||||
end, { desc = "LSP next diag" })
|
||||
vim.diagnostic.jump { count = -1, float = true }
|
||||
end, { desc = "LSP prev diag" })
|
||||
|
||||
-- Git
|
||||
map("n", "<leader>gm", "<cmd>Telescope git_commits<CR>", { desc = "telescope git commits" })
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
require "nvchad.options"
|
||||
|
||||
-- add yours here!
|
||||
|
||||
-- local o = vim.o
|
||||
-- o.cursorlineopt ='both' -- to enable cursorline!
|
||||
|
||||
vim.lsp.inlay_hint.enable(true)
|
||||
|
||||
vim.o.foldcolumn = "0" -- '0' is not bad
|
||||
@@ -23,14 +18,3 @@ vim.opt.fillchars = {
|
||||
}
|
||||
|
||||
vim.o.pumheight = 10
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "java",
|
||||
command = "setlocal shiftwidth=4 tabstop=4"
|
||||
})
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
yml = 'yaml.ansible'
|
||||
}
|
||||
})
|
||||
|
||||
@@ -16,5 +16,5 @@ return {
|
||||
},
|
||||
}
|
||||
),
|
||||
}
|
||||
};
|
||||
},
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ return {
|
||||
max_results = 10,
|
||||
min_chars = 3,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ return {
|
||||
package.path = package.path .. ";" .. vim.fn.expand "$HOME" .. "/.luarocks/share/lua/5.1/?.lua"
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
event = { "BufRead *.png", "BufRead *.jpg", "BufRead *.jpeg", "BufRead *.gif", "BufRead *.wepb", "BufRead *.avif" },
|
||||
event = { "BufRead *.png", "BufRead *.jpg", "BufRead *.jpeg", "BufRead *.gif", "BufRead *.webp", "BufRead *.avif" },
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ return {
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = require "configs.lspconfig"
|
||||
opts = require "configs.lspconfig",
|
||||
},
|
||||
{
|
||||
"Pocco81/auto-save.nvim",
|
||||
|
||||
@@ -2,14 +2,13 @@ return {
|
||||
"mfussenegger/nvim-jdtls",
|
||||
ft = { "java" },
|
||||
config = function()
|
||||
local cmd = vim.lsp.config["jdtls"].cmd
|
||||
|
||||
local lombok = vim.fn.stdpath('data') .. '/mason/packages/jdtls/lombok.jar'
|
||||
local cmd = { vim.fn.exepath "jdtls" }
|
||||
local lombok = vim.fn.stdpath "data" .. "/mason/share/jdtls/lombok.jar"
|
||||
|
||||
table.insert(cmd, string.format("--jvm-arg=-javaagent:%s", lombok))
|
||||
local opts = {
|
||||
cmd = cmd,
|
||||
root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }),
|
||||
root_dir = require("jdtls.setup").find_root { ".git", "mvnw", "gradlew" },
|
||||
on_attach = function(client, _)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
lint.linters_by_ft = {
|
||||
solidity = {'solhint'},
|
||||
["*"] = { "codespell" },
|
||||
}
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local lint = require "lint"
|
||||
lint.linters_by_ft = {
|
||||
-- solidity = {'solhint'},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("RunLinter", { clear = true }),
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
lint.try_lint("codespell")
|
||||
end,
|
||||
})
|
||||
end,
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("RunLinter", { clear = true }),
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
lint.try_lint "codespell"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return {
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
lazy = false,
|
||||
opts = require "configs.default-lsp"
|
||||
opts = require "configs.default-lsp",
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ return {
|
||||
opts = {
|
||||
lsp = {
|
||||
progress = {
|
||||
enabled = false
|
||||
enabled = false,
|
||||
},
|
||||
signature = {
|
||||
enabled = false
|
||||
enabled = false,
|
||||
},
|
||||
hover = {
|
||||
enabled = false
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
@@ -21,5 +21,5 @@ return {
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ return {
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("telescope").load_extension "projects"
|
||||
require("project_nvim").setup {
|
||||
}
|
||||
require("project_nvim").setup {}
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
"nvim-telescope/telescope.nvim",
|
||||
opts = {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
"--hidden","--glob",
|
||||
"!**/.git/*"
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
"--hidden",
|
||||
"--glob",
|
||||
"!**/.git/*",
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
|
||||
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
|
||||
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,21 +1,10 @@
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
pattern = '*.py',
|
||||
callback = function()
|
||||
local venv = vim.fn.finddir('.venv', vim.fn.getcwd() .. ';')
|
||||
if venv ~= '' then
|
||||
require('venv-selector').retrieve_from_cache()
|
||||
end
|
||||
end,
|
||||
once = true,
|
||||
})
|
||||
|
||||
return {
|
||||
'linux-cultist/venv-selector.nvim',
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
opts = {
|
||||
name = ".venv",
|
||||
},
|
||||
event = 'VeryLazy',
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{ '<leader>vs', '<cmd>VenvSelect<cr>' },
|
||||
{ "<leader>vs", "<cmd>VenvSelect<cr>" },
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user