From 76f1a2fdee213441eba793fd7e6dbf6f00fd92ee Mon Sep 17 00:00:00 2001 From: QQ <1770362456@qq.com> Date: Sun, 22 Jan 2023 20:20:54 +0800 Subject: [PATCH] update --- README.md | 30 +++++++++++++++++++++++++++ init.lua | 5 ++++- lazy-lock.json | 4 ++-- lua/Plugin/coc.lua | 18 ---------------- lua/Plugin/indentLine.lua | 0 lua/Plugin/lualine.lua | 40 ++++++++++++++++++++++++++++++++++++ lua/Plugin/nerdcommenter.lua | 28 +++++++++++++++++++++++++ lua/Plugin/surround.lua | 0 lua/core/keymap.lua | 3 ++- lua/core/plug.lua | 6 ++---- 10 files changed, 108 insertions(+), 26 deletions(-) create mode 100644 lua/Plugin/indentLine.lua create mode 100644 lua/Plugin/lualine.lua create mode 100644 lua/Plugin/nerdcommenter.lua create mode 100644 lua/Plugin/surround.lua diff --git a/README.md b/README.md index de76011..5489624 100644 --- a/README.md +++ b/README.md @@ -1 +1,31 @@ # 从零开始打造属于自己的nvim +## vim-surround插件 +`"Hello world"` +1.使用 `cs”‘` 效果如下: +`'Hello world'` +2.使用 `cs'` 效果如下: +`Hello world` +3.使用 `cst"` 效果如下: +`"Hello world"` +4.使用 `ds”` 效果如下: +`Hello world` +5.使用 `ys{$xx}"` {$xx}是一个文本对象: +例如: +`Hello world` 使用 `ysiw“`效果如下:`"Hello" world` +`Hello world` 使用 `ys2w“`效果如下:`"Hello world"` +## wildfire.vim插件 +按下回车可以快速选择一个文本对象(段落) +``` +Press in normal mode to +select the closest text object. +``` +使用它可以使用i”,i'等快速选择“或者’内的文本({[]})都可以 +## wildfire 和surround的配合 + +可以使用 `ni)`选择多括号内东西 + +![官方给的gif](https://raw.githubusercontent.com/gcmt/wildfire.vim/master/_assets/preview.gif) + +## nerdcommenter +快速注释插件 +`c` 切换注释状态 diff --git a/init.lua b/init.lua index b0a5fba..8067d00 100644 --- a/init.lua +++ b/init.lua @@ -4,5 +4,8 @@ require('core.plug') require('core.options') require('core.keymap') require('Plugin.coc') -require('Plugin.Im-auto-select') +require('Plugin.lualine') +require('Plugin.surround') +require('Plugin.nerdcommenter') + diff --git a/lazy-lock.json b/lazy-lock.json index ed26176..c48f86c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,13 +2,13 @@ "coc.nvim": { "branch": "release", "commit": "e86b15bbcabc2cc1f20a40e7c127a424e7ad3850" }, "colorizer": { "branch": "master", "commit": "72790a003d5a706c287486a1a81e3a6b32158b54" }, "gruvbox": { "branch": "master", "commit": "bf2885a95efdad7bd5e4794dd0213917770d79b7" }, + "indentLine": { "branch": "master", "commit": "d15d63bf9c4a74a02470d4bc8ecce53df13e3a75" }, "lazy.nvim": { "branch": "main", "commit": "96d759d1cbd8b0bd0ea0a0c2987f99410272f348" }, "lazygit.nvim": { "branch": "main", "commit": "32bffdebe273e571588f25c8a708ca7297928617" }, "lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" }, "nerdcommenter": { "branch": "master", "commit": "98cc4a2d64ca67cccbf5b5cf47c682ebadaaff58" }, - "tabline.nvim": { "branch": "main", "commit": "5d76dc8616b4b7b892229cc05cd0f4cd0200077a" }, "vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" }, "vim-easymotion": { "branch": "master", "commit": "b3cfab2a6302b3b39f53d9fd2cd997e1127d7878" }, - "vim-surround": { "branch": "master", "commit": "6c5e229e85e3248b9db27a2e6276583c586bf3dd" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "wildfire.vim": { "branch": "master", "commit": "b371e2b1d938ae0e164146136051de164ecb9aa5" } } \ No newline at end of file diff --git a/lua/Plugin/coc.lua b/lua/Plugin/coc.lua index b1fcc25..031cedb 100644 --- a/lua/Plugin/coc.lua +++ b/lua/Plugin/coc.lua @@ -72,24 +72,6 @@ keyset("o", "ic", "(coc-classobj-i)", opts) keyset("x", "ac", "(coc-classobj-a)", opts) keyset("o", "ac", "(coc-classobj-a)", opts) -local opts = {silent = true, nowait = true} --- Show all diagnostics -keyset("n", "a", ":CocList diagnostics", opts) --- Manage extensions -keyset("n", "e", ":CocList extensions", opts) --- Show commands -keyset("n", "c", ":CocList commands", opts) --- Find symbol of current document -keyset("n", "o", ":CocList outline", opts) --- Search workleader symbols -keyset("n", "s", ":CocList -I symbols", opts) --- Do default action for next item -keyset("n", "j", ":CocNext", opts) --- Do default action for previous item -keyset("n", "k", ":CocPrev", opts) --- Resume latest coc list -keyset("n", "p", ":CocListResume", opts) - -- explorer keyset("n", "", ":CocCommand explorer") -- translator diff --git a/lua/Plugin/indentLine.lua b/lua/Plugin/indentLine.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/Plugin/lualine.lua b/lua/Plugin/lualine.lua new file mode 100644 index 0000000..56c426a --- /dev/null +++ b/lua/Plugin/lualine.lua @@ -0,0 +1,40 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} diff --git a/lua/Plugin/nerdcommenter.lua b/lua/Plugin/nerdcommenter.lua new file mode 100644 index 0000000..2de014a --- /dev/null +++ b/lua/Plugin/nerdcommenter.lua @@ -0,0 +1,28 @@ +vim.cmd([[ +" Create default mappings +let g:NERDCreateDefaultMappings = 1 + +" Add spaces after comment delimiters by default +let g:NERDSpaceDelims = 1 + +" Use compact syntax for prettified multi-line comments +let g:NERDCompactSexyComs = 1 + +" Align line-wise comment delimiters flush left instead of following code indentation +let g:NERDDefaultAlign = 'left' + +" Set a language to use its alternate delimiters by default +let g:NERDAltDelims_java = 1 + +" Add your own custom formats or override the defaults +let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } + +" Allow commenting and inverting empty lines (useful when commenting a region) +let g:NERDCommentEmptyLines = 1 + +" Enable trimming of trailing whitespace when uncommenting +let g:NERDTrimTrailingWhitespace = 1 + +" Enable NERDCommenterToggle to check all selected lines is commented or not +let g:NERDToggleCheckAllLines = 1 +]]) diff --git a/lua/Plugin/surround.lua b/lua/Plugin/surround.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/core/keymap.lua b/lua/core/keymap.lua index 5b75fba..83a6e0f 100644 --- a/lua/core/keymap.lua +++ b/lua/core/keymap.lua @@ -40,7 +40,8 @@ map('n', '', ':vertical resize -5', {noremap = true}) map('n', '', ':vertical resize +5', {noremap = true}) -- 快速注释 -map('n', '/', 'c', {noremap = true}) +map('n', '/', 'c', {noremap = false}) + -- easymotion map('v', 'f', '(easymotion-bd-f)', {}) diff --git a/lua/core/plug.lua b/lua/core/plug.lua index b5d7bc7..e98121e 100644 --- a/lua/core/plug.lua +++ b/lua/core/plug.lua @@ -18,13 +18,12 @@ require("lazy").setup({ -- 主题插件 'nvim-lualine/lualine.nvim', 'morhetz/gruvbox', - 'kdheepak/tabline.nvim', -- lsp 补全 {'neoclide/coc.nvim', branch = 'release'}, -- surround 和 wildfire 配合有神奇的效果 - 'yaocccc/vim-surround', + 'tpope/vim-surround', 'gcmt/wildfire.vim', -- easymotion @@ -32,7 +31,7 @@ require("lazy").setup({ -- 格式整理 'junegunn/vim-easy-align', - 'scrooloose/nerdcommenter', + 'preservim/nerdcommenter', --颜色识别 'lilydjwg/colorizer', @@ -49,4 +48,3 @@ require("lazy").setup({ -