dotfiles/config/nvim/plugin/mini.lua (view raw)
| 1 | Config.add "echasnovski/mini.nvim" |
| 2 | |
| 3 | Config.map("n", "<leader>c", function() MiniBufremove.delete() end) |
| 4 | Config.map("n", "<leader>e", function() |
| 5 | local path = vim.api.nvim_buf_get_name(0) |
| 6 | if path == nil or vim.startswith(path, "term://") or vim.fn.filereadable(path) == 0 then path = vim.uv.cwd() or "" end |
| 7 | MiniFiles.open(path, true) |
| 8 | MiniFiles.reveal_cwd() |
| 9 | end) |
| 10 | |
| 11 | require("mini.icons").setup {} |
| 12 | Config.later(function() |
| 13 | require("mini.ai").setup {} |
| 14 | require("mini.bufremove").setup { silent = true } |
| 15 | require("mini.comment").setup {} |
| 16 | require("mini.pairs").setup {} |
| 17 | require("mini.splitjoin").setup {} |
| 18 | |
| 19 | local hi_words = require("mini.extra").gen_highlighter.words |
| 20 | require("mini.hipatterns").setup { |
| 21 | highlighters = { |
| 22 | hex_color = require("mini.hipatterns").gen_highlighter.hex_color(), |
| 23 | fixme = hi_words({ "FIXME" }, "MiniHipatternsFixme"), |
| 24 | todo = hi_words({ "TODO", "Todo" }, "MiniHipatternsTodo"), |
| 25 | note = hi_words({ "NOTE" }, "MiniHipatternsNote"), |
| 26 | hack = hi_words({ "HACK" }, "MiniHipatternsHack"), |
| 27 | }, |
| 28 | } |
| 29 | end) |
| 30 | |
| 31 | Config.aucmd("User", "MiniFilesBufferCreate", function(ev) |
| 32 | vim.schedule(function() |
| 33 | vim.api.nvim_set_option_value("buftype", "acwrite", { buf = 0 }) |
| 34 | vim.api.nvim_create_autocmd("BufWriteCmd", { |
| 35 | callback = function() require("mini.files").synchronize() end, |
| 36 | buffer = ev.data.buf_id, |
| 37 | }) |
| 38 | end) |
| 39 | end) |
| 40 | |
| 41 | require("mini.files").setup { |
| 42 | content = { |
| 43 | filter = function(f) |
| 44 | return ({ |
| 45 | [".bin"] = {}, |
| 46 | [".docker"] = {}, |
| 47 | [".git"] = {}, |
| 48 | [".jj"] = {}, |
| 49 | [".tests"] = {}, |
| 50 | ["build"] = {}, |
| 51 | ["dist"] = {}, |
| 52 | ["elm-stuff"] = {}, |
| 53 | ["node_modules"] = {}, |
| 54 | ["target"] = {}, |
| 55 | })[f.name] == nil |
| 56 | end, |
| 57 | }, |
| 58 | mappings = { |
| 59 | synchronize = "<cr>", |
| 60 | go_in = "", |
| 61 | go_in_plus = "l", |
| 62 | }, |
| 63 | } |