Skip to content

Commit 2c4a5de

Browse files
committed
refactor: move entrypoints from x/init.lua to x.lua
This makes config and languages module loading slightly simpler. Now all the actual config files can be in the same directory and initialisation can be separated.
1 parent 725850d commit 2c4a5de

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ after/
124124
Programming languages are managed in
125125
[`lua/peter/languages/<language>.lua`](./lua/peter/languages/). Each of these
126126
files should return a table of type `peter.lang.config`. The type is defined in
127-
[`lua/peter/languages/init.lua`](./lua/peter/languages/init.lua) and shown
127+
[`lua/peter/languages.lua`](./lua/peter/languages.lua) and shown
128128
below:
129129

130130
```lua
@@ -158,9 +158,9 @@ Instead of calling these directly in in the `plugins` field, you can include
158158
table fields with the same name (see example below).
159159

160160
Language configs are processed in
161-
[`lua/peter/languages/init.lua`](./lua/peter/languages/init.lua). This builds
162-
and exposes a table which maps language names to configurations. This table can
163-
be accessed with:
161+
[`lua/peter/languages.lua`](./lua/peter/languages.lua). This builds and exposes
162+
a table which maps language names to configurations. This table can be accessed
163+
with:
164164

165165
```lua
166166
-- Whole table.
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
-- THIS FILE DOES NOT CONTAIN THE CONFIGURATION FOR A SPECIFIC PROGRAMMING
2-
-- LANGUAGE.
3-
--
41
-- THIS FILE LOADS ALL OF THE OTHER LANGUAGE CONFIG FILES INTO A SINGLE LUA
52
-- MODULE THAT CAN BE ACCESSED USING `require("peter.languages")`.
63

@@ -10,7 +7,7 @@ local function is_valid_module(file)
107
-- We could use `vim.filetype.match({ filename = file })` but this would allow
118
-- files like `go.lua.bak`, which should not be included in the actual config
129
-- as they are backups.
13-
return file:sub(-4) == ".lua" and file ~= "init.lua"
10+
return file:sub(-4) == ".lua"
1411
end
1512

1613
---@class (exact) peter.lang.Config

0 commit comments

Comments
 (0)