nvim

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 084e26d014eb168f677ea4094d37ddd85f3ee84d
parent 8ef21b881e189113da94c8d14f2955c1dd7fbb73
Author: AndrewLockVI <andrew@laack.co>
Date:   Tue, 10 Jun 2025 13:27:34 -0500

Updated keymaps

Diffstat:
ALuaSnip/plaintex.lua | 369+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MLuaSnip/tex.lua | 127++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
Mlua/core/keymaps.lua | 26+++++++++++++-------------
Mlua/core/plugins.lua | 20++++++++++----------
4 files changed, 505 insertions(+), 37 deletions(-)

diff --git a/LuaSnip/plaintex.lua b/LuaSnip/plaintex.lua @@ -0,0 +1,369 @@ +-- these don't seem necessary... + +local ls = require("luasnip") +local s = ls.snippet +local sn = ls.snippet_node +local t = ls.text_node +local i = ls.insert_node +local f = ls.function_node +local d = ls.dynamic_node +local fmt = require("luasnip.extras.fmt").fmt +local fmta = require("luasnip.extras.fmt").fmta +local rep = require("luasnip.extras").rep + +return { + require("luasnip").snippet( + { + trig=";hw", + dscr="Autotriggered snippet to replace ;hw with a default document setup.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\documentclass[12pt, letterpaper]{article}", +"\\usepackage{enumitem}", +"\\usepackage{graphicx}", +"\\usepackage{amsthm}", +"\\usepackage{caption}", +"\\usepackage{tcolorbox}", +"\\usepackage{fancyhdr}", +"\\usepackage{datetime}", +"\\pagestyle{fancy}", +"\\fancyhf{}", +"\\lhead{Andrew Laack}", +"\\rhead{\\today}", +"\\newtcolorbox[]{alphaAnswer}[1][]{%", +" colframe=black, % Frame color", +" colback=white, % Background color", +" boxrule=0.2mm, % Thickness of the frame", +" sharp corners,", +"}", +"\\begin{document}", +"\\section*{1.1 FIRST SECTION}", +"\\end{document}", + } + ), + } + ), + + require("luasnip").snippet( + { + trig=";twoFigs", + dscr="Autotriggered snippet to replace ;twoFigs with side by side figures.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\begin{figure}[h]", +" \\centering", +" \\begin{minipage}{0.45\\textwidth}", +" \\centering", +" \\includegraphics[scale=.35]{images/PICTURE1}", +" \\caption{PICTURE 1}", +" \\end{minipage}", +" \\hfill", +" \\begin{minipage}{0.45\\textwidth}", +" \\centering", +" \\includegraphics[scale=.35]{images/PICTURE2}", +" \\caption{PICTURE 2}", +" \\end{minipage}", +"\\end{figure}", + } + ), + } + ), + + require("luasnip").snippet( + { + trig=";oneFig", + dscr="Autotriggered snippet to replace ;oneFig with one figure.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + +"\\begin{figure}[h]", +" \\centering", +" \\includegraphics[scale=1]{images/PICTURE}", +" \\caption{CAPTION}", +"\\end{figure}", + } + ), + } + ), + require("luasnip").snippet( + { + trig=";alphaList", + dscr="Autotriggered snippet to replace ;alphaList with a question and answer list", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + +"\\vspace{.5cm}", +"\\noindent \\textbf{N) QUESTION}", +"\\vspace{.5cm}", +"", +"\\begin{enumerate}[label=\\textbf{\\alph*)}]", +" \\item PART A", +" \\begin{alphaAnswer}", +" ANS A", +" \\end{alphaAnswer}", +"", +" \\item PART B", +" \\begin{alphaAnswer}", +" ANS B", +" \\end{alphaAnswer}", +"", +" \\item PART C", +" \\begin{alphaAnswer}", +" ANS C", +" \\end{alphaAnswer}", +"", +" \\item PART D", +" \\begin{alphaAnswer}", +" ANS D", +" \\end{alphaAnswer}", +"", +" \\item PART E", +" \\begin{alphaAnswer}", +" ANS E", +" \\end{alphaAnswer}", +"\\end{enumerate}" + } + ), + } + ), + + require("luasnip").snippet( + { + trig=";alphaAnswer", + dscr="Autotriggered snippet to replace ;alphaAnswer with answer area", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + "\\begin{alphaAnswer}", + "\\end{alphaAnswer}", + } + ), + } + ), + + require("luasnip").snippet( + { + trig=";alphaPhotos", + dscr="Autotriggered snippet to replace ;alphaPhotos with list of photos to be placed in alphaAnswer.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\begin{flushleft}", +" \\includegraphics[scale=.20]{images/PICTURE1}", +" \\includegraphics[scale=.20]{images/PICTURE2}", +" \\includegraphics[scale=.20]{images/PICTURE3}", +" \\includegraphics[scale=.20]{images/PICTURE4}", +"\\end{flushleft}" + } + ), + } + ), + + require("luasnip").snippet( + { + trig=";numList", + dscr="Autotriggered snippet to replace ;numList with number list", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + "\\begin{enumerate}", + " \\item", + " \\item", + " \\item", + "\\end{enumerate}", + } + ), + } + ), + + + +require("luasnip").snippet( + { + trig=";question", + dscr="Autotriggered snippet to expand ;question to a question in tex with bold unindented question and three bullets.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + "\\vspace{.5cm}", + "\\noindent\\textbf{}", + "\\vspace{.5cm}", + } + ), + } + ), + +require("luasnip").snippet( + { + trig=";alphaFig", + dscr="Autotriggered snippet to expand ;alphaFig to a figure to go in an alpha answer", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + "\\centering", + "\\includegraphics[scale=.5]{images/PICTURE.png}", + "\\captionof{figure}{CAPTION}" + } + ), + } + ), + +require("luasnip").snippet( + { + trig=";header", + dscr="Autotriggered snippet to expand ;header to my preferred header used after converting from markdown to tex.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\documentclass{article}", +"\\usepackage{longtable}", +"\\usepackage{fancyhdr}", +"\\usepackage{datetime}", +"\\pagestyle{fancy}", +"\\fancyhf{}", +"\\lhead{Andrew Laack}", +"\\rhead{\\today}", +"\\begin{document}", +"\\end{document}", + } + ), + } + ), + + + require("luasnip").snippet( + { + trig=";beamer", + dscr="Autotriggered snippet to replace ;beamer with a default presentation.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\documentclass[]{beamer}", +"\\usetheme{Boadilla}", +"\\title{CART-ELC}", +"\\subtitle{Using Beamer}", +"\\author{Andrew Laack}", +"\\date{\\today}", +"\\begin{document}", +"\\end{document}", + + } + ), + } + ), + + + + require("luasnip").snippet( + { + trig=";subsection", + dscr="Autotriggered snippet to expand ;subsection to a new subsection of notes.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\subsection{Subsection}", +"", +"\\begin{definition}", +" definition", +"\\end{definition}", +"", +"\\begin{explanation}", +" explain", +"\\end{explanation}", +"", +"\\begin{example}", +" example", +"\\end{example}", +"", +"\\begin{code}", +" code", +"\\end{code}", + } + ), + } + ), + + + require("luasnip").snippet( + { + trig=";slide", + dscr="Autotriggered snippet to expand ;slide to a new beamer slide.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + "\\begin{frame}", + " \\frametitle{TITLE}", + "\\end{frame}" + } + ), + } + ), + + + + require("luasnip").snippet( + { + trig=";bulletList", + dscr="Autotriggered snippet to expand ;bullets to a bulleted list.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + "\\begin{itemize}", + " \\item", + " \\item", + " \\item", + "\\end{itemize}" + } + ), + } + ), +} + + + diff --git a/LuaSnip/tex.lua b/LuaSnip/tex.lua @@ -14,8 +14,8 @@ local rep = require("luasnip.extras").rep return { require("luasnip").snippet( { - trig=";beginHW", - dscr="Autotriggered snippet to replace ;beginHW with a default document setup.", + trig=";hw", + dscr="Autotriggered snippet to replace ;hw with a default document setup.", snippetType="autosnippet", regTrig=false, priority=100, @@ -28,25 +28,19 @@ return { "\\usepackage{amsthm}", "\\usepackage{caption}", "\\usepackage{tcolorbox}", +"\\usepackage{fancyhdr}", +"\\usepackage{datetime}", +"\\pagestyle{fancy}", +"\\fancyhf{}", +"\\lhead{Andrew Laack}", +"\\rhead{\\today}", "\\newtcolorbox[]{alphaAnswer}[1][]{%", " colframe=black, % Frame color", " colback=white, % Background color", " boxrule=0.2mm, % Thickness of the frame", " sharp corners,", "}", -"\\author{Andrew Laack}", -"\\title{TITLE}", -"\\makeatletter", -"\\renewcommand{\\maketitle}{", -" \\begin{center}", -" {\\Large \\@title} \\\\[.5em]", -" {\\@author} \\\\[0.25em]", -" {\\small \\@date}", -" \\end{center}", -"}", -"\\makeatother", "\\begin{document}", -"\\maketitle{}", "\\section*{1.1 FIRST SECTION}", "\\end{document}", } @@ -245,6 +239,108 @@ require("luasnip").snippet( } ), +require("luasnip").snippet( + { + trig=";header", + dscr="Autotriggered snippet to expand ;header to my preferred header used after converting from markdown to tex.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\documentclass{article}", +"\\usepackage{longtable}", +"\\usepackage{fancyhdr}", +"\\usepackage{datetime}", +"\\pagestyle{fancy}", +"\\fancyhf{}", +"\\lhead{Andrew Laack}", +"\\rhead{\\today}", +"\\begin{document}", +"\\end{document}", + } + ), + } + ), + + + require("luasnip").snippet( + { + trig=";beamer", + dscr="Autotriggered snippet to replace ;beamer with a default presentation.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\documentclass[]{beamer}", +"\\usetheme{Boadilla}", +"\\title{CART-ELC}", +"\\subtitle{Using Beamer}", +"\\author{Andrew Laack}", +"\\date{\\today}", +"\\begin{document}", +"\\end{document}", + + } + ), + } + ), + + + + require("luasnip").snippet( + { + trig=";subsection", + dscr="Autotriggered snippet to expand ;subsection to a new subsection of notes.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ +"\\subsection{Subsection}", +"", +"\\begin{definition}", +" definition", +"\\end{definition}", +"", +"\\begin{explanation}", +" explain", +"\\end{explanation}", +"", +"\\begin{example}", +" example", +"\\end{example}", +"", +"\\begin{code}", +" code", +"\\end{code}", + } + ), + } + ), + + + require("luasnip").snippet( + { + trig=";slide", + dscr="Autotriggered snippet to expand ;slide to a new beamer slide.", + snippetType="autosnippet", + regTrig=false, + priority=100, + }, + { + t({ + "\\begin{frame}", + " \\frametitle{TITLE}", + "\\end{frame}" + } + ), + } + ), @@ -268,3 +364,6 @@ require("luasnip").snippet( } ), } + + + diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua @@ -92,8 +92,8 @@ smap <silent><expr> <C-p> luasnip#jumpable(-1) ? '<Plug>luasnip-jump-prev' : '<S ]] -- pounce config -vim.keymap.set("n", "s", ":Pounce <CR>", { noremap = true, silent = true }) -vim.keymap.set("x", "s", function() require'pounce'.pounce { } end) +-- vim.keymap.set("n", "s", ":Pounce <CR>", { noremap = true, silent = true }) +-- vim.keymap.set("x", "s", function() require'pounce'.pounce { } end) -- vim.keymap.set("o", "s", function() require'pounce'.pounce { } end) @@ -102,17 +102,17 @@ vim.keymap.set("x", "s", function() require'pounce'.pounce { } end) -- Set custom highlight groups - local highlights = { - PounceGap = { bold = true, fg = "#ffffff", bg = "#2e2a3b" }, -- soft light gray text on a deep purple background - PounceAcceptBest = { bold = true, fg = "#ffffff", bg = "#ff6f61" }, -- vibrant coral red for best match selection - PounceAccept = { bold = true, fg = "#ffffff", bg = "#ffcc00" }, -- bright yellow-orange for standard selection - PounceMatch = { bold = true, fg = "#ffffff", bg = "#4b6a8f" }, -- light gray text on a vibrant blue-gray background - - } - -for group, opts in pairs(highlights) do - vim.api.nvim_set_hl(0, group, opts) -end +-- local highlights = { +-- PounceGap = { bold = true, fg = "#ffffff", bg = "#2e2a3b" }, -- soft light gray text on a deep purple background +-- PounceAcceptBest = { bold = true, fg = "#ffffff", bg = "#ff6f61" }, -- vibrant coral red for best match selection +-- PounceAccept = { bold = true, fg = "#ffffff", bg = "#ffcc00" }, -- bright yellow-orange for standard selection +-- PounceMatch = { bold = true, fg = "#ffffff", bg = "#4b6a8f" }, -- light gray text on a vibrant blue-gray background +-- +-- } +-- +-- for group, opts in pairs(highlights) do +-- vim.api.nvim_set_hl(0, group, opts) +-- end -- Map C-Right to w vim.api.nvim_set_keymap('n', '<C-Right>', 'w', { noremap = true, silent = true }) diff --git a/lua/core/plugins.lua b/lua/core/plugins.lua @@ -134,16 +134,16 @@ require("luasnip").config.set_config({ -- Setting LuaSnip config -- }, --}) - - use('rlane/pounce.nvim') - - require'pounce'.setup{ - accept_keys = "TNSERIOADHFUYWPLMVXZCGBJKQ", - accept_best_key = "<enter>", - multi_window = true, - debug = false, - } - +-- +-- use('rlane/pounce.nvim') +-- +-- require'pounce'.setup{ +-- accept_keys = "TNSERIOADHFUYWPLMVXZCGBJKQ", +-- accept_best_key = "<enter>", +-- multi_window = true, +-- debug = false, +-- } +-- use({ "kylechui/nvim-surround",