initially migrated from packer to Lazy, still long road ahead

This commit is contained in:
Maciej Lebiest 2023-02-07 19:49:35 +01:00
parent b345abb769
commit 604b8a0bec
8 changed files with 233 additions and 102 deletions

2
.gitignore vendored
View file

@ -1 +1 @@
plugin/ lazy-lock.json

View file

@ -15,6 +15,7 @@ Installing system stuff (Fedora example):
```bash ```bash
sudo dnf install \ sudo dnf install \
git \
python3-pip \ python3-pip \
neovim \ neovim \
ripgrep \ ripgrep \
@ -29,8 +30,7 @@ sudo dnf install \
pip install pynvim pip install pynvim
git clone --depth 1 https://github.com/wbthomason/packer.nvim\ git clone https://github.com/Szwendacz99/nvim ~/.config/nvim
~/.local/share/nvim/site/pack/packer/start/packer.nvim
``` ```
##### #####
@ -39,14 +39,12 @@ git clone --depth 1 https://github.com/wbthomason/packer.nvim\
##### Inside vim ##### Inside vim
``` ```
:PackerInstall # manage plugins:
:PackerSync :Lazy
# installing packages, which mason-lspconfig cannot autoinstall (?) # installing packages, which mason-lspconfig cannot autoinstall (?)
:MasonInstall phpcs :MasonInstall phpcs
# tree-sitter setup
:TSInstall html dockerfile cpp css markdown c gitcommit bash phpdoc comment python http php regex json5 lua gitattributes gitignore json git_rebase javascript perl sql yaml
``` ```
On Fedora there is need to make sure your system can display any unicode character. Hacked fonts are needed for filetype icons but there is also need for a dedicated package with unicode fonts (like unifont-fonts.noarch) that will have every character missing from default font used in Neovim editor. Link to hacked fonts: On Fedora there is need to make sure your system can display any unicode character. Hacked fonts are needed for filetype icons but there is also need for a dedicated package with unicode fonts (like unifont-fonts.noarch) that will have every character missing from default font used in Neovim editor. Link to hacked fonts:

View file

@ -1,15 +1,10 @@
" set termguicolors before lua config,
" as it can contain some theme stuff that
" checks for termguicolors
set termguicolors
highlight clear
" load main lua file with additional configs " load main lua file with additional configs
lua require("initializer") lua require("initializer")
" highlight all .conf files as apache config (:]) " highlight all .conf files as apache config (:])
autocmd BufEnter *.conf :setlocal filetype=apache autocmd BufEnter *.conf :setlocal filetype=apache
"au BufNewFile,BufRead *.sls set filetype=sls.yaml "au BufNewFile,BufRead *.sls set filetype=sls.yaml
let mapleader = "\\"
"nerdtree bindings "nerdtree bindings
nnoremap <leader>n :NvimTreeFocus<CR> nnoremap <leader>n :NvimTreeFocus<CR>
nnoremap <C-t> :NvimTreeToggle<CR> nnoremap <C-t> :NvimTreeToggle<CR>
@ -18,8 +13,8 @@ nnoremap <C-t> :NvimTreeToggle<CR>
nmap <c-/> <plug>NERDCommenterToggle nmap <c-/> <plug>NERDCommenterToggle
vmap <c-/> <plug>NERDCommenterToggle vmap <c-/> <plug>NERDCommenterToggle
"theme configuration set termguicolors
syntax enable highlight clear
colorscheme dracula colorscheme dracula
set splitright set splitright

View file

@ -1,19 +0,0 @@
--Gruvbox theme settings
-- setup must be called before loading the colorscheme
require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
italic = false, -- default=true
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {},
dim_inactive = true, -- default=false
transparent_mode = false,
})

View file

@ -12,7 +12,3 @@ codewindow.setup({
z_index = 1, -- The z-index the floating window will be on z_index = 1, -- The z-index the floating window will be on
}) })
codewindow.apply_default_keybinds() codewindow.apply_default_keybinds()

View file

@ -1,5 +1,17 @@
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)
-- load all modules -- load all modules
require("packer-setup") require("lazy-setup")
require("general") require("general")
require("my-lint") require("my-lint")
require("conf-hlslens") require("conf-hlslens")
@ -9,7 +21,6 @@ require("conf-mason")
require("conf-nvim-cmp") require("conf-nvim-cmp")
require("conf-nvim-tree") require("conf-nvim-tree")
require("conf-bufferline") require("conf-bufferline")
require("conf-themes")
require("conf-treesitter") require("conf-treesitter")
require("conf-indent-blankline") require("conf-indent-blankline")
require("my-lspconfig") -- need to be after treesitter initialization require("my-lspconfig") -- need to be after treesitter initialization

212
lua/lazy-setup.lua Normal file
View file

@ -0,0 +1,212 @@
vim.g.mapleader = " " -- make sure to set `mapleader` before lazy so your mappings are correct
require("lazy").setup({
-- NERDTree stuff
{ 'nvim-tree/nvim-web-devicons' }, -- optional, for file icons
{ 'nvim-tree/nvim-tree.lua' },
-- neovim lsp plugins and depencencies
{ 'neovim/nvim-lspconfig' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/cmp-buffer' },
{ 'hrsh7th/cmp-cmdline' },
{ 'hrsh7th/cmp-path' },
{ 'hrsh7th/nvim-cmp' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{ 'mfussenegger/nvim-lint' },
{ 'onsails/lspkind.nvim' },
-- various plugins
{ 'lewis6991/gitsigns.nvim' },
{ 'petertriho/nvim-scrollbar' },
{ 'kevinhwang91/nvim-hlslens' },
{ 'L3MON4D3/LuaSnip', version = '*' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'lambdalisue/suda.vim' },
{ 'akinsho/bufferline.nvim', version = '*' },
{ 'gorbit99/codewindow.nvim' },
{ 'preservim/nerdcommenter' },
{ 'rmagatti/auto-session' },
{ 'tpope/vim-fugitive' },
{ 'Glench/Vim-Jinja2-Syntax' },
{ 'vmware-archive/salt-vim' },
{ 'stephpy/vim-yaml' },
{ 'lukas-reineke/indent-blankline.nvim' },
{ 'nvim-lualine/lualine.nvim' },
{ 'itchyny/vim-cursorword' },
{ 'sheerun/vim-polyglot' },
{ 'ray-x/lsp_signature.nvim' },
-- themes
{ 'olimorris/onedarkpro.nvim' },
{ 'ellisonleao/gruvbox.nvim' },
{ 'Mofiqul/dracula.nvim' },
{ 'vigoux/oak' },
{ 'NLKNguyen/papercolor-theme' },
{ 'bluz71/vim-moonfly-colors' },
{ 'luisiacc/gruvbox-baby' },
{ 'catppuccin/nvim' },
{ 'EdenEast/nightfox.nvim' },
{ 'projekt0n/github-nvim-theme' },
--Fuzzy search by Telescope and its dependencies:
{ 'nvim-lua/plenary.nvim' },
{
'nvim-telescope/telescope.nvim', branch = 'master',
dependencies = { 'nvim-lua/plenary.nvim' }
},
{ 'BurntSushi/ripgrep' },
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
},
{
root = vim.fn.stdpath("data") .. "/lazy", -- directory where plugins will be installed
defaults = {
lazy = false, -- should plugins be lazy-loaded?
version = nil,
-- version = "*", -- enable this to try installing the latest stable versions of plugins
},
-- leave nil when passing the spec as the first argument to setup()
spec = nil, ---@type LazySpec
lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update.
concurrency = 4, ---@type number limit the maximum amount of concurrent tasks
git = {
-- defaults for the `Lazy log` command
-- log = { "-10" }, -- show the last 10 commits
log = { "--since=3 days ago" }, -- show commits from the last 3 days
timeout = 120, -- kill processes that take more than 2 minutes
url_format = "https://github.com/%s.git",
-- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version,
-- then set the below to false. This is should work, but is NOT supported and will
-- increase downloads a lot.
filter = true,
},
dev = {
-- directory where you store your local plugin projects
path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"}
fallback = false, -- Fallback to git when local plugin doesn't exist
},
install = {
-- install missing plugins on startup. This doesn't increase startup time.
missing = true,
-- try to load one of these colorschemes when starting an installation during startup
colorscheme = { },
},
ui = {
-- a number <1 is a percentage., >1 is a fixed size
size = { width = 0.8, height = 0.8 },
wrap = true, -- wrap the lines in the ui
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
border = "none",
icons = {
cmd = "",
config = "",
event = "",
ft = "",
init = "",
import = "",
keys = "",
lazy = "",
loaded = "",
not_loaded = "",
plugin = "",
runtime = "",
source = "",
start = "",
task = "",
list = {
"",
"",
"",
"",
},
},
-- leave nil, to automatically select a browser depending on your OS.
-- If you want to use a specific browser, you can define it here
browser = nil, ---@type string?
throttle = 20, -- how frequently should the ui process render events
custom_keys = {
-- you can define custom key maps here.
-- To disable one of the defaults, set it to false
-- open lazygit log
["<localleader>l"] = function(plugin)
require("lazy.util").float_term({ "lazygit", "log" }, {
cwd = plugin.dir,
})
end,
-- open a terminal for the plugin dir
["<localleader>t"] = function(plugin)
require("lazy.util").float_term(nil, {
cwd = plugin.dir,
})
end,
},
},
diff = {
-- diff command <d> can be one of:
-- * browser: opens the github compare view. Note that this is always mapped to <K> as well,
-- so you can have a different command for diff <d>
-- * git: will run git diff and open a buffer with filetype git
-- * terminal_git: will open a pseudo terminal with git diff
-- * diffview.nvim: will open Diffview to show the diff
cmd = "git",
},
checker = {
-- automatically check for plugin updates
enabled = false,
concurrency = nil, ---@type number? set to 1 to check for updates very slowly
notify = true, -- get a notification when new updates are found
frequency = 3600, -- check for updates every hour
},
change_detection = {
-- automatically check for config file changes and reload the ui
enabled = true,
notify = true, -- get a notification when changes are found
},
performance = {
cache = {
enabled = false,
path = vim.fn.stdpath("cache") .. "/lazy/cache",
-- Once one of the following events triggers, caching will be disabled.
-- To cache all modules, set this to `{}`, but that is not recommended.
-- The default is to disable on:
-- * VimEnter: not useful to cache anything else beyond startup
-- * BufReadPre: this will be triggered early when opening a file from the command line directly
disable_events = { "UIEnter", "BufReadPre" },
ttl = 3600 * 24 * 5, -- keep unused modules for up to 5 days
},
reset_packpath = true, -- reset the package path to improve startup time
rtp = {
reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
---@type string[]
paths = {}, -- add any custom paths here that you want to includes in the rtp
---@type string[] list any plugins you want to disable here
disabled_plugins = {
-- "gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
-- "tarPlugin",
-- "tohtml",
-- "tutor",
-- "zipPlugin",
},
},
},
-- lazy can generate helptags from the headings in markdown readme files,
-- so :help works even for plugins that don't have vim docs.
-- when the readme opens with :help it will be correctly displayed as markdown
readme = {
root = vim.fn.stdpath("state") .. "/lazy/readme",
files = { "README.md", "lua/**/README.md" },
-- only generate markdown helptags for plugins that dont have docs
skip_if_doc_exists = true,
},
state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things
})

View file

@ -1,62 +0,0 @@
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- NERDTree stuff
use 'nvim-tree/nvim-web-devicons' -- optional, for file icons
use 'nvim-tree/nvim-tree.lua'
-- neovim lsp plugins and depencencies
use 'neovim/nvim-lspconfig'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-cmdline'
use 'hrsh7th/cmp-path'
use 'hrsh7th/nvim-cmp'
use 'williamboman/mason.nvim'
use 'williamboman/mason-lspconfig.nvim'
use 'mfussenegger/nvim-lint'
use 'onsails/lspkind.nvim'
-- various plugins
use 'lewis6991/gitsigns.nvim'
use 'petertriho/nvim-scrollbar'
use 'kevinhwang91/nvim-hlslens'
use 'windwp/nvim-ts-autotag'
use { 'L3MON4D3/LuaSnip', tag = '*' }
use 'saadparwaiz1/cmp_luasnip'
use 'lambdalisue/suda.vim'
use { 'akinsho/bufferline.nvim', tag = '*' }
use 'gorbit99/codewindow.nvim'
use 'preservim/nerdcommenter'
use 'rmagatti/auto-session'
use 'tpope/vim-fugitive'
use 'Glench/Vim-Jinja2-Syntax'
use 'vmware-archive/salt-vim'
use 'stephpy/vim-yaml'
use 'lukas-reineke/indent-blankline.nvim'
use 'nvim-lualine/lualine.nvim'
use 'itchyny/vim-cursorword'
use 'sheerun/vim-polyglot'
use 'ray-x/lsp_signature.nvim'
-- themes
use 'olimorris/onedarkpro.nvim'
use 'ellisonleao/gruvbox.nvim'
use 'Mofiqul/dracula.nvim'
use 'vigoux/oak'
use 'NLKNguyen/papercolor-theme'
use 'bluz71/vim-moonfly-colors'
use 'luisiacc/gruvbox-baby'
use 'catppuccin/nvim'
use 'EdenEast/nightfox.nvim'
use 'projekt0n/github-nvim-theme'
--Fuzzy search by Telescope and its dependencies:
use {
'nvim-telescope/telescope.nvim', branch = 'master',
requires = { { 'nvim-lua/plenary.nvim' } }
}
use 'BurntSushi/ripgrep'
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
end)