diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-04-06 03:03:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-04-06 03:21:04 +0900 |
| commit | 53c029d76b75ccf1010720009b4a68c5b9e4ba70 (patch) | |
| tree | 3c6d6b000cbb40862d36d3368ca765ca49569d06 | |
| parent | 86a6f322b70ac5f3a40e5f84b53d0b05dacd3028 (diff) | |
| download | dotfiles-53c029d76b75ccf1010720009b4a68c5b9e4ba70.tar.gz dotfiles-53c029d76b75ccf1010720009b4a68c5b9e4ba70.tar.zst dotfiles-53c029d76b75ccf1010720009b4a68c5b9e4ba70.zip | |
neovim: migrate package manager from packer.nvim to lazy.nvim
| -rw-r--r-- | .config/nvim/init.mini.lua | 4 | ||||
| -rw-r--r-- | .config/nvim/lazy-lock.json | 53 | ||||
| -rw-r--r-- | .config/nvim/lua/init/06-plugins.lua | 40 | ||||
| -rw-r--r-- | .config/nvim/lua/vimrc/plugins.lua | 422 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rwxr-xr-x | setup.sh | 7 | ||||
| -rwxr-xr-x | sync.sh | 15 |
7 files changed, 236 insertions, 306 deletions
diff --git a/.config/nvim/init.mini.lua b/.config/nvim/init.mini.lua deleted file mode 100644 index d9b7c75..0000000 --- a/.config/nvim/init.mini.lua +++ /dev/null @@ -1,4 +0,0 @@ -require('vimrc.my_env').mkdir() -require('vimrc').create_augroup_for_vimrc() -vim.api.nvim_create_user_command('PackerCompile', function() require('vimrc.plugins').compile() end, {}) -vim.api.nvim_create_user_command('PackerSync', function() require('vimrc.plugins').sync() end, {}) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..463f728 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,53 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20" }, + "capture.vim": { "branch": "master", "commit": "857ee11cfe1193948d3d45dcb8d511fded8533fb" }, + "colorswatch.vim": { "branch": "main", "commit": "2e3f847fc0e493de8b119d3c8560e47ceeff595c" }, + "committia.vim": { "branch": "master", "commit": "0b4df1a7f48ffbc23b009bd14d58ee1be541917c" }, + "editorconfig-vim": { "branch": "master", "commit": "7f4e4dfc58c480d154116614e616d90aac77204d" }, + "emmet-vim": { "branch": "master", "commit": "def5d57a1ae5afb1b96ebe83c4652d1c03640f4d" }, + "eskk.vim": { "branch": "master", "commit": "a2a722c1c020748249a1f04b788cecd4f509202b" }, + "fern-hijack.vim": { "branch": "master", "commit": "5989a1ac6ddffd0fe49631826b6743b129992b32" }, + "fern.vim": { "branch": "main", "commit": "dae5eb2debe023fce0e3dfafbf879bd89946d6d0" }, + "filetype.nvim": { "branch": "main", "commit": "b522628a45a17d58fc0073ffd64f9dc9530a8027" }, + "foldCC.vim": { "branch": "master", "commit": "344335d27349b837d33dc7757de0cb7930ac33ae" }, + "hop.nvim": { "branch": "v2", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" }, + "indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" }, + "lazy.nvim": { "branch": "main", "commit": "57cce98dfdb2f2dd05a0567d89811e6d0505e13b" }, + "nvim-treesitter": { "branch": "master", "commit": "411e771d511442ab81670701f5c830f6c74aadd7" }, + "nvim-yati": { "branch": "main", "commit": "8240f369d47c389ac898f87613e0901f126b40f3" }, + "playground": { "branch": "master", "commit": "4044b53c4d4fcd7a78eae20b8627f78ce7dc6f56" }, + "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" }, + "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, + "telescope.nvim": { "branch": "master", "commit": "942fe5faef47b21241e970551eba407bc10d9547" }, + "textobj-wiw": { "branch": "master", "commit": "8f89ed3797adb181332b8a9c80a9311c56184047" }, + "vim-altr": { "branch": "master", "commit": "fba055cf3b83a1ada5b05d694fbefd024aa93289" }, + "vim-asterisk": { "branch": "master", "commit": "77e97061d6691637a034258cc415d98670698459" }, + "vim-clang-format": { "branch": "master", "commit": "6b791825ff478061ad1c57b21bb1ed5a5fd0eb29" }, + "vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" }, + "vim-jplus": { "branch": "master", "commit": "6aaa729f4afeccf430eb3077034d362f5034aa10" }, + "vim-niceblock": { "branch": "master", "commit": "9302f527eefc0fde8df983cbb9710ad52c4213b5" }, + "vim-operator-assign": { "branch": "master", "commit": "099f470c847ec9cd531670a2e893fc4b9220192d" }, + "vim-operator-replace": { "branch": "master", "commit": "1345a556a321a092716e149d4765a5e17c0e9f0f" }, + "vim-operator-user": { "branch": "master", "commit": "c3dfd41c1ed516b4b901c97562e644de62c367aa" }, + "vim-parenmatch": { "branch": "master", "commit": "3f3c18d0fcfaaeb093fababd4bce2edbb4f07b50" }, + "vim-qfedit": { "branch": "master", "commit": "6ea17fc401cd8f9b958275d8b46681f15de8e75b" }, + "vim-qfreplace": { "branch": "master", "commit": "db1c4b0161931c9a63942f4f562a0d0f4271ac14" }, + "vim-quickhl": { "branch": "master", "commit": "be1f44169c3fdee3beab629e83380515da03835e" }, + "vim-quickrun": { "branch": "master", "commit": "50f9ced186cf2651f4356aa3548c2306e181ec3b" }, + "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, + "vim-ripgrep": { "branch": "master", "commit": "7d0a681b1a3a7af0b1b59bb7f4e276b736ff84f2" }, + "vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" }, + "vim-submode": { "branch": "master", "commit": "d29de4f55c40a7a03af1d8134453a703d6affbd2" }, + "vim-swap": { "branch": "master", "commit": "9358bfdc5e377aa13e7c2c2dd8699ba32b0dcf83" }, + "vim-textobj-blockwise": { "branch": "master", "commit": "c731da12fbd5728a22fb8d3c800b8bcdcbf94da8" }, + "vim-textobj-comment": { "branch": "master", "commit": "b201ad403275a38d76475b247b936e90eb06bed1" }, + "vim-textobj-indent": { "branch": "master", "commit": "deb76867c302f933c8f21753806cbf2d8461b548" }, + "vim-textobj-line": { "branch": "master", "commit": "1a6780d29adcf7e464e8ddbcd0be0a9df1a37339" }, + "vim-textobj-parameter": { "branch": "master", "commit": "201144f19a1a7081033b3cf2b088916dd0bcb98c" }, + "vim-textobj-space": { "branch": "master", "commit": "d4dc141aad3ad973a0509956ce753dfd0fc87114" }, + "vim-textobj-syntax": { "branch": "master", "commit": "a0167c2680f8a35d9ca1f47ddf31070492893175" }, + "vim-textobj-url": { "branch": "master", "commit": "782d5b990caaa4519d5b4f39ca9ec48bd2e4bfc5" }, + "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, + "vim-window-adjuster": { "branch": "master", "commit": "3dd7dd0a5e8a479a568ff10ee3cf6b1ffca8d20c" }, + "yankround.vim": { "branch": "master", "commit": "9dca96ed35b09de9fe5474de40da323d75fa3204" } +}
\ No newline at end of file diff --git a/.config/nvim/lua/init/06-plugins.lua b/.config/nvim/lua/init/06-plugins.lua index f8af4a5..3ea88cc 100644 --- a/.config/nvim/lua/init/06-plugins.lua +++ b/.config/nvim/lua/init/06-plugins.lua @@ -10,21 +10,25 @@ vim.g.loaded_zipPlugin = 1 --- Load and configure third-party plugins. {{{1 -vim.api.nvim_create_user_command( - 'PackerSync', - function() require('vimrc.plugins').sync() end, - { - desc = '[packer.nvim] Synchronize plugins', - } -) -vimrc.autocmd('BufWritePost', { - pattern = {'plugins.lua'}, - callback = function() - vim.cmd('source <afile>') - vimrc.autocmd('User', { - pattern = 'PackerCompileDone', - command = 'echo "[packer] Finished compiling lazy-loaders!"' - }) - require('vimrc.plugins').compile() - end, -}) +local lazy_path = require('vimrc.my_env').data_dir .. '/lazy/lazy.nvim' +if vim.loop.fs_stat(lazy_path) then + vim.opt.rtp:prepend(lazy_path) + require('lazy').setup('vimrc.plugins') +else + vim.api.nvim_create_user_command( + 'LazySetup', + function() + vim.fn.system({ + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', + lazy_path, + }) + end, + { + desc = '[lazy.nvim] Setup itself', + } + ) +end 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, } @@ -1,5 +1,4 @@ /.config/alacritty/alacritty.local.yml /.config/newsboat/urls -/.config/nvim/plugin/packer_compiled.lua /bin/gitalias/git-* /nvim-startup.log @@ -120,13 +120,6 @@ if [ ! -f ~/.config/alacritty/alacritty.local.yml ]; then fi fi -# Neovim: packer.nvim {{{2 -packer_nvim_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/packer/opt/packer.nvim -if [ ! -d "$packer_nvim_dir" ]; then - echo "clone: $packer_nvim_dir" - git clone --depth=1 https://github.com/wbthomason/packer.nvim "$packer_nvim_dir" -fi - # SKK {{{2 if [ ! -d ~/.config/skk ]; then echo "dir: ~/.config/skk" @@ -12,21 +12,6 @@ fi # Synchronize current settings. {{{1 -# Neovim {{{2 -if type nvim >/dev/null 2>&1; then - packer_nvim_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/packer/opt/packer.nvim - nvim_conf_dir="${XDG_CONFIG_HOME:-$HOME/.config}"/nvim - if [ -d "$packer_nvim_dir" -a -d "$nvim_conf_dir" ]; then - echo "neovim: compile" - if [ -f "$nvim_conf_dir/plugin/packer_compiled.lua" ]; then - rm -f "$nvim_conf_dir/plugin/packer_compiled.lua" - fi - nvim --headless -u "$nvim_conf_dir/init.mini.lua" -c 'autocmd User PackerCompileDone quitall' -c 'PackerCompile' - echo "neovim: sync" - nvim --headless -u "$nvim_conf_dir/init.mini.lua" -c 'autocmd User PackerComplete quitall' -c 'PackerSync' - fi -fi - # Bat {{{2 if type bat >/dev/null 2>&1; then echo "bat: rebuild cache" |
