Compare commits

...

3 Commits

Author SHA1 Message Date
niuzhaolong
e0b1b765f3 Change keybindings. 2025-05-23 00:34:16 +08:00
niuzhaolong
4de1572ad1 turn off auto toggle complete platte. 2025-05-23 00:34:01 +08:00
niuzhaolong
cc8ca1ff33 Update some configurations. 2025-05-22 23:49:23 +08:00
5 changed files with 41 additions and 37 deletions

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Vim Configuration
This is my vim(neovim) configuration, mainly using Lazy.vim as Configuration
manager and adding some basic support so that it can be used in multi-purpose
tasks.

View File

@ -1,17 +1,17 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
@ -23,13 +23,13 @@ vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "catppuccin-mocha" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

View File

@ -38,7 +38,7 @@ return {
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- 触发补全
["<C-n>"] = cmp.mapping.complete(), -- 触发补全
["<C-e>"] = cmp.mapping.abort(), -- 关闭补全
['<CR>'] = cmp.mapping(function(fallback)
if cmp.visible() then
@ -79,14 +79,9 @@ return {
{ name = "path" }, -- 文件路径
{ name = "buffer" }, -- 缓冲区内容
}),
-- 美化补全菜单(图标 + 类型提示)
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = 50,
ellipsis_char = "...",
}),
},
completion = {
autocomplete = false,
}
})
-- 命令行补全

View File

@ -3,6 +3,10 @@
return {
{
"tpope/vim-fugitive",
event = "User GitPrompt", -- 按需加载
cmd = {
"G",
"Git",
"Gedit", "Gdiffsplit", "Gread", "Gwrite", "GMove", "Ggrep", "GDelete", "GBrowse"
}
},
}

View File

@ -7,7 +7,7 @@ return {
{ "<leader>n", ":NERDTreeFocus<CR>", mode = "n", desc = "Nerd Tree Focus" },
{ "<C-n>", ":NERDTree<CR>", mode = "n", desc = "Nerd Tree" },
{ "<C-t>", ":NERDTreeToggle<CR>", mode = "n", desc = "Nerd Tree Toggle" },
{ "<C-f>", ":NERDTreeFind<CR>", mode = "n", desc = "Nerd Tree Find" },
{ "<C-s>", ":NERDTreeFind<CR>", mode = "n", desc = "Nerd Tree Find" },
},
},
{
@ -25,10 +25,10 @@ return {
}
},
keys = {
{ "<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>", desc = "Find Files" },
{ "<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>", desc = "Live Grep" },
{ "<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>", desc = "Find Buffers" },
{ "<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>", desc = "Help Tags" },
{ "<leader>tf", "<cmd>lua require('telescope.builtin').find_files()<cr>", desc = "Find Files" },
{ "<leader>tg", "<cmd>lua require('telescope.builtin').live_grep()<cr>", desc = "Live Grep" },
{ "<leader>tb", "<cmd>lua require('telescope.builtin').buffers()<cr>", desc = "Find Buffers" },
{ "<leader>th", "<cmd>lua require('telescope.builtin').help_tags()<cr>", desc = "Help Tags" },
{ "gf", "<cmd>Telescope file_browser path=%:p:h<cr>", desc = "Open File Under Cursor" },
}
},
@ -43,8 +43,8 @@ return {
{ "s", "<Plug>(easymotion-overwin-f2)", mode = "n", desc = "EasyMotion 跳转双字符" },
-- <Leader>L 跳转行(上下)
{ "<leader>L", "<Plug>(easymotion-overwin-line)", mode = "n", desc = "EasyMotion 跳转行" },
{ "<leader>L", "<Plug>(easymotion-bd-jk)", mode = { "x", "o" }, desc = "EasyMotion 跳转行(可视模式)" },
{ "<leader>l", "<Plug>(easymotion-overwin-line)", mode = "n", desc = "EasyMotion 跳转行" },
{ "<leader>l", "<Plug>(easymotion-bd-jk)", mode = { "x", "o" }, desc = "EasyMotion 跳转行(可视模式)" },
-- <Leader>w 跳转单词
{ "<leader>w", "<Plug>(easymotion-overwin-w)", mode = "n", desc = "EasyMotion 跳转单词" },