{
  pkgs,
  lib,
  ...
}: {
  programs.nixvim = {
    # TODO: package goto-preview though a module
    extraConfigLuaPost = ''
      ${lib.strings.fileContents ./lua/goto-preview.lua}
    '';
    extraPlugins = [
      pkgs.vimPlugins.goto-preview
    ];
    keymaps = [
      {
        key = "<space>gd";
        mode = "n";
        action = "require('goto-preview').goto_preview_definition";
        lua = true;
        options.desc = "[G]oto [D]efinition";
      }
      {
        key = "<space>gtd";
        mode = "n";
        action = "require('goto-preview').goto_preview_type_definition";
        lua = true;
        options.desc = "[G]oto the [t]ype [D]efinition";
      }
      {
        key = "<space>gi";
        mode = "n";
        action = "require('goto-preview').goto_preview_implementation";
        lua = true;
        options.desc = "[G]oto [I]mplementations";
      }
      {
        key = "<space>gr";
        mode = "n";
        action = "require('goto-preview').goto_preview_references";
        lua = true;
        options.desc = "[G]o to all [R]eferences of the symbol";
      }
      {
        key = "\\<space>";
        mode = "n";
        action = "require('goto-preview').close_all_win";
        lua = true;
        options.desc = "close all preview windows";
      }
    ];
  };
}