Dane Sabo 43d6abad48 Split markdown_and_tex into per-language modules; add cadquery autorun
- Split lua/custom/language_specific_commands/markdown_and_tex.lua into
  markdown.lua, tex.lua, and a shared nabla_setup.lua
- Add cadquery.lua: auto-render on save for ~/Documents/cad scripts via
  the project venv, with notifications and a <leader>cr manual trigger
- tex.lua: add \textcolor{blue|red|green}{...} operator + visual maps
  (<leader>t{b,r,g}, <leader>tx to remove); set textwidth=80, spell on
- markdown.lua: spell on, textwidth=60, nabla setup hook
- vimtex: switch to latexmk + lualatex with continuous compile and
  synctex; PDF viewer = skim with sync/activate
- lspconfig: enable julia_ls and texlab; add julialsp + texlab to Mason
  ensure_installed
- chadrc: theme -> ayu_dark
- init.lua: ghcup PATH to macOS location; load cadquery module;
  comment out taskwarrior (replaced by openclaw agent); add updatetime
  and sessionoptions for CursorHold + auto-session
2026-05-20 10:59:08 -04:00

65 lines
2.4 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ------------------------------------------------------------------------
-- MATLAB runner: vertical split, CLI-only with no display, reusable buffer
-- ------------------------------------------------------------------------
local matlab_term_buf = nil
local matlab_term_job = nil
vim.api.nvim_create_user_command("RunMatlab", function()
-- full path to current .m file, escape single quotes
local file = vim.fn.expand "%:p"
local matlab_file = file:gsub("'", "''")
-- build your CLI command: no desktop panels, no splash,
-- run the script, and stay in the prompt
local cmd = table.concat({
"matlab",
"-nodisplay",
"-nodesktop",
"-nosplash",
"-r",
string.format(
"'try, run(''%s''), catch, disp(getReport(lasterror)), end, disp(\"<< done >>\"), pause'",
matlab_file
),
}, " ")
if matlab_term_buf and vim.api.nvim_buf_is_valid(matlab_term_buf) and matlab_term_job then
-- if buffer exists, show or jump to it
local wins = vim.fn.win_findbuf(matlab_term_buf)
if #wins == 0 then
vim.cmd "vsplit"
vim.cmd("buffer " .. matlab_term_buf)
else
vim.api.nvim_set_current_win(wins[1])
end
vim.api.nvim_chan_send(matlab_term_job, cmd .. "\n")
else
-- new vertical split + terminal
vim.cmd "vsplit"
vim.cmd "terminal"
matlab_term_buf = vim.api.nvim_get_current_buf()
matlab_term_job = vim.b.terminal_job_id
vim.api.nvim_buf_set_name(matlab_term_buf, "MATLAB-CLI")
vim.api.nvim_chan_send(matlab_term_job, cmd .. "\n")
end
end, {})
vim.keymap.set("n", "<leader>mr", ":RunMatlab<CR>", { noremap = true, silent = true })
-- ------------------------------------------------------------------------
-- LiveScript style commenting: prepend "%[" on each line in a range
-- ------------------------------------------------------------------------
vim.api.nvim_create_user_command("CommentLive", function(opts)
local start_line, end_line = opts.line1, opts.line2
-- the replacement inserts literal "%[" at start of each line
vim.cmd(string.format("%d,%d s/^/%%[/", start_line, end_line))
end, {
range = true,
desc = "Prepend '%[' to each line (MATLAB Live Script style)",
})
-- map <leader>mc in visual mode to comment (only works with selection)
vim.keymap.set("v", "<leader>mc", ":CommentLive<CR>", { noremap = true, silent = true })
print "MATLAB Keybinds & LiveScript Commenter Loaded"