mirror of
https://github.com/DefectingCat/nvim
synced 2025-07-15 08:41:33 +00:00
modify
This commit is contained in:
@ -1,31 +1,40 @@
|
||||
{
|
||||
"LazyVim": { "branch": "main", "commit": "ec5981dfb1222c3bf246d9bcaa713d5cfa486fbd" },
|
||||
"LazyVim": { "branch": "main", "commit": "3f034d0a7f58031123300309f2efd3bb0356ee21" },
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "df87d16fc4ea7c2c67cfc00b513861738693fe07" },
|
||||
"blink.cmp": { "branch": "main", "commit": "4f38ce99a472932d5776337f08f7a8180f1f571a" },
|
||||
"blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"catppuccin": { "branch": "main", "commit": "1bf070129c0b6f77cc23f6a2212dcdc868308c52" },
|
||||
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
||||
"conform.nvim": { "branch": "master", "commit": "374aaf384e2e841607b8e2fe63fa3ad01d111c91" },
|
||||
"crates.nvim": { "branch": "main", "commit": "2c8f4fab02e3e9ea42c6ad9b547e4207a914a397" },
|
||||
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "43b0c856ae5f32a195d83f4a27fe21d63e6c966c" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "78c8d27c6f3300bfa92bb535236732d8e9bcb614" },
|
||||
"hop.nvim": { "branch": "v2", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" },
|
||||
"mason.nvim": { "branch": "main", "commit": "7c7318e8bae7e3536ef6b9e86b9e38e74f2e125e" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"mini.ai": { "branch": "main", "commit": "e139eb1101beb0250fea322f8c07a42f0f175688" },
|
||||
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
|
||||
"mini.pairs": { "branch": "main", "commit": "69864a2efb36c030877421634487fd90db1e4298" },
|
||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||
"nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" },
|
||||
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "4bc481b6f0c0cf3671fc894debd0e00347089a4e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "61e5109c8cf24807e4ae29813a3a82b31821dd45" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "0e3be38005e9673d044e994b1e4b123adb040179" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||
"oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "935c2c70c296d87ed1bcce9ce667c239c9c982b5" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "cb532f57c1ed2463c66df683468eb3994e554002" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||
"supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
|
11
lazyvim.json
11
lazyvim.json
@ -1,6 +1,15 @@
|
||||
{
|
||||
"extras": [
|
||||
|
||||
"lazyvim.plugins.extras.ai.supermaven",
|
||||
"lazyvim.plugins.extras.lang.docker",
|
||||
"lazyvim.plugins.extras.lang.git",
|
||||
"lazyvim.plugins.extras.lang.go",
|
||||
"lazyvim.plugins.extras.lang.json",
|
||||
"lazyvim.plugins.extras.lang.markdown",
|
||||
"lazyvim.plugins.extras.lang.rust",
|
||||
"lazyvim.plugins.extras.lang.toml",
|
||||
"lazyvim.plugins.extras.lang.typescript",
|
||||
"lazyvim.plugins.extras.lang.vue"
|
||||
],
|
||||
"install_version": 8,
|
||||
"news": {
|
||||
|
@ -6,3 +6,224 @@
|
||||
--
|
||||
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
|
||||
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
||||
-- 封装设置文件类型的函数
|
||||
|
||||
local function set_filetype(patterns, filetype)
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd({ "BufNewFile", "BufRead" }, {
|
||||
pattern = patterns,
|
||||
callback = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
vim.api.nvim_buf_set_option(buf, "filetype", filetype)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- 设置 markdown 高亮用于 mdx 文件
|
||||
set_filetype({ "*.mdx" }, "markdown")
|
||||
|
||||
-- 设置 env 文件为 sh 类型
|
||||
set_filetype({ ".env.example", ".env.local", ".env.development", ".env.production" }, "sh")
|
||||
|
||||
-- 设置终端相关选项
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd({ "TermOpen" }, {
|
||||
callback = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
vim.api.nvim_buf_set_option(buf, "relativenumber", false)
|
||||
vim.api.nvim_buf_set_option(buf, "number", false)
|
||||
end,
|
||||
})
|
||||
|
||||
-- 解析 .gitignore 文件
|
||||
local function parse_gitignore()
|
||||
local gitignore_path = vim.fn.findfile(".gitignore", ".;")
|
||||
if gitignore_path == "" then
|
||||
return {}
|
||||
end
|
||||
local rules = {}
|
||||
local file = io.open(gitignore_path, "r")
|
||||
if file then
|
||||
for line in file:lines() do
|
||||
line = line:gsub("^%s*(.-)%s*$", "%1")
|
||||
if line ~= "" and not line:match("^#") then
|
||||
table.insert(rules, line)
|
||||
end
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
return rules
|
||||
end
|
||||
-- 检查文件是否匹配 .gitignore 规则
|
||||
local function matches_gitignore(file_path, rules)
|
||||
local path_sep = package.config:sub(1, 1)
|
||||
for _, rule in ipairs(rules) do
|
||||
local pattern = "^" .. rule:gsub("%.", "%%."):gsub("%*", ".*"):gsub("%?", ".") .. "$"
|
||||
if file_path:match(pattern) then
|
||||
return true
|
||||
end
|
||||
-- 处理目录匹配
|
||||
if rule:sub(-1) == path_sep then
|
||||
pattern = "^" .. rule:gsub("%.", "%%."):gsub("%*", ".*"):gsub("%?", ".")
|
||||
if file_path:match(pattern) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
-- 自动更新磁盘上更改的文件,可跳过某些目录
|
||||
local skip_dirs = { "" } -- 手动指定要跳过检测的目录列表
|
||||
local gitignore_rules = parse_gitignore()
|
||||
autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, {
|
||||
callback = function()
|
||||
if vim.fn.mode() == "c" or vim.fn.bufexists("[Command Line]") then
|
||||
return
|
||||
end
|
||||
local bufname = vim.api.nvim_buf_get_name(0)
|
||||
for _, dir in ipairs(skip_dirs) do
|
||||
if string.find(bufname, dir, 1, true) then
|
||||
return -- 如果文件在手动跳过的目录中,不进行检测
|
||||
end
|
||||
end
|
||||
if matches_gitignore(bufname, gitignore_rules) then
|
||||
return -- 如果文件匹配 .gitignore 规则,不进行检测
|
||||
end
|
||||
vim.cmd("checktime")
|
||||
end,
|
||||
})
|
||||
|
||||
-- 文件更改后的通知
|
||||
autocmd("FileChangedShellPost", {
|
||||
command = [[echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None]],
|
||||
})
|
||||
|
||||
-- 用 o 换行不要延续注释
|
||||
local myAutoGroup = vim.api.nvim_create_augroup("myAutoGroup", {
|
||||
clear = true,
|
||||
})
|
||||
autocmd("BufEnter", {
|
||||
group = myAutoGroup,
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.opt.formatoptions = vim.opt.formatoptions
|
||||
- "o" -- O 和 o,不延续注释
|
||||
+ "r" -- 按回车键时延续注释
|
||||
end,
|
||||
})
|
||||
|
||||
-- 复制文本后高亮显示
|
||||
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
||||
autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = "*",
|
||||
})
|
||||
|
||||
-- 恢复光标位置
|
||||
autocmd("BufReadPost", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
local line = vim.fn.line("'\"")
|
||||
local filetype = vim.bo.filetype
|
||||
if
|
||||
line > 1
|
||||
and line <= vim.fn.line("$")
|
||||
and filetype ~= "commit"
|
||||
and vim.fn.index({ "xxd", "gitrebase" }, filetype) == -1
|
||||
then
|
||||
vim.cmd('normal! g`"')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- 函数:获取窗口栏路径
|
||||
local function get_winbar_path()
|
||||
return vim.fn.expand("%:.")
|
||||
end
|
||||
|
||||
-- 函数:获取主机名,添加错误日志
|
||||
local function get_hostname()
|
||||
local hostname = vim.fn.systemlist("hostname")
|
||||
if #hostname > 0 then
|
||||
return hostname[1]
|
||||
else
|
||||
vim.notify("Failed to get hostname", vim.log.levels.ERROR)
|
||||
return "unknown"
|
||||
end
|
||||
end
|
||||
|
||||
-- 函数:更新指定缓冲区的窗口栏
|
||||
local function update_winbar(bufnr)
|
||||
bufnr = bufnr or vim.api.nvim_get_current_buf()
|
||||
local old_buf = vim.api.nvim_get_current_buf()
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
local home_replaced = get_winbar_path()
|
||||
if home_replaced == "" then
|
||||
return
|
||||
end
|
||||
-- local buffer_count = get_buffer_count()
|
||||
local ft = vim.bo.filetype
|
||||
local hostname = get_hostname()
|
||||
local winbar
|
||||
|
||||
if ft == "NvimTree" then
|
||||
winbar = "RUA"
|
||||
else
|
||||
local winbar_prefix = "%#WinBar1#%m "
|
||||
local winbar_suffix = "%*%=%#WinBar2#" .. hostname
|
||||
winbar = winbar_prefix .. "%#WinBar1#" .. home_replaced .. winbar_suffix
|
||||
end
|
||||
|
||||
-- vim.opt.winbar = winbar
|
||||
-- 检查缓冲区是否支持设置 winbar
|
||||
if vim.api.nvim_buf_is_valid(bufnr) then
|
||||
vim.api.nvim_buf_set_option(bufnr, "winbar", winbar)
|
||||
end
|
||||
-- 检查 old_buf 是否有效
|
||||
if vim.api.nvim_buf_is_valid(old_buf) then
|
||||
vim.api.nvim_set_current_buf(old_buf)
|
||||
end
|
||||
end
|
||||
|
||||
-- 自动命令:在 BufEnter 和 WinEnter 事件时更新窗口栏
|
||||
autocmd({ "BufEnter", "WinEnter" }, {
|
||||
callback = function(args)
|
||||
update_winbar(args.buf)
|
||||
end,
|
||||
})
|
||||
|
||||
-- 启动时更新所有现有缓冲区的窗口栏
|
||||
local all_buffers = vim.api.nvim_list_bufs()
|
||||
for _, buf in ipairs(all_buffers) do
|
||||
if vim.api.nvim_buf_is_valid(buf) then
|
||||
update_winbar(buf)
|
||||
end
|
||||
end
|
||||
|
||||
-- 大文件检测
|
||||
local aug = vim.api.nvim_create_augroup("buf_large", { clear = true })
|
||||
autocmd({ "BufReadPre" }, {
|
||||
callback = function()
|
||||
local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
|
||||
local ok, stats = pcall(vim.loop.fs_stat, bufname)
|
||||
local large_file_size = 100 * 1024 -- 100 KB
|
||||
|
||||
if ok and stats and stats.size > large_file_size then
|
||||
vim.b.large_buf = true
|
||||
vim.opt_local.foldmethod = "manual"
|
||||
vim.opt_local.spell = false
|
||||
else
|
||||
vim.b.large_buf = false
|
||||
end
|
||||
end,
|
||||
group = aug,
|
||||
pattern = "*",
|
||||
})
|
||||
|
||||
-- 在 Vim 退出前保存会话
|
||||
-- autocmd("VimLeavePre", {
|
||||
-- command = ":SessionSave",
|
||||
-- })
|
||||
|
@ -1,3 +1,28 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
local map = LazyVim.safe_keymap_set
|
||||
|
||||
-- terminal
|
||||
map("t", "<C-x>", "<c-\\><c-n>")
|
||||
-- map("n", "<leader>tt", ":term<CR>", { desc = "Open new terminal" })
|
||||
|
||||
-- buffers
|
||||
-- map("n", "<S-l>", "<CMD>bn<CR>")
|
||||
-- map("n", "<S-h>", "<CMD>bp<CR>")
|
||||
map("n", "<leader>x", "<CMD>bd<CR>")
|
||||
-- map("n", "<C-s>", "<CMD>w<CR>")
|
||||
map("n", "<leader>la", "<CMD>%bd|e#|bd#<CR>")
|
||||
|
||||
-- tabs
|
||||
map("n", "<leader>tc", ":tabclose<CR>", { desc = "Close current tab" })
|
||||
map("n", "<leader>tn", ":tabnew<CR>", { desc = "New tab" })
|
||||
|
||||
-- search
|
||||
map("v", "<leader>ss", ":s/\\%V", { desc = "Search and replace in visual selection" })
|
||||
|
||||
-- copy
|
||||
-- map({ "n", "v" }, "y", '"+y', { desc = "Copy to system clipboard" })
|
||||
|
||||
-- lsp
|
||||
map("n", "gh", "<CMD>lua vim.lsp.buf.hover()<CR>")
|
||||
|
15
lua/config/usercmd.lua
Normal file
15
lua/config/usercmd.lua
Normal file
@ -0,0 +1,15 @@
|
||||
local user_command = vim.api.nvim_create_user_command
|
||||
|
||||
-- 定义 Difft 命令
|
||||
user_command("Difft", function()
|
||||
vim.cmd("windo diffthis")
|
||||
end, {
|
||||
desc = "windo Diffthis",
|
||||
})
|
||||
|
||||
-- 定义 Diffo 命令
|
||||
user_command("Diffo", function()
|
||||
vim.cmd("windo diffoff")
|
||||
end, {
|
||||
desc = "windo Diffoff",
|
||||
})
|
3
lua/plugins/disabled.lua
Normal file
3
lua/plugins/disabled.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
{ "akinsho/bufferline.nvim", enabled = false },
|
||||
}
|
@ -1,197 +0,0 @@
|
||||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "emoji" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, {
|
||||
function()
|
||||
return "😄"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
8
lua/plugins/flash.lua
Normal file
8
lua/plugins/flash.lua
Normal file
@ -0,0 +1,8 @@
|
||||
return {
|
||||
"folke/flash.nvim",
|
||||
enabled = false,
|
||||
keys = {
|
||||
-- disable the default flash keymap
|
||||
{ "s", mode = { "n", "x", "o" }, false },
|
||||
},
|
||||
}
|
38
lua/plugins/hop.lua
Normal file
38
lua/plugins/hop.lua
Normal file
@ -0,0 +1,38 @@
|
||||
return {
|
||||
"phaazon/hop.nvim",
|
||||
branch = "v2",
|
||||
keys = {
|
||||
{
|
||||
"f",
|
||||
function()
|
||||
local hop = require("hop")
|
||||
local directions = require("hop.hint").HintDirection
|
||||
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = false })
|
||||
end,
|
||||
desc = "Hop motion search in current line after cursor",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
{
|
||||
"F",
|
||||
function()
|
||||
local hop = require("hop")
|
||||
local directions = require("hop.hint").HintDirection
|
||||
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = false })
|
||||
end,
|
||||
desc = "Hop motion search in current line before cursor",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
{
|
||||
"<leader><leader>",
|
||||
function()
|
||||
local hop = require("hop")
|
||||
hop.hint_words({ current_line_only = false })
|
||||
end,
|
||||
desc = "Hop motion search words after cursor",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
keys = "etovxqpdygfblzhckisuran",
|
||||
},
|
||||
}
|
26
lua/plugins/lualine.lua
Normal file
26
lua/plugins/lualine.lua
Normal file
@ -0,0 +1,26 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
opts = {
|
||||
options = {
|
||||
-- theme = "catppuccin",
|
||||
-- theme = "lackluster",
|
||||
-- theme = "rei",
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
},
|
||||
extensions = { "quickfix", "trouble", "mason", "lazy", "nvim-tree" },
|
||||
sections = {
|
||||
lualine_x = {
|
||||
{ "encoding" },
|
||||
{ "fileformat" },
|
||||
{ "filetype" },
|
||||
},
|
||||
-- lualine_y = {
|
||||
-- { "progress", color = { bg = "#de9aa3", fg = "#000000" } },
|
||||
-- },
|
||||
-- lualine_z = {
|
||||
-- { "location", color = { bg = "#eac8c7" } },
|
||||
-- },
|
||||
},
|
||||
},
|
||||
}
|
5
lua/plugins/mason-workaround.lua
Normal file
5
lua/plugins/mason-workaround.lua
Normal file
@ -0,0 +1,5 @@
|
||||
-- https://github.com/LazyVim/LazyVim/issues/6039#issuecomment-2856227817
|
||||
return {
|
||||
{ "mason-org/mason.nvim", version = "^1.0.0" },
|
||||
{ "mason-org/mason-lspconfig.nvim", version = "^1.0.0" },
|
||||
}
|
8
lua/plugins/nvim-lspconfig.lua
Normal file
8
lua/plugins/nvim-lspconfig.lua
Normal file
@ -0,0 +1,8 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
-- disable a keymap
|
||||
keys[#keys + 1] = { "K", false }
|
||||
end,
|
||||
}
|
83
lua/plugins/oil.lua
Normal file
83
lua/plugins/oil.lua
Normal file
@ -0,0 +1,83 @@
|
||||
return {
|
||||
"stevearc/oil.nvim",
|
||||
keys = {
|
||||
{ "-", "<CMD>Oil<CR>", desc = "Open parent directory" },
|
||||
{
|
||||
"_",
|
||||
function()
|
||||
require("oil").open(vim.fn.getcwd())
|
||||
end,
|
||||
desc = "Open parent directory",
|
||||
},
|
||||
},
|
||||
cmd = { "Oil" },
|
||||
-- lazy = false,
|
||||
event = "VimEnter",
|
||||
-- dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("oil").setup({
|
||||
default_file_explorer = true,
|
||||
delete_to_trash = false,
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
},
|
||||
columns = {
|
||||
"icon",
|
||||
"permissions",
|
||||
"size",
|
||||
"mtime",
|
||||
},
|
||||
keymaps = {
|
||||
["g?"] = "actions.show_help",
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-s>"] = false,
|
||||
--[[ ["<C-h>"] = { "actions.select", opts = { horizontal = true } }, ]]
|
||||
["<C-h>"] = false,
|
||||
["<C-t>"] = { "actions.select", opts = { tab = true } },
|
||||
["<C-p>"] = "actions.preview",
|
||||
["<C-c>"] = false,
|
||||
["q"] = "actions.close",
|
||||
["<C-l>"] = false,
|
||||
["<C-r>"] = { "actions.refresh" },
|
||||
["-"] = "actions.parent",
|
||||
["_"] = "actions.open_cwd",
|
||||
["`"] = "actions.cd",
|
||||
["~"] = { "actions.cd", opts = { scope = "tab" } },
|
||||
["gs"] = "actions.change_sort",
|
||||
["gx"] = "actions.open_external",
|
||||
["g."] = "actions.toggle_hidden",
|
||||
["g\\"] = "actions.toggle_trash",
|
||||
-- Mappings can be a string
|
||||
-- ["~"] = "<cmd>edit $HOME<CR>",
|
||||
-- Mappings can be a function
|
||||
-- ["gd"] = function()
|
||||
-- require("oil").set_columns({ "icon", "permissions", "size", "mtime" })
|
||||
-- end,
|
||||
-- You can pass additional opts to vim.keymap.set by using
|
||||
-- a table with the mapping as the first element.
|
||||
["<leader>ff"] = {
|
||||
function()
|
||||
require("telescope.builtin").find_files({
|
||||
cwd = require("oil").get_current_dir(),
|
||||
})
|
||||
end,
|
||||
mode = "n",
|
||||
nowait = true,
|
||||
desc = "Find files in the current directory",
|
||||
},
|
||||
["<leader>fw"] = {
|
||||
function()
|
||||
require("telescope.builtin").live_grep({
|
||||
cwd = require("oil").get_current_dir(),
|
||||
})
|
||||
end,
|
||||
mode = "n",
|
||||
nowait = true,
|
||||
desc = "Find files in the current directory",
|
||||
},
|
||||
},
|
||||
skip_confirm_for_simple_edits = true,
|
||||
watch_for_changes = true,
|
||||
})
|
||||
end,
|
||||
}
|
26
lua/plugins/snacks.lua
Normal file
26
lua/plugins/snacks.lua
Normal file
@ -0,0 +1,26 @@
|
||||
return {
|
||||
"snacks.nvim",
|
||||
opts = {
|
||||
-- https://github.com/folke/snacks.nvim/discussions/860#discussioncomment-12027395
|
||||
picker = {
|
||||
sources = {
|
||||
explorer = {
|
||||
layout = {
|
||||
layout = {
|
||||
position = "right",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
layouts = {
|
||||
sidebar = {
|
||||
layout = {
|
||||
layout = {
|
||||
position = "right",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user