deleta some default keymap of flash.nvim in LazyVim

This commit is contained in:
2025-04-15 12:10:07 +08:00
parent b69bd64e05
commit 73104bf61e
6 changed files with 194 additions and 186 deletions

View File

@@ -1,150 +1,141 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git" local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({ vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" }, { out, "WarningMsg" },
{ "\nPress any key to exit..." }, { "\nPress any key to exit..." },
}, true, {}) }, true, {})
vim.fn.getchar() vim.fn.getchar()
os.exit(1) os.exit(1)
end end
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
if not vim.g.vscode then if not vim.g.vscode then
require("lazy").setup({ require("lazy").setup({
spec = { spec = {
-- add LazyVim and import its plugins -- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" }, { "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins -- import/override with your plugins
{ import = "plugins" }, { import = "plugins" },
}, },
defaults = { defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false, lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning, -- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install. -- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver -- version = "*", -- try installing the latest stable version for plugins that support semver
}, },
install = { colorscheme = { "tokyonight", "habamax" } }, install = { colorscheme = { "tokyonight", "habamax" } },
checker = { checker = {
enabled = true, -- check for plugin updates periodically enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update notify = false, -- notify on update
}, -- automatically check for plugin updates }, -- automatically check for plugin updates
performance = { performance = {
rtp = { rtp = {
-- disable some rtp plugins -- disable some rtp plugins
disabled_plugins = { disabled_plugins = {
"gzip", "gzip",
-- "matchit", -- "matchit",
-- "matchparen", -- "matchparen",
-- "netrwPlugin", -- "netrwPlugin",
"tarPlugin", "tarPlugin",
"tohtml", "tohtml",
"tutor", "tutor",
"zipPlugin", "zipPlugin",
}, },
}, },
}, },
}) })
else else
-- 1.options -- 1.options
-- Hint: use `:h <option>` to figure out the meaning if needed -- Hint: use `:h <option>` to figure out the meaning if needed
vim.opt.clipboard = 'unnamedplus' -- use system clipboard vim.opt.clipboard = "unnamedplus" -- use system clipboard
vim.opt.completeopt = {'menu', 'menuone', 'noselect'} vim.opt.completeopt = { "menu", "menuone", "noselect" }
vim.opt.mouse = 'a' -- allow the mouse to be used in Nvim vim.opt.mouse = "a" -- allow the mouse to be used in Nvim
-- Searching -- Searching
vim.opt.incsearch = true -- search as characters are entered vim.opt.incsearch = true -- search as characters are entered
vim.opt.hlsearch = true -- do not highlight matches vim.opt.hlsearch = true -- do not highlight matches
vim.opt.ignorecase = true -- ignore case in searches by default vim.opt.ignorecase = true -- ignore case in searches by default
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
-- Tab -- Tab
vim.opt.tabstop = 4 -- number of visual spaces per TAB -- vim.opt.tabstop = 4 -- number of visual spaces per TAB
vim.opt.softtabstop = 4 -- number of spacesin tab when editing -- vim.opt.softtabstop = 4 -- number of spacesin tab when editing
vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab -- vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab
vim.opt.expandtab = true -- tabs are spaces, mainly because of python -- vim.opt.expandtab = true -- tabs are spaces, mainly because of python
-- UI config -- UI config
vim.opt.number = true -- show absolute number -- vim.opt.number = true -- show absolute number
vim.opt.relativenumber = true -- add numbers to each line on the left side -- vim.opt.relativenumber = true -- add numbers to each line on the left side
vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally -- vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally
vim.opt.splitbelow = true -- open new vertical split bottom -- vim.opt.splitbelow = true -- open new vertical split bottom
vim.opt.splitright = true -- open new horizontal splits right -- vim.opt.splitright = true -- open new horizontal splits right
vim.opt.termguicolors = true -- enabl 24-bit RGB color in the TUI -- vim.opt.termguicolors = true -- enabl 24-bit RGB color in the TUI
vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSERT --" mode hint -- vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSERT --" mode hint
vim.opt.wrap = false -- Wrapping sucks (except on markdown) -- vim.opt.wrap = false -- Wrapping sucks (except on markdown)
vim.opt.swapfile = false -- Do not leave any backup files -- vim.opt.swapfile = false -- Do not leave any backup files
vim.opt.showmatch = true -- Highlights the matching parenthesis -- vim.opt.showmatch = true -- Highlights the matching parenthesis
vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text -- vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text
vim.opt.hidden = true -- Allow multple buffers -- vim.opt.hidden = true -- Allow multple buffers
vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|. -- vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|.
vim.opt.encoding = "utf-8" -- Just in case -- vim.opt.encoding = "utf-8" -- Just in case
vim.opt.cmdheight = 2 -- Shows better messages -- vim.opt.cmdheight = 2 -- Shows better messages
vim.opt.foldmethod = "indent" -- vim.opt.foldmethod = "indent"
vim.opt.foldlevel = 99 -- vim.opt.foldlevel = 99
vim.opt.swapfile = false -- vim.opt.swapfile = false
vim.opt.backup = false -- vim.opt.backup = false
vim.opt.undofile = false -- vim.opt.undofile = false
vim.opt.writebackup = false -- vim.opt.writebackup = false
vim.g.mapleader = " " -- set leader key to space vim.g.mapleader = " " -- set leader key to space
vim.g.maplocalleader = " " -- set local leader key to space vim.g.maplocalleader = " " -- set local leader key to space
if vim.loop.os_uname().sysname == "Windows_NT" then -- set default shell to powershell on Windows local fold = {
vim.opt.shell = "powershell.exe" unfoldAll = function()
vim.opt.shellcmdflag = "-Command" vim.fn.VSCodeNotify("editor.unfoldAll")
vim.opt.shellquote = "" end,
vim.opt.shellxquote = "" foldAll = function()
vim.opt.shellredir = "2>&1 | Out-File -Encoding ASCII %s; exit $LastExitCode" vim.fn.VSCodeNotify("editor.foldAll")
vim.opt.shellpipe = "2>&1 | Out-File -Encoding ASCII %s; exit $LastExitCode" end,
end fold = function()
vim.fn.VSCodeNotify("editor.fold")
end,
unfold = function()
vim.fn.VSCodeNotify("editor.unfold")
end,
}
vim.keymap.set("n", "zR", fold.unfoldAll)
vim.keymap.set("n", "zM", fold.foldAll)
vim.keymap.set("n", "zo", fold.unfold)
vim.keymap.set("n", "zc", fold.fold)
local fold = { local codeReader = {
unfoldAll = function() quickInfo = function()
vim.fn.VSCodeNotify("editor.unfoldAll") vim.fn.VSCodeNotify("editor.action.showHover")
end, end,
foldAll = function() }
vim.fn.VSCodeNotify("editor.foldAll")
end,
fold = function()
vim.fn.VSCodeNotify("editor.fold")
end,
unfold = function()
vim.fn.VSCodeNotify("editor.unfold")
end,
}
vim.keymap.set("n", "zR", fold.unfoldAll)
vim.keymap.set("n", "zM", fold.foldAll)
vim.keymap.set("n", "zo", fold.unfold)
vim.keymap.set("n", "zc", fold.fold)
local codeReader = { vim.keymap.set("n", "<c-h>", codeReader.quickInfo)
quickInfo = function()
vim.fn.VSCodeNotify("editor.action.showHover")
end,
}
vim.keymap.set("n", "<c-h>", codeReader.quickInfo) require("lazy").setup({
spec = {
require("lazy").setup({ -- import your plugins
spec = { { import = "vscodeplugins" },
-- import your plugins },
{ import = "vscodeplugins" }, -- Configure any other settings here. See the documentation for more details.
}, -- colorscheme that will be used when installing plugins.
-- Configure any other settings here. See the documentation for more details. install = { colorscheme = { "habamax" } },
-- colorscheme that will be used when installing plugins. -- automatically check for plugin updates
install = { colorscheme = { "habamax" } }, checker = { enabled = true },
-- automatically check for plugin updates })
checker = { enabled = true },
})
end end

View File

@@ -1,3 +1,18 @@
-- Options are automatically loaded before lazy.nvim startup -- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua -- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here -- Add any additional options here
if vim.loop.os_uname().sysname == "Windows_NT" then -- set default shell to powershell on Windows
vim.opt.shell = "powershell.exe"
vim.opt.shellcmdflag = "-Command"
vim.opt.shellquote = ""
vim.opt.shellxquote = ""
vim.opt.shellredir = "2>&1 | Out-File -Encoding ASCII %s; exit $LastExitCode"
vim.opt.shellpipe = "2>&1 | Out-File -Encoding ASCII %s; exit $LastExitCode"
end
-- Tab
vim.opt.tabstop = 4 -- number of visual spaces per TAB
vim.opt.softtabstop = 4 -- number of spacesin tab when editing
vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab
vim.opt.expandtab = true -- tabs are spaces, mainly because of python

View File

@@ -1,17 +1,19 @@
return{ return {
{ {
"folke/flash.nvim", "folke/flash.nvim",
event = "VeryLazy", event = "VeryLazy",
---@type Flash.Config ---@type Flash.Config
opts = {}, opts = {},
modes = {search = {enabled = true}}, modes = { search = { enabled = true } },
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "<leader>j", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, { "s", mode = { "n", "x", "o" }, false },
{ "<leader>J", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, { "S", mode = { "n", "o", "x" }, false },
-- { "<leader>r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, { "r", mode = "o", false },
-- { "<leader>R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, { "R", mode = { "o", "x" }, false },
-- { "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, { "<c-s>", mode = { "c" }, false },
{ "<leader>j", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "<leader>J", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
}, },
} }
} }

View File

@@ -1,12 +1,12 @@
return { return {
{ {
"kylechui/nvim-surround", "kylechui/nvim-surround",
version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
require("nvim-surround").setup({ require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults -- Configuration here, or leave empty to use defaults
}) })
end, end,
}, },
} }

View File

@@ -1,14 +1,14 @@
return { return {
--[[ {"vim-neo-tree/neo-tree.nvim", enabled = false}, -- { "vim-neo-tree/neo-tree.nvim", enabled = false },
{ -- {
"nvim-tree/nvim-tree.lua", -- "nvim-tree/nvim-tree.lua",
version = "*", -- version = "*",
lazy = false, -- lazy = false,
dependencies = { -- dependencies = {
"nvim-tree/nvim-web-devicons", -- "nvim-tree/nvim-web-devicons",
}, -- },
config = function() -- config = function()
require("nvim-tree").setup {} -- require("nvim-tree").setup {}
end, -- end,
} ]] -- }
} }

View File

@@ -1,27 +1,27 @@
return { return {
{ {
"folke/flash.nvim", "folke/flash.nvim",
event = "VeryLazy", event = "VeryLazy",
---@type Flash.Config ---@type Flash.Config
opts = {}, opts = {},
modes = { search = { enabled = true } }, modes = { search = { enabled = true } },
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "<leader>j", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, { "<leader>j", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "<leader>J", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, { "<leader>J", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
-- { "<leader>r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, -- { "<leader>r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
-- { "<leader>R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, -- { "<leader>R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
-- { "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, -- { "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
},
{
"kylechui/nvim-surround",
version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end,
}, },
},
{
"kylechui/nvim-surround",
version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end,
},
} }