可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):

问题:

I want to comment out a block of code in sublime text.

I see it in RailsCasts, but don't think he uses sublime text ... to do the following ...

if (uncommented)

some uncommented example

# if (commented)

# some commented example code

# end

end

Is there a shortcut in sublime text that I can use to insert the block of #'s?

回答1:

The shortcut to comment out or uncomment the selected text or current line:

Windows: Ctrl+/

Mac: Command ⌘+/

Linux: Ctrl+Shift+/

Alternatively, use the menu: Edit > Comment

For the block comment you may want to use:

Windows: Ctrl+Shift+/

Mac: Command ⌘+Option/Alt+/

回答2:

You're looking for the toggle_comment command. (Edit > Comment > Toggle Comment)

By default, this command is mapped to:

Ctrl+/ (On Windows and Linux)

Command ⌘+/ (On Mac)

This command also takes a block argument, which allows you to use block comments instead of single lines (e.g. /* ... */ as opposed to // ... in JavaScript). By default, the following key combinations are mapped to toggle block comments:

Ctrl+Shift+/ (On Windows and Linux)

Command ⌘+Alt+/ (On Mac)

回答3:

With a non-US keyboard layout the default shortcut Ctrl+/ (Win/Linux) does not work.

I managed to change it into Ctrl+1 as per Robert's comment by writing

[

{

"keys": ["ctrl+1"],

"command": "toggle_comment",

"args": { "block": false }

}

,

{ "keys": ["ctrl+shift+1"],

"command": "toggle_comment",

"args": { "block": true }

}

]

to Preferences -> Key Bindings (on the right half, the user keymap).

Note that there should be only one set of brackets ('[]') at the right side; if you had there something already, copy paste this between the brackets and keep only the outermost brackets.

回答4:

Ctrl-/ will insert // style commenting, for javascript, etc

Ctrl-/ will insert comments for HTML,

Ctrl-/ will insert # comments for Ruby,

..etc

But does not work perfectly on HTML

HTML tags:

Ctrl-/ twice (ie Ctrl-/Ctrl-/) will effectively comment out the line:

The first Ctrl-/ adds // to the beginning of the line,

which comments out the script tag, but adds "//" text to your webpage.

The second Ctrl-/ then surrounds that in

style comments, which accomplishes the task.

Ctrl--Shift-/ does not produce multi-line comments on HTML (or even single line comments), but does

add /* */ style multi-line comments in Javascript, text, and other file formats.

--

[I added as a new answer since I could not add comments.

I included this info because this is the info I was looking for, and this is the only related StackOverflow page from my search results.

I since discovered the / / trick for HTML script tags and decided to share this additional information, since it requires a slight variation of the usual catch-all (and reported above)

/ and Ctrl--Shift-/ method of commenting out one's code in sublime.]

回答5:

Just in case someone is using the Portuguese ABNT keyboard layout

The shortcut is

Ctrl + ;

回答6:

Just an important note. If you have HTML comment and your uncomment doesn't work

(Maybe it's a PHP file), so don't mark all the comment but just put your cursor at the end or at the beginning of the comment (before ) and try again (Ctrl+/).

回答7:

You can toggle the block comment with

Ctrl+Shift+/

Source: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=2967

回答8:

In mac I did this

type your comment and press command + D to select the text

and then press Alt + Command + / to comment out the selected text.

subli快速度创建html,Shortcut to comment out a block of code with subli相关推荐

  1. 最快速度找到内存泄漏

    本文已经迁移到: http://cpp.winxgui.com/cn:the-fastest-way-to-find-memory-leak 最快速度找到内存泄漏 许式伟 2006年11月某日 内存管 ...

  2. 实现以最快速度搭建springboot后台web项目并连通数据库实现控制层与服务层与dao层的select查询...

    背景 Servlet的出现 上世纪90年代,随着Internet和浏览器的飞速发展,基于浏览器的B/S模式随之火爆发展起来.最初,用户使用浏览器向WEB服务器发送的请求都是请求静态的资源,比如html ...

  3. 【小米校招笔试】一个数组是由有序数组经过n次循环移动后所得,请你用最快速度查找某个元素位置

    2016年小米校招笔试第二题(西安站) 2 现有一个数组是由有序数组经过n次循环移动后所得,请你用最快速度查找某个元素位置(如1234568,向右移动3次后为67812345). 参考解法(Java版 ...

  4. C# 判断给定大数是否为质数,目标以快速度得到正确的计算结果。

    标题是一个测试题.在看到这道题的时候,第一反应这是一道考程序复杂度的题,其次再是算法问题. 我们先来看看质数的规则: Link:http://en.wikipedia.org/wiki/Prime_n ...

  5. dotnet 是 前30个增长最快速度的开源项目中排名第一的开发平台

    CNCF 的博客 发了一篇文章 <Update on CNCF and Open Source Project Velocity 2020>,中文翻译参见 2020年CNCF和开源项目开发 ...

  6. 欧派家居的财务费用也出现了较快速度的增长

    近日,欧派家居发布公告称,自2021年6月1日至2021年6月22日期间,公司股票收盘价格已满足连续30个交易日中至少15个交易日的收盘价格不低于"欧派转债"当期转股价格的130% ...

  7. 最快速度求两个数组之交集算法与hash

    一个题目 该题目来自58同城的二面,用最快速度求两个数组之交集算法. 比如A={6,2,4,1},B={2,9,4,3},那么A&B={2,4}. 算法一:在大多数情况,也就是一般的情况下,大 ...

  8. 最快速度求两个数组之交集算法

    该题目来自58同城的二面,用最快速度求两个数组之交集算法. 比如A={6,2,4,1},B={2,9,4,3},那么A&B={2,4}. 算法一:在大多数情况,也就是一般的情况下,大家都能想出 ...

  9. 如何在互联网以最快速度赚够十万?

    普通的我们,每天过着普通人的生活,每天重复着固定的工作,每月上缴着房贷车贷保险,支出着固定的水电费.物业费.吃住穿行.每天如拼命三郎一般勤勤恳恳的付出,只为能在单位加个薪,升个职. 不料公司的效益一年 ...

  10. 目前 计算速度最快的计算机系统是,目前计算机执行最快速度是多少

    目前计算机执行最快速度是多少以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 目前计算机执行最快速度是多少 2013年6月 ...

最新文章

  1. 手把手教你使用koa2
  2. java aab全排列_编译原理习题课答案.ppt
  3. 【转】SAP的标准委外采购中都有哪些坑
  4. 2017年9月分c语言,2020年9月中国编程语言排行榜
  5. 51单片机8*8点阵屏、取模软件的使用
  6. 王道408数据结构——第二章 线性表
  7. Linux C编程学习--main()函数简析
  8. 如何选择深度学习框架 TensorFlow/Torch/Mxnet/Theano
  9. ABBYY PDF Transformer+ 给你好看
  10. PHP 中数组获取不到元素
  11. 用WPF实现打印及打印预览
  12. 美敦力PB560呼吸机设计图纸 源代码分享
  13. 优化服务器卡顿,如何解决国外服务器卡顿问题
  14. 如何查看存款和贷款的基准利率
  15. 通过蒲公英让两台异地电脑组建局域网
  16. 南京技师学院计算机系,江苏南京技师学院
  17. 李开复写给中国大学生的第五封信
  18. Elasticsearch(二)
  19. 【训练题22:线性求逆元】【模板】乘法逆元 | 洛谷 P3811
  20. java max重载_浅谈Java方法的重载

热门文章

  1. html轮播图代码自适应,【简易轮播代码】自适应全屏轮播banner图切换代码
  2. [项目管理]浅谈软件项目WBS任务分解
  3. 如何用python抓地图_【数据不用愁】手把手教你抓取地图矢量数据【附代码和矢量地图数据】...
  4. 使用BCDboot工具,修复windows 系统启动,双启动菜单丢失故障
  5. 家校协同小程序实战教程
  6. 嵌入式驱动开发学习路线
  7. 点分十进制ip地址转为十进制数字地址-python3实现
  8. linux把mac格式化了,Mac上将树莓派已经写了系统的SD卡(磁盘)抹除、格式化
  9. 精讲设计模式-Builder模式
  10. 8uftp服务器用户名密码,8uftp怎么用,8uftp怎么用,详细介绍8uftp的用法