nvim: migrate to lazy package manager

This commit is contained in:
TheK4n 2023-03-12 17:23:43 +03:00
parent 619f686a78
commit 67126480a8
10 changed files with 156 additions and 93 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ home/user/.ipython/profile_default/*
home/user/.gnupg/*
!home/user/.gnupg/gpg.conf
lazy-lock.json

View File

@ -1,9 +0,0 @@
if not (packer_plugins["vim-rainbow"] and packer_plugins["vim-rainbow"].loaded) then
return
end
vim.api.nvim_create_autocmd('BufEnter',
{
pattern = {"*"},
command = 'RainbowToggle'
})

View File

@ -1,7 +1,7 @@
for _, source in ipairs {
"base.options",
"base.keys",
"base.plugins",
"base.mappings",
"base.lazy",
} do
local status_ok, fault = pcall(require, source)
if not status_ok then

View File

@ -1,2 +0,0 @@
require("base.keys.keys")
require("base.keys.run-scripts")

View File

@ -0,0 +1,150 @@
local function install_lazy_if_not_installed(lazypath)
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
end
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
install_lazy_if_not_installed(lazypath)
vim.opt.rtp:prepend(lazypath)
local plugins = {
{
'nvim-lualine/lualine.nvim',
dependencies = { 'kyazdani42/nvim-web-devicons' }
},
{
'ellisonleao/gruvbox.nvim' -- colorscheme
},
{
'kana/vim-textobj-lastpat', -- text-object i/, operate under finding
dependencies = { 'kana/vim-textobj-user' }
},
{
'tpope/vim-surround'
},
{
'tpope/vim-repeat'
},
{
'google/vim-searchindex'
},
{
'tpope/vim-commentary' -- gcc to comment line
},
{
'ap/vim-css-color' -- highlight hex
},
{
'preservim/tagbar',
keys = {
{ '<Leader>t', '<cmd>TagbarToggle<CR>' }
},
enabled = vim.fn.executable "ctags" == 1
},
{
'preservim/vimux',
enabled = vim.fn.executable "tmux" == 1
},
{
'rbgrouleff/bclose.vim'
},
{
'frazrepo/vim-rainbow',
config = function()
vim.api.nvim_create_autocmd('BufEnter',
{
pattern = {"*"},
command = 'RainbowToggle'
})
end
},
{
'Pocco81/auto-save.nvim' -- autosave files
},
{
'windwp/nvim-autopairs' -- auto pair brackets and tags
},
{
'lewis6991/gitsigns.nvim' -- git integration
},
{
'windwp/nvim-ts-autotag'
},
{
'lervag/vimtex'
},
{
'shime/vim-livedown',
enabled = vim.fn.executable "npm" == 1,
build = '/usr/bin/npm install -g livedown'
},
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate'
},
{
'numToStr/Comment.nvim'
},
{
'neovim/nvim-lspconfig'
},
{
'folke/trouble.nvim',
dependencies = { 'kyazdani42/nvim-web-devicons' }
},
{
'neovim/nvim-lspconfig'
},
{
'hrsh7th/nvim-cmp'
},
{
'hrsh7th/cmp-nvim-lsp'
},
{
'saadparwaiz1/cmp_luasnip'
},
{
'L3MON4D3/LuaSnip',
dependencies = 'hrsh7th/nvim-cmp',
},
{
'honza/vim-snippets'
},
{
'williamboman/mason.nvim',
dependencies = "williamboman/mason-lspconfig.nvim"
},
{
'nvim-telescope/telescope.nvim',
enabled = vim.fn.executable "fzf" == 1,
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
enabled = vim.fn.executable "make" == 1,
build = "make"
}
},
keys = {
{ '<Leader>ff', '<cmd>Telescope find_files<CR>' },
{ '<Leader>fg', '<cmd>Telescope live_grep<CR>' },
}
},
}
require("lazy").setup(
plugins,
{
lockfile = vim.fn.stdpath "data" .. "/lazy-lock.json"
}
)

View File

@ -0,0 +1,2 @@
require("base.mappings.mappings")
require("base.mappings.run-scripts")

View File

@ -63,15 +63,6 @@ map("n", '<Leader>eh', '<cmd>set list!<CR>', opts)
vim.opt.listchars=[[tab:→\ ,eol:↵,trail:·,extends:↷,precedes:↶]]
-- Tags panel (ctags required)
map("n", '<Leader>t', '<cmd>TagbarToggle<CR>', opts)
-- Telescope
map("n", '<Leader>ff', '<cmd>Telescope find_files<CR>', opts)
map("n", '<Leader>fg', '<cmd>Telescope live_grep<CR>', opts)
-- Expand %% to dirname of current file in command line
map("c", '%%', [[getcmdtype() == ':' ? expand('%:h').'/' : '%%']], {expr = true})

View File

@ -1,69 +0,0 @@
vim.cmd([[packadd packer.nvim]])
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons' }
}
use {
'kana/vim-textobj-lastpat', -- text-object i/, operate under finding
requires = { 'kana/vim-textobj-user' }
}
use 'ellisonleao/gruvbox.nvim' -- theme
use 'tpope/vim-surround'
use 'tpope/vim-repeat'
use 'google/vim-searchindex'
use 'tpope/vim-commentary' -- gcc to comment line
use 'ap/vim-css-color' -- highlight hex
use 'preservim/tagbar'
use 'preservim/vimux'
use 'rbgrouleff/bclose.vim'
use 'frazrepo/vim-rainbow' -- rainbow brackets
use 'Pocco81/auto-save.nvim' -- autosave files
use 'windwp/nvim-autopairs' -- auto pair brackets and tags
use 'lewis6991/gitsigns.nvim' -- git integration
use 'windwp/nvim-ts-autotag'
use 'lervag/vimtex'
use {
'shime/vim-livedown', -- Markdown previewer :LivedownPreview
run = '/usr/bin/npm install -g livedown'
}
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
use 'numToStr/Comment.nvim'
use { 'folke/trouble.nvim',
requires = { 'kyazdani42/nvim-web-devicons' }
}
use 'neovim/nvim-lspconfig'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
-- snippets
use 'saadparwaiz1/cmp_luasnip'
use {
'L3MON4D3/LuaSnip',
after = 'nvim-cmp',
}
use 'honza/vim-snippets'
-- lsp servers installer
use {
'williamboman/mason.nvim',
requires = {
"williamboman/mason-lspconfig.nvim"
},
}
use {
'nvim-telescope/telescope.nvim',
requires = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
}
}
end)

View File

@ -92,9 +92,8 @@ cmd_nvim() {
_link_files_in_sandbox ".config/nvim" ".local/bin/vim_askpass_helper" ".local/bin/vim_askpass_helper_python"
git clone --depth 1 https://github.com/wbthomason/packer.nvim "$SANDBOX_PATH/.local/share/nvim/site/pack/packer/start/packer.nvim"
__install_from_sandbox
nvim +PackerCompile +PackerSync +PackerSync
nvim +Lazy
}
cmd_ssh() {