Skip to content

About

My neovim configuration. That's about it!

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

100 Commits

Folders and files

Repository files navigation

The Full List

Time to gut the shit outta this thing and start it from scratch... functionally. At the very least build out precisely what I know I need.

My original init.lua

I can't include Lua as the snippet language because render-markdown screams. Case in point, I guess...

-- Set up leader key at the outset
vim.g.mapleader = " "

-- Ensure lazy.nvim is installed
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",
		"https://github.com/folke/lazy.nvim.git",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

-- Import vim options and plugin information
require("lazy").setup("plugins")
require("setup")
require("commands")
require("keybinds")

-- Set default colorscheme
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "NONE" })
vim.api.nvim_set_hl(0, "FloatBorder", { bg = "NONE" })
vim.opt.termguicolors = true
vim.cmd.colorscheme("gruvbox")
vim.cmd([[autocmd BufNewFile,BufRead *.launch setfiletype xml]])

-- Change notification style
vim.notify = require("notify")

The Telescope-using, Nui-using, spellcheck thing

---Custom small selector for spelling suggestions
---@param picker any
---@return TelescopeLayout
return function(picker)
  local Layout = require("nui.layout")
  local Popup = require("nui.popup")
  local TSLayout = require("telescope.pickers.layout")

  local results = Popup({
    focusable = false,
    border = { style = "none" },
    win_options = {
      winhighlight = "Normal:TelescopeResultsNormal",
    },
  })

  local prompt = Popup({
    enter = true,
    border = { style = "none" },
    win_options = {
      winhighlight = "Normal:TelescopePromptNormal",
    },
  })

  local box = Layout.Box({
    Layout.Box(results, { grow = 1 }),
    Layout.Box(prompt, { size = 1 }),
  }, { dir = "col" })

  local function prepare_layout_parts(layout)
    layout.results = TSLayout.Window(results) ---@diagnostic disable-line: param-type-mismatch
    layout.prompt = TSLayout.Window(prompt) ---@diagnostic disable-line: param-type-mismatch
    layout.preview = TSLayout.Window(nil) ---@diagnostic disable-line: param-type-mismatch
  end

  -- Little extra to always put the window at the start of the word we're replacing
  local word = vim.fn.expand("<cword>")
  local to_end = vim.api.nvim_eval([[matchstr(getline('.'), '\k*', getpos('.')[2]-1)]])
  local offset = #word - #to_end

  local layout = Layout({
    relative = "cursor",
    anchor = "NW",
    position = {
      row = 1,
      col = -offset - 2,
    },
    size = {
      height = 6,
      width = 20,
    },
  }, box)

  layout.picker = picker
  prepare_layout_parts(layout)

  local layout_update = layout.update
  ---@diagnostic disable-next-line: duplicate-set-field
  function layout:update()
    prepare_layout_parts(layout)
    layout_update(self)
  end

  ---@diagnostic disable-next-line: param-type-mismatch
  return TSLayout(layout)
end

Plugin Wishlist

SOME PLUGINS I MAY END UP WANTING, BUT HAVE YET TO NEED

My keybinds

-- --------------------
-- Vim-related Keybinds
-- --------------------
-- Misc
vim.keymap.set("n", "<leader>sp", ":set spell<CR>")

-- Allow j/k through wrapped lines
vim.cmd("noremap <expr> j v:count ? 'j' : 'gj'")
vim.cmd("noremap <expr> k v:count ? 'k' : 'gk'")

-- Moving across windows
vim.keymap.set("n", "<leader>wh", "<C-W>h", {})
vim.keymap.set("n", "<leader>wj", "<C-W>j", {})
vim.keymap.set("n", "<leader>wk", "<C-W>k", {})
vim.keymap.set("n", "<leader>wl", "<C-W>l", {})
vim.keymap.set("n", "<leader>rr", "<C-R>", {})

-- Creating new windows
vim.keymap.set("n", "<leader>sv", ":vsplit<CR>", {})
vim.keymap.set("n", "<leader>sh", ":split<CR>", {})

-- Moving across buffers
vim.keymap.set("n", "<leader>bp", ":bp<CR>", {})
vim.keymap.set("n", "<leader>bn", ":bn<CR>", {})
vim.keymap.set("n", "<leader>bd", ":bd<CR>", {})

-- LSP features
vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format, {})
vim.keymap.set("n", "<leader>ld", vim.lsp.buf.definition, {})
vim.keymap.set("n", "<leader>lD", vim.lsp.buf.declaration, {})
vim.keymap.set("n", "<leader>ln", vim.lsp.buf.rename, {}) -- Maybe there's a way to get the command line prompt to appear in a floating window right here?
vim.keymap.set("n", "<leader>lr", vim.lsp.buf.references, {})
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
vim.keymap.set({ "n", "v" }, "<leader>lc", vim.lsp.buf.code_action, {})

-- Spelling
vim.keymap.set("n", "<leader>sp", function()
  if vim.wo.spell then
    vim.wo.spell = false
    vim.notify("Spellcheck OFF", vim.log.levels.INFO)
  else
    vim.wo.spell = true
    vim.notify("Spellcheck ON", vim.log.levels.INFO)
  end
end, { noremap = true, silent = true })

-- ----------------------
-- Preferred Colorschemes
-- ----------------------
vim.cmd("command FloatBorderBGOff lua vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'NONE' })")

-- Dark mode colorschemes
vim.keymap.set("n", "<leader>dp", ":colorscheme gruvbox | set background=dark | FloatBorderBGOff<CR>", {})
vim.keymap.set("n", "<leader>do", ":colorscheme zenbones | FloatBorderBGOff<CR>", {})
vim.keymap.set("n", "<leader>di", ":colorscheme kanagawa-dragon | FloatBorderBGOff<CR>", {})
vim.keymap.set("n", "<leader>du", ":colorscheme terafox | FloatBorderBGOff<CR>", {})

-- Light mode colorschemes
vim.keymap.set("n", "<leader>lq", ":colorscheme material-lighter | FloatBorderBGOff<CR>", {})
vim.keymap.set("n", "<leader>lw", ":colorscheme rose-pine-dawn | FloatBorderBGOff<CR>", {})
vim.keymap.set("n", "<leader>le", function()
  vim.cmd("colorscheme alabaster")
  vim.cmd("set background=light")
  vim.cmd("FloatBorderBGOff")
  vim.cmd("hi Comment gui=bold")
  vim.cmd("hi Boolean gui=bold")
  vim.cmd("hi Title gui=bold")
  vim.cmd("hi Special gui=bold")
  vim.cmd("hi Number gui=bold")
  vim.cmd("hi @spell gui=bold")
  vim.cmd("hi @nospell gui=bold")
  vim.cmd("hi @conceal gui=bold")
  -- vim.cmd("hi @variable gui=bold")
  -- vim.cmd("hi @function gui=bold")
  vim.cmd("hi @string gui=bold")
  vim.cmd("hi @punctuation gui=bold")
  vim.cmd("hi @punctuation.bracket gui=bold")
  vim.cmd("hi @keyword gui=bold")
  vim.cmd("hi @keyword.function gui=bold")
  vim.cmd("hi @type gui=italic")
  -- TODO: Just keep playing with these until I like what I see.
end
, {})
-- vim.keymap.set("n", "<leader>le", ":colorscheme alabaster | set background=light | FloatBorderBGOff<CR>", {})
vim.keymap.set("n", "<leader>lr", ":colorscheme rose-pine-dawn | FloatBorderBGOff<CR>", {})

-- -----------------------
-- Plugin-related Keybinds
-- -----------------------
-- VimTex
vim.keymap.set("n", "<leader>vc", ":VimtexCompile<CR>", {})

-- Trouble
vim.keymap.set("n", "<leader>tr", ":TroubleToggle<CR>", {})

-- Neotree
vim.keymap.set("n", "<leader>nol", ":Neotree filesystem reveal left<CR>", {})
vim.keymap.set("n", "<leader>nor", ":Neotree filesystem reveal right<CR>", {})
vim.keymap.set("n", "<leader>ntl", ":Neotree filesystem toggle left<CR>", {})
vim.keymap.set("n", "<leader>ntr", ":Neotree filesystem toggle right<CR>", {})
vim.keymap.set("n", "<leader>nf", ":Neotree position=float<CR>", {})

-- Undotree
vim.keymap.set("n", "<leader>us", ":UndotreeShow<CR>", {})
vim.keymap.set("n", "<leader>uc", ":UndotreeHide<CR>", {})
vim.keymap.set("n", "<leader>uf", ":UndotreeFocus<CR>", {})

-- Twilight
vim.keymap.set("n", "<leader>te", ":TwilightEnable<CR>")
vim.keymap.set("n", "<leader>td", ":TwilightDisable<CR>")

-- Telescope
local telescope_builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", telescope_builtin.find_files, {})
vim.keymap.set("n", "<leader>fg", telescope_builtin.live_grep, {})
vim.keymap.set("n", "<leader>fb", telescope_builtin.buffers, {})

local spelling = require("mmachado.layouts.telescope_spelling")
vim.keymap.set("n", "<leader>ss", function()
  telescope_builtin.spell_suggest({ create_layout = spelling })
end)

-- LuaSnip
local luasnip = require("luasnip")
vim.keymap.set({ "i", "s" }, "<a-l>", function()
  if luasnip.jumpable(1) then
    luasnip.jump(1)
  end
end)
vim.keymap.set({ "i", "s" }, "<a-h>", function()
  if luasnip.jumpable(-1) then
    luasnip.jump(-1)
  end
end)

vim.keymap.set({ "i", "s" }, "<a-j>", function()
  if luasnip.choice_active() then
    luasnip.change_choice(1)
  end
end)
vim.keymap.set({ "i", "s" }, "<a-k>", function()
  if luasnip.choice_active() then
    luasnip.change_choice(-1)
  end
end)

Commands

I literally never used these.

vim.cmd("command AddLsp vsplit | edit ~/.config/nvim/lua/plugins/code_editing.lua")
vim.cmd("command LuaSnipEdit execute 'vsplit | edit ~/.config/nvim/snippets/' . expand('%:e') . '.lua'")

My plugins

Fucking FINALLY!

Display and UX

  • romgrk/barbar.nvim
  • nvim-lualine/lualine.nvim
  • nvim-neo-tree/neo-tree.nvim
  • mbbill/undotree
  • stevearc/aerial.nvim
  • MunifTanjim/nui.nvim
  • rcarriga/nvim-notify
  • vhyrro/luarocks.nvim (never worked)
  • 3rd/image.nvim (never worked)
  • HakonHarnes/img-clip.nvim
  • TaDaa/vimade
  • folke/twilight.nvim

Text Editing

  • kylechui/nvim-surround
  • m4xshen/autoclose.nvim

I definitely want something to more easily manipulate markdown files.

Git Stuff

  • lewis6991/gitsigns.nvim
  • akinsho/toggleterm.nvim (I guess I wanted to use this for LazyGit? Maybe I won't tho.)
  • f-person/git-blame.nvim (Would def need to change this up, had this as the setup:
    • message_template = " , "" • via <>"
    • date_format = "%m-%d-%Y %H:%M:%S"

File Navigation

  • stevearc/oil.nvim
  • nvim-telescope/telescope.nvim
  • nvim-telescope/telescope-ui-select.nvim
  • nvim-telescope/telescope-file-browser.nvim
  • otavioschwanck/arrow.nvim (I never used this.)

Color schemes

CRUCIAL!!!

  • fladson/vim-kitty
  • zenbones-theme/zenbones.nvim
  • ellisonleao/gruvbox.nvim
  • rebelot/kanagawa.nvim
  • marko-cerovac/material.nvim
  • Mofiqul/adwaita.nvim
  • EdenEast/nightfox.nvim
  • rose-pine/neovim
  • neanias/everforest-nvim
  • catppuccin/nvim
  • savq/melange-nvim

IDE Features

The absolute behemoth. This bitch needs to be dissected, I swear to god.

  • nvim-treesitter/nvim-treesitter (Maybe I don't need this at all in favor of semantic highlighting via LSPs?)
  • nvimtools/none-ls.nvim (To this day, I don't know what this does. Maybe I don't even need it at all.)
  • neovim/nvim-lspconfig
    config = function()
      require("java").setup()
      local capabilities = require("cmp_nvim_lsp").default_capabilities()

      -- Setup all LSPs in "ensure_installed"
      vim.lsp.config(
        'rust_analyzer', {
          capabilities = capabilities,
          settings = {
            ['rust_analyzer'] = {}
          }
        }
      )
      vim.lsp.config(
        'lua_ls', { capabilities = capabilities }
      )
      vim.lsp.config(
        'jedi_language_server', { capabilities = capabilities }
      )
      vim.lsp.config(
        'clangd', { capabilities = capabilities }
      )
      vim.lsp.config(
        'texlab', { capabilities = capabilities }
      )
      vim.lsp.config(
        'jdtls', { capabilities = capabilities }
      )
      vim.lsp.config["tinymist"] = {
        cmd = { "tinymist" },
        filetypes = { "typst" },
        settings = {
          formatterProseWrap = true,
          formatterPrintWidth = 80,
          formatterIndentSize = 4,
          exportPdf = "onType",
        }
      }
    end,
  • chomosuke/typst-preview.nvim
  • williamboman/mason.nvim
  • williamboman/mason-lspconfig.nvim
  • nvimdev/lspsaga.nvim, maybe. It's not actually installed.
  • GustavEikaas/easy-dotnet.nvim, maybe. It's not installed and only for DotNet, plus I only ever did stuff with Unity, which I never wanna touch again.
  • seblyng/roslyn.nvim. Literally just for C# again, maybe not even needed anymore because Mason might have it, and also I still never wanna touch C#.
  • hrsh7th/nvim-cmp Lowkey blink.nvim seems better.
  • hrsh7th/cmp-nvim-lsp. Once again not needed if I switch to Blink.
  • windwp/nvim-ts-autotag
  • L3MON4D3/LuaSnip
  • saadparwaiz1/cmp_luasnip - might not be needed with blink. Yep, documentation shows how to use LuaSnip in Blink.
  • Exafunction/codeium.vim. Maaaayyybe.
  • folke/todo-comments.nvim
  • folke/trouble.nvim
  • rachartier/tiny-inline-diagnostic.nvim
  • lervag/vimtex
  • MeanderingProgrammer/render-markdown.nvim
  • brianhuster/live-preview.nvim
  • iamcco/markdown-preview.nvim
  • bullets-vim/bullets.vim

About

My neovim configuration. That's about it!

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages