macos Sublime Text 2:如何将光标定位在缓冲区的开头/结尾?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11479195/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 09:19:52  来源:igfitidea点击:

Sublime Text 2: how to position cursor at begin/end of buffer?

macoskeyboard-shortcutssublimetext2

提问by George Armhold

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:

不得不问一个看似基本的问题,我觉得很傻。我在谷歌上搜索了很多,并且检查了 Default(OSX).sublime-keymap 文件,但我无法弄清楚:

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

如何在 OSX 上的 Sublime2 中使光标跳转到当前缓冲区的开头/结尾?

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

Home/End 分别滚动到顶部/底部,但它们不会将光标定位在缓冲区的开始/结束处。

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.

当然有办法做到这一点。某些应用程序(例如 Intellij)为此使用 CMD+Home/End,但这也不起作用。

回答by Martijn Pieters

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

这些对我有用(OS X 10.7.5 上的 Sublime Text 2 v2.0.1)

  • ?-↑: 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.

CMD-up 和 -down 组合是在 OS X 上移动到文本缓冲区开头和结尾的默认快捷方式。例如,它们也适用于 Safari 文本区域。因此,它们未列在键映射文件中。

回答by Deepak Lamichhane

In windows you can use

在 Windows 中,您可以使用

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

Ctrl+ Home-> 到文件的开头
Ctrl+ End-> 到文件的结尾

回答by lbsweek

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 } },

回答by Ankur Agarwal

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:

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

OSX 优胜美地版本:10.10.3 (14D136)

在 Sublime Text 稳定频道 build 3083 中:

Command + down arrow takes me to end of buffer

命令 + 向下箭头带我到缓冲区的末尾

Command + up arrow takes me to beginning of buffer

命令 + 向上箭头带我到缓冲区的开头

回答by George Armhold

An "almost" solution: as per standard OSX keybindings, shift + home/endwill 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.

一个“几乎”的解决方案:根据标准的 OSX 键绑定,shift + home/end将光标从当前位置移动到home/end,然后选择中间的文本。这样做的副作用是光标位于home/end

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

我仍然想知道如何在不选择中间文本的情况下执行此操作。

回答by rafayama

See if this works

看看这是否有效

beginning ? CMD + left arrow

开始?CMD + 左箭头

end ? CMD + Right arrow

结尾 ?CMD + 右箭头