2023-10-31 14:21:12 +08:00
|
|
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
|
|
if not vim.loop.fs_stat(lazypath) then
|
|
|
|
vim.fn.system({
|
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
"--filter=blob:none",
|
|
|
|
"https://github.com/folke/lazy.nvim.git",
|
|
|
|
"--branch=stable", -- latest stable release
|
|
|
|
lazypath,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
2023-11-11 10:22:57 +08:00
|
|
|
|
|
|
|
local opts = {
|
2024-01-17 12:34:05 +08:00
|
|
|
defaults = {
|
|
|
|
lazy = true,
|
|
|
|
},
|
2023-11-23 15:24:50 +08:00
|
|
|
dev = {
|
|
|
|
path = "~/.local/src"
|
2023-12-12 13:07:24 +08:00
|
|
|
},
|
|
|
|
install = {
|
|
|
|
-- try to load one of these colorschemes when starting an installation during startup
|
|
|
|
colorscheme = { "gruvbox-material", "habamax" },
|
|
|
|
},
|
2023-10-31 14:21:12 +08:00
|
|
|
}
|
2023-11-11 10:22:57 +08:00
|
|
|
|
|
|
|
local plugins = {
|
2023-11-11 11:45:14 +08:00
|
|
|
-- main UI
|
2023-10-31 14:21:12 +08:00
|
|
|
{
|
2023-11-30 20:53:07 +08:00
|
|
|
"sainnhe/gruvbox-material",
|
2023-10-31 14:21:12 +08:00
|
|
|
lazy = false,
|
|
|
|
priority = 1000,
|
|
|
|
config = function()
|
2023-11-30 20:53:07 +08:00
|
|
|
vim.g.gruvbox_material_better_performance = true
|
|
|
|
vim.g.gruvbox_material_enable_bold = true
|
|
|
|
vim.g.gruvbox_material_foreground = 1
|
|
|
|
vim.g.gruvbox_material_diagnostic_virtual_text = 'colored'
|
|
|
|
vim.cmd([[colorscheme gruvbox-material]])
|
2023-10-31 14:21:12 +08:00
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"nvim-lualine/lualine.nvim",
|
|
|
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
|
|
config = function()
|
|
|
|
require("plugins.statusline")
|
2023-11-30 10:08:56 +08:00
|
|
|
end,
|
|
|
|
event = "UIEnter"
|
2023-10-31 14:21:12 +08:00
|
|
|
},
|
2023-11-11 11:45:14 +08:00
|
|
|
-- TS, LSP, Completion
|
2023-10-31 14:21:12 +08:00
|
|
|
{
|
2023-11-11 16:53:57 +08:00
|
|
|
"williamboman/mason.nvim",
|
|
|
|
lazy = true
|
2023-10-31 14:21:12 +08:00
|
|
|
},
|
|
|
|
{
|
2023-11-11 11:45:14 +08:00
|
|
|
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
config = function()
|
|
|
|
require("plugins.treesitter")
|
2023-11-23 15:24:50 +08:00
|
|
|
end,
|
2023-11-20 22:15:47 +08:00
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
2023-12-10 11:05:26 +08:00
|
|
|
build = ":TSUpdate",
|
2023-10-31 14:21:12 +08:00
|
|
|
dependencies = {
|
2023-12-10 11:05:26 +08:00
|
|
|
"nvim-treesitter/nvim-treesitter-context",
|
|
|
|
"nvim-treesitter/nvim-treesitter-textobjects"
|
|
|
|
}
|
2023-10-31 14:21:12 +08:00
|
|
|
},
|
2023-11-11 16:53:57 +08:00
|
|
|
{
|
|
|
|
"L3MON4D3/LuaSnip",
|
|
|
|
dependencies = { "rafamadriz/friendly-snippets" },
|
2023-12-09 20:07:47 +08:00
|
|
|
config = function()
|
|
|
|
require("luasnip").setup()
|
|
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
|
|
end,
|
|
|
|
lazy = true,
|
|
|
|
-- install jsregexp (optional!).
|
|
|
|
build = "make install_jsregexp"
|
2023-11-11 16:53:57 +08:00
|
|
|
},
|
2023-10-31 14:21:12 +08:00
|
|
|
{
|
|
|
|
"hrsh7th/nvim-cmp",
|
|
|
|
dependencies = {
|
2023-11-11 16:53:57 +08:00
|
|
|
"hrsh7th/cmp-nvim-lsp",
|
2023-10-31 14:21:12 +08:00
|
|
|
"hrsh7th/cmp-buffer",
|
2023-11-11 16:53:57 +08:00
|
|
|
"hrsh7th/cmp-nvim-lua",
|
2023-10-31 14:21:12 +08:00
|
|
|
"hrsh7th/cmp-cmdline",
|
|
|
|
"FelipeLema/cmp-async-path",
|
|
|
|
{
|
|
|
|
"saadparwaiz1/cmp_luasnip",
|
|
|
|
dependencies = {
|
|
|
|
"L3MON4D3/LuaSnip"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
event = { "InsertEnter", "CmdlineEnter" },
|
|
|
|
config = function()
|
|
|
|
require("plugins/cmp")
|
|
|
|
end
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"hrsh7th/cmp-nvim-lsp",
|
2023-11-11 17:11:57 +08:00
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
2023-10-31 14:21:12 +08:00
|
|
|
dependencies = {
|
|
|
|
"neovim/nvim-lspconfig",
|
2023-11-11 17:11:57 +08:00
|
|
|
},
|
|
|
|
lazy = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"neovim/nvim-lspconfig",
|
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
|
|
|
dependencies = {
|
|
|
|
{
|
|
|
|
"williamboman/mason-lspconfig.nvim",
|
|
|
|
dependencies = {
|
|
|
|
"williamboman/mason.nvim",
|
|
|
|
}
|
2023-10-31 14:21:12 +08:00
|
|
|
},
|
2023-11-11 17:11:57 +08:00
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
require("plugins.lsp")
|
|
|
|
end,
|
2023-10-31 14:21:12 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"jay-babu/mason-null-ls.nvim",
|
|
|
|
config = function()
|
|
|
|
require("plugins.null-ls")
|
|
|
|
end,
|
2023-11-11 17:11:57 +08:00
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
2023-10-31 14:21:12 +08:00
|
|
|
dependencies = {
|
|
|
|
"williamboman/mason.nvim",
|
2023-11-28 11:10:12 +08:00
|
|
|
"nvimtools/none-ls.nvim"
|
2023-10-31 14:21:12 +08:00
|
|
|
}
|
|
|
|
},
|
2024-01-17 12:34:05 +08:00
|
|
|
|
|
|
|
-- rust lsp support
|
|
|
|
{
|
|
|
|
'mrcjkb/rustaceanvim',
|
|
|
|
ft = { 'rust' },
|
|
|
|
key = {
|
|
|
|
vim.keymap.set('n', '<leader>rr', ':RustLsp runnables<cr>'),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'saecki/crates.nvim',
|
|
|
|
tag = 'stable',
|
|
|
|
event = { "BufRead Cargo.toml" },
|
|
|
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
|
|
|
config = function()
|
|
|
|
require('crates').setup({
|
|
|
|
null_ls = {
|
|
|
|
enabled = true,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
-- setup cmp completion
|
|
|
|
vim.api.nvim_create_autocmd("BufRead", {
|
|
|
|
group = vim.api.nvim_create_augroup("CmpSourceCargo", { clear = true }),
|
|
|
|
pattern = "Cargo.toml",
|
|
|
|
callback = function()
|
|
|
|
require('cmp').setup.buffer({ sources = { { name = "crates" } } })
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
2023-11-11 11:45:14 +08:00
|
|
|
-- Code editing
|
|
|
|
{
|
|
|
|
"machakann/vim-sandwich",
|
2023-12-12 13:07:24 +08:00
|
|
|
event = "ModeChanged",
|
2023-11-11 11:45:14 +08:00
|
|
|
keys = "s"
|
|
|
|
},
|
2023-11-11 10:22:57 +08:00
|
|
|
{
|
|
|
|
"numToStr/Comment.nvim",
|
2023-11-28 11:10:12 +08:00
|
|
|
event = "ModeChanged",
|
2023-11-11 11:45:14 +08:00
|
|
|
keys = "g",
|
|
|
|
config = function()
|
2023-11-11 10:22:57 +08:00
|
|
|
require("Comment").setup()
|
|
|
|
end
|
|
|
|
},
|
2023-11-11 11:45:14 +08:00
|
|
|
{
|
|
|
|
"andymass/vim-matchup",
|
2024-01-13 11:51:46 +08:00
|
|
|
event = { "BufReadPre", "BufNewFile" },
|
2023-11-11 11:45:14 +08:00
|
|
|
},
|
2023-12-12 17:02:50 +08:00
|
|
|
{
|
|
|
|
'nvim-telescope/telescope-fzf-native.nvim',
|
2024-01-03 13:01:42 +08:00
|
|
|
build = 'CFLAGS=-march=native make',
|
2023-12-12 17:02:50 +08:00
|
|
|
lazy = true
|
|
|
|
},
|
2023-10-31 14:21:12 +08:00
|
|
|
{
|
|
|
|
"nvim-telescope/telescope.nvim",
|
2023-12-12 17:02:50 +08:00
|
|
|
dependencies = {
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
'nvim-telescope/telescope-fzf-native.nvim'
|
|
|
|
},
|
2023-11-23 15:24:50 +08:00
|
|
|
event = "CmdlineEnter",
|
2023-11-28 13:02:36 +08:00
|
|
|
keys = {
|
2023-12-12 17:02:50 +08:00
|
|
|
vim.keymap.set('n', '<leader>f/', ':Telescope lsp_dynamic_workspace_symbols<cr>'),
|
|
|
|
vim.keymap.set('n', '<leader>fg', ':Telescope live_grep<cr>'),
|
|
|
|
vim.keymap.set('n', '<leader>fb', ':Telescope buffers<cr>'),
|
|
|
|
vim.keymap.set('n', '<leader>ff', ':Telescope find_files<cr>'),
|
2023-12-15 12:01:32 +08:00
|
|
|
vim.keymap.set('n', '<leader>fd', ':Telescope diagnostics<cr>'),
|
2023-12-09 18:05:53 +08:00
|
|
|
},
|
2023-12-12 17:02:50 +08:00
|
|
|
config = function()
|
|
|
|
require("telescope").setup {
|
|
|
|
defaults = {
|
|
|
|
layout_strategy = 'flex',
|
|
|
|
layout_config = {
|
2024-01-11 21:09:13 +08:00
|
|
|
flex = { flip_columns = 160 }
|
2023-12-12 17:02:50 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
require('telescope').load_extension('fzf')
|
|
|
|
end
|
2023-10-31 14:21:12 +08:00
|
|
|
},
|
2023-11-28 11:10:12 +08:00
|
|
|
{
|
2023-12-09 18:05:53 +08:00
|
|
|
'kevinhwang91/nvim-bqf',
|
|
|
|
ft = 'qf'
|
2023-11-11 15:04:42 +08:00
|
|
|
},
|
2023-11-30 12:55:27 +08:00
|
|
|
{
|
|
|
|
"danymat/neogen",
|
|
|
|
dependencies = "nvim-treesitter/nvim-treesitter",
|
|
|
|
cmd = "Neogen",
|
|
|
|
opts = {
|
|
|
|
snippet_engine = "luasnip"
|
|
|
|
},
|
|
|
|
config = true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'altermo/ultimate-autopair.nvim',
|
|
|
|
event = { 'InsertEnter', 'CmdlineEnter' },
|
|
|
|
opts = {
|
2023-12-29 14:20:01 +08:00
|
|
|
tabout = { enable = true, hopout = true }
|
2023-11-30 12:55:27 +08:00
|
|
|
},
|
|
|
|
},
|
2024-01-17 12:34:05 +08:00
|
|
|
{
|
|
|
|
"iamcco/markdown-preview.nvim",
|
|
|
|
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
|
|
|
build = "cd app && yarn install",
|
|
|
|
init = function()
|
|
|
|
vim.g.mkdp_filetypes = { "markdown" }
|
|
|
|
end,
|
|
|
|
ft = { "markdown" },
|
|
|
|
},
|
2023-11-11 11:45:14 +08:00
|
|
|
|
|
|
|
-- Eye candy UI
|
2023-11-11 15:04:42 +08:00
|
|
|
{
|
|
|
|
"NvChad/nvim-colorizer.lua",
|
|
|
|
cmd = { "ColorizerAttachToBuffer",
|
|
|
|
"ColorizerToggle"
|
|
|
|
},
|
2024-01-13 11:51:46 +08:00
|
|
|
event = "BufRead",
|
2023-11-11 15:04:42 +08:00
|
|
|
config = function()
|
2024-01-13 11:51:46 +08:00
|
|
|
require 'colorizer'.setup {
|
|
|
|
filetypes = {
|
|
|
|
'*',
|
|
|
|
css = { rgb_fn = true, },
|
|
|
|
html = { names = false, }
|
|
|
|
},
|
|
|
|
}
|
2023-11-11 15:04:42 +08:00
|
|
|
end
|
|
|
|
},
|
2023-10-31 14:21:12 +08:00
|
|
|
{
|
|
|
|
"winston0410/range-highlight.nvim",
|
|
|
|
event = "CmdlineEnter"
|
2023-11-11 11:45:14 +08:00
|
|
|
},
|
2023-11-30 10:08:56 +08:00
|
|
|
{
|
|
|
|
'cameron-wags/rainbow_csv.nvim',
|
|
|
|
config = true,
|
|
|
|
ft = {
|
|
|
|
'csv',
|
|
|
|
'tsv',
|
|
|
|
'csv_semicolon',
|
|
|
|
'csv_whitespace',
|
|
|
|
'csv_pipe',
|
|
|
|
'rfc_csv',
|
|
|
|
'rfc_semicolon'
|
|
|
|
},
|
|
|
|
cmd = {
|
|
|
|
'RainbowDelim',
|
|
|
|
'RainbowDelimSimple',
|
|
|
|
'RainbowDelimQuoted',
|
|
|
|
'RainbowMultiDelim'
|
|
|
|
}
|
|
|
|
},
|
2023-11-11 11:45:14 +08:00
|
|
|
{
|
2023-11-23 15:24:50 +08:00
|
|
|
'stevearc/dressing.nvim',
|
|
|
|
event = "UIEnter"
|
2023-11-11 11:45:14 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"lewis6991/gitsigns.nvim",
|
|
|
|
event = "BufEnter",
|
2023-12-09 18:05:53 +08:00
|
|
|
lazy = true,
|
2023-12-07 13:23:19 +08:00
|
|
|
keys = {
|
|
|
|
-- View changed in git
|
|
|
|
vim.keymap.set('n', ']c', function()
|
|
|
|
if vim.wo.diff then return ']c' end
|
2023-12-09 18:05:53 +08:00
|
|
|
vim.schedule(function()
|
|
|
|
require("gitsigns").next_hunk()
|
|
|
|
end)
|
2023-12-07 13:23:19 +08:00
|
|
|
return '<Ignore>'
|
|
|
|
end, { expr = true }),
|
|
|
|
|
|
|
|
vim.keymap.set('n', '[c', function()
|
|
|
|
if vim.wo.diff then return '[c' end
|
2023-12-09 18:05:53 +08:00
|
|
|
vim.schedule(function()
|
|
|
|
require("gitsigns").prev_hunk()
|
|
|
|
end)
|
2023-12-07 13:23:19 +08:00
|
|
|
return '<Ignore>'
|
2023-12-09 18:05:53 +08:00
|
|
|
end, { expr = true }),
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>hp",
|
|
|
|
function() require("gitsigns").preview_hunk() end)
|
2023-12-07 13:23:19 +08:00
|
|
|
},
|
2023-11-11 15:04:42 +08:00
|
|
|
opts = {
|
|
|
|
signcolumn = false,
|
|
|
|
numhl = true,
|
|
|
|
current_line_blame_opts = {
|
|
|
|
delay = 300,
|
|
|
|
ignore_whitespace = false,
|
|
|
|
virt_text_priority = 100,
|
|
|
|
},
|
|
|
|
},
|
2023-11-23 15:24:50 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
-- misc and games
|
|
|
|
{
|
|
|
|
"seandewar/killersheep.nvim",
|
|
|
|
cmd = "KillKillKill"
|
2023-11-30 12:55:27 +08:00
|
|
|
},
|
2023-12-12 13:07:24 +08:00
|
|
|
{
|
|
|
|
"sindrets/diffview.nvim",
|
|
|
|
event = "CmdlineEnter"
|
|
|
|
},
|
2023-11-30 12:55:27 +08:00
|
|
|
{
|
|
|
|
"NeogitOrg/neogit",
|
|
|
|
dependencies = {
|
|
|
|
"nvim-lua/plenary.nvim", -- required
|
|
|
|
"nvim-telescope/telescope.nvim", -- optional
|
|
|
|
"sindrets/diffview.nvim", -- optional
|
|
|
|
},
|
|
|
|
cmd = { "Neogit", "NeogitResetState" },
|
2023-11-30 14:33:05 +08:00
|
|
|
opts = {
|
|
|
|
disable_hint = true,
|
|
|
|
},
|
2023-11-30 12:55:27 +08:00
|
|
|
},
|
2023-11-11 10:22:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
local vscode_plugins = {
|
2023-11-28 13:02:36 +08:00
|
|
|
{
|
|
|
|
"machakann/vim-sandwich",
|
2023-12-12 13:07:24 +08:00
|
|
|
event = "BufEnter",
|
2023-11-28 13:02:36 +08:00
|
|
|
keys = "s"
|
|
|
|
},
|
2023-11-11 10:22:57 +08:00
|
|
|
{
|
|
|
|
"numToStr/Comment.nvim",
|
2023-11-11 11:45:14 +08:00
|
|
|
config = function()
|
2023-11-11 10:22:57 +08:00
|
|
|
require("Comment").setup()
|
|
|
|
end
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
if vim.g.vscode then
|
|
|
|
-- VSCode extension
|
|
|
|
require("lazy").setup(vscode_plugins, opts)
|
|
|
|
else
|
|
|
|
-- ordinary Neovim
|
|
|
|
require("lazy").setup(plugins, opts)
|
|
|
|
end
|