vim: make initialization structure more consistent

This commit is contained in:
Fernando Schauenburg 2024-02-10 15:42:23 +01:00
parent 1bc2c669de
commit ac5a50894b
4 changed files with 83 additions and 70 deletions

View file

@ -0,0 +1,12 @@
local M = {}
M.setup = function()
local colorscheme = 'gruvbox'
vim.cmd('silent! colorscheme ' .. colorscheme)
if vim.v.errmsg ~= '' then
vim.notify(('Colorscheme %s not found!'):format(colorscheme), vim.log.levels.WARN)
end
end
return M

View file

@ -0,0 +1,15 @@
local M = {}
M.setup = function()
vim.filetype.add {
pattern = {
['${HOME}/.ssh/config.d/.*'] = 'sshconfig',
['.*/ssh/config'] = 'sshconfig',
['.*/git/config'] = 'gitconfig',
['.*config/zsh/.*'] = 'zsh',
}
}
end
return M

View file

@ -10,81 +10,14 @@ R = function(module)
return require(module) return require(module)
end end
local bootstrap_lazy = function(path)
if not vim.loop.fs_stat(path) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'--branch=stable',
'https://github.com/folke/lazy.nvim.git',
path,
}
end
vim.opt.rtp:prepend(path)
return vim.F.npcall(require, 'lazy')
end
local setup_plugins = function()
local lazy = bootstrap_lazy(vim.fn.stdpath('data') .. '/lazy/lazy.nvim')
if not lazy then
vim.notify('Lazy not installed and failed to bootstrap!', vim.log.levels.WARN)
return
end
lazy.setup {
spec = 'fschauen.plugins',
-- defaults = {
-- lazy = true,
-- },
dev = {
path = '~/Projects/nvim-plugins',
fallback = true,
},
ui = {
border = 'rounded',
title = ' Lazy ',
},
performance = {
rtp = {
disabled_plugins = {
'gzip',
'matchit',
'matchparen',
'netrwPlugin',
'tarPlugin',
'tohtml',
'tutor',
'zipPlugin',
},
},
},
}
end
M.setup = function() M.setup = function()
require('fschauen.options').setup() require('fschauen.options').setup()
require('fschauen.keymap').setup() require('fschauen.keymap').setup()
require('fschauen.diagnostic').setup() require('fschauen.diagnostic').setup()
require('fschauen.autocmd').setup() require('fschauen.autocmd').setup()
require('fschauen.filetype').setup()
vim.filetype.add { require('fschauen.lazy').setup()
pattern = { require('fschauen.colorscheme').setup()
['${HOME}/.ssh/config.d/.*'] = 'sshconfig',
['.*/ssh/config'] = 'sshconfig',
['.*/git/config'] = 'gitconfig',
['.*config/zsh/.*'] = 'zsh',
}
}
setup_plugins()
local colorscheme = 'gruvbox'
vim.cmd('silent! colorscheme ' .. colorscheme)
if vim.v.errmsg ~= '' then
vim.notify(('Colorscheme %s not found!'):format(colorscheme), vim.log.levels.WARN)
end
end end
return M return M

View file

@ -0,0 +1,53 @@
local M = {}
local bootstrap_lazy = function(path)
if not vim.loop.fs_stat(path) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'--branch=stable',
'https://github.com/folke/lazy.nvim.git',
path,
}
end
vim.opt.rtp:prepend(path)
return vim.F.npcall(require, 'lazy')
end
M.setup = function()
local lazy = bootstrap_lazy(vim.fn.stdpath('data') .. '/lazy/lazy.nvim')
if not lazy then
vim.notify('Lazy not installed and failed to bootstrap!', vim.log.levels.WARN)
return
end
lazy.setup {
spec = 'fschauen.plugins',
dev = {
path = '~/Projects/nvim-plugins',
fallback = true,
},
ui = {
border = 'rounded',
title = ' Lazy ',
},
performance = {
rtp = {
disabled_plugins = {
'gzip',
'matchit',
'matchparen',
'netrwPlugin',
'tarPlugin',
'tohtml',
'tutor',
'zipPlugin',
},
},
},
}
end
return M