如何在文本2和3中使用侧边栏和键盘?

时间:2021-03-22 07:38:44

When using Sublime Text 2 we tend to open the side bar to navigate thru files/folders in our projects. For that we can use the hotkey ctrl+k ctrl+b (in windows).

当使用卓越的文本2时,我们倾向于打开侧边栏来浏览我们项目中的thru文件/文件夹。我们可以使用hotkey ctrl+k ctrl+b(在windows中)。

However, once we're in the side bar, we can't use it with keyboard (arrows for instance). We have to stick using it with our own mouse...

但是,一旦我们在侧栏,我们就不能用键盘(例如箭头)。我们必须坚持用我们自己的鼠标……

Just a note: I installed SideBarEnhancements plugin, but I didn't find anything that could solve my problem.

只是一个提示:我安装了sidebar增强插件,但是我没有找到任何能解决我问题的东西。

Any solution you might know?

有什么解决办法吗?

10 个解决方案

#1


243  

You can type Ctrl+0 (Ctrl+Zero) to focus on the side bar.

您可以键入Ctrl+0 (Ctrl+ 0)以集中在侧栏上。

Then you'll be able to move selection among files with arrow keys and to open the selected file hitting Enter, without touching the mouse.

然后,您将能够在文件中选择箭头键并打开选中的文件,而不触及鼠标。

#2


53  

Another useful shortcut: ctrl + k Together with ctrl + b will show/hide the sidebar. Make sure you hit K and B in the right order

另一个有用的快捷方式:ctrl + k和ctrl + b一起显示/隐藏侧边栏。确保你按正确顺序打了K和B。

#3


32  

I didn't find any other complete answers, so I pulled together information from various answers and added a bit of my own.

我没有找到其他完整的答案,所以我从各种答案中收集了一些信息,并添加了一些我自己的答案。

  • Ctrl+K, Ctrl+B: toggle the sidebar
  • Ctrl+K, Ctrl+B:切换侧边栏。
  • Ctrl+K+B: shorted form of the above (make sure you hit K and B in the right order)
  • 按Ctrl+K+B:做空表格(确保你按正确顺序打了K和B)
  • Ctrl+0: switch focus to the sidebar (if open)
  • Ctrl+0:将焦点切换到侧边栏(如果打开)
  • Up/Down: navigate file list
  • 向上/向下:导航文件列表
  • Right: expand a directory
  • 右:扩大一个目录
  • Left: collapse a directory/navigate to parent directory
  • 左:折叠一个目录/导航到父目录。
  • Enter: open a file
  • 输入:打开一个文件

@Santiago Agüero The part you were missing was that the sidebar needs focus before the arrow keys will work (Ctrl+0).

@Santiago Aguero您所缺少的部分是侧边栏需要在箭头键生效之前(Ctrl+0)。

As far as I can know, these shortcuts all work in Sublime 3, as well as Sublime 2.

据我所知,这些捷径都是崇高的,也是崇高的。

One caveat: these assume you are using the default keybindings. But you can easily customize the keybindings by opening Preferences > Key Bindings - User and copying over lines from Preferences > Key Bindings - Default, changing the keys value as needed. E.g.,

一个警告:这些假定您使用的是默认的键绑定。但是,您可以通过打开首选项>键绑定——用户和从首选项>键绑定——默认情况下,在需要的时候更改键值,轻松自定义keybindings。例如,

{ "keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+0"], "command": "focus_side_bar" },

P.S. To get the fancy-looking keyboard glyphs, use the <kbd> HTML tag. E.g., <kbd>Key</kbd> will turn into Key. (Thanks to https://meta.stackexchange.com/questions/5527) :)

要获得外观漂亮的键盘符号,可以使用 HTML标记。例如,Key将变为关键字。(由于https://meta.stackexchange.com/questions/5527):)

#4


22  

Summary

总结

Ctrl + 0 will navigate to your sidebar. By default you can navigate the folders with your arrow keys. If you prefer 'Vim' type settings, you can avoid using the arrow keys by remapping your keys to the typical Vim settings (hjkl).

Ctrl + 0将导航到你的侧边栏。默认情况下,您可以使用箭头键浏览文件夹。如果您喜欢“Vim”类型设置,可以通过将键重新映射到典型的Vim设置(hjkl)来避免使用箭头键。

  • h will minimize/open a folder
  • h将最小化/打开一个文件夹。
  • j will navigate down (i.e. down arrow)
  • j将向下移动(即向下箭头)
  • k will navigate up (i.e. up arrow)
  • k将向上移动(即向上箭头)
  • l will open up a folder
  • 我将打开一个文件夹。
  • Enter will open the file
  • 输入将打开文件。

Key mappings

键映射

To set this up, open Preferences > Key Bindings - User and add the following:

要设置这个,打开首选项>键绑定-用户并添加以下内容:

{ "keys": ["h"], "command": "move", "args": {"by": "characters", "forward": false}, "context":
    [ {"key": "control", "operand": "sidebar_tree"} ] },
{ "keys": ["j"], "command": "move", "args": {"by": "lines", "forward": true}, "context":
    [ {"key": "control", "operand": "sidebar_tree"} ] },
{ "keys": ["k"], "command": "move", "args": {"by": "lines", "forward": false}, "context":
    [ {"key": "control", "operand": "sidebar_tree"} ] },
{ "keys": ["l"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
    [ {"key": "control", "operand": "sidebar_tree"} ] }

#5


13  

Ctrl+p is also really useful for opening files without using the mouse.

Ctrl+p对于打开文件也很有用,不用鼠标。

If you open a folder in Sublime all the files in that folder (and files in contained folders) will show up in the search you get with Ctrl+p.

如果你打开一个文件夹,将文件夹中的所有文件(以及包含文件夹中的文件)都显示在你用Ctrl+p的搜索中。

Just hit Ctrl+p and start typing parts of the filename and you'll get a list of matches.

只要按下Ctrl+p,然后开始输入文件名,你就会得到一个匹配的列表。

#6


8  

For sublime text 3 use Ctrl+K+B

对于崇高的文本3使用Ctrl+K+B。

Press and hold Ctrl then Press and holdK and then Press and holdB

按下并按下Ctrl然后按下,然后按下,然后按下。

#7


6  

In Sublime Text2, press keys in following format "Ctrl+k+b" and it will work on ubuntu.

在卓越的Text2中,按如下格式按下键“Ctrl+k+b”,它将在ubuntu上运行。

It worked on my machine (v14.04 LTS)

它在我的机器上运行(v14.04 LTS)

#8


5  

For Sublime Text 2 (and also Sublime Text 3) on Windows use Ctrl+0 to focus on the side bar, and use Ctrl+1 or Esc key to focus on the editor. And if it didn't work, use those 0 and 1 keys that exist in the numeric keys row under the function keys row rather than those 0 and 1 keys that exist in the numeric keypad of the keyboard. This image may demonstrate better: http://en.wikipedia.org/wiki/File:Qwerty.svg

对于在Windows上使用Ctrl+0的优秀文本2(以及出色的文本3),将焦点放在侧边栏上,并使用Ctrl+1或Esc键将焦点集中在编辑器上。如果它不工作,使用在函数键行下面的数字键行中存在的0和1键,而不是在键盘的数字键盘中存在的0和1键。这张照片可能更好:http://en.wikipedia.org/wiki/File:Qwerty.svg。

#9


2  

I actually had the same issue, the fact that I had to trigger the reveal in side bar and then move focus to the sidebar, alongside with the fact that if the file's folder was already unfolded the focus would move to the sidebar's top, all this made me write a new plugin to reveal the file in sidebar and then move focus to there, making it a lot easier to navigate the sidebar with keyboard arrows, give it a try =)

我有同样的问题,我不得不在侧边栏,然后触发显示焦点移动到侧边栏,和,如果该文件的文件夹已经展开重点将转移到侧边栏的顶部,这一切让我写一个新的插件显示文件栏,然后再集中到这里,使它更容易导航栏的键盘箭头,试一试=)

https://github.com/miguelgraz/FocusFileOnSidebar

https://github.com/miguelgraz/FocusFileOnSidebar

#10


1  

You have to add a folder to the Sublime Text window in order to navigate via the sidebar. Go to File -> Open Folder... and select the highest directory you want to be able to navigate.

为了通过侧边栏导航,您必须将一个文件夹添加到卓越的文本窗口中。打开文件->打开文件夹…选择您希望能够导航的最高目录。

#1


243  

You can type Ctrl+0 (Ctrl+Zero) to focus on the side bar.

您可以键入Ctrl+0 (Ctrl+ 0)以集中在侧栏上。

Then you'll be able to move selection among files with arrow keys and to open the selected file hitting Enter, without touching the mouse.

然后,您将能够在文件中选择箭头键并打开选中的文件,而不触及鼠标。

#2


53  

Another useful shortcut: ctrl + k Together with ctrl + b will show/hide the sidebar. Make sure you hit K and B in the right order

另一个有用的快捷方式:ctrl + k和ctrl + b一起显示/隐藏侧边栏。确保你按正确顺序打了K和B。

#3


32  

I didn't find any other complete answers, so I pulled together information from various answers and added a bit of my own.

我没有找到其他完整的答案,所以我从各种答案中收集了一些信息,并添加了一些我自己的答案。

  • Ctrl+K, Ctrl+B: toggle the sidebar
  • Ctrl+K, Ctrl+B:切换侧边栏。
  • Ctrl+K+B: shorted form of the above (make sure you hit K and B in the right order)
  • 按Ctrl+K+B:做空表格(确保你按正确顺序打了K和B)
  • Ctrl+0: switch focus to the sidebar (if open)
  • Ctrl+0:将焦点切换到侧边栏(如果打开)
  • Up/Down: navigate file list
  • 向上/向下:导航文件列表
  • Right: expand a directory
  • 右:扩大一个目录
  • Left: collapse a directory/navigate to parent directory
  • 左:折叠一个目录/导航到父目录。
  • Enter: open a file
  • 输入:打开一个文件

@Santiago Agüero The part you were missing was that the sidebar needs focus before the arrow keys will work (Ctrl+0).

@Santiago Aguero您所缺少的部分是侧边栏需要在箭头键生效之前(Ctrl+0)。

As far as I can know, these shortcuts all work in Sublime 3, as well as Sublime 2.

据我所知,这些捷径都是崇高的,也是崇高的。

One caveat: these assume you are using the default keybindings. But you can easily customize the keybindings by opening Preferences > Key Bindings - User and copying over lines from Preferences > Key Bindings - Default, changing the keys value as needed. E.g.,

一个警告:这些假定您使用的是默认的键绑定。但是,您可以通过打开首选项>键绑定——用户和从首选项>键绑定——默认情况下,在需要的时候更改键值,轻松自定义keybindings。例如,

{ "keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+0"], "command": "focus_side_bar" },

P.S. To get the fancy-looking keyboard glyphs, use the <kbd> HTML tag. E.g., <kbd>Key</kbd> will turn into Key. (Thanks to https://meta.stackexchange.com/questions/5527) :)

要获得外观漂亮的键盘符号,可以使用 HTML标记。例如,Key将变为关键字。(由于https://meta.stackexchange.com/questions/5527):)

#4


22  

Summary

总结

Ctrl + 0 will navigate to your sidebar. By default you can navigate the folders with your arrow keys. If you prefer 'Vim' type settings, you can avoid using the arrow keys by remapping your keys to the typical Vim settings (hjkl).

Ctrl + 0将导航到你的侧边栏。默认情况下,您可以使用箭头键浏览文件夹。如果您喜欢“Vim”类型设置,可以通过将键重新映射到典型的Vim设置(hjkl)来避免使用箭头键。

  • h will minimize/open a folder
  • h将最小化/打开一个文件夹。
  • j will navigate down (i.e. down arrow)
  • j将向下移动(即向下箭头)
  • k will navigate up (i.e. up arrow)
  • k将向上移动(即向上箭头)
  • l will open up a folder
  • 我将打开一个文件夹。
  • Enter will open the file
  • 输入将打开文件。

Key mappings

键映射

To set this up, open Preferences > Key Bindings - User and add the following:

要设置这个,打开首选项>键绑定-用户并添加以下内容:

{ "keys": ["h"], "command": "move", "args": {"by": "characters", "forward": false}, "context":
    [ {"key": "control", "operand": "sidebar_tree"} ] },
{ "keys": ["j"], "command": "move", "args": {"by": "lines", "forward": true}, "context":
    [ {"key": "control", "operand": "sidebar_tree"} ] },
{ "keys": ["k"], "command": "move", "args": {"by": "lines", "forward": false}, "context":
    [ {"key": "control", "operand": "sidebar_tree"} ] },
{ "keys": ["l"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
    [ {"key": "control", "operand": "sidebar_tree"} ] }

#5


13  

Ctrl+p is also really useful for opening files without using the mouse.

Ctrl+p对于打开文件也很有用,不用鼠标。

If you open a folder in Sublime all the files in that folder (and files in contained folders) will show up in the search you get with Ctrl+p.

如果你打开一个文件夹,将文件夹中的所有文件(以及包含文件夹中的文件)都显示在你用Ctrl+p的搜索中。

Just hit Ctrl+p and start typing parts of the filename and you'll get a list of matches.

只要按下Ctrl+p,然后开始输入文件名,你就会得到一个匹配的列表。

#6


8  

For sublime text 3 use Ctrl+K+B

对于崇高的文本3使用Ctrl+K+B。

Press and hold Ctrl then Press and holdK and then Press and holdB

按下并按下Ctrl然后按下,然后按下,然后按下。

#7


6  

In Sublime Text2, press keys in following format "Ctrl+k+b" and it will work on ubuntu.

在卓越的Text2中,按如下格式按下键“Ctrl+k+b”,它将在ubuntu上运行。

It worked on my machine (v14.04 LTS)

它在我的机器上运行(v14.04 LTS)

#8


5  

For Sublime Text 2 (and also Sublime Text 3) on Windows use Ctrl+0 to focus on the side bar, and use Ctrl+1 or Esc key to focus on the editor. And if it didn't work, use those 0 and 1 keys that exist in the numeric keys row under the function keys row rather than those 0 and 1 keys that exist in the numeric keypad of the keyboard. This image may demonstrate better: http://en.wikipedia.org/wiki/File:Qwerty.svg

对于在Windows上使用Ctrl+0的优秀文本2(以及出色的文本3),将焦点放在侧边栏上,并使用Ctrl+1或Esc键将焦点集中在编辑器上。如果它不工作,使用在函数键行下面的数字键行中存在的0和1键,而不是在键盘的数字键盘中存在的0和1键。这张照片可能更好:http://en.wikipedia.org/wiki/File:Qwerty.svg。

#9


2  

I actually had the same issue, the fact that I had to trigger the reveal in side bar and then move focus to the sidebar, alongside with the fact that if the file's folder was already unfolded the focus would move to the sidebar's top, all this made me write a new plugin to reveal the file in sidebar and then move focus to there, making it a lot easier to navigate the sidebar with keyboard arrows, give it a try =)

我有同样的问题,我不得不在侧边栏,然后触发显示焦点移动到侧边栏,和,如果该文件的文件夹已经展开重点将转移到侧边栏的顶部,这一切让我写一个新的插件显示文件栏,然后再集中到这里,使它更容易导航栏的键盘箭头,试一试=)

https://github.com/miguelgraz/FocusFileOnSidebar

https://github.com/miguelgraz/FocusFileOnSidebar

#10


1  

You have to add a folder to the Sublime Text window in order to navigate via the sidebar. Go to File -> Open Folder... and select the highest directory you want to be able to navigate.

为了通过侧边栏导航,您必须将一个文件夹添加到卓越的文本窗口中。打开文件->打开文件夹…选择您希望能够导航的最高目录。