diff --git a/init.lua b/init.lua index efca689..48665a9 100644 --- a/init.lua +++ b/init.lua @@ -3,27 +3,27 @@ vim.g.loaded_netrwPlugin = 1 vim.opt.termguicolors = true -- nvchad ui stuff -vim.g.base46_cache = vim.fn.stdpath('data') .. '/base46_cache/' +vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46_cache/" vim.g.mapleader = " " -vim.keymap.set({'n', 'v'}, "", "") -vim.keymap.set({'n', 'v'}, "", "") -vim.keymap.set({'n', 'v'}, "", "") -vim.keymap.set({'n', 'v'}, "", "") +vim.keymap.set({ "n", "v" }, "", "") +vim.keymap.set({ "n", "v" }, "", "") +vim.keymap.set({ "n", "v" }, "", "") +vim.keymap.set({ "n", "v" }, "", "") -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - vim.fn.system({ + vim.fn.system { "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, - }) + } end vim.opt.rtp:prepend(lazypath) -require("lazy").setup({ import = "plugins" }) +require("lazy").setup { import = "plugins" } -- more nvchad ui stuff -- dofile(vim.g.base46_cache .. "defaults") diff --git a/lua/after/lsp.lua b/lua/after/lsp.lua deleted file mode 100644 index da459f5..0000000 --- a/lua/after/lsp.lua +++ /dev/null @@ -1,23 +0,0 @@ -local lsp_zero = require('lsp-zero') - -lsp_zero.on_attach(function(client, bufnr) - -- see :help lsp-zero-keybindings - -- to learn the available actions - lsp_zero.default_keymaps({buffer = bufnr}) -end) - --- here you can setup the language servers -require('mason').setup({}) -require('mason-lspconfig').setup({ - ensure_installed = { - 'tsserver', - 'rust_analyzer', - 'gopls', - 'clangd', - } - handlers = { - function(server_name) - require('lspconfig')[server_name].setup({}) - end, - } -}) diff --git a/lua/configs/nvim-tree.lua b/lua/configs/nvim-tree.lua index a9bf3dd..0f7ef80 100644 --- a/lua/configs/nvim-tree.lua +++ b/lua/configs/nvim-tree.lua @@ -1,27 +1,27 @@ local function on_attach(bufnr) - local api = require "nvim-tree.api" + local api = require "nvim-tree.api" - api.config.mappings.default_on_attach(bufnr) + api.config.mappings.default_on_attach(bufnr) end local M = { - disable_netrw = true, - on_attach = on_attach, - git = { ignore = false }, - renderer = { - icons = { - glyphs = { - git = { -- this is so stupid lmao - unstaged = "😴", - staged = "😎", - unmerged = "😈", - untracked = "😭", - renamed = "😶", - deleted = "😵", - }, + disable_netrw = true, + on_attach = on_attach, + git = { ignore = false }, + renderer = { + icons = { + glyphs = { + git = { -- this is so stupid lmao + unstaged = "😴", + staged = "😎", + unmerged = "😈", + untracked = "😭", + renamed = "😶", + deleted = "😵", }, }, }, + }, } return M diff --git a/lua/configs/treesitter.lua b/lua/configs/treesitter.lua index 386197d..7d1fe77 100644 --- a/lua/configs/treesitter.lua +++ b/lua/configs/treesitter.lua @@ -1,12 +1,18 @@ return { - ensure_installed = { - "lua", "luadoc", "printf", - "vim", "vimdoc", "go", - "ruby", "rust", "cpp", - }, - highlight = { - enable = true, - use_languagetree = true, - }, - indent = { { enable = true } }, + ensure_installed = { + "lua", + "luadoc", + "printf", + "vim", + "vimdoc", + "go", + "ruby", + "rust", + "cpp", + }, + highlight = { + enable = true, + use_languagetree = true, + }, + indent = { { enable = true } }, } diff --git a/lua/nvconfig.lua b/lua/nvconfig.lua index cac03eb..0b5f446 100644 --- a/lua/nvconfig.lua +++ b/lua/nvconfig.lua @@ -5,8 +5,8 @@ M.ui = { -- hl = highlights hl_add = {}, hl_override = { - Comment = { italic = true }, - ['@comment'] = { italic = true }, + Comment = { italic = true }, + ["@comment"] = { italic = true }, }, changed_themes = {}, theme_toggle = { "onedark", "one_light" }, @@ -48,7 +48,8 @@ M.ui = { [[ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ]], [[ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ]], [[ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ]], - [[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], }, + [[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], + }, buttons = { { " Find File", "Spc f f", "Telescope find_files" }, @@ -80,19 +81,19 @@ M.ui = { M.base46 = { integrations = { - "nvimtree", - "treesitter", - "blankline", - "git", - "lsp", - "nvdash", - "syntax", - "statusline", - "tbline", - "telescope", - "devicons", - "mason", - "defaults", + "nvimtree", + "treesitter", + "blankline", + "git", + "lsp", + "nvdash", + "syntax", + "statusline", + "tbline", + "telescope", + "devicons", + "mason", + "defaults", }, } diff --git a/lua/plugins/base46.lua b/lua/plugins/base46.lua index 4fc2b27..94799fb 100644 --- a/lua/plugins/base46.lua +++ b/lua/plugins/base46.lua @@ -1,8 +1,8 @@ return { - "NvChad/base46", - branch = "v2.5", - lazy = true, - build = function() - require("base46").load_all_highlights() - end, + "NvChad/base46", + branch = "v2.5", + lazy = true, + build = function() + require("base46").load_all_highlights() + end, } diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua index 7449a37..f33ca1d 100644 --- a/lua/plugins/comment.lua +++ b/lua/plugins/comment.lua @@ -1,14 +1,14 @@ -return { - "numToStr/Comment.nvim", - keys = { - { "gcc", mode = "n", desc = "Comment toggle current line" }, - { "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" }, - { "gc", mode = "x", desc = "Comment toggle linewise (visual)" }, - { "gbc", mode = "n", desc = "Comment toggle current block" }, - { "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" }, - { "gb", mode = "x", desc = "Comment toggle blockwise (visual)" }, - }, - config = function(_, opts) - require("Comment").setup(opts) - end, - } +return { + "numToStr/Comment.nvim", + keys = { + { "gcc", mode = "n", desc = "Comment toggle current line" }, + { "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" }, + { "gc", mode = "x", desc = "Comment toggle linewise (visual)" }, + { "gbc", mode = "n", desc = "Comment toggle current block" }, + { "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" }, + { "gb", mode = "x", desc = "Comment toggle blockwise (visual)" }, + }, + config = function(_, opts) + require("Comment").setup(opts) + end, +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index 1f7e883..b3d28db 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -1,11 +1,37 @@ -return { - "stevearc/conform.nvim", - opts = { - formatters_by_ft = { - lua = { "stylua" }, - }, - }, - config = function(_, opts) - require("conform").setup(opts) +return { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + opts = { + format_on_save = function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { timeout_ms = 3000, lsp_fallback = true } end, - } + formatters_by_ft = { + bash = { "shfmt" }, + sh = { "shfmt" }, + fish = { "fish_indent" }, + lua = { "stylua" }, + go = { "goimports", "gofumpt", "goimports-reviser" }, + javascript = { { "prettierd", "prettier" } }, + typescript = { { "prettierd", "prettier" } }, + javascriptreact = { { "prettierd", "prettier" } }, + typescriptreact = { { "prettierd", "prettier" } }, + vue = { { "prettierd", "prettier" } }, + css = { { "prettierd", "prettier" } }, + scss = { { "prettierd", "prettier" } }, + less = { { "prettierd", "prettier" } }, + html = { { "prettierd", "prettier" } }, + json = { { "prettierd", "prettier" } }, + jsonc = { { "prettierd", "prettier" } }, + yaml = { { "prettierd", "prettier" } }, + markdown = { { "prettierd", "prettier" } }, + ["markdown.mdx"] = { { "prettierd", "prettier" } }, + }, + }, + config = function(_, opts) + require("conform").setup(opts) + end, +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 6b51412..e5dfa05 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -1,11 +1,11 @@ return { - "lewis6991/gitsigns.nvim", - event = "User FilePost", - opts = function() - return require("configs.gitsigns") - end, - config = function(_, opts) - dofile(vim.g.base46_cache .. "git") - require("gitsigns").setup(opts) - end, + "lewis6991/gitsigns.nvim", + event = "User FilePost", + opts = function() + return require "configs.gitsigns" + end, + config = function(_, opts) + dofile(vim.g.base46_cache .. "git") + require("gitsigns").setup(opts) + end, } diff --git a/lua/plugins/indent-blankline.lua b/lua/plugins/indent-blankline.lua index 135bfe6..fcd0753 100644 --- a/lua/plugins/indent-blankline.lua +++ b/lua/plugins/indent-blankline.lua @@ -1,18 +1,17 @@ -return { - "lukas-reineke/indent-blankline.nvim", - event = "User FilePost", - opts = { - indent = { char = "│", highlight = "IblChar" }, - scope = { char = "│", highlight = "IblScopeChar" }, - }, - config = function(_, opts) - dofile(vim.g.base46_cache .. "blankline") +return { + "lukas-reineke/indent-blankline.nvim", + event = "User FilePost", + opts = { + indent = { char = "│", highlight = "IblChar" }, + scope = { char = "│", highlight = "IblScopeChar" }, + }, + config = function(_, opts) + dofile(vim.g.base46_cache .. "blankline") - local hooks = require "ibl.hooks" - hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level) - require("ibl").setup(opts) - - dofile(vim.g.base46_cache .. "blankline") - end, - } + local hooks = require "ibl.hooks" + hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level) + require("ibl").setup(opts) + dofile(vim.g.base46_cache .. "blankline") + end, +} diff --git a/lua/plugins/lsp-zero.lua b/lua/plugins/lsp-zero.lua index 8796c5c..90e80c8 100644 --- a/lua/plugins/lsp-zero.lua +++ b/lua/plugins/lsp-zero.lua @@ -1,16 +1,44 @@ return { - { - 'williamboman/mason.nvim', - cmd = { "Mason", "MasonInstall", "MasonUpdate" }, - config = function(_, opts_) - dofile(vim.g.base46_cache .. "mason") - require('mason').setup(opts) - end, - }, -{'williamboman/mason-lspconfig.nvim'}, -{'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, -{'neovim/nvim-lspconfig'}, -{'hrsh7th/cmp-nvim-lsp'}, -{'hrsh7th/nvim-cmp'}, -{'L3MON4D3/LuaSnip'}, + { + "williamboman/mason.nvim", + cmd = { "Mason", "MasonInstall", "MasonUpdate" }, + config = function(_, opts) + dofile(vim.g.base46_cache .. "mason") + require("mason").setup(opts) + end, + }, + { "williamboman/mason-lspconfig.nvim" }, + { + "VonHeikemen/lsp-zero.nvim", + branch = "v3.x", + config = function() + local lsp_zero = require "lsp-zero" + lsp_zero.on_attach(function(client, bufnr) + -- see :help lsp-zero-keybindings + -- to learn the available actions + lsp_zero.default_keymaps { buffer = bufnr } + end) + -- here you can setup the language servers + require("mason").setup {} + require("mason-lspconfig").setup { + ensure_installed = { + "tsserver", + "rust_analyzer", + "gopls", + "clangd", + "lua_ls", + "pyright", + }, + handlers = { + function(server_name) + require("lspconfig")[server_name].setup {} + end, + }, + } + end, + }, + { "neovim/nvim-lspconfig" }, + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/nvim-cmp" }, + { "L3MON4D3/LuaSnip" }, } diff --git a/lua/plugins/nvim-colorizer.lua b/lua/plugins/nvim-colorizer.lua index 2095f9d..0cad65f 100644 --- a/lua/plugins/nvim-colorizer.lua +++ b/lua/plugins/nvim-colorizer.lua @@ -1,12 +1,12 @@ return { - "NvChad/nvim-colorizer.lua", - -- event = "User FilePost", - -- opts = { user_default_options = { names = false } }, - -- config = function(_, opts) - -- require('colorizer').setup(opts) - -- - -- vim.defer_fn(function() - -- require('colorizer').attach_to_buffer(0) - -- end, 0) - -- end, + "NvChad/nvim-colorizer.lua", + event = "User FilePost", + opts = { user_default_options = { names = false } }, + config = function(_, opts) + require("colorizer").setup(opts) + + vim.defer_fn(function() + require("colorizer").attach_to_buffer(0) + end, 0) + end, } diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua index bf54a17..d1ce634 100644 --- a/lua/plugins/nvim-tree.lua +++ b/lua/plugins/nvim-tree.lua @@ -1,23 +1,23 @@ return { - "nvim-tree/nvim-tree.lua", - version = "*", - lazy = false, - dependencies = { - "nvim-tree/nvim-web-devicons", - lazy = true, - opts = function() - return { override = require "nvchad.icons.devicons" } - end, - -- opts = {}, - config = function(_, opts) - dofile(vim.g.base46_cache .. "devicons") - require("nvim-web-devicons").setup(opts) - end - }, - opts = function() - return require "configs.nvim-tree" - end, - config = function(_, opts) - require("nvim-tree").setup(opts) - end, + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + lazy = true, + opts = function() + return { override = require "nvchad.icons.devicons" } + end, + -- opts = {}, + config = function(_, opts) + dofile(vim.g.base46_cache .. "devicons") + require("nvim-web-devicons").setup(opts) + end, + }, + opts = function() + return require "configs.nvim-tree" + end, + config = function(_, opts) + require("nvim-tree").setup(opts) + end, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 5940daa..b9fbda7 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,5 +1,5 @@ local map = vim.keymap.set return { - "nvim-telescope/telescope.nvim", - dependencies = { 'nvim-lua/plenary.nvim' }, + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 01c955e..da5fbd6 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,15 +1,14 @@ return { - "nvim-treesitter/nvim-treesitter", - event = { "BufReadPost", "BufNewFile" }, - cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, - build = ":TSUpdate", - opts = function() - return require "configs.treesitter" - end, - config = function(_, opts) - dofile(vim.g.base46_cache .. "syntax") - dofile(vim.g.base46_cache .. "treesitter") - require("nvim-treesitter.configs").setup(opts) - end, - } - + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPost", "BufNewFile" }, + cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, + build = ":TSUpdate", + opts = function() + return require "configs.treesitter" + end, + config = function(_, opts) + dofile(vim.g.base46_cache .. "syntax") + dofile(vim.g.base46_cache .. "treesitter") + require("nvim-treesitter.configs").setup(opts) + end, +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 47cf7bc..d179f2a 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -1,8 +1,8 @@ return { - "NvChad/ui", - lazy = false, - branch = "v2.5", - config = function() - require "nvchad" - end, + "NvChad/ui", + lazy = false, + branch = "v2.5", + config = function() + require "nvchad" + end, } diff --git a/lua/plugins/vim-sleuth.lua b/lua/plugins/vim-sleuth.lua new file mode 100644 index 0000000..dc6771a --- /dev/null +++ b/lua/plugins/vim-sleuth.lua @@ -0,0 +1,3 @@ +return { + "timpope/vim-sleuth", +} diff --git a/lua/remaps.lua b/lua/remaps.lua index ea38284..b52d69f 100644 --- a/lua/remaps.lua +++ b/lua/remaps.lua @@ -1,27 +1,27 @@ local map = vim.keymap.set -- general mappings -map('n', ';', ':') +map("n", ";", ":") map("n", "rn", "set rnu!", { desc = "Toggle Relative number" }) map("n", "", "w", { desc = "File Save" }) map("n", "", "h", { desc = "Switch Window left" }) map("n", "", "l", { desc = "Switch Window right" }) map("n", "", "j", { desc = "Switch Window down" }) map("n", "", "k", { desc = "Switch Window up" }) -map("n", "qq", ":wa:qa" ) +map("n", "qq", ":wa:qa") -- telescope keybinds -local builtin = require('telescope.builtin') -map('n', 'ff', builtin.find_files, { desc = '[f]ind [f]ile' }) -map('n', 'pg', builtin.live_grep, { desc = '[p]roject [g]rep' }) -map('n', 'fb', builtin.buffers, { desc = '[f]ind [b]uffer' }) -map('n', 'fh', builtin.help_tags, { desc = '[f]ind [h]elp' }) +local builtin = require "telescope.builtin" +map("n", "ff", builtin.find_files, { desc = "[f]ind [f]ile" }) +map("n", "pg", builtin.live_grep, { desc = "[p]roject [g]rep" }) +map("n", "fb", builtin.buffers, { desc = "[f]ind [b]uffer" }) +map("n", "fh", builtin.help_tags, { desc = "[f]ind [h]elp" }) map("n", "fg", "Telescope current_buffer_fuzzy_find", { desc = "[f]ile [g]rep" }) -- base46 maps -map('n', 'th', 'Telescope themes', { desc = '[th]emes' }) +map("n", "th", "Telescope themes", { desc = "[th]emes" }) -- nvim-tree mapping -map('n', 'e', 'NvimTreeOpen') +map("n", "e", "NvimTreeOpen") -- comment map("n", "/", function() @@ -41,7 +41,7 @@ map("n", "x", function() require("nvchad.tabufline").close_buffer() end, { desc = "Buffer Close" }) --- lsp +-- lsp map("n", "lf", vim.diagnostic.open_float, { desc = "Lsp floating diagnostics" }) map("n", "[d", vim.diagnostic.goto_prev, { desc = "Lsp prev diagnostic" }) map("n", "]d", vim.diagnostic.goto_next, { desc = "Lsp next diagnostic" })