Sublime Text 2: how to position cursor at begin/en

2019-03-11 16:19发布

问题:

I feel silly having to ask what seems like a basic question. I've Googled plenty, and I've examined the Default(OSX).sublime-keymap file, but I can't figure out:

How can I make the cursor jump to the beginning/end of the current buffer in Sublime2 on OSX?

Home/End scroll to the top/bottom respectively, but they do not position the cursor at the begin/end of the buffer.

Surely there is a way to do this. Some apps (e.g. Intellij) use CMD+Home/End for this, but that doesn't work either.

回答1:

These work for me (Sublime Text 2 v2.0.1 on OS X 10.7.5)

  • ⌘-↑: start of buffer
  • ⌘-↓: end of buffer

The CMD-up and -down combos are the default shortcut for moving to the start and end of text buffers on OS X. They work in Safari text areas, too, for example. As such, they are not listed in the keymap file.



回答2:

In windows you can use

Ctrl + Home -> to the beginning of the file
Ctrl + End -> to the end of the file



回答3:

to customize short cut for "move to beginning of file" and "move to end of file"

{ "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof"} },
{ "keys": ["ctrl+end"], "command": "move_to", "args": {"to": "eof"} },
{ "keys": ["ctrl+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true} },
{ "keys": ["ctrl+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true } },


回答4:

An "almost" solution: as per standard OSX keybindings, shift + home/end will move the cursor from the current position to home/end, and select the text in-between. A side effect of this is that the cursor is positioned at home/end.

I would still like to know how to do this without selecting the intermediate text.



回答5:

Darwin abcmacbook.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:06 PDT 2015; root:xnu-2782.20.48~5/DEVELOPMENT_X86_64 x86_64

OSX Yosemite Version: 10.10.3 (14D136)

In Sublime Text Stable Channel build 3083:

Command + down arrow takes me to end of buffer

Command + up arrow takes me to beginning of buffer



回答6:

See if this works

beginning » CMD + left arrow

end » CMD + Right arrow