### Nix Flakes Example Installation Source: https://nvf.notashelf.dev/index.html This snippet demonstrates how to install NVF using Nix flakes. It shows how to add NVF as an input in your flake.nix and import its NixOS module into your system configuration. This method allows for easy management of NVF and its dependencies within your Nix environment. ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nvf.url = "github:notashelf/nvf"; }; outputs = { nixpkgs, nvf, ... }: { # ↓ this is your host output in the flake schema nixosConfigurations."your-hostname" = nixpkgs.lib.nixosSystem { modules = [ nvf.nixosModules.default # <- this imports the NixOS module that provides the options ./configuration.nix # <- your host entrypoint, `programs.nvf.*` may be defined here ]; }; }; } ``` -------------------------------- ### Configure conform-nvim Setup Options Source: https://nvf.notashelf.dev/options.html Provides a table for passing additional setup options directly to the conform.nvim plugin's setup function. This allows for customization beyond the basic enable/disable setting, accommodating any valid conform.nvim configuration parameters. ```nix vim.formatter.conform-nvim.setupOpts = { // Add custom conform.nvim options here }; ``` -------------------------------- ### Configure Neo-tree Setup Options Source: https://nvf.notashelf.dev/options.html Allows passing custom options to the setup function of the neo-tree.nvim plugin. This enables fine-grained control over the filetree's behavior and appearance. Any valid option for neo-tree's setup function can be provided here. ```nix vim.filetree.neo-tree.setupOpts = { someOption = "value"; anotherOption = true; }; ``` -------------------------------- ### Example Nix Flake Installation for Home Manager Source: https://nvf.notashelf.dev/index.html This snippet demonstrates how to integrate the nvf Home Manager module into a Nix flake configuration. It specifies inputs for nixpkgs, home-manager, and nvf, and then configures the user's home environment to include the nvf module. ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager"; nvf.url = "github:notashelf/nvf"; }; outputs = { nixpkgs, home-manager, nvf, ... }: { # ↓ this is your home output in the flake schema, expected by home-manager "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; modules = [ nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options ./home.nix # <- your home entrypoint, `programs.nvf.*` may be defined here ]; }; }; } ``` -------------------------------- ### Nix Configuration for Applying Plugin Setup Options Source: https://nvf.notashelf.dev/hacking.html This Nix configuration applies the defined setup options for a plugin. It uses `lib.nvim.lua.toLuaObject` to convert Nix attributes into a Lua table for the plugin's `setup` function. ```nix # in modules/.../your-plugin/config.nix { lib, config, ...}: let cfg = config.vim.your-plugin; in { vim.luaConfigRC = lib.nvim.dag.entryAnywhere '' require('plugin-name').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts}) ''; } ``` -------------------------------- ### Configure Plugins with Standard API (Nix) Source: https://nvf.notashelf.dev/configuring.html This example shows how to configure plugins using the standard API with `vim.extraPlugins` in Nix. It maps plugin names to configurations including the package, setup code, and dependencies. This method allows for setting up plugins and defining their execution order relative to others. ```nix {pkgs, ...}: { config.vim.extraPlugins = { aerial = { package = pkgs.vimPlugins.aerial-nvim; setup = "require('aerial').setup {}"; }; harpoon = { package = pkgs.vimPlugins.harpoon; setup = "require('harpoon').setup {}"; after = ["aerial"]; # place harpoon configuration after aerial }; }; } ``` -------------------------------- ### Configure Telescope Extensions in Nix Source: https://nvf.notashelf.dev/options.html Example configuration for adding telescope extensions, including package dependencies and setup parameters. ```nix [ { name = "fzf"; packages = [pkgs.vimPlugins.telescope-fzf-native-nvim]; setup = {fzf = {fuzzy = true;};}; } ] ``` -------------------------------- ### Define Telescope Extension Setup Table Source: https://nvf.notashelf.dev/options.html Example of an attribute set used to configure specific telescope extension settings. ```nix { fzf = { fuzzy = true; }; } ``` -------------------------------- ### Configure Supermaven AI Assistant Options Source: https://nvf.notashelf.dev/options.html Example configuration for the Supermaven AI assistant, including keymap definitions and file-specific ignore settings. These options are passed to the plugin setup function. ```nix { vim.assistant.supermaven-nvim = { enable = true; setupOpts = { ignore_file = { markdown = true; }; keymaps = { accept_suggestion = ""; accept_word = ""; clear_suggestion = " {"foo", "bar"} ``` -------------------------------- ### Configure LSP Kind Setup Options Source: https://nvf.notashelf.dev/options.html Allows passing custom options to the lspkind.nvim setup function for detailed customization. This enables fine-tuning of how pictograms are displayed and integrated. Defaults to an empty object `{}`. ```nix vim.lsp.lspkind.setupOpts = { }; ``` -------------------------------- ### NeoCodeium Filetype Exclusion Example Source: https://nvf.notashelf.dev/options.html An example demonstrating how to disable NeoCodeium suggestions for specific filetypes. This is configured within the `filetypes` option of `setupOpts`. ```nix { gitcommit = false; help = false; } ``` -------------------------------- ### NeoCodeium Workspace Root Detection Example Source: https://nvf.notashelf.dev/options.html An example showing how to configure the `root_dir` option for NeoCodeium's Windsurf Chat integration. This option takes a list of strings representing directories or files used to detect the workspace root. ```nix [ ".git" "package.json" ] ``` -------------------------------- ### Configure LSP Signature Setup Options Source: https://nvf.notashelf.dev/options.html Allows passing custom options to the lsp-signature setup function for further customization. This enables fine-tuning of the signature viewer's behavior. Defaults to an empty object `{}`. ```nix vim.lsp.lspSignature.setupOpts = { }; ``` -------------------------------- ### Enabling Nix Experimental Features Source: https://nvf.notashelf.dev/index.html Configuration snippets to enable 'nix-command' and 'flakes' features required for NVF installation. ```nix nix.settings.experimental-features = "nix-command flakes"; ``` ```text experimental-features = nix-command flakes ``` ```bash $ nix --extra-experimental-features "nix-command flakes" ``` -------------------------------- ### Nix Configuration with Inline Lua Function Source: https://nvf.notashelf.dev/hacking.html This snippet demonstrates using `mkLuaInline` to pass a Lua function as a setup option for a plugin. It allows for dynamic behavior defined directly in Lua. ```nix { vim.your-plugin.setupOpts = { on_init = lib.generators.mkLuaInline '' function() print('we can write lua!') end ''; }; } ``` -------------------------------- ### Configure dashboard-nvim Setup Options Source: https://nvf.notashelf.dev/options.html Allows passing custom options to the dashboard.nvim setup function for detailed configuration. Any valid dashboard.nvim options can be included here. ```nix vim.dashboard.dashboard-nvim.setupOpts = { disable_move = true; }; ``` -------------------------------- ### Configure crates-nvim Setup Options Source: https://nvf.notashelf.dev/options.html Provides a table for passing custom options to the crates-nvim setup function. This allows for fine-grained control over its behavior, even for undocumented options. ```nix vim.languages.rust.extensions.crates-nvim.setupOpts = { }; ``` -------------------------------- ### Configure Neorg Setup Options Source: https://nvf.notashelf.dev/options.html Provides an option table for the setup function of the Neorg plugin. Allows for custom configurations beyond the documented options. This is a Nix configuration option. ```nix vim.notes.neorg.setupOpts ``` -------------------------------- ### Configure Harpoon Setup Options Source: https://nvf.notashelf.dev/options.html Provides an option table for the setup function of the Harpoon plugin. Allows for custom configurations beyond the documented options. This is a Nix configuration option. ```nix vim.navigation.harpoon.setupOpts ``` -------------------------------- ### Configure nvim-autopairs Setup Options Source: https://nvf.notashelf.dev/options.html Allows passing custom options to the setup function of the nvim-autopairs plugin. This enables advanced configuration and customization of the autopairs behavior beyond the default settings, allowing users to tailor it to their specific needs. ```nix vim.autopairs.nvim_autopairs.setup_opts = { disable_when_modifying_cursor = true; fast_wrap = { left = "({[<"; right = ")}]>"; }; }; ``` -------------------------------- ### Configure Ccc.nvim Setup Options with Defaults Source: https://nvf.notashelf.dev/release-notes.html Introduces the `vim.utility.ccc.setupOpts` configuration for the ccc.nvim plugin. It specifies that the existing hard-coded options are now provided as default values, simplifying setup. ```lua vim.utility.ccc.setupOpts = { -- Default options are now included here -- Example: some_option = "default_value" } ``` -------------------------------- ### Install nvf Without Flakes using fetchTarball Source: https://nvf.notashelf.dev/index.html This Nix code snippet illustrates how to install the nvf module without using flakes, by fetching the repository archive directly using `builtins.fetchTarball`. It then imports the module and enables nvf in the Home Manager configuration. ```nix # home.nix let nvf = import (builtins.fetchTarball { url = "https://github.com/notashelf/nvf/archive/.tar.gz"; # Optionally, you can add 'sha256' for verification and caching # sha256 = ""; }); in { imports = [ # Import the NixOS module from your fetched input nvf.homeManagerModules.nvf ]; # Once the module is imported, you may use `programs.nvf` as exposed by the # NixOS module. programs.nvf.enable = true; } ``` -------------------------------- ### Generated Lua Script for Plugin Setup Source: https://nvf.notashelf.dev/hacking.html This is the resulting Lua script generated from the Nix configuration, showing how the plugin is set up with its default options. ```lua require('plugin-name').setup({ enable_feature_a = false, number_option = 3, }) ``` -------------------------------- ### Configure HLArgs-Nvim Setup Options (Nix) Source: https://nvf.notashelf.dev/options.html Allows passing custom options to the hlargs-nvim setup function. This submodule accepts any valid options for further customization. Defaults to an empty table. ```nix vim.visuals.hlargs-nvim.setupOpts = {} ``` -------------------------------- ### Configure Neocord Plugin Settings Source: https://nvf.notashelf.dev/options.html Example configuration for the Neocord Discord rich presence plugin, showing how to define blacklisted filetypes. ```nix vim.presence.neocord.setupOpts = { auto_update = true; blacklist = [ "Alpha" ]; client_id = "1157438221865717891"; }; ``` -------------------------------- ### Configure Startify Bookmarks Source: https://nvf.notashelf.dev/options.html Defines a list of bookmarks to be displayed on the startify plugin's start page. Each bookmark is an attribute set containing a shortcut and a path. ```nix vim.dashboard.startify.bookmarks = [ { c = "~/.config/nvim/init.nix"; } ]; ``` -------------------------------- ### Configure comment-nvim Setup Options Source: https://nvf.notashelf.dev/options.html Allows passing custom options to the comment-nvim setup function. This enables fine-tuning of the plugin's behavior, including enabling basic or extra mappings. ```nix vim.comments.comment-nvim.setupOpts = { mappings.basic = true; mappings.extra = true; }; ``` -------------------------------- ### Setup Lua Code for Neovim Plugin Source: https://nvf.notashelf.dev/options.html Provides Lua code to be executed during the setup phase of a Neovim plugin. This allows for custom configuration and initialization of the plugin. The code is typically a string of Lua statements concatenated with newlines. ```lua vim.extraPlugins..setup = "require('some-plugin').setup {}"; ``` -------------------------------- ### Mini Plugin Configuration Source: https://nvf.notashelf.dev/options.html Standard configuration pattern for enabling mini.nvim modules and providing setup options. ```APIDOC ## [CONFIG] vim.mini.[module].enable ### Description Enables or disables a specific mini.nvim module. ### Method N/A (Configuration Property) ### Parameters #### Request Body - **enable** (boolean) - Required - Whether to enable the plugin. Default: false. ### Request Example { "vim.mini.completion.enable": true } ## [CONFIG] vim.mini.[module].setupOpts ### Description Provides an option table to be passed into the setup function of the specified mini.nvim module. ### Method N/A (Configuration Property) ### Parameters #### Request Body - **setupOpts** (object) - Optional - Key-value pairs for plugin-specific configuration. ### Request Example { "vim.mini.comment.setupOpts": { "options": "value" } } ### Response #### Success Response (200) - **status** (string) - Configuration applied successfully. ``` -------------------------------- ### NixOS Installation Without Flakes Source: https://nvf.notashelf.dev/index.html This snippet illustrates how to install NVF on NixOS without using flakes, leveraging the `flake-compat` project. It uses `builtins.fetchTarball` to download NVF and then imports its NixOS module. This method requires manual updates of the tarball URL and SHA256 hash for dependency management. ```nix # configuration.nix let nvf = import (builtins.fetchTarball { url = "https://github.com/notashelf/nvf/archive/.tar.gz"; # Optionally, you can add 'sha256' for verification and caching # sha256 = ""; }); in { imports = [ # Import the NixOS module from your fetched input nvf.nixosModules.nvf ]; # Once the module is imported, you may use `programs.nvf` as exposed by the # NixOS module. programs.nvf.enable = true; } ``` -------------------------------- ### Configure NvimTree Renderer Options Source: https://nvf.notashelf.dev/options.html Example configuration for nvim-tree renderer settings, including git highlighting and icon placement preferences. ```nix { vim.filetree.nvimTree.setupOpts.renderer = { group_empty = true; highlight_git = true; highlight_modified = "all"; icons = { git_placement = "signcolumn"; modified_placement = "after"; glyphs = { default = ""; modified = ""; }; }; }; } ``` -------------------------------- ### Configure Which-Key Plugin Options Source: https://nvf.notashelf.dev/options.html Example of setting custom options for the which-key plugin, including window border styles and preset selection. ```nix { vim.binds.whichKey.setupOpts = { preset = "modern"; notify = true; win = { border = "rounded"; }; }; } ``` -------------------------------- ### Define ToggleTerm Setup Options Source: https://nvf.notashelf.dev/options.html Advanced configuration for ToggleTerm, including dynamic sizing logic and winbar customization using Lua inline expressions. ```nix vim.terminal.toggleterm.setupOpts.size = { _type = "lua-inline"; expr = '' function(term) if term.direction == "horizontal" then return 15 elseif term.direction == "vertical" then return vim.o.columns * 0.4 end end ''; }; vim.terminal.toggleterm.setupOpts.winbar.name_formatter = { _type = "lua-inline"; expr = '' function(term) return term.name end ''; }; ``` -------------------------------- ### Configure extra plugins with dependency ordering Source: https://nvf.notashelf.dev/options.html Registers custom plugins and defines their setup logic. Uses a DAG-based system to manage plugin load order via the 'after' attribute. ```nix with pkgs.vimPlugins; { aerial = { package = aerial-nvim; setup = "require('aerial').setup {}"; }; harpoon = { package = harpoon; setup = "require('harpoon').setup {}"; after = ["aerial"]; }; } ``` -------------------------------- ### CCC Neovim Plugin Setup Options Source: https://nvf.notashelf.dev/release-notes.html Adds the `vim.utility.ccc.setupOpts` option to the ccc.nvim plugin, providing default values that match the existing hard-coded options. This simplifies configuration by offering sensible defaults. ```lua vim.utility.ccc.setupOpts = { -- existing hard-coded options as defaults } ``` -------------------------------- ### Nix to Lua Conversion Example (Attribute Set) Source: https://nvf.notashelf.dev/hacking.html Illustrates the conversion of a Nix attribute set to a Lua table using `toLuaObject`. This is fundamental for passing configuration data between Nix and Lua. ```nix # {foo = "bar"} -> {["foo"] = "bar"} ``` -------------------------------- ### Import NVF Home Manager Module Source: https://nvf.notashelf.dev/index.html This code demonstrates how to import the NVF Home Manager module into your Home Manager configuration. Assuming NVF is defined in your `inputs` and `inputs` is available in the argument set, this import statement makes NVF's customization options accessible within your Home Manager setup. ```nix { # Assuming nvf is in your inputs and inputs is in the argument set. # See example installation below. imports = [ inputs.nvf.homeManagerModules.default ]; } ``` -------------------------------- ### Using `mkLuaInline` for Raw Lua Code Source: https://nvf.notashelf.dev/hacking.html This example shows how to embed raw Lua code directly into Nix configuration using `lib.generators.mkLuaInline`. This is useful for providing Lua functions or complex expressions. ```nix # { _type = "lua-inline"; expr = "function add(a, b) return a + b end"; } ``` -------------------------------- ### Enable and Configure colorful-menu.nvim Source: https://nvf.notashelf.dev/options.html Enable the colorful-menu.nvim plugin for syntax-highlighted completion menus. Additional setup options can be passed to its configuration. ```nix vim.ui.colorful_menu_nvim.enable = true vim.ui.colorful_menu_nvim.setupOpts = { -- Additional options for colorful-menu.nvim } ``` -------------------------------- ### Define Neovim Autocommands in nvf Source: https://nvf.notashelf.dev/configuring.html Examples showing how to define autocommands using Lua callbacks, Vimscript commands, and specific event triggers within the nvf configuration structure. ```nix { lib, ... }: { vim.augroups = [ { name = "UserSetup"; } ]; vim.autocmds = [ # Example 1: Using a Lua callback { event = [ "BufWritePost" ]; pattern = [ "*.lua" ]; group = "UserSetup"; desc = "Notify after saving Lua file"; callback = lib.generators.mkLuaInline '' function() vim.notify("Lua file saved!", vim.log.levels.INFO) end ''; } # Example 2: Using a Vim command { event = [ "FileType" ]; pattern = [ "markdown" ]; group = "UserSetup"; desc = "Set spellcheck for Markdown"; command = "setlocal spell"; } # Example 3: Autocommand without a specific group { event = [ "BufEnter" ]; pattern = [ "*.log" ]; desc = "Disable line numbers in log files"; command = "setlocal nonumber"; } # Example 4: Using Lua for callback { event = [ "BufWinEnter" ]; pattern = [ "*" ]; desc = "Simple greeting on entering a buffer window"; callback = lib.generators.mkLuaInline '' function(args) print("Entered buffer: " .. args.buf) end ''; once = true; } ]; } ``` -------------------------------- ### Standalone NVF Configuration with Flakes Source: https://nvf.notashelf.dev/index.html An example of defining a custom Neovim package using NVF as a flake output, which can then be integrated into Home-Manager configurations. ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager"; nvf.url = "github:notashelf/nvf"; }; outputs = {nixpkgs, home-manager, nvf, ...}: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; configModule = { config.vim = { theme.enable = true; }; }; customNeovim = nvf.lib.neovimConfiguration { inherit pkgs; modules = [configModule]; }; in { packages.${system}.my-neovim = customNeovim.neovim; homeConfigurations = { "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { modules = [ {home.packages = [customNeovim.neovim];} ]; }; }; }; } ``` -------------------------------- ### Configure Lazy-Loaded Plugins with NVF (Lua) Source: https://nvf.notashelf.dev/configuring.html This snippet demonstrates how to configure lazy-loaded plugins within NVF using `config.vim.lazy.plugins`. It specifies the plugin package, the module to set up, and optional setup options and hooks. This is useful for plugins that require a setup table and benefit from lazy loading. ```lua { config.vim.lazy.plugins = { "aerial.nvim" = { # ^^^^^^^^^^^ this name should match the package.pname or package.name package = aerial-nvim; setupModule = "aerial"; setupOpts = {option_name = false}; after = "print('aerial loaded')"; }; }; } ``` -------------------------------- ### Configure custom LSP server command Source: https://nvf.notashelf.dev/configuring.html Shows how to define a custom LSP server command for a language module by providing a list of strings. This bypasses automatic installation and uses the binary found in the system PATH. ```nix vim.languages.java = { lsp = { enable = true; # This expects 'jdt-language-server' to be in your PATH or in # 'vim.extraPackages.' There are no additional checks performed to see # if the command provided is valid. package = ["jdt-language-server" "-data" "~/.cache/jdtls/workspace"]; }; }; ``` -------------------------------- ### Configure Nix Plugin with Lazy Loading Source: https://nvf.notashelf.dev/hacking.html Configures a plugin using Nix for lazy loading. It specifies the package name, setup module, options, and triggers for loading such as directory changes or commands. This replaces the older vim.startPlugins method. ```nix {config, ...}: let cfg = config.vim.your-plugin; in { vim.lazy.plugins.your-plugin = { # Instead of vim.startPlugins, use this: package = "your-plugin"; # ıf your plugin uses the `require('your-plugin').setup{...}` pattern setupModule = "your-plugin"; inherit (cfg) setupOpts; # Events that trigger this plugin to be loaded event = ["DirChanged"]; cmd = ["YourPluginCommand"]; # Plugin Keymaps keys = [ # We'll cover this in detail in the 'keybinds' section { key = "d"; mode = "n"; action = ":YourPluginCommand"; } ]; }; } ``` -------------------------------- ### Configure LSP Servers Source: https://nvf.notashelf.dev/options.html Defines configurations for Language Server Protocol (LSP) servers. This includes setting root markers, capabilities, filetypes, and attach hooks for each server. The example shows configuration for a generic server and a specific 'clangd' server. ```lua vim.lsp.servers = { ["*"].{ root_markers = {".git"}; capabilities = { textDocument = { semanticTokens = { multilineTokenSupport = true; }; }; }; }; ["clangd"] = { filetypes = ["c"]; }; } ``` -------------------------------- ### Enable dashboard-nvim Plugin in Neovim Source: https://nvf.notashelf.dev/options.html Enables the dashboard.nvim plugin, offering a fancy and fast start screen for Neovim. Configuration is done via the `setupOpts` attribute. ```nix vim.dashboard.dashboard-nvim.enable = true; ``` -------------------------------- ### Define Lazy-Load Key Mappings Source: https://nvf.notashelf.dev/options.html Example of configuring key-based lazy-loading triggers, supporting both standard command strings and Lua function references. ```nix keys = [ { mode = "n"; key = "s"; action = ":DapStepOver"; desc = "DAP Step Over"; } { mode = ["n" "x"]; key = "dc"; action = "function() require('dap').continue() end"; lua = true; desc = "DAP Continue"; } ] ``` -------------------------------- ### Configure Neovim Startup Plugins (vim.startPlugins) Source: https://nvf.notashelf.dev/options.html Manages the list of plugins to load on Neovim startup. This is used internally to add plugins to Neovim's runtime. For additional plugins, use `vim.extraPlugins`. Dependencies include a list of null, package, or specific plugin names. No explicit inputs or outputs are defined beyond the plugin list itself. ```nix vim.startPlugins = [ "plenary-nvim" ]; ``` -------------------------------- ### Temporarily Enable Flakes Experimental Features Source: https://nvf.notashelf.dev/index.html This command-line example shows how to temporarily enable flakes experimental features for a single Nix command. By using the `--extra-experimental-features` flag, you can activate `nix-command` and `flakes` without modifying system-wide configurations. ```bash # Temporarily enables "nix-command" and "flakes" experimental features. $ nix --extra-experimental-features "nix-command flakes" ``` -------------------------------- ### Configure Avante-Nvim Ask Window Settings Source: https://nvf.notashelf.dev/options.html Customize the appearance and behavior of the 'AvanteAsk' window in Avante-Nvim. Options include border type, floating window usage, focus behavior after applying changes, and whether to start in insert mode. ```nix vim.assistant.avante-nvim.setupOpts.windows.ask.border = "rounded"; vim.assistant.avante-nvim.setupOpts.windows.ask.floating = false; vim.assistant.avante-nvim.setupOpts.windows.ask.focus_on_apply = "ours"; vim.assistant.avante-nvim.setupOpts.windows.ask.start_insert = true; ``` -------------------------------- ### Advanced Pure Lua Configuration with NVF (Nix) Source: https://nvf.notashelf.dev/tips.html This Nix configuration extends the runtime path with multiple custom directories and sets up a Lua configuration string for Neovim. It includes an example of requiring a custom Lua module and setting up a plugin like 'gitsigns'. ```nix {pkgs, ...}: { vim = { additionalRuntimePaths = [ # You can list more than one file here. ./nvim-custom-1 # To make sure list items are ordered, use lib.mkBefore or lib.mkAfter # Simply placing list items in a given order will **not** ensure that # this list will be deterministic. ./nvim-custom-2 ]; startPlugins = [pkgs.vimPlugins.gitsigns]; # Neovim supports in-line syntax highlighting for multi-line strings. # Simply place the filetype in a /* comment */ before the line. luaConfigRC.myconfig = /* lua */ '' -- Call the Lua module from ./nvim/lua/myconfig require("myconfig") -- Any additional Lua configuration that you might want *after* your own -- configuration. For example, a plugin setup call. require('gitsigns').setup({}) ''; }; } ``` -------------------------------- ### Install Lua Packages for Vim Source: https://nvf.notashelf.dev/options.html Specifies a list of Lua packages to be installed for Vim. This option takes a list of strings, where each string is the name of a package to be installed. ```lua -- Example: Installing 'magick' and 'serpent' packages vim.luaPackages = ["magick" "serpent"] ``` -------------------------------- ### Nix Derivation for Rust Plugins (postInstall phase) Source: https://nvf.notashelf.dev/hacking.html This snippet shows the `postInstall` phase of a Nix derivation for a Rust-based plugin. It copies plugin files and organizes the build output. It's designed to be used with `buildRustPackage` or `stdenv.mkDerivation`. ```nix { # ... postInstall = '' cp -r {lua,plugin} "$out" mkdir -p "$out/doc" cp 'doc/'*'.txt' "$out/doc/" mkdir -p "$out/target" mv "$out/lib" "$out/target/release" ''; # ... } ``` -------------------------------- ### Configure Avante-Nvim Edit Window Settings Source: https://nvf.notashelf.dev/options.html Customize the appearance and behavior of the 'AvanteEdit' window in Avante-Nvim. Options include border type and whether to start in insert mode. ```nix vim.assistant.avante-nvim.setupOpts.windows.edit.border = "rounded"; vim.assistant.avante-nvim.setupOpts.windows.edit.start_insert = true; ``` -------------------------------- ### Build Vim Plugin with Nixpkgs Inputs Source: https://nvf.notashelf.dev/tips.html This snippet demonstrates how to build a Vim plugin using Nixpkgs inputs. It defines the 'aerial-nvim' plugin, specifying its source and setup function. This method is suitable when managing plugin sources via Nix flakes or npins. ```nix {inputs, ...}: let aerial-from-source = pkgs.vimUtils.buildVimPlugin { name = "aerial-nvim"; src = inputs.aerial-nvim; }; in { vim.extraPlugins = { aerial = { package = aerial-from-source; setup = "require('aerial').setup {}"; }; }; } ``` -------------------------------- ### Configure NVF with Pure Lua Runtime Directory (Nix) Source: https://nvf.notashelf.dev/tips.html This Nix code snippet demonstrates how to add a local 'nvim' directory to Neovim's additional runtime paths. This allows for pure Lua configuration by placing Lua files within the 'nvim/lua/myconfig' directory. It's part of a flake-based setup. ```nix { # Let us assume we are in the repository root, i.e., the same directory as the # flake.nix. For the sake of the argument, we will assume that the Neovim lua # configuration is in a nvim/ directory relative to flake.nix. vim = { additionalRuntimePaths = [ # This will be added to Neovim's runtime paths. Conceptually, this behaves # very similarly to ~/.config/nvim but you may not place a top-level # init.lua to be able to require it directly. ./nvim ]; }; } ``` -------------------------------- ### Load Plugin with Lazy Loading in Lua Source: https://nvf.notashelf.dev/hacking.html Loads a plugin using Lua with lazy loading capabilities. It defines the plugin's name, setup function, events, commands, and keymaps. This is the resulting Lua code generated from the Nix configuration. ```lua require('lz.n').load({ { "name-of-your-plugin", after = function() require('your-plugin').setup({ --[[ your setupOpts ]]-- }) end, event = {"DirChanged"}, cmd = {"YourPluginCommand"}, keys = { {"d", ":YourPluginCommand", mode = {"n"}}, }, } }) ``` -------------------------------- ### Configure Plugin Loading with LazyFile Event (Nix) Source: https://nvf.notashelf.dev/configuring.html This example shows how to use the `LazyFile` user event in NVF to trigger plugin loading when a file is opened. The `LazyFile` event acts as an alias for a combination of standard Neovim events (`BufReadPost`, `BufNewFile`, `BufWritePre`), providing a convenient way to manage file-related plugin loads. ```nix { config.vim.lazy.plugins = { "aerial.nvim" = { package = pkgs.vimPlugins.aerial-nvim; event = [{event = "User"; pattern = "LazyFile";}]; # ... }; }; } ``` -------------------------------- ### Defining Nix Module Options Source: https://nvf.notashelf.dev/hacking.html Demonstrates the correct structure for defining module options in Nix, including the use of mkEnableOption and nested submodules with proper argument ordering. ```nix module = { value = mkEnableOption "some description"; subModule = { someOtherValue = mkOption { type = lib.types.bool; default = true; description = "Some other description"; }; }; }; ``` -------------------------------- ### Configure Extra Plugins with NVF (Nix) Source: https://nvf.notashelf.dev/configuring.html This snippet utilizes NVF's `vim.extraPlugins` API (version 0.5 and later) for configuring plugins, offering a preferred alternative to the legacy method. It abstracts away direct interaction with the DAG system, allowing for faster iteration by defining plugin packages and their setup Lua code. ```nix {pkgs, ...}: { config.vim.extraPlugins = { aerial = { package = pkgs.vimPlugins.aerial-nvim; setup = '' require('aerial').setup { -- some lua configuration here } ''; }; harpoon = { package = pkgs.vimPlugins.harpoon; setup = "require('harpoon').setup {}"; after = ["aerial"]; }; }; } ``` -------------------------------- ### Migrate Bufferline to setupOpts (Lua) Source: https://nvf.notashelf.dev/release-notes.html Moves the `bufferline` configuration to use `setupOpts` for increased customizability. ```lua bufferline.setupOpts ``` -------------------------------- ### Enable NVF Plugins and Clipboard Providers Source: https://nvf.notashelf.dev/options.html Demonstrates how to enable various utility plugins and clipboard providers within the NVF Nix configuration structure. ```nix { vim.binds.cheatsheet.enable = true; vim.binds.hardtime-nvim.enable = true; vim.binds.whichKey.enable = true; vim.clipboard.enable = true; vim.clipboard.providers.wl-copy.enable = true; vim.clipboard.providers.xclip.enable = true; } ``` -------------------------------- ### Register Custom LSP Servers in Neovim Source: https://nvf.notashelf.dev/configuring.html Demonstrates how to register custom LSP servers using Neovim's `vim.lsp.servers` API. This allows for the integration of language servers not included in existing modules, or to manage LSP discovery from the system's PATH. It shows how to define command executables, filetypes, and root markers for custom LSPs. ```lua { lib, ...}: { vim.lsp.servers = { # Get `basedpyright-langserver` from PATH, e.g., a dev shell. basedpyright.cmd = lib.mkForce ["basedpyright-langserver" "--stdio"]; # Define a custom LSP entry using `vim.lsp.servers`: ty = { cmd = lib.mkDefault [(lib.getExe pkgs.ty) "server"]; filetypes = ["python"]; root_markers = [ ".git" "pyproject.toml" "setup.cfg" "requirements.txt" "Pipfile" "pyrightconfig.json" ]; # If your LSP accepts custom settings. See `:help lsp-config` for more details # on available fields. This is a freeform field. settings.ty = { /* ... */ }; }; } ``` -------------------------------- ### Configure Treesitter Grammars Source: https://nvf.notashelf.dev/options.html Defines the list of treesitter grammars to install. It accepts packages from nvim-treesitter grammar plugins. ```nix with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [ regex kdl ]; ``` -------------------------------- ### Configure fzf-lua and gesture-nvim enablement Source: https://nvf.notashelf.dev/options.html Demonstrates how to enable utility plugins within the NVF configuration structure using boolean flags. ```nix vim.fzf-lua.enable = true; vim.gestures.gesture-nvim.enable = true; ``` -------------------------------- ### GitHub Copilot Configuration Source: https://nvf.notashelf.dev/options.html Configuration options for enabling and customizing the GitHub Copilot integration, including mappings and setup parameters. ```APIDOC ## CONFIGURATION vim.assistant.copilot ### Description Configures the GitHub Copilot AI assistant plugin, including cmp integration, panel behavior, and suggestion mappings. ### Parameters #### Request Body - **enable** (boolean) - Optional - Whether to enable GitHub Copilot. Default: false - **cmp.enable** (boolean) - Optional - Whether to enable nvim-cmp integration. Default: false - **mappings.panel** (object) - Optional - Keybindings for panel interaction (accept, jumpNext, jumpPrev, open, refresh). - **mappings.suggestion** (object) - Optional - Keybindings for suggestion interaction (accept, acceptLine, acceptWord, dismiss, next, prev). - **setupOpts** (object) - Optional - Advanced setup options including node command and panel layout settings. ### Request Example { "enable": true, "cmp": { "enable": true }, "setupOpts": { "panel": { "enabled": true, "layout": { "position": "bottom", "ratio": 0.4 } } } } ``` -------------------------------- ### Migrate indent-blankline to setupOpts (Lua) Source: https://nvf.notashelf.dev/release-notes.html Migrates `indent-blankline` to use `setupOpts` for greater customization. Previously included/broken options like `listChar`, `fillChar`, and `eolChar` have been removed and require manual configuration. ```lua indentBlankline.setupOpts ``` -------------------------------- ### Add Plugins to Runtime with Legacy Method (Nix) Source: https://nvf.notashelf.dev/configuring.html This code illustrates the legacy method of adding Neovim plugins by including their packages in `vim.startPlugins`. This makes the plugin available in Neovim's runtime. The comment explains that `vim.startPlugins` accepts a list of strings for internal plugins or package specifications for external ones. ```nix {pkgs, ...}: { # Add a Neovim plugin from Nixpkgs to the runtime. # This does not need to come explicitly from packages. 'vim.startPlugins' # takes a list of *string* (to load internal plugins) or *package* to load # a Neovim package from any source. vim.startPlugins = [pkgs.vimPlugins.aerial-nvim]; } ``` -------------------------------- ### Nix Configuration for Enabling a Plugin Source: https://nvf.notashelf.dev/hacking.html This Nix configuration snippet demonstrates how to enable a specific plugin, 'blink-cmp', within the Neovim configuration. It's part of the `config.vim.startPlugins` setting. ```nix { config.vim.startPlugins = ["blink-cmp"]; } ``` -------------------------------- ### Define Standalone Neovim Flake Source: https://nvf.notashelf.dev/index.html An example of a Nix flake that consumes the NVF library to build a custom Neovim instance. This allows for independent builds and sharing of configurations. ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nvf.url = "github:notashelf/nvf"; }; outputs = {nixpkgs, ...} @ inputs: { packages.x86_64-linux = { default = (inputs.nvf.lib.neovimConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; modules = [ { config.vim = { theme.enable = true; treesitter.enable = true; }; } ]; }).neovim; }; }; } ``` -------------------------------- ### Enable nvim-web-devicons Source: https://nvf.notashelf.dev/options.html Controls whether the nvim-web-devicons plugin is enabled. This plugin provides file-specific icons in the Neovim UI. It requires the nvim-web-devicons plugin to be installed. ```nix vim.visuals.nvim-web-devicons.enable = true; ``` -------------------------------- ### Configure LuaSnip Snippet Loaders Source: https://nvf.notashelf.dev/options.html Specify the Lua code used to load snippet providers for LuaSnip. The default loader is 'from_vscode'. You can switch to other loaders like 'from_snipmate' as shown in the example. ```lua require("luasnip.loaders.from_snipmate").lazy_load() ``` -------------------------------- ### Enable syntax-gaslighting Source: https://nvf.notashelf.dev/options.html Enables the syntax-gaslighting plugin, which provides humorous or misleading messages within the editor. This can be used for playful customization or to simulate certain error conditions. It requires the syntax-gaslighting plugin to be installed. ```nix vim.visuals.syntax-gaslighting.enable = true; ``` -------------------------------- ### Nix: Import Modules with Dynamic Paths Source: https://nvf.notashelf.dev/options.html Demonstrates how to import Nix modules using a dynamically determined path, typically for NixOS configurations. It utilizes the `modulesPath` special argument to locate profiles like `minimal.nix`. ```nix { modulesPath, ... }: { imports = [ (modulesPath + "/profiles/minimal.nix") ]; } ``` -------------------------------- ### Configure Obsidian Neovim Plugin Pickers Source: https://nvf.notashelf.dev/release-notes.html Automatically configures an enabled picker for obsidian.nvim in a specified order (snacks.nvim, mini.nvim, telescope.nvim, fzf-lua). This simplifies setup by selecting the first available picker. ```lua -- Configuration would involve enabling one of these pickers: -- require('telescope').setup { ... } -- require('fzf-lua').setup { ... } ```