This commit is contained in:
Ryan 2023-10-31 14:21:12 +08:00
parent 573ea78839
commit 4ba1a1e303
Signed by: juan
GPG Key ID: 807ECD28A698D245
6 changed files with 168 additions and 231 deletions

View File

@ -3,4 +3,4 @@ require('core')
-- load mappings -- load mappings
require('mappings') require('mappings')
-- load plugins and its options -- load plugins and its options
require('plugins') require('lazy-plugins')

32
lazy-lock.json Normal file
View File

@ -0,0 +1,32 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" },
"cmp-async-path": { "branch": "main", "commit": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-git": { "branch": "main", "commit": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" },
"cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"gruvbox.nvim": { "branch": "main", "commit": "477c62493c82684ed510c4f70eaf83802e398898" },
"lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" },
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
"mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
"nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" },
"nvim-lspconfig": { "branch": "master", "commit": "d0467b9574b48429debf83f8248d8cee79562586" },
"nvim-treesitter": { "branch": "master", "commit": "a8c14d68b024ffc20baec92d1acc91796bcfb485" },
"nvim-treesitter-context": { "branch": "master", "commit": "2806d83e3965017382ce08792ee527e708fa1bd4" },
"nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" },
"nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"range-highlight.nvim": { "branch": "master", "commit": "8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9" },
"tagbar": { "branch": "master", "commit": "5d6990e4fc5b3e3b88a3af90146f2561c4f6d828" },
"telescope.nvim": { "branch": "master", "commit": "4522d7e3ea75ffddabdc39957168a8a7060b5df0" },
"vim-matchup": { "branch": "master", "commit": "6dbe108230c7dbbf00555b7d4d9f6a891837ef07" },
"vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" }
}

129
lua/lazy-plugins.lua Normal file
View File

@ -0,0 +1,129 @@
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)
opts = {
install = {
colorscheme = { "gruvbox" }
}
}
require("lazy").setup({
{
"ellisonleao/gruvbox.nvim",
lazy = false,
priority = 1000,
config = function()
vim.cmd([[colorscheme gruvbox]])
end
},
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("plugins.statusline")
end
},
{
"williamboman/mason.nvim"
},
{
"nvim-treesitter/nvim-treesitter-context",
dependencies = {
"nvim-treesitter/nvim-treesitter"
},
},
{
"HiPhish/nvim-ts-rainbow2",
dependencies = {
"nvim-treesitter/nvim-treesitter",
config = function()
require("plugins.treesitter")
end
},
},
{
"hrsh7th/nvim-cmp",
dependencies = {
{
"hrsh7th/cmp-nvim-lsp",
},
-- TODO: check the cmp sources
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-document-symbol",
"FelipeLema/cmp-async-path",
"petertriho/cmp-git",
"ray-x/cmp-treesitter",
{
"saadparwaiz1/cmp_luasnip",
dependencies = {
"L3MON4D3/LuaSnip"
}
},
{
"windwp/nvim-autopairs",
config = function()
require("plugins.nvim-autopairs")
end
}
},
event = { "InsertEnter", "CmdlineEnter" },
config = function()
require("plugins/cmp")
end
},
{
"hrsh7th/cmp-nvim-lsp",
dependencies = {
"neovim/nvim-lspconfig",
dependencies = {
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
}
},
"null-ls.nvim"
},
config = function()
require("plugins.lsp")
end,
}
},
{
"jay-babu/mason-null-ls.nvim",
config = function()
require("plugins.null-ls")
end,
dependencies = {
"williamboman/mason.nvim",
"jose-elias-alvarez/null-ls.nvim"
}
},
"machakann/vim-sandwich",
"numToStr/Comment.nvim",
"andymass/vim-matchup",
{
"nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
require("plugins.telescope")
end
},
{
"preservim/tagbar",
cmd = "TagbarToggle"
},
{
"winston0410/range-highlight.nvim",
event = "CmdlineEnter"
}
}, opts)

View File

@ -3,8 +3,9 @@ local map = vim.api.nvim_set_keymap
-- vscode -- vscode
if vim.g.vscode then if vim.g.vscode then
-- undo/REDO via vscode -- undo/REDO via vscode
map("n","u","<Cmd>call VSCodeNotify('undo')<CR>") map("n","u","<Cmd>call VSCodeNotify('undo')<CR>", {})
map("n","<C-r>","<Cmd>call VSCodeNotify('redo')<CR>") map("n","<C-r>","<Cmd>call VSCodeNotify('redo')<CR>", {})
map("n","gf", "<Cmd>call VSCodeCall('editor.action.openLink')<CR>", {silent = true, noremap = true})
end end
-- generic mappings -- generic mappings
@ -51,9 +52,6 @@ map('', '<leader>qf',
-- toggle tagbar -- toggle tagbar
map('', '<leader>tt', ':TagbarToggle<cr>', { silent = true }) map('', '<leader>tt', ':TagbarToggle<cr>', { silent = true })
-- toggle NvimTree
map('', '<C-n>', ':NvimTreeToggle<cr>', { silent = true })
-- toggle formatter -- toggle formatter
map('', '<leader>fm', ':lua vim.lsp.buf.format({async = true})<cr>', { silent = true }) map('', '<leader>fm', ':lua vim.lsp.buf.format({async = true})<cr>', { silent = true })

View File

@ -1,223 +0,0 @@
return require("packer").startup(function(use)
use({ "wbthomason/packer.nvim" })
-- core UI
use({
"ellisonleao/gruvbox.nvim",
config = function()
vim.cmd("colorscheme gruvbox")
end,
})
use({ "nvim-tree/nvim-web-devicons" })
use({
"nvim-lualine/lualine.nvim",
after = { "nvim-web-devicons" },
config = function()
require("plugins.statusline")
end,
})
-- lsp stuff
use({
"neovim/nvim-lspconfig",
after = { "mason-lspconfig.nvim", "null-ls.nvim" },
config = function()
require("plugins.lsp")
end,
})
use({ "williamboman/mason-lspconfig.nvim", after = "mason.nvim" })
use({ "hrsh7th/cmp-nvim-lsp", after = "nvim-lspconfig" })
use({
"ray-x/lsp_signature.nvim",
after = { "nvim-cmp" },
config = function()
require("plugins.lsp-signature")
end,
})
-- tree sitter modules and tree sitter
use({
"nvim-treesitter/nvim-treesitter",
requires = {
{
"HiPhish/nvim-ts-rainbow2",
after = { "nvim-treesitter" },
config = function()
require("plugins.treesitter")
end,
},
},
event = "UIEnter",
run = ":TSUpdate",
})
-- completer
use({
"L3MON4D3/LuaSnip",
event = "UIEnter",
requires = { "rafamadriz/friendly-snippets" },
})
use({
"hrsh7th/nvim-cmp",
event = "InsertEnter",
after = { "LuaSnip", "cmp-nvim-lsp", "nvim-treesitter" },
config = function()
require("plugins.cmp")
end,
requires = {
-- local
{ "hrsh7th/cmp-cmdline", after = "nvim-cmp" },
{ "hrsh7th/cmp-buffer", after = "nvim-cmp" },
{ "FelipeLema/cmp-async-path", after = "nvim-cmp" },
{
"petertriho/cmp-git",
after = "nvim-cmp",
config = function()
require("cmp_git").setup()
end,
},
{ "delphinus/cmp-ctags", after = "nvim-cmp" }, -- end
-- lsp
{ "hrsh7th/cmp-nvim-lsp-document-symbol", after = "nvim-cmp" }, -- TS
{ "ray-x/cmp-treesitter", after = "nvim-cmp" }, -- end
-- Snip
{ "saadparwaiz1/cmp_luasnip", after = { "nvim-cmp", "LuaSnip" } },
},
})
-- formating and editing
use({ "williamboman/mason.nvim", event = "BufEnter" })
use({
"windwp/nvim-autopairs",
after = "nvim-cmp",
config = function()
require("plugins.nvim-autopairs")
end,
})
use({
"jose-elias-alvarez/null-ls.nvim",
requires = { "nvim-lua/plenary.nvim" },
event = "BufEnter",
})
use({
"jay-babu/mason-null-ls.nvim",
config = function()
require("plugins.null-ls")
end,
after = { "mason.nvim", "null-ls.nvim" },
})
use({
"mattn/emmet-vim",
ft = { "html", "htmldjango", "css", "markdown" },
setup = function()
require("plugins.emmet")
end,
})
use({ "machakann/vim-sandwich", event = "UIEnter" })
use({
"numToStr/Comment.nvim",
event = "UIEnter",
config = function()
require("Comment").setup()
end,
})
-- navigation
use({
"andymass/vim-matchup",
after = "nvim-treesitter",
config = function()
require("plugins.matchup")
end,
})
use({
"nvim-telescope/telescope.nvim",
event = "UIEnter",
requires = { "nvim-lua/plenary.nvim" },
config = function()
require("plugins.telescope")
end,
})
use({ "preservim/tagbar", cmd = "TagbarToggle" })
use({
"phaazon/hop.nvim",
event = "UIEnter",
as = "hop",
config = function()
require("hop").setup({ keys = "etovxqpdygfblzhckisuran" })
end,
})
-- use({
-- "c0r73x/neotags.lua",
-- event = "BufEnter",
-- config = function()
-- require("neotags").setup({
-- enable = string.find(vim.fn.getcwd(), "/home/"),
-- ctags = {
-- directory = vim.env.HOME .. '/.cache/nvim/neotags' -- default directory where to store tags
-- },
-- })
-- end
-- })
-- eye-candy
use({
"eandrju/cellular-automaton.nvim",
cmd = "CellularAutomaton",
})
use({
"lewis6991/gitsigns.nvim",
event = "UIEnter",
requires = { "nvim-lua/plenary.nvim" },
config = function()
require("plugins.gitsigns")
end,
})
use({
"nvim-treesitter/nvim-treesitter-context",
after = "nvim-treesitter",
config = function()
require("treesitter-context").setup({
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
patterns = {
-- Match patterns for TS nodes. These get wrapped to match at word boundaries.
-- For all filetypes
-- Note that setting an entry here replaces all other patterns for this entry.
-- By setting the 'default' entry below, you can control which nodes you want to
-- appear in the context window.
default = {
"class",
"function",
"method",
"for", -- These won't appear in the context
"while",
"if",
"switch",
"case",
},
},
})
end,
})
use({
"winston0410/range-highlight.nvim",
event = "CmdlineEnter",
config = function()
require("range-highlight").setup({})
end,
requires = "winston0410/cmd-parser.nvim",
})
use({
"norcalli/nvim-colorizer.lua",
event = "BufEnter",
config = function()
require("plugins.nvim-colorizer")
end,
})
-- integrations
use({ "tpope/vim-fugitive", cmd = "G" })
end)
-- vim:set shiftwidth=4 tabstop=4:

View File

@ -52,7 +52,6 @@ cmp.setup({
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "luasnip" }, -- For luasnip users. { name = "luasnip" }, -- For luasnip users.
{ name = "ctags" },
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "treesitter" }, { name = "treesitter" },
{ name = "async_path" }, { name = "async_path" },
@ -72,7 +71,7 @@ cmp.setup.cmdline({ '/', '?' }, {
-- Set configuration for specific filetype. -- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', { cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. { name = 'git' }, -- You can specify the `cmp_git` source if you were installed it.
}, { }, {
{ name = 'buffer' }, { name = 'buffer' },
}) })
@ -92,3 +91,5 @@ cmp.setup.cmdline(':', {
} }
}) })
}) })
require("cmp_git").setup()