Changed block movement to mimic word movement
This commit is contained in:
parent
9c652086e8
commit
1b2fda2825
|
@ -322,8 +322,8 @@ local translations = {
|
|||
["next-char"] = translate.next_char,
|
||||
["previous-word-start"] = translate.previous_word_start,
|
||||
["next-word-end"] = translate.next_word_end,
|
||||
["previous-start-of-block"] = translate.previous_start_of_block,
|
||||
["next-start-of-block"] = translate.next_start_of_block,
|
||||
["previous-block-start"] = translate.previous_block_start,
|
||||
["next-block-end"] = translate.next_block_end,
|
||||
["start-of-doc"] = translate.start_of_doc,
|
||||
["end-of-doc"] = translate.end_of_doc,
|
||||
["start-of-line"] = translate.start_of_line,
|
||||
|
|
|
@ -85,30 +85,30 @@ function translate.end_of_word(doc, line, col)
|
|||
end
|
||||
|
||||
|
||||
function translate.previous_start_of_block(doc, line, col)
|
||||
function translate.previous_block_start(doc, line, col)
|
||||
while true do
|
||||
line = line - 1
|
||||
if line <= 1 then
|
||||
return 1, 1
|
||||
end
|
||||
if doc.lines[line-1]:match("^%s*$")
|
||||
and not doc.lines[line]:match("^%s*$") then
|
||||
if doc.lines[line-1]:find("^%s*$")
|
||||
and not doc.lines[line]:find("^%s*$") then
|
||||
return line, (doc.lines[line]:find("%S"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function translate.next_start_of_block(doc, line, col)
|
||||
function translate.next_block_end(doc, line, col)
|
||||
while true do
|
||||
line = line + 1
|
||||
if line >= #doc.lines then
|
||||
return #doc.lines, 1
|
||||
end
|
||||
if doc.lines[line-1]:match("^%s*$")
|
||||
and not doc.lines[line]:match("^%s*$") then
|
||||
return line, (doc.lines[line]:find("%S"))
|
||||
if doc.lines[line+1]:find("^%s*$")
|
||||
and not doc.lines[line]:find("^%s*$") then
|
||||
return line+1, #doc.lines[line+1]
|
||||
end
|
||||
line = line + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -157,8 +157,8 @@ keymap.add {
|
|||
["down"] = { "command:select-next", "doc:move-to-next-line" },
|
||||
["ctrl+left"] = "doc:move-to-previous-word-start",
|
||||
["ctrl+right"] = "doc:move-to-next-word-end",
|
||||
["ctrl+["] = "doc:move-to-previous-start-of-block",
|
||||
["ctrl+]"] = "doc:move-to-next-start-of-block",
|
||||
["ctrl+["] = "doc:move-to-previous-block-start",
|
||||
["ctrl+]"] = "doc:move-to-next-block-end",
|
||||
["home"] = "doc:move-to-start-of-line",
|
||||
["end"] = "doc:move-to-end-of-line",
|
||||
["ctrl+home"] = "doc:move-to-start-of-doc",
|
||||
|
@ -172,8 +172,8 @@ keymap.add {
|
|||
["shift+down"] = "doc:select-to-next-line",
|
||||
["ctrl+shift+left"] = "doc:select-to-previous-word-start",
|
||||
["ctrl+shift+right"] = "doc:select-to-next-word-end",
|
||||
["ctrl+shift+["] = "doc:select-to-previous-start-of-block",
|
||||
["ctrl+shift+]"] = "doc:select-to-next-start-of-block",
|
||||
["ctrl+shift+["] = "doc:select-to-previous-block-start",
|
||||
["ctrl+shift+]"] = "doc:select-to-next-block-end",
|
||||
["shift+home"] = "doc:select-to-start-of-line",
|
||||
["shift+end"] = "doc:select-to-end-of-line",
|
||||
["ctrl+shift+home"] = "doc:select-to-start-of-doc",
|
||||
|
|
Loading…
Reference in a new issue