Compare commits

..

No commits in common. "d459d79de0e77ea2de9e9cfea33d293542092186" and "80f2afb1cfa798d4fe05bb649f5980f154130a9e" have entirely different histories.

15 changed files with 246 additions and 466 deletions

View file

@ -1,18 +1,6 @@
local default_buffer_session = function()
local buffer_path = vim.api.nvim_buf_get_name(0) or vim.fn.tempname()
local temp_path = vim.fn.stdpath("run") .. "/molten-sessions" .. buffer_path .. ".json"
local dir = vim.fn.fnamemodify(temp_path, ":p:h")
if vim.fn.getftype(dir) ~= "dir" then
vim.fn.mkdir(dir, "p")
end
return temp_path
end
-- Start quarto session -- Start quarto session
local startsession = function(file, args) local startsession = function(file, args)
file = file or default_buffer_session() file = file or "/tmp/jupyter-magma-session.json"
local path = require("util").get_python_venv() local path = require("util").get_python_venv()
vim.g["python3_host_prog"] = path vim.g["python3_host_prog"] = path
@ -23,13 +11,10 @@ local startsession = function(file, args)
if args then if args then
file = args[0] file = args[0]
end end
local once = false
vim.fn.jobstart({ "jupyter", "console", "-f", file }, { vim.fn.jobstart({ "jupyter", "console", "-f", file }, {
on_stdout = function(_) on_stdout = function(_)
if not once then vim.cmd("MagmaInit " .. file)
vim.cmd("MoltenInit " .. file) vim.cmd("JupyterAttach " .. file)
end
once = true
end, end,
on_exit = function(_) on_exit = function(_)
vim.notify(string.format("jupyter kernel stopped: %s", file), vim.log.levels.INFO) vim.notify(string.format("jupyter kernel stopped: %s", file), vim.log.levels.INFO)
@ -42,62 +27,39 @@ vim.api.nvim_create_user_command("JupyterStart", function()
end, {}) end, {})
local map = vim.keymap.set local map = vim.keymap.set
-- filetype mappings
-- PLUGIN: magma-nvim
-- Operate jupyter notebooks from within vim
map("n", "<localleader>cc", ":MagmaEvaluateLine<cr>", { silent = true })
map(
"n",
"<localleader>C",
"?^```{<cr>jV/```<cr>k:<C-u>MagmaEvaluateVisual<cr>",
{ silent = true, desc = "Evaluate current code cell" }
)
map("x", "<localleader>c", ":<C-u>MagmaEvaluateVisual<cr>", { silent = true })
map(
"n",
"<localleader>c",
"nvim_exec('MagmaEvaluateOperator', v:true)",
{ expr = true, silent = true, desc = "+code-evaluation" }
)
map("n", "<localleader>cr", ":MagmaReevaluateCell<cr>", { silent = true })
map("n", "<localleader>cu", ":MagmaShowOutput<cr>", { silent = true })
map("n", "<localleader>cU", ":noautocmd :MagmaEnterOutput<cr>", { silent = true, desc = "MagmaEnterOutput" })
map("n", "<localleader>cd", ":MagmaDelete<cr>", { silent = true })
map("n", "<localleader>cs", ":MagmaInterrupt<cr>")
map("n", "<localleader>ci", ":MagmaInit ")
map("n", "<localleader>cD", ":MagmaDeinit<cr>")
map("n", "<localleader>cR", ":MagmaRestart<cr>")
local function molten_mappings_set() -- jump to beginning of previous/ next cell code
-- Operate jupyter notebooks from within vim map("n", "]c", "/^```{<cr>}:nohl<cr>", { desc = "Next quarto cell" })
map("n", "<localleader>cc", ":MoltenEvaluateLine<cr>", { silent = true }) map("n", "[c", "?^```<cr>n}:nohl<cr>", { desc = "Previous quarto cell" })
map( -- insert cell header above/below
"n", map("n", "<localleader>co", "o```{python}<cr><cr>```<esc>k", { desc = "Insert quarto cell below" })
"<localleader>C", map("n", "<localleader>cO", "O```{python}<cr><cr>```<esc>k", { desc = "Insert quarto cell above" })
require("quarto.runner").run_cell,
{ silent = true, desc = "Evaluate current code cell" }
)
map("x", "<localleader>c", ":<C-u>MoltenEvaluateVisual<cr>", { silent = true })
map(
"n",
"<localleader>c",
"nvim_exec('MoltenEvaluateOperator', v:true)",
{ expr = true, silent = true, desc = "+code-evaluation" }
)
map("n", "<localleader>cr", ":MoltenReevaluateCell<cr>", { silent = true })
map("n", "<localleader>cu", ":MoltenShowOutput<cr>", { silent = true })
map("n", "<localleader>cU", ":noautocmd :MoltenEnterOutput<cr>", { silent = true, desc = "Molten enter output" })
map("n", "<localleader>cd", ":MoltenDelete<cr>", { silent = true })
map("n", "<localleader>ci", ":MoltenInterrupt<cr>")
map("n", "<localleader>cN", ":MoltenInit ")
map("n", "<localleader>cD", ":MoltenDeinit<cr>")
map("n", "<localleader>cR", ":MoltenRestart<cr>")
map(
"n",
"<localleader>cA",
require("quarto.runner").run_all,
{ silent = true, desc = "Evaluate all code cells" }
)
map(
"n",
"<localleader>ca",
require("quarto.runner").run_above,
{ silent = true, desc = "Evaluate cells above current" }
)
map(
"n",
"<localleader>cb",
require("quarto.runner").run_below,
{ silent = true, desc = "Evaluate cells below current" }
)
-- jump to beginning of previous/ next cell code
map("n", "]c", "/^```{<cr>}:nohl<cr>", { desc = "Next quarto cell" })
map("n", "[c", "?^```<cr>n}:nohl<cr>", { desc = "Previous quarto cell" })
-- insert cell header above/below
map("n", "<localleader>co", "o```{python}<cr><cr>```<esc>k", { desc = "Insert quarto cell below" })
map("n", "<localleader>cO", "O```{python}<cr><cr>```<esc>k", { desc = "Insert quarto cell above" })
end
vim.api.nvim_create_autocmd("User", {
pattern = "MoltenInitPost",
callback = molten_mappings_set,
})
local bufnr = 0 local bufnr = 0
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" }) map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" })
map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { buffer = bufnr, desc = "Next diagnostic" }) map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { buffer = bufnr, desc = "Next diagnostic" })
@ -131,7 +93,6 @@ map("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<cr>", { buffer = bufnr, de
map("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<cr>", { buffer = bufnr, desc = "Type definition" }) map("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<cr>", { buffer = bufnr, desc = "Type definition" })
if vim.b["sessionfile"] == nil then if vim.b["sessionfile"] == nil then
local path = default_buffer_session() vim.b["sessionfile"] = vim.fn.tempname() .. ".json"
vim.b["sessionfile"] = path startsession(vim.b["sessionfile"])
vim.schedule_wrap(startsession(path))
end end

View file

@ -10,6 +10,7 @@ for _, source in ipairs({
"core.autocmds", "core.autocmds",
"core.mappings", "core.mappings",
"core.look", "core.look",
"personal",
}) do }) do
local status_ok, fault = pcall(require, source) local status_ok, fault = pcall(require, source)
if not status_ok then if not status_ok then

View file

@ -1,8 +1,8 @@
{ {
"Arduino.nvim": { "branch": "main", "commit": "fad71572bf7a79b88da38167a756259b03d0c3ef" }, "Arduino.nvim": { "branch": "main", "commit": "1e986040861e77dd7107abfecc473c60ccd97d3f" },
"BetterLua.vim": { "branch": "master", "commit": "d2d6c115575d09258a794a6f20ac60233eee59d5" }, "BetterLua.vim": { "branch": "master", "commit": "d2d6c115575d09258a794a6f20ac60233eee59d5" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" }, "LuaSnip": { "branch": "master", "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" },
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
"aerial.nvim": { "branch": "master", "commit": "63ec2bfc3d9b8ce1fd943fff14781504d8ee250e" }, "aerial.nvim": { "branch": "master", "commit": "63ec2bfc3d9b8ce1fd943fff14781504d8ee250e" },
"bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" }, "bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" },
@ -23,71 +23,69 @@
"cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" }, "cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" }, "completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" },
"conform.nvim": { "branch": "master", "commit": "ce95e6b2a072d81fd312ff213f241cacab1eccef" },
"dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" }, "dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" },
"dressing.nvim": { "branch": "master", "commit": "8b7ae53d7f04f33be3439a441db8071c96092d19" }, "dressing.nvim": { "branch": "master", "commit": "59fe7ef1aeeed499b983614fcfff89206bf0d5ce" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
"git-conflict.nvim": { "branch": "main", "commit": "4e0191c9a0ae05d7fbdcdc7f15cd358f56d23bfb" }, "git-conflict.nvim": { "branch": "main", "commit": "4e0191c9a0ae05d7fbdcdc7f15cd358f56d23bfb" },
"gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" }, "gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
"headlines.nvim": { "branch": "master", "commit": "e3d7bfdf40e41a020d966d35f8b48d75b90367d2" }, "headlines.nvim": { "branch": "master", "commit": "74a083a3c32a08be24f7dfcc6f448ecf47857f46" },
"image.nvim": { "branch": "master", "commit": "c40215d7d7d1d8c823ee9a77be1a894d5c8df41b" }, "jupyter-kernel.nvim": { "branch": "main", "commit": "5b409598033884a3d819e2a3bcd1fe340bc8d783" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lazy.nvim": { "branch": "main", "commit": "1c16e4236f0937e8955865a0e5e046c7dafbc4b5" },
"lightspeed.nvim": { "branch": "main", "commit": "fcc72d8a4d5f4ebba62d8a3a0660f88f1b5c3b05" }, "lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
"lsp-setup.nvim": { "branch": "main", "commit": "7276e54faf4af909b6ea171975fd4179ebe65cec" }, "lsp-setup.nvim": { "branch": "main", "commit": "7276e54faf4af909b6ea171975fd4179ebe65cec" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"magma-nvim-goose": { "branch": "main", "commit": "9a626aab63361d027541d023707f82e28d7f872c" },
"markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" }, "markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" },
"markmap.nvim": { "branch": "main", "commit": "3befc2a54c2448a16c30c1c7762aab263f22946a" }, "markmap.nvim": { "branch": "main", "commit": "3befc2a54c2448a16c30c1c7762aab263f22946a" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4eb8e15e3c0757303d4c6dea64d2981fc679e990" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "397273083f988c1a17acf3816947cd198338e700" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "8b70e7f1e0a4119c1234c3bde4a01c241cabcc74" }, "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" },
"mdeval.nvim": { "branch": "master", "commit": "2654caf8ecaad702b50199d18e39cff23d81e0ba" }, "mdeval.nvim": { "branch": "master", "commit": "2654caf8ecaad702b50199d18e39cff23d81e0ba" },
"mini.nvim": { "branch": "main", "commit": "b5645ac6eefce8e7af9d7dd4e5e296a81cba8a10" }, "mini.nvim": { "branch": "main", "commit": "707dca4f4152c2d9c9b4c5e02635f78dfd33db50" },
"molten-nvim": { "branch": "main", "commit": "93f2f168e77cbd82a881e07030cdbd45a48ed070" }, "neotest": { "branch": "master", "commit": "6fd61fe665381939a6d70eb08ef1959a10af369e" },
"neotest": { "branch": "master", "commit": "009328955066ae6c170d24bb0de5f168d8760ff8" },
"neotest-python": { "branch": "master", "commit": "81d2265efac717bb567bc15cc652ae10801286b3" }, "neotest-python": { "branch": "master", "commit": "81d2265efac717bb567bc15cc652ae10801286b3" },
"nvim-FeMaco.lua": { "branch": "main", "commit": "6af458f0196215f397db31a6e1fb2df795811693" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-FeMaco.lua": { "branch": "main", "commit": "c4e9c71c9ca595772a360435bdf91bee3f9d32b1" },
"nvim-base16": { "branch": "master", "commit": "96e308958625a84940d5e443475465abf99c7bd9" }, "nvim-base16": { "branch": "master", "commit": "96e308958625a84940d5e443475465abf99c7bd9" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
"nvim-coverage": { "branch": "main", "commit": "cf4b5c61dfac977026a51a2bcad9173c272986ce" }, "nvim-coverage": { "branch": "main", "commit": "fd6f94781c94958d1c26353d0d43a82ea5572b31" },
"nvim-lint": { "branch": "master", "commit": "849ccb610de3f6ce1a239ea1e68568ef1a53d5df" }, "nvim-lspconfig": { "branch": "master", "commit": "8f3ddc448769f563248654a5099c943c7139137e" },
"nvim-lspconfig": { "branch": "master", "commit": "cf3dd4a290084a868fac0e2e876039321d57111c" },
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
"nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" }, "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "faee9d60428afc7857e0927fdc18daa6c409fa64" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "faee9d60428afc7857e0927fdc18daa6c409fa64" },
"nvim-tree.lua": { "branch": "master", "commit": "7d1760f892951dd6a118dae1d7a1d8df5f029edf" }, "nvim-tree.lua": { "branch": "master", "commit": "aaee4cd896b74f85a81bed7eef2db7869960c4d0" },
"nvim-treesitter": { "branch": "master", "commit": "63260da18bf273c76b8e2ea0db84eb901cab49ce" }, "nvim-treesitter": { "branch": "master", "commit": "63260da18bf273c76b8e2ea0db84eb901cab49ce" },
"nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" }, "nvim-treesitter-context": { "branch": "master", "commit": "4cf64264c049c55f256550ad247b606f3e53bc77" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "4c344ffc8d54d7e1ba2cefaaa2c10ea93aa1cc2d" }, "nvim-treesitter-textsubjects": { "branch": "master", "commit": "48b3bf54e32f23e2299c59ff76fa3b0599565b39" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "011c09784f1a95cf469a48c1993b664190440391" },
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" },
"nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" }, "nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" },
"nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" }, "nvim-web-devicons": { "branch": "master", "commit": "3af745113ea537f58c4b1573b64a429fefad9e07" },
"otter.nvim": { "branch": "main", "commit": "9a3db06bf3abadafb93279648317984ca789b888" }, "otter.nvim": { "branch": "main", "commit": "2752dd199d73342f13a1bd599a99822505e2803f" },
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"quarto-nvim": { "branch": "main", "commit": "0a35b3890e9d723b730506d7d8b3ba3d0d6aae2e" }, "quarto-nvim": { "branch": "main", "commit": "b349b7e54f5f5543b6104bfbad0e7d09d4f7c564" },
"smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" }, "smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" },
"stickybuf.nvim": { "branch": "master", "commit": "e3db41f2c1bb2df3ee6ff964ee74fe991f6f9566" }, "stickybuf.nvim": { "branch": "master", "commit": "e3db41f2c1bb2df3ee6ff964ee74fe991f6f9566" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" }, "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
"undotree": { "branch": "main", "commit": "a88c8ab7f780bc14ab9356c2311c44f49213d47c" }, "undotree": { "branch": "main", "commit": "41f56b30cc774ad26c4945c7e10673453893e7ad" },
"vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" }, "vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" },
"vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" }, "vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" },
"vim-easy-align": { "branch": "master", "commit": "0db4ea6132110631ec678a99a82aa49a0686ae65" }, "vim-easy-align": { "branch": "master", "commit": "0db4ea6132110631ec678a99a82aa49a0686ae65" },
"vim-exchange": { "branch": "master", "commit": "784d63083ad7d613aa96f00021cd0dfb126a781a" }, "vim-exchange": { "branch": "master", "commit": "784d63083ad7d613aa96f00021cd0dfb126a781a" },
"vim-numbertoggle": { "branch": "main", "commit": "df9b1fe616507340718716204ba7f434125bdf7a" }, "vim-numbertoggle": { "branch": "main", "commit": "df9b1fe616507340718716204ba7f434125bdf7a" },
"vim-oscyank": { "branch": "main", "commit": "ffe827a27dae98aa826e2295336c650c9a434da0" }, "vim-oscyank": { "branch": "main", "commit": "ffe827a27dae98aa826e2295336c650c9a434da0" },
"vim-pandoc-syntax": { "branch": "master", "commit": "16939cda184ff555938cc895cc62477c172997f9" }, "vim-pandoc-syntax": { "branch": "master", "commit": "4268535e1d33117a680a91160d845cd3833dfe28" },
"vim-spellsync": { "branch": "master", "commit": "3d6dd50de9c4d953cc16638112a6ae196df41463" }, "vim-spellsync": { "branch": "master", "commit": "3d6dd50de9c4d953cc16638112a6ae196df41463" },
"which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" }, "which-key.nvim": { "branch": "main", "commit": "bf09a25bdc9a83bcc69d2cf078e680368676513b" },
"wrapping.nvim": { "branch": "master", "commit": "5e87f1424c86c50d3bc205830aa56ed1cad45467" }, "wrapping.nvim": { "branch": "master", "commit": "5e87f1424c86c50d3bc205830aa56ed1cad45467" },
"zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" }, "zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" },
"zettelkasten.nvim": { "branch": "main", "commit": "0e77624689b470410f5355b613d45219c9350264" }, "zettelkasten.nvim": { "branch": "main", "commit": "0e77624689b470410f5355b613d45219c9350264" },
"zk-nvim": { "branch": "main", "commit": "142625638d2fad464939c6ee1775571aba6379c6" } "zk-nvim": { "branch": "main", "commit": "e9e5e21dbeacd0e753728c7ea45b7a7582d9080a" }
} }

View file

@ -137,6 +137,7 @@ map(
{ desc = "colorschemes" } { desc = "colorschemes" }
) )
map("n", "<leader>vl", ":Lazy<cr>", { desc = "Lazy" }) map("n", "<leader>vl", ":Lazy<cr>", { desc = "Lazy" })
map("n", "<leader>vm", ":Mason<cr>", { desc = "Mason" })
-- PLUGIN: Telescope GLOBAL FUZZY FINDING -- PLUGIN: Telescope GLOBAL FUZZY FINDING
-- buffers and files in current workdir -- buffers and files in current workdir
@ -177,11 +178,16 @@ map("n", "<localleader>q", "gqap", { silent = true, desc = "Format current parag
map("x", "<localleader>q", "gq", { silent = true, desc = "Format {motion}" }) map("x", "<localleader>q", "gq", { silent = true, desc = "Format {motion}" })
map("n", "<localleader>Q", "vapJgqap", { silent = true, desc = "Unformat then format paragraph" }) map("n", "<localleader>Q", "vapJgqap", { silent = true, desc = "Unformat then format paragraph" })
-- FORMAT code with
-- PLUGIN: formatter.nvim
map("n", "<localleader>f", ":FormatLock<cr>")
map("n", "<localleader>F", ":FormatWriteLock<cr>")
-- SPELL CHECKING -- SPELL CHECKING
-- Move to the prev/next spelling error with [S ]S -- Move to the prev/next spelling error with [S ]S
-- Move to the prev/next spelling error or suggestion with [s ]s -- Move to the prev/next spelling error or suggestion with [s ]s
prefix({ ["<localleader>Z"] = { name = "+Spelling" } }) prefix({ ["<localleader>Z"] = { name = "+Spelling" } })
map("n", "<localleader>ZZ", ":setlocal spell! spelllang=en_us,en_gb,de_de<cr>", { desc = "Toggle spellcheck" }) map("n", "<localleader>ZZ", ":setlocal spell! spelllang=en_us,en_uk,de_de<cr>", { desc = "Toggle spellcheck" })
map("n", "<localleader>ZE", ":setlocal spell! spelllang=en_us<cr>", { desc = "Toggle EN_US spellcheck" }) map("n", "<localleader>ZE", ":setlocal spell! spelllang=en_us<cr>", { desc = "Toggle EN_US spellcheck" })
map("n", "<localleader>ZB", ":setlocal spell! spelllang=en_gb<cr>", { desc = "Toggle EN_GB spellcheck" }) map("n", "<localleader>ZB", ":setlocal spell! spelllang=en_gb<cr>", { desc = "Toggle EN_GB spellcheck" })
map("n", "<localleader>ZD", ":setlocal spell! spelllang=de_de<cr>", { desc = "Toggle DE_DE spellcheck" }) map("n", "<localleader>ZD", ":setlocal spell! spelllang=de_de<cr>", { desc = "Toggle DE_DE spellcheck" })
@ -189,23 +195,19 @@ map("n", "<localleader>ZD", ":setlocal spell! spelllang=de_de<cr>", { desc = "To
map("i", "<c-z>", "<C-G>u<Esc>[s1z=`]a<C-G>u") map("i", "<c-z>", "<C-G>u<Esc>[s1z=`]a<C-G>u")
map("n", "<localleader>z", "ms[s1z=`s", { desc = "Fix last spell error" }) map("n", "<localleader>z", "ms[s1z=`s", { desc = "Fix last spell error" })
prefix({ ["<leader>s"] = { name = "+show" } })
-- Set vim to distraction free prose mode -- Set vim to distraction free prose mode
map("n", "<leader>sz", ":ZenMode<cr>", { silent = true }) map("n", "<leader>sz", ":ZenMode<cr>", { silent = true })
-- PLUGIN: mini.nvim -- PLUGIN: mini.nvim
map("n", "<leader>sm", ":lua MiniMap.toggle()<cr>", { silent = true, desc = "minimap" }) prefix({ ["<leader>s"] = { name = "+show" } })
map("n", "<leader>ss", ":lua MiniStarter.open()<cr>", { desc = "startpage" }) map("n", "<leader>sm", ":lua MiniMap.toggle()<cr>", { silent = true, desc = "toggle minimap" })
map("n", "<leader>ss", ":lua MiniStarter.open()<cr>", { desc = "show startpage" })
-- PLUGIN: symbols-outline.nvim -- PLUGIN: symbols-outline.nvim
map("n", "<leader>so", "<cmd>AerialNavToggle<cr>", { silent = true, desc = "symbol navigator" }) map("n", "<leader>so", "<cmd>AerialToggle<cr>", { silent = true, desc = "toggle symbol outline" })
map("n", "<leader>sO", "<cmd>AerialToggle<cr>", { silent = true, desc = "symbol outline" }) map("n", "<leader>sn", "<cmd>AerialNavToggle<cr>", { silent = true, desc = "toggle symbol navigator" })
-- PLUGIN: nvim-tree -- PLUGIN: nvim-tree
map("n", "<leader>se", "<cmd>NvimTreeToggle<cr>", { silent = true, desc = "filetree" }) map("n", "<leader>se", "<cmd>NvimTreeToggle<cr>", { silent = true, desc = "toggle filetree" })
-- PLUGIN: nvim-tree
map("n", "<leader>sd", "<cmd>Trouble workspace_diagnostics<cr>", { silent = true, desc = "diagnostics workspace" })
map("n", "<leader>sD", "<cmd>Trouble document_diagnostics<cr>", { silent = true, desc = "diagnostics document" })
-- PLUGIN: easy-align -- PLUGIN: easy-align
-- Start interactive EasyAlign in visual mode (e.g. vipga) -- Start interactive EasyAlign in visual mode (e.g. vipga)
@ -253,10 +255,11 @@ map("v", "<localleader>nf", ":ZkMatch<cr>", { desc = "find note from selection"
-- PLUGIN: toggleterm.nvim -- PLUGIN: toggleterm.nvim
-- create a lazygit or python window, set up in toggleterm settings -- create a lazygit or python window, set up in toggleterm settings
-- TODO create ability to go into python environment when in poetry venv and/or euporie/jupyter notebook -- TODO create ability to go into python environment when in poetry venv and/or euporie/jupyter notebook
map("n", "<leader>sg", ":Lazygit<cr>") prefix({ ["<localleader>t"] = { name = "+term" } })
map("n", "<leader>sG", ":Lazygit!<cr>") map("n", "<leader>tg", ":Lazygit<cr>")
map("n", "<leader>sp", ":Pythonterm<cr>") map("n", "<leader>tG", ":Lazygit!<cr>")
map("n", "<leader>sP", ":Pythonterm!<cr>") map("n", "<leader>tp", ":Pythonterm<cr>")
map("n", "<leader>tP", ":Pythonterm!<cr>")
prefix({ ["<localleader>s"] = { name = "+set" } }) prefix({ ["<localleader>s"] = { name = "+set" } })
-- PLUGIN: wrapping.nvim -- PLUGIN: wrapping.nvim
@ -274,3 +277,5 @@ map(
'<cmd>lua require("colorizer").attach_to_buffer(0, {mode = "background"} )<cr>', '<cmd>lua require("colorizer").attach_to_buffer(0, {mode = "background"} )<cr>',
{ silent = true, desc = "colorize background" } { silent = true, desc = "colorize background" }
) )
map("n", "<leader>sa", "<cmd>FormatOnSave<cr>", { silent = true, desc = "toggle format on save" })

View file

@ -84,7 +84,7 @@ local globals = {
maplocalleader = ",", maplocalleader = ",",
tex_flavor = "latex", tex_flavor = "latex",
disable_autoformat = true, -- only format files manually format_on_save = false, -- from personal toggle function
} }
for o, v in pairs(globals) do for o, v in pairs(globals) do

View file

@ -0,0 +1,33 @@
local function stop_formatting()
vim.api.nvim_del_augroup_by_name("LspFormat")
end
local function start_formatting()
for _, client in pairs(vim.lsp.get_active_clients()) do
require("lsp-setup.utils").format_on_save(client)
end
end
local function _toggle(opts)
if opts.args == "" then
vim.g.format_on_save = not vim.g.format_on_save
elseif opts.args == "on" or opts.args == "1" then
vim.g.format_on_save = true
elseif opts.args == "off" or opts.args == "0" then
vim.g.format_on_save = false
else
vim.notify("Please provide arguments 'on' or 'off' or non arguments to toggle.")
end
if vim.g.format_on_save == true then
start_formatting()
else
stop_formatting()
end
end
vim.api.nvim_create_user_command(
"FormatOnSave",
_toggle,
{ desc = "toggle automatically formatting on save", nargs = "?" }
)

View file

@ -0,0 +1 @@
require("personal.format_on_save_toggle")

View file

@ -17,7 +17,6 @@ local servers = {
docker_compose_language_service = {}, docker_compose_language_service = {},
dockerls = {}, dockerls = {},
emmet_ls = {}, emmet_ls = {},
eslint = {},
gopls = {}, gopls = {},
julials = {}, julials = {},
lua_ls = { lua_ls = {
@ -43,16 +42,6 @@ local servers = {
yamlls = {}, yamlls = {},
} }
-- TODO installed for conform/nvim-lint so should be sourced from there not here
local to_mason =
{ "stylua", "shellcheck", "shfmt", "markdownlint", "bibtex-tidy", "jq", "prettier", "ruff", unpack(servers) }
require("mason-tool-installer").setup({
-- a list of all tools you want to ensure are installed upon
-- start
ensure_installed = to_mason,
start_delay = 3000,
})
local function on_attach(client, bufnr) local function on_attach(client, bufnr)
local map = vim.keymap.set local map = vim.keymap.set
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" }) map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" })
@ -70,7 +59,8 @@ local function on_attach(client, bufnr)
{ buffer = bufnr, desc = "Next error" } { buffer = bufnr, desc = "Next error" }
) )
require("which-key").register({ ["<localleader>l"] = { name = "+language" } }) require("which-key").register({ ["<localleader>l"] = { name = "+lsp" } })
map("n", "<localleader>li", "<cmd>LspInfo<cr>", { buffer = bufnr, desc = "Lsp Info" })
map( map(
"n", "n",
"<localleader>ld", "<localleader>ld",
@ -110,6 +100,7 @@ local function on_attach(client, bufnr)
{ buffer = bufnr, desc = "Implementation" } { buffer = bufnr, desc = "Implementation" }
) )
end end
map("n", "<localleader>ll", "<cmd>lua vim.lsp.buf.format()<CR>", { buffer = bufnr, desc = "Format document" })
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { buffer = bufnr, desc = "Hover definition" }) map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { buffer = bufnr, desc = "Hover definition" })
map("n", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", { buffer = bufnr, desc = "Declaration" }) map("n", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", { buffer = bufnr, desc = "Declaration" })
map( map(
@ -125,20 +116,16 @@ local function on_attach(client, bufnr)
vim.diagnostic.disable(0) vim.diagnostic.disable(0)
end end
end, { buffer = bufnr, desc = "Disable buffer diagnostics" }) end, { buffer = bufnr, desc = "Disable buffer diagnostics" })
if vim.g.format_on_save then
require("lsp-setup.utils").format_on_save(client)
end
end end
-- Display diagnostics as virtual text only if not in insert mode -- Display diagnostics as virtual text only if not in insert mode
-- https://lr.artemislena.eu/r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/ -- https://lr.artemislena.eu/r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/
vim.api.nvim_create_autocmd("InsertEnter", { vim.api.nvim_create_autocmd("InsertEnter", { callback = function() vim.diagnostic.config({ virtual_text = false, }) end })
callback = function() vim.api.nvim_create_autocmd("InsertLeave", { callback = function() vim.diagnostic.config({ virtual_text = true, }) end })
vim.diagnostic.config({ virtual_text = false })
end,
})
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
vim.diagnostic.config({ virtual_text = true })
end,
})
lsp.setup({ lsp.setup({
default_mappings = false, default_mappings = false,
@ -150,7 +137,6 @@ lsp.setup({
}) })
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
lspconfig.nushell.setup({})
local python_path local python_path
-- ensure python virtualenv is determined automatically on lsp start -- ensure python virtualenv is determined automatically on lsp start
@ -166,11 +152,12 @@ lspconfig.pyright.setup({
}) })
lspconfig.ruff_lsp.setup({ lspconfig.ruff_lsp.setup({
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
on_attach(client, bufnr)
if python_path == nil then if python_path == nil then
python_path, _ = require("util").get_python_venv(client.config.root_dir) python_path, _ = require("util").get_python_venv(client.config.root_dir)
end end
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
client.config.settings.python.pythonPath = python_path client.config.settings.python.pythonPath = python_path
on_attach(client, bufnr)
end, end,
}) })
@ -180,3 +167,45 @@ if require("util").is_available("arduino") then
on_new_config = require("arduino").on_new_config, on_new_config = require("arduino").on_new_config,
}) })
end end
local null_ls = require("null-ls")
null_ls.setup({})
require("mason-null-ls").setup({
ensure_installed = { "black", "prettier", "shfmt", "eslint-lsp", "stylua", "jq", "vale", "markdownlint" },
automatic_installation = false,
handlers = {
shfmt = function(_, _)
null_ls.register(null_ls.builtins.formatting.shfmt.with({
extra_filetypes = { "bash", "zsh" },
}))
end,
prettier = function(_, _)
null_ls.register(null_ls.builtins.formatting.prettier.with({
extra_filetypes = { "astro" },
disabled_filetypes = { "markdown" },
timeout = 7000,
}))
end,
eslint = function(_, _)
null_ls.register(null_ls.builtins.diagnostics.eslint.with({
extra_filetypes = { "astro" },
}))
null_ls.register(null_ls.builtins.code_actions.eslint.with({
extra_filetypes = { "astro" },
}))
end,
markdownlint = function(_, _)
null_ls.register(null_ls.builtins.diagnostics.markdownlint.with({
extra_filetypes = { "quarto" },
}))
end,
vale = function(_, _)
null_ls.register(null_ls.builtins.diagnostics.vale.with({
condition = function(utils)
return (utils.root_has_file({ ".vale.ini", "_vale.ini" }) and utils.root_has_file({ "styles/" }))
end,
}))
end,
},
})

View file

@ -12,77 +12,51 @@ return {
require("quarto").setup({ require("quarto").setup({
lspFeatures = { lspFeatures = {
enabled = true, enabled = true,
languages = { "r", "python", "julia", "bash" }, languages = { "r", "python", "julia" },
diagnostics = { enabled = true, triggers = { "BufWritePost" } }, diagnostics = { enabled = true, triggers = { "BufWrite" } },
completion = { enabled = true }, completion = { enabled = true },
}, },
codeRunner = {
enabled = true,
default_method = "molten",
},
}) })
end, end,
ft = { "quarto" }, lazy = false,
ft = "quarto",
},
{
"lkhphuc/jupyter-kernel.nvim",
config = true,
cmd = "JupyterAttach",
build = ":UpdateRemotePlugins",
keys = {
{
"<localleader>ck",
"<Cmd>JupyterInspect<CR>",
desc = "Inspect object in kernel",
},
},
lazy = false,
}, },
-- REPL work -- REPL work
{ {
"3rd/image.nvim", "WhiteBlackGoose/magma-nvim-goose",
config = function()
-- Example for configuring Neovim to load user-installed installed Lua rocks:
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({
backend = "kitty",
integrations = {
markdown = {
enabled = true,
download_remote_images = true,
only_render_image_at_cursor = true,
filetypes = { "markdown", "vimwiki", "quarto" },
},
},
})
end,
ft = { "markdown", "vimwiki", "quarto" },
},
{
"benlubas/molten-nvim",
build = ":UpdateRemotePlugins", build = ":UpdateRemotePlugins",
config = function() config = function()
vim.g.molten_image_provider = "none" -- image integration does NOT work currently :-( vim.g.magma_image_provider = "kitty"
vim.g.molten_auto_open_output = false vim.g.magma_automatically_open_output = false
end, end,
cmd = { cmd = {
"MoltenInfo", "MagmaInit",
"MoltenInit", "MagmaEvaluateOperator",
"MoltenDeinit", "MagmaEvaluateLine",
"MoltenGoto", "MagmaEvaluateVisual",
"MoltenNext", "MagmaRestart",
"MoltenPrev",
"MoltenEvaluateLine",
"MoltenEvaluateVisual",
"MoltenEvaluateOperator",
"MoltenEvaluateArgument",
"MoltenReevaluateCell",
"MoltenDelete",
"MoltenShowOutput",
"MoltenHideOutput",
"MoltenEnterOutput",
"MoltenInterrupt",
"MoltenRestart",
"MoltenSave",
"MoltenLoad",
"MoltenExportOutput",
}, },
ft = { "quarto", "python" }, ft = { "quarto", "python" },
lazy = false, lazy = false,
keys = {
{ "<leader>vn", ":MoltenInfo<cr>" },
},
}, },
-- MARKDOWN ONLY -- MARKDOWN ONLY
-- Evaluate markdown code blocks -- Evaluate markdown code blocks
{ {
"jubnzv/mdeval.nvim", "jubnzv/mdeval.nvim",
@ -97,11 +71,11 @@ return {
lazy = false, lazy = false,
}, },
{ {
"AckslD/nvim-FeMaco.lua", "AckslD/nvim-FeMaco.lua",
cmd = { cmd = {
"FeMaco", "FeMaco"
}, },
ft = { "markdown" }, ft = { "markdown" },
config = true, config = true
}, }
} }

View file

@ -47,162 +47,25 @@ return {
"MasonUpdate", "MasonUpdate",
}, },
build = ":MasonUpdate", build = ":MasonUpdate",
keys = {
{ "<leader>vm", ":Mason<cr>", desc = "Mason" },
},
}, },
{ {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
cmd = { "LspInstall", "LspUninstall" }, cmd = { "LspInstall", "LspUninstall" },
}, },
{ {
"WhoIsSethDaniel/mason-tool-installer.nvim", "jose-elias-alvarez/null-ls.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"jay-babu/mason-null-ls.nvim",
},
event = "VeryLazy",
}, },
}, },
event = { "BufRead", "BufNewFile", "InsertEnter" }, event = "BufReadPost",
after = { "nvim-cmp" },
config = function() config = function()
require("plugins.config.lsp") require("plugins.config.lsp")
end, end,
keys = { {
"<leader>vs",
":LspInfo<cr>",
desc = "LspInfo",
} },
}, },
-- linting setup
{
"mfussenegger/nvim-lint",
config = function()
local linters = {
astro = {},
bash = {},
javascript = {},
javascriptreact = {},
markdown = {},
quarto = {},
sh = {},
svelte = {},
text = {},
typescript = {},
typescriptreact = {},
}
local per_cmd = function(cmd, ft_table)
if vim.fn.executable(cmd) == 1 then
for _, v in pairs(ft_table) do
table.insert(v, cmd)
end
end
end
per_cmd("markdownlint", { linters.markdown, linters.quarto })
per_cmd("vale", { linters.markdown, linters.text, linters.quarto })
per_cmd("shellcheck", { linters.sh, linters.bash })
per_cmd("eslint_d", {
linters.astro,
linters.javascript,
linters.javascriptreact,
linters.svelte,
linters.typescript,
linters.typescriptreact,
})
require("lint").linters_by_ft = linters
vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, {
callback = function()
require("lint").try_lint()
end,
})
end,
event = { "BufReadPost", "BufNewFile" },
},
-- formatting setup
{
"stevearc/conform.nvim",
config = function()
require("conform").setup({
lsp_fallback = true,
format_after_save = function(bufnr)
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { lsp_fallback = true }
end,
formatters_by_ft = {
angular = { { "prettierd", "prettier" } },
astro = { { "prettierd", "prettier" } },
bash = { "shfmt" },
bib = { "bibtex-tidy" },
css = { { "prettierd", "prettier" } },
graphql = { { "prettierd", "prettier" } },
html = { { "prettierd", "prettier" } },
javascript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
json = { "jq" },
lua = { "stylua" },
python = { "ruff_fix", "ruff_format" },
sh = { "shfmt" },
svelte = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
vue = { { "prettierd", "prettier" } },
yaml = { { "prettierd", "prettier" } },
zsh = { "shfmt" },
},
formatters = {
-- enable python isort functionality
ruff_fix = {
prepend_args = { "--select", "I" },
},
},
})
vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then
-- FormatDisable! will disable formatting just for this buffer
vim.b.disable_autoformat = true
else
vim.g.disable_autoformat = true
end
end, {
desc = "Disable formatting on save",
bang = true,
})
vim.api.nvim_create_user_command("FormatEnable", function()
vim.b.disable_autoformat = false
vim.g.disable_autoformat = false
end, {
desc = "Enable formatting on save",
})
end,
cmd = { "ConformInfo" },
event = { "BufReadPre" },
keys = {
{
"<localleader>ll",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
desc = "Format buffer",
},
{
"<localleader>lL",
function()
vim.g.disable_autoformat = not vim.g.disable_autoformat
end,
desc = "Toggle AutoFormat",
},
{
"<leader>vf",
":ConformInfo<cr>",
desc = "ConformInfo",
},
},
init = function()
-- If you want the formatexpr, here is the place to set it
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
},
-- completion setup -- completion setup
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
@ -233,25 +96,12 @@ return {
config = function() config = function()
require("plugins.config.cmp") require("plugins.config.cmp")
end, end,
event = { "InsertEnter", "CmdlineEnter" }, event = { "InsertEnter", "CmdlineEnter", "VeryLazy" },
}, },
-- loading animations for some LSP -- loading animations for some LSP
{ "j-hui/fidget.nvim", config = true, tag = "legacy", event = "VeryLazy" }, { "j-hui/fidget.nvim", config = true, tag = "legacy", event = "VeryLazy" },
-- useful quickfix-like buffer
{
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {},
cmd = {
"Trouble",
"TroubleRefresh",
"TroubleToggle",
"TroubleClose",
},
},
-- testing setup -- testing setup
{ {
"nvim-neotest/neotest", "nvim-neotest/neotest",

View file

@ -3,7 +3,9 @@ local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex" }
local prose_plugs = { local prose_plugs = {
-- UI improvements -- UI improvements
-- provide distraction free writing -- provide distraction free writing
{ "folke/zen-mode.nvim", config = true, cmd = { "ZenMode" }, dependencies = { "folke/twilight.nvim" } }, { "folke/zen-mode.nvim", config = true, event = "VeryLazy" },
-- provide even distraction free-er writing (lowlight paragraphs)
{ "folke/twilight.nvim", event = "VeryLazy" },
{ {
"andrewferrier/wrapping.nvim", "andrewferrier/wrapping.nvim",
config = function() config = function()

View file

@ -7,21 +7,11 @@ return {
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
-- one of "all", "maintained" (parsers with maintainers), or a list of languages -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "all", ensure_installed = "all",
auto_install = true,
highlight = { highlight = {
enable = true, enable = true,
language_tree = true,
disable = function(_, bufnr) disable = function(_, bufnr)
if return vim.api.nvim_buf_line_count(bufnr) > 7000
vim.api.nvim_buf_line_count(bufnr) > 1000
or vim.fn.strwidth(vim.fn.getline(".")) > 300
or vim.fn.getfsize(vim.fn.expand("%")) > 1024 * 1024
then
return true
end
return false
end, end,
additional_vim_regex_highlighting = false,
}, },
incremental_selection = { enable = true }, incremental_selection = { enable = true },
textobjects = { enable = true }, textobjects = { enable = true },
@ -34,6 +24,11 @@ return {
strategy = { rainbow.strategy.global }, strategy = { rainbow.strategy.global },
}, },
-- for improved commentstrings, needs corresponding plugin
context_commentstring = {
enable = true,
enable_autocmd = false, -- since we run it as a hook from the mini.comment plugin
},
-- allows using . and ; to target treesitter branches -- allows using . and ; to target treesitter branches
textsubjects = { textsubjects = {
enable = true, enable = true,
@ -42,33 +37,7 @@ return {
[";"] = "textsubjects-container-outer", [";"] = "textsubjects-container-outer",
}, },
}, },
endwise = {
enable = true
}
}) })
-- for improved commentstrings, needs corresponding plugin
require("ts_context_commentstring").setup({
enable = true,
enable_autocmd = false, -- since we run it as a hook from the mini.comment plugin
languages = {
nu = "# %s",
},
})
-- treesitter parser for nushell. To fully get e.g. syntax highlight
-- working you need a highlight file too. For now I installed manually, see:
-- https://github.com/nushell/tree-sitter-nu/blob/main/installation/neovim.md
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.nu = {
install_info = {
url = "https://github.com/nushell/tree-sitter-nu",
files = { "src/parser.c" },
branch = "main",
},
filetype = "nu",
}
end, end,
event = "BufReadPost", event = "BufReadPost",
cmd = { cmd = {
@ -94,10 +63,11 @@ return {
"https://gitlab.com/HiPhish/nvim-ts-rainbow2.git", "https://gitlab.com/HiPhish/nvim-ts-rainbow2.git",
{ "romgrk/nvim-treesitter-context", config = true }, { "romgrk/nvim-treesitter-context", config = true },
"JoosepAlviste/nvim-ts-context-commentstring", "JoosepAlviste/nvim-ts-context-commentstring",
"RRethy/nvim-treesitter-textsubjects", {
"RRethy/nvim-treesitter-textsubjects",
},
"windwp/nvim-ts-autotag", "windwp/nvim-ts-autotag",
"RRethy/nvim-treesitter-endwise",
}, },
}, },
{ "nvim-treesitter/playground", cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
} }

View file

@ -8,7 +8,7 @@ FDI
Farole Farole
Fordism Fordism
Fordist Fordist
Gramsci Gramsci's
JIT JIT
Kyrgyzstan Kyrgyzstan
Kyūshū Kyūshū
@ -196,13 +196,3 @@ programmatically
TUI TUI
Lemmy Lemmy
cli cli
Pareto
decarbonise
Gini
Familia
Bolsa
ppts
ppt
Programo
Urbano
redistributional

View file

@ -1,43 +0,0 @@
#!/usr/bin/env bash
molten_session_dir="/run/user/$UID/molten-sessions"
cur_dir=$(pwd)
search_dir="${molten_session_dir}${cur_dir}"
if [ "$1" == "-c" ]; then
cmd=$(echo -e "euporie-console\njupyter-console\nptipython\nipython\npython" | fzf)
fi
# set normal command first
if [ -z "$cmd" ]; then
if exist ptipython; then
cmd=ptipython
elif exist ipython; then
cmd=ipython
elif exist python; then
cmd=python
else
echo "No python found on system, please install." 1>&2
exit 1
fi
fi
# search for molten session for current dir
if [ -n "$(ls -A "${search_dir}" 2>/dev/null)" ]; then
res=$(find "$search_dir" -maxdepth 1 -type f -name "*.json")
if [ "$(echo "$res" | wc -l)" -gt 1 ]; then
session=$(echo "$res" | fzf --prompt "Molten session> ")
fi
fi
# attach to kernel
if [ -n "${session}" ]; then
if exist euporie-console || [ "$cmd" == "euporie-console" ]; then
euporie-console --edit-mode vi --connection-file "$session"
elif exist jupyter-console || [ "$cmd" == "jupyter-console" ]; then
jupyter-console --existing "$session"
fi
# or just run normal python
else
$cmd
fi

View file

@ -106,6 +106,15 @@ else
done done
fi fi
# python
if exist ptipython; then
alias py=ptipython
elif exist ipython; then
alias py=ipython
elif exist python; then
alias py=python
fi
# distrobox # distrobox
if exist distrobox; then if exist distrobox; then
alias db=distrobox alias db=distrobox