How do I prevent Sublime Text 3 from auto-indenting a line as a one off

不打扰是莪最后的温柔 提交于 2019-12-24 03:44:14

问题


When I'm editing HTML or CSS in Sublime Text 3 the lines auto-indent when I hit the [ENTER] key, which generally is very useful.

On occasion I find myself wanting to paste a line of markup which is already indented, and this results in double indentation.

Is there some other key combination along with the [ENTER] key that prevents the next line from auto-indenting and instead returns the curson to the very beginning of the line? Please note I don't want to turn off auto-indent on a global basis.


回答1:


You can do it in various steps, using various keybindings, so you can simply record a macro and do it in one simple custom keybinding (tools > record macro).

Steps:

  1. Press [Enter] to move to a new line.
  2. Press [shift+home] to select until the beginning of line (spaces or tabs used to indent).
  3. Press [backspace] to remove the selected indentation charaters
  4. You're done. Stop recording and save the macro, then use a custom keybinding to do it in a single step.



回答2:


I found in Windows that CTRL + SHIFT + V (rather than just CTRL + V) does a "paste and indent" whereby the indentation is corrected as necessary.

It's also possible to switch the default paste for paste as indent as per these instructions: https://gist.github.com/twosixcode/1988097



来源:https://stackoverflow.com/questions/28896916/how-do-i-prevent-sublime-text-3-from-auto-indenting-a-line-as-a-one-off

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!