From 5e4d3df8ba8830f0f6cbe191ea295fe017231d19 Mon Sep 17 00:00:00 2001 From: QQ <1770362456@qq.com> Date: Thu, 19 Jan 2023 20:33:35 +0800 Subject: [PATCH] update --- coc-settings.json | 4 +++- lazy-lock.json | 4 +++- lua/coc.lua | 22 ++---------------- lua/keymap.lua | 58 +++++++++++++++++++++++++++++++++++++++++------ lua/options.lua | 7 +++--- lua/plug.lua | 21 +++++++++++------ 6 files changed, 77 insertions(+), 39 deletions(-) diff --git a/coc-settings.json b/coc-settings.json index fa7fad5..0a22cd3 100644 --- a/coc-settings.json +++ b/coc-settings.json @@ -1,4 +1,6 @@ { "snippets.ultisnips.pythonPrompt": false, - "coc.preferences.extensionUpdateCheck": "daily" + "coc.preferences.extensionUpdateCheck": "daily", + "explorer.toggle": true, + "explorer.icon.enableNerdfont": true } diff --git a/lazy-lock.json b/lazy-lock.json index 6d57cf0..a0f2995 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -3,12 +3,14 @@ "coc.nvim": { "branch": "release", "commit": "95b43f67147391cf2c69e550bd001b742781d226" }, "colorizer": { "branch": "master", "commit": "72790a003d5a706c287486a1a81e3a6b32158b54" }, "gruvbox": { "branch": "master", "commit": "bf2885a95efdad7bd5e4794dd0213917770d79b7" }, + "lazygit.nvim": { "branch": "main", "commit": "32bffdebe273e571588f25c8a708ca7297928617" }, "nerdcommenter": { "branch": "master", "commit": "98cc4a2d64ca67cccbf5b5cf47c682ebadaaff58" }, "vim-airline": { "branch": "master", "commit": "1d9ae3f972e76a1d36384da7a2890f6402d07d6c" }, "vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" }, - "vim-instant-markdown": { "branch": "master", "commit": "383aa2900f855eddc42ffbe9d636c54e2f2939d5" }, + "vim-easymotion": { "branch": "master", "commit": "b3cfab2a6302b3b39f53d9fd2cd997e1127d7878" }, "vim-markdown-toc": { "branch": "master", "commit": "7ec05df27b4922830ace2246de36ac7e53bea1db" }, "vim-surround": { "branch": "master", "commit": "6c5e229e85e3248b9db27a2e6276583c586bf3dd" }, "vim-table-mode": { "branch": "master", "commit": "9555a3e6e5bcf285ec181b7fc983eea90500feb4" }, + "vim-which-key": { "branch": "master", "commit": "c0eb7a63e80ed0dc2c91eb8c879b7396a795f775" }, "wildfire.vim": { "branch": "master", "commit": "b371e2b1d938ae0e164146136051de164ecb9aa5" } } \ No newline at end of file diff --git a/lua/coc.lua b/lua/coc.lua index 1f4d33e..b1b31f3 100644 --- a/lua/coc.lua +++ b/lua/coc.lua @@ -3,11 +3,12 @@ vim.cmd([[ \ 'coc-clangd', \ 'coc-lua', \ 'coc-python', + \ 'coc-json', \ - \ 'coc-explorer', \ 'coc-translator', \ 'coc-yank', \ 'coc-pairs', + \ 'coc-explorer', \ ] ]]) @@ -32,23 +33,4 @@ map("i", "", [[ coc#pum#visible() ? coc#pum#prev(1) : "\" ]], opts) -- u breaks current undo, please make your own choice map("i", "", [[ coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\" ]], opts) --- Use `[g` and `]g` to navigate diagnostics --- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list -map("n", "[g", "(coc-diagnostic-prev)", {silent = true}) -map("n", "]g", "(coc-diagnostic-next)", {silent = true}) - --- GoTo code navigation -map("n", "gd", "(coc-definition)", {silent = true}) -map("n", "gy", "(coc-type-definition)", {silent = true}) -map("n", "gi", "(coc-implementation)", {silent = true}) -map("n", "gr", "(coc-references)", {silent = true}) - --- Symbol renaming -map("n", "rn", "(coc-rename)", {silent = true}) - --- Formatting selected code -map("x", "i", "(coc-format-selected)", {silent = true}) -map("n", "i", "(coc-format-selected)", {silent = true}) - -map("n", "tt", ":CocCommand explorer", {silent = true}) diff --git a/lua/keymap.lua b/lua/keymap.lua index 06f2207..2c21fb2 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -3,6 +3,10 @@ local map = vim.api.nvim_set_keymap map('n', 'y', '"+y', {noremap = true}) map('n', 'p', '"+p', {noremap = true}) map('n', 'd', '"+d', {noremap = true}) +map('v', 'y', '"+y', {noremap = true}) +map('v', 'p', '"+p', {noremap = true}) +map('v', 'd', '"+d', {noremap = true}) +map('n', 'rp',':%s/',{noremap = true}) map('n', 'L', '$', {noremap = true}) map('n', 'H', '^', {noremap = true}) @@ -11,16 +15,19 @@ map('n', '<', '<<', {noremap = true}) map('n', 'Q', ':q!', {noremap = true}) map('n', '?', 'set hlsearch?', {noremap = true}) map('n', '/', 'set hlsearch/', {noremap = true}) -map('n', '', '5j', {noremap = true}) -map('n', '', '5k', {noremap = true}) + +map('n', '', '5j', {noremap = true}) +map('n', '', '5k', {noremap = true}) +map('n', '', ':tabn', {noremap = true}) +map('n', '', ':tabp', {noremap = true}) -map('n', '', ':nohlsearch', {noremap = true}) -map('n', '', 'j', {noremap = true}) -map('n', '', 'h', {noremap = true}) -map('n', '', 'k', {noremap = true}) -map('n', '', 'l', {noremap = true}) +map('n', '', 'j', {noremap = true}) +map('n', '', 'h', {noremap = true}) +map('n', '', 'k', {noremap = true}) +map('n', '', 'l', {noremap = true}) map('n', '', ':wq', {noremap = true}) +map('n', '', ':nohlsearch', {noremap = true}) map('n', 'y', 'ggyG', {noremap = true}) @@ -32,6 +39,43 @@ map('n', '', ':res +5', {noremap = true}) map('n', '', ':vertical resize -5', {noremap = true}) map('n', '', ':vertical resize +5', {noremap = true}) +-- 快速注释 +map('n', '/', 'c', {noremap = true}) + +-- easymotion +map('v', 'f', '(easymotion-bd-f)', {}) +map('n', 'f', '(easymotion-overwin-f)', {}) +map('n', 's', '(easymotion-overwin-f2)',{}) + +-- lazygit +map('n', 'g', ':w:LazyGit', {}) + +-- coc.nvim +map("n", "[g", "(coc-diagnostic-prev)", {silent = true}) +map("n", "]g", "(coc-diagnostic-next)", {silent = true}) +map("n", "gd", "(coc-definition)", {silent = true}) +map("n", "gy", "(coc-type-definition)", {silent = true}) +map("n", "gi", "(coc-implementation)", {silent = true}) +map("n", "gr", "(coc-references)", {silent = true}) +map("n", "rn", "(coc-rename)", {silent = true}) +map("x", "i", "(coc-format-selected)", {silent = true}) +map("n", "i", "(coc-format-selected)", {silent = true}) +map("n", "", ":CocCommand explorer", {silent = true}) + +--EasyAlign +map("v", "ga", ":EasyAlign", {silent = true}) + + + + + + + + + + + + diff --git a/lua/options.lua b/lua/options.lua index 7348f2b..3f92832 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -35,6 +35,7 @@ vim.g.bg = dark vim.cmd([[colorscheme gruvbox]]) -- 输入法自动根据模式自动切换 -vim.cmd([[ -au InsertLeave * :silent !fcitx5-remote -c -]]) +vim.cmd([[ au InsertLeave * :silent !fcitx5-remote -c ]]) + +-- 文件判断 +vim.cmd([[ filetype plugin on ]]) diff --git a/lua/plug.lua b/lua/plug.lua index 29bbc0a..6091528 100644 --- a/lua/plug.lua +++ b/lua/plug.lua @@ -1,15 +1,14 @@ -local lazypath = '~/.config/nvim/lua/lazy/lazy.lua' - +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", - "--depin=1", - "https://github.com/newbieQQ/lazy.nvim.git", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release lazypath, }) end - vim.opt.rtp:prepend(lazypath) require("lazy").setup({ @@ -24,6 +23,9 @@ require("lazy").setup({ 'yaocccc/vim-surround', 'gcmt/wildfire.vim', + -- easymotion + 'easymotion/vim-easymotion', + -- 格式整理 'junegunn/vim-easy-align', 'scrooloose/nerdcommenter', @@ -32,10 +34,15 @@ require("lazy").setup({ 'lilydjwg/colorizer', --markdown - 'suan/vim-instant-markdown', 'dhruvasagar/vim-table-mode', 'mzlogin/vim-markdown-toc', - 'dkarter/bullets.vim' + 'dkarter/bullets.vim', + + -- lazygit + 'kdheepak/lazygit.nvim', + + -- which key + 'liuchengxu/vim-which-key', })