AutoYADM commit: 2024-11-22 02:18:15

This commit is contained in:
Daniel Fichtinger 2024-11-22 02:18:15 -05:00
parent 5f24f10427
commit 9745c8159f
38 changed files with 1122 additions and 1687 deletions

View file

@ -0,0 +1,8 @@
-- TODO: turn this into a plugin? lol
local M = {}
function M.command(command_name)
vim.cmd('call feedkeys(":' .. command_name .. ' ", "n")')
end
return M

View file

@ -0,0 +1,73 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
vim.opt_local.breakindent = true
vim.opt_local.wrap = true
vim.api.nvim_create_autocmd("FileType", {
pattern = "python",
callback = function()
local cl = require("colorbuddy")
cl.Group.new("@variable", cl.colors.primary)
cl.Group.new("@string", cl.colors.secondary)
cl.Group.new("@keyword", cl.colors.complement)
cl.Group.new("@keyword.operator", cl.colors.complement)
cl.Group.new("@constant.builtin", cl.colors.complement)
end,
})
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = "tex",
-- callback = function()
-- vim.cmd([[
-- syntax match texMathSymbol "\\oplus" conceal cchar=⊕
-- ]])
-- end,
-- })
-- This autocommand fixes syntax highlighting for inline math in markdown files
-- Together with vimtex, it will apply very sexy good stuff here!
-- vim.api.nvim_create_autocmd("FileType", {
-- patterm = "tex",
-- callback = function()
-- vim.api.nvim_create_autocmd("BufWrite", {
-- buffer = 0,
-- callback = function()
-- vim.api.nvim_command("VimtexCompile")
-- end,
-- })
-- end,
-- })
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function()
vim.cmd([[
syn region mathBlock start=/\$\$/ end=/\$\$/ contains=@tex
" inline math
syn match mathInline '\$[^$].\{-}\$' contains=@tex
" actually highlight the region we defined as "math"
syn include @tex syntax/tex.vim
hi def link mathBlock Statement
hi def link mathInline Statement
]])
end,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "markdown" },
callback = function()
vim.opt_local.breakindent = true
-- We want markdown files to autosave
vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
buffer = 0,
command = "silent! write",
})
vim.keymap.set("i", "<Cr>", function()
local md_utils = require("md-utils")
local isList = md_utils.isCursorInList()
if isList then
vim.api.nvim_command("MDListItemBelow")
else
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", true, true, true), "n", true)
end
end, { desc = "Continue List", silent = true, remap = true })
vim.opt_local.wrap = true
vim.opt_local.spell = false
end,
})

View file

@ -0,0 +1,117 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
local map = vim.keymap.set
local wk = require("which-key")
vim.keymap.set({ "i", "n" }, "<C-t>", "<Nop>")
local dirmap = {
up = "w0",
down = "w$",
}
-- Bind arrows to hjkl to my colemak-dh motions work as expected
map({ "n", "x" }, "<Up>", "k", { desc = "Up", remap = true })
map({ "n", "x" }, "<Down>", "j", { desc = "Down", remap = true })
map({ "n", "x" }, "<Left>", "h", { desc = "Left", remap = true })
map({ "n", "x" }, "<Right>", "l", { desc = "Right", remap = true })
map({ "n", "t", "i" }, "<C-Left>", "<cmd> TmuxNavigateLeft<CR>", { desc = "Switch Window Left", remap = true })
map({ "n", "t", "i" }, "<C-Right>", "<cmd> TmuxNavigateRight<CR>", { desc = "Switch Window Right", remap = true })
map({ "n", "t", "i" }, "<C-Up>", "<cmd> TmuxNavigateUp<CR>", { remap = true })
map({ "n", "t", "i" }, "<C-Down>", "<cmd> TmuxNavigateDown<CR>", { desc = "Switch Window Down", remap = true })
map({ "x" }, "<M-Left>", "<M-h>", { remap = true })
map({ "x" }, "<M-Right>", "<M-l>", { remap = true })
map({ "n", "x", "v" }, "<M-Up>", "<M-k>", { remap = true })
map({ "n", "x", "v" }, "<M-Down>", "<M-j>", { remap = true })
map({ "n" }, "<S-Left>", "[b", { desc = "Previous Buffer", remap = true })
map({ "n" }, "<S-Right>", "]b", { desc = "Next Buffer", remap = true })
map({ "n" }, "<S-Down>", "5j", { remap = true })
map({ "n" }, "<S-Up>", "5k", { remap = true })
map({ "i" }, "<M-e>", "<Esc>", { desc = "Escape insert mode", remap = true })
-- better navigation
map({ "n" }, "<C-u>", "<C-u>zz", { remap = false })
map({ "n" }, "<C-d>", "<C-d>zz", { remap = false })
map({ "n" }, "n", "nzz", { remap = false })
map({ "n" }, "N", "Nzz", { remap = false })
map({ "n" }, "<PageDown>", "<Down>zz", { remap = false })
map({ "n" }, "<PageUp>", "<Up>zz", { remap = false })
map({ "n", "x" }, "<M-i>", "$", { remap = false })
map({ "n", "x" }, "<M-m>", "0", { remap = false })
-- easily access null register
map({ "n", "x" }, "<leader>n", '"_', { remap = false, silent = true, desc = "Null Register" })
-- remove the default lazyvim, and also swap H and L (for move cursor) to make more sense on colemak
vim.keymap.del({ "n" }, "<S-h>")
vim.keymap.del({ "n" }, "<S-l>")
map({ "n" }, "<S-h>", "L", { remap = false })
map({ "n" }, "<S-l>", "H", { remap = false })
-- better delete and put
-- better quit
map("n", "<C-q>", "<cmd>qa<cr>", { desc = "Quit All" })
map("n", "<C-x>", function()
Snacks.bufdelete()
end, { remap = true, desc = "Delete Buffer" })
-- yank history
map({ "n", "x" }, "<leader>fp", function()
if LazyVim.pick.picker.name == "telescope" then
require("telescope").extensions.yank_history.yank_history({})
else
vim.cmd([[YankyRingHistory]])
end
end, { desc = "Open Yank History", remap = false })
-- TODO: add leader + y for save current buf, leader + Y to write all
map({ "n", "x" }, "<leader>y", ":w<CR>", { desc = "Save" })
map({ "n", "x" }, "<leader>Y", ":wa<CR>", { desc = "Save All" })
-- Zen Mode
map("n", "<leader>uz", "<CMD>ZenMode<CR>", { desc = "Toggle Zen Mode" })
-- Source Current File
map("n", "<leader><leader>x", "<CMD>source %<CR>", { desc = "Source current file" })
-- Obsidian
-- <leader>o is the prefix for all Obsidian bindings
wk.add({
{ "<leader>o", group = "Obsidian" },
{ "<leader>od", group = "Daily Note" },
{ "<leader>ol", group = "Follow Link" },
})
map("n", "<leader>oo", "<CMD>ObsidianQuickSwitch<CR>", { desc = "Obsidian Quick Switch" })
map("n", "<leader>o/", "<CMD>ObsidianSearch<CR>", { desc = "Obsidian Grep" })
-- This one will open the command line and let the user type the arg
map("n", "<leader>on", function()
require("command-key").command("ObsidianNew")
end, { desc = "Obsidian New Note" })
map("n", "<leader>ob", "<CMD>ObsidianBacklinks<CR>", { desc = "Obsidian Backlinks" })
map("n", "<leader>ot", "<CMD>ObsidianTags<CR>", { desc = "Obsidian Tags" })
map("n", "<leader>olv", "<CMD>ObsidianFollowLink vsplit<CR>", { desc = "Obsidian Follow Link Vsplit" })
map("n", "<leader>olh", "<CMD>ObsidianFollowLink hsplit<CR>", { desc = "Obsidian Follow Link Hsplit" })
map("n", "<leader>odt", "<CMD>ObsidianToday<CR>", { desc = "Obsidian Open Today's Daily" })
map("n", "<leader>ods", "<CMD>ObsidianDailies<CR>", { desc = "Obsidian Search Dailies" })
map("n", "<leader>ols", "<CMD>ObsidianLinks<CR>", { desc = "Obsidian Search Links" })
map("x", "<leader>oll", function()
require("command-key").command("ObsidianLink")
end, { desc = "Obsidian Link Visual To Existing Note" })
map("x", "<leader>oln", function()
require("command-key").command("ObsidianLinkNew")
end, { desc = "Obsidian Link Visual To New Note" })
map("x", "<leader>ole", function()
require("command-key").command("ObsidianExtractNote")
end, { desc = "Obsidian Copy Selection To New Note & Link" })
map("n", "<leader>or", function()
require("command-key").command("ObsidianRename")
end, { desc = "Obsidian Rename" })
map("n", "<leader>oc", "<CMD>ObsidianTOC<CR>", { desc = "Obsidian Table Of Contents" })
-- TODO: Add binds for templates

View file

@ -0,0 +1,114 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
local map = vim.keymap.set
local wk = require("which-key")
vim.keymap.set({ "i", "n" }, "<C-t>", "<Nop>")
-- Bind arrows to hjkl to my colemak-dh motions work as expected
map({ "n", "x" }, "<Up>", "k", { desc = "Up", remap = true })
map({ "n", "x" }, "<Down>", "j", { desc = "Down", remap = true })
map({ "n", "x" }, "<Left>", "h", { desc = "Left", remap = true })
map({ "n", "x" }, "<Right>", "l", { desc = "Right", remap = true })
map({ "n", "t", "i" }, "<C-Left>", "<C-w>h", { desc = "Switch Window Left", remap = true })
map({ "n", "t", "i" }, "<C-Right>", "<C-w>j", { desc = "Switch Window Right", remap = true })
map({ "n", "t", "i" }, "<C-Up>", "<C-w>k", { remap = true })
map({ "n", "t", "i" }, "<C-Down>", "<C-w>l", { desc = "Switch Window Down", remap = true })
map({ "x" }, "<M-Left>", "<M-h>", { remap = true })
map({ "x" }, "<M-Right>", "<M-l>", { remap = true })
map({ "n", "x", "v" }, "<M-Up>", "<M-k>", { remap = true })
map({ "n", "x", "v" }, "<M-Down>", "<M-j>", { remap = true })
map({ "n" }, "<S-Left>", "[b", { desc = "Previous Buffer", remap = true })
map({ "n" }, "<S-Right>", "]b", { desc = "Next Buffer", remap = true })
map({ "n" }, "<S-Down>", "5j", { remap = true })
map({ "n" }, "<S-Up>", "5k", { remap = true })
map({ "i" }, "<M-e>", "<Esc>", { desc = "Escape insert mode", remap = true })
-- better navigation
map({ "n" }, "<C-u>", "<C-u>zz", { remap = false })
map({ "n" }, "<C-d>", "<C-d>zz", { remap = false })
map({ "n" }, "n", "nzz", { remap = false })
map({ "n" }, "N", "Nzz", { remap = false })
map({ "n" }, "<PageDown>", "<Down>zz", { remap = false })
map({ "n" }, "<PageUp>", "<Up>zz", { remap = false })
map({ "n", "x" }, "<M-i>", "$", { remap = false })
map({ "n", "x" }, "<M-m>", "0", { remap = false })
-- easily access null register
map({ "n", "x" }, "<leader>n", '"_', { remap = false, silent = true, desc = "Null Register" })
-- remove the default lazyvim, and also swap H and L (for move cursor) to make more sense on colemak
vim.keymap.del({ "n" }, "<S-h>")
vim.keymap.del({ "n" }, "<S-l>")
map({ "n" }, "<S-h>", "L", { remap = false })
map({ "n" }, "<S-l>", "H", { remap = false })
-- better delete and put
-- better quit
map("n", "<C-q>", "<cmd>qa<cr>", { desc = "Quit All" })
map("n", "<C-x>", function()
Snacks.bufdelete()
end, { remap = true, desc = "Delete Buffer" })
-- yank history
map({ "n", "x" }, "<leader>fp", function()
if LazyVim.pick.picker.name == "telescope" then
require("telescope").extensions.yank_history.yank_history({})
else
vim.cmd([[YankyRingHistory]])
end
end, { desc = "Open Yank History", remap = false })
-- TODO: add leader + y for save current buf, leader + Y to write all
map({ "n", "x" }, "<leader>y", ":w<CR>", { desc = "Save" })
map({ "n", "x" }, "<leader>Y", ":wa<CR>", { desc = "Save All" })
-- Zen Mode
-- map("n", "<leader>uz", "<CMD>ZenMode<CR>", { desc = "Toggle Zen Mode" })
-- Source Current File
map("n", "<leader><leader>x", "<CMD>source %<CR>", { desc = "Source current file" })
-- Obsidian
-- <leader>o is the prefix for all Obsidian bindings
wk.add({
{ "<leader>o", group = "Obsidian" },
{ "<leader>od", group = "Daily Note" },
{ "<leader>ol", group = "Follow Link" },
})
map("n", "<leader>oo", "<CMD>ObsidianQuickSwitch<CR>", { desc = "Obsidian Quick Switch" })
map("n", "<leader>o/", "<CMD>ObsidianSearch<CR>", { desc = "Obsidian Grep" })
-- This one will open the command line and let the user type the arg
map("n", "<leader>on", function()
require("command-key").command("ObsidianNew")
end, { desc = "Obsidian New Note" })
map("n", "<leader>ob", "<CMD>ObsidianBacklinks<CR>", { desc = "Obsidian Backlinks" })
map("n", "<leader>ot", "<CMD>ObsidianTags<CR>", { desc = "Obsidian Tags" })
map("n", "<leader>olv", "<CMD>ObsidianFollowLink vsplit<CR>", { desc = "Obsidian Follow Link Vsplit" })
map("n", "<leader>olh", "<CMD>ObsidianFollowLink hsplit<CR>", { desc = "Obsidian Follow Link Hsplit" })
map("n", "<leader>odt", "<CMD>ObsidianToday<CR>", { desc = "Obsidian Open Today's Daily" })
map("n", "<leader>ods", "<CMD>ObsidianDailies<CR>", { desc = "Obsidian Search Dailies" })
map("n", "<leader>ols", "<CMD>ObsidianLinks<CR>", { desc = "Obsidian Search Links" })
map("x", "<leader>oll", function()
require("command-key").command("ObsidianLink")
end, { desc = "Obsidian Link Visual To Existing Note" })
map("x", "<leader>oln", function()
require("command-key").command("ObsidianLinkNew")
end, { desc = "Obsidian Link Visual To New Note" })
map("x", "<leader>ole", function()
require("command-key").command("ObsidianExtractNote")
end, { desc = "Obsidian Copy Selection To New Note & Link" })
map("n", "<leader>or", function()
require("command-key").command("ObsidianRename")
end, { desc = "Obsidian Rename" })
map("n", "<leader>oc", "<CMD>ObsidianTOC<CR>", { desc = "Obsidian Table Of Contents" })
-- TODO: Add binds for templates
-- cmdh.fix_hjkl()
-- cmdh.fix_all()

View file

@ -0,0 +1,53 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = {} },
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -0,0 +1,8 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
local opt = vim.opt
opt.scrolloff = 2
opt.spell = false
-- opt.spelloptions = "camel"

View file

@ -1,5 +0,0 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}

View file

@ -1,52 +0,0 @@
--[[
--
-- This file is not required for your own configuration,
-- but helps people determine if their system is setup correctly.
--
--]]
local check_version = function()
local verstr = tostring(vim.version())
if not vim.version.ge then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
return
end
if vim.version.ge(vim.version(), '0.10-dev') then
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
end
end
local check_external_reqs = function()
-- Basic utils: `git`, `make`, `unzip`
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
local is_executable = vim.fn.executable(exe) == 1
if is_executable then
vim.health.ok(string.format("Found executable: '%s'", exe))
else
vim.health.warn(string.format("Could not find executable: '%s'", exe))
end
end
return true
end
return {
check = function()
vim.health.start 'kickstart.nvim'
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
Fix only warnings for plugins and languages you intend to use.
Mason will give warnings for languages that are not installed.
You do not need to install, unless you want to use those languages!]]
local uv = vim.uv or vim.loop
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
check_version()
check_external_reqs()
end,
}

View file

@ -1,16 +0,0 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
-- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require('nvim-autopairs').setup {}
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
}

View file

@ -1,148 +0,0 @@
-- debug.lua
--
-- Shows how to use the DAP plugin to debug your code.
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well. That's why it's called
-- kickstart.nvim and not kitchen-sink.nvim ;)
return {
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Installs the debug adapters for you
'williamboman/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
},
}
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
}
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
},
}
end,
}

View file

@ -1,61 +0,0 @@
-- Adds git related signs to the gutter, as well as utilities for managing changes
-- NOTE: gitsigns is already included in init.lua but contains only the base
-- config. This will add also the recommended keymaps.
return {
{
'lewis6991/gitsigns.nvim',
opts = {
on_attach = function(bufnr)
local gitsigns = require 'gitsigns'
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then
vim.cmd.normal { ']c', bang = true }
else
gitsigns.nav_hunk 'next'
end
end, { desc = 'Jump to next git [c]hange' })
map('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal { '[c', bang = true }
else
gitsigns.nav_hunk 'prev'
end
end, { desc = 'Jump to previous git [c]hange' })
-- Actions
-- visual mode
map('v', '<leader>hs', function()
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'stage git hunk' })
map('v', '<leader>hr', function()
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'reset git hunk' })
-- normal mode
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function()
gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
end,
},
},
}

View file

@ -1,9 +0,0 @@
return {
{ -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help ibl`
main = 'ibl',
opts = {},
},
}

View file

@ -1,60 +0,0 @@
return {
{ -- Linting
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
-- lint.linters_by_ft = lint.linters_by_ft or {}
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
--
-- However, note that this will enable a set of default linters,
-- which will cause errors unless these tools are available:
-- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
-- Only run the linter in buffers that you can modify in order to
-- avoid superfluous noise, notably within the handy LSP pop-ups that
-- describe the hovered symbol using Markdown.
if vim.opt_local.modifiable:get() then
lint.try_lint()
end
end,
})
end,
},
}

View file

@ -1,25 +0,0 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- https://github.com/nvim-neo-tree/neo-tree.nvim
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
},
cmd = 'Neotree',
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
opts = {
filesystem = {
window = {
mappings = {
['\\'] = 'close_window',
},
},
},
},
}

View file

@ -0,0 +1,59 @@
local M = {}
-- test comment
M.go_map = {
-- ["@lsp.type.class"] = { link = "Structure" },
-- ["@lsp.type.decorator"] = { link = "Function" },
-- ["@lsp.type.enum"] = { link = "Structure" },
-- ["@lsp.type.enumMember"] = { link = "Constant" },
-- ["@lsp.type.function"] = { link = "Function" },
-- ["@lsp.type.interface"] = { link = "Structure" },
["@lsp.type.macro"] = "Macro",
["@lsp.type.method"] = "@function.method", -- Function
["@lsp.type.namespace"] = "@module", -- Structure
["@lsp.type.parameter"] = "@variable.parameter", -- Identifier
-- ["@lsp.type.property"] = { link = "Identifier" },
-- ["@lsp.type.struct"] = { link = "Structure" },
-- ["@lsp.type.type"] = { link = "Type" },
-- ["@lsp.type.typeParameter"] = { link = "TypeDef" },
["@lsp.type.variable"] = "@variable", -- Identifier
["@lsp.type.comment"] = "@comment", -- Comment
["@lsp.type.type"] = "gotype",
["@lsp.type.selfParameter"] = "@variable.builtin",
-- ["@lsp.type.builtinConstant"] = { link = "@constant.builtin" },
["@lsp.type.builtinConstant"] = "@constant.builtin",
["@lsp.type.magicFunction"] = "@function.builtin",
["@lsp.mod.readonly"] = "Constant",
["@lsp.mod.typeHint"] = "Type",
-- ["@lsp.mod.defaultLibrary"] = { link = "Special" },
-- ["@lsp.mod.builtin"] = { link = "Special" },
["@lsp.typemod.operator.controlFlow"] = "@keyword.exception",
["@lsp.typemod.keyword.documentation"] = "Special",
["@lsp.typemod.variable.global"] = "Constant",
["@lsp.typemod.variable.static"] = "Constant",
["@lsp.typemod.variable.defaultLibrary"] = "Special",
["@lsp.typemod.function.builtin"] = "@function.builtin",
["@lsp.typemod.function.defaultLibrary"] = "@function.builtin",
["@lsp.typemod.method.defaultLibrary"] = "@function.builtin",
["@lsp.typemod.operator.injected"] = "Operator",
["@lsp.typemod.string.injected"] = "String",
["@lsp.typemod.variable.injected"] = "@variable",
-- ["@lsp.typemod.function.readonly"] = { fg = theme.syn.fun, bold = true },
}
function M.link(table, lang)
for hl, input in pairs(table) do
local l = input .. "." .. lang
vim.api.nvim_set_hl(0, hl, { link = l })
end
end
return M

View file

@ -0,0 +1,11 @@
local M = {}
M.isCursorInList = function()
local line = vim.api.nvim_get_current_line()
if line:match("^%s*[%-%*%+]%s+") or line:match("^%s*%d+%.%s+") then
return true
end
return false
end
return M

View file

@ -0,0 +1,103 @@
return {
"nvimdev/dashboard-nvim",
lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
opts = function()
-- local logo = [[
-- ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
-- ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
-- ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
-- ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
-- ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
-- ]]
local saturn = [[
_.oo.
_.u[[/;:,. .odMMMMMM'
.o888UU[[[/;:-. .o@P^ MMM^
oN88888UU[[[/;::-. dP^
dNMMNN888UU[[[/;:--. .o@P^
,MMMMMMN888UU[[/;::-. o@^
NNMMMNN888UU[[[/~.o@P^
888888888UU[[[/o@^-..
oI8888UU[[[/o@P^:--..
.@^ YUU[[[/o@^;::---..
oMP ^/o@P^;:::---..
.dMMM .o@^ ^;::---...
dMMMMMMM@^` `^^^^
YMMMUP^
^^
]]
-- logo = string.rep("\n", 8) .. logo .. "\n\n"
saturn = string.rep("\n", 8) .. saturn .. "\n\n"
local function loadObsidian()
-- require("lazy").setup(require("plugins.obsidian"))
require("obsidian")
-- vim.api.nvim_input("<cmd>ObsidianWorkspace<cr>")
vim.api.nvim_input("<cmd>ObsidianTags<cr>")
end
local function openConfig()
local dir = "~/.config/nvim/"
vim.api.nvim_set_current_dir(dir)
vim.cmd("edit" .. dir)
end
local opts = {
theme = "doom",
hide = {
-- this is taken care of by lualine
-- enabling this messes up the actual laststatus setting after loading a file
statusline = false,
},
config = {
-- header = vim.split(logo, "\n"),
header = vim.split(saturn, "\n"),
-- stylua: ignore
center = {
-- { action = function() vim.cmd("edit " .. "~/second-brain/00-index/00-index.md") end, desc = " Open Obsidian Vault", icon = " ", key = "o" },
-- { action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" },
-- { action = loadObsidian, desc = " Obsidian Tags", icon = "󱤇 ", key = "o" },
{ action = "ene | startinsert", desc = " New File", icon = "", key = "n" },
-- { action = function () vim.api.nvim_input("<CMD>ObsidianQuickSwitch<CR>") end, desc = " Obsidian", icon = " ", key = "o"},
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = "", key = "r" },
-- { action = 'lua LazyVim.pick("live_grep")()', desc = " Grep", icon = " ", key = "/" },
-- { action = function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, desc = " Git", icon = " ", key = "g" },
{ action = 'lua LazyVim.pick.config_files()()', desc = " Search Config", icon = "", key = "c" },
-- { action = openConfig, desc = " Open Config", icon = " ", key = "c" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" },
-- { action = 'lua require("persistence").select()', desc = " Select Session", icon = "󱦞 ", key = "S" },
-- { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" },
-- { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },
{ action = function() vim.api.nvim_input("<cmd>qa<cr>") end, desc = " Quit", icon = "", key = "q" },
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
end,
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s"
end
-- open dashboard after closing lazy
if vim.o.filetype == "lazy" then
vim.api.nvim_create_autocmd("WinClosed", {
pattern = tostring(vim.api.nvim_get_current_win()),
once = true,
callback = function()
vim.schedule(function()
vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" })
end)
end,
})
end
return opts
end,
}

View file

@ -0,0 +1,10 @@
return {
{ "nvim-neo-tree/neo-tree.nvim", enabled = false },
{ "folke/tokyonight.nvim", enabled = false },
{ "catpuccin/nvim", enabled = false },
-- { "folke/noice.nvim", enabled = false },
}
-- TODO:
-- figure out how to make markdown extra work together with Obsidian, disable it for now
-- either I can use the extra in markdown files but disable it and use obsidian in vault md files
-- OR find some way for them to coexist?

View file

@ -0,0 +1,54 @@
return {
"echasnovski/mini.files",
lazy = false,
keys = {
{
"<leader>e",
function()
require("mini.files").open(vim.api.nvim_buf_get_name(0), true)
end,
desc = "Open mini.files (current file directory)",
},
{
"<leader>fm",
function()
require("mini.files").open(vim.uv.cwd(), true)
end,
desc = "Open mini.files (cwd)",
},
{
"<leader>E",
function()
require("mini.files").open(LazyVim.root(), true)
end,
desc = "Open mini.files (root)",
},
},
opts = {
content = {
-- hide hidden files by default
filter = function(fs_entry)
return not vim.startswith(fs_entry.name, ".")
end,
},
mappings = {
go_in_plus = "<CR>",
synchronize = ":w",
-- close = "q",
-- go_in = "i",
-- go_out = "m",
-- go_out_plus = "M",
-- mark_goto = "'",
-- mark_set = "k",
-- reset = "<BS>",
-- reveal_cwd = "@",
-- show_help = "g?",
-- trim_left = "<",
-- trim_right = ">",
},
options = {
permanent_delete = false,
use_as_default_explorer = true,
},
},
}

View file

@ -0,0 +1,8 @@
return {
"folke/lazy.nvim",
opts = {
install = {
colorscheme = { "noirbuddy" },
},
},
}

View file

@ -0,0 +1,20 @@
-- local noirbuddy_lualine = require("noirbuddy.plugins.lualine")
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"jesseleite/nvim-noirbuddy",
},
config = function()
local noirbuddy_lualine = require("noirbuddy.plugins.lualine")
local theme = noirbuddy_lualine.theme
local sections = noirbuddy_lualine.sections
local inactive_sections = noirbuddy_lualine.inactive_sections
require("lualine").setup({
options = {
theme = theme,
},
sections = sections,
inactive_sections = inactive_sections,
})
end,
}

View file

@ -0,0 +1,35 @@
local function retmap()
local m = {
inline_surround_toggle = "<leader>mm", -- (string|boolean) toggle inline style
inline_surround_toggle_line = "<leader>mmm", -- (string|boolean) line-wise toggle inline style
inline_surround_delete = "<leader>md", -- (string|boolean) delete emphasis surrounding cursor
inline_surround_change = "<leader>mc", -- (string|boolean) change emphasis surrounding cursor
-- link_add = "<leader>ml", -- (string|boolean) add link
-- link_follow = "<leader>mx", -- (string|boolean) follow link
go_curr_heading = "<leader>mh",
go_parent_heading = "<leader>mH",
go_next_heading = "<M-n>",
go_prev_heading = "<M-e>",
}
require("which-key").add({
{ "<leader>m", group = "Markdown" },
})
vim.keymap.set("n", "<leader>mu", "<cmd>MDListItemAbove<cr>", { desc = "Insert List Item Above", silent = true })
vim.keymap.set(
{ "n", "x" },
"<leader>ml",
"<cmd>MDResetListNumbering<cr>",
{ desc = "Reset List Numbering", silent = true }
)
return m
end
local opts = {
mappings = retmap(),
}
local spec = {
"tadmccorkle/markdown.nvim",
ft = "markdown",
opts = opts,
}
return spec

View file

@ -0,0 +1,106 @@
-- #0f0f0f
-- #933737
-- #A23D3D
-- #994848
-- #7B7F80
-- #7C8080
-- #8D8D8D
-- #d4d4d4
-- #949494
-- #933737
-- #A23D3D
-- #994848
-- #7B7F80
-- #7C8080
-- #8D8D8D
-- #d4d4d4
return {
{
"jesseleite/nvim-noirbuddy",
lazy = false,
dependencies = {
{ "tjdevries/colorbuddy.nvim" },
},
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = function()
local noiropts = {
-- preset = "miami-nights",
styles = {
italic = true,
bold = true,
underline = true,
undercurl = false,
},
colors = {
secondary = "#BD4C4C",
primary = "#933737",
diagnostic_error = "#AC2020",
diagnostic_warning = "#ff7700",
diagnostic_info = "#d5d5d5",
diagnostic_hint = "#d5d5d5",
diff_add = "#f5f5f5",
diff_change = "#737373",
diff_delete = "#AC2020",
},
}
require("noirbuddy").setup(noiropts)
local colorbuddy = require("colorbuddy")
local Color = colorbuddy.Color
local colors = colorbuddy.colors
local Group = colorbuddy.Group
local groups = colorbuddy.groups
local styles = colorbuddy.styles
Color.new("error", "#AC2020")
Color.new("warn", "#f79000")
Color.new("warnborder", "#79491d")
Color.new("infoborder", "#215858")
Color.new("complement", "#379393")
-- Override specific highlight groups
-- Group.new("Type", colors.complement)
Group.new("DiagnosticOk", colors.diagnostic_info)
Group.new("Added", colors.diff_change)
Group.new("Removed", colors.primary)
Group.new("Changed", colors.complement)
Group.new("@markup.link", colors.secondary)
Group.new("@markup.list", colors.complement)
Group.new("@variable", colors.complement)
Group.new("@type.builtin", colors.primary)
Group.new("@number", colors.secondary)
Group.new("NonText", colors.noir_7)
Group.new("Comment", colors.noir_6)
Group.new("@comment", colors.noir_6)
Group.new("@boolean.go", colors.complement)
Group.new("@boolean", colors.complement)
Group.new("@keyword.return", colors.complement)
-- Group.new("gotype", colors.primary)
Group.new("Boolean", colors.complement)
Group.new("Constant", colors.complement)
-- TODO: change these groups to match Snacks instead...
-- Is that even needed actually?
Group.new("DashboardHeader", colors.primary)
Group.new("DashboardIcon", colors.primary)
Group.new("DashboardKey", colors.complement)
Group.new("NotifyINFOBorder", colors.infoborder)
Group.new("NotifyINFOTitle", colors.complement)
Group.new("NotifyINFOIcon", colors.complement)
Group.new("NotifyWARNBorder", colors.warnborder)
Group.new("NotifyWARNTitle", colors.warn)
Group.new("NotifyWARNIcon", colors.warn)
Group.new("NotifyERRORBorder", colors.error)
Group.new("NotifyERRORTitle", colors.error)
Group.new("NotifyERRORIcon", colors.error)
Group.new("ErrorMsg", colors.noir_1, colors.error)
Group.new("SpellBad", nil, nil, styles.undercurl)
Group.new("SpellCap", nil, nil, styles.undercurl)
Group.new("String", colors.primary, nil, nil)
Group.new("Title", colors.primary, nil, styles.bold)
local linkhl = require("link-hl")
linkhl.link(linkhl.go_map, "go")
end,
},
},
}

View file

@ -0,0 +1,24 @@
return {
"folke/snacks.nvim",
priority = 1000,
opts = {
bigfile = {
notify = true,
size = 1.5 * 1024 * 1024, -- 1.5MB
---@param ctx {buf: number, ft:string}
setup = function(ctx)
vim.b.minianimate_disable = true
vim.cmd("set conceallevel=0")
vim.cmd("TSBufDisable highlight")
vim.opt_local.foldenable = false
vim.cmd("NoMatchParen")
vim.opt_local.cursorline = false
vim.opt_local.signcolumn = "no"
vim.opt_local.spell = false
vim.schedule(function()
vim.bo[ctx.buf].syntax = ctx.ft
end)
end,
},
},
}

View file

@ -0,0 +1,9 @@
return {
"psliwka/vim-dirtytalk",
build = ":DirtytalkUpdate",
config = function()
vim.opt.spelllang = { "en", "programming" }
end,
-- Note: let g:dirtytalk_blacklist=['lorem-ipsum'] to disable a wordlist
-- Mus run :DirtytalkUpdate after making this change
}