HTML缩进CSS,Emacs中的HTML

3
我在使用Emacs的HTML和JS模式时遇到了缩进问题。我希望有更好的模式或函数来实现更好的缩进。
我也看到了Smart Tab,并创建了如下代码。
(require 'smarttabs)
(define-key read-expression-map [tab] 'hippie-expand)
(define-key read-expression-map [backtab] 'unexpand)

(smart-tabs-advice js2-indent-line js2-basic-offset)
    (smart-tabs-advice python-indent-line-1 python-indent)
    (add-hook 'python-mode-hook
              (lambda ()
                (setq indent-tabs-mode t)
                (setq tab-width (default-value 'tab-width))))
(smart-tabs-advice html-indent-line html-basic-offset)

但是也存在问题,在js2mode、html-mode、nxhtml mode中我遇到了很多像这样的问题

<div>
  <table>
    <tr>
      <td>
        test
      </td>
    </tr>
  </table>
</div>
  • 所有都是空格,我希望使用制表符(具有特定大小)
  • 有时我想使用tabshift tab进行更多或更少的缩进,但不起作用...只有这种缩进是可接受的:D

或者对于JavaScript js2mode创建类似于此的东西

function preview(img, selection) {
    var scaleX = 64 / (selection.width || 1);
    var scaleY = 64 / (selection.height || 1);
    $('#preview').css({ 
                          width: Math.round(scaleX * img.width) + 'px',
                          height: Math.round(scaleY * img.height) + 'px',
                          marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px',
                          marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' 
                      });
}

但我想要这个

function preview(img, selection) {
    var scaleX = 64 / (selection.width || 1);
    var scaleY = 64 / (selection.height || 1);
    $('#preview').css({
        width: Math.round(scaleX * img.width) + 'px',
        height: Math.round(scaleY * img.height) + 'px',
        marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px',
        marginTop: '-' + Math.round(scaleY * selection.y1) + 'px'
    });
}

我能为这个问题做些什么?

1个回答

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接