</p></div><divclass="chapter"><divclass="titlepage"><div><div><h1class="title"><aid="ch-try-it-out"></a>Chapter1.Try it out</h1></div></div></div><preclass="programlisting 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</pre><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="_nix"></a>1.1.Nix</h2></div></div></div><p>By default LSP support for Nix is enabled alongside all complementary Neovim plugins. By running <codeclass="literal">nix run .</code>, which is the default package,
you will build Neovim with this config.</p></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="_tidal"></a>1.2.Tidal</h2></div></div></div><p>Tidal is an alternative config that adds vim-tidal on top of the plugins from the Nix configuration.</p></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="_maximal"></a>1.3.Maximal</h2></div></div></div><p>Maximal is the ultimate configuration that will enable basically everything. Keep in mind, however, that this will pull a lot of dependencies.</p><p>You are strongly recommended to use the binary cache if you would like to try the Maximal configuration.</p></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="_using_prebuilt_configs"></a>1.4.Using Prebuilt Configs</h2></div></div></div><preclass="programlisting console">$ nix run github:notashelf/neovim-flake#nix
$ nix run github:notashelf/neovim-flake#maximal</pre></div></div><divclass="chapter"><divclass="titlepage"><div><div><h1class="title"><aid="ch-default-configs"></a>Chapter2.Default Configs</h1></div></div></div><p>While you can configure neovim-flake yourself using the builder, here are a few default configurations you can use.</p><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="sec-default-tidal"></a>2.1.Tidal Cycles</h2></div></div></div><preclass="programlisting console">$ nix run github:notashelf/neovim-flake#tidal file.tidal</pre><p>Utilizing <aclass="link"href="https://github.com/tidalcycles/vim-tidal"target="_top">vim-tidal</a> and mitchmindtree’s fantastic <aclass="link"href="https://github.com/mitchmindtree/tidalcycles.nix"target="_top">tidalcycles.nix</a> start playing with tidal cycles in a single command.</p><p>In your tidal file, type a cycle e.g. <codeclass="literal">d1 $ s "drum"</code> and then press <spanclass="emphasis"><em>ctrl+enter</em></span>. 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 <codeclass="literal">services.pipewire.jack.enable = true</code>.</p></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="sec-default-nix"></a>2.2.Nix</h2></div></div></div><preclass="programlisting console">$ nix run github:notashelf/neovim-flake#nix test.nix</pre><p>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.</p></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="sec-default-maximal"></a>2.3.Maximal</h2></div></div></div><preclass="programlisting console">$ nix shell github:notashelf/neovim-flake#maximal test.nix</pre><p>It is the same fully configured neovim as with the <aclass="link"href="index.html#sec-default-nix"title="2.2.Nix">Nix</a> config, but with every supported language enabled.</p><divclass="note"><h3class="title">Note</h3><p>Running the maximal config will download <spanclass="strong"><strong>a lot</strong></span> of packages as it is downloading language servers, formatters, and more.</p></div></div></div><divclass="chapter"><divclass="titlepage"><div><div><h1class="title"><aid="ch-custom-configuration"></a>Chapter3.Custom Configuration</h1></div></div></div><p>Custom configuration is done with the <codeclass="literal">neovimConfiguration</code> function. It takes in the configuration as a module. The output of the configuration function is an attrset.</p><preclass="programlisting nix">{
}</pre></div><divclass="chapter"><divclass="titlepage"><div><div><h1class="title"><aid="ch-custom-plugins"></a>Chapter4.Custom Plugins</h1></div></div></div><p>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 <codeclass="literal">config.vim.startPlugins</code> array.</p><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="_new_method"></a>4.1.New Method</h2></div></div></div><p>As of version 0.5, we have a more extensive API for configuring plugins, under <codeclass="literal">vim.extraPlugins</code>.</p><p>Instead of using DAGs exposed by the library, you may use the extra plugin module as follows:</p><preclass="programlisting nix">{
config.vim.extraPlugins = with pkgs.vimPlugins; {
aerial = {
package = aerial-nvim;
setup = ''
require('aerial').setup {
-- some lua configuration here
}
'';
};
harpoon = {
package = harpoon;
setup = "require('harpoon').setup {}";
after = ["aerial"];
};
};
}</pre></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="_old_method"></a>4.2.Old Method</h2></div></div></div><p>Users who have not yet updated to 0.5, or prefer a more hands-on approach may use the old method where the load orderof the plugins is determined by DAGs.</p><preclass="programlisting nix">{
# fetch plugin source from GitHub and add it to startPlugins
}</pre><p>However, just making the plugin available might not be enough. In that case, you can write custom vimscript or lua config, using <codeclass="literal">config.vim.configRC</code> or <codeclass="literal">config.vim.luaConfigRC</code> respectively.
These options are attribute sets, and you need to give the configuration you’re adding some name, like this:</p><preclass="programlisting nix">{
}</pre><p>Note: If your configuration needs to be put in a specific place in the config, you can use functions from <codeclass="literal">inputs.neovim-flake.lib.nvim.dag</code> to order it. Refer to <aclass="link"href="https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix"target="_top">https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix</a>.</p><p>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.</p></div></div><divclass="chapter"><divclass="titlepage"><div><div><h1class="title"><aid="ch-hm-module"></a>Chapter5.Home Manager</h1></div></div></div><p>The Home Manager module allows us to customize the different <codeclass="literal">vim</code> options. To use it, we first add the input flake.</p><preclass="programlisting nix">{
}</pre></div><divclass="chapter"><divclass="titlepage"><div><div><h1class="title"><aid="ch-languages"></a>Chapter6.Language Support</h1></div></div></div><p>Language specific support means there is a combination of language specific plugins, <codeclass="literal">treesitter</code> support, <codeclass="literal">nvim-lspconfig</code> language servers, and <codeclass="literal">null-ls</code> integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have sections under the <codeclass="literal">vim.languages</code> attribute. See the configuration docs for details.</p><divclass="itemizedlist"><ulclass="itemizedlist"style="list-style-type: disc; "><liclass="listitem">
</li></ul></div><p>Adding support for more languages, and improving support for existing ones are great places where you can contribute with a PR.</p></div></div><divclass="navfooter"><hr/><tablewidth="100%"summary="Navigation footer"><tr><tdwidth="40%"align="left"></td><tdwidth="20%"align="center"></td><tdwidth="40%"align="right"><aaccesskey="n"href="options.html">Next</a></td></tr><tr><tdwidth="40%"align="left"valign="top"></td><tdwidth="20%"align="center"></td><tdwidth="40%"align="right"valign="top">AppendixA.Configuration Options</td></tr></table></div></body></html>