PhpStorm 环绕/环绕选择? [英] PhpStorm wrap/surround selection?

查看:40
本文介绍了PhpStorm 环绕/环绕选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常在编码和模板中,我需要包装文本的某个部分.是否有任何快捷方式来包装当前选择,例如:

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-tag 包装,但没有别的.另外 ctrl+alt+- 根据当前文件格式(php, twig, html, ...)注释当前选择p>

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->编辑器->智能钥匙 ->键入引号或大括号时环绕选择.

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 -> 的复选框编辑器->一般->智能钥匙 ->输入引号或大括号时环绕选择.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆