Sublime Forum

Can't go to the begin & end of a wrapped line using keyword?

#1

When a single line is wrapped into to 2 lines in view, say Line 1 & Line 2,
pressing the key “end” on Line 1, the caret will go to Line 1’s end, but when “end” is pressed again, it will not go to Line 2’s end.
The same situation is also happened when going to the beginning of Line 1 from Line 2 using the key “home”.

Could this behavior be added to Sublime Text? I am missing this feature when switching from Notepad++. :cry:

0 Likes

Cannot use the same key for "eol" and "hardeol"
#2

Look at file Default (Windows).sublime-keymap
There search for “end” and “home”, the thing should be obvious.

hardbol = hard beginning of line
hardeol = hard end of line.

tweaks the settings for what you expect.

0 Likes

#3

docs.sublimetext.info/en/latest/ … dings.html

0 Likes

#4

[quote=“tito”]Look at file Default (Windows).sublime-keymap
There search for “end” and “home”, the thing should be obvious.

hardbol = hard beginning of line
hardeol = hard end of line.

tweaks the settings for what you expect.[/quote]

thx. but can these 2 action (“eol” & “hardeol”, “bol” & “hardbol”) combine to 1 key, as I described on the 1st post?

P.S. just to remind that the “hardbol” & “hardeol” is not on the keymapping file before, and it cannot be found in the doc you posted.

0 Likes

#5

[quote]thx. but can these 2 action (“eol” & “hardeol”, “bol” & “hardbol”) combine to 1 key, as I described on the 1st post?
[/quote]

Nice question, it is possible. Now, I’m not sure of the best way to do it. You need to take care of the selections.

True, I can’t rememebr how I discovered the command. It was something like a search for “eol”.

wich returns this:

[code]Searching 77 files for “hardeol”

C:\Users\luna\AppData\Roaming\Sublime Text 2\Packages\Default\Add Line in Braces.sublime-macro:
2 {“command”: “insert”, “args”: {“characters”: “\n\n”} },
3 {“command”: “move”, “args”: {“by”: “lines”, “forward”: false} },
4: {“command”: “move_to”, “args”: {“to”: “hardeol”, “extend”: false} },
5 {“command”: “reindent”, “args”: {“single_line”: true} }
6 ]

C:\Users\luna\AppData\Roaming\Sublime Text 2\Packages\Default\Add Line.sublime-macro:
1
2: {“command”: “move_to”, “args”: {“to”: “hardeol”}},
3 {“command”: “insert”, “args”: {“characters”: “\n”}}
4 ]

C:\Users\luna\AppData\Roaming\Sublime Text 2\Packages\Default\Delete to Hard EOL.sublime-macro:
1
2: {“command”: “move_to”, “args”: {“to”: “hardeol”, “extend”: true}},
3 {“command”: “add_to_kill_ring”, “args”: {“forward”: true}},
4 {“command”: “right_delete”}

3 matches across 3 files
[/code]

I have set this some time ago in my user/Default.sublime-keymap

{ "keys": "home"], "command": "move_to", "args": {"to": "hardbol", "extend": false} }, { "keys": "end"], "command": "move_to", "args": {"to": "hardeol", "extend": false} },

0 Likes

#6

Nice question, it is possible. Now, I’m not sure of the best way to do it. You need to take care of the selections.

True, I can’t rememebr how I discovered the command. It was something like a search for “eol”.

wich returns this:

[code]Searching 77 files for “hardeol”

C:\Users\luna\AppData\Roaming\Sublime Text 2\Packages\Default\Add Line in Braces.sublime-macro:
2 {“command”: “insert”, “args”: {“characters”: “\n\n”} },
3 {“command”: “move”, “args”: {“by”: “lines”, “forward”: false} },
4: {“command”: “move_to”, “args”: {“to”: “hardeol”, “extend”: false} },
5 {“command”: “reindent”, “args”: {“single_line”: true} }
6 ]

C:\Users\luna\AppData\Roaming\Sublime Text 2\Packages\Default\Add Line.sublime-macro:
1
2: {“command”: “move_to”, “args”: {“to”: “hardeol”}},
3 {“command”: “insert”, “args”: {“characters”: “\n”}}
4 ]

C:\Users\luna\AppData\Roaming\Sublime Text 2\Packages\Default\Delete to Hard EOL.sublime-macro:
1
2: {“command”: “move_to”, “args”: {“to”: “hardeol”, “extend”: true}},
3 {“command”: “add_to_kill_ring”, “args”: {“forward”: true}},
4 {“command”: “right_delete”}

3 matches across 3 files
[/code]

I have set this some time ago in my user/Default.sublime-keymap

{ "keys": "home"], "command": "move_to", "args": {"to": "hardbol", "extend": false} }, { "keys": "end"], "command": "move_to", "args": {"to": "hardeol", "extend": false} },[/quote]

thx.
just wrote to get some help in Technical Support for writing the code at Cannot use the same key for "eol" and "hardeol" .

0 Likes

#7

Could someone help writing the keybinding code for this?
I tried

[code]{ “keys”: “end”], “command”: “move_to”, “args”: {“to”: “hardeol”, “extend”: false}, “context”:

		{ "key": "following_text", "operator": "not_regex_contains", "operand": "$", "match_all": true }
	]
}[/code]

, but it didn’t work. Is there a character for soft eol for the “operand”?

0 Likes