aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/mini.lua
diff options
context:
space:
mode:
Diffstat (limited to 'vim/mini.lua')
-rw-r--r--vim/mini.lua276
1 files changed, 186 insertions, 90 deletions
diff --git a/vim/mini.lua b/vim/mini.lua
index 15f4c42..6c31590 100644
--- a/vim/mini.lua
+++ b/vim/mini.lua
@@ -327,12 +327,121 @@ require("lazy").setup({
327 vim.keymap.set({ "n", "t" }, "<A-i>", function() 327 vim.keymap.set({ "n", "t" }, "<A-i>", function()
328 vim.cmd("ToggleTerm direction=float") 328 vim.cmd("ToggleTerm direction=float")
329 end, { desc = "terminal toggle floating term" }) 329 end, { desc = "terminal toggle floating term" })
330 vim.keymap.set({ "n", "t" }, "<A-e>", function()
331 zoom()
332 end, { desc = "terminal toggle floating term" })
330 vim.keymap.set({ "n", "t" }, "<A-v>", function() 333 vim.keymap.set({ "n", "t" }, "<A-v>", function()
331 vim.cmd("ToggleTerm direction=horizontal") 334 vim.cmd("ToggleTerm direction=horizontal")
332 end, { desc = "terminal toggle floating term" }) 335 end, { desc = "terminal toggle floating term" })
333 end, 336 end,
334 }, 337 },
335 --}}} 338 --}}}
339-- Markdown: obsidian {{{
340 {
341 "epwalsh/obsidian.nvim",
342 version = "*", -- recommended, use latest release instead of latest commit
343 lazy = false,
344 ft = "markdown",
345 -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
346 -- event = {
347 -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
348 -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md"
349 -- "BufReadPre path/to/my-vault/**.md",
350 -- "BufNewFile path/to/my-vault/**.md",
351 -- },
352 dependencies = {
353 -- Required.
354 "nvim-lua/plenary.nvim",
355 },
356 config = function()
357 vim.keymap.set("n", "<leader>oo", ":Obsidian", { })
358 vim.keymap.set("n", "<leader>ot", ":ObsidianTags<CR>", { })
359 vim.keymap.set("n", "<leader>os", ":ObsidianSearch<CR>", { })
360 vim.keymap.set("n", "<leader>oq", ":ObsidianQuickSwitch<CR>", { })
361 vim.keymap.set("v", "<leader>on", ":ObsidianLinkNew<CR>", { })
362 vim.keymap.set("n", "<leader>ol", ":ObsidianLinks<CR>", { })
363 require("obsidian").setup({
364 workspaces = {
365 {
366 name = "log",
367 path = "~/log",
368 },
369 },
370 completion = {
371 -- Set to false to disable completion.
372 nvim_cmp = true,
373 -- Trigger completion at 2 chars.
374 min_chars = 2,
375 },
376 mapping = {
377 -- Toggle check-boxes.
378 ["<leader>oc"] = {
379 action = function()
380 return require("obsidian").util.toggle_checkbox()
381 end,
382 opts = { buffer = true },
383 },
384 -- Smart action depending on context, either follow link or toggle checkbox.
385 ["<cr>"] = {
386 action = function()
387 return require("obsidian").util.smart_action()
388 end,
389 opts = { buffer = true, expr = true },
390 },
391 },
392 -- see below for full list of options 👇
393 note_id_func = function(title)
394 return title
395 -- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
396 -- In this case a note with the title 'My new note' will be given an ID that looks
397 -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
398 -- local suffix = ""
399 -- title = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
400 -- if title ~= nil and title ~= "" then
401 -- -- If title is given, transform it into valid file name.
402 -- suffix = "-" .. title
403 -- else
404 -- -- If title is nil, just add 4 random uppercase letters to the suffix.
405 -- for _ = 1, 4 do
406 -- suffix = suffix .. string.char(math.random(65, 90))
407 -- end
408 -- suffix = "-" .. title
409 -- end
410 -- return tostring(os.time()) .. suffix
411 end,
412 -- Optional, for templates (see below).
413 templates = {
414 folder = "templates",
415 date_format = "%Y-%m-%d",
416 time_format = "%H:%M",
417 -- A map for custom variables, the key should be the variable and the value a function
418 substitutions = {},
419 },
420 })
421 end,
422 },
423-- }}}
424-- Markdown: preview {{{
425 {
426 "iamcco/markdown-preview.nvim",
427 cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
428 build = function()
429 vim.fn["mkdp#util#install"]()
430 end,
431 keys = {
432 {
433 "<leader>cp",
434 ft = "markdown",
435 "<cmd>MarkdownPreviewToggle<cr>",
436 desc = "Markdown Preview",
437 },
438 },
439 config = function()
440 vim.cmd([[do FileType]])
441 vim.g.mkdp_browser = 'firefox'
442 end,
443 },
444-- }}}
336 -- lualine {{{ 445 -- lualine {{{
337 { 446 {
338 "nvim-lualine/lualine.nvim", 447 "nvim-lualine/lualine.nvim",
@@ -417,67 +526,67 @@ require("lazy").setup({
417 }, 526 },
418 -- }}} 527 -- }}}
419 528
420 -- lspconfig {{{ 529 -- -- lspconfig {{{
421 -- Use :help lspconfig-all to check servers 530 -- -- Use :help lspconfig-all to check servers
422 { 531 -- {
423 "neovim/nvim-lspconfig", 532 -- "neovim/nvim-lspconfig",
424 lazy = false, 533 -- lazy = false,
425 config = function() 534 -- config = function()
426 local lspconfig = require "lspconfig" 535 -- local lspconfig = require "lspconfig"
427 -- 536 -- --
428 -- typescript 537 -- -- typescript
429 lspconfig.lua_ls.setup {} 538 -- lspconfig.lua_ls.setup {}
430 lspconfig.tsserver.setup {} 539 -- lspconfig.tsserver.setup {}
431 lspconfig.vimls.setup {} 540 -- lspconfig.vimls.setup {}
432 lspconfig.html.setup {} 541 -- lspconfig.html.setup {}
433 -- 542 -- --
434 vim.keymap.set("n", "<leader>F", function() 543 -- vim.keymap.set("n", "<leader>F", function()
435 vim.lsp.buf.format() 544 -- vim.lsp.buf.format()
436 end, { desc = "format files" }) 545 -- end, { desc = "format files" })
437 end, 546 -- end,
438 }, 547 -- },
439 -- }}} 548 -- -- }}}
440 -- Mason {{{ 549 -- -- Mason {{{
441 { 550 -- {
442 "williamboman/mason.nvim", 551 -- "williamboman/mason.nvim",
443 dependencies = { 552 -- dependencies = {
444 "williamboman/mason-lspconfig.nvim", 553 -- "williamboman/mason-lspconfig.nvim",
445 }, 554 -- },
446 config = function() 555 -- config = function()
447 require('mason').setup { 556 -- require('mason').setup {
448 automatically_installation = true, 557 -- automatically_installation = true,
449 ensure_installed = { 558 -- ensure_installed = {
450 "vim-language-server", 559 -- "vim-language-server",
451 "lua-language-server", 560 -- "lua-language-server",
452 "css-lsp", 561 -- "css-lsp",
453 "html-lsp", 562 -- "html-lsp",
454 "prettier", 563 -- "prettier",
455 "stylua", 564 -- "stylua",
456 }, 565 -- },
457 } 566 -- }
458 end 567 -- end
459 }, 568 -- },
460 -- }}} 569 -- -- }}}
461 -- treesitter {{{ 570 -- -- treesitter {{{
462 { 571 -- {
463 "nvim-treesitter/nvim-treesitter", 572 -- "nvim-treesitter/nvim-treesitter",
464 event = { "BufReadPost", "BufNewFile" }, 573 -- event = { "BufReadPost", "BufNewFile" },
465 cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, 574 -- cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
466 build = ":TSUpdate", 575 -- build = ":TSUpdate",
467 config = function() 576 -- config = function()
468 require("nvim-treesitter.configs").setup({ 577 -- require("nvim-treesitter.configs").setup({
469 ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" }, 578 -- ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" },
470 -- 579 -- --
471 highlight = { 580 -- highlight = {
472 enable = true, 581 -- enable = true,
473 use_languagetree = true, 582 -- use_languagetree = true,
474 }, 583 -- },
475 -- 584 -- --
476 indent = { enable = true }, 585 -- indent = { enable = true },
477 }) 586 -- })
478 end, 587 -- end,
479 }, 588 -- },
480 -- }}} 589 -- -- }}}
481 -- nvim-cmp {{{ 590 -- nvim-cmp {{{
482 { 591 {
483 "hrsh7th/nvim-cmp", 592 "hrsh7th/nvim-cmp",
@@ -537,7 +646,6 @@ require("lazy").setup({
537 ["<C-d>"] = cmp.mapping.scroll_docs(-4), 646 ["<C-d>"] = cmp.mapping.scroll_docs(-4),
538 ["<C-f>"] = cmp.mapping.scroll_docs(4), 647 ["<C-f>"] = cmp.mapping.scroll_docs(4),
539 ["<C-Space>"] = cmp.mapping.complete(), 648 ["<C-Space>"] = cmp.mapping.complete(),
540 ["<C-e>"] = cmp.mapping.close(),
541 ['<CR>'] = cmp.mapping.confirm(), 649 ['<CR>'] = cmp.mapping.confirm(),
542 ['<C-c>'] = cmp.mapping.abort(), 650 ['<C-c>'] = cmp.mapping.abort(),
543 } 651 }
@@ -577,7 +685,7 @@ require("lazy").setup({
577 { name = "path" }, 685 { name = "path" },
578 }, 686 },
579 experimental = { 687 experimental = {
580 ghost_text = true, 688 -- ghost_text = true,
581 } 689 }
582 }) 690 })
583 cmp.setup.cmdline(':', { 691 cmp.setup.cmdline(':', {
@@ -675,6 +783,7 @@ require("mini.basics").setup()
675require("mini.misc").setup({ 783require("mini.misc").setup({
676 make_global = { "put", "put_text", "zoom" }, 784 make_global = { "put", "put_text", "zoom" },
677}) 785})
786vim.keymap.set( 'n', '<leader>z', function() zoom() end, { buffer = bufnr, desc = 'zoom' })
678--}}} 787--}}}
679-- mini.extra {{{ 788-- mini.extra {{{
680require("mini.extra").setup() 789require("mini.extra").setup()
@@ -800,10 +909,10 @@ require("mini.visits").setup()
800-- mini.surround {{{ 909-- mini.surround {{{
801require("mini.surround").setup { 910require("mini.surround").setup {
802 mappings = { 911 mappings = {
803 add = 'S' 912 add = 'sa'
804 } 913 }
805} 914}
806vim.keymap.set('v', 's', 'S', { remap = true }) 915vim.keymap.set('v', 's', 'sa', {})
807-- }}} 916-- }}}
808-- mini.indentscope {{{ 917-- mini.indentscope {{{
809require("mini.indentscope").setup() 918require("mini.indentscope").setup()
@@ -957,16 +1066,16 @@ require("mini.pairs").setup()
957-- add { source = "lambdalisue/suda.vim" } 1066-- add { source = "lambdalisue/suda.vim" }
958-- }}} 1067-- }}}
959-- -- true-zen {{{ 1068-- -- true-zen {{{
960-- add({ 1069-- Add({
961-- source = "Pocco81/true-zen.nvim", 1070-- source = "Pocco81/true-zen.nvim",
962-- }) 1071-- })
963-- vim.keymap.set("n", "<leader>z", ":TZAtaraxis<CR>") 1072-- vim.keymap.set("n", "<leader>z", ":TZAtaraxis<CR>")
964-- -- }}} 1073-- -- }}}
965-- -- bufferline {{{ 1074-- bufferline {{{
966Add({ 1075Add({
967 source = "akinsho/bufferline.nvim", 1076 source = "akinsho/bufferline.nvim",
968 depends = { 1077 depends = {
969 "nvim-tree/nvim-web-devicons", -- OPTIONAL: for file icons 1078 "nvim-tree/nvim-web-devicons",
970 "tiagovla/scope.nvim", 1079 "tiagovla/scope.nvim",
971 }, 1080 },
972}) 1081})
@@ -1015,34 +1124,15 @@ require('bufferline').setup{
1015 } 1124 }
1016 }, 1125 },
1017 custom_filter = function (buf_number) 1126 custom_filter = function (buf_number)
1018 local tabId = tostring(vim.fn.tabpagenr()) 1127 for _, p in ipairs(vim.t.bufs) do
1019 if vim.g.tab_group[tabId] then 1128 if p == buf_number then
1020 for _, p in ipairs(vim.g.tab_group[tabId]) do 1129 return true
1021 if p == buf_number then
1022 return true
1023 end
1024 end 1130 end
1025 end 1131 end
1026 return false 1132 return false
1027 end 1133 end
1028 } 1134 }
1029}; 1135};
1030
1031-- require("bufferline").setup({
1032-- options = {
1033-- custom_filter = function(buf_number)
1034-- local tabId = vim.fn.tabpagenr()
1035-- if vim.g.tab_group[tabId] then
1036-- for _, p in ipairs(vim.g.tab_group[tabId]) do
1037-- if p == buf_number then
1038-- return true
1039-- end
1040-- end
1041-- end
1042-- return false
1043-- end
1044-- },
1045-- })
1046-- keymaps {{{ 1136-- keymaps {{{
1047for i = 1, 9, 1 do 1137for i = 1, 9, 1 do
1048 vim.keymap.set("n", string.format("<A-%s>", i), function() 1138 vim.keymap.set("n", string.format("<A-%s>", i), function()
@@ -1058,6 +1148,12 @@ vim.keymap.set("n", "<M-p>", "<Cmd>BufferLineTogglePin<CR>", opts)
1058-- }}} 1148-- }}}
1059-- -- TODO: tabpages 1149-- -- TODO: tabpages
1060-- -- }}} 1150-- -- }}}
1151Add {
1152 source = "chentoast/marks.nvim"
1153}
1154require('marks').setup {
1155}
1156vim.cmd("hi MarkSignHL guifg=#f85e84 guibg=#37343a")
1061 1157
1062-- KEYMAPS {{{ 1158-- KEYMAPS {{{
1063 1159