Moved to lazy plugin manager
This commit is contained in:
parent
adfbfcd0bc
commit
fcec1cf777
589
lua/plugins.lua
589
lua/plugins.lua
@ -6,7 +6,8 @@ local has_words_before = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local feedkey = function(key, mode)
|
local feedkey = function(key, mode)
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true),
|
||||||
|
mode, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- LSP keybindings
|
-- LSP keybindings
|
||||||
@ -32,313 +33,307 @@ local lsp_on_attach = function(_, bufnr)
|
|||||||
|
|
||||||
-- Create a command `:Format` local to the LSP buffer
|
-- Create a command `:Format` local to the LSP buffer
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format',
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format',
|
||||||
vim.lsp.buf.format or vim.lsp.buf.formatting, { desc = 'Format current buffer with LSP' })
|
vim.lsp.buf.format or vim.lsp.buf.formatting,
|
||||||
|
{ desc = 'Format current buffer with LSP' })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- plugins definition
|
plugins = {
|
||||||
local function manage_plugins()
|
{ "tpope/vim-sensible", lazy = false },
|
||||||
|
{
|
||||||
local plugins = {
|
"EdenEast/nightfox.nvim",
|
||||||
["https://github.com/faerryn/plogins.nvim.git"] = {},
|
lazy = false,
|
||||||
["https://github.com/tpope/vim-sensible.git"] = {},
|
dependencies = {
|
||||||
["https://github.com/kevinhwang91/rnvimr.git"] = {
|
{ "airblade/vim-gitgutter" },
|
||||||
packadd_hook = function()
|
|
||||||
vim.api.nvim_set_keymap('n', '<leader>f', ":RnvimrToggle<cr>", {})
|
|
||||||
vim.g.rnvimr_action = {
|
|
||||||
['<C-t>'] = "NvimEdit tabedit",
|
|
||||||
['<C-x>'] = "NvimEdit split",
|
|
||||||
['<C-v>'] = "NvimEdit vsplit",
|
|
||||||
}
|
|
||||||
end
|
|
||||||
},
|
|
||||||
["https://github.com/ojroques/nvim-hardline.git"] = {
|
|
||||||
packadd_hook = function()
|
|
||||||
require('hardline').setup()
|
|
||||||
end
|
|
||||||
},
|
|
||||||
["https://github.com/EdenEast/nightfox.nvim.git"] = {
|
|
||||||
packadd_hook = function()
|
|
||||||
require('nightfox').setup({
|
|
||||||
options = {
|
|
||||||
modules = {
|
|
||||||
gitgutter = true,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
palettes = {
|
|
||||||
nightfox = {
|
|
||||||
bg0 = '#121212',
|
|
||||||
bg1 = '#161616',
|
|
||||||
bg2 = '#222222',
|
|
||||||
bg3 = '#282828',
|
|
||||||
bg4 = '#404040',
|
|
||||||
sel0 = "#2a2a2a",
|
|
||||||
sel1 = "#525253",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
specs = {
|
|
||||||
nightfox = {
|
|
||||||
syntax = {
|
|
||||||
func = "red",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
vim.cmd("colorscheme nightfox")
|
|
||||||
end
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Auto-completion
|
|
||||||
["https://github.com/hrsh7th/cmp-nvim-lsp.git"] = {},
|
|
||||||
["https://github.com/hrsh7th/cmp-buffer.git"] = {},
|
|
||||||
["https://github.com/hrsh7th/cmp-path.git"] = {},
|
|
||||||
["https://github.com/hrsh7th/cmp-cmdline.git"] = {},
|
|
||||||
["https://github.com/hrsh7th/cmp-nvim-lsp-signature-help.git"] = {},
|
|
||||||
["https://github.com/hrsh7th/cmp-vsnip.git"] = {},
|
|
||||||
["https://github.com/hrsh7th/vim-vsnip.git"] = {},
|
|
||||||
["https://github.com/hrsh7th/nvim-cmp.git"] = {
|
|
||||||
packadd_after = {
|
|
||||||
["https://github.com/hrsh7th/cmp-nvim-lsp.git"] = true,
|
|
||||||
["https://github.com/hrsh7th/cmp-buffer.git"] = true,
|
|
||||||
["https://github.com/hrsh7th/cmp-path.git"] = true,
|
|
||||||
["https://github.com/hrsh7th/cmp-cmdline.git"] = true,
|
|
||||||
["https://github.com/hrsh7th/cmp-nvim-lsp-signature-help.git"] = true,
|
|
||||||
["https://github.com/hrsh7th/cmp-vsnip.git"] = true,
|
|
||||||
["https://github.com/hrsh7th/vim-vsnip.git"] = true,
|
|
||||||
},
|
|
||||||
packadd_hook = function()
|
|
||||||
vim.o.completeopt = "menu,menuone,noselect"
|
|
||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
-- snippet engine is required
|
|
||||||
expand = function(args)
|
|
||||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
-- completion = cmp.config.window.bordered(),
|
|
||||||
-- documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
--['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
--['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
--['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
|
||||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
-- The fallback function sends a already mapped key.
|
|
||||||
-- In this case, it's probably `<Tab>`.
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
["<S-Tab>"] = cmp.mapping(function()
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
|
||||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'nvim_lsp_signature_help' },
|
|
||||||
{ name = 'vsnip' },
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
-- Set configuration for specific filetype.
|
|
||||||
cmp.setup.filetype('gitcommit', {
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'cmp_git' },
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use buffer source for `/` and `?`
|
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':'
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
|
|
||||||
-- LSP configuration
|
|
||||||
["https://github.com/neovim/nvim-lspconfig.git"] = {
|
|
||||||
packadd_after = {
|
|
||||||
["https://github.com/hrsh7th/nvim-cmp.git"] = true,
|
|
||||||
},
|
|
||||||
packadd_hook = function()
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
||||||
local lsp_config = require("lspconfig")
|
|
||||||
local servers = { "clangd", "rust_analyzer", "pylsp" }
|
|
||||||
|
|
||||||
for _, lsp in ipairs(servers) do
|
|
||||||
lsp_config[lsp].setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = lsp_on_attach,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
init = function()
|
||||||
-- LSP alternative
|
require('nightfox').setup({
|
||||||
["https://github.com/nvim-lua/plenary.nvim.git"] = {},
|
options = {
|
||||||
["https://github.com/ludovicchabant/vim-gutentags.git"] = {},
|
modules = { gitgutter = true }
|
||||||
["https://github.com/nvim-telescope/telescope.nvim.git"] = {
|
},
|
||||||
packadd_after = {
|
palettes = {
|
||||||
["https://github.com/nvim-lua/plenary.nvim.git"] = true,
|
nightfox = {
|
||||||
["https://github.com/ludovicchabant/vim-gutentags.git"] = true,
|
bg0 = '#121212',
|
||||||
},
|
bg1 = '#161616',
|
||||||
packadd_hook = function()
|
bg2 = '#222222',
|
||||||
require("telescope").setup{
|
bg3 = '#282828',
|
||||||
defaults = {
|
bg4 = '#404040',
|
||||||
-- Default configuration for telescope goes here:
|
sel0 = "#2a2a2a",
|
||||||
-- config_key = value,
|
sel1 = "#525253",
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
-- map actions.which_key to <C-h> (default: <C-/>)
|
|
||||||
-- actions.which_key shows the mappings for your picker,
|
|
||||||
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
|
||||||
["<C-h>"] = "which_key"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
pickers = {
|
|
||||||
-- Default configuration for builtin pickers goes here:
|
|
||||||
-- picker_name = {
|
|
||||||
-- picker_config_key = value,
|
|
||||||
-- ...
|
|
||||||
-- }
|
|
||||||
-- Now the picker_config_key will be applied every time you call this
|
|
||||||
-- builtin picker
|
|
||||||
},
|
|
||||||
extensions = {
|
|
||||||
-- Your extension configuration goes here:
|
|
||||||
-- extension_name = {
|
|
||||||
-- extension_config_key = value,
|
|
||||||
-- }
|
|
||||||
-- please take a look at the readme of the extension you want to configure
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
specs = {
|
||||||
|
nightfox = {
|
||||||
|
syntax = { func = "red" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
vim.cmd("colorscheme nightfox")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ojroques/nvim-hardline",
|
||||||
|
lazy = false,
|
||||||
|
init = function()
|
||||||
|
require('hardline').setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kevinhwang91/rnvimr",
|
||||||
|
lazy = false,
|
||||||
|
init = function()
|
||||||
|
vim.api.nvim_set_keymap('n', '<leader>f', ":RnvimrToggle<cr>", {})
|
||||||
|
vim.g.rnvimr_action = {
|
||||||
|
['<C-t>'] = "NvimEdit tabedit",
|
||||||
|
['<C-x>'] = "NvimEdit split",
|
||||||
|
['<C-v>'] = "NvimEdit vsplit",
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
lazy = false,
|
||||||
|
dependencies = {
|
||||||
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
|
{ "hrsh7th/cmp-buffer" },
|
||||||
|
{ "hrsh7th/cmp-path" },
|
||||||
|
{ "hrsh7th/cmp-cmdline" },
|
||||||
|
{ "hrsh7th/cmp-nvim-lsp-signature-help" },
|
||||||
|
{ "hrsh7th/cmp-vsnip" },
|
||||||
|
{ "hrsh7th/vim-vsnip" },
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
vim.o.completeopt = "menu,menuone,noselect"
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- snippet engine is required
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
--['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
--['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
--['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||||
|
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
-- The fallback function sends a already mapped key.
|
||||||
|
-- In this case, it's probably `<Tab>`.
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function()
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||||
|
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'nvim_lsp_signature_help' },
|
||||||
|
{ name = 'vsnip' },
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
-- Set configuration for specific filetype.
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'cmp_git' },
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?`
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
vim.api.nvim_set_keymap('n', 'tf', ":Telescope find_files<cr>", {})
|
-- Use cmdline & path source for ':'
|
||||||
vim.api.nvim_set_keymap('n', 'tg', ":Telescope live_grep<cr>", {})
|
cmp.setup.cmdline(':', {
|
||||||
vim.api.nvim_set_keymap('n', 'ts', ":Telescope grep_string<cr>", {})
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
vim.api.nvim_set_keymap('n', 'tt', ":Telescope current_buffer_tags<cr>", {})
|
sources = cmp.config.sources({
|
||||||
vim.api.nvim_set_keymap('n', 'tc', ":Telescope git_commits<cr>", {})
|
{ name = 'path' }
|
||||||
vim.api.nvim_set_keymap('n', 'ta', ":Telescope git_status<cr>", {})
|
}, {
|
||||||
vim.api.nvim_set_keymap('n', 'td', ":Telescope lsp_definitions<cr>", {})
|
{ name = 'cmdline' }
|
||||||
vim.api.nvim_set_keymap('n', 'tr', ":Telescope lsp_references<cr>", {})
|
})
|
||||||
vim.api.nvim_set_keymap('n', 'tc', ":Telescope lsp_outgoing_calls<cr>", {})
|
})
|
||||||
vim.api.nvim_set_keymap('n', 'te', ":Telescope diagnostics<cr>", {})
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
lazy = false,
|
||||||
|
dependencies = "hrsh7th/nvim-cmp",
|
||||||
|
init = function()
|
||||||
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
local lsp_config = require("lspconfig")
|
||||||
|
local servers = { "clangd", "rust_analyzer", "pylsp" }
|
||||||
|
|
||||||
|
for _, lsp in ipairs(servers) do
|
||||||
|
lsp_config[lsp].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = lsp_on_attach,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
tag = "0.1.2",
|
||||||
|
lazy = false,
|
||||||
|
dependencies = {
|
||||||
|
{ "nvim-lua/plenary.nvim" },
|
||||||
|
{ "ludovicchabant/vim-gutentags" },
|
||||||
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||||
},
|
},
|
||||||
|
init = function()
|
||||||
|
require("telescope").setup{
|
||||||
|
defaults = {
|
||||||
|
-- Default configuration for telescope goes here:
|
||||||
|
-- config_key = value,
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
-- map actions.which_key to <C-h> (default: <C-/>)
|
||||||
|
-- actions.which_key shows the mappings for your picker,
|
||||||
|
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
||||||
|
["<C-h>"] = "which_key"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
-- Default configuration for builtin pickers goes here:
|
||||||
|
-- picker_name = {
|
||||||
|
-- picker_config_key = value,
|
||||||
|
-- ...
|
||||||
|
-- }
|
||||||
|
-- Now the picker_config_key will be applied every time you call this
|
||||||
|
-- builtin picker
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true, -- false will only do exact matching
|
||||||
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
|
override_file_sorter = true, -- override the file sorter
|
||||||
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
|
-- the default case_mode is "smart_case"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
require("telescope").load_extension("fzf")
|
||||||
|
|
||||||
-- Git integration
|
vim.api.nvim_set_keymap('n', 'tf',
|
||||||
["https://github.com/tpope/vim-fugitive.git"] = {},
|
":Telescope find_files<cr>", {})
|
||||||
["https://github.com/airblade/vim-gitgutter.git"] = {
|
vim.api.nvim_set_keymap('n', 'tg',
|
||||||
packadd_after = { ["https://github.com/EdenEast/nightfox.nvim.git"] = true },
|
":Telescope live_grep<cr>", {})
|
||||||
packadd_hook = function()
|
vim.api.nvim_set_keymap('n', 'ts',
|
||||||
-- put sign in number column to avoid screen-shifting
|
":Telescope grep_string<cr>", {})
|
||||||
vim.cmd('set signcolumn=number')
|
vim.api.nvim_set_keymap('n', 'tt',
|
||||||
end
|
":Telescope current_buffer_tags<cr>", {})
|
||||||
},
|
vim.api.nvim_set_keymap('n', 'tc',
|
||||||
["https://github.com/sindrets/diffview.nvim.git"] = {
|
":Telescope git_commits<cr>", {})
|
||||||
packadd_after = { ["https://github.com/nvim-lua/plenary.nvim.git"] = true },
|
vim.api.nvim_set_keymap('n', 'ta',
|
||||||
packadd_hook = function()
|
":Telescope git_status<cr>", {})
|
||||||
vim.api.nvim_set_keymap('n', '<leader>g', ":DiffviewOpen", {})
|
vim.api.nvim_set_keymap('n', 'td',
|
||||||
end
|
":Telescope lsp_definitions<cr>", {})
|
||||||
},
|
vim.api.nvim_set_keymap('n', 'tr',
|
||||||
|
":Telescope lsp_references<cr>", {})
|
||||||
|
vim.api.nvim_set_keymap('n', 'te',
|
||||||
|
":Telescope diagnostics<cr>", {})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"airblade/vim-gitgutter",
|
||||||
|
lazy = false,
|
||||||
|
dependencies = {
|
||||||
|
{ "tpope/vim-fugitive" },
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
-- put sign in number column to avoid screen-shifting
|
||||||
|
vim.cmd('set signcolumn=number')
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sindrets/diffview.nvim",
|
||||||
|
lazy = false,
|
||||||
|
dependencies = {
|
||||||
|
{ "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
vim.api.nvim_set_keymap('n', '<leader>g', ":DiffviewOpen", {})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
lazy = false,
|
||||||
|
init = function()
|
||||||
|
local conf = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
-- Syntax highlight
|
conf.setup {
|
||||||
["https://github.com/nvim-treesitter/nvim-treesitter.git"] = {
|
-- only enable tested parsers
|
||||||
packadd_hook = function()
|
ensure_installed = { "c", "cpp", "lua", "rust" },
|
||||||
local conf = require("nvim-treesitter.configs")
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
auto_install = false,
|
||||||
|
-- List of parsers to ignore installing (for "all")
|
||||||
|
ignore_install = {},
|
||||||
|
highlight = {
|
||||||
|
-- `false` will disable the whole extension
|
||||||
|
enable = true,
|
||||||
|
-- list of language that will be disabled
|
||||||
|
disable = {},
|
||||||
|
-- disable slow treesitter highlight for large files
|
||||||
|
disable = function(lang, buf)
|
||||||
|
local max_filesize = 200 * 1024 -- 200 KB
|
||||||
|
local ok, stats =
|
||||||
|
pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
if ok and stats and stats.size > max_filesize then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
-- run `:h syntax` and tree-sitter at the same time.
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ "ARM9/arm-syntax-vim", lazy = false },
|
||||||
|
}
|
||||||
|
|
||||||
conf.setup {
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
-- only enable tested parsers
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
ensure_installed = { "c", "cpp", "lua", "rust" },
|
vim.fn.system({
|
||||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
"git",
|
||||||
sync_install = false,
|
"clone",
|
||||||
-- Automatically install missing parsers when entering buffer
|
"--filter=blob:none",
|
||||||
auto_install = false,
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
-- List of parsers to ignore installing (for "all")
|
"--branch=stable", -- latest stable release
|
||||||
ignore_install = {},
|
lazypath,
|
||||||
highlight = {
|
})
|
||||||
-- `false` will disable the whole extension
|
|
||||||
enable = true,
|
|
||||||
-- list of language that will be disabled
|
|
||||||
disable = {},
|
|
||||||
-- disable slow treesitter highlight for large files
|
|
||||||
disable = function(lang, buf)
|
|
||||||
local max_filesize = 200 * 1024 -- 200 KB
|
|
||||||
local ok, stats =
|
|
||||||
pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
|
||||||
if ok and stats and stats.size > max_filesize then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
-- run `:h syntax` and tree-sitter at the same time.
|
|
||||||
additional_vim_regex_highlighting = false,
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
},
|
|
||||||
-- to activate it, use ':set filetype=arm " arm = armv7'
|
|
||||||
["https://github.com/ARM9/arm-syntax-vim.git"] = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
local manager = require("plogins").manage(plugins)
|
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("PloginsUpgrade",
|
|
||||||
manager.upgrade, {})
|
|
||||||
vim.api.nvim_create_user_command("PloginsAutoremove",
|
|
||||||
manager.autoremove, {})
|
|
||||||
end
|
|
||||||
|
|
||||||
local plogins_source = "https://github.com/faerryn/plogins.nvim.git"
|
|
||||||
local plogins_name = plogins_source:gsub("/", "%%")
|
|
||||||
local plogins_dir = ("%s/site/pack/plogins/opt/%s"):format((vim.fn.stdpath("data")),
|
|
||||||
plogins_name)
|
|
||||||
|
|
||||||
if not vim.loop.fs_stat(plogins_dir) then
|
|
||||||
vim.loop.spawn("git",
|
|
||||||
{ args = { "clone", "--depth", "1", plogins_source, plogins_dir } },
|
|
||||||
function(code, signal)
|
|
||||||
vim.defer_fn(function()
|
|
||||||
vim.cmd(("packadd %s"):format(vim.fn.fnameescape(plogins_name)))
|
|
||||||
manage_plugins()
|
|
||||||
end, 0)
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
vim.cmd(("packadd %s"):format(vim.fn.fnameescape(plogins_name)))
|
|
||||||
manage_plugins()
|
|
||||||
end
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup(plugins, opts)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user