~hedy/dotfiles

cd9003a06cdb5fb25ce6bc41db21e623d07a3795 — hedy 6 months ago b1e62e1
nvim: Restructure plugins and add mini.clue

Note that for some reason after one of these changes mini.files pressure
<cr> stops working
M .config/nvim/README.norg => .config/nvim/README.norg +19 -7
@@ 4,11 4,12 @@
  -- Plugin spec: `./lua/plugin_spec.lua`
  -- Modular plugin configuration: `./lua/plugins/*.lua`
  - LSP & Completion
  -- `lsp-config` with nvim-0.5
  -- `lsp-config`, `lspkind`, `lsp_signature`
  -- `nvim-cmp`
  -- Treesitter: context + textobjects
  - Status line (SUBJECT TO CHANGE)
  -- Lualine
  - Status line: NONE
  -- Ruler area when there's only one window
  -- Together with incline.nvim when there are splits
  - Theme: Tundra
  - File explorer: NvimTree



@@ 94,10 95,9 @@
   neovim version: 0.9

   - UI
   -- No fancy UI like message popups
   -- No fancy UI like message popups. What are we in? GUI?
   -- Area of main source (code) should be as tall as possible on a laptop,
      this means little possiblity for permanent winbar, tabline, or high
      cmdheight.
      this means sparingly little tabline/winbar or high cmdheight.
   -- Completion is turned off by default. This allows distraction free
      typing. The menu can be triggered with TAB. Unfortunately, nvim-cmp does
      not yet support ghost text + manual completion, unlike my emacs config


@@ 114,4 114,16 @@
   -- Enough contrast where applicable to discern UI elements

   - Plugins
   -- Preferably plugins with enough customizability and without feature-creep
   -- Preferably plugins with enough customizability but without feature-creep

** Meta todo

   - Emacs
   -- ( ) Talk about lazy.nvim/packer vs elpaca/straight + use-package

** Neovim todo

   - 'Statusline' set up
   -- ( ) Add diagnostics to incline and ruler
   -- ( ) Find a way to make ruler behave properly
   -- ( ) Look into nougat

M .config/nvim/init.lua => .config/nvim/init.lua +6 -3
@@ 6,8 6,11 @@ vim.g.mapleader = [[ ]]
-- Set envvar VIMHOME to, eg, ~/.config/nvim (has no trailing slash)
vim.env.VIMHOME = vim.fn.expand('<sfile>:p:h')

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

require('loadlazy')

require('general')
require('mappings')
require('autocmds')
require('config/general')
require('config/mappings')
require('config/autocmds')

R .config/nvim/lua/plugins/statusline.lua => .config/nvim/lua/archive/statusline.lua +0 -8
@@ 143,11 143,3 @@ lualine.setup {
  inactive_winbar = {},
  extensions = {'nvim-tree', competitest_line, 'symbols-outline'},
}

-- local map = function(...) vim.keymap.set(...) end
-- local d   = function(s) return { desc = s } end

-- map(
--   "n", "<leader>mm",
--   function() lualine.hide({ places = "statusline", unhide }) end
-- )

R .config/nvim/lua/autocmds.lua => .config/nvim/lua/config/autocmds.lua +0 -0
R .config/nvim/lua/general.lua => .config/nvim/lua/config/general.lua +24 -7
@@ 7,20 7,29 @@ o.number = true
o.relativenumber = true

o.mouse = "a"
o.selectmode = "mouse"   -- Use select mode when dragging with mouse
-- Use select mode when dragging with mouse.
-- This allows IDE-like quick substitution. If I need to use the mouse for
-- visual selection, I can select with mouse, then <C-v>v
-- See mappings.lua for IDE-like pair wrapping in select mode. (Select text,
-- press an open bracket to have selection be wrapped immediately.)
o.selectmode = "mouse"

-- Changes to default:
-- - Use vertical in all of command mode
-- - Use vertical in command mode
o.guicursor = "n-v-sm:block,i-ci-ve-c:ver25,r-cr-o:hor20"

-- o.cursorline      = true
-- Cursor line is rather distracting when trying to focus on the code.
-- Especially so when typing in comments -- the background of the cursor line
-- behind the already low-constrast comment fg color makes it hard to read (and
-- write with)
-- write with) <-- this was back when using dracula.
--
-- If I'm working on something with long lines and I need a visual indicator of
-- alignment I can do visual line then <Esc> to "blink" the cursor line, or
-- enable this locally.
--
-- Maybe I'll figure out a way in the future to dynamically enable cursorline
-- when screenline is wrapped.
o.showcmd         = true -- show incomplete commands
o.hlsearch        = true -- highlight search
o.wildmenu        = true -- command line's tab complete in a menu


@@ 28,20 37,28 @@ o.errorbells      = false-- no beeps please
o.visualbell      = true -- flash screen instead
o.title           = true -- set window title to file name
o.incsearch       = true -- incrementally find next match while typing search
o.scrolloff       = 6    -- screen lines to keep above and below cursor
o.sidescrolloff   = 8    -- screen columns to keep on left and right of cursor
-- Having scrolloff positive means I can't have cursor at the very top/bottom
-- whilst referring to some content on the other side of the same buffer
o.scrolloff       = 0
o.sidescrolloff   = 0
o.confirm         = true
o.showmatch       = true
o.showmode        = false -- Don't show messages when switching modes
                          -- It's such an integral part of (n)vim, I know what I'm doing :)

o.encoding = "utf-8"
o.mat = 2
o.matchtime = 1           -- deci second to show matching pair while typing
o.inccommand = "nosplit"  -- neovim only
o.autoindent = true
o.fileformat = "unix"

o.splitbelow = true
-- o.exrc = true  -- Could be potentially dangerous
o.splitright = true
if vim.fn.has("nvim-0.9") == 1 then
  -- Could be potentially dangerous before the exrc PR is merged.
  -- In 0.9 they can open files securely using trust DB
  o.exrc = true
end
vim.o.autochdir = true

o.expandtab     = true -- AIUI, tab -> spaces

R .config/nvim/lua/mappings.lua => .config/nvim/lua/config/mappings.lua +47 -20
@@ 1,9 1,9 @@
-- Note that plugins config may set more mappings.

local silent = { silent = true }
local map = vim.keymap.set
local au = vim.api.nvim_create_autocmd
local function d(s) return { desc = s } end
local function map(...) vim.keymap.set(...) end
local function au(...) vim.api.nvim_create_autocmd(...) end
local function mapbuf(a, b, c) vim.api.nvim_buf_set_keymap(0, a, b, c, { noremap=true }) end

---------------------


@@ 12,28 12,29 @@ local function mapbuf(a, b, c) vim.api.nvim_buf_set_keymap(0, a, b, c, { noremap
map("n", "<Leader>rn", "<cmd>set relativenumber!<cr>", d "toggle rel num")
map("n", "<Leader>z", "zR", d "zA (toggle all folds)")
-- The 3 mappings that I use most often out of all vim mappings :D
map("n", "<Leader>w", "<cmd>w<CR>", d "write")
map("n", "<Leader>x", "<cmd>xa<CR>", d "x all")
map("n", "<Leader>q", "<cmd>qa<CR>", d "quit all")
map("n", "<Leader>w", "<cmd>w<CR>", d ":w")
map("n", "<Leader>x", "<cmd>xa<CR>", d ":xa")
map("n", "<Leader>q", "<cmd>qa<CR>", d ":qa")
map("n", "<Leader>nh", "<cmd>noh<CR>", d ":noh")
map("n", "<Leader>p", "\"+p", d "System clipboard paste")
-- XXX: Decide whether to deprecate this in favor of :Telescope registers
map("n", "<Leader>rg", "<cmd>registers<CR>", d "Show registers, also <leader>fR")
map("n", "<leader>u", "gul")
map("n", "<leader>U", "gUl")
map("n", "<leader><down>", "<cmd><down>")
map("n", "<leader><up>", "<cmd><up>")
-- Deprecated in favor of telescope registers because you can use <C-e> to edit
-- select register, how cool is that!
-- map("n", "<Leader>rg", "<cmd>registers<CR>", d "Show registers, also <leader>fR")
map("n", "<leader>u", "gul", d "Lower current char")
map("n", "<leader>U", "gUl", d "Upper current char")
map("n", "<leader><up>", ":<up>", d "Like @: but does not <cr>")

-----------------------------------
-- Normal and Universal Mappings --
-----------------------------------
-- Close a buffer, useful when doing PlugInstall and then closing that
-- Or is it close a window? frame? DAMN all this emacs terminology got me so
-- confused
map("n", "Q", "<cmd>q<CR>")
-- Or is it close a window? frame? I'll admit all this emacs terminology got me
-- so confused.
map("n", "Q", "<cmd>q<CR>", d":q")

-- NOTE: These mappings Just Work in wsl so no need the extra binding like
-- in vimrc, this is why you use neovim instead of vim ;)
-- Legacy comment incomming
-- > These mappings Just Work in wsl so no need the extra binding like in vimrc,
-- > this is why you use neovim instead of vim ;)
map("n", "<M-j>", "<cmd>m+1<CR>==", d "Move line down")
map("n", "<M-k>", "<cmd>m-2<CR>==", d "Move line up")
map("n", "<M-J>", "<cmd>t.<CR>==", d "Copy line down")


@@ 99,7 100,7 @@ else
  map("", "<C-`>", "<cmd>split term://fish<cr><cmd>resize -7<cr>i",
    d "Open terminal below" )
end
map("t", "<Esc>", "<C-\\><C-n>", d "Esc in terminal mode")
map("t", "<Esc>", "<C-\\><C-n>")

--------------------------------------
-- Insert/Command Editting Mappings --


@@ 121,8 122,34 @@ map("i", "<M-Tab>", "<C-x><C-o>")
--------------------------------
-- Filetype specific mappings --
--------------------------------

au("FileType", {
  pattern = {"help"},
  callback = function () mapbuf("n", "q", "<cmd>q<cr>") end
  pattern = {"help", "qf"},
  callback = function() mapbuf("n", "q", "<cmd>q<cr>") end
})


--------------------------
-- Select mode mappings --
--------------------------
-- Requires 'mini.surround' for 'sa' and Comment.nvim for 'gb'
map("s", '(',  "<C-o>sa(gvll<C-g>", {remap = true})
map("s", ')',  "<C-o>sa)gvll<C-g>", {remap = true})
map("s", '\'', "<C-o>sa'gvll<C-g>", {remap = true})
map("s", '"',  '<C-o>sa"gvll<C-g>', {remap = true})
map("s", '`',  "<C-o>sa`gvll<C-g>", {remap = true})
map("s", '<C-/>',  "<C-v>vgb", {remap = true})

-- Select mode tips (:h Select)
-- * Ctrl-G toggles Visual and Select mode
-- * Ctrl-R <register> let's you put what ever you replaced into register
-- Visual mode mappings apply to select mode unless it is a printable character
-- or <cr>, or above key sequences and <C-o>
--
-- Visual mode tips
-- * You can use 'p' on selection and it will be replaced by paste
-- * 'P' is same except it does not overwrite registers
-- * gn/gN select match
-- * ~ Switch case (or u/U)
-- Visual block
-- * I/A can be used in place of i/a
-- * >/< shift can be used!

M .config/nvim/lua/loadlazy.lua => .config/nvim/lua/loadlazy.lua +6 -29
@@ 1,3 1,5 @@
-- Bootstrap and set up lazy.nvim
-- Lazy.nvim is one of the things to keeps me from emacs ๐Ÿ’”
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({


@@ 15,42 17,17 @@ vim.cmd [[
  filetype indent on
]]

require("lazy").setup("plugin_spec", {
require("lazy").setup("plugins", {
  install = {
    colorscheme = { "tundra" },
  },
  change_detection = {
    -- I still have to quit and reopen nvim after a new plugin install anyway,
    -- so this feature is useless and annoying.
    enabled = false,
    enabled = true,
    notify = false,
  },
  ui = {
    -- a number <1 is a percentage., >1 is a fixed size
    size = { width = 1, height = 1 },
    icons = {
      cmd = "๎ฏ‡ ",
      config = "๏€“",
      event = "๎ช†",
      ft = "๏€– ",
      init = "๏€“ ",
      import = "๎‰ฝ ",
      keys = "๏„œ ",
      lazy = "๓ฐ’ฒ ",
      loaded = "โ—",
      not_loaded = "โ—‹",
      plugin = "๏’‡ ",
      runtime = "๎žฅ",
      require = "๓ฐขฑ ",
      source = "๏„ก ",
      start = "๎ซ“",
      task = "โœ” ",
      list = {
        "โ—",
        "โžœ",
        "โ˜…",
        "โ€’",
      },
    },
    size = { width = 0.8, height = 0.9 },
    border = "rounded",
  },
})

D .config/nvim/lua/plugin_spec.lua => .config/nvim/lua/plugin_spec.lua +0 -643
@@ 1,643 0,0 @@
-- Used by Lazy.nvim in loadlazy.lua
--
-- Note on styling:
--    { "plugin src",   <-- ugly, but useful
--      option = value,
--      option = value,
--    }
-- The "plugin src" is joined on the same line as opening brace so
-- treesitter-context can show the plugin name. Useful since some of the plugin
-- specs could be long.
return {
  { "dracula/vim",
    name = "dracula", lazy = false, priority = 10000,
    config = function() vim.cmd("colorscheme dracula") end,
    enabled = false, -- LOL I've switched to tundra semi-temporarily
  },
  -- The thing about using dracula theme in nvim here is the annoyance of
  -- having to use lua APIs to interact with something that was designed for
  -- vimscript. With "modern" nvim plugins where the themes are written in 100%
  -- lua, configuring everything else (such as statusline colors) reusing
  -- values defined in these themes provide a much smoother, cleaner
  -- configuration.
  --
  -- This is by no means a /political/ (ahem) statement suggesting my
  -- abandoning of the holy dracula theme. I just, well, decided to try
  -- something new since I sort of realized there is no "perfect" or "best"
  -- theme.
  --
  -- After hours of blood, pain, and tears of trying to tweak dracula colors to
  -- be easier on the eyes and have greater contrast, I took one look at the
  -- carousel of themes from NvChad and fell in love with tundra...
  { "sam4llis/nvim-tundra", lazy = false, priority = 10000,
    config = function () require("plugins/tundra") end,
  },
  -- Use 'gf' with dot.separated.modules in lua.
  -- Put the cursor at the argument in "require" and press "gf" to see the effect.
  "sam4llis/nvim-lua-gf",
  { "nvim-tree/nvim-tree.lua",
    cmd = {"NvimTreeOpen", "NvimTreeToggle", "NvimTreeFindFile", "NvimTreeFocus", "NvimTreeFindFileToggle"},
    keys = { "<leader>e" },
    config = function ()
      vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<cr>",
        { desc = "NvimTreeToggle" })
      require("nvim-tree").setup {
        view = { width = 20, },
        -- renderer = { group_empty = true, },
        -- filters = { dotfiles = true, },
      }
    end,
  },
  -- "jreybert/vimagit",  -- emacs' magit โœจ
  -- So anyways apparently almost every plugin that was popular in vim had to
  -- be rewritten in lua.
  { "NeogitOrg/neogit",
    cmd = "Neogit",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-telescope/telescope.nvim",
      "sindrets/diffview.nvim",        -- optional
      -- "ibhagwan/fzf-lua",           -- optional
    },
    opts = {
      integrations = {
        -- Use telescope for menu selection rather than vim.ui.select.
        -- Allows multi-select and some things that vim.ui.select doesn't.
        telescope = true,
        -- The diffview integration enables the diff popup.
        diffview = true,
      },
    }
  },
  -- "tpope/vim-surround",  -- quoting and parenthesizing manipulation
  -- "tpope/vim-commentary", -- I'd rather not clog <Leader> mappings with nerd commentor
  -- Sorry tpope! It's more convenient to configure in lua than in vim...
  --   * nvim-comment is lighter but doesn't, AFAIK, support block comments.
  --   * mini.surround let's you add quotes easily (defined above)
  { "numToStr/Comment.nvim", opts = {} },
  { "lewis6991/gitsigns.nvim",
    -- "Be the diff you wish see in the gutter" -- Doom Emacs
    -- Also see comparison with vim-gitgutter:
    -- https://github.com/lewis6991/gitsigns.nvim?tab=readme-ov-file#comparison-with-vim-gitgutter
    enabled = vim.fn.has("nvim-0.8") == 1,
    opts = {
      -- NO WAY! โค๏ธ
      yadm = { enable = true },
    },
  },
  { "folke/trouble.nvim",
    enabled = vim.fn.has("nvim-0.7.2") == 1,
    cmd = "Trouble",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    opts = {
      signs = {
        -- icons / text used for a diagnostic
        error = "E:",
        warning = "W:",
        hint = "H:",
        information = "I:",
        other = "X:",
      },
      fold_open = "๏‘ผ", -- icon used for open folds
      fold_closed = "๏‘ ", -- icon used for closed folds
    },
  },
  { 'stevearc/aerial.nvim',
    enabled = false,
    opts = {
      filter_kind = false,
    },
    -- Optional dependencies
    dependencies = {
      "nvim-treesitter/nvim-treesitter",
      "nvim-tree/nvim-web-devicons"
    },
  },
  { dir = "~/projects/markdown-toc.nvim", ft = "markdown",
    opts = {
      -- fences = false,
      toc_list = {
        -- indent_size = function() return vim.bo.shiftwidth end,
      }
    },
  },
  { dir = "~/projects/outline.nvim",  -- See https://github.com/hedyhli/outline.nvim
    -- Switched to this from tagbar because it does not require exctags, and it
    -- lists the items in order as defined in source code.
    enabled = vim.fn.has("nvim-0.7") == 1,
    cmd = { "Outline", "OutlineOpen" },
    keys = {
      { "<leader>tt", "<cmd>Outline<CR>", desc = "Toggle outline window" },
      { "<leader>tT", "<cmd>Outline!<CR>", desc = "Toggle outline window without focus" },
      { "<leader>tf", "<cmd>OutlineFollow<CR>", desc = "Focus & follow outline window" },
    },
    config = function() require "plugins/outline" end,
  },
  -- "bling/vim-bufferline", -- I prefer this over taking over the tabline space thanks
  -- Fair well vim-bufferline! You have served my vim and nvim experience well.
  -- I've since decided to set cmdheight to 1 and put the buffers in my status
  -- bar :')
  -- See plugins/statusline.lua.
  -- TODO: Check if this is still needed
  "tpope/vim-endwise",     -- Add those 'endif'/'fi'/'done'
  { "moll/vim-bbye",       -- smart buffer closer
    config = function()
      local function d(s) return { desc = s } end
      local function map(...) vim.keymap.set(...) end
      map("n", "<Leader>bd", "<cmd>Bdelete<cr>", d"Bdelete")
      map("n", "<Leader>bx", "<cmd>Bwipeout<cr>", d"like bd but removes from jumplist")
    end
  },
  { "nvim-tree/nvim-web-devicons", lazy = true,
    enabled = vim.fn.has("nvim-0.7") == 1,
    config = function() require('plugins/icons') end,
    pin = true,
    commit = 'cde67b5d5427daeecfd7c77cf02ded23a26980bb',
  },
  { -- STATUS LINE
    "nvim-lualine/lualine.nvim",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    config = function() require("plugins/statusline") end,
    enabled = false,
  },
  { "b0o/incline.nvim",
    config = function() require("plugins/incline") end,
  },
  { "tiagovla/scope.nvim",
    -- Tab-local buffer list.
    -- Similar to beframe (by prot) from emacs!
    config = true
  },
  { 'nvim-telescope/telescope.nvim', tag = '0.1.4',
    enabled = vim.fn.has("nvim-0.9") == 1,
    dependencies = {
      'nvim-lua/plenary.nvim',
      { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
    },
    config = function() require('plugins/telescope') end,
  },
  { "folke/todo-comments.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
    opts = {
      highlight = {
        multiline = false,
        -- The 3 lines below tunes down the coloring of the highlights. The
        -- color schemes and treesitter nowdays are already way too vibrant for
        -- my liking, and for someone who litters todo/fixme way too much
        -- everywhere, adding *wide* *bg* highlighting to them is just WAY TOO
        -- MUCH EYE CANDY AAAA
        before = "",
        keyword = "fg", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty.
        after = "", -- "fg" or "bg" or empty

        pattern = [[.*<(KEYWORDS)\s*]], -- (vim regex)
        comments_only = true, -- uses treesitter to match keywords in comments only
        max_line_len = 200,
        exclude = {}, -- filetypes
      },
    }
  },
  { "echasnovski/mini.files",
    -- Neat popout window to browse dirs and manipulate within the editor!
    cmd = "MiniFiles",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    config = function()
      require('mini.files').setup()
      vim.api.nvim_create_user_command('MiniFiles', function()
        MiniFiles.open()
      end, { desc = "Calls lua MiniFiles.open()" })
    end,
  },
  { "echasnovski/mini.surround", version = '*',
    opts = {
        -- Duration (in ms) of highlight when calling `MiniSurround.highlight()`
        highlight_duration = 500,
        -- Module mappings. Use `''` (empty string) to disable one.
        mappings = {
          add = 'sa', -- Add surrounding in Normal and Visual modes
          delete = 'ds', -- Delete surrounding -- Using "ds" for muscle memory compat
          find = 'sf', -- Find surrounding (to the right)
          find_left = 'sF', -- Find surrounding (to the left)
          highlight = 'sh', -- Highlight surrounding
          replace = 'cs', -- Replace surrounding -- muscle memory compat
          update_n_lines = 'sn', -- Update `n_lines`

          suffix_last = 'l', -- Suffix to search with "prev" method
          suffix_next = 'n', -- Suffix to search with "next" method
        },
        -- Number of lines within which surrounding is searched
        n_lines = 20,
        -- Whether to respect selection type:
        -- - Place surroundings on separate lines in linewise mode.
        -- - Place surroundings on each line in blockwise mode.
        respect_selection_type = false,
        -- How to search for surrounding (first inside current line, then inside
        -- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev',
        -- 'cover_or_nearest', 'next', 'prev', 'nearest'. For more details,
        -- see `:h MiniSurround.config`.
        search_method = 'cover',
        -- Whether to disable showing non-error feedback
        silent = false,
      },
  },
  { "echasnovski/mini.splitjoin",
    opts = {
      mappings = { -- both n/v modes
        toggle = 'gS',
        split = '',
        join = '',
      },
      detect = {
        -- Array of Lua patterns to detect region with arguments.
        -- Default: { '%b()', '%b[]', '%b{}' }
        brackets = nil,
        -- String Lua pattern defining argument separator
        separator = ',',
        -- Array of Lua patterns for sub-regions to exclude separators from.
        -- Enables correct detection in presence of nested brackets and quotes.
        -- Default: { '%b()', '%b[]', '%b{}', '%b""', "%b''" }
        exclude_regions = nil,
      },
      -- Split options
      split = {
        hooks_pre = {},
        hooks_post = {},
      },
      -- Join options
      join = {
        hooks_pre = {},
        hooks_post = {},
      },
    }
  },
  { "echasnovski/mini.trailspace",
    config = true,
  },
  { "lukas-reineke/indent-blankline.nvim", name = "ibl",
    -- https://github.com/lukas-reineke/indent-blankline.nvim/wiki/Migrate-to-version-3
    -- Not documented but it appears new version requires nvim nightly.
    -- Upgraded to nvim 0.9.4 and the new version worked with showing context
    -- without needing treesitter! ๐ŸŽ‰
    after = "sam4llis/nvim-tundra",
    main = vim.fn.has("nvim-0.9") == 1 and "ibl",
    version = vim.fn.has("nvim-0.9") == 1 and "*" or "2.20.8",
    pin = vim.fn.has("nvim-0.9") == 0,
    opts = {
      -- scope = {
      --   highlight = "ErrorMsg",
      -- },
      exclude = {
        filetypes = {
          "help",
          "NvimTree",
          "Trouble",
          "trouble",
          "lazy",
          "mason",
          "notify",
          "toggleterm",
          "lazyterm",
          "Outline"
        },
      },
    },
  },
  { "RRethy/vim-illuminate",
    config = function ()
			require("illuminate").configure{}
			vim.cmd([[hi def IlluminatedWordText guibg=Gray]])
		end,
		enabled = false, -- Somehow wasn't working for me
  },

  --- File type, syntax, language helper plugins ---
  { url = "https://git.sr.ht/~torresjrjr/gemini.vim", ft = "gemini" },
  { "cespare/vim-toml", ft = "toml" },
  { "blankname/vim-fish", ft = "fish",
    config = function ()
      vim.opt_local.shiftwidth = 4
      vim.opt_local.textwidth = 79
      vim.opt_local.foldmethod = "expr"
      vim.opt_local.expandtab = true
      vim.opt_local.tabstop = 4
    end,
  },
  { url = "https://git.rawtext.club/slope-lang/slope-vim-syntax",
    ft = "slope",
    enabled = false;
  },
  { "mzlogin/vim-markdown-toc", ft = "markdown",
  },
  { "leafo/moonscript-vim", ft = "moon",
    config = function ()
      vim.opt_local.tabstop = 2
      vim.opt_local.softtabstop = 2
      vim.opt_local.shiftwidth = 2
    end
  },

  ------ LSP and autopair plugins ------
  -- This plugin below is really good, but whenever I'm on a commented line,
  -- press o, press backspace, the line below is joined up above. You won't
  -- believe how long it took me to debug this problem and finally realize it's
  -- because of this plugin.
  -- "jiangmiao/auto-pairs",
  --
  -- So now I'm using this instead:
  --    windwp/nvim-autopairs - extremely customizable, written in lua -
  --    integrates wth hrsh7th/nvim-cmp
  -- For nvim < 0.5, use: townk/vim-autoclose
  { "mfussenegger/nvim-lint",
    enabled = vim.fn.has("nvim-0.6") == 1,
    config = function() require("plugins/linting") end,
  },
  { "windwp/nvim-autopairs",
    commit = vim.fn.has("nvim-0.7") == 1 and "b7672cd",
    config = function() require("plugins/autopair") end,
  },

  -- Best IDE autocomplete setup ever
  -- INSANE level of customizability within an environment as confortable as
  -- lua and with stability as solid as an obsidian.
  { "neovim/nvim-lspconfig",
    config = function()
      require('plugins/lsp')
    end
  },
  { "ray-x/lsp_signature.nvim",
    event = "VeryLazy",
    config = function(_, opts) require'lsp_signature'.setup(opts) end,
    opts = {
      doc_lines = 10,
      -- set to 0 if you DO NOT want any API comments be shown
      -- This setting only take effect in insert mode, it does not affect signature help in normal
      -- mode, 10 by default
      max_height = 12,
      max_width = 80,
      noice = false,
      wrap = true,
      floating_window = false,
      floating_window_above_cur_line = true,
      floating_window_off_x = 1,
      floating_window_off_y = 0, -- -2 move window up 2 lines; 2 move down 2 lines
      -- can be either number or function, see examples
      close_timeout = 4000,
      fix_pos = false,  -- don't auto-close the floating window all parameters finished
      hint_enable = true, -- virtual hint
      hint_prefix = "๎ชซ ",
      hint_scheme = "String",
      hint_inline = function() return vim.fn.has('nvim-0.10') == 1 end,
      hi_parameter = "LspSignatureActiveParameter",
      handler_opts = { border = "rounded" },
      always_trigger = false,
      auto_close_after = nil,
      extra_trigger_chars = {","},
      zindex = 200,
      padding = '',
      transparency = nil, -- 1~100
      timer_interval = 200, -- lower to reduce latency
      toggle_key = '<M-s>', -- toggle floating window key (must set below to true)
      toggle_key_flip_floatwin_setting = true,
      select_signature_key = '<M-n>', -- next signature for (eg) overloads
    },
  },
  -- Treesitter!
  { "nvim-treesitter/nvim-treesitter",
    enabled = vim.fn.has('nvim-0.9') == 1,
    build = ":TSUpdate",
    version = false,
    event = "VeryLazy",
    cmd = { "TSUpdateSync", "TSUpdate", "TSInstall", "Inspect", "InspectTree" },
    config = function() require("plugins/treesitter") end,
  },
  -- Setting these as dependencies of nvim-treesitter causes error of invalid
  -- query.
  { "nvim-treesitter/nvim-treesitter-context",
    enabled = vim.fn.has('nvim-0.9') == 1,
    after = "nvim-treesitter/nvim-treesitter",
  },
  { "nvim-treesitter/nvim-treesitter-textobjects",
    enabled = vim.fn.has('nvim-0.9') == 1,
    after = "nvim-treesitter/nvim-treesitter",
  },
  { "windwp/nvim-ts-autotag",
    -- Automatically add closing tags for HTML and JSX
    ft = { "html", "tsx", "jsx" },
    opts = {},
  },
  -- End of treesitter
  -- Begin completion framework
  -- Please see ./lua/plugins/complete.lua
  { "hrsh7th/nvim-cmp",
    event = { "InsertEnter", "CmdlineEnter" },
    config = function() require('plugins/complete') end,
    dependencies = {
      "hrsh7th/cmp-nvim-lsp",
      "hrsh7th/cmp-path",       -- File paths
      "hrsh7th/cmp-cmdline",    -- Fire your way through the neovim cmd line
      "hrsh7th/cmp-calc",       -- Somehwat useful.. But emacs M-x calc FTW!
      "hrsh7th/cmp-emoji",      -- ๐Ÿ˜ :smirk:
      "mtoohey31/cmp-fish",
      "petertriho/cmp-git",
      "kdheepak/cmp-latex-symbols", -- ฯ„ long live \tau
      -- "dcampos/nvim-snippy", -- Adding it here does not apply opts
      "dcampos/cmp-snippy",
    },
  },
  { "dcampos/nvim-snippy",
    opts = {
      -- mappings to navigate expansion fields are merged in plugins/complete.lua
      mappings = {
        is = {},
        nx = {
          ['<leader>sx'] = 'cut_text',
        },
      },
    }
  },
  { "onsails/lspkind.nvim",
  },
  { "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
    config = function()
      require("lsp_lines").setup()

      vim.diagnostic.config({ virtual_lines = false })
      vim.api.nvim_create_autocmd("BufReadPost", {
        pattern = "*",
        callback = function()
          vim.b.lsp_lines_enabled = false
        end
      })

      vim.keymap.set("n", "<Leader>ll", function()
        require("lsp_lines").toggle()
        -- Disable virtual_text since it's redundant due to lsp_lines.
        if vim.b.lsp_lines_enabled then
          -- IT was enabled, now it's disabled.
          vim.diagnostic.config({ virtual_text = true })
          vim.b.lsp_lines_enabled = false
        else
          vim.diagnostic.config({ virtual_text = false })
          vim.b.lsp_lines_enabled = true
        end
      end , {desc = "Toggle Lsp Lines"})
    end,
  },
  { "xeluxee/competitest.nvim",
    dependencies = "MunifTanjim/nui.nvim",
    config = function() require("plugins/competitest") end,
  },
  { "nvim-neorg/neorg",
    -- Org... and better? I sure hope so!
    cmd = "Neorg",
    ft = "norg",
    build = ":Neorg sync-parsers",
    dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" },
    config = function()
      require("neorg").setup {
        load = {
          ["core.defaults"] = {}, -- Loads default behaviour
          ["core.concealer"] = {
            config = {
              folds = true,
            }
          },
          ["core.dirman"] = { -- Manages Neorg workspaces
            config = {
              workspaces = { neorg = "~/neorg" },
              default_workspace = "neorg"
            },
          },
          ["core.completion"] = {
            config = {
              engine = "nvim-cmp",
              name = "๎ด€ "
            },
          },
          ["core.highlights"] = {
            config = {
              highlights = {
                tags = {
                  ranged_verbatim = {
                    parameters = "guifg=#9ca3af",
                    begin = "guifg=#9ca3af",
                    ["end"] = "guifg=#9ca3af",
                    name =  {
                      word = "guifg=#9ca3af",
                    },
                  },
                },
              },
            },
          },
        },
      }
    end,
  },
  { "folke/which-key.nvim",
    -- The most mind blowing steal from ever

    event = "VeryLazy",
    enabled = false,
    init = function()
      vim.o.timeout = true
      vim.o.timeoutlen = 600
    end,
    opts = {
      plugins = {
        marks = true, -- shows a list of your marks on ' and `
        registers = false, -- Slightly annoying
        -- Although it reminds me of my calculator giving me a similar preview
        -- of stored variables upon the "recall" key haha
        spelling = {
          enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
          suggestions = 20, -- how many suggestions should be shown in the list?
        },
        presets = {
          operators = true, -- adds help for operators like d, y, ...
          motions = true, -- adds help for motions
          text_objects = true, -- help for text objects triggered after entering an operator
          windows = true, -- default bindings on <c-w>
          nav = true, -- misc bindings to work with windows
          z = true, -- bindings for folds, spelling and others prefixed with z
          g = true, -- bindings for prefixed with g
        },
      },
      -- add operators that will trigger motion and text object completion
      -- to enable all native operators, set the preset / operators plugin above
      operators = { gc = "Comments" },
      key_labels = {
        -- ["<space>"] = "SPC",
        -- ["<cr>"] = "RET",
        -- ["<tab>"] = "TAB",
      },
      motions = { count = true, },
      icons = {
        breadcrumb = "ยป", -- symbol used in the command line area that shows your active key combo
        separator = "=", -- symbol used between a key and it's label
        group = "+", -- symbol prepended to a group
      },
      popup_mappings = {
        scroll_down = "<c-d>", -- binding to scroll down inside the popup
        scroll_up = "<c-u>", -- binding to scroll up inside the popup
      },
      window = {
        border = "shadow", -- none, single, double, shadow
        position = "bottom", -- bottom, top
        margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left]. When between 0 and 1, will be treated as a percentage of the screen size.
        padding = { 0, 1, 0, 1 }, -- extra window padding [top, right, bottom, left]
        winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent
        zindex = 1000, -- positive value to position WhichKey above other floating windows.
      },
      layout = {
        height = { min = 4, max = 20 }, -- min and max height of the columns
        width = { min = 20, max = 50 }, -- min and max width of the columns
        spacing = 2, -- spacing between columns
        align = "left", -- align columns left, center or right
      },
      ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
      -- hide mapping boilerplate
      hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "^:", "^ ", "^call ", "^lua " },
      show_help = true, -- show a help message in the command line for using WhichKey
      show_keys = true, -- show the currently pressed key and its label as a message in the command line
      triggers = "auto", -- automatically setup triggers
      -- triggers = {"<leader>"} -- or specifiy a list manually
      -- list of triggers, where WhichKey should not wait for timeoutlen and show immediately
      triggers_nowait = {
        -- marks
        "`",
        "'",
        "g`",
        "g'",
        -- registers
        -- '"',
        -- "<c-r>",
        -- spelling
        "z=",
      },
      triggers_blacklist = {
        -- list of mode / prefixes that should never be hooked by WhichKey
        -- this is mostly relevant for keymaps that start with a native binding
        i = { "j", "k" },
        v = { "j", "k" },
      },
      -- disable the WhichKey popup for certain buf types and file types.
      -- Disabled by default for Telescope
      disable = {
        buftypes = {},
        filetypes = {},
      },
    }
  },
  "folke/neodev.nvim",
  -- TODO: check nvim version
  { "mfussenegger/nvim-dap",
    config = function() require("plugins/dap") end,
  },
  { "theHamsta/nvim-dap-virtual-text",
    dependencies = {"mfussenegger/nvim-dap"},
  },
  { "rcarriga/nvim-dap-ui",
    dependencies = {"mfussenegger/nvim-dap"},
  },
}

A .config/nvim/lua/plugins.lua => .config/nvim/lua/plugins.lua +165 -0
@@ 0,0 1,165 @@
-- Used by Lazy.nvim in loadlazy.lua
--
-- These are plugins that don't have their own dedicated config
-- file in plugins/
return {
  -- Use 'gf' with dot.separated.modules in lua.
  -- Put the cursor at the argument in "require" and press "gf" to see the effect.
  "sam4llis/nvim-lua-gf",

  { "nvim-tree/nvim-tree.lua",
    cmd = {"NvimTreeOpen", "NvimTreeToggle", "NvimTreeFindFile", "NvimTreeFocus", "NvimTreeFindFileToggle"},
    keys = { { "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = ":NvimTreeToggle" } },
    config = function ()
      require("nvim-tree").setup {
        view = { width = 20, },
        -- renderer = { group_empty = true, },
        -- filters = { dotfiles = true, },
      }
    end,
  },
  -- "jreybert/vimagit",  -- emacs' magit โœจ
  -- So anyways apparently almost every plugin that was popular in vim had to
  -- be rewritten in lua.
  { "NeogitOrg/neogit",
    cmd = "Neogit",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-telescope/telescope.nvim",
      "sindrets/diffview.nvim",        -- optional
      -- "ibhagwan/fzf-lua",           -- optional
    },
    opts = {
      integrations = {
        telescope = true,
        -- The diffview integration enables the diff popup.
        diffview = true,
      },
    }
  },
  -- "tpope/vim-surround",  -- quoting and parenthesizing manipulation
  -- "tpope/vim-commentary", -- I'd rather not clog <Leader> mappings with nerd commentor
  -- Sorry tpope! It's more convenient to configure in lua than in vim...
  --   * nvim-comment is lighter but doesn't, AFAIK, support block comments.
  --   * mini.surround let's you add quotes easily (defined above)
  { "numToStr/Comment.nvim", config = true },
  { "lewis6991/gitsigns.nvim",
    -- "Be the diff you wish see in the gutter" -- Doom Emacs
    -- Also see comparison with vim-gitgutter:
    -- https://github.com/lewis6991/gitsigns.nvim?tab=readme-ov-file#comparison-with-vim-gitgutter
    enabled = vim.fn.has("nvim-0.8") == 1,
    opts = {
      -- No way โค๏ธ
      yadm = { enable = true },
    },
  },
  { "folke/trouble.nvim",
    enabled = vim.fn.has("nvim-0.7.2") == 1,
    cmd = "Trouble",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    opts = {
      signs = {
        -- icons / text used for a diagnostic
        error = "E:",
        warning = "W:",
        hint = "H:",
        information = "I:",
        other = "X:",
      },
      fold_open = "๏‘ผ", -- icon used for open folds
      fold_closed = "๏‘ ", -- icon used for closed folds
    },
  },
  -- Full disclosure: I'm the maintainer of outline.nvim (see plugins/outline),
  -- just trying out aerial for fun :)
  { 'stevearc/aerial.nvim',
    enabled = true,
    cmd = { "AerialOpen", "AerialToggle", "AerialNavToggle" },
    opts = {
      -- Doesn't seem to work
      filter_kind = false,
    },
    -- Optional dependencies
    dependencies = {
      "nvim-treesitter/nvim-treesitter",
      "nvim-tree/nvim-web-devicons"
    },
  },
  -- "bling/vim-bufferline", -- I prefer this over taking over the tabline space thanks
  -- Fair well vim-bufferline! You have served my vim and nvim experience well.
  -- I've since decided to set cmdheight to 1 and put the buffers in my status
  -- bar :')
  -- See archived/statusline.lua.
  -- Now I've abandoned the notion of having to know opened buffers all the
  -- time. If I need it I can use bp/bn/bd and telescope buffers.
  -- TODO: Check if this is still needed
  "tpope/vim-endwise",     -- Add those 'endif'/'fi'/'done'
  { "moll/vim-bbye",       -- smart buffer closer
    config = function()
      local function d(s) return { desc = s } end
      local map = vim.keymap.set
      map("n", "<Leader>bd", "<cmd>Bdelete<cr>", d"Bdelete")
      map("n", "<Leader>bx", "<cmd>Bwipeout<cr>", d"like bd but removes from jumplist")
    end
  },
  { "carbon-steel/detour.nvim" },
  { "tiagovla/scope.nvim",
    -- Tab-local buffer list.
    -- Similar to beframe (by prot) from emacs!
    config = true
  },
  { "folke/todo-comments.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
    opts = {
      highlight = {
        multiline = false,
        -- The 3 lines below tunes down the coloring of the highlights. The
        -- color schemes and treesitter nowdays are already way too vibrant for
        -- my liking, and for someone who litters todo/fixme way too much
        -- everywhere, adding *wide* *bg* highlighting to them is just WAY too
        -- much eye candy.
        before = "",
        keyword = "fg", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty.
        after = "", -- "fg" or "bg" or empty
        -- Require only one space before keyword so we don't match keywords
        -- in the middle of comments.
        pattern = [[\s<(KEYWORDS)\s*]], -- (vim regex)
        comments_only = true, -- uses treesitter to match keywords in comments only
        max_line_len = 200,
        exclude = {}, -- filetypes
      },
    }
  },
  { "lukas-reineke/indent-blankline.nvim", name = "ibl",
    -- https://github.com/lukas-reineke/indent-blankline.nvim/wiki/Migrate-to-version-3
    -- Not documented but it appears new version requires a higher version of nvim.
    -- Upgraded to nvim 0.9.4 and the new version worked with showing context
    -- without needing treesitter ๐ŸŽ‰
    main = vim.fn.has("nvim-0.9") == 1 and "ibl",
    version = vim.fn.has("nvim-0.9") == 1 and "*" or "2.20.8",
    pin = vim.fn.has("nvim-0.9") == 0,
    opts = {
      exclude = {
        filetypes = {
          "help",
          "NvimTree",
          "Trouble",
          "trouble",
          "lazy",
          "mason",
          "notify",
          "toggleterm",
          "lazyterm",
          "Outline",
        },
      },
    },
  },

  { "windwp/nvim-ts-autotag",
    -- Automatically add closing tags for HTML and JSX
    ft = { "html", "tsx", "jsx" },
    opts = {},
  },
  "folke/neodev.nvim",
}

M .config/nvim/lua/plugins/autopair.lua => .config/nvim/lua/plugins/autopair.lua +19 -0
@@ 1,5 1,24 @@
local function config()
require('nvim-autopairs').setup({
  enable_check_bracket_line = false,   -- Don't close pair when next char is a closing pair
  ignored_next_char = "[%w%.]",        -- will ignore alphanumeric and `.` symbol
  fast_wrap = {},
})
end

-- This plugin below is really good, but whenever I'm on a commented line,
-- press o, press backspace, the line below is joined up above. You won't
-- believe how long it took me to debug this problem and finally realize it's
-- because of this plugin.
-- "jiangmiao/auto-pairs",
--
-- So now I'm using this instead:
--    windwp/nvim-autopairs - extremely customizable, written in lua -
--    integrates wth hrsh7th/nvim-cmp
-- For nvim < 0.5, use: townk/vim-autoclose
return {
  "windwp/nvim-autopairs",
  commit = vim.fn.has("nvim-0.7") == 1 and "b7672cd",
  config = config,
  event = "InsertEnter",
}

M .config/nvim/lua/plugins/competitest.lua => .config/nvim/lua/plugins/competitest.lua +9 -0
@@ 1,3 1,4 @@
local function config()
vim.api.nvim_create_autocmd(
   { "FileType" },
   { pattern = "CompetiTest",


@@ 208,3 209,11 @@ require('competitest').setup {
  open_received_contests = true,
  replace_received_testcases = false,
}
end

return {
  "xeluxee/competitest.nvim",
  dependencies = "MunifTanjim/nui.nvim",
  config = config,
  ft = "cpp",
}

M .config/nvim/lua/plugins/complete.lua => .config/nvim/lua/plugins/complete.lua +33 -0
@@ 1,4 1,5 @@
-- https://github.com/hrsh7th/nvim-cmp
local function config()
local has_words_before = function()
  unpack = unpack or table.unpack
  local line, col = unpack(vim.api.nvim_win_get_cursor(0))


@@ 207,3 208,35 @@ cmp.event:on(
function _G.CmpDisable()
  cmp.setup.buffer { enabled = false }
end
end

return {
  { "hrsh7th/nvim-cmp",
    event = { "InsertEnter", "CmdlineEnter" },
    config = config,
    dependencies = {
      "hrsh7th/cmp-nvim-lsp",
      "hrsh7th/cmp-path",       -- File paths
      "hrsh7th/cmp-cmdline",    -- Fire your way through the neovim cmd line
      "hrsh7th/cmp-calc",       -- Somehwat useful.. But emacs M-x calc FTW!
      "hrsh7th/cmp-emoji",      -- ๐Ÿ˜ :smirk:
      "mtoohey31/cmp-fish",
      "petertriho/cmp-git",
      "kdheepak/cmp-latex-symbols", -- ฯ„ long live \tau
      -- "dcampos/nvim-snippy", -- Adding it here does not apply opts
      "dcampos/cmp-snippy",
    },
  },
  { "dcampos/nvim-snippy",
    event = "InsertEnter",
    opts = {
      -- mappings to navigate expansion fields are merged in plugins/complete.lua
      mappings = {
        is = {},
        nx = {
          ['<leader>sx'] = 'cut_text',
        },
      },
    }
  },
}

M .config/nvim/lua/plugins/dap.lua => .config/nvim/lua/plugins/dap.lua +21 -0
@@ 1,3 1,4 @@
local function config()
local dap = require('dap')
dap.adapters.python = function(cb, config)
  if config.request == 'attach' then


@@ 79,3 80,23 @@ vim.api.nvim_create_user_command(
    nargs = '?',
    complete = function() return {'sidebar', 'tray'} end,
  })
end

return {
  -- TODO: check nvim version
  { "mfussenegger/nvim-dap",
    config = config,
    lazy = true,
    cmd = {"DapToggleBreakpoint", "DapContinue"},
  },
  { "theHamsta/nvim-dap-virtual-text",
    lazy = true,
    cmd = {"DapToggleBreakpoint", "DapContinue"},
    dependencies = {"mfussenegger/nvim-dap"},
  },
  { "rcarriga/nvim-dap-ui",
    lazy = true,
    cmd = {"DapToggleBreakpoint", "DapContinue"},
    dependencies = {"mfussenegger/nvim-dap"},
  },
}

A .config/nvim/lua/plugins/ft.lua => .config/nvim/lua/plugins/ft.lua +35 -0
@@ 0,0 1,35 @@
return {
  --- File type, syntax, language helper plugins ---
  { url = "https://git.sr.ht/~torresjrjr/gemini.vim", ft = "gemini" },
  { "cespare/vim-toml", ft = "toml" },
  { "blankname/vim-fish", ft = "fish",
    config = function ()
      vim.opt_local.shiftwidth = 4
      vim.opt_local.textwidth = 79
      vim.opt_local.foldmethod = "expr"
      vim.opt_local.expandtab = true
      vim.opt_local.tabstop = 4
    end,
  },
  { url = "https://git.rawtext.club/slope-lang/slope-vim-syntax",
    ft = "slope",
    enabled = false;
  },
  { "mzlogin/vim-markdown-toc", ft = "markdown",
  },
  { dir = "~/projects/markdown-toc.nvim", ft = "markdown",
    opts = {
      -- fences = false,
      toc_list = {
        -- indent_size = function() return vim.bo.shiftwidth end,
      }
    },
  },
  { "leafo/moonscript-vim", ft = "moon",
    config = function ()
      vim.opt_local.tabstop = 2
      vim.opt_local.softtabstop = 2
      vim.opt_local.shiftwidth = 2
    end
  },
}

M .config/nvim/lua/plugins/icons.lua => .config/nvim/lua/plugins/icons.lua +10 -0
@@ 3,6 3,7 @@
-- Used by lazy, nvim-tree, and others

-- https://github.com/nvim-tree/nvim-web-devicons
local function config()
require'nvim-web-devicons'.setup {
  -- your personnal icons can go here (to override)
  -- you can specify color or cterm_color instead of specifying both of them


@@ 38,3 39,12 @@ require'nvim-web-devicons'.setup {
    }
  },
}
end

return {
  "nvim-tree/nvim-web-devicons", lazy = true,
  enabled = vim.fn.has("nvim-0.7") == 1,
  config = function() require('plugins/icons') end,
  pin = true,
  commit = 'cde67b5d5427daeecfd7c77cf02ded23a26980bb',
}

M .config/nvim/lua/plugins/incline.lua => .config/nvim/lua/plugins/incline.lua +8 -0
@@ 1,3 1,5 @@
local function config()

local cp = require('nvim-tundra.palette.arctic')
local a = vim.api
local f = vim.fn


@@ 144,3 146,9 @@ require('incline').setup {
    zindex = 50
  }
}
end

return {
  "b0o/incline.nvim",
  config = config,
}

M .config/nvim/lua/plugins/linting.lua => .config/nvim/lua/plugins/linting.lua +10 -0
@@ 1,4 1,6 @@
-- https://github.com/errata-ai/vale/releases

local function config()
local lint = require('lint')
lint.linters_by_ft = {
  markdown = {'codespell'},


@@ 10,3 12,11 @@ lint.linters_by_ft = {
}

vim.api.nvim_create_autocmd("BufWritePost", { pattern = "*", callback = function() lint.try_lint() end })
end

return {
  "mfussenegger/nvim-lint",
  enabled = vim.fn.has("nvim-0.6") == 1,
  config = config,
  event = {"BufWritePost", "InsertEnter"}
}

M .config/nvim/lua/plugins/lsp.lua => .config/nvim/lua/plugins/lsp.lua +72 -0
@@ 1,3 1,4 @@
local function config()
-- IMPORTANT: make sure to setup neodev BEFORE lspconfig
require("neodev").setup({
  setup_jsonls = false,


@@ 137,3 138,74 @@ lspconfig.lua_ls.setup {
    },
  },
}
end

return {
  { "neovim/nvim-lspconfig",
    config = config,
    ft = {"python", "go", "markdown", "lua", "vim", "bash"},
  },
  { "ray-x/lsp_signature.nvim",
    event = "VeryLazy",
    opts = {
      doc_lines = 10,
      -- set to 0 if you DO NOT want any API comments be shown
      -- This setting only take effect in insert mode, it does not affect signature help in normal
      -- mode, 10 by default
      max_height = 12,
      max_width = 80,
      noice = false,
      wrap = true,
      floating_window = false,
      floating_window_above_cur_line = true,
      floating_window_off_x = 1,
      floating_window_off_y = 0, -- -2 move window up 2 lines; 2 move down 2 lines
      -- can be either number or function, see examples
      close_timeout = 4000,
      fix_pos = false,  -- don't auto-close the floating window all parameters finished
      hint_enable = true, -- virtual hint
      hint_prefix = "๎ชซ ",
      hint_scheme = "String",
      hint_inline = function() return vim.fn.has('nvim-0.10') == 1 end,
      hi_parameter = "LspSignatureActiveParameter",
      handler_opts = { border = "rounded" },
      always_trigger = false,
      auto_close_after = nil,
      extra_trigger_chars = {","},
      zindex = 200,
      padding = '',
      transparency = nil, -- 1~100
      timer_interval = 200, -- lower to reduce latency
      toggle_key = '<M-s>', -- toggle floating window key (must set below to true)
      toggle_key_flip_floatwin_setting = true,
      select_signature_key = '<M-n>', -- next signature for (eg) overloads
    },
  },
  { "onsails/lspkind.nvim" },
  { "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
    config = function()
      require("lsp_lines").setup()

      vim.diagnostic.config({ virtual_lines = false })
      vim.api.nvim_create_autocmd("BufReadPost", {
        pattern = "*",
        callback = function()
          vim.b.lsp_lines_enabled = false
        end
      })

      vim.keymap.set("n", "<Leader>ll", function()
        require("lsp_lines").toggle()
        -- Disable virtual_text since it's redundant due to lsp_lines.
        if vim.b.lsp_lines_enabled then
          -- IT was enabled, now it's disabled.
          vim.diagnostic.config({ virtual_text = true })
          vim.b.lsp_lines_enabled = false
        else
          vim.diagnostic.config({ virtual_text = false })
          vim.b.lsp_lines_enabled = true
        end
      end , {desc = "Toggle Lsp Lines"})
    end,
  },
}

A .config/nvim/lua/plugins/mini.lua => .config/nvim/lua/plugins/mini.lua +130 -0
@@ 0,0 1,130 @@
-- Ordered in discovery date of these high-quality, self-contained and
-- minimalist plugins. Finding myself using switching to more of more of
-- ones from the library and eventually found the need to extract it to a
-- dedicated file.

return {
  { "echasnovski/mini.files",
    -- Neat popout window to browse dirs and manipulate within the editor!
    cmd = "MiniFiles",
    keys = { { "<leader>E", "<cmd>MiniFiles<cr>",  desc = ":MiniFiles" } },
    dependencies = { "nvim-tree/nvim-web-devicons" },
    config = function()
      require('mini.files').setup{}
      vim.api.nvim_create_user_command('MiniFiles', function()
        require('mini.files').open(nil, false)
      end, { desc = ":lua MiniFiles.open()" })
    end,
  },
  { "echasnovski/mini.surround", version = '*',
    opts = {
      -- Duration (in ms) of highlight when calling `MiniSurround.highlight()`
      highlight_duration = 500,
      -- Module mappings. Use `''` (empty string) to disable one.
      mappings = {
        add = 'sa',
        delete = 'ds', -- Using "ds" for muscle memory compat
        find = 'sf', -- Find surrounding (to the right)
        find_left = 'sF', -- Find surrounding (to the left)
        highlight = 'sh', -- Highlight surrounding
        replace = 'cs', -- Replace surrounding -- muscle memory compat
        update_n_lines = 'sn', -- Update `n_lines`

        suffix_last = 'l', -- Suffix to search with "prev" method
        suffix_next = 'n', -- Suffix to search with "next" method
      },
      -- Number of lines within which surrounding is searched
      n_lines = 20,
      -- Whether to respect selection type:
      -- - Place surroundings on separate lines in linewise mode.
      -- - Place surroundings on each line in blockwise mode.
      respect_selection_type = false,
      -- How to search for surrounding (first inside current line, then inside
      -- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev',
      -- 'cover_or_nearest', 'next', 'prev', 'nearest'. For more details,
      -- see `:h MiniSurround.config`.
      search_method = 'cover',
      -- Whether to disable showing non-error feedback
      silent = false,
    },
  },
  { "echasnovski/mini.splitjoin",
    opts = {
      mappings = { -- both n/v modes
        toggle = 'gS',
        split = '',
        join = '',
      },
      detect = {
        -- Array of Lua patterns to detect region with arguments.
        -- Default: { '%b()', '%b[]', '%b{}' }
        brackets = nil,
        -- String Lua pattern defining argument separator
        separator = ',',
        -- Array of Lua patterns for sub-regions to exclude separators from.
        -- Enables correct detection in presence of nested brackets and quotes.
        -- Default: { '%b()', '%b[]', '%b{}', '%b""', "%b''" }
        exclude_regions = nil,
      },
      -- Split options
      split = {
        hooks_pre = {},
        hooks_post = {},
      },
      -- Join options
      join = {
        hooks_pre = {},
        hooks_post = {},
      },
    }
  },
  { "echasnovski/mini.trailspace",
    config = true,
  },
  { "echasnovski/mini.clue",
    enabled = false,
    config = function()
      local miniclue = require "mini.clue"
      miniclue.setup {
        triggers = {
          { mode = 'n', keys = '<Leader>' },
          { mode = 'x', keys = '<Leader>' },
          { mode = 'n', keys = 'g' },
          { mode = 'x', keys = 'g' },
          -- Marks
          { mode = 'n', keys = "'" },
          { mode = 'n', keys = '`' },
          { mode = 'x', keys = "'" },
          { mode = 'x', keys = '`' },
          -- Registers
          { mode = 'n', keys = '"' },
          { mode = 'x', keys = '"' },
          { mode = 'i', keys = '<C-r>' },
          { mode = 'c', keys = '<C-r>' },

          { mode = 'n', keys = '<C-w>' },
          { mode = 'n', keys = 'z' },
          { mode = 'x', keys = 'z' },
        },

        clues = {
          -- Enhance this by adding descriptions for <Leader> mapping groups
          miniclue.gen_clues.builtin_completion(),
          miniclue.gen_clues.g(),
          miniclue.gen_clues.marks(),
          miniclue.gen_clues.registers(),
          miniclue.gen_clues.windows(),
          miniclue.gen_clues.z(),
        },
        window = {
          config = {
            width = 50,
          },
          delay = 800,
          scroll_down = '<C-d>',
          scroll_up = '<C-u>',
        },
      }
    end
  }
}

A .config/nvim/lua/plugins/norg.lua => .config/nvim/lua/plugins/norg.lua +49 -0
@@ 0,0 1,49 @@
-- Org... and better? I sure hope so!

return {
  "nvim-neorg/neorg",
  cmd = "Neorg",
  ft = "norg",
  build = ":Neorg sync-parsers",
  dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" },
  config = function()
    require("neorg").setup {
      load = {
        ["core.defaults"] = {}, -- Loads default behaviour
        ["core.concealer"] = {
          config = {
            folds = true,
          }
        },
        ["core.dirman"] = { -- Manages Neorg workspaces
          config = {
            workspaces = { neorg = "~/neorg" },
            default_workspace = "neorg"
          },
        },
        ["core.completion"] = {
          config = {
            engine = "nvim-cmp",
            name = "๎ด€ "
          },
        },
        ["core.highlights"] = {
          config = {
            highlights = {
              tags = {
                ranged_verbatim = {
                  parameters = "guifg=#9ca3af",
                  begin = "guifg=#9ca3af",
                  ["end"] = "guifg=#9ca3af",
                  name =  {
                    word = "guifg=#9ca3af",
                  },
                },
              },
            },
          },
        },
      },
    }
  end,
}

M .config/nvim/lua/plugins/outline.lua => .config/nvim/lua/plugins/outline.lua +52 -21
@@ 1,24 1,55 @@
require('outline').setup {
  preview_window = {
    border = 'rounded',
    open_hover_on_preview = false,
-- https://github.com/simrat39/symbols-outline.nvim
-- Switched to this from tagbar because it does not require exctags, and it
-- lists the items in order as defined in source code.
-- Then I ended up forking it...
-- https://github.com/hedyhli/outline.nvim

return {
  dir = "~/projects/outline.nvim",
  enabled = vim.fn.has("nvim-0.7") == 1,
  cmd = { "Outline", "OutlineOpen" },
  keys = {
    { "<leader>tt", "<cmd>Outline<CR>", desc = "Toggle outline window" },
    { "<leader>t<leader>", "<cmd>Outline!<CR>", desc = "Toggle outline window without focus" },
    { "<leader>tf", "<cmd>OutlineFollow<CR>", desc = "Focus & follow outline window" },
  },
  symbol_folding = {
    autofold_depth = 1,
    auto_unfold_hover = true,
  },
  guides = {
    enabled = true,
  },
  outline_window = {
    show_cursorline = true,
    hide_cursor = true,
    winhl = "OutlineDetails:LineNr,OutlineLineno:LineNr,OutlineGuides:Comment",
  },
  keymaps = {
    close = "q",
  },
  symbols = {
    icon_source = "lspkind",
  opts = {
    preview_window = {
      border = 'rounded',
      open_hover_on_preview = false,
    },
    symbol_folding = {
      -- Auto fold all but current hover
      autofold_depth = 1,
      auto_unfold_hover = true,
    },
    guides = {
      -- Keep only guides that indicate siblings that might span multiple lines (vertical)
      markers = {
        middle = ' ',
        bottom = ' ',
      }
    },
    outline_window = {
      show_cursorline = true,
      -- Beautiful, but not very good in indicating window focus (I don't use a
      -- statusline), plus at the time of writing preview window breaks this
      -- feature... But still beautiful nonetheless!
      hide_cursor = true,
      winhl = "OutlineDetails:LineNr,OutlineLineno:LineNr,OutlineGuides:Comment",
    },
    symbols = {
      icon_fetcher = function(k)
        local buf = vim.api.nvim_win_get_buf(require('outline').state.code_win)
        local ft = vim.api.nvim_buf_get_option(buf, "ft")
        -- There can only be kind String in markdown so... let's not have the
        -- eye candy here
        if ft == 'markdown' and k == 'String' then
          return ""
        end
        return false
      end,
      icon_source = "lspkind",
    },
  },
}

M .config/nvim/lua/plugins/telescope.lua => .config/nvim/lua/plugins/telescope.lua +21 -8
@@ 1,14 1,8 @@
local function config()

local function d(s) return { desc = s } end
local function map(...) vim.keymap.set(...) end

map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", d"Telescope find_files")
map("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", d"Telescope oldfiles")
map("n", "<leader>fg", "<cmd>Telescope live_grep<cr>", d"Telescope live_grep")
map("n", "<leader>fb", "<cmd>Telescope buffers<cr>", d"Telescope buffers")
map("n", "<leader>bb", "<cmd>Telescope buffers<cr>", d"Telescope buffers")
map("n", "<leader>fh", "<cmd>Telescope help_tags<cr>", d"Telescope help_tags")
map("n", "<leader>fR", "<cmd>Telescope registers<cr>", d"Telescope registers (also see <leader>rg)")

-- Go to dir of selected entry
local goto_dir = function(prompt_bufnr)
  local selection = require("telescope.actions.state").get_selected_entry()


@@ 65,6 59,14 @@ local reprompt_from_git_root = function(picker, prompt_bufnr)
  end
end

map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", d"Telescope find_files")
map("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", d"Telescope oldfiles")
map("n", "<leader>fg", "<cmd>Telescope live_grep<cr>", d"Telescope live_grep")
map("n", "<leader>fb", "<cmd>Telescope buffers<cr>", d"Telescope buffers")
map("n", "<leader>bb", "<cmd>Telescope buffers<cr>", d"Telescope buffers")
map("n", "<leader>fh", "<cmd>Telescope help_tags<cr>", d"Telescope help_tags")
map("n", "<leader>fR", "<cmd>Telescope registers<cr>", d"Telescope registers (also see <leader>rg)")

require('telescope').setup({
  defaults = {
    -- layout_config = {


@@ 104,3 106,14 @@ require('telescope').setup({
  },
})
require('telescope').load_extension('fzf')
end

return {
  'nvim-telescope/telescope.nvim', tag = '0.1.4',
  enabled = vim.fn.has("nvim-0.9") == 1,
  dependencies = {
    'nvim-lua/plenary.nvim',
    { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
  },
  config = config,
}

M .config/nvim/lua/plugins/treesitter.lua => .config/nvim/lua/plugins/treesitter.lua +48 -27
@@ 1,3 1,4 @@
local function config()
local configs = require("nvim-treesitter.configs")
configs.setup({
  ensure_installed = {


@@ 7,33 8,33 @@ configs.setup({
  highlight = { enable = true },
  indent = { enable = true },
  -- Textobjects, see below as well
  -- textobjects = {
  --   select = {
  --     enable = true,
  --     -- Automatically jump forward to textobj, similar to targets.vim
  --     lookahead = true,
  --     keymaps = {
  --       -- You can use the capture groups defined in textobjects.scm
  --       ["af"] = { query = "@function.outer", desc = "Around function" },
  --       ["if"] = { query = "@function.inner", desc = "Inside function" },
  --       ["ac"] = { query = "@class.outer", desc = "Around class" },
  --       ["ic"] = { query = "@class.inner", desc = "Inside class" },
  --       -- You can also use captures from other query groups like `locals.scm`
  --       ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
  --     },
  --     include_surrounding_whitespace = false,
  --   },
  --   move = {
  --     enable = true,
  --     set_jumps = true,
  --     goto_next = {
  --       ["]p"] = "@parameter.outer",
  --     },
  --     goto_previous = {
  --       ["[p"] = "@parameter.outer",
  --     },
  --   }
  -- },
  textobjects = {
    select = {
      enable = true,
      -- Automatically jump forward to textobj, similar to targets.vim
      lookahead = true,
      keymaps = {
        -- You can use the capture groups defined in textobjects.scm
        ["af"] = { query = "@function.outer", desc = "Around function" },
        ["if"] = { query = "@function.inner", desc = "Inside function" },
        ["ac"] = { query = "@class.outer", desc = "Around class" },
        ["ic"] = { query = "@class.inner", desc = "Inside class" },
        -- You can also use captures from other query groups like `locals.scm`
        ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
      },
      include_surrounding_whitespace = false,
    },
    move = {
      enable = true,
      set_jumps = true,
      goto_next = {
        ["]p"] = "@parameter.outer",
      },
      goto_previous = {
        ["[p"] = "@parameter.outer",
      },
    }
  },
})

-- TS context


@@ 89,3 90,23 @@ vim.keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f)
vim.keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F)
vim.keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t)
vim.keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T)
end

return {
  { "nvim-treesitter/nvim-treesitter",
    enabled = vim.fn.has('nvim-0.9') == 1,
    build = ":TSUpdate",
    version = false,
    event = "VeryLazy",
    cmd = { "TSUpdateSync", "TSUpdate", "TSInstall", "Inspect", "InspectTree" },
    config = config,
  },
  -- Setting these as dependencies of nvim-treesitter causes error of invalid
  -- query.
  { "nvim-treesitter/nvim-treesitter-context",
    enabled = vim.fn.has('nvim-0.9') == 1,
  },
  { "nvim-treesitter/nvim-treesitter-textobjects",
    enabled = vim.fn.has('nvim-0.9') == 1,
  },
}

M .config/nvim/lua/plugins/tundra.lua => .config/nvim/lua/plugins/tundra.lua +30 -3
@@ 1,3 1,25 @@
-- { "dracula/vim",
--   name = "dracula", lazy = false, priority = 10000,
--   config = function() vim.cmd("colorscheme dracula") end,
--   enabled = false, -- LOL I've switched to tundra semi-temporarily
-- },
-- The thing about using dracula theme in nvim here is the annoyance of having
-- to use lua APIs to interact with something that was designed for vimscript.
-- With "modern" nvim plugins where the themes are written in 100% lua,
-- configuring everything else (such as statusline colors) reusing values
-- defined in these themes provide a much smoother, cleaner configuration.
--
-- This is by no means a /political/ (ahem) statement suggesting my abandoning
-- of the holy dracula theme. I just, well, decided to try something new since
-- I sort of realized there is no "perfect" or "best" theme.
--
-- After hours of blood, pain, and tears of trying to tweak dracula colors to
-- be easier on the eyes and have greater contrast, I took one look at the
-- carousel of themes from NvChad and fell in love with tundra...
--
-- So I did find dracula.nvim, but I've already integrated tundra well.

local function config()
local s = require('nvim-tundra.stylesheet.arctic')

-- See also: statusline.lua for statusline colors (which I also use tundra's


@@ 46,9 68,7 @@ require("nvim-tundra").setup {
  overwrite = {
    colors = {},
    highlights = {
      TreesitterContext = { bg = s.cp.gray._700 },
      -- FIXME: Line number hl doesn't work
      TreesitterContextLineNumber = { fg = s.cp.gray._500, bg = s.cp.gray._700 },
      TreesitterContext = { bg = "#283343" },
      Folded = {
        fg = s.cp.gray._400,
        bg = s.cp.gray._700


@@ 67,3 87,10 @@ require("nvim-tundra").setup {

vim.o.background = "dark"
vim.cmd("colorscheme tundra")
end

return {
  -- Must be loaded before ibl!
  "sam4llis/nvim-tundra", lazy = false, priority = 10000,
  config = config,
}