init.lua: rewrite nvim entrypoint to use psoxizsh.entrypoint

Plus, add a detailed description of the new location(s) for configuration, and
a brief overview of how plugins work
This commit is contained in:
Paul Stemmet 2024-08-08 12:31:10 +00:00
parent f4cf1b75db
commit 478c623268
Signed by: Paul Stemmet
GPG Key ID: EDEA539F594E7E75
1 changed files with 92 additions and 1 deletions

View File

@ -1,3 +1,94 @@
--[[
This is entrypoint Psoxizsh uses to start Neovim.
The majority of configuration can be done via the following files:
~/.config/nvim
lua
   config
      autocmds.lua | Any additional autocmds (late loaded)
      keymaps.lua | Any additional key binds (late loaded)
      lazy.lua |
      options.lua | Any vim.opt or vim.g configuration (early loaded)
   plugins | Any additional plugins, changes to existing
   spec1.lua | plugins, plugin specific key binds, etc.
   specN.lua |
init.lua | <--- You are here
autocmds.lua:
Any custom autocommands to create.
You can use `psoxizsh.autocmd` as a helper for creating these.
Example:
local au = psoxizsh.autocmd
au.MyCustomGroup {
{ 'VimEnter', 'yaml', ':silent echo opened a YAML file!' }
}
keymaps.lua:
Any additional key binds to create.
You can use the builtin `vim.keymap.set` to create these. See :h vim.keymap
for more details.
Example:
local map = vim.keymap.set
map('n', '<leader>:', function() print('using a lua function') end)
map({ 'i', 'v' }, '<leader>:', '<cmd>silent echo using a vim cmdstring<CR>')
options.lua:
Any extra options you wish to set.
Unlike other files, options.lua is loaded *EARLY*, before most initialization
happens, letting you set things like mapleader, background color, etc before
other things that use this information are loaded.
However, this also means that (excluding parts of psoxizsh itself) you cannot
access any plugin related configuration.
Example:
local opt, g = vim.opt, vim.g
g.mapleader = ','
plugins/*.lua
Any direct submodules in the plugin/ directory will have their plugin specs
merged and loaded during initialization.
A full description of a plugin is beyond the purview of this document, but
briefly, each spec object describes where to source it, how to configure it,
when to load it, and any additional plugins it depends on.
These specs are then merged according to the following rules:
- cmd : the list of commands will be extended with your custom commands
- event : the list of events will be extended with your custom events
- ft : the list of filetypes will be extended with your custom filetypes
- keys : the list of keymaps will be extended with your custom keymaps
- opts : your custom opts will be merged with the default opts
- dependencies: the list of dependencies will be extended with your custom dependencies
- any other property will override the defaults
See https://lazy.folke.io/spec for the full spec description, or look at
some of the examples in $PSOXIZSH/nvim/lua/psoxizsh/plugins for more.
---
Unless you wish to change the options passed directly to our package manager,
you do not need to change this file. If you do, copy this file to your local
~/.config/nvim/init.lua and make the modifications needed:
cp -v $PSOXIZSH/init.lua ~/.config/nvim/init.lua
Next, add the following line (replacing 'overrides' with your config overrides)
just above the call to .start():
require('psoxizsh.entrypoint.config').with(overrides)
--]]
vim.opt.rtp:append( os.getenv('PSOXIZSH') .. '/nvim' ) vim.opt.rtp:append( os.getenv('PSOXIZSH') .. '/nvim' )
require 'psoxizsh' require('psoxizsh.entrypoint').start()