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,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"