diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index 0fda20c..e861b68 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -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" diff --git a/dot_config/nvim/lua/autocmds.lua b/dot_config/nvim/lua/autocmds.lua new file mode 100644 index 0000000..6280b0f --- /dev/null +++ b/dot_config/nvim/lua/autocmds.lua @@ -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, +}) diff --git a/dot_config/nvim/lua/chadrc.lua b/dot_config/nvim/lua/chadrc.lua index ea6e980..67ee35e 100644 --- a/dot_config/nvim/lua/chadrc.lua +++ b/dot_config/nvim/lua/chadrc.lua @@ -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 = { diff --git a/dot_config/nvim/lua/configs/default-lsp.lua b/dot_config/nvim/lua/configs/default-lsp.lua index 14bf42f..d4e3bc2 100644 --- a/dot_config/nvim/lua/configs/default-lsp.lua +++ b/dot_config/nvim/lua/configs/default-lsp.lua @@ -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 diff --git a/dot_config/nvim/lua/configs/lspconfig.lua b/dot_config/nvim/lua/configs/lspconfig.lua index f7e6c83..90cdf41 100644 --- a/dot_config/nvim/lua/configs/lspconfig.lua +++ b/dot_config/nvim/lua/configs/lspconfig.lua @@ -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 diff --git a/dot_config/nvim/lua/configs/nvim-tree.lua b/dot_config/nvim/lua/configs/nvim-tree.lua index 9bd083e..169186a 100644 --- a/dot_config/nvim/lua/configs/nvim-tree.lua +++ b/dot_config/nvim/lua/configs/nvim-tree.lua @@ -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 = { diff --git a/dot_config/nvim/lua/mappings.lua b/dot_config/nvim/lua/mappings.lua index bcb9c7e..41c08aa 100644 --- a/dot_config/nvim/lua/mappings.lua +++ b/dot_config/nvim/lua/mappings.lua @@ -43,16 +43,16 @@ map("n", "lr", " lua require 'nvchad.lsp.renamer' ()", { desc -- Diagnostic map("n", "dd", function() - vim.diagnostic.jump({ count = 1, float = false }) + vim.diagnostic.jump { count = 1, float = false } end, { desc = "LSP next diag" }) map("n", "df", function() - vim.diagnostic.jump({ count = 1, float = true }) + vim.diagnostic.jump { count = 1, float = true } end, { desc = "LSP next diag" }) map("n", "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", "gm", "Telescope git_commits", { desc = "telescope git commits" }) diff --git a/dot_config/nvim/lua/options.lua b/dot_config/nvim/lua/options.lua index ebf05ae..f4c56a5 100644 --- a/dot_config/nvim/lua/options.lua +++ b/dot_config/nvim/lua/options.lua @@ -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' - } -}) diff --git a/dot_config/nvim/lua/plugins/action-preview.lua b/dot_config/nvim/lua/plugins/action-preview.lua index 95e2764..592917d 100644 --- a/dot_config/nvim/lua/plugins/action-preview.lua +++ b/dot_config/nvim/lua/plugins/action-preview.lua @@ -16,5 +16,5 @@ return { }, } ), - } -}; + }, +} diff --git a/dot_config/nvim/lua/plugins/crates.lua b/dot_config/nvim/lua/plugins/crates.lua index 4ff9a02..02f0a70 100644 --- a/dot_config/nvim/lua/plugins/crates.lua +++ b/dot_config/nvim/lua/plugins/crates.lua @@ -14,6 +14,6 @@ return { max_results = 10, min_chars = 3, }, - } - } + }, + }, } diff --git a/dot_config/nvim/lua/plugins/image.lua b/dot_config/nvim/lua/plugins/image.lua index f55924d..93303e8 100644 --- a/dot_config/nvim/lua/plugins/image.lua +++ b/dot_config/nvim/lua/plugins/image.lua @@ -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" }, } diff --git a/dot_config/nvim/lua/plugins/init.lua b/dot_config/nvim/lua/plugins/init.lua index a8b7a69..0bb53fd 100644 --- a/dot_config/nvim/lua/plugins/init.lua +++ b/dot_config/nvim/lua/plugins/init.lua @@ -5,7 +5,7 @@ return { }, { "neovim/nvim-lspconfig", - opts = require "configs.lspconfig" + opts = require "configs.lspconfig", }, { "Pocco81/auto-save.nvim", diff --git a/dot_config/nvim/lua/plugins/jdtls.lua b/dot_config/nvim/lua/plugins/jdtls.lua index 89516f0..bca461c 100644 --- a/dot_config/nvim/lua/plugins/jdtls.lua +++ b/dot_config/nvim/lua/plugins/jdtls.lua @@ -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, diff --git a/dot_config/nvim/lua/plugins/lint.lua b/dot_config/nvim/lua/plugins/lint.lua index 85abf0b..7cbfcf3 100644 --- a/dot_config/nvim/lua/plugins/lint.lua +++ b/dot_config/nvim/lua/plugins/lint.lua @@ -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, } - diff --git a/dot_config/nvim/lua/plugins/mason-tool-installer.lua b/dot_config/nvim/lua/plugins/mason-tool-installer.lua index 2fab400..ddfc765 100644 --- a/dot_config/nvim/lua/plugins/mason-tool-installer.lua +++ b/dot_config/nvim/lua/plugins/mason-tool-installer.lua @@ -1,5 +1,5 @@ return { "WhoIsSethDaniel/mason-tool-installer.nvim", lazy = false, - opts = require "configs.default-lsp" + opts = require "configs.default-lsp", } diff --git a/dot_config/nvim/lua/plugins/noice.lua b/dot_config/nvim/lua/plugins/noice.lua index c0ab08a..2f33346 100644 --- a/dot_config/nvim/lua/plugins/noice.lua +++ b/dot_config/nvim/lua/plugins/noice.lua @@ -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", - } + }, } diff --git a/dot_config/nvim/lua/plugins/project.lua b/dot_config/nvim/lua/plugins/project.lua index 934d11a..9e60a7c 100644 --- a/dot_config/nvim/lua/plugins/project.lua +++ b/dot_config/nvim/lua/plugins/project.lua @@ -3,7 +3,6 @@ return { lazy = false, config = function() require("telescope").load_extension "projects" - require("project_nvim").setup { - } + require("project_nvim").setup {} end, } diff --git a/dot_config/nvim/lua/plugins/telescope.lua b/dot_config/nvim/lua/plugins/telescope.lua index 1259a01..09dcdc2 100644 --- a/dot_config/nvim/lua/plugins/telescope.lua +++ b/dot_config/nvim/lua/plugins/telescope.lua @@ -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/*" }, + }, + }, + }, } diff --git a/dot_config/nvim/lua/plugins/venv.lua b/dot_config/nvim/lua/plugins/venv.lua index 4af5972..054879a 100644 --- a/dot_config/nvim/lua/plugins/venv.lua +++ b/dot_config/nvim/lua/plugins/venv.lua @@ -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 = { - { 'vs', 'VenvSelect' }, + { "vs", "VenvSelect" }, }, }