docs: clean up documentation directory

This commit is contained in:
NotAShelf 2023-06-06 03:01:44 +03:00
commit 294b712c15
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
10 changed files with 100 additions and 60 deletions

View file

@ -0,0 +1,47 @@
[[ch-custom-configuration]]
== Custom Configuration
Custom configuration is done with the `neovimConfiguration` function. It takes in the configuration as a module. The output of the configuration function is an attrset.
[source,nix]
----
{
options = "The options that were available to configure";
config = "The outputted configuration";
pkgs = "The package set used to evaluate the module";
neovim = "The built neovim package";
}
----
The following is an example of a barebones vim configuration with the default theme enabled.
[source,nix]
----
{
inputs.neovim-flake = {
url = "github:notashelf/neovim-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {nixpkgs, neovim-flake, ...}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
configModule = {
# Add any custom options (and feel free to upstream them!)
# options = ...
config.vim = {
theme.enable = true;
};
};
customNeovim = neovim-flake.lib.neovimConfiguration {
modules = [configModule];
inherit pkgs;
};
in {
packages.${system}.neovim = customNeovim.neovim;
};
}
----

View file

@ -0,0 +1,34 @@
[[ch-custom-plugins]]
== Custom Plugins
You can use custom plugins, before they are implemented in the flake.
To add a plugin, you need to add it to your config's `config.vim.startPlugins` array.
This is an example of adding the FrenzyExists/aquarium-vim plugin:
[source,nix]
----
{
config.vim.startPlugins = [
(pkgs.fetchFromGitHub {
owner = "FrenzyExists";
repo = "aquarium-vim";
rev = "d09b1feda1148797aa5ff0dbca8d8e3256d028d5";
sha256 = "CtyEhCcGxxok6xFQ09feWpdEBIYHH+GIFVOaNZx10Bs=";
})
];
}
----
However, just making the plugin available might not be enough. In that case, you can write custom vimscript or lua config, using `config.vim.configRC` or `config.vim.luaConfigRC` respectively.
These options are attribute sets, and you need to give the configuration you're adding some name, like this:
[source,nix]
----
{
config.vim.configRC.aquarium = "colorscheme aquiarum";
}
----
Note: If your configuration needs to be put in a specific place in the config, you can use functions from `inputs.neovim-flake.lib.nvim.dag` to order it. Refer to https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix.
Also, if you successfully made your plugin work, please make a PR to add it to the flake, or open an issue with your findings so that we can make it available for everyone easily.

View file

@ -0,0 +1,36 @@
[[ch-default-configs]]
== Default Configs
While you can configure neovim-flake yourself using the builder, here are a few default configurations you can use.
[[sec-default-tidal]]
=== Tidal Cycles
[source,console]
$ nix run github:notashelf/neovim-flake#tidal file.tidal
Utilizing https://github.com/tidalcycles/vim-tidal[vim-tidal] and mitchmindtree's fantastic https://github.com/mitchmindtree/tidalcycles.nix[tidalcycles.nix] start playing with tidal cycles in a single command.
In your tidal file, type a cycle e.g. `d1 $ s "drum"` and then press _ctrl+enter_. Super collider with superdirt, and a modified GHCI with tidal will start up and begin playing. Note, you need jack enabled on your system. If you are using pipewire, its as easy as setting `services.pipewire.jack.enable = true`.
[[sec-default-nix]]
=== Nix
[source,console]
$ nix run github:notashelf/neovim-flake#nix test.nix
Enables all the of neovim plugins, with language support for specifically Nix. This lets you see what a fully configured neovim setup looks like without downloading a whole bunch of language servers and associated tools.
[[sec-default-maximal]]
=== Maximal
[source,console]
$ nix shell github:notashelf/neovim-flake#maximal test.nix
It is the same fully configured neovim as with the <<sec-default-nix,Nix>> config, but with every supported language enabled.
[NOTE]
====
Running the maximal config will download *a lot* of packages as it is downloading language servers, formatters, and more.
====

View file

@ -0,0 +1,80 @@
[[ch-hm-module]]
== Home Manager
The Home Manager module allows us to customize the different `vim` options. To use it, we first add the input flake.
[source,nix]
----
{
neovim-flake = {
url = github:notashelf/neovim-flake;
# you can override input nixpkgs
inputs.nixpkgs.follows = "nixpkgs";
};
}
----
Followed by importing the HM module.
[source,nix]
----
{
imports = [ neovim-flake.homeManagerModules.default ];
}
----
Then we should be able to use the given module. E.g.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
# your settings need to go into the settings attrset
settings = {
vim.viAlias = false;
vim.vimAlias = true;
vim.lsp = {
enable = true;
};
};
};
}
----
=== Custom vim/neovim plugins
It is possible to add custom plugins to your configuration by using the `vim.startPlugins` option and the this flake's lua DAG library.
Start by adding it to startPlugins. This example uses nvim-surround, but the process will be similar for other plugins as well.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
settings = {
vim.startPlugins = [ pkgs.vimPlugins.nvim-surround ];
};
};
}
----
Followed by requiring the plugin, should it need one, in the lua DAG. Please note that you're able to name the DAG to however you want, the name will add a `--SECTION <name>` in the init.vim, under which it will be initialized. `lib.nvim.dag.entryAfter ["name"]` could also be used to initialize a plugin only after a previous plugin has beeni initialize
Your final setup will likely look like this, where nvim-flake refers to your flake input or fetch.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
settings = {
vim.startPlugins = [ pkgs.vimPlugins.nvim-surround ];
luaConfigRC.nvim-surround = nvim-flake.lib.nvim.dag.entryAnywhere '' # nvim-flake is a reference to the flake. Please change this accordingly to your config.
require("nvim-surround").setup()
'';
};
};
}
----

View file

@ -0,0 +1,20 @@
[[ch-languages]]
== Language Support
Language specific support means there is a combination of language specific plugins, `treesitter` support, `nvim-lspconfig` language servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have sections under the `vim.languages` attribute. See the configuration docs for details.
* Rust: <<opt-vim.languages.rust.enable>>
* Nix: <<opt-vim.languages.nix.enable>>
* SQL: <<opt-vim.languages.sql.enable>>
* C/C++: <<opt-vim.languages.clang.enable>>
* Typescript/Javascript: <<opt-vim.languages.ts.enable>>
* Python: <<opt-vim.languages.python.enable>>:
* Zig: <<opt-vim.languages.zig.enable>>
* Markdown: <<opt-vim.languages.markdown.enable>>
* HTML: <<opt-vim.languages.html.enable>>
* SQL: <<opt-vim.languages.sql.enable>>
* Dart: <<opt-vim.languages.dart.enable>>
* Go: <<opt-vim.languages.go.enable>>
Adding support for more languages, and improving support for existing ones are great places where you can contribute with a PR.

View file

@ -0,0 +1,34 @@
[[ch-try-it-out]]
== Try it out
[source,console]
----
$ cachix use neovim-flake # Optional: it'll save you CPU resources and time
$ nix run github:notashelf/neovim-flake # will run the default configuration
----
=== Nix
By default LSP support for Nix is enabled alongside all complementary Neovim plugins. By running `nix run .`, which is the default package,
you will build Neovim with this config.
=== Tidal
Tidal is an alternative config that adds vim-tidal on top of the plugins from the Nix configuration.
=== Maximal
Maximal is the ultimate configuration that will enable basically everything. Keep in mind, however, that this will pull a lot of dependencies.
You are strongly recommended to use the binary cache if you would like to try the Maximal configuration.
=== Using Prebuilt Configs
[source,console]
----
$ nix run github:notashelf/neovim-flake#nix
$ nix run github:notashelf/neovim-flake#tidal
$ nix run github:notashelf/neovim-flake#maximal
----