diff --git a/init.lua b/init.lua index 1152335..efca689 100644 --- a/init.lua +++ b/init.lua @@ -1,39 +1,45 @@ -vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/" -vim.g.mapleader = " " +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.opt.termguicolors = true --- bootstrap lazy and all plugins -local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" +-- nvchad ui stuff +vim.g.base46_cache = vim.fn.stdpath('data') .. '/base46_cache/' -if not vim.loop.fs_stat(lazypath) then - local repo = "https://github.com/folke/lazy.nvim.git" - vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath } +vim.g.mapleader = " " +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" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + 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" }) -local lazy_config = require "configs.lazy" +-- more nvchad ui stuff +-- dofile(vim.g.base46_cache .. "defaults") +-- dofile(vim.g.base46_cache .. "syntax") +-- dofile(vim.g.base46_cache .. "treesitter") +-- dofile(vim.g.base46_cache .. "git") +-- dofile(vim.g.base46_cache .. "nvimtree") --- load plugins -require("lazy").setup({ - { - "NvChad/NvChad", - lazy = false, - branch = "v2.5", - import = "nvchad.plugins", - config = function() - require "options" - end, - }, +-- or if you want to load all base46 integrations at startup itself +local integrations = require("nvconfig").base46.integrations - { import = "plugins" }, -}, lazy_config) - --- load theme -dofile(vim.g.base46_cache .. "defaults") -dofile(vim.g.base46_cache .. "statusline") - -require "nvchad.autocmds" +for _, name in ipairs(integrations) do + dofile(vim.g.base46_cache .. name) +end -vim.schedule(function() - require "mappings" -end) +vim.o.number = true +-- require("nvim-tree.api").tree.open() -- open tree on start +require "options" +require "remaps" diff --git a/lazy-lock.json b/lazy-lock.json index b60a3df..00e8af4 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,34 +1,22 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" }, - "NvChad": { "branch": "v2.5", "commit": "0b1f669caa312ca11be79b3833296d1271bf4c75" }, "base46": { "branch": "v2.5", "commit": "adb64a6ae70f8c61c5ab8892f07d29dafd4d47ad" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, - "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" }, - "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" }, + "conform.nvim": { "branch": "master", "commit": "820eec990d5f332d30cf939954c8672a43a0459e" }, "gitsigns.nvim": { "branch": "main", "commit": "d96ef3bbff0bdbc3916a220f5c74a04c4db033f2" }, - "go.nvim": { "branch": "master", "commit": "591a0b837420f27c734600fa5c6de87f18352e50" }, - "guihua.lua": { "branch": "master", "commit": "3b3126ae87c254f6849e708549ba76c39e3f42f8" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, - "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "ca9eaccc154578064366d99de7b02f8231c383eb" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" }, "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, - "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-lspconfig": { "branch": "master", "commit": "b3014f2209503944f2714cf27c95591433a0c7d8" }, - "nvim-tree.lua": { "branch": "master", "commit": "81eb8d519233c105f30dc0a278607e62b20502fd" }, - "nvim-treesitter": { "branch": "master", "commit": "ef267f0c285928ea3a0d3362a260a0728fd4a146" }, + "nvim-tree.lua": { "branch": "master", "commit": "ddd1d6eb21c45433bdc65cc8015f2457998f2bf2" }, + "nvim-treesitter": { "branch": "master", "commit": "f08a9d97f7a2ac02115a5c1c8e3973b2634d996b" }, "nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" }, "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, - "telescope.nvim": { "branch": "master", "commit": "5a701e99906961218b55d7ad6c2a998f066c6fe0" }, - "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, - "trouble.nvim": { "branch": "dev", "commit": "10eff94809ecd6ee6cc59f42e9521b9b8a14e9ce" }, - "ui": { "branch": "v2.5", "commit": "e1af69426b3c4b55c88bd1c81790c1c73b30bfa8" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } + "telescope.nvim": { "branch": "master", "commit": "4d4ade7f2b8f403e8816ca50c05ed16e259b21fb" }, + "ui": { "branch": "v2.5", "commit": "e1af69426b3c4b55c88bd1c81790c1c73b30bfa8" } } \ No newline at end of file diff --git a/lua/after/lsp.lua b/lua/after/lsp.lua new file mode 100644 index 0000000..da459f5 --- /dev/null +++ b/lua/after/lsp.lua @@ -0,0 +1,23 @@ +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/chadrc.lua b/lua/chadrc.lua index e6538ac..12dbc61 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -1,42 +1,6 @@ --- This file needs to have same structure as nvconfig.lua --- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua - ----@type ChadrcConfig +-- this file exists so base64 telescope theme swap works :P local M = {} -M.ui = { - theme = "your_needy_pop_star", - hl_override = { - Comment = { italic = true }, - ["@comment"] = { italic = true }, - }, - tabufline = { - lazyload = false, - }, - nvdash = { - load_on_startup = true, - - header = { - [[ ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ]], - [[ ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ]], - [[ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ]], - [[ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ]], - [[ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ]], - [[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], - }, - - buttons = { - { " Find File", "Spc f f", "Telescope find_files" }, - { "󰈚 Recent Files", "Spc f o", "Telescope oldfiles" }, - { "󰈭 Find Word", "Spc f w", "Telescope live_grep" }, - { " Bookmarks", "Spc m a", "Telescope marks" }, - { " Themes", "Spc t h", "Telescope themes" }, - { " Mappings", "Spc c h", "NvCheatsheet" }, - }, - }, - telescope = { - style = "bordered", - }, -} +M.ui = { theme = "your_needy_pop_star" } return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua deleted file mode 100644 index e5eaddc..0000000 --- a/lua/configs/conform.lua +++ /dev/null @@ -1,15 +0,0 @@ -local options = { - formatters_by_ft = { - lua = { "stylua" }, - css = { "prettier" }, - html = { "prettier" }, - }, - - format_on_save = { - -- These options will be passed to conform.format() - timeout_ms = 500, - lsp_fallback = true, - }, -} - -require("conform").setup(options) diff --git a/lua/configs/gitsigns.lua b/lua/configs/gitsigns.lua new file mode 100644 index 0000000..d09e967 --- /dev/null +++ b/lua/configs/gitsigns.lua @@ -0,0 +1,24 @@ +return { + signs = { + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "󰍵" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "│" }, + }, + + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function opts(desc) + return { buffer = bufnr, desc = desc } + end + + local map = vim.keymap.set + + map("n", "rh", gs.reset_hunk, opts "Reset Hunk") + map("n", "ph", gs.preview_hunk, opts "Preview Hunk") + map("n", "gb", gs.blame_line, opts "Blame Line") + end, +} diff --git a/lua/configs/go.lua b/lua/configs/go.lua deleted file mode 100644 index 7f158a8..0000000 --- a/lua/configs/go.lua +++ /dev/null @@ -1 +0,0 @@ -require("go").setup() diff --git a/lua/configs/lazy.lua b/lua/configs/lazy.lua deleted file mode 100644 index cd170bd..0000000 --- a/lua/configs/lazy.lua +++ /dev/null @@ -1,47 +0,0 @@ -return { - defaults = { lazy = true }, - install = { colorscheme = { "nvchad" } }, - - ui = { - icons = { - ft = "", - lazy = "󰂠 ", - loaded = "", - not_loaded = "", - }, - }, - - performance = { - rtp = { - disabled_plugins = { - "2html_plugin", - "tohtml", - "getscript", - "getscriptPlugin", - "gzip", - "logipat", - "netrw", - "netrwPlugin", - "netrwSettings", - "netrwFileHandlers", - "matchit", - "tar", - "tarPlugin", - "rrhelper", - "spellfile_plugin", - "vimball", - "vimballPlugin", - "zip", - "zipPlugin", - "tutor", - "rplugin", - "syntax", - "synmenu", - "optwin", - "compiler", - "bugreport", - "ftplugin", - }, - }, - }, -} diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua deleted file mode 100644 index 12d416e..0000000 --- a/lua/configs/lspconfig.lua +++ /dev/null @@ -1,62 +0,0 @@ -local map = vim.keymap.set -local conf = require("nvconfig").ui.lsp - -local on_attach = function(client, bufnr) - local function opts(desc) - return { buffer = bufnr, desc = desc } - end - - map("n", "gD", vim.lsp.buf.declaration, opts "Lsp Go to declaration") - map("n", "gd", vim.lsp.buf.definition, opts "Lsp Go to definition") - map("n", "K", vim.lsp.buf.hover, opts "Lsp hover information") - map("n", "gi", vim.lsp.buf.implementation, opts "Lsp Go to implementation") - map("n", "sh", vim.lsp.buf.signature_help, opts "Lsp Show signature help") - map("n", "wa", vim.lsp.buf.add_workspace_folder, opts "Lsp Add workspace folder") - map("n", "wr", vim.lsp.buf.remove_workspace_folder, opts "Lsp Remove workspace folder") - - map("n", "wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, opts "Lsp List workspace folders") - - map("n", "D", vim.lsp.buf.type_definition, opts "Lsp Go to type definition") - - map("n", "ra", function() - require "nvchad.lsp.renamer"() - end, opts "Lsp NvRenamer") - - map({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts "Lsp Code action") - map("n", "gr", "Telescope lsp_references", opts "[G]et [R]eferences") - - -- setup signature popup - if conf.signature and client.server_capabilities.signatureHelpProvider then - require("nvchad.lsp.signature").setup(client, bufnr) - end -end -local on_init = require("nvchad.configs.lspconfig").on_init -local capabilities = require("nvchad.configs.lspconfig").capabilities - -local lspconfig = require "lspconfig" -local servers = { "html", "cssls", "gopls", "tsserver" } - --- lsps with default config -for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - on_attach = on_attach, - on_init = on_init, - capabilities = capabilities, - } -end - --- rust -lspconfig.rust_analyzer.setup { - settings = { - ["rust-analyzer"] = {}, - }, -} - --- typescript --- lspconfig.tsserver.setup { --- on_attach = on_attach, --- on_init = on_init, --- capabilities = capabilities, --- } diff --git a/lua/configs/nvim-tree.lua b/lua/configs/nvim-tree.lua new file mode 100644 index 0000000..a9bf3dd --- /dev/null +++ b/lua/configs/nvim-tree.lua @@ -0,0 +1,27 @@ +local function on_attach(bufnr) + local api = require "nvim-tree.api" + + 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 = "😵", + }, + }, + }, + }, +} + +return M diff --git a/lua/configs/treesitter.lua b/lua/configs/treesitter.lua new file mode 100644 index 0000000..386197d --- /dev/null +++ b/lua/configs/treesitter.lua @@ -0,0 +1,12 @@ +return { + ensure_installed = { + "lua", "luadoc", "printf", + "vim", "vimdoc", "go", + "ruby", "rust", "cpp", + }, + highlight = { + enable = true, + use_languagetree = true, + }, + indent = { { enable = true } }, +} diff --git a/lua/mappings.lua b/lua/mappings.lua deleted file mode 100644 index 2c2e307..0000000 --- a/lua/mappings.lua +++ /dev/null @@ -1,31 +0,0 @@ -require "nvchad.mappings" - --- add yours here - -local map = vim.keymap.set --- disable arrow keys -map("n", "", "") -map("n", "", "") -map("n", "", "") -map("n", "", "") - -map("n", ";", ":", { desc = "CMD enter command mode" }) -map("i", "jk", "") - --- custom Leader binds -map("n", "sd", ":s/", { desc = "Shortcut to sed" }) -map("n", "qq", ":qa", { desc = "Write all and quit all" }) - --- map({ "n", "i", "v" }, "", " w ") -vim.keymap.set("n", "]t", function() - require("todo-comments").jump_next() -end, { desc = "Next todo comment" }) - -vim.keymap.set("n", "[t", function() - require("todo-comments").jump_prev() -end, { desc = "Previous todo comment" }) - -map("n", "tt", ":TodoTelescope", { desc = "View [T]odos in [T]elescope" }) --- map("n", "tT", ":TodoTrouble", { desc = "View [t]odos in [T]rouble" }) - --- map("n", "gr", "Telescope lsp_references", { desc = "[G]oto [R]eferences" }) diff --git a/lua/nvconfig.lua b/lua/nvconfig.lua new file mode 100644 index 0000000..cac03eb --- /dev/null +++ b/lua/nvconfig.lua @@ -0,0 +1,99 @@ +local M = {} + +M.ui = { + ------------------------------- base46 ------------------------------------- + -- hl = highlights + hl_add = {}, + hl_override = { + Comment = { italic = true }, + ['@comment'] = { italic = true }, + }, + changed_themes = {}, + theme_toggle = { "onedark", "one_light" }, + theme = "yoru", -- default theme (chadrc.lua controls theme, not this) + transparency = false, + + cmp = { + icons = true, + lspkind_text = true, + style = "default", -- default/flat_light/flat_dark/atom/atom_colored + }, + + telescope = { style = "bordered" }, -- borderless / bordered + + ------------------------------- nvchad_ui modules ----------------------------- + statusline = { + theme = "default", -- default/vscode/vscode_colored/minimal + -- default/round/block/arrow separators work only for default statusline theme + -- round and block will work for minimal theme only + separator_style = "default", + order = nil, + modules = nil, + }, + + -- lazyload it when there are 1+ buffers + tabufline = { + enabled = true, + lazyload = false, + order = { "treeOffset", "buffers", "tabs", "btns" }, + modules = nil, + }, + + nvdash = { + load_on_startup = true, + + header = { + [[ ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ]], + [[ ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ]], + [[ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ]], + [[ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ]], + [[ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ]], + [[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], }, + + buttons = { + { " Find File", "Spc f f", "Telescope find_files" }, + { "󰈚 Recent Files", "Spc f o", "Telescope oldfiles" }, + { "󰈭 Find Word", "Spc f w", "Telescope live_grep" }, + { " Bookmarks", "Spc m a", "Telescope marks" }, + { " Themes", "Spc t h", "Telescope themes" }, + { " Mappings", "Spc c h", "NvCheatsheet" }, + }, + }, + + cheatsheet = { theme = "grid" }, -- simple/grid + + lsp = { signature = true }, + + term = { + hl = "Normal:term,WinSeparator:WinSeparator", + sizes = { sp = 0.3, vsp = 0.2 }, + float = { + relative = "editor", + row = 0.3, + col = 0.25, + width = 0.5, + height = 0.4, + border = "single", + }, + }, +} + +M.base46 = { + integrations = { + "nvimtree", + "treesitter", + "blankline", + "git", + "lsp", + "nvdash", + "syntax", + "statusline", + "tbline", + "telescope", + "devicons", + "mason", + "defaults", + }, +} + +return M diff --git a/lua/options.lua b/lua/options.lua index 0329d80..04fe4fc 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -1,71 +1,53 @@ -require "nvchad.options" - --- add yours here! vim.o.mouse = "nv" vim.o.mousemodel = "extend" --- tabsize --- vim.opt.shiftwidth = 4 --- vim.opt.tabstop = 4 - -- optimization for WSL -vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { - once = true, - callback = function() - if vim.fn.has "win32" == 1 or vim.fn.has "wsl" == 1 then - vim.g.clipboard = { - copy = { - ["+"] = "win32yank.exe -i --crlf", - ["*"] = "win32yank.exe -i --crlf", - }, - paste = { - ["+"] = "win32yank.exe -o --lf", - ["*"] = "win32yank.exe -o --lf", - }, - } - elseif vim.fn.has "unix" == 1 then - if vim.fn.executable "xclip" == 1 then - vim.g.clipboard = { - copy = { - ["+"] = "xclip -selection clipboard", - ["*"] = "xclip -selection clipboard", - }, - paste = { - ["+"] = "xclip -selection clipboard -o", - ["*"] = "xclip -selection clipboard -o", - }, - } - elseif vim.fn.executable "xsel" == 1 then - vim.g.clipboard = { - copy = { - ["+"] = "xsel --clipboard --input", - ["*"] = "xsel --clipboard --input", - }, - paste = { - ["+"] = "xsel --clipboard --output", - ["*"] = "xsel --clipboard --output", - }, - } - end - end - - vim.opt.clipboard = "unnamedplus" - end, - desc = "Lazy load clipboard", -}) - --- go.nvim opts -local format_sync_grp = vim.api.nvim_create_augroup("goimports", {}) -vim.api.nvim_create_autocmd("BufWritePre", { - pattern = "*.go", - callback = function() - require("go.format").goimports() - end, - group = format_sync_grp, -}) - -local o = vim.o -o.cursorlineopt = "both" -- to enable cursorline! +-- vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { +-- once = true, +-- callback = function() +-- if vim.fn.has "win32" == 1 or vim.fn.has "wsl" == 1 then +-- vim.g.clipboard = { +-- copy = { +-- ["+"] = "win32yank.exe -i --crlf", +-- ["*"] = "win32yank.exe -i --crlf", +-- }, +-- paste = { +-- ["+"] = "win32yank.exe -o --lf", +-- ["*"] = "win32yank.exe -o --lf", +-- }, +-- } +-- elseif vim.fn.has "unix" == 1 then +-- if vim.fn.executable "xclip" == 1 then +-- vim.g.clipboard = { +-- copy = { +-- ["+"] = "xclip -selection clipboard", +-- ["*"] = "xclip -selection clipboard", +-- }, +-- paste = { +-- ["+"] = "xclip -selection clipboard -o", +-- ["*"] = "xclip -selection clipboard -o", +-- }, +-- } +-- elseif vim.fn.executable "xsel" == 1 then +-- vim.g.clipboard = { +-- copy = { +-- ["+"] = "xsel --clipboard --input", +-- ["*"] = "xsel --clipboard --input", +-- }, +-- paste = { +-- ["+"] = "xsel --clipboard --output", +-- ["*"] = "xsel --clipboard --output", +-- }, +-- } +-- end +-- end +-- vim.opt.clipboard = "unnamedplus" +-- end, +-- desc = "Lazy load clipboard", +--}) + +-- enable cursor line +vim.o.cursorlineopt = "both" -- Highlight on yank vim.api.nvim_create_autocmd("TextYankPost", { @@ -75,5 +57,3 @@ vim.api.nvim_create_autocmd("TextYankPost", { vim.highlight.on_yank { timeout = 500 } end, }) - --- require("nvim-tree").setup(require "configs.nvimtree") diff --git a/lua/plugins/base46.lua b/lua/plugins/base46.lua new file mode 100644 index 0000000..4fc2b27 --- /dev/null +++ b/lua/plugins/base46.lua @@ -0,0 +1,8 @@ +return { + "NvChad/base46", + branch = "v2.5", + lazy = true, + build = function() + require("base46").load_all_highlights() + end, +} diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua deleted file mode 100644 index b4f37fd..0000000 --- a/lua/plugins/cmp.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - "hrsh7th/nvim-cmp", - config = function(_, opts) - local cmp = require "cmp" - opts.mapping[""] = cmp.mapping { - i = function(fallback) - if cmp.visible() and cmp.get_active_entry() then - cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false } - else - fallback() - end - end, - s = cmp.mapping.confirm { select = true }, - c = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true }, - } - opts.mapping[""] = cmp.mapping(function(fallback) - -- This little snippet will confirm with tab, and if no entry is selected, will confirm the first item - if cmp.visible() then - local entry = cmp.get_selected_entry() - if not entry then - cmp.select_next_item { behavior = cmp.SelectBehavior.Select } - end - cmp.confirm() - else - fallback() - end - end, { "i", "s", "c" }) - require("cmp").setup(opts) - end, -} diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua new file mode 100644 index 0000000..7449a37 --- /dev/null +++ b/lua/plugins/comment.lua @@ -0,0 +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, + } diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..1f7e883 --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,11 @@ +return { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + lua = { "stylua" }, + }, + }, + config = function(_, opts) + require("conform").setup(opts) + end, + } diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..6b51412 --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +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, +} diff --git a/lua/plugins/go.lua b/lua/plugins/go.lua deleted file mode 100644 index c38fd22..0000000 --- a/lua/plugins/go.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - "ray-x/go.nvim", - lazy = false, - dependencies = { -- optional packages - "ray-x/guihua.lua", - "neovim/nvim-lspconfig", - "nvim-treesitter/nvim-treesitter", - }, - config = function() - require "configs.go" - end, - event = { "CmdlineEnter" }, - ft = { "go", "gomod", "gowork", "gotmpl" }, - build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries -} diff --git a/lua/plugins/indent-blankline.lua b/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..135bfe6 --- /dev/null +++ b/lua/plugins/indent-blankline.lua @@ -0,0 +1,18 @@ +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, + } + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua deleted file mode 100644 index 093dc0b..0000000 --- a/lua/plugins/init.lua +++ /dev/null @@ -1,27 +0,0 @@ -return { - { - "stevearc/conform.nvim", - event = "BufWritePre", -- uncomment for format on save - config = function() - require "configs.conform" - end, - }, - { - "nvim-treesitter/nvim-treesitter", - opts = { - ensure_installed = { - "vim", - "lua", - "vimdoc", - "html", - "css", - "c", - "go", - "rust", - "javascript", - "gomod", - "ruby", - }, - }, - }, -} diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua deleted file mode 100644 index 7d4f085..0000000 --- a/lua/plugins/lsp-config.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "neovim/nvim-lspconfig", - config = function() - require("nvchad.configs.lspconfig").defaults() - require "configs.lspconfig" - end, -} diff --git a/lua/plugins/lsp-zero.lua b/lua/plugins/lsp-zero.lua new file mode 100644 index 0000000..8796c5c --- /dev/null +++ b/lua/plugins/lsp-zero.lua @@ -0,0 +1,16 @@ +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'}, +} diff --git a/lua/plugins/markdown-preview.lua b/lua/plugins/markdown-preview.lua deleted file mode 100644 index bb96fbc..0000000 --- a/lua/plugins/markdown-preview.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - build = "cd app && yarn install", - init = function() - vim.g.mkdp_filetypes = { "markdown" } - end, - ft = { "markdown" }, -} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua deleted file mode 100644 index f4a0a61..0000000 --- a/lua/plugins/mason.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - "lua-language-server", - "stylua", - "html-lsp", - "css-lsp", - "prettier", - "gopls", - "goimports", - "golines", - "gofumpt", - }, - }, -} diff --git a/lua/plugins/nvim-colorizer.lua b/lua/plugins/nvim-colorizer.lua new file mode 100644 index 0000000..2095f9d --- /dev/null +++ b/lua/plugins/nvim-colorizer.lua @@ -0,0 +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, +} diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua index e72c1c3..bf54a17 100644 --- a/lua/plugins/nvim-tree.lua +++ b/lua/plugins/nvim-tree.lua @@ -1,20 +1,23 @@ return { - "nvim-tree/nvim-tree.lua", - opts = { - git = { ignore = false }, - renderer = { - icons = { - glyphs = { - git = { -- this is so stupid lmao - unstaged = "😴", - staged = "😎", - unmerged = "😈", - untracked = "😭", - renamed = "😶", - deleted = "😵", - }, - }, - }, - }, - }, + "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 new file mode 100644 index 0000000..5940daa --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,5 @@ +local map = vim.keymap.set +return { + "nvim-telescope/telescope.nvim", + dependencies = { 'nvim-lua/plenary.nvim' }, +} diff --git a/lua/plugins/todo-comments.lua b/lua/plugins/todo-comments.lua deleted file mode 100644 index 442671a..0000000 --- a/lua/plugins/todo-comments.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - lazy = false, - opts = { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }, -} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..01c955e --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,15 @@ +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, + } + diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua deleted file mode 100644 index 77d2af0..0000000 --- a/lua/plugins/trouble.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - "folke/trouble.nvim", - branch = "dev", -- IMPORTANT! - keys = { - { - "tx", - "Trouble diagnostics toggle", - desc = "Diagnostics (Trouble)", - }, - { - "tX", - "Trouble diagnostics toggle filter.buf=0", - desc = "Buffer Diagnostics (Trouble)", - }, - { - "cs", - "Trouble symbols toggle focus=false", - desc = "Symbols (Trouble)", - }, - { - "cl", - "Trouble lsp toggle focus=false win.position=right", - desc = "LSP Definitions / references / ... (Trouble)", - }, - { - "tL", - "Trouble loclist toggle", - desc = "Location List (Trouble)", - }, - { - "tQ", - "Trouble qflist toggle", - desc = "Quickfix List (Trouble)", - }, - }, - opts = {}, -- for default options, refer to the configuration section for custom setup. -} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..47cf7bc --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,8 @@ +return { + "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 deleted file mode 100644 index 47cad65..0000000 --- a/lua/plugins/vim-sleuth.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - "tpope/vim-sleuth", - opts = {}, -} diff --git a/lua/remaps.lua b/lua/remaps.lua new file mode 100644 index 0000000..ea38284 --- /dev/null +++ b/lua/remaps.lua @@ -0,0 +1,55 @@ +local map = vim.keymap.set +-- general mappings +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" ) + +-- 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' }) +map("n", "fg", "Telescope current_buffer_fuzzy_find", { desc = "[f]ile [g]rep" }) + +-- base46 maps +map('n', 'th', 'Telescope themes', { desc = '[th]emes' }) + +-- nvim-tree mapping +map('n', 'e', 'NvimTreeOpen') + +-- comment +map("n", "/", function() + require("Comment.api").toggle.linewise.current() +end, { desc = "Comment Toggle" }) + +-- tabufline +map("n", "", function() + require("nvchad.tabufline").next() +end, { desc = "Buffer Goto next" }) + +map("n", "", function() + require("nvchad.tabufline").prev() +end, { desc = "Buffer Goto prev" }) + +map("n", "x", function() + require("nvchad.tabufline").close_buffer() +end, { desc = "Buffer Close" }) + +-- 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" }) +map("n", "q", vim.diagnostic.setloclist, { desc = "Lsp diagnostic loclist" }) + +map( + "v", + "/", + "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", + { desc = "Comment Toggle" } +)