From 833a1117258ddb6e1ce40792e115412ec50eef82 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 31 Aug 2023 17:41:50 -0500 Subject: [PATCH] feat(nvim): add neorg This does more than just the title. Bad commit? Yeah, probably. I'm not going to spend the time to chunk this correctly. 1. Add neorg 2. Remove Overseer as it had conflicting bindings I wanted to use and I never use Overseer 3. Yank a bunch of hop bindings that conflicted with new local leader key. I never used those hop bindings, so no loss there. 4. Add `image.nvim` that allows previewing images directly in Neovim. There's some issues with it for sure in Wezterm, but it works well enough. --- dots/.config/nvim/after/ftplugin/norg.lua | 7 -- dots/.config/nvim/lua/core/mappings.lua | 1 + dots/.config/nvim/lua/plugins/configs/hop.lua | 5 -- .../lua/plugins/configs/indent-blankline.lua | 2 +- .../nvim/lua/plugins/configs/neorg.lua | 87 +++++++++++++++++++ .../nvim/lua/plugins/configs/overseer.lua | 26 ------ 6 files changed, 89 insertions(+), 39 deletions(-) create mode 100644 dots/.config/nvim/lua/plugins/configs/neorg.lua delete mode 100644 dots/.config/nvim/lua/plugins/configs/overseer.lua diff --git a/dots/.config/nvim/after/ftplugin/norg.lua b/dots/.config/nvim/after/ftplugin/norg.lua index f256a176..adec580f 100644 --- a/dots/.config/nvim/after/ftplugin/norg.lua +++ b/dots/.config/nvim/after/ftplugin/norg.lua @@ -1,8 +1 @@ -vim.keymap.set("n", "fge", ":Neorg gtd edit", { - buffer = true, -}) -vim.keymap.set("n", "fgv", ":Neorg gtd views", { - buffer = true, -}) - vim.opt_local.shiftwidth = 2 diff --git a/dots/.config/nvim/lua/core/mappings.lua b/dots/.config/nvim/lua/core/mappings.lua index f2a87f21..ecda00bc 100755 --- a/dots/.config/nvim/lua/core/mappings.lua +++ b/dots/.config/nvim/lua/core/mappings.lua @@ -3,6 +3,7 @@ local M = {} M.setup = function() -- set mapleader to space vim.g.mapleader = " " + vim.g.maplocalleader = ";" -- Get rid of highlight after search vim.keymap.set("n", "", function() diff --git a/dots/.config/nvim/lua/plugins/configs/hop.lua b/dots/.config/nvim/lua/plugins/configs/hop.lua index f9402ed2..6842ccef 100644 --- a/dots/.config/nvim/lua/plugins/configs/hop.lua +++ b/dots/.config/nvim/lua/plugins/configs/hop.lua @@ -10,11 +10,6 @@ return { desc = "Hop: Character", mode = { "" }, }, - { ";l", "HopLineStart", desc = "Hop: Line Start" }, - { ";s", "HopPattern", desc = "Hop: Pattern" }, - { ";;", "HopWord", desc = "Hop: Word" }, - { ";a", "HopAnywhere", desc = "Hop: Anywhere" }, - { ";v", "HopVertical", desc = "Hop Vertical" }, }, cmd = { "HopLineStart", diff --git a/dots/.config/nvim/lua/plugins/configs/indent-blankline.lua b/dots/.config/nvim/lua/plugins/configs/indent-blankline.lua index 9bfd99e0..b35ea1f4 100644 --- a/dots/.config/nvim/lua/plugins/configs/indent-blankline.lua +++ b/dots/.config/nvim/lua/plugins/configs/indent-blankline.lua @@ -31,7 +31,7 @@ return { "NeogitLogView", } - g.indent_blankline_buftype_exclude = { "terminal" } + g.indent_blankline_buftype_exclude = { "terminal", "nofile" } g.indent_blankline_show_trailing_blankline_indent = false g.indent_blankline_show_first_indent_level = true diff --git a/dots/.config/nvim/lua/plugins/configs/neorg.lua b/dots/.config/nvim/lua/plugins/configs/neorg.lua new file mode 100644 index 00000000..adcbf85f --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/neorg.lua @@ -0,0 +1,87 @@ +return { + { + "3rd/image.nvim", + build = function() + ---@param out SystemCompleted + vim.system({"luarocks", "--lua-version", "5.1", "--local", "install", "magick"}, {}, function (out) + if out.code ~= 0 then + error("Failed to install `magick` luarock for image.nvim!", vim.log.levels.ERROR) + end + end) + end, + ft = {"markdown", "norg"}, + config = function() + package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua;" + package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua;" + require("image").setup({ + window_overlap_clear_enabled = true, + }) + end + }, + { + "nvim-neorg/neorg", + build = ":Neorg sync-parsers", -- This is the important bit! + cmd = { "Neorg" }, + ft = { "norg" }, + keys = { + { "o", desc = "> Neorg" }, + { "oj", ":Neorg journal custom", desc = "Neorg: Journal" }, + { "ot", ":Neorg toc", desc = "Neorg: Table of Contents" } + }, + config = function() + require("neorg").setup({ + load = { + ["core.defaults"] = {}, + ["core.completion"] = { + config = { + engine = "nvim-cmp" + } + }, + ["core.neorgcmd"] = {}, + ["core.summary"] = {}, + ["core.journal"] = { + config = { + stategy = "flat" + }, + workspace = "default" + }, + ["core.dirman"] = { + config = { + default_workspace = "default", + workspaces = { + default = "~/Notes" + }, + index = "index.norg" + } + }, + ["core.concealer"] = { + config = { + folds = false, + icon_preset = "diamond", + icons = { + code_block = { + conceal = true, + content_only = true, + }, + }, + } + }, + ["core.integrations.treesitter"] = { + config = { + configure_parsers = true, + install_parsers = true + } + }, + ["core.qol.todo_items"] = { + config = { + create_todo_items = true, + create_todo_parents = true + } + }, + ["core.ui"] = {}, + ["core.ui.calendar"] = {} + } + }) + end, + } +} diff --git a/dots/.config/nvim/lua/plugins/configs/overseer.lua b/dots/.config/nvim/lua/plugins/configs/overseer.lua deleted file mode 100644 index c5e4192e..00000000 --- a/dots/.config/nvim/lua/plugins/configs/overseer.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - { - "stevearc/overseer.nvim", - cmd = { - "OverseerRun", - "OverseerInfo", - "OverseerOpen", - "OverseerBuild", - "OverseerClose", - "OverseerRunCmd", - "OverseerToggle", - "OverseerClearCache", - "OverseerLoadBundle", - "OverseerSaveBundle", - "OverseerTaskAction", - "OverseerQuickAction", - "OverseerDeleteBundle", - }, - keys = { - { "or", desc = "> Overseer" }, - { "or", vim.cmd.OverseerRun, desc = "Overseer: Run" }, - { "ot", vim.cmd.OverseerToggle, desc = "Overseer: Toggle" }, - }, - opts = {}, - }, -}