Also call save_dir when opening parent

This commit is contained in:
Thomas Avé 2024-04-10 13:46:15 +02:00
parent 2f01eaf9f9
commit d2bf13d6f6
1 changed files with 7 additions and 6 deletions

View File

@ -1,11 +1,12 @@
local function store_select()
require("oil").select({}, function()
local function save_dir()
local dir = require("oil").get_current_dir()
if dir ~= nil then
local f = io.open("/tmp/oil_dir", "w")
if f then
f:write(require("oil").get_current_dir())
f:write(dir)
f:close()
end
end)
end
end
return {
@ -14,13 +15,13 @@ return {
opts = {
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = store_select,
["<CR>"] = function() require("oil").select({}, save_dir) end,
["<leader>v"] = "actions.select_vsplit",
["<leader>s"] = "actions.select_split",
["<leader>p"] = "actions.preview",
["<backspace>"] = "actions.close",
["<leader>r"] = "actions.refresh",
["-"] = "actions.parent",
["-"] = function() require("oil").open(); save_dir() end,
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",