You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+217-1Lines changed: 217 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,224 @@ If you have any questions regarding those files, feel free to open an issue or [
18
18
19
19
The contribution process is mostly documented in the [pull request template](.github/pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
20
20
21
-
## Code of Conduct
21
+
###Code of Conduct
22
22
23
23
This project does not quite have a code of conduct yet. And to be honest, I'm not sure if I want one. I'm not expecting this project to be a hotbed of activity, but I do want to make sure that everyone who does contribute feels welcome and safe. As such, I will do my best to make sure that those who distrupt the project are dealt with swiftly and appropriately.
24
24
25
25
If you feel that you are not being treated with respect, please contact me directly.
26
+
27
+
### Guidelines
28
+
29
+
Here are the overall boundaries I would like you to follow while contributing to neovim-flake.
30
+
31
+
#### Documentation
32
+
33
+
If you are making a pull request to add a
34
+
35
+
36
+
#### Style
37
+
38
+
**Nix**
39
+
We use Alejandra for formatting nix code, which can be invoked directly with `nix fmt` in the repository.
40
+
41
+
While Alejandra is mostly opinionated on how code looks after formatting, certain formattings are done at the user's discretion.
42
+
43
+
Please use one line code for attribute sets that contain only one subset.
# this is an option that contains more than one nested value
53
+
someOtherValue = mkOption {
54
+
type = lib.types.bool;
55
+
description = "Some other description"
56
+
default = true;
57
+
};
58
+
};
59
+
}
60
+
```
61
+
62
+
If you move a line down after the merge operator, Alejandra will automatically unfold the whole merged attrset for you, which we do not want.
63
+
64
+
```nix
65
+
module = {
66
+
key = mkEnableOption "some description" // {
67
+
default = true; # we want this to be inline
68
+
};
69
+
# ...
70
+
}
71
+
```
72
+
73
+
For lists, it's up mostly to your discretion but please try to avoid unfolded lists if there is only one item in the list.
74
+
```nix
75
+
76
+
# ok
77
+
acceptableList = [
78
+
item1
79
+
item2
80
+
item3
81
+
item4
82
+
];
83
+
84
+
# not ok
85
+
listToBeAvoided = [item1 item2 item3 item4];
86
+
```
87
+
88
+
*This will be moved elsewhere, disregard unless you are adding a new plugin with keybinds*
89
+
#### Keybinds
90
+
91
+
##### Custom key mappings support for a plugin
92
+
93
+
To add custom keymappings to a plugin, a couple of helper functions are available in the project.
94
+
95
+
To set a mapping, you should define it on `vim.maps.<mode>`.
96
+
The available modes are:
97
+
98
+
- normal
99
+
- insert
100
+
- select
101
+
- visual
102
+
- terminal
103
+
- normalVisualOp
104
+
- visualOnly
105
+
- operator
106
+
- insertCommand
107
+
- lang
108
+
- command
109
+
110
+
An example, simple keybinding, can look like this:
111
+
112
+
```nix
113
+
114
+
{
115
+
vim.maps.normal = {
116
+
"<leader>wq" = {
117
+
action = ":wq<CR>";
118
+
silent = true;
119
+
desc = "Save file and quit";
120
+
};
121
+
};
122
+
}
123
+
```
124
+
125
+
There are many settings available in the options. Please refer to [the documentation](https://notashelf.github.io/neovim-flake/options.html#opt-vim.maps.command._name_.action) to see a list of them.
126
+
127
+
neovim-flake provides a list of helper commands, so that you don't have to write the mapping attribute sets every time:
128
+
129
+
`mkBinding = key: action: desc:` - makes a basic binding, with `silent` set to true.
130
+
`mkExprBinding = key: action: desc:` - makes an expression binding, with `lua`, `silent`, and `expr` set to true.
131
+
`mkLuaBinding = key: action: desc:` - makes an expression binding, with `lua`, and `silent` set to true.
132
+
Note - the lua in these bindings is _actual_ lua, not pasted into a `:lua`.
133
+
Therefore, you either pass in a function like `require('someplugin').some_function`, without actually calling it,
134
+
or you define your own function, like `function() require('someplugin').some_function() end`.
135
+
136
+
Additionally, to not have to repeat the descriptions, there's another utility function with its own set of functions:
This function can be used in combination with the same mkBinding functions as above, except they only take two arguments - `binding` and `action`, and have different names.
149
+
`mkSetBinding = binding: action:` - makes a basic binding, with `silent` set to true.
150
+
`mkSetExprBinding = binding: action:` - makes an expression binding, with `lua`, `silent`, and `expr` set to true.
151
+
`mkSetLuaBinding = binding: action:` - makes an expression binding, with `lua`, and `silent` set to true.
152
+
153
+
You can read the source code of some modules to see them in action, but their usage should look something like this:
154
+
155
+
```nix
156
+
# plugindefinition.nix
157
+
{lib, ...}:
158
+
with lib; {
159
+
options.vim.plugin = {
160
+
enable = mkEnableOption "Enable plugin";
161
+
162
+
# Mappings should always be inside an attrset called mappings
163
+
mappings = {
164
+
# mkMappingOption is a helper function from lib,
165
+
# that takes a description (which will also appear in which-key),
166
+
# and a default mapping (which can be null)
167
+
toggleCurrentLine = mkMappingOption "Toggle current line comment" "gcc";
168
+
toggleCurrentBlock = mkMappingOption "Toggle current block comment" "gbc";
169
+
170
+
toggleOpLeaderLine = mkMappingOption "Toggle line comment" "gc";
If you have come across a plugin that has an API that doesn't seem to easily allow custom keybindings, don't be scared to implement a draft PR. We'll help you get it done.
@@ -78,7 +78,7 @@ nix run github:notashelf/neovim-flake#tidal
78
78
79
79
Similar instructions will apply for `nix profile install`.
80
80
81
-
P.S. The `maximal` configuration is *massive* and will take a while to build. To get a feel for the configuration, use the default `nix` or `tidal` configurations.
81
+
P.S. The `maximal` configuration is _massive_ and will take a while to build. To get a feel for the configuration, use the default `nix` or `tidal` configurations.
82
82
83
83
## Documentation
84
84
@@ -103,8 +103,8 @@ I am always looking for new ways to help improve this flake. If you would like t
103
103
## Philosophy
104
104
105
105
The philosophy behind this flake configuration is to create an easily configurable and reproducible Neovim environment. While it does sacrifice in size
106
-
(which I know some users will find *disagreeable*), it offers a lot of flexibility and customizability in exchange for the large size of the flake inputs.
107
-
The KISS (Keep it simple, stupid) principle has been abandoned here, however, you *can* ultimately leverage the flexibility of this flake to declare a configuration that follows KISS principles, it is very easy to bring your own plugins and configurations from non-nix. What this flake is meant to be does eventually fall into your hands. Whether you are a developer, writer, or live coder (see tidal cycles below!), you can quickly craft a config that suits every project's need. Think of it like a distribution of Neovim that takes advantage of pinning vim plugins and
106
+
(which I know some users will find _disagreeable_), it offers a lot of flexibility and customizability in exchange for the large size of the flake inputs.
107
+
The KISS (Keep it simple, stupid) principle has been abandoned here, however, you _can_ ultimately leverage the flexibility of this flake to declare a configuration that follows KISS principles, it is very easy to bring your own plugins and configurations from non-nix. What this flake is meant to be does eventually fall into your hands. Whether you are a developer, writer, or live coder, you can quickly craft a config that suits every project's need. Think of it like a distribution of Neovim that takes advantage of pinning vim plugins and
108
108
third party dependencies (such as tree-sitter grammars, language servers, and more).
109
109
110
110
One should never get a broken config when setting options. If setting multiple options results in a broken Neovim, file an issue! Each plugin knows when another plugin which allows for smart configuration of keybindings and automatic setup of things like completion sources and languages.
@@ -128,9 +128,9 @@ instead of the `maximal` output. This will reduce size by a lot, but you will lo
128
128
**A**: No. If you feel the need to ask that question, then you have missed the whole point of using nix and ultimately this flake. The whole reason we use nix is to be able to handle EVERYTHING declaratively, well including the LSP and plugin installations.
129
129
<br/><br/>
130
130
131
-
**Q**: Can you add *X*?
131
+
**Q**: Can you add _X_?
132
132
<br/>
133
-
**A**: Maybe. Open an issue using the appropriate template and I will consider it. I do not intend to add *every plugin that is in existence*, but I will consider it, should it offer something useful to the flake.
133
+
**A**: Maybe. Open an issue using the appropriate template and I will consider it. I do not intend to add _every plugin that is in existence_, but I will consider it, should it offer something useful to the flake.
134
134
135
135
## Credits
136
136
@@ -139,17 +139,19 @@ instead of the `maximal` output. This will reduce size by a lot, but you will lo
139
139
Special thanks to
140
140
141
141
-[@fufexan](https://github.com/fufexan) - For the transition to flake-parts
142
-
-[@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
142
+
-[@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
143
+
-[@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible
144
+
-[@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates
143
145
144
146
and everyone who has submitted issues or pull requests!
145
147
146
148
### Inspiration
147
149
148
150
This configuration borrows from and is based on a few other configurations, including:
0 commit comments