Compare commits

...

10 commits

Author SHA1 Message Date
8748b66344
nvim: Switch python lsp to basedpyright
Switched pyright to basedpyright as it adds a couple noteworthy
rules and some functions that are otherwise exlusive to pylance.

Especially useful for me are semantic highlighting as well as
inlay hints (now that nvim supports it from 0.10 onwards).
2024-06-06 16:23:44 +02:00
4697e09472
nvim: Ensure pythonPath setting always finds entry
LSP attachment would complain if it did not find an existing dict to
access in the `settings.python` section of the python lsp dictionaries.
This fixes that by creating an empty dict if nothing exists yet,
essentially functioning as null-check.
2024-06-06 16:23:43 +02:00
b37650ac03
nvim: Re-enable femaco plugin
Since it in fact works wonderfully now, we re-enable FeMaco, allowing to
edit codeblocks in markdown-like environments (but really anywhere) by
simply invoking `<localleader>ce` ('codeblock-edit').

The mapping is only active in markdown and quarto files for the time
being, though more can probably be added.
The command itself works anywhere (`:FeMaco`), so can be used in racket
or norg or whereever.
2024-06-06 16:23:42 +02:00
989081abfc
nvim: Only register markdown which-keys if available
Check for availability of which-key plugin before setting up layer
key descriptions.
2024-06-06 16:23:41 +02:00
405af0f020
nvim: Move util to core.util module
Moved all utility functions from their own directory into
the core functionality direcotyr as a single file.
2024-06-06 16:23:41 +02:00
e939305df3
nvim: Update plugins 2024-06-06 10:25:08 +02:00
7fd32f873a
nvim: Change cmp results order and icons
Made lsp and LaTeX icons a little less obnoxious,
and fixed order to better load more pertinent results.
2024-06-06 10:12:24 +02:00
434974284a
nvim: Fix flash for search and operator pending
flash.nvim was activating on searches which, while perhaps useful
for some people, was not for me. It stops the (incremental) search
as soon as no valid target exists which drops you back into normal
mode while still typing out the search and thus doing
who-knows-what.

The operator pending mode for the original jump mapping has been
removed to allow the 'surround' mappings from mini plugin to
always work correctly (`ysiw`, `csaw`, ...).
2024-06-06 09:58:25 +02:00
cb21789f3a
nvim: Add mapping for inlay hints
`<localleader>li` will show inlay hints if they are available
for the active LSP server.
2024-06-06 09:45:34 +02:00
c03b88c6cc
nvim: Formatting 2024-06-06 09:43:20 +02:00
15 changed files with 177 additions and 180 deletions

View file

@ -1,6 +1,9 @@
local map = vim.keymap.set
require("which-key").register({ ["<localleader>c"] = { name = "+md-code" } })
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>c"] = { name = "+codecells" } })
require("which-key").register({ ["<localleader>e"] = { name = "+criticmarkup" } })
end
if require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then
map("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<cr>", { silent = true })

View file

@ -13,7 +13,7 @@ end
-- Start quarto session
local startsession = function(file, args)
file = file or default_buffer_session()
local path = require("util").get_python_venv()
local path = require("core.util").get_python_venv()
vim.g["python3_host_prog"] = path
if vim.fn.executable("jupyter-console") ~= 1 then

View file

@ -1,87 +1,92 @@
{
"Arduino.nvim": { "branch": "main", "commit": "fad71572bf7a79b88da38167a756259b03d0c3ef" },
"Arduino.nvim": { "branch": "main", "commit": "7fd0f58c6f7a460ef180ef3bc9715baa37e9dd36" },
"BetterLua.vim": { "branch": "master", "commit": "d2d6c115575d09258a794a6f20ac60233eee59d5" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
"aerial.nvim": { "branch": "master", "commit": "3748e87a316a68754341cdffcef44fee61dee51c" },
"aerial.nvim": { "branch": "master", "commit": "4d10acbcb760802ea74381ac3ed98cbb6e5f7805" },
"bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" },
"cmp-beancount": { "branch": "main", "commit": "da154ea94d598e6649d6ad01efa0a8611eff460d" },
"cmp-beancount": { "branch": "main", "commit": "c8a2533828b84546ae279d60137aec92bd52dc72" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-calc": { "branch": "main", "commit": "ce91d14d2e7a8b3f6ad86d85e34d41c1ae6268d9" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-digraphs": { "branch": "master", "commit": "5efc1f0078d7c5f3ea1c8e3aad04da3fd6e081a9" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" },
"cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-pandoc-references": { "branch": "master", "commit": "2c808dff631a783ddd2c554c4c6033907589baf6" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-rg": { "branch": "master", "commit": "677a7874ee8f1afc648c2e7d63a97bc21a7663c5" },
"cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" },
"cmp-treesitter": { "branch": "master", "commit": "13e4ef8f4dd5639fca2eb9150e68f47639a9b37d" },
"cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" },
"cmp-tmux": { "branch": "main", "commit": "95b1b921802e6f60627b3e76afb9380fddd87f9a" },
"cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" },
"conform.nvim": { "branch": "master", "commit": "3d59cbd01a4b74124c5a6fb23b8cc63e5c2db3d5" },
"conform.nvim": { "branch": "master", "commit": "9b26e81c4292106e68dda3e7b64473434fd5b3e0" },
"dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" },
"dressing.nvim": { "branch": "master", "commit": "42d767b04c50a6966c9633e3968bc65c0c2f2bfc" },
"fidget.nvim": { "branch": "main", "commit": "a3e1e79116ceb93d4c8c0ff432bf506b3213a24d" },
"friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" },
"dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" },
"fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" },
"flash.nvim": { "branch": "main", "commit": "7bb4a9c75d1e20cd24185afedeaa11681829ba23" },
"friendly-snippets": { "branch": "main", "commit": "e11b09bf10706bb74e16e4c3d11b2274d62e687f" },
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
"git-conflict.nvim": { "branch": "main", "commit": "4c8e252b87d54d944c1e56bfb477f78b6fdaf661" },
"gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
"glance.nvim": { "branch": "master", "commit": "8ed5cf3b3b1231ea696d88c9efd977027429d869" },
"headlines.nvim": { "branch": "master", "commit": "d39c4e6ed8963717bc9b2dc39fada8fe1039e9bf" },
"image.nvim": { "branch": "master", "commit": "9b6248bd8b58b505559e31eb581b7c4638369ec3" },
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
"lightspeed.nvim": { "branch": "main", "commit": "fcc72d8a4d5f4ebba62d8a3a0660f88f1b5c3b05" },
"lsp-setup.nvim": { "branch": "main", "commit": "22ba14fb5c4208fd93f616d7b99bb47656e6e144" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
"git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" },
"gitsigns.nvim": { "branch": "main", "commit": "76927d14d3fbd4ba06ccb5246e79d93b5442c188" },
"glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" },
"headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" },
"image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" },
"lazy.nvim": { "branch": "main", "commit": "b0ba3f9399bf48c86abaa4db1a40bd0b681d5018" },
"lsp-setup.nvim": { "branch": "main", "commit": "6e4e977512ce426d8b52c27f3b6e6aefc73e1452" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" },
"markmap.nvim": { "branch": "main", "commit": "3befc2a54c2448a16c30c1c7762aab263f22946a" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "bf0f4f8062d3acbe0afcc61db01a4d19d96310e4" },
"markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"mini.nvim": { "branch": "main", "commit": "b5645ac6eefce8e7af9d7dd4e5e296a81cba8a10" },
"molten-nvim": { "branch": "main", "commit": "21d766c2d60e5f6e03f507e7f3e382a2a927ad41" },
"neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
"neotest": { "branch": "master", "commit": "b47c99265253f0a31a428b698c59ec0bc956e78d" },
"mdeval.nvim": { "branch": "master", "commit": "2c32e2f3e7d8f222e7a4724989f218d036e1081d" },
"mini.nvim": { "branch": "main", "commit": "f24747266a047617d06605a2316aa6c071662fa2" },
"molten-nvim": { "branch": "main", "commit": "df5ccef3b6fda3582f7746e45327ee031f668826" },
"neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" },
"neotest": { "branch": "master", "commit": "6f35d797882c6ce0ab7c87dc86561512dc3d7aba" },
"neotest-python": { "branch": "master", "commit": "81d2265efac717bb567bc15cc652ae10801286b3" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-FeMaco.lua": { "branch": "main", "commit": "96bbf843595dbe865838b3f2484b73557f34700c" },
"nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-coverage": { "branch": "main", "commit": "cf4b5c61dfac977026a51a2bcad9173c272986ce" },
"nvim-lint": { "branch": "master", "commit": "966ab3dc37eee3e413692264b44a3011b05a6060" },
"nvim-lspconfig": { "branch": "master", "commit": "41f40dc4b86f3e166cf08115f621001972565a20" },
"nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "cbd041d91b90cd3c02df03fe6133208888f8e008" },
"nvim-tree.lua": { "branch": "master", "commit": "f1b3e6a7eb92da492bd693257367d9256839ed3d" },
"nvim-coverage": { "branch": "main", "commit": "aa4b4400588e2259e87e372b1e4e90ae13cf5a39" },
"nvim-lint": { "branch": "master", "commit": "1a3a8d047bc01f1760ae4a0f5e80f111ea222e67" },
"nvim-lspconfig": { "branch": "master", "commit": "d1ab6b6051976b04948e127b0f302a465b1394d6" },
"nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" },
"nvim-surround": { "branch": "main", "commit": "f1f0699a1d49f28e607ffa4361f1bbe757ac5ebc" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" },
"nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" },
"nvim-treesitter": { "branch": "master", "commit": "f197a15b0d1e8d555263af20add51450e5aaa1f0" },
"nvim-treesitter-context": { "branch": "master", "commit": "9c06b115abc57c99cf0aa81dc29490f5001f57a1" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "4c344ffc8d54d7e1ba2cefaaa2c10ea93aa1cc2d" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "55d11124c45e9bb506703f73e5775652ed5357e9" },
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
"nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" },
"nvim-web-devicons": { "branch": "master", "commit": "a55b801b7ef5719ca25692c3a0a5447fdfb692ed" },
"otter.nvim": { "branch": "main", "commit": "cf29fc255bce78fd03565b40722438c0ab3ce05d" },
"nvim-treesitter-context": { "branch": "master", "commit": "5efba33af0f39942e426340da7bc15d7dec16474" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "1428108f18ce9d8cc4481dcedebeeb490eabf395" },
"nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
"otter.nvim": { "branch": "main", "commit": "5cd161f28835fada50d99c89dc05041565a27bdb" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"quarto-nvim": { "branch": "main", "commit": "0a35b3890e9d723b730506d7d8b3ba3d0d6aae2e" },
"quarto-nvim": { "branch": "main", "commit": "67e09027b5d8bd948907734fc6fb15028ffdcd28" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" },
"smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" },
"stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"trouble.nvim": { "branch": "main", "commit": "46a19388d3507f4c4bebb9994bf821a79b3bc342" },
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
"undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" },
"vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" },
"vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" },
"vim-easy-align": { "branch": "master", "commit": "0db4ea6132110631ec678a99a82aa49a0686ae65" },
"vim-exchange": { "branch": "master", "commit": "d6c1e9790bcb8df27c483a37167459bbebe0112e" },
"vim-numbertoggle": { "branch": "main", "commit": "df9b1fe616507340718716204ba7f434125bdf7a" },
"vim-pandoc-syntax": { "branch": "master", "commit": "16939cda184ff555938cc895cc62477c172997f9" },
"vim-scimark": { "branch": "master", "commit": "9b66a88fa4bb87b8baab3c4aecc43b985b32e7fd" },
"vim-spellsync": { "branch": "master", "commit": "3d6dd50de9c4d953cc16638112a6ae196df41463" },
"which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" },
"wrapping.nvim": { "branch": "master", "commit": "5e87f1424c86c50d3bc205830aa56ed1cad45467" },
"which-key.nvim": { "branch": "main", "commit": "4b7167f8fb2dba3d01980735e3509e172c024c29" },
"wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" },
"zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" },
"zk-nvim": { "branch": "main", "commit": "fb0962b75a680561f94cae0588b8da92ea8d2fae" }
"zk-nvim": { "branch": "main", "commit": "66b9b490e930fb77f93a2a0c64e0da9a5144fd0a" }
}

View file

@ -1,5 +1,5 @@
local map = vim.keymap.set
local is_available = require("util").is_available
local is_available = require("core.util").is_available
if is_available("which-key") then
local prefix = require("which-key").register

View file

@ -1,17 +1,32 @@
local T = {}
local exepath = vim.fn.exepath
local function path_join(...)
return table.concat(vim.tbl_flatten { ... }, '/')
-- from astronvim util function
--- Check if a plugin is defined in lazy. Useful with lazy loading when a plugin is not necessarily loaded yet
---@param plugin string The plugin to search for
---@return boolean available # Whether the plugin is available
function T.is_available(plugin)
return T.get_plugin(plugin) and true or false
end
-- Get the plugin file handle if it exists, return nil otherwise
function T.get_plugin(plugin)
local status, lib = pcall(require, plugin)
if status then
return lib
end
return nil
end
-- from https://github.com/ray-x/navigator.lua/issues/247#issue-1465308677
T.get_path = function(workspace)
local function path_join(...)
return table.concat(vim.tbl_flatten({ ... }), "/")
end
-- return the current python environment path
function T.get_python_venv(workspace)
-- Use activated virtualenv.
if vim.env.VIRTUAL_ENV then
return path_join(vim.env.VIRTUAL_ENV, "bin", "python")
end
-- Find and use virtualenv in workspace directory.
for _, pattern in ipairs({ "*", ".*" }) do
local match = vim.fn.glob(path_join(workspace, pattern, "pyvenv.cfg"))
@ -26,9 +41,8 @@ T.get_path = function(workspace)
return path_join(venv_base_folder, "bin", "python")
end
end
-- Fallback to system Python.
return exepath("python3") or exepath("python") or "python"
return vim.fn.exepath("python3") or vim.fn.exepath("python") or "python"
end
return T

View file

@ -42,11 +42,6 @@ cmp.setup({
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "otter" },
{ name = "luasnip", keyword_length = 2 },
{ name = "pandoc_references" },
{ name = "nvim_lua" },
{
name = "beancount",
@ -54,6 +49,11 @@ cmp.setup({
account = vim.env["HOME"] .. "/documents/records/budget/main.beancount", -- TODO implement dynamically
},
},
{ name = "otter" },
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip", keyword_length = 2 },
{ name = "pandoc_references" },
{ name = "calc" },
{ name = "path" },
{ name = "buffer", keyword_length = 3 },
@ -61,7 +61,7 @@ cmp.setup({
{ name = "spell", keyword_length = 3 },
{ name = "tmux" }, -- { name = 'rg', keyword_length = 5 },
{ name = "vCard" },
{ name = "digraphs" },
{ name = "digraphs", keyword_length = 2 },
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
@ -117,10 +117,10 @@ cmp.setup({
vim_item.menu = ({
buffer = "",
calc = "󰃬",
digraphs = "",
latex_symbols = "󰊄",
digraphs = "",
latex_symbols = "𝓧",
luasnip = "",
nvim_lsp = "",
nvim_lsp = "",
nvim_lua = "󰢱",
pandoc_references = "",
spell = "󰓆",

View file

@ -33,7 +33,7 @@ local servers = {
marksman = {
filetypes = { "markdown", "quarto" },
},
pyright = {},
basedpyright = {},
ruff_lsp = {},
serve_d = {},
tailwindcss = {},
@ -77,6 +77,9 @@ local function on_attach(client, bufnr)
"<cmd>lua vim.diagnostic.open_float()<cr>",
{ buffer = bufnr, desc = "Line diagnostics" }
)
map("n", "<localleader>li", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end, { buffer = bufnr, desc = "Inlay hints" })
map("n", "<localleader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", { buffer = bufnr, desc = "Codeactions" })
map("n", "<localleader>ln", "<cmd>lua vim.lsp.buf.rename()<cr>", { buffer = bufnr, desc = "Rename element" })
if vim.fn.exists(":Glance") then
@ -159,12 +162,13 @@ lspconfig.nushell.setup({})
local python_path
-- ensure python virtualenv is determined automatically on lsp start
lspconfig.pyright.setup({
lspconfig.basedpyright.setup({
on_attach = function(client, bufnr)
if python_path == nil then
python_path, _ = require("util").get_python_venv(client.config.root_dir)
python_path, _ = require("core.util").get_python_venv(client.config.root_dir)
end
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
client.config.settings.python = {} or client.config.settings.python
client.config.settings.python.pythonPath = python_path
on_attach(client, bufnr)
end,
@ -173,14 +177,15 @@ 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)
python_path, _ = require("core.util").get_python_venv(client.config.root_dir)
end
client.config.settings.python = {} or client.config.settings.python
client.config.settings.python.pythonPath = python_path
end,
})
-- set up arduino with the help of arduino.nvim plugin
if require("util").is_available("arduino") then
if require("core.util").is_available("arduino") then
lspconfig.arduino_language_server.setup({
on_new_config = require("arduino").on_new_config,
})

View file

@ -51,7 +51,7 @@ return {
keys = {
{
"s",
mode = { "n", "x", "o" },
mode = { "n", "x" },
function()
require("flash").jump()
end,
@ -73,22 +73,6 @@ return {
end,
desc = "Remote Flash",
},
{
"R",
mode = { "o", "x" },
function()
require("flash").treesitter_search()
end,
desc = "Treesitter Search",
},
{
"<c-s>",
mode = { "c" },
function()
require("flash").toggle()
end,
desc = "Toggle Flash Search",
},
},
},
@ -127,7 +111,7 @@ return {
hooks = {
pre = function()
-- use treesitter commentstring functionality if it's installed
if require("util").is_available("ts_context_commentstring") then
if require("core.util").is_available("ts_context_commentstring") then
require("ts_context_commentstring.internal").update_commentstring()
end
end,

View file

@ -81,6 +81,18 @@ return {
{ "<leader>vn", ":MoltenInfo<cr>" },
},
},
-- Edit code blocks in md/quarto using whatever language is
{
"AckslD/nvim-FeMaco.lua",
cmd = {
"FeMaco",
},
ft = { "markdown", "quarto" },
opts = {},
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
},
-- MARKDOWN ONLY
-- Evaluate markdown code blocks
@ -96,12 +108,4 @@ return {
},
lazy = false,
},
{
"AckslD/nvim-FeMaco.lua",
cmd = {
"FeMaco",
},
ft = { "markdown" },
config = true,
},
}

View file

@ -22,7 +22,9 @@ local formatters = {
javascript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
json = { "jq" },
liquid = { { "prettierd", "prettier" } },
lua = { "stylua" },
markdown = { { "prettierd", "prettier" } },
python = { "ruff_fix", "ruff_format" },
sh = { "shfmt" },
svelte = { { "prettierd", "prettier" } },
@ -123,7 +125,7 @@ return {
end,
})
end,
event = { "BufWritePost", "InsertLeave" },
event = { "BufWritePre", "InsertEnter" },
},
-- formatting setup
@ -248,6 +250,7 @@ return {
"nvim-neotest/neotest",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-neotest/nvim-nio",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",
@ -262,7 +265,7 @@ return {
}),
},
})
if require("util").is_available("which-key") then
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>t"] = { name = "+test" } })
end
end,

View file

@ -60,7 +60,7 @@ local prose_plugs = {
{
"mickael-menu/zk-nvim",
config = function()
if require("util").is_available("which-key") then
if require("core.util").is_available("which-key") then
local prefix = require("which-key").register
prefix({ ["<leader>n"] = { name = "+notes" } })
prefix({ ["<localleader>n"] = { name = "+note" } })
@ -71,7 +71,15 @@ local prose_plugs = {
require("zk").edit(opts, { title = "Zk Orphans" })
end)
end
require("zk").setup({ picker = "telescope" })
require("zk").setup({
picker = "telescope",
lsp = {
auto_attach = {
enabled = true,
filteypes = { "markdown", "quarto" },
},
},
})
end,
ft = writing_ft,
cmd = {

View file

@ -9,7 +9,7 @@ return {
},
cmd = "Telescope",
config = function()
if require("util").is_available("which-key") then
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<leader>f"] = { name = "+find" } })
end
-- Setup up telescope fuzzy finding settings

View file

@ -3,7 +3,18 @@ return {
{
"nvim-lualine/lualine.nvim",
requires = { "nvim-tree/nvim-web-devicons", config = true },
opts = {
config = function()
-- FIXME: Errors out on no pynvim installed
-- local function molten()
-- if
-- require("core.util").is_available("molten.status")
-- and require("molten.status").initialized() ~= ""
-- then
-- return "󱪄"
-- end
-- return ""
-- end
require("lualine").setup({
options = {
icons_enabled = true,
theme = "auto",
@ -16,7 +27,7 @@ return {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_x = { "encoding", "fileformat", "filetype", "molten" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
@ -30,7 +41,8 @@ return {
},
tabline = {},
extensions = { "quickfix", "toggleterm" },
},
})
end,
event = { "BufNewFile", "BufAdd", "BufWinEnter" },
},
-- create pretty unobtrusive notifications
@ -124,7 +136,7 @@ return {
local Terminal = require("toggleterm.terminal").Terminal
-- need to disable indentlines since they obscure first line of terminal
if require("util").is_available("mini.nvim") then
if require("core.util").is_available("mini.nvim") then
vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
callback = function()

View file

@ -1,17 +0,0 @@
-- helper for easily defining highlight groups
--
-- usage example - italicize comments:
-- set_hl("Comment", { gui = "italic" })
return function(group, options)
local bg = options.bg == nil and "" or "guibg=" .. options.bg
local fg = options.fg == nil and "" or "guifg=" .. options.fg
local gui = options.gui == nil and "" or "gui=" .. options.gui
local link = options.link or false
local target = options.target
if not link then
vim.cmd(string.format("hi %s %s %s %s", group, bg, fg, gui))
else
vim.cmd(string.format("hi! link", group, target))
end
end

View file

@ -1,24 +0,0 @@
local T = {}
-- from astronvim util function
--- Check if a plugin is defined in lazy. Useful with lazy loading when a plugin is not necessarily loaded yet
---@param plugin string The plugin to search for
---@return boolean available # Whether the plugin is available
function T.is_available(plugin)
return T.get_plugin(plugin) and true or false
end
-- Get the plugin file handle if it exists, return nil otherwise
function T.get_plugin(plugin)
local status, lib = pcall(require, plugin)
if(status) then return lib end
return nil
end
-- get the current python environment
-- return its path
function T.get_python_venv(workspace)
return require("util.pyenv").get_path(workspace)
end
return T