Skip to content

Commit 90943ff

Browse files
authored
Merge pull request #591 from NotAShelf/docs-touchup
treewide: general cleanup in docs and contribution exp.
2 parents 9443273 + 328b309 commit 90943ff

File tree

15 files changed

+335
-70
lines changed

15 files changed

+335
-70
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ indent_style = space
1414
indent_size = 2
1515
trim_trailing_whitespace = false
1616

17-
[*.{js,nix,yml,yaml}]
17+
[*.{js,json,nix,yml,yaml}]
1818
indent_style = space
1919
indent_size = 2
2020
tab_width = 2

.github/PULL_REQUEST_TEMPLATE/pull_request_template.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,29 @@ or dependency in this section.
77
If your pull request aims to fix an open issue or a please bug, please also link the relevant issue
88
below this line. You may attach an issue to your pull request with `Fixes #<issue number>` outside
99
this comment, and it will be closed when your pull request is merged.
10+
11+
A developer package template is provided in flake/develop.nix. If working on a module, you may use
12+
it to test your changes with minimal dependency changes.
1013
-->
1114

1215
## Sanity Checking
1316

1417
<!--
1518
Please check all that apply. As before, this section is not a hard requirement but checklists with more checked
16-
items are likely to be merged faster. You may save some time in maintainer review by performing self-reviews here
17-
before submitting your pull request.
19+
items are likely to be merged faster. You may save some time in maintainer reviews by performing self-reviews
20+
here before submitting your pull request.
1821
1922
If your pull request includes any change or unexpected behaviour not covered below, please do make sure to include
2023
it above in your description.
2124
-->
2225

2326
[editorconfig]: https://editorconfig.org
2427
[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes
28+
[hacking nvf]: https://notashelf.github.io/nvf/index.xhtml#sec-guidelines
2529

2630
- [ ] I have updated the [changelog] as per my changes
2731
- [ ] I have tested, and self-reviewed my code
32+
- [ ] My changes fit guidelines found in [hacking nvf]
2833
- Style and consistency
2934
- [ ] I ran **Alejandra** to format my code (`nix fmt`)
3035
- [ ] My code conforms to the [editorconfig] configuration of the project
@@ -34,9 +39,10 @@ it above in your description.
3439
- [ ] I have added a section in the manual
3540
- [ ] _(For breaking changes)_ I have included a migration guide
3641
- Package(s) built:
37-
- [ ] `.#nix` (default package)
42+
- [ ] `.#nix` _(default package)_
3843
- [ ] `.#maximal`
39-
- [ ] `.#docs-html` (manual, must build)
44+
- [ ] `.#docs-html` _(manual, must build)_
45+
- [ ] `.#docs-linkcheck` _(optional, please build if adding links)_
4046
- Tested on platform(s)
4147
- [ ] `x86_64-linux`
4248
- [ ] `aarch64-linux`
@@ -46,7 +52,8 @@ it above in your description.
4652
<!--
4753
If your changes touch upon a portion of the codebase that you do not understand well, please make sure to consult
4854
the maintainers on your changes. In most cases, making an issue before creating your PR will help you avoid duplicate
49-
efforts in the long run.
55+
efforts in the long run. `git blame` might help you find out who is the "author" or the "maintainer" of a current
56+
module by showing who worked on it the most.
5057
-->
5158

5259
---

.github/README.md

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
[Contribute]: #contributing
5151
[FAQ]: #frequently-asked-questions
5252
[Credits]: #credits
53+
[License]: #license
5354

5455
**[<kbd><br> Features <br></kbd>][Features]**
5556
**[<kbd><br> Get Started <br></kbd>][Get Started]**
@@ -67,6 +68,10 @@
6768
[standalone]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-installation
6869
[NixOS module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-nixos
6970
[Home-Manager module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-hm
71+
[release notes]: https://notashelf.github.io/nvf/release-notes.html
72+
[discussions tab]: https://github.com/notashelf/nvf/discussions
73+
[FAQ section]: #frequently-asked-questions
74+
[DAG]: https://en.wikipedia.org/wiki/Directed_acyclic_graph
7075

7176
- **Simple**: One language to rule them all! Use Nix to configure everything,
7277
with optional Lua support for robust configurability!
@@ -79,11 +84,31 @@
7984
customizable through the Nix module system.
8085
- Not comfortable with a full-nix config or want to bring your Lua config? You
8186
can do just that, no unnecessary restrictions.
82-
- Lazyloading? We got it! Lazyload both internal and external plugins at will.
87+
- Lazyloading 💤? We got it! Lazyload both internal and external plugins at
88+
will.
89+
- nvf allows _ordering configuration bits_ using [DAG] (_Directed acyclic
90+
graph_)s. It has never been easier to construct an editor configuration
91+
deterministically!
92+
- nvf exposes everything you need to avoid a vendor lock-in. Which means you
93+
can add new modules, plugins and so on without relying on us adding a module
94+
for them! Though, of course, feel free to request them.
95+
- Use plugins from anywhere. Inputs, npins, nixpkgs... You name it.
96+
- Add your own modules, with ease. It's all built-in!
8397
- **Well-documented**: Documentation is priority. You will _never_ face
8498
undocumented, obscure behaviour.
99+
- Changes, breaking or otherwise, will be communicated in the [release notes]
100+
- Refer to the [FAQ section] for answers to common questions.
101+
- Your question not there? Head to the to the [discussions tab]!
85102
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
86103
will, remain maintainable for myself and any contributors.
104+
- **Community-Led**: we would like nvf to be fully capable of accomplishing what
105+
you really want it to do. If you have a use case that is not made possible by
106+
nvf, please open an issue (or a pull request!)
107+
- Your feedback is more than welcome! Feedback is what _drives_ nvf forward.
108+
If you have anything to say, or ask, please let us know.
109+
- Pull requests are _always_ welcome. If you think the project can benefit
110+
from something you did locally, but are not quite sure how to upstream,
111+
please feel free to contact us! We'll help you get it done.
87112

88113
## Get Started
89114

@@ -173,36 +198,49 @@ fix.
173198
[list of open pull requests]: https://github.com/NotAShelf/nvf/pulls
174199

175200
**Q**: What platforms are supported?
176-
<br/> **A**: nvf actively supports **Linux and Darwin** platforms using
177-
standalone Nix, NixOS or Home-Manager. Please take a look at the [nvf manual]
178-
for available installation instructions.
201+
202+
**A**: nvf actively supports **Linux and Darwin** platforms using standalone
203+
Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available
204+
installation instructions.
179205

180206
**Q**: Can you add _X_?
181-
<br/> **A**: Maybe! It is not one of our goals to support each and every Neovim
207+
208+
**A**: Maybe! It is not one of our goals to support each and every Neovim
182209
plugin, however, I am always open to new modules and plugin setup additions to
183210
**nvf**. Use the appropriate [issue template] and I will consider a module
184211
addition. As mentioned before, pull requests to add new features are also
185212
welcome.
186213

187214
**Q**: A plugin I need is not available in **nvf**. What to do?
188-
<br/> **A**: **nvf** exposes several APIs for you to be able to add your own
189-
plugin configurations! Please see the documentation on how you may do this.
215+
216+
**A**: **nvf** exposes several APIs for you to be able to add your own plugin
217+
configurations! Please see the documentation on how you may do this.
190218

191219
**Q**: Main branch is awfully silent, is the project dead?
192-
<br/> **A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking
193-
userspace and work in a separate branch until we make sure the new additions are
194-
implemented in the most comfortable way possible for the end user. If you have
195-
not noticed any activity on the main branch, consider taking a look at the
220+
221+
**A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking userspace and
222+
work in a separate branch until we make sure the new additions are implemented
223+
in the most comfortable way possible for the end user. If you have not noticed
224+
any activity on the main branch, consider taking a look at the
196225
[list of branches] or the [list of open pull requests]. You may also consider
197226
_testing_ those release branches to get access to new features ahead of time and
198227
better prepare to breaking changes.
199228

200229
**Q**: Will you support non-flake installations?
201-
<br/> **A**: Quite possibly. **nvf** started as "neovim-flake", which does mean
202-
it is and will remain flakes-first but we might consider non-flakes
203-
compatibility. Though keep in mind that **nvf** under non-flake environments
204-
would lose customizability of plugin inputs, which is one of our primary
205-
features.
230+
231+
**A**: Quite possibly. **nvf** started as "neovim-flake", which does mean it is
232+
and will remain flakes-first but we might consider non-flakes compatibility.
233+
Though keep in mind that **nvf** under non-flake environments would lose
234+
customizability of plugin inputs, which is one of our primary features.
235+
236+
**Q**: I prefer working with Lua, can I use nvf as a plugin manager while I use
237+
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
238+
of a configuration generated from Nix?
239+
240+
**A**: Yes! Add `"~/.config.nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
241+
any plugins you want to load to `vim.startPlugins`. This will load your
242+
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
243+
Neovim's behaviour with Nix.
206244

207245
## Credits
208246

@@ -245,7 +283,7 @@ and everyone who has submitted issues or pull requests!
245283

246284
### Inspiration
247285

248-
This configuration borrows from and is based on a few other configurations,
286+
This configuration borrows from, and is based on a few other configurations,
249287
including:
250288

251289
- [@jordanisaacs's](https://github.com/jordanisaacs)

configuration.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This is the sample configuration for nvf, aiming to give you a feel of the default options
2-
# while certain plugins are enabled. While it may act as one, this is not an overview of nvf's
3-
# module options. To find a complete overview of nvf's options and examples, visit the manual.
2+
# while certain plugins are enabled. While it may partially act as one, this is *not* quite
3+
# an overview of nvf's module options. To find a complete and curated list of nvf module
4+
# options, examples, instruction tutorials and more; please visit the online manual.
45
# https://notashelf.github.io/nvf/options.html
56
isMaximal: {
67
config.vim = {

docs/manual.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ in
102102
--script script/anchor-use.js \
103103
--script script/anchor-min.js \
104104
--script script/search.js \
105-
--toc-depth 2 \
105+
--toc-depth 1 \
106106
--section-toc-depth 1 \
107107
manual.md \
108108
"$dest/index.xhtml"

docs/manual/options.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# Neovim Flake Configuration Options {#ch-options}
1+
# nvf Configuration Options {#ch-options}
22

33
Below are the module options provided by nvf, in no particular order. Most
44
options will include useful comments, warnings or setup tips on how a module
55
option is meant to be used as well as examples in complex cases.
66

7+
An offline version of this page is bundled with nvf as a part of the manpages
8+
which you can access with `man 5 nvf`. Please us know if you believe any of the
9+
options below are missing useful examples.
10+
711
<!--
812
In the manual, individual options may be referenced in Hyperlinks as follows:
913
[](#opt-vim.*) If changing the prefix here, do keep in mind the #opt- suffix will have

docs/manual/tips.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Helpful Tips {#ch-helpful-tips}
22

33
```{=include=} chapters
4+
tips/pure-lua-config.md
45
tips/debugging-nvf.md
56
tips/offline-docs.md
67
```

docs/manual/tips/debugging-nvf.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ nvf-print-config | bat --language=lua
1717
```
1818

1919
Alternatively, `cat` or `less` may also be used.
20+
21+
## Accessing `neovimConfig` {#sec-accessing-config}
22+
23+
It is also possible to access the configuration for the wrapped package. The
24+
_built_ Neovim package will contain a `neovimConfig` attribute in its
25+
`passthru`.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Pure Lua Configuration {#sec-pure-lua-config}
2+
3+
We recognize that you might not always want to configure your setup purely in
4+
Nix, sometimes doing things in Lua is simply the "superior" option. In such a
5+
case you might want to configure your Neovim instance using Lua, and nothing but
6+
Lua. It is also possible to mix Lua and Nix configurations.
7+
8+
Pure Lua or hybrid Lua/Nix configurations can be achieved in two different ways.
9+
_Purely_, by modifying Neovim's runtime directory or _impurely_ by placing Lua
10+
configuration in a directory found in `$HOME`. For your convenience, this
11+
section will document both methods as they can be used.
12+
13+
## Pure Runtime Directory {#sec-pure-nvf-runtime}
14+
15+
As of 0.6, nvf allows you to modify Neovim's runtime path to suit your needs.
16+
One of the ways the new runtime option is to add a configuration **located
17+
relative to your `flake.nix`**, which must be version controlled in pure flakes
18+
manner.
19+
20+
```nix
21+
{
22+
# Let us assume we are in the repository root, i.e., the same directory as the
23+
# flake.nix. For the sake of the argument, we will assume that the Neovim lua
24+
# configuration is in a nvim/ directory relative to flake.nix.
25+
vim = {
26+
additionalRuntimeDirectories = [
27+
# This will be added to Neovim's runtime paths. Conceptually, this behaves
28+
# very similarly to ~/.config/nvim but you may not place a top-level
29+
# init.lua to be able to require it directly.
30+
./nvim
31+
];
32+
};
33+
}
34+
```
35+
36+
This will add the `nvim` directory, or rather, the _store path_ that will be
37+
realised after your flake gets copied to the Nix store, to Neovim's runtime
38+
directory. You may now create a `lua/myconfig` directory within this nvim
39+
directory, and call it with [](#opt-vim.luaConfigRC).
40+
41+
```nix
42+
{pkgs, ...}: {
43+
vim = {
44+
additionalRuntimeDirectories = [
45+
# You can list more than one file here.
46+
./nvim-custom-1
47+
48+
# To make sure list items are ordered, use lib.mkBefore or lib.mkAfter
49+
# Simply placing list items in a given order will **not** ensure that
50+
# this list will be deterministic.
51+
./nvim-custom-2
52+
];
53+
54+
startPlugins = [pkgs.vimPlugins.gitsigns];
55+
56+
# Neovim supports in-line syntax highlighting for multi-line strings.
57+
# Simply place the filetype in a /* comment */ before the line.
58+
luaConfigRC.myconfig = /* lua */ ''
59+
-- Call the Lua module from ./nvim/lua/myconfig
60+
require("myconfig")
61+
62+
-- Any additional Lua configuration that you might want *after* your own
63+
-- configuration. For example, a plugin setup call.
64+
require('gitsigns').setup({})
65+
'';
66+
};
67+
}
68+
```
69+
70+
## Impure Absolute Directory {#sec-impure-absolute-dir}
71+
72+
[Neovim 0.9]: https://github.com/neovim/neovim/pull/22128
73+
74+
As of [Neovim 0.9], {var}`$NVIM_APPNAME` is a variable expected by Neovim to
75+
decide on the configuration directory. nvf sets this variable as `"nvf"`,
76+
meaning `~/.config/nvf` will be regarded as _the_ configuration directory by
77+
Neovim, similar to how `~/.config/nvim` behaves in regular installations. This
78+
allows some degree of Lua configuration, backed by our low-level wrapper
79+
[mnw](https://github.com/Gerg-L/mnw). Creating a `lua/` directory located in
80+
`$NVIM_APPNAME` ("nvf" by default) and placing your configuration in, e.g.,
81+
`~/.config/nvf/lua/myconfig` will allow you to `require` it as a part of the Lua
82+
module system through nvf's module system.
83+
84+
Let's assume your `~/.config/nvf/lua/myconfig/init.lua` consists of the
85+
following:
86+
87+
```lua
88+
-- init.lua
89+
vim.keymap.set("n", " ", "<Nop>", { silent = true, remap = false })
90+
vim.g.mapleader = " "
91+
```
92+
93+
The following Nix configuration via [](#opt-vim.luaConfigRC) will allow loading
94+
this
95+
96+
```nix
97+
{
98+
# The attribute name "myconfig-dir" here is arbitrary. It is required to be
99+
# a *named* attribute by the DAG system, but the name is entirely up to you.
100+
vim.luaConfigRC.myconfig-dir = ''
101+
require("myconfig")
102+
103+
-- Any additional Lua
104+
'';
105+
}
106+
```
107+
108+
[DAG system]: https://notashelf.github.io/nvf/index.xhtml#ch-using-dags
109+
110+
After you load your custom configuration, you may use an `init.lua` located in
111+
your custom configuration directory to configure Neovim exactly as you would
112+
without a wrapper like nvf. If you want to place your `require` call in a
113+
specific position (i.e., before or after options you set in nvf) the
114+
[DAG system] will let you place your configuration in a location of your
115+
choosing.
116+
117+
[top-level DAG system]: https://notashelf.github.io/nvf/index.xhtml#ch-vim-luaconfigrc

flake.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# «https://github.com/nix-systems/nix-systems»
1818
systems = import inputs.systems;
1919
imports = [
20+
./flake/templates
21+
2022
./flake/apps.nix
2123
./flake/legacyPackages.nix
2224
./flake/overlays.nix

0 commit comments

Comments
 (0)