Compare commits

...

20 Commits

Author SHA1 Message Date
Marty Oehme d459d79de0
nvim: Update spellfile 2023-12-12 12:11:03 +01:00
Marty Oehme 1e47459801
nvim: Add endwise plugin to treesitter
Will automatically add function end tags for a bunch of languages, most importantly
for me to lua and bash.
2023-12-12 12:11:02 +01:00
Marty Oehme ea7b2e632e
nvim: Configure image.nvim lazyness
Set up to load on the file types it affects.
2023-12-12 12:11:01 +01:00
Marty Oehme c550a9d514
nvim: Move Molten info toggle to vim-meta key group
Moved mapping from `<localleader>cI` to `<leader>vn` (for molteN).
2023-12-12 12:11:00 +01:00
Marty Oehme ea224ebbc1
nvim: Lazy load zen-mode, nvim-cmp
Correctly lazy load nvim-cmp as much as possible.
Loading it with certain events but also before lsp.
See here: https://github.com/hrsh7th/nvim-cmp/discussions/688#discussioncomment-1891544
2023-12-12 12:10:34 +01:00
Marty Oehme eec90ad7e2
nvim: Add automatic mason tool installation
Using mason-tool-installer we ensure everything is installed correctly.
Need to improve the collection of things to install. Currently we just
do everything in lsp configuration file, even the non-lsp things
(formatters/linters) which should be sourced where they belong not
in that file.
2023-12-12 12:10:33 +01:00
Marty Oehme ab06ef922b
nvim: Replace null-ls with nvim-lint
Fully replaced null-ls. Will need more tweaking on the nvim-lint setup but
works generally for now. Works well in tandem with conform formatter.
2023-12-12 12:10:32 +01:00
Marty Oehme 5ccf8bc1fc
nvim: Add formatting expression and more filetypes 2023-12-12 12:10:28 +01:00
Marty Oehme bad6200bd2
nvim: Move Mason quick mapping to plugin setup 2023-12-12 12:10:27 +01:00
Marty Oehme 49692601da
nvim: Change Lsp info mapping to vim layer
Moved the mapping to show lsp info window from `<localleader>li` to
`<leader>vs`.
Local leader +l mappings should be reserved for lsp functionality,
while we have a whole +v layer to grab (meta) information about our
vim installation. It fits in there much better.
2023-12-12 12:10:26 +01:00
Marty Oehme 293dc8a467
nvim: Add conform.nvim formatter
In the process of moving away from null-ls, added formatting with the help
of conform.nvim. Brings one new command, :ConformInfo which can also be
reached via `<leader>vc`.

AutoFormat on saving remains disabled by default but can be enabled with
:FormatEnable (and disabled again with :FormatDisable) or quickly through
`<localleader>lL`.

Manual formatting works like before with `<localleader>ll`. Uses the
formatters set in the plugin (similar setup to null-ls before) but
automatically falls back to lsp formatters if it does not have its own
and lsp has one enabled.
2023-12-12 12:10:25 +01:00
Marty Oehme 1def627edd
nvim: Turn off treesitter highlights in big files
Files above 1000 lines, 300 linelength or really big filesize.
2023-12-12 12:10:15 +01:00
Marty Oehme 7f112816b0
nvim: Remove TSPlayground plugin
Has been superseded by internal functionality, just run `:Inspect` or
`:InspectTree`.
2023-12-12 12:09:58 +01:00
Marty Oehme 5d8177b1b5
nvim: Update +show mode mappings and descriptions
Mappings preceded by <leader>s 'show' something so removed a lot of the 'toggle'
wording from their descriptions.

Subsumed the toggleterm toggles under this menu since they 'show' a term window
(lazygit or ipython).
Changed Aerial mappings to show navigator by default (`<leader>so`) and the
sidebar outline only on capital version (`<leader>sO`) since this mapping is
used less often.

Removed broken molten-image setup.
2023-12-12 12:09:30 +01:00
Marty Oehme 8d9b67cb04
nvim: Add Trouble.nvim plugin to quickly show diag 2023-12-12 12:09:29 +01:00
Marty Oehme c487da69a8
nvim: Add molten and image.nvim plugins
Image nvim works mostly well (slow on wezterm but that will always be the case
with kitty protocol for now as far as I know).
Would love to be able to toggle images on/off dynamically but I don't see a
way to accomplish that now. (or really, get to any option of the plugin).

Molten itself also works well - the output is displayed more nicely than for
the Magma plugins and everything continues working mostly well (or rather,
just as wonky as I had it set up on my older magma install :)

For now, the molten - image.nvim integration seems to not work at all -
it simply errors out when it would produce an image as output. No clue why
and it also complains about the wrong image provider (which I have taken from
the molten readme). No time to bugfix now but maybe at some point.

To do - find a much better way of installing the image.nvim required
luarock magick - done manually with hardcoded path in setup now

Also extended the old `py` alias to a full-blown script which will in
addition to detecting the python repl also find any running molten
session for the current directory (i.e. any running jupy kernel) and let
the user choose the right one if there is multiple. Will then default to
starting a kernel-aware repl environment (euporia or jupyter-console).

Added a very simple `-c` option which lets you choose python command to
run manually.
2023-12-12 12:07:41 +01:00
Marty Oehme 297f2c87a3
nvim: Update plugins 2023-12-05 18:01:15 +01:00
Marty Oehme 55a8a18feb
nvim: Fix spelling language
Accidentally put the wrong british language into the global spell setting.
Now it uses the correct one.
2023-12-05 18:00:32 +01:00
Marty Oehme 4d886e7e6d
nvim: Add experimental nushell lsp and treesitter
HACK
Added support for nushell lsp (not yet available to automatically install
through mason integration) and for nushell treesitter (VERY manual
installation as of right now).

Will work for testing out the shell and its nvim integration but
definitely has to be integrated better in the future.
2023-12-04 09:28:22 +01:00
Marty Oehme 78f7112c11
nvim: Update plugins 2023-12-04 09:27:03 +01:00
15 changed files with 466 additions and 246 deletions

View File

@ -1,6 +1,18 @@
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
local startsession = function(file, args)
file = file or "/tmp/jupyter-magma-session.json"
file = file or default_buffer_session()
local path = require("util").get_python_venv()
vim.g["python3_host_prog"] = path
@ -11,10 +23,13 @@ local startsession = function(file, args)
if args then
file = args[0]
end
local once = false
vim.fn.jobstart({ "jupyter", "console", "-f", file }, {
on_stdout = function(_)
vim.cmd("MagmaInit " .. file)
vim.cmd("JupyterAttach " .. file)
if not once then
vim.cmd("MoltenInit " .. file)
end
once = true
end,
on_exit = function(_)
vim.notify(string.format("jupyter kernel stopped: %s", file), vim.log.levels.INFO)
@ -27,39 +42,62 @@ vim.api.nvim_create_user_command("JupyterStart", function()
end, {})
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>")
-- 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" })
local function molten_mappings_set()
-- Operate jupyter notebooks from within vim
map("n", "<localleader>cc", ":MoltenEvaluateLine<cr>", { silent = true })
map(
"n",
"<localleader>C",
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
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" })
@ -93,6 +131,7 @@ 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" })
if vim.b["sessionfile"] == nil then
vim.b["sessionfile"] = vim.fn.tempname() .. ".json"
startsession(vim.b["sessionfile"])
local path = default_buffer_session()
vim.b["sessionfile"] = path
vim.schedule_wrap(startsession(path))
end

View File

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

View File

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

View File

@ -137,7 +137,6 @@ map(
{ desc = "colorschemes" }
)
map("n", "<leader>vl", ":Lazy<cr>", { desc = "Lazy" })
map("n", "<leader>vm", ":Mason<cr>", { desc = "Mason" })
-- PLUGIN: Telescope GLOBAL FUZZY FINDING
-- buffers and files in current workdir
@ -178,16 +177,11 @@ map("n", "<localleader>q", "gqap", { silent = true, desc = "Format current parag
map("x", "<localleader>q", "gq", { silent = true, desc = "Format {motion}" })
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
-- Move to the prev/next spelling error with [S ]S
-- Move to the prev/next spelling error or suggestion with [s ]s
prefix({ ["<localleader>Z"] = { name = "+Spelling" } })
map("n", "<localleader>ZZ", ":setlocal spell! spelllang=en_us,en_uk,de_de<cr>", { desc = "Toggle spellcheck" })
map("n", "<localleader>ZZ", ":setlocal spell! spelllang=en_us,en_gb,de_de<cr>", { desc = "Toggle 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>ZD", ":setlocal spell! spelllang=de_de<cr>", { desc = "Toggle DE_DE spellcheck" })
@ -195,19 +189,23 @@ 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("n", "<localleader>z", "ms[s1z=`s", { desc = "Fix last spell error" })
prefix({ ["<leader>s"] = { name = "+show" } })
-- Set vim to distraction free prose mode
map("n", "<leader>sz", ":ZenMode<cr>", { silent = true })
-- PLUGIN: mini.nvim
prefix({ ["<leader>s"] = { name = "+show" } })
map("n", "<leader>sm", ":lua MiniMap.toggle()<cr>", { silent = true, desc = "toggle minimap" })
map("n", "<leader>ss", ":lua MiniStarter.open()<cr>", { desc = "show startpage" })
map("n", "<leader>sm", ":lua MiniMap.toggle()<cr>", { silent = true, desc = "minimap" })
map("n", "<leader>ss", ":lua MiniStarter.open()<cr>", { desc = "startpage" })
-- PLUGIN: symbols-outline.nvim
map("n", "<leader>so", "<cmd>AerialToggle<cr>", { silent = true, desc = "toggle symbol outline" })
map("n", "<leader>sn", "<cmd>AerialNavToggle<cr>", { silent = true, desc = "toggle symbol navigator" })
map("n", "<leader>so", "<cmd>AerialNavToggle<cr>", { silent = true, desc = "symbol navigator" })
map("n", "<leader>sO", "<cmd>AerialToggle<cr>", { silent = true, desc = "symbol outline" })
-- PLUGIN: nvim-tree
map("n", "<leader>se", "<cmd>NvimTreeToggle<cr>", { silent = true, desc = "toggle filetree" })
map("n", "<leader>se", "<cmd>NvimTreeToggle<cr>", { silent = true, desc = "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
-- Start interactive EasyAlign in visual mode (e.g. vipga)
@ -255,11 +253,10 @@ map("v", "<localleader>nf", ":ZkMatch<cr>", { desc = "find note from selection"
-- PLUGIN: toggleterm.nvim
-- 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
prefix({ ["<localleader>t"] = { name = "+term" } })
map("n", "<leader>tg", ":Lazygit<cr>")
map("n", "<leader>tG", ":Lazygit!<cr>")
map("n", "<leader>tp", ":Pythonterm<cr>")
map("n", "<leader>tP", ":Pythonterm!<cr>")
map("n", "<leader>sg", ":Lazygit<cr>")
map("n", "<leader>sG", ":Lazygit!<cr>")
map("n", "<leader>sp", ":Pythonterm<cr>")
map("n", "<leader>sP", ":Pythonterm!<cr>")
prefix({ ["<localleader>s"] = { name = "+set" } })
-- PLUGIN: wrapping.nvim
@ -277,5 +274,3 @@ map(
'<cmd>lua require("colorizer").attach_to_buffer(0, {mode = "background"} )<cr>',
{ 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 = ",",
tex_flavor = "latex",
format_on_save = false, -- from personal toggle function
disable_autoformat = true, -- only format files manually
}
for o, v in pairs(globals) do

View File

@ -1,33 +0,0 @@
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

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

View File

@ -17,6 +17,7 @@ local servers = {
docker_compose_language_service = {},
dockerls = {},
emmet_ls = {},
eslint = {},
gopls = {},
julials = {},
lua_ls = {
@ -42,6 +43,16 @@ local servers = {
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 map = vim.keymap.set
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" })
@ -59,8 +70,7 @@ local function on_attach(client, bufnr)
{ buffer = bufnr, desc = "Next error" }
)
require("which-key").register({ ["<localleader>l"] = { name = "+lsp" } })
map("n", "<localleader>li", "<cmd>LspInfo<cr>", { buffer = bufnr, desc = "Lsp Info" })
require("which-key").register({ ["<localleader>l"] = { name = "+language" } })
map(
"n",
"<localleader>ld",
@ -100,7 +110,6 @@ local function on_attach(client, bufnr)
{ buffer = bufnr, desc = "Implementation" }
)
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", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", { buffer = bufnr, desc = "Declaration" })
map(
@ -116,16 +125,20 @@ local function on_attach(client, bufnr)
vim.diagnostic.disable(0)
end
end, { buffer = bufnr, desc = "Disable buffer diagnostics" })
if vim.g.format_on_save then
require("lsp-setup.utils").format_on_save(client)
end
end
-- 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/
vim.api.nvim_create_autocmd("InsertEnter", { callback = function() vim.diagnostic.config({ virtual_text = false, }) end })
vim.api.nvim_create_autocmd("InsertLeave", { callback = function() vim.diagnostic.config({ virtual_text = true, }) end })
vim.api.nvim_create_autocmd("InsertEnter", {
callback = function()
vim.diagnostic.config({ virtual_text = false })
end,
})
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
vim.diagnostic.config({ virtual_text = true })
end,
})
lsp.setup({
default_mappings = false,
@ -137,6 +150,7 @@ lsp.setup({
})
local lspconfig = require("lspconfig")
lspconfig.nushell.setup({})
local python_path
-- ensure python virtualenv is determined automatically on lsp start
@ -152,12 +166,11 @@ lspconfig.pyright.setup({
})
lspconfig.ruff_lsp.setup({
on_attach = function(client, bufnr)
on_attach(client, bufnr)
if python_path == nil then
python_path, _ = require("util").get_python_venv(client.config.root_dir)
end
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
client.config.settings.python.pythonPath = python_path
on_attach(client, bufnr)
end,
})
@ -167,45 +180,3 @@ if require("util").is_available("arduino") then
on_new_config = require("arduino").on_new_config,
})
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,51 +12,77 @@ return {
require("quarto").setup({
lspFeatures = {
enabled = true,
languages = { "r", "python", "julia" },
diagnostics = { enabled = true, triggers = { "BufWrite" } },
languages = { "r", "python", "julia", "bash" },
diagnostics = { enabled = true, triggers = { "BufWritePost" } },
completion = { enabled = true },
},
codeRunner = {
enabled = true,
default_method = "molten",
},
})
end,
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,
ft = { "quarto" },
},
-- REPL work
{
"WhiteBlackGoose/magma-nvim-goose",
"3rd/image.nvim",
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",
config = function()
vim.g.magma_image_provider = "kitty"
vim.g.magma_automatically_open_output = false
vim.g.molten_image_provider = "none" -- image integration does NOT work currently :-(
vim.g.molten_auto_open_output = false
end,
cmd = {
"MagmaInit",
"MagmaEvaluateOperator",
"MagmaEvaluateLine",
"MagmaEvaluateVisual",
"MagmaRestart",
"MoltenInfo",
"MoltenInit",
"MoltenDeinit",
"MoltenGoto",
"MoltenNext",
"MoltenPrev",
"MoltenEvaluateLine",
"MoltenEvaluateVisual",
"MoltenEvaluateOperator",
"MoltenEvaluateArgument",
"MoltenReevaluateCell",
"MoltenDelete",
"MoltenShowOutput",
"MoltenHideOutput",
"MoltenEnterOutput",
"MoltenInterrupt",
"MoltenRestart",
"MoltenSave",
"MoltenLoad",
"MoltenExportOutput",
},
ft = { "quarto", "python" },
lazy = false,
keys = {
{ "<leader>vn", ":MoltenInfo<cr>" },
},
},
-- MARKDOWN ONLY
-- MARKDOWN ONLY
-- Evaluate markdown code blocks
{
"jubnzv/mdeval.nvim",
@ -71,11 +97,11 @@ return {
lazy = false,
},
{
"AckslD/nvim-FeMaco.lua",
cmd = {
"FeMaco"
},
ft = { "markdown" },
config = true
}
"AckslD/nvim-FeMaco.lua",
cmd = {
"FeMaco",
},
ft = { "markdown" },
config = true,
},
}

View File

@ -47,25 +47,162 @@ return {
"MasonUpdate",
},
build = ":MasonUpdate",
keys = {
{ "<leader>vm", ":Mason<cr>", desc = "Mason" },
},
},
{
"williamboman/mason-lspconfig.nvim",
cmd = { "LspInstall", "LspUninstall" },
},
{
"jose-elias-alvarez/null-ls.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"jay-babu/mason-null-ls.nvim",
},
event = "VeryLazy",
"WhoIsSethDaniel/mason-tool-installer.nvim",
},
},
event = "BufReadPost",
event = { "BufRead", "BufNewFile", "InsertEnter" },
after = { "nvim-cmp" },
config = function()
require("plugins.config.lsp")
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
{
"hrsh7th/nvim-cmp",
@ -96,12 +233,25 @@ return {
config = function()
require("plugins.config.cmp")
end,
event = { "InsertEnter", "CmdlineEnter", "VeryLazy" },
event = { "InsertEnter", "CmdlineEnter" },
},
-- loading animations for some LSP
{ "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
{
"nvim-neotest/neotest",

View File

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

View File

@ -7,11 +7,21 @@ return {
require("nvim-treesitter.configs").setup({
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "all",
auto_install = true,
highlight = {
enable = true,
language_tree = true,
disable = function(_, bufnr)
return vim.api.nvim_buf_line_count(bufnr) > 7000
if
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,
additional_vim_regex_highlighting = false,
},
incremental_selection = { enable = true },
textobjects = { enable = true },
@ -24,11 +34,6 @@ return {
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
textsubjects = {
enable = true,
@ -37,7 +42,33 @@ return {
[";"] = "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,
event = "BufReadPost",
cmd = {
@ -63,11 +94,10 @@ return {
"https://gitlab.com/HiPhish/nvim-ts-rainbow2.git",
{ "romgrk/nvim-treesitter-context", config = true },
"JoosepAlviste/nvim-ts-context-commentstring",
{
"RRethy/nvim-treesitter-textsubjects",
},
"RRethy/nvim-treesitter-textsubjects",
"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
Fordism
Fordist
Gramsci's
Gramsci
JIT
Kyrgyzstan
Kyūshū
@ -196,3 +196,13 @@ programmatically
TUI
Lemmy
cli
Pareto
decarbonise
Gini
Familia
Bolsa
ppts
ppt
Programo
Urbano
redistributional

43
scripts/.local/bin/py Executable file
View File

@ -0,0 +1,43 @@
#!/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,15 +106,6 @@ else
done
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
if exist distrobox; then
alias db=distrobox