using LazyVim for non-vscode scenario

This commit is contained in:
2025-04-14 20:04:07 +08:00
parent 367ebdccb0
commit b69bd64e05
18 changed files with 366 additions and 350 deletions

197
lua/plugins/example.lua Normal file
View File

@@ -0,0 +1,197 @@
-- 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",
},
},
},
}

View File

@@ -7,11 +7,11 @@ return{
modes = {search = {enabled = true}},
-- stylua: ignore
keys = {
{ "<leader>s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "<leader>S", 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", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
{ "<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>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" },
-- { "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
}
}

View File

@@ -1,59 +0,0 @@
return {
{
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged_enable = true,
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
use_focus = true,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
},
config = function(_, opts)
require('gitsigns').setup(opts)
end
}
}

View File

@@ -1,83 +0,0 @@
return {
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
options = {
theme = "auto",
},
-- sections = {
-- lualine_c = {
-- -- 显示当前窗口编号(格式:[窗口号] 文件名)
-- function()
-- return "[" .. tostring(vim.api.nvim_win_get_number(0)) .. "] " .. vim.fn.expand("%:t")
-- end,
-- },
-- },
}
}
}
-- local colors = {
-- blue = '#80a0ff',
-- cyan = '#79dac8',
-- black = '#080808',
-- white = '#c6c6c6',
-- red = '#ff5189',
-- violet = '#d183e8',
-- grey = '#303030',
-- }
-- local bubbles_theme = {
-- normal = {
-- a = { fg = colors.black, bg = colors.violet },
-- b = { fg = colors.white, bg = colors.grey },
-- c = { fg = colors.white },
-- },
-- insert = { a = { fg = colors.black, bg = colors.blue } },
-- visual = { a = { fg = colors.black, bg = colors.cyan } },
-- replace = { a = { fg = colors.black, bg = colors.red } },
-- inactive = {
-- a = { fg = colors.white, bg = colors.black },
-- b = { fg = colors.white, bg = colors.black },
-- c = { fg = colors.white },
-- },
-- }
-- return {
-- {
-- 'nvim-lualine/lualine.nvim',
-- dependencies = { 'nvim-tree/nvim-web-devicons' },
-- opts = {
-- options = {
-- theme = bubbles_theme,
-- component_separators = '',
-- section_separators = { left = '', right = '' },
-- },
-- },
-- sections = {
-- lualine_a = { { 'mode', separator = { left = '' }, right_padding = 2 } },
-- lualine_b = { 'filename', 'branch' },
-- lualine_c = {
-- '%=', --[[ add your center components here in place of this comment ]]
-- },
-- lualine_x = {},
-- lualine_y = { 'filetype', 'progress' },
-- lualine_z = {
-- { 'location', separator = { right = '' }, left_padding = 2 },
-- },
-- },
-- inactive_sections = {
-- lualine_a = { 'filename' },
-- lualine_b = {},
-- lualine_c = {},
-- lualine_x = {},
-- lualine_y = {},
-- lualine_z = { 'location' },
-- },
-- tabline = {},
-- extensions = {},
-- }
-- }

View File

@@ -1,12 +1,12 @@
return{
{
"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
}
return {
{
"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,
},
}

View File

@@ -2,7 +2,7 @@ return {
{
"yorickpeterse/nvim-window",
keys = {
{ "<leader>w", "<cmd>lua require('nvim-window').pick()<cr>", desc = "nvim-window: Jump to window" },
{ "<leader>ww", "<cmd>lua require('nvim-window').pick()<cr>", desc = "nvim-window: Jump to window" },
},
config = true,
}

View File

@@ -1,4 +1,6 @@
return {
--[[ {"vim-neo-tree/neo-tree.nvim", enabled = false},
{
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
@@ -8,4 +10,5 @@ return {
config = function()
require("nvim-tree").setup {}
end,
}
} ]]
}