简体   繁体   English

每当我调整编辑器窗口的大小时,如何阻止代码行自动移到下一行?

[英]How to stop lines of code from automatically shifting to the next line whenever I resize the window of the editor?

I am using Sublime Text 2. When I am on an HTML file.我正在使用 Sublime Text 2。当我使用 HTML 文件时。 If I resize the window.如果我调整窗口大小。 The code at the very end shifts down to the next line.最后的代码向下移动到下一行。 How do I stop this from happening?我如何阻止这种情况发生? I want the code to continue onward, so I will have to scroll side to side to see the rest of the code and not have the shift to the next line.我希望代码继续向前,所以我必须左右滚动才能看到其余的代码,而不是移到下一行。

I have taken screenshots to better illustrate what I am referring to.我截取了屏幕截图以更好地说明我所指的内容。

完整的代码窗口

After window has been resized.调整窗口大小后。 Notice the number lines?注意到数字线了吗? How do I stop that?我该如何阻止? I'd rather scroll right to see the rest of the code instead of having the code jump to the next line.我宁愿向右滚动以查看其余代码,而不是让代码跳到下一行。

调整大小的窗口

I noticed this only happens in an HTML file.我注意到这只发生在 HTML 文件中。

Look in the default Preferences.sublime-settings file for the setting below:默认的Preferences.sublime-settings 文件中查看以下设置:

// Disables horizontal scrolling if enabled.
// May be set to true, false, or "auto", where it will be disabled for
// source code, and otherwise enabled.
"word_wrap": "auto",

If you want the default for word wrap to be off for all syntax types:如果您希望为所有语法类型关闭自动换行的默认设置:

Copy "word_wrap": "auto", into your user Preferences.sublime-settings file"word_wrap": "auto",复制到您的用户Preferences.sublime-settings文件中

If you want the default for word wrap to be off for code and off for HTML but on for other syntax types:如果你想为自动换行默认是关闭的代码和关闭HTML,但其他类型的语法:

Copy "word_wrap": "auto", into the HTML.sublime-settings file"word_wrap": "auto",复制到HTML.sublime-settings文件中


Set it to "word_wrap": "false", .将其设置为"word_wrap": "false",

Now your default for HTML will be word wrap is off .现在您对 HTML 的默认设置是 word wrap is off

You can change this anytime by toggling the Word Wrap item in the View menu or by launching the Control Panel and typing enough of word wrap until the Word Wrap: Toggle item is selected and hitting Return .您可以随时更改此设置,方法是在“ View菜单中切换Word Wrap项目,启动控制面板并输入足够的自动word wrap直到选中Word Wrap: Toggle项目并按Return

只需在“查看”菜单中取消选中“自动换行”即可。

  1. Open an HTML file with sublime使用 sublime 打开 HTML 文件
  2. Choose Preferences > Settings-More > Syntax Specific - User选择Preferences > Settings-More > Syntax Specific - User
  3. A file named HTML.sublime-settings will open一个名为HTML.sublime-settings文件将打开
  4. Insert the following:插入以下内容:

{
    "word_wrap": "false"
}

  1. save the file保存文件

You can specify a particular number of columns to display before wrapping, irrespective of the window width.无论窗口宽度如何,您都可以在换行之前指定要显示的特定列数 Put your desired number of columns in the relevant preferences file:将所需的列数放在相关的首选项文件中:

"wrap_width": 80,

This is probably not what you want with HTML, but it helps with readability for things like Markdown, TeX, or plain text when the author didn't use line breaks.这可能不是您想要的 HTML,但是当作者没有使用换行符时,它有助于提高 Markdown、TeX 或纯文本等内容的可读性。

set --> "word_wrap": "false" in "Sublime Text > Preferences > Settings".在“Sublime Text > Preferences > Settings”中设置 --> "word_wrap": "false"。

It's instant change.这是即时变化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM