Home Download Buy Blog Forum Support

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

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

Postby singw on Tue Jun 12, 2012 11:56 am

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:
singw
 
Posts: 59
Joined: Fri Aug 05, 2011 2:16 pm

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

Postby tito on Tue Jun 12, 2012 8:55 pm

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.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

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

Postby tito on Tue Jun 12, 2012 9:40 pm

Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

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

Postby singw on Wed Jun 13, 2012 2:05 am

tito wrote: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.

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.
singw
 
Posts: 59
Joined: Fri Aug 05, 2011 2:16 pm

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

Postby tito on Wed Jun 13, 2012 2:48 am

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

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.

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.

True, I can't rememebr how I discovered the command. It was something like a search for "eol".

wich returns this:
Code: Select all
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


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

Code: Select all
   { "keys": ["home"], "command": "move_to", "args": {"to": "hardbol", "extend": false} },
   { "keys": ["end"], "command": "move_to", "args": {"to": "hardeol", "extend": false} },
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

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

Postby singw on Wed Jun 13, 2012 10:36 am

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

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.

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.

True, I can't rememebr how I discovered the command. It was something like a search for "eol".

wich returns this:
Code: Select all
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


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

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


thx.
just wrote to get some help in Technical Support for writing the code at viewtopic.php?f=3&t=7488 .
singw
 
Posts: 59
Joined: Fri Aug 05, 2011 2:16 pm

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

Postby singw on Fri Jun 22, 2012 6:55 am

Could someone help writing the keybinding code for this?
I tried
Code: Select all
{ "keys": ["end"], "command": "move_to", "args": {"to": "hardeol", "extend": false}, "context":
      [
         { "key": "following_text", "operator": "not_regex_contains", "operand": "$", "match_all": true }
      ]
   }


, but it didn't work. Is there a character for soft eol for the "operand"?
singw
 
Posts: 59
Joined: Fri Aug 05, 2011 2:16 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 23 guests