【问题标题】:html indentation for css, html in emacscss的html缩进,emacs中的html
【发布时间】:2011-04-19 05:31:30
【问题描述】:

我在 html 和 js 模式下遇到 emacs 缩进的问题。 我想要更好的模式或功能以获得更好的缩进

我也看到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模式下我有很多这样的问题

<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'
    });
}

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

【问题讨论】:

    标签: emacs indentation


    【解决方案1】:

    nxml mode (config sn-ps here) 有没有给你满意的结果?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-17
      • 1970-01-01
      • 2011-12-12
      • 2014-03-06
      • 2011-09-02
      • 2016-04-30
      • 2011-04-03
      • 1970-01-01
      相关资源
      最近更新 更多