Customized fork of github.com/rxi/lite

Changed block movement to mimic word movement

rxi 1b2fda28 9c652086

Changed files
+14 -14
data
core
+2 -2
data/core/commands/doc.lua
··· 322 ["next-char"] = translate.next_char, 323 ["previous-word-start"] = translate.previous_word_start, 324 ["next-word-end"] = translate.next_word_end, 325 - ["previous-start-of-block"] = translate.previous_start_of_block, 326 - ["next-start-of-block"] = translate.next_start_of_block, 327 ["start-of-doc"] = translate.start_of_doc, 328 ["end-of-doc"] = translate.end_of_doc, 329 ["start-of-line"] = translate.start_of_line,
··· 322 ["next-char"] = translate.next_char, 323 ["previous-word-start"] = translate.previous_word_start, 324 ["next-word-end"] = translate.next_word_end, 325 + ["previous-block-start"] = translate.previous_block_start, 326 + ["next-block-end"] = translate.next_block_end, 327 ["start-of-doc"] = translate.start_of_doc, 328 ["end-of-doc"] = translate.end_of_doc, 329 ["start-of-line"] = translate.start_of_line,
+8 -8
data/core/doc/translate.lua
··· 85 end 86 87 88 - function translate.previous_start_of_block(doc, line, col) 89 while true do 90 line = line - 1 91 if line <= 1 then 92 return 1, 1 93 end 94 - if doc.lines[line-1]:match("^%s*$") 95 - and not doc.lines[line]:match("^%s*$") then 96 return line, (doc.lines[line]:find("%S")) 97 end 98 end 99 end 100 101 102 - function translate.next_start_of_block(doc, line, col) 103 while true do 104 - line = line + 1 105 if line >= #doc.lines then 106 return #doc.lines, 1 107 end 108 - if doc.lines[line-1]:match("^%s*$") 109 - and not doc.lines[line]:match("^%s*$") then 110 - return line, (doc.lines[line]:find("%S")) 111 end 112 end 113 end 114
··· 85 end 86 87 88 + function translate.previous_block_start(doc, line, col) 89 while true do 90 line = line - 1 91 if line <= 1 then 92 return 1, 1 93 end 94 + if doc.lines[line-1]:find("^%s*$") 95 + and not doc.lines[line]:find("^%s*$") then 96 return line, (doc.lines[line]:find("%S")) 97 end 98 end 99 end 100 101 102 + function translate.next_block_end(doc, line, col) 103 while true do 104 if line >= #doc.lines then 105 return #doc.lines, 1 106 end 107 + if doc.lines[line+1]:find("^%s*$") 108 + and not doc.lines[line]:find("^%s*$") then 109 + return line+1, #doc.lines[line+1] 110 end 111 + line = line + 1 112 end 113 end 114
+4 -4
data/core/keymap.lua
··· 157 ["down"] = { "command:select-next", "doc:move-to-next-line" }, 158 ["ctrl+left"] = "doc:move-to-previous-word-start", 159 ["ctrl+right"] = "doc:move-to-next-word-end", 160 - ["ctrl+["] = "doc:move-to-previous-start-of-block", 161 - ["ctrl+]"] = "doc:move-to-next-start-of-block", 162 ["home"] = "doc:move-to-start-of-line", 163 ["end"] = "doc:move-to-end-of-line", 164 ["ctrl+home"] = "doc:move-to-start-of-doc", ··· 172 ["shift+down"] = "doc:select-to-next-line", 173 ["ctrl+shift+left"] = "doc:select-to-previous-word-start", 174 ["ctrl+shift+right"] = "doc:select-to-next-word-end", 175 - ["ctrl+shift+["] = "doc:select-to-previous-start-of-block", 176 - ["ctrl+shift+]"] = "doc:select-to-next-start-of-block", 177 ["shift+home"] = "doc:select-to-start-of-line", 178 ["shift+end"] = "doc:select-to-end-of-line", 179 ["ctrl+shift+home"] = "doc:select-to-start-of-doc",
··· 157 ["down"] = { "command:select-next", "doc:move-to-next-line" }, 158 ["ctrl+left"] = "doc:move-to-previous-word-start", 159 ["ctrl+right"] = "doc:move-to-next-word-end", 160 + ["ctrl+["] = "doc:move-to-previous-block-start", 161 + ["ctrl+]"] = "doc:move-to-next-block-end", 162 ["home"] = "doc:move-to-start-of-line", 163 ["end"] = "doc:move-to-end-of-line", 164 ["ctrl+home"] = "doc:move-to-start-of-doc", ··· 172 ["shift+down"] = "doc:select-to-next-line", 173 ["ctrl+shift+left"] = "doc:select-to-previous-word-start", 174 ["ctrl+shift+right"] = "doc:select-to-next-word-end", 175 + ["ctrl+shift+["] = "doc:select-to-previous-block-start", 176 + ["ctrl+shift+]"] = "doc:select-to-next-block-end", 177 ["shift+home"] = "doc:select-to-start-of-line", 178 ["shift+end"] = "doc:select-to-end-of-line", 179 ["ctrl+shift+home"] = "doc:select-to-start-of-doc",