From 16117d8500e6b00de0c1f8b27abca839b7729e76 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Fri, 19 Jul 2024 17:47:46 +0800 Subject: Update --- snippets/lua_keymap | 9 +- vim/init/basic.vim | 2 +- vim/init/keymaps.vim | 9 +- vim/lua/plugins/init.lua | 620 +++++++++++++++++++++++------------------------ vim/mini.lua | 234 ++++++++++++------ 5 files changed, 486 insertions(+), 388 deletions(-) diff --git a/snippets/lua_keymap b/snippets/lua_keymap index 255fe49..d221d2b 100644 --- a/snippets/lua_keymap +++ b/snippets/lua_keymap @@ -1,6 +1,5 @@ -vim.keymap.set( - 'n', - 'gp', - require('gitsigns').prev_hunk, - { buffer = bufnr, desc = '[G]o to [P]revious Hunk' } +vim.keymap.set( 'n', '', function() + require(''), + end, + { buffer = bufnr, desc = '' } ) diff --git a/vim/init/basic.vim b/vim/init/basic.vim index 818e996..2394045 100644 --- a/vim/init/basic.vim +++ b/vim/init/basic.vim @@ -82,7 +82,7 @@ set autoindent smartindent set shiftwidth=2 set cindent set ttimeout -set ttimeoutlen=50 +set timeoutlen=500 " set updatetime=4000 " autocmd CursorHold * normal! m' diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index 82c3c07..5639e11 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim @@ -12,8 +12,8 @@ imap l " Search for selected test vnoremap * y/\V=escape(@",'/\') - " Set wrap + nnoremap W :set wrap! " Fast saving @@ -243,6 +243,7 @@ function! CloseBufferSafely() let answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") if answer == 1 | write | endif if answer == 3 | return | endif + if answer == "" | return | endif endif let bufs = getbufinfo({'buflisted': 1}) @@ -404,7 +405,8 @@ vnoremap zF :call UnfoldSelectionOnly() nnoremap zF :call ResumeFoldmethod()zv " Select current fold -xnoremap iz :silent!normal![zV]z +xnoremap az :silent!normal![zV]z +xnoremap iz :silent!normal![zjV]zk " Use l to open fold nnoremap l foldclosed('.') == -1 ? 'l' : 'zo' @@ -413,6 +415,9 @@ nnoremap l foldclosed('.') == -1 ? 'l' : 'zo' nnoremap zo foldclosed('.') == -1 ? 'zjzo' : 'zo' nnoremap zO foldclosed('.') == -1 ? 'zjzO' : 'zO' +nnoremap zJ zjzx +nnoremap zK zkzx + " Fold file except selection let b:original_foldmethod = "" function! UnfoldSelectionOnly() diff --git a/vim/lua/plugins/init.lua b/vim/lua/plugins/init.lua index 03a7d46..6f6e044 100644 --- a/vim/lua/plugins/init.lua +++ b/vim/lua/plugins/init.lua @@ -1,334 +1,334 @@ return { - -- Detect tabstop and shiftwidth automatically - "tpope/vim-sleuth", + -- Detect tabstop and shiftwidth automatically + "tpope/vim-sleuth", - -- Use sudo in command mode - { - "lambdalisue/suda.vim", - cmd = { "SudaWrite" }, - }, + -- Use sudo in command mode + { + "lambdalisue/suda.vim", + cmd = { "SudaWrite" }, + }, - -- For focus mode - { - "Pocco81/true-zen.nvim", - lazy = false, - cmd = { "TZAtaraxis", "TZMinimalist" }, - }, + -- For focus mode + { + "Pocco81/true-zen.nvim", + lazy = false, + cmd = { "TZAtaraxis", "TZMinimalist" }, + }, - -- hop.nvim: For quick jump - { - "smoka7/hop.nvim", - lazy = false, - version = "*", - opts = { - keys = "etovxqpdygfblzhckisuran", - }, - config = function() - require("hop").setup() - end, - }, + -- hop.nvim: For quick jump + { + "smoka7/hop.nvim", + lazy = false, + version = "*", + opts = { + keys = "etovxqpdygfblzhckisuran", + }, + config = function() + require("hop").setup() + end, + }, - { - "stevearc/conform.nvim", - lazy = false, - -- event = 'BufWritePre', -- uncomment for format on save - config = function() - require("configs.conform") + { + "stevearc/conform.nvim", + lazy = false, + -- event = 'BufWritePre', -- uncomment for format on save + config = function() + require("configs.conform") - vim.keymap.set("n", "F", function() - require("conform").format({ lsp_fallback = true }) - end, { desc = "format files" }) - end, - }, + vim.keymap.set("n", "F", function() + require("conform").format({ lsp_fallback = true }) + end, { desc = "format files" }) + end, + }, - { - -- Add indentation guides even on blank lines - "lukas-reineke/indent-blankline.nvim", - -- See `:help ibl` - enabled = true, - main = "ibl", - opts = { - indent = { char = "┊" }, - whitespace = { highlight = { "Whitespace", "NonText" } }, - }, - }, + { + -- Add indentation guides even on blank lines + "lukas-reineke/indent-blankline.nvim", + -- See `:help ibl` + enabled = true, + main = "ibl", + opts = { + indent = { char = "┊" }, + whitespace = { highlight = { "Whitespace", "NonText" } }, + }, + }, - { - "lewis6991/gitsigns.nvim", - opts = function() - return { - -- See `:help gitsigns.txt` - signs = { - add = { text = "+" }, - change = { text = "~" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - }, - on_attach = function(bufnr) - local gs = require("gitsigns") - vim.keymap.set( - "n", - "gp", - gs.prev_hunk, - { buffer = bufnr, desc = "[G]o to [P]revious Hunk" } - ) - vim.keymap.set("n", "gn", gs.next_hunk, { buffer = bufnr, desc = "[G]o to [N]ext Hunk" }) - vim.keymap.set("n", "hp", gs.preview_hunk, { buffer = bufnr, desc = "[P]review [H]unk" }) - vim.keymap.set("n", "hd", gs.diffthis, { buffer = bufnr, desc = "[h]unk [d]iff" }) - vim.keymap.set("n", "hD", function() - gs.diffthis("~") - end, { buffer = bufnr, desc = "[h]unk [d]iff for ~" }) - -- vim.keymap.set("n", "gb", gs.blame_line{full=true}, { desc = "Git Blame" }) - vim.keymap.set("n", "gb", gs.toggle_current_line_blame, { desc = "Blame Line" }) - vim.keymap.set("v", "hr", gs.reset_hunk, { buffer = bufnr, desc = "[h]unk [r]eset" }) - end, - } - end, - }, + { + "lewis6991/gitsigns.nvim", + opts = function() + return { + -- See `:help gitsigns.txt` + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + }, + on_attach = function(bufnr) + local gs = require("gitsigns") + vim.keymap.set( + "n", + "gp", + gs.prev_hunk, + { buffer = bufnr, desc = "[G]o to [P]revious Hunk" } + ) + vim.keymap.set("n", "gn", gs.next_hunk, { buffer = bufnr, desc = "[G]o to [N]ext Hunk" }) + vim.keymap.set("n", "hp", gs.preview_hunk, { buffer = bufnr, desc = "[P]review [H]unk" }) + vim.keymap.set("n", "hd", gs.diffthis, { buffer = bufnr, desc = "[h]unk [d]iff" }) + vim.keymap.set("n", "hD", function() + gs.diffthis("~") + end, { buffer = bufnr, desc = "[h]unk [d]iff for ~" }) + -- vim.keymap.set("n", "gb", gs.blame_line{full=true}, { desc = "Git Blame" }) + vim.keymap.set("n", "gb", gs.toggle_current_line_blame, { desc = "Blame Line" }) + vim.keymap.set("v", "hr", gs.reset_hunk, { buffer = bufnr, desc = "[h]unk [r]eset" }) + end, + } + end, + }, - { - "iberianpig/tig-explorer.vim", - lazy = false, - dependencies = { - "rbgrouleff/bclose.vim", - }, - config = function() - vim.keymap.del("n", "bd") - end, - }, - { - "epwalsh/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit - lazy = true, - ft = "markdown", - -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: - -- event = { - -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. - -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md" - -- "BufReadPre path/to/my-vault/**.md", - -- "BufNewFile path/to/my-vault/**.md", - -- }, - dependencies = { - -- Required. - "nvim-lua/plenary.nvim", - }, - opts = { - workspaces = { - { - name = "log", - path = "~/log", - }, - }, - completion = { - -- Set to false to disable completion. - nvim_cmp = true, - -- Trigger completion at 2 chars. - min_chars = 2, - }, - mapping = { - -- Toggle check-boxes. - ["oc"] = { - action = function() - return require("obsidian").util.toggle_checkbox() - end, - opts = { buffer = true }, - }, - -- Smart action depending on context, either follow link or toggle checkbox. - [""] = { - action = function() - return require("obsidian").util.smart_action() - end, - opts = { buffer = true, expr = true }, - }, - }, - -- see below for full list of options 👇 - note_id_func = function(title) - return title - -- Create note IDs in a Zettelkasten format with a timestamp and a suffix. - -- In this case a note with the title 'My new note' will be given an ID that looks - -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md' - -- local suffix = "" - -- title = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() - -- if title ~= nil and title ~= "" then - -- -- If title is given, transform it into valid file name. - -- suffix = "-" .. title - -- else - -- -- If title is nil, just add 4 random uppercase letters to the suffix. - -- for _ = 1, 4 do - -- suffix = suffix .. string.char(math.random(65, 90)) - -- end - -- suffix = "-" .. title - -- end - -- return tostring(os.time()) .. suffix - end, - -- Optional, for templates (see below). - templates = { - folder = "templates", - date_format = "%Y-%m-%d", - time_format = "%H:%M", - -- A map for custom variables, the key should be the variable and the value a function - substitutions = {}, - }, - }, - config = function() - vim.keymap.set("n", "oo", ":Obsidian", { buffer = true }) - vim.keymap.set("n", "ot", ":ObsidianTags", { buffer = true }) - vim.keymap.set("n", "os", ":ObsidianSearch", { buffer = true }) - vim.keymap.set("n", "oq", ":ObsidianQuickSwitch", { buffer = true }) - vim.keymap.set("v", "on", ":ObsidianLinkNew", { buffer = true }) - vim.keymap.set("n", "ol", ":ObsidianLinks", { buffer = true }) - end, - }, + { + "iberianpig/tig-explorer.vim", + lazy = false, + dependencies = { + "rbgrouleff/bclose.vim", + }, + config = function() + vim.keymap.del("n", "bd") + end, + }, + { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + ft = "markdown", + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + -- event = { + -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. + -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md" + -- "BufReadPre path/to/my-vault/**.md", + -- "BufNewFile path/to/my-vault/**.md", + -- }, + dependencies = { + -- Required. + "nvim-lua/plenary.nvim", + }, + opts = { + workspaces = { + { + name = "log", + path = "~/log", + }, + }, + completion = { + -- Set to false to disable completion. + nvim_cmp = true, + -- Trigger completion at 2 chars. + min_chars = 2, + }, + mapping = { + -- Toggle check-boxes. + ["oc"] = { + action = function() + return require("obsidian").util.toggle_checkbox() + end, + opts = { buffer = true }, + }, + -- Smart action depending on context, either follow link or toggle checkbox. + [""] = { + action = function() + return require("obsidian").util.smart_action() + end, + opts = { buffer = true, expr = true }, + }, + }, + -- see below for full list of options 👇 + note_id_func = function(title) + return title + -- Create note IDs in a Zettelkasten format with a timestamp and a suffix. + -- In this case a note with the title 'My new note' will be given an ID that looks + -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md' + -- local suffix = "" + -- title = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() + -- if title ~= nil and title ~= "" then + -- -- If title is given, transform it into valid file name. + -- suffix = "-" .. title + -- else + -- -- If title is nil, just add 4 random uppercase letters to the suffix. + -- for _ = 1, 4 do + -- suffix = suffix .. string.char(math.random(65, 90)) + -- end + -- suffix = "-" .. title + -- end + -- return tostring(os.time()) .. suffix + end, + -- Optional, for templates (see below). + templates = { + folder = "templates", + date_format = "%Y-%m-%d", + time_format = "%H:%M", + -- A map for custom variables, the key should be the variable and the value a function + substitutions = {}, + }, + }, + config = function() + vim.keymap.set("n", "oo", ":Obsidian", { buffer = true }) + vim.keymap.set("n", "ot", ":ObsidianTags", { buffer = true }) + vim.keymap.set("n", "os", ":ObsidianSearch", { buffer = true }) + vim.keymap.set("n", "oq", ":ObsidianQuickSwitch", { buffer = true }) + vim.keymap.set("v", "on", ":ObsidianLinkNew", { buffer = true }) + vim.keymap.set("n", "ol", ":ObsidianLinks", { buffer = true }) + end, + }, - { - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - ft = { "markdown" }, - build = function() - vim.fn["mkdp#util#install"]() - end, - init = function() - vim.g.mkdp_preview_options = { - mkit = { breaks = true }, - toc = { - containerClass = "toc", - format = "function format(x, htmlencode) { return `${htmlencode(x)}`; }", - callback = "console.log('foo')", - }, - } - vim.cmd("let g:mkdp_browser = 'firefox'") - end, - }, + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + init = function() + vim.g.mkdp_preview_options = { + mkit = { breaks = true }, + toc = { + containerClass = "toc", + format = "function format(x, htmlencode) { return `${htmlencode(x)}`; }", + callback = "console.log('foo')", + }, + } + vim.cmd("let g:mkdp_browser = 'firefox'") + end, + }, - { - "nvim-telescope/telescope.nvim", - opts = function() - return require("configs.telescope") - end, - }, + { + "nvim-telescope/telescope.nvim", + opts = function() + return require("configs.telescope") + end, + }, - { - "nvim-telescope/telescope-fzf-native.nvim", - build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release", - }, + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release", + }, - { - "nvim-treesitter/nvim-treesitter", - dependencies = { - "nvim-treesitter/nvim-treesitter-textobjects", - }, - opts = function() - return require("configs.treesitter") - end, - }, + { + "nvim-treesitter/nvim-treesitter", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + opts = function() + return require("configs.treesitter") + end, + }, - { - "stevearc/aerial.nvim", - opts = {}, - -- Optional dependencies - dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-tree/nvim-web-devicons", - }, - }, + { + "stevearc/aerial.nvim", + opts = {}, + -- Optional dependencies + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + }, - -- { - -- 'numToStr/Comment.nvim', - -- lazy = true, - -- opts = { - -- opleader = { - -- ---Line-comment keymap - -- line = '', - -- ---Block-comment keymap - -- block = 'gb', - -- }, - -- } - -- }, + -- { + -- 'numToStr/Comment.nvim', + -- lazy = true, + -- opts = { + -- opleader = { + -- ---Line-comment keymap + -- line = '', + -- ---Block-comment keymap + -- block = 'gb', + -- }, + -- } + -- }, - { - "neovim/nvim-lspconfig", - lazy = false, - config = function() - require("nvchad.configs.lspconfig").defaults() - require("configs.lspconfig") - end, - }, - -- - { - "williamboman/mason.nvim", - opts = { - automatically_installation = true, - ensure_installed = { - "vim-language-server", - "lua-language-server", - "css-lsp", - "html-lsp", - "prettier", - "stylua", - }, - }, - }, + { + "neovim/nvim-lspconfig", + lazy = false, + config = function() + require("nvchad.configs.lspconfig").defaults() + require("configs.lspconfig") + end, + }, + -- + { + "williamboman/mason.nvim", + opts = { + automatically_installation = true, + ensure_installed = { + "vim-language-server", + "lua-language-server", + "css-lsp", + "html-lsp", + "prettier", + "stylua", + }, + }, + }, - { - "numToStr/Comment.nvim", - lazy = false, - opts = { - toggler = { - line = "", - block = "gb", - }, - opleader = { - line = "", - block = "gb", - }, - }, - }, + { + "numToStr/Comment.nvim", + lazy = false, + opts = { + toggler = { + line = "", + block = "gb", + }, + opleader = { + line = "", + block = "gb", + }, + }, + }, - { - "tpope/vim-surround", - lazy = false, - config = function() - vim.cmd("vmap s S") - end, - }, + { + "tpope/vim-surround", + lazy = false, + config = function() + vim.cmd("vmap s S") + end, + }, - { - "nvim-tree/nvim-tree.lua", - opts = function() - local opts = require("nvchad.configs.nvimtree") - opts.on_attach = function(bufnr) - local api = require("nvim-tree.api") - api.config.mappings.default_on_attach(bufnr) - vim.keymap.set("n", "l", api.node.open.edit, { buffer = bufnr, nowait = true }) - vim.keymap.set("n", "h", api.tree.change_root_to_parent, { buffer = bufnr, nowait = true }) - end - return opts - end, - }, + { + "nvim-tree/nvim-tree.lua", + opts = function() + local opts = require("nvchad.configs.nvimtree") + opts.on_attach = function(bufnr) + local api = require("nvim-tree.api") + api.config.mappings.default_on_attach(bufnr) + vim.keymap.set("n", "l", api.node.open.edit, { buffer = bufnr, nowait = true }) + vim.keymap.set("n", "h", api.tree.change_root_to_parent, { buffer = bufnr, nowait = true }) + end + return opts + end, + }, - { - "folke/which-key.nvim", + { + "folke/which-key.nvim", lazy = false, - opts = { - presets = { - windows = true, -- default bindings on - nav = true, -- misc bindings to work with windows - z = true, -- bindings for folds, spelling and others prefixed with z - g = true, -- bindings for prefixed with g - }, - }, - }, - -- { - -- 'junegunn/goyo.vim', - -- lazy = false, - -- }, + opts = { + presets = { + windows = true, -- default bindings on + nav = true, -- misc bindings to work with windows + z = true, -- bindings for folds, spelling and others prefixed with z + g = true, -- bindings for prefixed with g + }, + }, + }, + -- { + -- 'junegunn/goyo.vim', + -- lazy = false, + -- }, - -- { - -- 'akinsho/bufferline.nvim', - -- lazy = false, - -- version = "*", - -- dependencies = 'nvim-tree/nvim-web-devicons' - -- } + -- { + -- 'akinsho/bufferline.nvim', + -- lazy = false, + -- version = "*", + -- dependencies = 'nvim-tree/nvim-web-devicons' + -- } } diff --git a/vim/mini.lua b/vim/mini.lua index 2646ca6..d87c01c 100644 --- a/vim/mini.lua +++ b/vim/mini.lua @@ -1,6 +1,6 @@ -- vim: sw=2 foldmethod=marker foldmarker={{{,}}} --- Ref: https://github.com/echasnovski/mini.nvim?tab=readme-ov-file +-- Ref: https://github.com/echasnovski/mini.nvim -- TODO -- Install mini.nvim {{{ @@ -40,6 +40,17 @@ vim.g.animate_disable = true -- mini.basics {{{ require('mini.basics').setup() -- }}} +-- mini.misc {{{ +require('mini.misc').setup({ + make_global = { 'put', 'put_text', 'zoom'} +}) --}}} +-- mini.extra {{{ +require('mini.extra').setup() +-- }}} +-- mini.colors {{{ +require('mini.colors').setup() +vim.keymap.set( 'n', 'co', function() require('mini.colors').interactive() end) +-- }}} -- mini.base16 {{{ require('mini.base16').setup({ palette = { @@ -78,14 +89,22 @@ require('mini.base16').setup({ }, use_cterm = true, }) --}}} --- mini.misc {{{ -require('mini.misc').setup({ - make_global = { 'put', 'put_text', 'zoom'} -}) --}}} -- mini.icons {{{ require('mini.icons').setup({ }) --}}} +-- mini.tabline {{{ + +require('mini.tabline').setup {} + +for i = 1, 9, 1 do + vim.keymap.set("n", string.format("", i), function() + vim.api.nvim_set_current_buf( vim.fn.getbufinfo({ buflisted=true })[i].bufnr) + end, {silent = true}) +end + +-- }}} -- mini.statusline {{{ + require('mini.statusline').setup({ content = { active = status_config @@ -126,54 +145,52 @@ function status_config() { hl = mode_hl, strings = { location } }, }) end --- }}} --- mini.clue {{{ -local miniclue = require('mini.clue') -miniclue.setup({ - triggers = { - -- Leader triggers - { mode = 'n', keys = '' }, - { mode = 'x', keys = '' }, - - -- Built-in completion - { mode = 'i', keys = '' }, - - -- `g` key - { mode = 'n', keys = 'g' }, - { mode = 'x', keys = 'g' }, - - -- Marks - { mode = 'n', keys = "'" }, - { mode = 'n', keys = '`' }, - { mode = 'x', keys = "'" }, - { mode = 'x', keys = '`' }, - - -- Registers - { mode = 'n', keys = '"' }, - { mode = 'x', keys = '"' }, - { mode = 'i', keys = '' }, - { mode = 'c', keys = '' }, - - -- Window commands - { mode = 'n', keys = '' }, - - -- `z` key - { mode = 'n', keys = 'z' }, - { mode = 'x', keys = 'z' }, - }, - clues = { - -- Enhance this by adding descriptions for mapping groups - miniclue.gen_clues.builtin_completion(), - miniclue.gen_clues.g(), - miniclue.gen_clues.marks(), - miniclue.gen_clues.registers(), - miniclue.gen_clues.windows(), - miniclue.gen_clues.z(), - }, -})-- }}} --- mini.colors {{{ -require('mini.colors').setup() +-- }}} +-- Disabled: mini.clue {{{ +-- local miniclue = require('mini.clue') +-- miniclue.setup({ +-- triggers = { +-- -- Leader triggers +-- { mode = 'n', keys = '' }, +-- { mode = 'x', keys = '' }, +-- +-- -- Built-in completion +-- { mode = 'i', keys = '' }, +-- +-- -- `g` key +-- { mode = 'n', keys = 'g' }, +-- { mode = 'x', keys = 'g' }, +-- +-- -- Marks +-- { mode = 'n', keys = "'" }, +-- { mode = 'n', keys = '`' }, +-- { mode = 'x', keys = "'" }, +-- { mode = 'x', keys = '`' }, +-- +-- -- Registers +-- { mode = 'n', keys = '"' }, +-- { mode = 'x', keys = '"' }, +-- { mode = 'i', keys = '' }, +-- { mode = 'c', keys = '' }, +-- +-- -- Window commands +-- { mode = 'n', keys = '' }, +-- +-- -- `z` key +-- { mode = 'n', keys = 'z' }, +-- { mode = 'x', keys = 'z' }, +-- }, +-- +-- clues = { +-- -- Enhance this by adding descriptions for mapping groups +-- miniclue.gen_clues.builtin_completion(), +-- miniclue.gen_clues.g(), +-- miniclue.gen_clues.marks(), +-- miniclue.gen_clues.registers(), +-- miniclue.gen_clues.windows(), +-- miniclue.gen_clues.z(), +-- }, -- }}} -- mini.comment {{{ require('mini.comment').setup({ @@ -213,29 +230,60 @@ require('mini.diff').setup({ }, }) -- }}} --- mini.extra {{{ -require('mini.extra').setup() --- }}} -- mini.map {{{ require('mini.map').setup() --- }}} --- mini.tabline {{{ - -require('mini.tabline').setup() - -for i = 1, 9, 1 do - vim.keymap.set("n", string.format("", i), function() - vim.api.nvim_set_current_buf(vim.t.bufs[i]) - end) -end - +vim.keymap.set( 'n', 'mp', function() require('mini.map').toggle() end, { buffer = bufnr, desc = '' }) -- }}} -- mini.visits {{{ require('mini.visits').setup() +vim.keymap.set( 'n', 'li', function() + MiniVisits.list_paths() + end, + { buffer = bufnr, desc = '' } +) -- }}} -- mini.completion {{{ require('mini.completion').setup() -- }}} +-- mini.surround {{{ +require('mini.surround').setup { + mappings = { + add = 's' + } +} +-- }}} +-- mini.indentscope {{{ +require('mini.indentscope').setup() +-- }}} +-- mini.splitjoin {{{ +require('mini.splitjoin').setup() +-- }}} +-- mini.move {{{ +require('mini.move').setup() +-- }}} +-- mini.pairs {{{ +require('mini.pairs').setup() +-- }}} +-- mini.hipatterns {{{ +local hipatterns = require('mini.hipatterns') +hipatterns.setup({ + highlighters = { + -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' + fixme = { pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' }, + hack = { pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' }, + todo = { pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' }, + note = { pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' }, + + -- Highlight hex color strings (`#rrggbb`) using that color + hex_color = hipatterns.gen_highlighter.hex_color(), + }, +}) +vim.keymap.set( 'n', 'hi', function() + MiniHipatterns.toggle() + end, + { buffer = bufnr, desc = 'Toggle hex color highlight' } +) +-- }}} -- Telescope {{{ add({ source = "nvim-telescope/telescope.nvim", @@ -409,15 +457,61 @@ end, { desc = "Search Directory" })-- }}} -- toggleterm {{{ add({ - source = "akinsho/toggleterm.nvim", - hooks = { post_checkout = function() end }, +source = "akinsho/toggleterm.nvim", +hooks = { post_checkout = function() end }, }) require("toggleterm").setup{ - persist_size = false, - direction = 'float', +persist_size = false, +direction = 'float', } vim.keymap.set({ "n", "t" }, "", function() vim.cmd("ToggleTerm direction=float") end, { desc = "terminal toggle floating term" }) vim.keymap.set({ "n", "t" }, "", function() vim.cmd("ToggleTerm direction=horizontal") end, { desc = "terminal toggle floating term" }) --}}} +-- Tig {{{ + +add({ + source = "iberianpig/tig-explorer.vim", + depends = { "rbgrouleff/bclose.vim" }, + hooks = { post_checkout = function() end }, +}) + +--}}} +-- Disabled: suda {{{ +-- add { source = "lambdalisue/suda.vim" } +-- }}} +-- which-key {{{ +add({ + source = "folke/which-key.nvim", + checkout = "stable", +}) +require('which-key').setup { + defaults = { + win = { + -- don't allow the popup to overlap with the cursor + no_overlap = false, + -- width = 1, + height = { min = 10, max = 25 }, + -- col = 0, + -- row = math.huge, + -- border = "none", + padding = { 1, 2 }, -- extra window padding [top/bottom, right/left] + title = true, + title_pos = "center", + zindex = 1000, + -- Additional vim.wo and vim.bo options + bo = {}, + wo = { + -- winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent + }, + }, + } +} +-- }}} +-- true-zen {{{ +add { + source = "Pocco81/true-zen.nvim", +} +vim.keymap.set("n", "z", ":TZAtaraxis") +-- }}} -- cgit v1.2.3-70-g09d2