Moved to lazy plugin manager
This commit is contained in:
parent
adfbfcd0bc
commit
fcec1cf777
255
lua/plugins.lua
255
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,37 +33,22 @@ 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"] = {
|
init = function()
|
||||||
packadd_hook = function()
|
|
||||||
require('hardline').setup()
|
|
||||||
end
|
|
||||||
},
|
|
||||||
["https://github.com/EdenEast/nightfox.nvim.git"] = {
|
|
||||||
packadd_hook = function()
|
|
||||||
require('nightfox').setup({
|
require('nightfox').setup({
|
||||||
options = {
|
options = {
|
||||||
modules = {
|
modules = { gitgutter = true }
|
||||||
gitgutter = true,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
palettes = {
|
palettes = {
|
||||||
nightfox = {
|
nightfox = {
|
||||||
@ -77,37 +63,47 @@ local function manage_plugins()
|
|||||||
},
|
},
|
||||||
specs = {
|
specs = {
|
||||||
nightfox = {
|
nightfox = {
|
||||||
syntax = {
|
syntax = { func = "red" }
|
||||||
func = "red",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
vim.cmd("colorscheme nightfox")
|
vim.cmd("colorscheme nightfox")
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
-- Auto-completion
|
"ojroques/nvim-hardline",
|
||||||
["https://github.com/hrsh7th/cmp-nvim-lsp.git"] = {},
|
lazy = false,
|
||||||
["https://github.com/hrsh7th/cmp-buffer.git"] = {},
|
init = function()
|
||||||
["https://github.com/hrsh7th/cmp-path.git"] = {},
|
require('hardline').setup()
|
||||||
["https://github.com/hrsh7th/cmp-cmdline.git"] = {},
|
end,
|
||||||
["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()
|
{
|
||||||
|
"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"
|
vim.o.completeopt = "menu,menuone,noselect"
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
|
||||||
@ -184,15 +180,13 @@ local function manage_plugins()
|
|||||||
{ name = 'cmdline' }
|
{ name = 'cmdline' }
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
-- LSP configuration
|
"neovim/nvim-lspconfig",
|
||||||
["https://github.com/neovim/nvim-lspconfig.git"] = {
|
lazy = false,
|
||||||
packadd_after = {
|
dependencies = "hrsh7th/nvim-cmp",
|
||||||
["https://github.com/hrsh7th/nvim-cmp.git"] = true,
|
init = function()
|
||||||
},
|
|
||||||
packadd_hook = function()
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
local lsp_config = require("lspconfig")
|
local lsp_config = require("lspconfig")
|
||||||
local servers = { "clangd", "rust_analyzer", "pylsp" }
|
local servers = { "clangd", "rust_analyzer", "pylsp" }
|
||||||
@ -205,16 +199,16 @@ local function manage_plugins()
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
-- LSP alternative
|
"nvim-telescope/telescope.nvim",
|
||||||
["https://github.com/nvim-lua/plenary.nvim.git"] = {},
|
tag = "0.1.2",
|
||||||
["https://github.com/ludovicchabant/vim-gutentags.git"] = {},
|
lazy = false,
|
||||||
["https://github.com/nvim-telescope/telescope.nvim.git"] = {
|
dependencies = {
|
||||||
packadd_after = {
|
{ "nvim-lua/plenary.nvim" },
|
||||||
["https://github.com/nvim-lua/plenary.nvim.git"] = true,
|
{ "ludovicchabant/vim-gutentags" },
|
||||||
["https://github.com/ludovicchabant/vim-gutentags.git"] = true,
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||||
},
|
},
|
||||||
packadd_hook = function()
|
init = function()
|
||||||
require("telescope").setup{
|
require("telescope").setup{
|
||||||
defaults = {
|
defaults = {
|
||||||
-- Default configuration for telescope goes here:
|
-- Default configuration for telescope goes here:
|
||||||
@ -238,46 +232,62 @@ local function manage_plugins()
|
|||||||
-- builtin picker
|
-- builtin picker
|
||||||
},
|
},
|
||||||
extensions = {
|
extensions = {
|
||||||
-- Your extension configuration goes here:
|
fzf = {
|
||||||
-- extension_name = {
|
fuzzy = true, -- false will only do exact matching
|
||||||
-- extension_config_key = value,
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
-- }
|
override_file_sorter = true, -- override the file sorter
|
||||||
-- please take a look at the readme of the extension you want to configure
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
}
|
-- the default case_mode is "smart_case"
|
||||||
}
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap('n', 'tf', ":Telescope find_files<cr>", {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'tg', ":Telescope live_grep<cr>", {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'ts', ":Telescope grep_string<cr>", {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'tt', ":Telescope current_buffer_tags<cr>", {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'tc', ":Telescope git_commits<cr>", {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'ta', ":Telescope git_status<cr>", {})
|
|
||||||
vim.api.nvim_set_keymap('n', 'td', ":Telescope lsp_definitions<cr>", {})
|
|
||||||
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
|
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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',
|
||||||
|
":Telescope grep_string<cr>", {})
|
||||||
|
vim.api.nvim_set_keymap('n', 'tt',
|
||||||
|
":Telescope current_buffer_tags<cr>", {})
|
||||||
|
vim.api.nvim_set_keymap('n', 'tc',
|
||||||
|
":Telescope git_commits<cr>", {})
|
||||||
|
vim.api.nvim_set_keymap('n', 'ta',
|
||||||
|
":Telescope git_status<cr>", {})
|
||||||
|
vim.api.nvim_set_keymap('n', 'td',
|
||||||
|
":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
|
-- put sign in number column to avoid screen-shifting
|
||||||
vim.cmd('set signcolumn=number')
|
vim.cmd('set signcolumn=number')
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
["https://github.com/sindrets/diffview.nvim.git"] = {
|
{
|
||||||
packadd_after = { ["https://github.com/nvim-lua/plenary.nvim.git"] = true },
|
"sindrets/diffview.nvim",
|
||||||
packadd_hook = function()
|
lazy = false,
|
||||||
|
dependencies = {
|
||||||
|
{ "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
vim.api.nvim_set_keymap('n', '<leader>g', ":DiffviewOpen", {})
|
vim.api.nvim_set_keymap('n', '<leader>g', ":DiffviewOpen", {})
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
-- Syntax highlight
|
"nvim-treesitter/nvim-treesitter",
|
||||||
["https://github.com/nvim-treesitter/nvim-treesitter.git"] = {
|
lazy = false,
|
||||||
packadd_hook = function()
|
init = function()
|
||||||
local conf = require("nvim-treesitter.configs")
|
local conf = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
conf.setup {
|
conf.setup {
|
||||||
@ -305,40 +315,25 @@ local function manage_plugins()
|
|||||||
end,
|
end,
|
||||||
-- run `:h syntax` and tree-sitter at the same time.
|
-- run `:h syntax` and tree-sitter at the same time.
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
-- to activate it, use ':set filetype=arm " arm = armv7'
|
{ "ARM9/arm-syntax-vim", lazy = false },
|
||||||
["https://github.com/ARM9/arm-syntax-vim.git"] = {},
|
}
|
||||||
}
|
|
||||||
|
|
||||||
local manager = require("plogins").manage(plugins)
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.api.nvim_create_user_command("PloginsUpgrade",
|
vim.fn.system({
|
||||||
manager.upgrade, {})
|
"git",
|
||||||
vim.api.nvim_create_user_command("PloginsAutoremove",
|
"clone",
|
||||||
manager.autoremove, {})
|
"--filter=blob:none",
|
||||||
end
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable", -- latest stable release
|
||||||
local plogins_source = "https://github.com/faerryn/plogins.nvim.git"
|
lazypath,
|
||||||
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