enhance s
This commit is contained in:
parent
4fc1d4d77b
commit
14d055c118
|
@ -33,7 +33,7 @@ Undefined parameters are (mostly) treated as 1.
|
||||||
1. `Up`/`Down`: restore to the history command sequence
|
1. `Up`/`Down`: restore to the history command sequence
|
||||||
2. `h`/`v`: split the current region horizontally/vertically into 2 regions. The split will respect the ratio A:B.
|
2. `h`/`v`: split the current region horizontally/vertically into 2 regions. The split will respect the ratio A:B.
|
||||||
3. `w`: Take two parameters (A, B), and split the current region equally into A columns and B rows. If no parameter is defined, behave the same as `Space` without parameters.
|
3. `w`: Take two parameters (A, B), and split the current region equally into A columns and B rows. If no parameter is defined, behave the same as `Space` without parameters.
|
||||||
4. `s`: shift the current editing region with other open sibling regions.
|
4. `s`: shift the current editing region with other open sibling regions. If A is defined, shift for A times.
|
||||||
5. `Space` or `-`: Without parameters, close the current region and move to the next open region. With parameters, set the maximum depth of splitting (default is 2).
|
5. `Space` or `-`: Without parameters, close the current region and move to the next open region. With parameters, set the maximum depth of splitting (default is 2).
|
||||||
6. `Enter`/`.`: close all open regions. When all regions are closed, press `Enter` will save the layout and exit the editor.
|
6. `Enter`/`.`: close all open regions. When all regions are closed, press `Enter` will save the layout and exit the editor.
|
||||||
7. `Backspace`: undo the last command.
|
7. `Backspace`: undo the last command.
|
||||||
|
|
|
@ -386,14 +386,14 @@ function start_editor(data)
|
||||||
elseif key == "s" or key == "S" then
|
elseif key == "s" or key == "S" then
|
||||||
if #open_areas > 0 then
|
if #open_areas > 0 then
|
||||||
key = "s"
|
key = "s"
|
||||||
|
local times = num_1 or 1
|
||||||
local top = pop_open_area()
|
local top = pop_open_area()
|
||||||
local t = {}
|
local t = {top}
|
||||||
while #open_areas > 0 and open_areas[#open_areas].depth == top.depth do
|
while #open_areas > 0 and open_areas[#open_areas].depth == top.depth do
|
||||||
t[#t + 1] = pop_open_area()
|
t[#t + 1] = pop_open_area()
|
||||||
end
|
end
|
||||||
open_areas[#open_areas + 1] = top
|
|
||||||
for i = #t, 1, -1 do
|
for i = #t, 1, -1 do
|
||||||
open_areas[#open_areas + 1] = t[i]
|
open_areas[#open_areas + 1] = t[(i + times - 1) % #t + 1]
|
||||||
end
|
end
|
||||||
num_1 = nil
|
num_1 = nil
|
||||||
num_2 = nil
|
num_2 = nil
|
||||||
|
|
Loading…
Reference in New Issue