PhpStorm环绕/环绕选择? [英] PhpStorm wrap/surround selection?
问题描述
通常在编码和模板制作中,我需要包装文本的特定部分.是否有包装当前选择内容的快捷方式,例如:
Often in coding and templating I need to wrap a certain part of text. Is there any shortcut to wrap the current selection, for example:
Hello World
"Hello World"
Hello World
{{ trans 'Hello World' }}
我在Mac和PC上使用PhpStorm 7.我发现了一些类似的东西,其中包括: ctrl + alt + j ,您可以使用html标签包装其他物品.同样, ctrl + alt + -会根据当前文件格式(php,twig,html,...)注释当前选择内容>
Im using PhpStorm 7 for Mac and PC. I found something similiar, with: ctrl+alt+j you can wrap with a html-tag but nothing else. Also ctrl+alt+- comments the current selection according to the current file format(php, twig, html, ...)
推荐答案
我知道这是一个较晚的答案,但是我希望所有遇到此问题的人都能得到帮助.
在PhpStorm中,几乎所有的东西都可以配置,但是有点棘手,需要一些学习曲线.
I know this is a little late answer, but I hope anyone who looks this question get helped.
In PhpStorm, almost everything can be configured but a little tricky and takes some learning curve.
选择一个单词并用单引号(或双引号)括起来是一种非常普遍的行为.
It's very common behaviour that select a word and type single quote (or double quote) to surround it.
Hello World
'Hello World'
"Hello World"
要启用此功能,请选中 Preferences -> IDE -> Editor -> Smart Keys -> Surround Selection on typing quote or brace
的复选框.
To enable this, tick on checkbox of Preferences -> IDE -> Editor -> Smart Keys -> Surround Selection on typing quote or brace
.
另一种方法是,选择某些内容(单词,条件),然后按 Cmd + Alt + T (在Mac上), Ctrl + Alt + T (在Windows上).将显示可用的 Surround With
选项对话框.
Another way, you select something (word, condition) and press Cmd + Alt + T (on Mac) , Ctrl + Alt + T (on Windows). Available Surround With
options dialog box will be displayed.
对于 PhpStorm版本8 ,请选中 Preferences -> Editor -> General -> Smart Keys -> Surround selection on typing quote or brace
的复选框.
For PhpStorm Version 8, tick on checkbox of Preferences -> Editor -> General -> Smart Keys -> Surround selection on typing quote or brace
.
对于 PhpStorm 2016版,请使用 Cmd + Alt + S (在Mac上)或 Ctrl + Alt + S (在Win上)转到设置.勾选设置->编辑器->常规->智能键->键入引号或花括号的环绕声选择.
For PhpStorm Version 2016, use Cmd + Alt + S (on Mac) or Ctrl + Alt + S (on Win) to go to Settings. Tick on checkbox of Settings -> Editor -> General -> Smart Keys -> Surround selection on typing quote or brace`.
这篇关于PhpStorm环绕/环绕选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!