mig packer to lazy and archive

Signed-off-by: d0zingcat <leewtang@gmail.com>
This commit is contained in:
d0zingcat
2024-06-03 11:18:10 +08:00
parent bd35155080
commit 65b75edd9a
56 changed files with 764 additions and 25 deletions

View File

@@ -0,0 +1,5 @@
return {
'm4xshen/autoclose.nvim',
event = 'VeryLazy',
config = true,
}

View File

@@ -0,0 +1,5 @@
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = true,
}

View File

@@ -0,0 +1,20 @@
return {
'akinsho/bufferline.nvim',
event = 'VeryLazy',
enabled = false,
opts = {
options = {
show_buffer_icons = true,
diagnostics = 'nvim_lsp',
indicator = {
icon = '',
style = 'icon',
},
-- show_buffer_close_icons = false,
modified_icon = '',
offsets = {
{ filetype = 'NvimTree', text = 'File Explorer', text_align = 'center', highlight = 'Directory' },
},
},
}
}

View File

@@ -0,0 +1,13 @@
return {
'tkmpypy/chowcho.nvim',
event = 'VeryLazy',
keys = {
{
'-',
mode = { 'n' },
function()
require('chowcho').run()
end,
}
}
}

79
nvim/lua/plugins/cmp.lua Normal file
View File

@@ -0,0 +1,79 @@
return {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'hrsh7th/cmp-vsnip',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/vim-vsnip',
'hrsh7th/vim-vsnip-integ',
'hrsh7th/cmp-buffer',
'onsails/lspkind-nvim',
'windwp/nvim-autopairs',
'hrsh7th/cmp-cmdline',
},
config = function()
local cmp = require('cmp')
local types = require('cmp.types')
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local opts = {
formatting = {
format = function(entry, vim_item)
vim_item.kind = require('lspkind').presets.default[vim_item.kind] .. ' ' .. vim_item.kind
-- set a name for each source
vim_item.menu = ({
buffer = '[Buf]',
nvim_lsp = '[LSP]',
luasnip = '[Snip]',
nvim_lua = '[Lua]',
latex_symbols = '[Latex]',
})[entry.source.name]
return vim_item
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
snippet = {
expand = function(args)
vim.fn['vsnip#anonymous'](args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<Tab>'] = cmp.mapping.select_next_item({ behavior = types.cmp.SelectBehavior.Select }),
['<S-Tab>'] = function(fallback)
local function input(keys, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(keys, true, true, true), mode or 'i', true)
end
if vim.fn.pumvisible() == 1 then
input('<C-p>', 'n')
elseif vim.fn['vsnip#jumpable']() == -1 then
input('<Plug>(vsnip-jump-prev)')
else
fallback()
end
end,
['<C-y>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
['<CR>'] = function(fallback)
fallback()
end,
['<C-e>'] = function(fallback)
fallback()
end,
}),
completion = {
completeopt = 'menu,menuone,noselect',
},
preselect = types.cmp.PreselectMode.None,
sources = {
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'vsnip' },
},
}
cmp.setup(opts)
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
end,
}

View File

@@ -0,0 +1,5 @@
return {
'numToStr/comment.nvim',
keys = { 'gcc', { 'gc', mode = 'v' } },
config = true,
}

View File

@@ -0,0 +1,21 @@
return {
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
event = 'InsertEnter',
opts = {
-- panel = {
-- auto_refresh = true,
-- },
filetypes = {
['*'] = true,
},
suggestion = {
auto_trigger = true,
keymap = {
accept = '<C-e>',
next = '<C-j>',
prev = '<C-k>',
}
}
}
}

View File

@@ -0,0 +1,14 @@
return {
'nvim-tree/nvim-web-devicons',
event = 'VeryLazy',
opts = {
override = {
zsh = {
icon = '',
color = '#428850',
name = 'Zsh',
},
},
default = true,
}
}

View File

@@ -0,0 +1,13 @@
return {
'j-hui/fidget.nvim', -- nvim-lsp progress
branch = 'legacy',
event = 'VeryLazy',
opts = {
text = {
done = '[✓]',
},
fmt = {
stack_upwards = false,
},
},
}

View File

@@ -0,0 +1,4 @@
return {
'tpope/vim-fugitive',
event = 'VeryLazy',
}

View File

@@ -0,0 +1,49 @@
return {
'lewis6991/gitsigns.nvim',
event = 'VeryLazy',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '' },
topdelete = { text = '' },
changedelete = { text = '' },
},
word_diff = false,
current_line_blame = true,
linehl = true,
numhl = true,
sign_priority = 6,
preview_config = {
border = 'rounded',
},
on_attach = function(bufnr)
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
local gs = package.loaded.gitsigns
map('n', '<leader>hs', gs.stage_hunk)
map('n', '<leader>hr', gs.reset_hunk)
map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
map('n', '<leader>hp', gs.preview_hunk)
map('n', '<leader>hd', gs.diffthis)
map('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, { expr = true })
map('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, { expr = true })
end
}
}

View File

@@ -0,0 +1,5 @@
return {
'm-demare/hlargs.nvim',
event = 'VeryLazy',
config = true,
}

View File

@@ -0,0 +1,5 @@
return {
'glepnir/hlsearch.nvim',
event = 'VeryLazy',
config = true,
}

25
nvim/lua/plugins/hop.lua Normal file
View File

@@ -0,0 +1,25 @@
return {
'phaazon/hop.nvim',
event = 'VeryLazy',
config = true,
keys = {
{
's',
'<cmd>HopChar2<cr>',
},
{
'<leader>w',
'<cmd>HopWordAC<cr>',
},
{
'<leader>k',
mode = { 'n', 'v' },
'<cmd>HopLineStart<cr>',
},
{
'<leader>j',
mode = { 'n', 'v' },
'<cmd>HopLineStart<cr>',
},
},
}

View File

@@ -0,0 +1,5 @@
return {
'adelarsq/image_preview.nvim',
event = 'VeryLazy',
config = true,
}

View File

@@ -0,0 +1,5 @@
return {
'mattdibi/incolla.nvim',
cmd = { 'Incolla' },
config = true,
}

View File

@@ -0,0 +1,41 @@
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
return {
'lukas-reineke/indent-blankline.nvim',
event = 'BufRead',
main = 'ibl',
opts = {
indent = {
char = '|',
highlight = highlight,
},
exclude = {
buftypes = {
'terminal',
'NvimTree',
'nofile'
}
},
}
}

View File

@@ -0,0 +1,14 @@
return {
'hoob3rt/lualine.nvim',
event = 'VeryLazy',
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
opts = {
options = {
disabled_filetypes = { 'NvimTree' },
theme = 'auto',
section_separators = '',
component_separators = '',
-- globalstatus = true,
},
},
}

View File

@@ -0,0 +1 @@
return { "folke/neoconf.nvim", cmd = "Neoconf" }

View File

@@ -0,0 +1,9 @@
return {
'folke/neodev.nvim',
event = 'VeryLazy',
dependencies = {
'neovim/nvim-lspconfig',
},
ft = { 'lua' },
config = true,
}

View File

@@ -0,0 +1,22 @@
return {
'petertriho/nvim-scrollbar',
event = 'VeryLazy',
opts = function()
local colors = require('tokyonight.colors').setup()
return {
handle = {
cursor = false,
color = colors.bg_highlight,
},
marks = {
Search = { color = colors.orange },
Error = { color = colors.error },
Warn = { color = colors.warning },
Info = { color = colors.info },
Hint = { color = colors.hint },
Misc = { color = colors.purple },
},
excluded_filetypes = { 'NvimTree', 'TelescopePrompt', 'chatgpt' }
}
end
}

View File

@@ -0,0 +1,5 @@
return {
'utilyre/sentiment.nvim',
event = 'VeryLazy',
config = true,
}

View File

@@ -0,0 +1,5 @@
return {
'ray-x/lsp_signature.nvim',
event = 'VeryLazy',
config = true,
}

View File

@@ -0,0 +1,16 @@
return {
'krivahtoo/silicon.nvim',
event = 'VeryLazy',
enabled = false,
opts = {
font = 'Hack=20',
theme = 'Dracula',
background = '#fff',
pad_horiz = 50,
pad_vert = 50,
line_number = true,
line_pad = 2,
line_offset = 1,
tab_width = 4,
}
}

View File

@@ -0,0 +1,27 @@
return {
'luukvbaal/statuscol.nvim',
event = 'VeryLazy',
opts = function()
local builtin = require('statuscol.builtin')
return {
relculright = true,
segments = {
{
sign = { name = { '.*' }, maxwidth = 1, auto = true },
click = 'v:lua#.ScSa'
},
{ text = { builtin.lnumfunc }, click = 'v:lua.ScLa', },
{ text = { builtin.foldfunc }, click = 'v:lua.ScFa' },
{
text = { ' ' },
condition = { builtin.not_empty, true, builtin.not_empty },
click = 'v:lua.ScFa'
},
{
sign = { name = { 'GitSigns' }, maxwidth = 1, colwidth = 1, auto = true },
click = 'v:lua.ScSa'
},
}
}
end
}

View File

@@ -0,0 +1,46 @@
return {
'nvim-telescope/telescope.nvim',
event = 'VeryLazy',
dependencies = {
'nvim-lua/plenary.nvim',
},
opts = {
defaults = {
layout_config = {
horizontal = {
width = 0.75,
height = 0.5,
},
},
mappings = {
i = {
['<esc>'] = 'close',
['<C-j>'] = 'move_selection_previous',
['<C-k>'] = 'move_selection_next',
['<C-l>'] = { '<Right>', type = 'command' },
['<C-h>'] = { '<Left>', type = 'command' },
['<C-f>'] = 'preview_scrolling_down',
['<C-b>'] = 'preview_scrolling_up',
},
},
},
},
keys = {
{
'<leader>ff',
'<cmd>Telescope find_files<cr>',
},
{
'<leader>fg',
'<cmd>Telescope live_grep<cr>',
},
{
'<leader>b',
'<cmd>Telescope buffers<cr>',
},
{
';',
'<cmd>Telescope commands<cr>',
}
},
}

View File

@@ -0,0 +1,14 @@
return {
'folke/todo-comments.nvim',
event = 'VeryLazy',
dependencies = {
'nvim-lua/plenary.nvim',
},
opts = {
highlight = {
-- bg conflects with linehl of gitsigns
keyword = 'fg',
after = '',
},
}
}

View File

@@ -0,0 +1,17 @@
return {
'akinsho/toggleterm.nvim',
event = 'VeryLazy',
keys = {
{ mode = { 'n' }, '<C-t>', ':ToggleTerm<CR>' },
},
opts = {
open_mapping = [[<C-t>]],
size = function(term)
if term.direction == 'horizontal' then
return 15
else
return vim.o.columns * 0.3
end
end,
},
}

View File

@@ -0,0 +1,11 @@
return {
'folke/tokyonight.nvim',
lazy = false,
priority = 1000,
init = function()
require('tokyonight').load()
end,
opts = {
style = 'night',
},
}

99
nvim/lua/plugins/tree.lua Normal file
View File

@@ -0,0 +1,99 @@
return {
'nvim-tree/nvim-tree.lua',
event = 'VeryLazy',
dependencies = 'nvim-tree/nvim-web-devicons',
init = function()
local function open_nvim_tree()
require('nvim-tree.api').tree.find_file({ open = true })
end
local function close_nvim_tree()
local layout = vim.api.nvim_call_function('winlayout', {})
if layout[1] == 'leaf'
and vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(layout[2]), 'filetype') == 'NvimTree'
and layout[3] == nil then
vim.cmd('confirm quit')
end
end
vim.api.nvim_create_autocmd('VimEnter', { callback = open_nvim_tree })
vim.api.nvim_create_autocmd('BufEnter', { callback = close_nvim_tree })
end,
opts = {
on_attach = function(bufnr)
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
local api = require('nvim-tree.api')
api.config.mappings.default_on_attach(bufnr)
map('n', '<C-v>', api.node.open.vertical)
map('n', '<C-s>', api.node.open.horizontal)
map('n', 'v', api.node.open.vertical)
map('n', 's', api.node.open.horizontal)
map('n', '[d', api.node.navigate.diagnostics.prev)
map('n', ']d', api.node.navigate.diagnostics.next)
-- map('n', 'r', api.fs.rename_sub, { buffer = bufnr })
map('n', '<C-t>', function() require('toggleterm').toggle() end)
map('n', '-', function() require('chowcho').run() end)
end,
renderer = {
indent_markers = {
enable = true,
icons = {
item = '|',
edge = '|',
corner = '',
}
},
highlight_git = true,
icons = {
git_placement = 'after',
glyphs = {
symlink = '',
git = {
deleted = '',
ignored = '',
renamed = '',
staged = '+',
unmerged = '',
untracked = '?',
-- unstaged = 'ϟ',
},
folder = {
arrow_open = '',
arrow_closed = '',
default = '',
open = '',
empty = '',
empty_open = '',
symlink = '',
symlink_open = '',
},
}
}
},
view = {
width = 35,
side = 'left',
},
diagnostics = {
enable = true,
icons = {
error = '',
warning = '',
info = '',
hint = '',
},
},
update_focused_file = {
enable = true,
},
hijack_netrw = true,
update_cwd = true,
reload_on_bufenter = true,
}
}

View File

@@ -0,0 +1,71 @@
return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
event = 'VeryLazy',
dependencies = {
'nvim-treesitter/playground',
'nvim-treesitter/nvim-treesitter-refactor',
'nvim-treesitter/nvim-treesitter-textobjects',
'nvim-treesitter/nvim-treesitter-context',
'RRethy/nvim-treesitter-endwise',
-- 'andymass/vim-matchup', -- extend % key
'yioneko/nvim-yati',
},
init = function()
local ncmd = vim.api.nvim_command
ncmd('set foldmethod=expr')
ncmd('set foldexpr=nvim_treesitter#foldexpr()')
end,
opts = {
ensure_installed = {
'c', 'lua', 'rust', 'go', 'python',
'zig', 'markdown', 'solidity', 'jsonnet', 'vim', 'graphql'
},
highlight = {
enable = true,
},
playground = {
enable = true,
},
query_linter = {
enable = true,
use_virtual_text = true,
lint_events = { 'BufWrite', 'CursorHold' },
},
-- nvim-treesitter/nvim-treesitter-refactor
refactor = {
highlight_definitions = { enable = true },
smart_rename = {
enable = true,
keymaps = {
smart_rename = 'gnr',
},
},
},
indent = { enable = false },
autopairs = { enable = true },
rainbow = { enable = true },
autotag = { enable = true },
context_commentstring = { enable = true },
-- RRethy/nvim-treesitter-endwise
endwise = {
enable = true,
},
-- andymass/vim-matchup
-- matchup = {
-- enable = true,
-- },
-- nvim-treesitter/nvim-treesitter-textobjects
textobjects = {
select = {
enable = true,
lookahead = true,
},
},
-- yioneko/nvim-yati
yati = { enable = true },
},
config = function(_, opts)
require('nvim-treesitter.configs').setup(opts)
end,
}

View File

@@ -0,0 +1,4 @@
return {
'wakatime/vim-wakatime',
event = 'InsertEnter',
}

View File

@@ -0,0 +1 @@
return {"folke/which-key.nvim"}