新来的emacs。我试图在我的反应项目工作,然而,每次我去一个新的线,它把线上的后退。我真的不太确定我在用埃马克做什么,所以请原谅我!关于如何解决这个问题,有什么建议或帮助吗?
发布于 2018-08-07 03:00:08
为了重新创建您的问题,我尝试编辑一个react文件,如果我使用的是javascript-mode,则会发现同样的行为,从屏幕截图中可以看出这就是您正在使用的。
为了查看emacs正在做什么,我执行了M-x describe-key (对我来说是C-h k )并按enter键,得到了以下内容:
RET (translated from <return>) runs the command newline (found in
global-map), which is an interactive compiled Lisp function in
‘simple.el’.
It is bound to RET.
(newline &optional ARG INTERACTIVE)
Insert a newline, and move to left margin of the new line if it’s blank.
If option ‘use-hard-newlines’ is non-nil, the newline is marked with the
text-property ‘hard’.
With ARG, insert that many newlines.
If ‘electric-indent-mode’ is enabled, this indents the final new line
that it adds, and reindents the preceding line. To just insert
a newline, use M-x electric-indent-just-newline.我认为这是与你所看到的相关的部分(强调我的):
如果启用了“电缩进模式”,则此缩进将缩进它添加的最后一行,将重新定位前面的行。
我也会在emacs中做一些反应。在我的经验中,默认的javascript-mode,甚至一些更高级的Javascript模式(如js2-mode)对React的JSX语法不太好。到目前为止,我发现的最好的事情是rjsx-mode。你可以试试!我认为如果启用了这种模式,您会发现缩进在JSX块中表现得更加明智。
https://stackoverflow.com/questions/51717864
复制相似问题