How to jump to the other side of selected text?

谁说我不能喝 提交于 2020-07-23 08:14:18

问题


I have selected a text with the cursor.

Now I want to jump to the other side of the text, but how? If I made the selection with the mouse and moved the selection once with + /, I don't find a way to change the cursor position to the other side of the selected text.

Is there any way to make it happen. Maybe a script in PHP/Shell/Applescript?

I am using OS X Mavericks.


回答1:


It took a while, but I have found a way. I use KeyBindings of OS X to reset the side where the cursor of the selection is, by killing the selection and yanking it in one step.

You need to add the following line to your ~/Library/KeyBindings/DefaultKeyBinding.dict file:

"$ " = (deleteToMark:, yankAndSelect:);

If you do not habe such a file you can create and add the line with this command:

echo $'{\n\t"$ " = (deleteToMark:, yankAndSelect:);\n}' > ~/Library/KeyBindings/DefaultKeyBinding.dict

Now the keyboard shortcut + Space can be used to reset the side on which the text insertion cursor is, when you have text selected.

Example:

  1. Select Text
  2. Hold and expand the selection on one side with the arrow keys (like + expands the selection on the left side)
  3. Hit + Space
  4. You can now decide again which side to expand, instead of only expanding/reducing one side (like + expands the selection on the right side)


来源:https://stackoverflow.com/questions/19819644/how-to-jump-to-the-other-side-of-selected-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!