-- BOOTSTRAP lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", "https://github.com/folke/lazy.nvim.git", lazypath, }) end vim.opt.rtp:prepend(lazypath) vim.g.mapleader = " " vim.g.maplocalleader = " " require("lazy").setup({ -- UI / Usability "tpope/vim-sleuth", "lukas-reineke/indent-blankline.nvim", "windwp/nvim-autopairs", -- File explorer { "stevearc/oil.nvim", opts = { default_file_explorer = true, view_options = { show_hidden = true, }, }, }, -- Theme { "luisiacc/gruvbox-baby", name = "gruvbox-baby", priority = 1000, config = function() vim.g.gruvbox_baby_background_color = "medium" vim.g.gruvbox_baby_telescope_theme = 1 vim.g.gruvbox_baby_transparent_mode = 1 vim.cmd.colorscheme("gruvbox-baby") end, }, -- Noice UI { "folke/noice.nvim", event = "VeryLazy", dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify", }, config = function() require("noice").setup({ presets = { bottom_search = true, command_palette = true, long_message_to_split = true, inc_rename = false, lsp_doc_border = true, }, -- ASCII-only UI patch routes = { { filter = { event = "msg_show", kind = "", find = "" }, opts = { skip = true }, }, }, cmdline = { format = { cmdline = { icon = ":" }, search_down = { icon = "/" }, search_up = { icon = "?" }, }, }, lsp = { progress = { enabled = true, format = { progress = function(msg) return string.format("%s [%s%%]", msg.title or "LSP", msg.percentage or "?" ) end, }, format_done = function(_) return "LSP done" end, }, }, }) -- nvim-notify ASCII settings local notify = require("notify") notify.setup({ render = "compact", stages = "static", icons = { ERROR = "E", WARN = "W", INFO = "I", DEBUG = ">", TRACE = "-", }, }) vim.notify = notify end, }, -- Lualine ASCII UI { "nvim-lualine/lualine.nvim", config = function() local lualine = require("lualine") local colors = { bg = "NONE", fg = "#bbc2cf", yellow = "#ECBE7B", cyan = "#008080", green = "#98be65", orange = "#FF8800", violet = "#a9a1e1", magenta = "#c678dd", blue = "#51afef", red = "#ec5f67", } local conditions = { buffer_not_empty = function() return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 end, hide_in_width = function() return vim.fn.winwidth(0) > 80 end, } local config = { options = { globalstatus = true, component_separators = "", section_separators = "", theme = { normal = { c = { fg = colors.fg, bg = "NONE" } }, inactive = { c = { fg = colors.fg, bg = "NONE" } }, }, }, sections = { lualine_a = {}, lualine_b = {}, lualine_c = {}, lualine_x = {}, lualine_y = {}, lualine_z = {}, }, inactive_sections = { lualine_a = {}, lualine_b = {}, lualine_c = {}, lualine_x = {}, lualine_y = {}, lualine_z = {}, }, } local function ins_left(component) table.insert(config.sections.lualine_c, component) end local function ins_right(component) table.insert(config.sections.lualine_x, component) end ins_left({ function() return "|" end, color = { fg = colors.blue }, }) ins_left({ function() return "*" end, color = function() local mode_color = { n = colors.red, i = colors.green, v = colors.blue, V = colors.blue, c = colors.magenta, s = colors.orange, S = colors.orange, ic = colors.yellow, R = colors.violet, t = colors.red, } return { fg = mode_color[vim.fn.mode()] } end, }) ins_left({ "filesize", cond = conditions.buffer_not_empty, }) ins_left({ "filename", cond = conditions.buffer_not_empty, color = { fg = colors.magenta, gui = "bold" }, }) ins_left("location") ins_left({ "progress", color = { gui = "bold" } }) ins_left({ "diagnostics", sources = { "nvim_diagnostic" }, symbols = { error = "E:", warn = "W:", info = "I:" }, }) ins_left(function() return "%=" end) ins_left({ function() local msg = "No LSP" local buf_ft = vim.bo.filetype for _, client in ipairs(vim.lsp.get_clients({ bufnr = 0 })) do local filetypes = client.config.filetypes if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then return client.name end end return msg end, icon = "LSP:", color = { fg = "#ffffff", gui = "bold" }, }) ins_right({ "o:encoding", fmt = string.upper, color = { fg = colors.green, gui = "bold" }, }) ins_right({ "fileformat", fmt = string.upper, icons_enabled = false, color = { fg = colors.green, gui = "bold" }, }) ins_right({ "branch", icon = "git:", color = { fg = colors.violet, gui = "bold" }, }) ins_right({ "diff", symbols = { added = "+", modified = "~", removed = "-" }, }) ins_right({ function() return "|" end, color = { fg = colors.blue }, }) lualine.setup(config) vim.api.nvim_set_hl(0, "StatusLine", { bg = "NONE" }) vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "NONE" }) end, }, -- Telescope { "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" }, }, -- Treesitter { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup({ highlight = { enable = true }, indent = { enable = true }, ensure_installed = { "lua", "vim", "c", "cpp", "markdown", "python", "rust", "bash", }, }) end, }, -- Completion { "hrsh7th/nvim-cmp", dependencies = { "hrsh7th/cmp-nvim-lsp", "saadparwaiz1/cmp_luasnip", "L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets", }, config = function() local cmp = require("cmp") local luasnip = require("luasnip") require("luasnip.loaders.from_vscode").lazy_load() cmp.setup({ snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.confirm({ select = true }), }), sources = { { name = "nvim_lsp" }, { name = "luasnip" }, }, }) end, }, -- LSP { "neovim/nvim-lspconfig", dependencies = { "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", "hrsh7th/cmp-nvim-lsp", "j-hui/fidget.nvim", }, config = function() require("mason").setup() require("fidget").setup() local servers = { lua_ls = { settings = { Lua = { diagnostics = { globals = { "vim" } }, completion = { callSnippet = "Replace" }, }, }, }, } require("mason-tool-installer").setup({ ensure_installed = vim.tbl_keys(servers), }) local capabilities = require("cmp_nvim_lsp").default_capabilities() require("mason-lspconfig").setup({ handlers = { function(server) require("lspconfig")[server].setup({ capabilities = capabilities, settings = servers[server], }) end, }, }) end, }, -- Formatting { "stevearc/conform.nvim", opts = { formatters_by_ft = { lua = { "stylua" }, python = { "black" }, }, }, }, -- Git signs ASCII { "lewis6991/gitsigns.nvim", config = function() require("gitsigns").setup({ signs = { add = { text = "+" }, change = { text = "~" }, delete = { text = "-" }, topdelete = { text = "-" }, changedelete = { text = "~" }, }, }) end, }, -- Which-key { "folke/which-key.nvim", config = function() require("which-key").setup() end, }, }) -- Cursor/selection aesthetics vim.api.nvim_set_hl(0, "CursorLine", { bg = "#1c1c1c" }) vim.api.nvim_set_hl(0, "Visual", { bg = "#262626" }) -- ASCII diagnostics vim.fn.sign_define("DiagnosticSignError", { text = "E", texthl = "DiagnosticError" }) vim.fn.sign_define("DiagnosticSignWarn", { text = "W", texthl = "DiagnosticWarn" }) vim.fn.sign_define("DiagnosticSignInfo", { text = "I", texthl = "DiagnosticInfo" }) vim.fn.sign_define("DiagnosticSignHint", { text = "H", texthl = "DiagnosticHint" }) -- Options local opt = vim.opt opt.number = true opt.mouse = "a" opt.splitright = true opt.splitbelow = true opt.smartindent = true opt.expandtab = true opt.shiftwidth = 4 opt.tabstop = 4 opt.ignorecase = true opt.smartcase = true opt.termguicolors = true opt.cursorline = true opt.scrolloff = 10 opt.clipboard = "unnamedplus" -- Typo forgiveness vim.cmd([[ cnoreabbrev W w cnoreabbrev Q q cnoreabbrev WQ wq cnoreabbrev Wq wq cnoreabbrev wQ wq cnoreabbrev WQA wqa cnoreabbrev WQa wqa cnoreabbrev Wqa wqa ]]) -- Keymaps local map = vim.keymap.set map("n", "", ":nohl") map("n", "-", require("oil").open, { desc = "Open parent directory" }) local telescope = require("telescope.builtin") map("n", "ff", telescope.find_files) map("n", "fg", telescope.live_grep) map("n", "fb", telescope.buffers) -- Yank highlight vim.api.nvim_create_autocmd("TextYankPost", { callback = function() vim.highlight.on_yank() end, })