Changed behaviour of home.
This commit is contained in:
parent
0b2bf227a8
commit
2bf56e67c5
|
@ -418,6 +418,7 @@ local translations = {
|
||||||
["start-of-line"] = translate.start_of_line,
|
["start-of-line"] = translate.start_of_line,
|
||||||
["end-of-line"] = translate.end_of_line,
|
["end-of-line"] = translate.end_of_line,
|
||||||
["start-of-word"] = translate.start_of_word,
|
["start-of-word"] = translate.start_of_word,
|
||||||
|
["start-of-indentation"] = translate.start_of_indentation,
|
||||||
["end-of-word"] = translate.end_of_word,
|
["end-of-word"] = translate.end_of_word,
|
||||||
["previous-line"] = DocView.translate.previous_line,
|
["previous-line"] = DocView.translate.previous_line,
|
||||||
["next-line"] = DocView.translate.next_line,
|
["next-line"] = DocView.translate.next_line,
|
||||||
|
|
|
@ -117,6 +117,10 @@ function translate.start_of_line(doc, line, col)
|
||||||
return line, 1
|
return line, 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function translate.start_of_indentation(doc, line, col)
|
||||||
|
local s, e = doc.lines[line]:find("^%s*")
|
||||||
|
return line, col > e + 1 and e + 1 or 1
|
||||||
|
end
|
||||||
|
|
||||||
function translate.end_of_line(doc, line, col)
|
function translate.end_of_line(doc, line, col)
|
||||||
return line, math.huge
|
return line, math.huge
|
||||||
|
|
|
@ -80,7 +80,7 @@ local function keymap_macos(keymap)
|
||||||
["cmd+right"] = "doc:move-to-next-word-end",
|
["cmd+right"] = "doc:move-to-next-word-end",
|
||||||
["cmd+["] = "doc:move-to-previous-block-start",
|
["cmd+["] = "doc:move-to-previous-block-start",
|
||||||
["cmd+]"] = "doc:move-to-next-block-end",
|
["cmd+]"] = "doc:move-to-next-block-end",
|
||||||
["home"] = "doc:move-to-start-of-line",
|
["home"] = "doc:move-to-start-of-indentation",
|
||||||
["end"] = "doc:move-to-end-of-line",
|
["end"] = "doc:move-to-end-of-line",
|
||||||
["cmd+home"] = "doc:move-to-start-of-doc",
|
["cmd+home"] = "doc:move-to-start-of-doc",
|
||||||
["cmd+end"] = "doc:move-to-end-of-doc",
|
["cmd+end"] = "doc:move-to-end-of-doc",
|
||||||
|
|
|
@ -184,7 +184,7 @@ keymap.add_direct {
|
||||||
["ctrl+right"] = "doc:move-to-next-word-end",
|
["ctrl+right"] = "doc:move-to-next-word-end",
|
||||||
["ctrl+["] = "doc:move-to-previous-block-start",
|
["ctrl+["] = "doc:move-to-previous-block-start",
|
||||||
["ctrl+]"] = "doc:move-to-next-block-end",
|
["ctrl+]"] = "doc:move-to-next-block-end",
|
||||||
["home"] = "doc:move-to-start-of-line",
|
["home"] = "doc:move-to-start-of-indentation",
|
||||||
["end"] = "doc:move-to-end-of-line",
|
["end"] = "doc:move-to-end-of-line",
|
||||||
["ctrl+home"] = "doc:move-to-start-of-doc",
|
["ctrl+home"] = "doc:move-to-start-of-doc",
|
||||||
["ctrl+end"] = "doc:move-to-end-of-doc",
|
["ctrl+end"] = "doc:move-to-end-of-doc",
|
||||||
|
|
Loading…
Reference in New Issue