diff options
Diffstat (limited to '.config/nvim/lua/vimrc/plugins.lua')
| -rw-r--r-- | .config/nvim/lua/vimrc/plugins.lua | 422 |
1 files changed, 161 insertions, 261 deletions
diff --git a/.config/nvim/lua/vimrc/plugins.lua b/.config/nvim/lua/vimrc/plugins.lua index 25baa9c..e7c3d1b 100644 --- a/.config/nvim/lua/vimrc/plugins.lua +++ b/.config/nvim/lua/vimrc/plugins.lua @@ -1,22 +1,13 @@ -vim.cmd.packadd('packer.nvim') -local packer = require('packer') - --- Plugins {{{1 -packer.startup(function(use) - -- Plugin management {{{2 - use { - 'wbthomason/packer.nvim', - opt = true, - } - -- Libraries {{{2 +return { + -- Libraries {{{1 -- telescope.nvim depends on it. - use { + { 'nvim-lua/plenary.nvim', - } - -- Text editing {{{2 - -- IME {{{3 + }, + -- Text editing {{{1 + -- IME {{{2 -- SKK (Simple Kana to Kanji conversion program) for Vim. - use { + { 'vim-skk/eskk.vim', config = function() local my_env = require('vimrc.my_env') @@ -100,33 +91,26 @@ packer.startup(function(use) autocmd Vimrc User eskk-initialize-post call My_eskk_initialize_post() ]=]) end, - } - -- Operators {{{3 + }, + -- Operators {{{2 -- Support for user-defined operators. - use { + { 'kana/vim-operator-user', - } + }, -- Extract expression and make assingment statement. - use { + { 'tek/vim-operator-assign', - } + }, -- Replace text without updating registers. - use { + { 'kana/vim-operator-replace', - opt = true, + lazy = true, keys = { - {'n', '<Plug>(operator-replace)'}, - {'o', '<Plug>(operator-replace)'}, - {'x', '<Plug>(operator-replace)'}, + {'<C-p>', '<Plug>(operator-replace)', mode = {'n', 'o', 'x'}}, }, - setup = function() - vim.keymap.set('n', '<C-p>', '<Plug>(operator-replace)') - vim.keymap.set('o', '<C-p>', '<Plug>(operator-replace)') - vim.keymap.set('x', '<C-p>', '<Plug>(operator-replace)') - end, - } + }, -- Super surround. - use { + { 'machakann/vim-sandwich', config = function() vim.fn['operator#sandwich#set']('add', 'all', 'highlight', 2) @@ -152,21 +136,11 @@ packer.startup(function(use) vim.g['sandwich#recipes'] = rs end end, - } - -- Non-operators {{{3 + }, + -- Non-operators {{{2 -- Comment out. - use { + { 'numToStr/Comment.nvim', - opt = true, - keys = { - {'n', 'm//'}, - {'n', 'm??'}, - {'n', 'm/'}, {'x', 'm/'}, - {'n', 'm?'}, {'x', 'm?'}, - {'n', 'm/O'}, - {'n', 'm/o'}, - {'n', 'm/A'}, - }, config = function() require('Comment').setup { toggler = { @@ -184,126 +158,93 @@ packer.startup(function(use) }, } end, - } + }, -- Align text. - use { + { 'junegunn/vim-easy-align', - opt = true, + lazy = true, cmd = {'EasyAlign'}, keys = { - {'n', '<Plug>(EasyAlign)'}, - {'x', '<Plug>(EasyAlign)'}, + {'=', '<Plug>(EasyAlign)', mode = {'n', 'x'}}, }, - setup = function() - vim.keymap.set('n', '=', '<Plug>(EasyAlign)') - vim.keymap.set('x', '=', '<Plug>(EasyAlign)') - end, - } - -- Text objects {{{2 + }, + -- Text objects {{{1 -- Support for user-defined text objects. - use { + { 'kana/vim-textobj-user', - } + priority = 100, + }, -- Text object for blockwise. - use { + { 'osyo-manga/vim-textobj-blockwise', - } + }, -- Text object for comment. - use { + { 'thinca/vim-textobj-comment', - } + }, -- Text object for indent. - use { + { 'kana/vim-textobj-indent', - } + }, -- Text object for line. - use { + { 'kana/vim-textobj-line', - } + }, -- Text object for parameter. - use { + { 'sgur/vim-textobj-parameter', - } + }, -- Text object for space. - use { + { 'saihoooooooo/vim-textobj-space', - opt = true, + lazy = true, keys = { - {'o', 'a<Space>'}, {'x', 'a<Space>'}, - {'o', 'i<Space>'}, {'x', 'i<Space>'}, + {'a<Space>', '<Plug>(textobj-space-a)', mode = {'o', 'x'}}, + {'i<Space>', '<Plug>(textobj-space-i)', mode = {'o', 'x'}}, }, - setup = function() + init = function() vim.g.textobj_space_no_default_key_mappings = true end, - config = function() - vim.keymap.set('o', 'a<Space>', '<Plug>(textobj-space-a)') - vim.keymap.set('x', 'a<Space>', '<Plug>(textobj-space-a)') - vim.keymap.set('o', 'i<Space>', '<Plug>(textobj-space-i)') - vim.keymap.set('x', 'i<Space>', '<Plug>(textobj-space-i)') - end, - } + }, -- Text object for syntax. - use { + { 'kana/vim-textobj-syntax', - } + }, -- Text object for URL. - use { + { 'mattn/vim-textobj-url', - } + }, -- Text object for words in words. - use { + { 'h1mesuke/textobj-wiw', - opt = true, + lazy = true, keys = { - {'n', '<C-w>'}, {'o', '<C-w>'}, {'x', '<C-w>'}, - {'n', 'g<C-w>'}, {'o', 'g<C-w>'}, {'x', 'g<C-w>'}, - {'n', '<C-e>'}, {'o', '<C-e>'}, {'x', '<C-e>'}, - {'n', 'g<C-e>'}, {'o', 'g<C-e>'}, {'x', 'g<C-e>'}, - {'o', 'a<C-w>'}, {'x', 'a<C-w>'}, - {'o', 'i<C-w>'}, {'x', 'i<C-w>'}, + {'<C-w>', '<Plug>(textobj-wiw-n)', mode = {'n', 'o', 'x'}}, + {'g<C-w>', '<Plug>(textobj-wiw-p)', mode = {'n', 'o', 'x'}}, + {'<C-e>', '<Plug>(textobj-wiw-N)', mode = {'n', 'o', 'x'}}, + {'g<C-e>', '<Plug>(textobj-wiw-P)', mode = {'n', 'o', 'x'}}, + {'a<C-w>', '<Plug>(textobj-wiw-a)', mode = {'o', 'x'}}, + {'i<C-w>', '<Plug>(textobj-wiw-i)', mode = {'o', 'x'}}, }, - setup = function() + init = function() vim.g.textobj_wiw_no_default_key_mappings = true end, - config = function() - vim.keymap.set('n', '<C-w>', '<Plug>(textobj-wiw-n)') - vim.keymap.set('o', '<C-w>', '<Plug>(textobj-wiw-n)') - vim.keymap.set('x', '<C-w>', '<Plug>(textobj-wiw-n)') - vim.keymap.set('n', 'g<C-w>', '<Plug>(textobj-wiw-p)') - vim.keymap.set('o', 'g<C-w>', '<Plug>(textobj-wiw-p)') - vim.keymap.set('x', 'g<C-w>', '<Plug>(textobj-wiw-p)') - vim.keymap.set('n', '<C-e>', '<Plug>(textobj-wiw-N)') - vim.keymap.set('o', '<C-e>', '<Plug>(textobj-wiw-N)') - vim.keymap.set('x', '<C-e>', '<Plug>(textobj-wiw-N)') - vim.keymap.set('n', 'g<C-e>', '<Plug>(textobj-wiw-P)') - vim.keymap.set('o', 'g<C-e>', '<Plug>(textobj-wiw-P)') - vim.keymap.set('x', 'g<C-e>', '<Plug>(textobj-wiw-P)') - - vim.keymap.set('o', 'a<C-w>', '<Plug>(textobj-wiw-a)') - vim.keymap.set('x', 'a<C-w>', '<Plug>(textobj-wiw-a)') - vim.keymap.set('o', 'i<C-w>', '<Plug>(textobj-wiw-i)') - vim.keymap.set('x', 'i<C-w>', '<Plug>(textobj-wiw-i)') - end, - } - -- Search {{{2 + }, + -- Search {{{1 -- Extend * and #. - use { + { 'haya14busa/vim-asterisk', - opt = true, + lazy = true, keys = { - {'n', '<Plug>(asterisk-z*)'}, {'x', '<Plug>(asterisk-z*)'}, - {'n', '<Plug>(asterisk-gz*)'}, {'x', '<Plug>(asterisk-gz*)'}, + {'*', '<Plug>(asterisk-z*)', mode = {'n', 'x'}}, + {'g*', '<Plug>(asterisk-gz*)', mode = {'n', 'x'}}, }, - setup = function() - vim.keymap.set({'n', 'x'}, '*', '<Plug>(asterisk-z*)') - vim.keymap.set({'n', 'x'}, 'g*', '<Plug>(asterisk-gz*)') - end, - } + }, -- NOTE: it is a fork version of jremmen/vim-ripgrep -- Integration with ripgrep, fast alternative of grep command. - use { + { 'nsfisis/vim-ripgrep', - opt = true, + lazy = true, cmd = {'Rg', 'RG'}, config = function() -- Workaround: do not open quickfix window. @@ -322,10 +263,10 @@ packer.startup(function(use) } ) end, - } - -- Files {{{2 + }, + -- Files {{{1 -- Switch to related files. - use { + { 'kana/vim-altr', config = function() -- C/C++ @@ -336,11 +277,11 @@ packer.startup(function(use) -- Go to File Alternative vim.keymap.set('n', 'gfa', '<Plug>(altr-forward)') end, - } + }, -- Full-featured filer. - use { + { 'lambdalisue/fern.vim', - opt = true, + lazy = true, cmd = {'Fern'}, config = function() local vimrc = require('vimrc') @@ -354,28 +295,28 @@ packer.startup(function(use) end, }) end, - } + }, -- Fern plugin: hijack Netrw. - use { + { 'lambdalisue/fern-hijack.vim', - } - -- Appearance {{{2 + }, + -- Appearance {{{1 -- Show highlight. - use { + { 'cocopon/colorswatch.vim', - opt = true, + lazy = true, cmd = {'ColorSwatchGenerate'}, - } + }, -- Makes folding text cool. - use { + { 'LeafCage/foldCC.vim', config = function() vim.o.foldtext = 'FoldCCtext()' vim.g.foldCCtext_head = 'repeat(">", v:foldlevel) . " "' end, - } + }, -- Show indentation guide. - use { + { 'lukas-reineke/indent-blankline.nvim', config = function() require("indent_blankline").setup { @@ -383,15 +324,15 @@ packer.startup(function(use) show_first_indent_level = false, } end, - } + }, -- Highlight matched parentheses. - use { + { 'itchyny/vim-parenmatch', - } + }, -- Tree-sitter integration. - use { + { 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdateSync', + build = ':TSUpdateSync', config = function() require('nvim-treesitter.configs').setup { ensure_installed = 'all', @@ -419,13 +360,13 @@ packer.startup(function(use) }, } end, - } + }, -- Tree-sitter debugging. - use { + { 'nvim-treesitter/playground', - } + }, -- Highlight specified words. - use { + { 't9md/vim-quickhl', config = function() -- TODO: CUI @@ -446,15 +387,15 @@ packer.startup(function(use) vim.keymap.set('x', '"', '<Plug>(quickhl-manual-this)') vim.keymap.set('n', '<C-c>', ':<C-u>nohlsearch <Bar> QuickhlManualReset<CR>', { silent=true }) end, - } + }, -- Yet another tree-sitter indentation. -- TODO: uninstall it once the official nvim-treesitter provides sane indentation. - use { + { 'yioneko/nvim-yati', - } - -- Filetypes {{{2 + }, + -- Filetypes {{{1 -- Faster replacement for bundled filetype.vim - use { + { 'nathom/filetype.nvim', config = function() require('filetype').setup({ @@ -467,9 +408,9 @@ packer.startup(function(use) }, }) end, - } + }, -- C/C++ - use { + { 'rhysd/vim-clang-format', config = function() local vimrc = require('vimrc') @@ -481,13 +422,13 @@ packer.startup(function(use) command = 'ClangFormatAutoDisable', }) end, - } + }, -- HTML/CSS - use { + { 'mattn/emmet-vim', - opt = true, + lazy = true, cmd = {'EmmetInstall'}, - setup = function() + init = function() local vimrc = require('vimrc') vim.g.user_emmet_install_global = false @@ -496,23 +437,23 @@ packer.startup(function(use) command = 'EmmetInstall', }) end, - } + }, -- Rust - use { + { 'rust-lang/rust.vim', config = function() vim.g.rustfmt_autosave = true end, - } - -- QoL {{{2 + }, + -- QoL {{{1 -- Capture the output of a command. - use { + { 'tyru/capture.vim', - opt = true, + lazy = true, cmd = {'Capture'}, - } + }, -- Write git commit message. - use { + { 'rhysd/committia.vim', config = function() vim.g.committia_hooks = { @@ -521,23 +462,26 @@ packer.startup(function(use) end, } end, - } + }, -- Neovim clone of EasyMotion - use { + { 'phaazon/hop.nvim', branch = 'v2', -- Hop.nvim's README recommends this. - opt = true, + lazy = true, keys = { - {'n', '<Plug>(hop-f)'}, {'o', '<Plug>(hop-f)'}, - {'x', '<Plug>(hop-f)'}, {'n', '<Plug>(hop-F)'}, - {'o', '<Plug>(hop-F)'}, {'x', '<Plug>(hop-F)'}, - {'o', '<Plug>(hop-t)'}, {'x', '<Plug>(hop-t)'}, - {'o', '<Plug>(hop-T)'}, {'x', '<Plug>(hop-T)'}, - {'n', '<Plug>(hop-s2)'}, {'o', '<Plug>(hop-s2)'}, {'x', '<Plug>(hop-s2)'}, - {'n', '<Plug>(hop-n)'}, {'o', '<Plug>(hop-n)'}, {'x', '<Plug>(hop-n)'}, - {'n', '<Plug>(hop-N)'}, {'o', '<Plug>(hop-N)'}, {'x', '<Plug>(hop-N)'}, - {'n', '<Plug>(hop-j)'}, {'o', '<Plug>(hop-j)'}, {'x', '<Plug>(hop-j)'}, - {'n', '<Plug>(hop-k)'}, {'o', '<Plug>(hop-k)'}, {'x', '<Plug>(hop-k)'}, + {'f', '<Plug>(hop-f)', mode = {'n', 'o', 'x'}}, + {'F', '<Plug>(hop-F)', mode = {'n', 'o', 'x'}}, + {'t', '<Plug>(hop-t)', mode = {'o', 'x'}}, + {'T', '<Plug>(hop-T)', mode = {'o', 'x'}}, + -- Note: Don't use the following key sequences! They are used by 'vim-sandwich'. + -- * sa + -- * sd + -- * sr + {'ss', '<Plug>(hop-s2)', mode = {'n', 'o', 'x'}}, + {'sn', '<Plug>(hop-n)', mode = {'n', 'o', 'x'}}, + {'sN', '<Plug>(hop-N)', mode = {'n', 'o', 'x'}}, + {'sj', '<Plug>(hop-j)', mode = {'n', 'o', 'x'}}, + {'sk', '<Plug>(hop-k)', mode = {'n', 'o', 'x'}}, }, config = function() require('hop').setup { @@ -587,45 +531,13 @@ packer.startup(function(use) vim.keymap.set('', '<Plug>(hop-j)', function() hop_jk({ direction = AFTER_CURSOR }) end, { silent = true }) vim.keymap.set('', '<Plug>(hop-k)', function() hop_jk({ direction = BEFORE_CURSOR }) end, { silent = true }) end, - setup = function() - vim.keymap.set('n', 'f', '<Plug>(hop-f)') - vim.keymap.set('o', 'f', '<Plug>(hop-f)') - vim.keymap.set('x', 'f', '<Plug>(hop-f)') - vim.keymap.set('n', 'F', '<Plug>(hop-F)') - vim.keymap.set('o', 'F', '<Plug>(hop-F)') - vim.keymap.set('x', 'F', '<Plug>(hop-F)') - vim.keymap.set('o', 't', '<Plug>(hop-t)') - vim.keymap.set('x', 't', '<Plug>(hop-t)') - vim.keymap.set('o', 'T', '<Plug>(hop-T)') - vim.keymap.set('x', 'T', '<Plug>(hop-T)') - - -- Note: Don't use the following key sequences! They are used by 'vim-sandwich'. - -- * sa - -- * sd - -- * sr - vim.keymap.set('n', 'ss', '<Plug>(hop-s2)') - vim.keymap.set('o', 'ss', '<Plug>(hop-s2)') - vim.keymap.set('x', 'ss', '<Plug>(hop-s2)') - vim.keymap.set('n', 'sn', '<Plug>(hop-n)') - vim.keymap.set('o', 'sn', '<Plug>(hop-n)') - vim.keymap.set('x', 'sn', '<Plug>(hop-n)') - vim.keymap.set('n', 'sN', '<Plug>(hop-N)') - vim.keymap.set('o', 'sN', '<Plug>(hop-N)') - vim.keymap.set('x', 'sN', '<Plug>(hop-N)') - vim.keymap.set('n', 'sj', '<Plug>(hop-j)') - vim.keymap.set('o', 'sj', '<Plug>(hop-j)') - vim.keymap.set('x', 'sj', '<Plug>(hop-j)') - vim.keymap.set('n', 'sk', '<Plug>(hop-k)') - vim.keymap.set('o', 'sk', '<Plug>(hop-k)') - vim.keymap.set('x', 'sk', '<Plug>(hop-k)') - end, - } + }, -- Integration with EditorConfig (https://editorconfig.org) - use { + { 'editorconfig/editorconfig-vim', - } + }, -- Extend J. - use { + { 'osyo-manga/vim-jplus', config = function() vim.g['jplus#input_config'] = { @@ -644,31 +556,31 @@ packer.startup(function(use) vim.keymap.set('n', 'gJ', '<Plug>(jplus-input)') vim.keymap.set('x', 'gJ', '<Plug>(jplus-input)') end, - } + }, -- Improve behaviors of I, A and gI in Blockwise-Visual mode. - use { + { 'kana/vim-niceblock', config = function() vim.keymap.set('x', 'I', '<Plug>(niceblock-I)') vim.keymap.set('x', 'gI', '<Plug>(niceblock-gI)') vim.keymap.set('x', 'A', '<Plug>(niceblock-A)') end, - } + }, -- Edit QuickFix freely. - use { + { 'itchyny/vim-qfedit', - } + }, -- Edit QuickFix and reflect to original buffers. - use { + { 'thinca/vim-qfreplace', - opt = true, + lazy = true, cmd = {'Qfreplace'}, config = function() vim.keymap.set('n', 'br', ':<C-u>Qfreplace SmartOpen<CR>', { silent=true }) end, - } + }, -- Run anything. - use { + { 'thinca/vim-quickrun', config = function() vim.g.quickrun_config = { @@ -689,9 +601,9 @@ packer.startup(function(use) vim.keymap.set('n', 'BB', '<Plug>(quickrun)') vim.keymap.set('x', 'BB', '<Plug>(quickrun)') end, - } + }, -- Extend dot-repeat. - use { + { 'tpope/vim-repeat', config = function() vim.keymap.set('n', 'U', '<Plug>(RepeatRedo)') @@ -699,76 +611,70 @@ packer.startup(function(use) -- repeat#setreg() does nothing here. vim.fn['repeat#setreg']('', '') end, - } + }, -- Introduce user-defined mode. - use { + { 'kana/vim-submode', config = function() - -- Global settings {{{3 + -- Global settings {{{2 vim.g.submode_always_show_submode = true vim.g.submode_keyseqs_to_leave = {'<C-c>', '<ESC>'} vim.g.submode_keep_leaving_key = true - -- yankround {{{3 + -- yankround {{{2 vim.fn['submode#enter_with']('YankRound', 'nv', 'rs', 'gp', '<Plug>(yankround-p)') vim.fn['submode#enter_with']('YankRound', 'nv', 'rs', 'gP', '<Plug>(yankround-P)') vim.fn['submode#map']('YankRound', 'nv', 'rs', 'p', '<Plug>(yankround-prev)') vim.fn['submode#map']('YankRound', 'nv', 'rs', 'P', '<Plug>(yankround-next)') - -- swap {{{3 + -- swap {{{2 vim.fn['submode#enter_with']('Swap', 'n', 'rs', 'g>', '<Plug>(swap-next)') vim.fn['submode#map']('Swap', 'n', 'rs', '<', '<Plug>(swap-prev)') vim.fn['submode#enter_with']('Swap', 'n', 'rs', 'g<', '<Plug>(swap-prev)') vim.fn['submode#map']('Swap', 'n', 'rs', '>', '<Plug>(swap-next)') - -- TODO - if packer_plugins['vim-swap'] and not packer_plugins['vim-swap'].loaded then - vim.cmd.packadd('vim-swap') - end - - -- Resizing a window (height) {{{3 + -- Resizing a window (height) {{{2 vim.fn['submode#enter_with']('WinResizeH', 'n', 's', 'trh') vim.fn['submode#enter_with']('WinResizeH', 'n', 's', 'trh') vim.fn['submode#map']('WinResizeH', 'n', 's', '+', '<C-w>+') vim.fn['submode#map']('WinResizeH', 'n', 's', '-', '<C-w>-') - -- Resizing a window (width) {{{3 + -- Resizing a window (width) {{{2 vim.fn['submode#enter_with']('WinResizeW', 'n', 's', 'trw') vim.fn['submode#enter_with']('WinResizeW', 'n', 's', 'trw') vim.fn['submode#map']('WinResizeW', 'n', 's', '+', '<C-w>>') vim.fn['submode#map']('WinResizeW', 'n', 's', '-', '<C-w><Lt>') - -- Super undo/redo {{{3 + -- Super undo/redo {{{2 vim.fn['submode#enter_with']('Undo/Redo', 'n', 's', 'gu', 'g-') vim.fn['submode#map']('Undo/Redo', 'n', 's', 'u', 'g-') vim.fn['submode#enter_with']('Undo/Redo', 'n', 's', 'gU', 'g+') vim.fn['submode#map']('Undo/Redo', 'n', 's', 'U', 'g+') -- }}} end, - } + }, -- Swap arguments. - use { + { 'machakann/vim-swap', - opt = true, - setup = function() + init = function() vim.g.swap_no_default_key_mappings = true end, - } + }, -- Fuzzy finder. - use { + { 'nvim-telescope/telescope.nvim', - } + }, -- Adjust window size. - use { + { 'rhysd/vim-window-adjuster', config = function() vim.keymap.set('n', 'tRw', '<Cmd>AdjustScreenWidth<CR>') vim.keymap.set('n', 'tRh', '<Cmd>AdjustScreenHeight<CR>') vim.keymap.set('n', 'tRr', ':<C-u>AdjustScreenWidth <Bar> AdjustScreenHeight<CR>', { silent=true }) end, - } + }, -- Remember yank history and paste them. - use { + { 'LeafCage/yankround.vim', config = function() local my_env = require('vimrc.my_env') @@ -776,12 +682,6 @@ packer.startup(function(use) vim.g.yankround_dir = my_env.yankround_dir vim.g.yankround_use_region_hl = true end, - } + }, -- }}} -end) --- }}} - -return { - compile = packer.compile, - sync = packer.sync, } |
