forked from iGio90/filemanager-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.lua
More file actions
36 lines (28 loc) · 924 Bytes
/
action.lua
File metadata and controls
36 lines (28 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
local config = import('micro/config')
local micro = import('micro')
local os = import('os')
local golib_ioutil = import('ioutil')
local buffer = import('micro/buffer')
local filepath = import('path/filepath')
local Action = {}
Action.__index = Action
-- Return a new object used when adding to scanlist
function Action:new(tab)
local instance = setmetatable({}, Action)
instance.tab = tab
return instance
end
function Action:cursor_move_down()
-- self.pane.Cursor:Down()
self:highlight_current_line()
end
-- (Tries to) go load one "step" from the current directory
function Action:load_back_directory()
local current_dir = self.tab.current_directory
local one_back_directory = filepath.Dir(current_dir)
-- Try opening, assuming they aren't at "root", by checking if it matches last dir
if one_back_directory ~= current_dir then
self.tab:load(one_back_directory)
end
end
return Action