Compare commits

...

7 commits

Author SHA1 Message Date
6d82162f16
nvim: Switch basic file editor to mini.files
While we can still reach vifm through the `<leader>E` mapping, the basic
`<leader>e` file editor mapping has been switched over to the mini.files
browser.
It works somewhat like oil.nvim, in that you simply get a buffer to work
with that you can delete/move/copy/rename lines in and after doing a
synchronization (with `=`) all changes are actually applied to the
files.
Since I mostly need the quick file opening to do some quick renaming
operation or want to open an adjacent file this seems like the quickest
and most painless option to do so. For larger operations I still have
access to the full vifm experience.
2024-06-07 11:08:56 +02:00
4f67a6d3ca
nvim: Fix which-key conditional usage if not loaded
The only left-over which-key invocation which did not check for its
existence beforehand.
2024-06-07 09:56:55 +02:00
57f2fbd5fe
nvim: Replace vim-easy-align with mini module
Mini.nvim now also comes with an align module which perfectly mimics
the behavior of my beloved junegunn vim-easy-align plugin. It is almost
sad to see such an old friend go, but ultimately it removes a redundant
plugin and switches the setup ever so slightly more towards being lua
based.
The mini module also allows more advanced lua-based modifier pattern
shenanigans but so far I don't need any of the advanced stuff: I just
need a quick way to align markdown tables and similar, and this one does
exactly the same as before, only with a couple nice additional options
and previews. It still uses the same key chord `ga<where>` but also
offers `gA<where>` which apparently comes with a nicer preview. My
fingers will probably stick to the former for the time being.

One thing that changes is that, by default, it will align *all*
separators not just the first instance on each line. To mimic the old
behavior you can, in alignment mode, hit `f` to enter a filter and enter
`n==2` to get the same result as default vim-easy-align (the first pair
of delimiters are aligned).
Also it comes with some nice extra functionality like trimming
whitespace by just hitting `t` when in alignment mode
2024-06-07 09:50:26 +02:00
5c4afcb0b3
nvim: Update plugins 2024-06-06 22:36:16 +02:00
94c2d83c86
nvim: Fix trouble for major version update
Fixed for new invocation usage and removed deprecated commands.
Added telescope functionality (to push results into trouble) though I am
not quite happy with the close coupling yet. Have not found an easy way
to only have this mapping be created if trouble exists.
2024-06-06 22:32:27 +02:00
1771a61334
nvim: Use peek for markdown preview where possible
On machines that have deno installed, we use peek instead of
markdown-preview for html-based previews of md files. The preview is
more responsive and in a neater package, as well as just not relying on
any vim plugin stuff to the same degree.
We still fall back to the old markdown-preview if no deno executable is
available.

We also change the key maps slightly to prepare for future 'prose' or
'preview' based mappings: All mappings are registered under the
`<leader>p` layer, with md preview being `<leader>pp` and various
mindmap operations moved to `<leader>pm`.
2024-06-06 20:50:37 +02:00
b69548fa38
nvim: Load nvim-surround as VeryLazy
This fixes the somewhat confusing issue of trying to use any of the
surround operations before entering insert mode at least once in a file
(so, probably as the first operation). Before, the plugin would just
silently fail.
Now it simply loads very lazily, which does not affect load times
strongly.
2024-06-06 20:45:53 +02:00
10 changed files with 99 additions and 50 deletions

View file

@ -5,7 +5,7 @@ if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>e"] = { name = "+criticmarkup" } })
end
if require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then
if require("core.util").is_available("zk") and require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then
map("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<cr>", { silent = true })
end
@ -22,11 +22,26 @@ map("n", "[c", "?^```<cr>n}:nohl<cr>", { desc = "previous code cell" })
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" })
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>p"] = { name = "+prose" } })
end
-- show nice md preview in browser (auto-syncs scrolling)
map("n", "<localleader>cp", "<Plug>MarkdownPreviewToggle", { desc = "show md preview" })
if require("core.util").is_available("peek") then
local peek = require("peek")
local function togglePeek()
if peek.is_open() then
peek.close()
else
peek.open()
end
end
map("n", "<leader>pp", togglePeek, { desc = "show md preview" })
else
map("n", "<leader>pp", "<Plug>MarkdownPreviewToggle", { desc = "show md preview" })
end
-- create mindmaps directly from markdown! requires external executable
if vim.fn.executable("markmap") then
map("n", "<localleader>cm", "<cmd>MarkmapOpen<cr>", { desc = "open md mindmap" })
map("n", "<localleader>cM", "<cmd>MarkmapWatch<cr>", { desc = "watch for md mindmap" })
map("n", "<leader>pm", "<cmd>MarkmapOpen<cr>", { desc = "open md mindmap" })
map("n", "<leader>pM", "<cmd>MarkmapWatch<cr>", { desc = "watch for md mindmap" })
end

View file

@ -35,10 +35,9 @@
"glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" },
"headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" },
"image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" },
"lazy.nvim": { "branch": "main", "commit": "b0ba3f9399bf48c86abaa4db1a40bd0b681d5018" },
"lazy.nvim": { "branch": "main", "commit": "70f2c090d3ffb14f8702d468e05beb240b768881" },
"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": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
@ -54,7 +53,7 @@
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-coverage": { "branch": "main", "commit": "aa4b4400588e2259e87e372b1e4e90ae13cf5a39" },
"nvim-lint": { "branch": "master", "commit": "1a3a8d047bc01f1760ae4a0f5e80f111ea222e67" },
"nvim-lspconfig": { "branch": "master", "commit": "d1ab6b6051976b04948e127b0f302a465b1394d6" },
"nvim-lspconfig": { "branch": "master", "commit": "92166b89ab4b3d60f24e58170cac53b7141fd032" },
"nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" },
"nvim-surround": { "branch": "main", "commit": "f1f0699a1d49f28e607ffa4361f1bbe757ac5ebc" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" },
@ -67,6 +66,7 @@
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
"otter.nvim": { "branch": "main", "commit": "5cd161f28835fada50d99c89dc05041565a27bdb" },
"peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"quarto-nvim": { "branch": "main", "commit": "67e09027b5d8bd948907734fc6fb15028ffdcd28" },
@ -75,7 +75,7 @@
"stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"trouble.nvim": { "branch": "main", "commit": "46a19388d3507f4c4bebb9994bf821a79b3bc342" },
"trouble.nvim": { "branch": "main", "commit": "7a9c235806d4d9e2e74889f7e359f183a6d0e20d" },
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
"undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" },
"vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" },
@ -85,7 +85,7 @@
"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": "4b7167f8fb2dba3d01980735e3509e172c024c29" },
"which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" },
"wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" },
"zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" },
"zk-nvim": { "branch": "main", "commit": "66b9b490e930fb77f93a2a0c64e0da9a5144fd0a" }

View file

@ -70,7 +70,9 @@ local function on_attach(client, bufnr)
{ buffer = bufnr, desc = "Next error" }
)
require("which-key").register({ ["<localleader>l"] = { name = "+language" } })
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>l"] = { name = "+language" } })
end
map(
"n",
"<localleader>ld",

View file

@ -107,6 +107,27 @@ return {
})
require("mini.ai").setup()
-- Align tables and other alignable things
require("mini.align").setup({})
require("mini.bracketed").setup({
{
buffer = { suffix = "b", options = {} },
comment = { suffix = "c", options = {} },
conflict = { suffix = "", options = {} },
diagnostic = { suffix = "d", options = {} },
file = { suffix = "f", options = {} },
indent = { suffix = "", options = {} }, -- disable since we use indentscope above
jump = { suffix = "j", options = {} },
location = { suffix = "l", options = {} },
oldfile = { suffix = "o", options = {} },
quickfix = { suffix = "q", options = {} },
treesitter = { suffix = "t", options = {} },
undo = { suffix = "", options = {} }, -- disable since I don't need it
window = { suffix = "w", options = {} },
yank = { suffix = "y", options = {} },
},
})
require("mini.comment").setup({
hooks = {
pre = function()
@ -117,9 +138,19 @@ return {
end,
},
})
require("mini.cursorword").setup({ delay = 500 })
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true, underline = false })
vim.api.nvim_set_hl(0, "MiniCursorwordCurrent", { bold = true, underline = false })
require("mini.files").setup()
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesWindowUpdate",
callback = function(args)
vim.wo[args.data.win_id].number = true
end,
})
require("mini.fuzzy").setup()
require("mini.indentscope").setup({
symbol = "",
@ -148,24 +179,6 @@ return {
starter.gen_hook.aligning("center", "center"),
},
})
require("mini.bracketed").setup({
{
buffer = { suffix = "b", options = {} },
comment = { suffix = "c", options = {} },
conflict = { suffix = "", options = {} },
diagnostic = { suffix = "d", options = {} },
file = { suffix = "f", options = {} },
indent = { suffix = "", options = {} }, -- disable since we use indentscope above
jump = { suffix = "j", options = {} },
location = { suffix = "l", options = {} },
oldfile = { suffix = "o", options = {} },
quickfix = { suffix = "q", options = {} },
treesitter = { suffix = "t", options = {} },
undo = { suffix = "", options = {} }, -- disable since I don't need it
window = { suffix = "w", options = {} },
yank = { suffix = "y", options = {} },
},
})
end,
event = "VimEnter", -- need to load pretty soon for Starter screen
keys = {
@ -174,14 +187,16 @@ return {
function()
require("mini.map").toggle()
end,
silent = true, desc = "minimap" ,
silent = true,
desc = "minimap",
},
{
"<leader>ss",
function()
require("mini.starter").open()
end,
silent = true, desc = "startpage" ,
silent = true,
desc = "startpage",
},
{
"<localleader>w",
@ -190,6 +205,16 @@ return {
end,
desc = "Trim trailing whitespace",
},
{
"<leader>e",
function()
local mf = require("mini.files")
if not mf.close() then
mf.open()
end
end,
desc = "floating file browser",
},
},
},
-- try to avoid putting files in util buffers, e.g. filetree, aerial, undotree, ..

View file

@ -1,15 +1,6 @@
return {
-- Align tables and other alignable things
{
"junegunn/vim-easy-align",
event = "InsertEnter",
keys = {
{ "ga", "<Plug>(EasyAlign)", mode = "n" },
{ "ga", "<Plug>(EasyAlign)", mode = "x" },
},
},
-- surround things with other things using ys/cs/ds
{ "kylechui/nvim-surround", config = true, event = "InsertEnter" },
{ "kylechui/nvim-surround", config = true, event = "VeryLazy" },
-- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
{

View file

@ -9,9 +9,8 @@ return {
end,
cmd = "Vifm",
keys = {
{ "<leader>e", "<cmd>Vifm<cr>", desc = "browse files" },
{ "<leader>E", ":Vifm getcwd()<cr>", desc = "browse project" },
{ "<leader>vc", ":Vifm " .. vim.fn.stdpath("config") .. "/lua<cr>", desc = "open config" },
{ "<leader>E", "<cmd>Vifm<cr>", desc = "buffer file browser" },
{ "<leader>vc", ":Vifm " .. vim.fn.stdpath("config") .. "<cr>", desc = "open config" },
},
event = { "BufEnter" },
}, -- integrate file manager

View file

@ -55,7 +55,9 @@ return {
end, { expr = true, desc = "Previous git hunk" })
-- Actions
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })
if require("core.util").is_available("which-key") then
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })
end
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })

View file

@ -235,13 +235,10 @@ return {
opts = {},
cmd = {
"Trouble",
"TroubleRefresh",
"TroubleToggle",
"TroubleClose",
},
keys = {
{ "<leader>sd", "<cmd>Trouble workspace_diagnostics<cr>", silent = true, desc = "diagnostics workspace" },
{ "<leader>sD", "<cmd>Trouble document_diagnostics<cr>", silent = true, desc = "diagnostics document" },
{ "<leader>sd", "<cmd>Trouble diagnostics toggle<cr>", silent = true, desc = "diagnostics workspace" },
{ "<leader>sD", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", silent = true, desc = "diagnostics document" },
},
},

View file

@ -8,7 +8,7 @@ local prose_plugs = {
config = true,
cmd = { "ZenMode" },
dependencies = { "folke/twilight.nvim" },
keys = { { "<leader>sz", ":ZenMode<cr>", { silent = true } } },
keys = { { "<leader>sz", ":ZenMode<cr>", silent = true, desc = "toggle zen mode" } },
},
{
"andrewferrier/wrapping.nvim",
@ -48,8 +48,21 @@ local prose_plugs = {
ft = writing_ft,
},
-- generate an auto-updating html preview for md files
-- uses the very nice peek if deno is available, otherwise falls back to markdown-preview
{
"toppair/peek.nvim",
event = { "VeryLazy" },
cond = vim.fn.executable("deno") == 1,
build = "deno task --quiet build:fast",
config = function()
require("peek").setup()
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
end,
},
{
"iamcco/markdown-preview.nvim",
cond = vim.fn.executable("deno") == 0,
build = function()
vim.fn["mkdp#util#install"]()
end,

View file

@ -36,6 +36,11 @@ return {
prompt_prefix = "󰍉 ",
selection_caret = "󰳟 ",
color_devicons = true,
mappings = {
-- FIXME Find way to only invoke this *IF* trouble plugin is found
i = { ["<c-t>"] = require("trouble.sources.telescope").open },
n = { ["<c-t>"] = require("trouble.sources.telescope").open },
}
},
pickers = {
buffers = { theme = "ivy" },