- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 162
Open
Description
Hey,
I am having some trouble creating the key-values pairs for the setupOpts. I dont really understaind how the conversion works.
Mostly with the keymaps.
In the lua code, there is no key for the first element, but I guess the setupOpts requires one. So I dont really know what to do.
Nix code:
  setupOpts = {
      columns = [ "icon" ];
      keymaps = {
        "g?" = { "1" = "actions.show_help"; mode = "n"; };
        "<CR>" = "actions.select";
        "<C-p>" = "actions.preview";
        "<C-c>" = { "1" = "actions.close"; mode = "n"; };
        "<C-l>" = "actions.refresh";
        "<BS>" = { "1" = "actions.parent"; mode = "n"; };
        "<A-BS>" = { "1" = "actions.open_cwd"; mode = "n"; };
        "g." = { "1" = "actions.toggle_hidden"; mode = "n"; };
      };
      use_default_keymaps = false;
      view_options = {
        show_hidden = true;
      };
    };
original lua code:
		require("oil").setup({
			columns = {
				"icon",
				-- "permissions",
				-- "size",
				-- "mtime",
			},
			keymaps = {
				["g?"] = { "actions.show_help", mode = "n" },
				["<CR>"] = "actions.select",
				["<C-p>"] = "actions.preview",
				["<C-c>"] = { "actions.close", mode = "n" },
				["<C-l>"] = "actions.refresh",
				["<BS>"] = { "actions.parent", mode = "n" },
				["<A-BS>"] = { "actions.open_cwd", mode = "n" },
				["g."] = { "actions.toggle_hidden", mode = "n" },
				["gd"] = {
					desc = "Toggle file detail view",
					callback = function()
						detail = not detail
						if detail then
							require("oil").set_columns({ "icon", "permissions", "size", "mtime" })
						else
							require("oil").set_columns({ "icon" })
						end
					end,
				},
			},
			use_default_keymaps = false,
			view_options = {
				show_hidden = true,
			},
		})
Metadata
Metadata
Assignees
Labels
No labels