簡體   English   中英

如何在Emacs Sass模式下修復奇怪的縮進行為

[英]How to fix a strange indentation behaviour in Emacs sass-mode

這個問題( https://github.com/nex3/sass-mode/issues/5 )已經解釋了我想說的話,請看一下。 有什么辦法可以解決它。

當我按下退格鍵時,例如在cj之后,它總是更深一層而不是同一層,除了提供“標記設置”消息的控制緩沖區外,什么也沒有發生。 當我檢查時,看到它綁定到haml-electric-backspace。 因此,只有兩種方式可以創建新行,並將光標移動到同一行的縮進級別,最后一行是ret tab tab或cj,然后是cb cb或tab tab。 我認為cj應該默認為同一級別,並且退格鍵應該具有默認的emacs行為。

我發現一堆與sass模式有關的錯誤。

這是我保存在.emacs中的一些代碼,可能會有所幫助:

(defconst sass-line-keywords
  '(("@\\(\\w+\\)"    0 font-lock-keyword-face sass-highlight-directive)
("/[/*].*"  0 font-lock-comment-face)
("[=+]\\w+" 0 font-lock-variable-name-face sass-highlight-script-after-match)
("!\\w+"    0 font-lock-variable-name-face sass-highlight-script-after-match)
(":\\w+"    0 font-lock-variable-name-face)
("\\w+\s*:" 0 font-lock-variable-name-face)
("\\(\\w+\\)\s*="  1 font-lock-variable-name-face sass-highlight-script-after-match)
("\\(:\\w+\\)\s*=" 1 font-lock-variable-name-face sass-highlight-script-after-match)
(".*"      sass-highlight-selector)))

(defconst sass-selector-font-lock-keywords
  '( ;; Attribute selectors (e.g. p[foo=bar])
("\\[\\([^]=]+\\)" (1 font-lock-variable-name-face)
 ("[~|$^*]?=\\([^]=]+\\)" nil nil (1 font-lock-string-face)))
("&"       0 font-lock-constant-face)
("\\.\\w+" 0 font-lock-type-face)
("#\\w+"   0 font-lock-keyword-face)
;; Pseudo-selectors, optionally with arguments (e.g. :first, :nth-child(12))
("\\(::?\\w+\\)" (1 font-lock-variable-name-face)
 ("(\\([^)]+\\))" nil nil (1 font-lock-string-face)))))
(defconst sass-non-block-openers
  '("^.*,$" ;; Continued selectors
"^ *@\\(extend\\|debug\\|warn\\|include\\|import\\)" ;; Single-line mixins
"^ *[$!]"     ;; Variables
".*[^\s-]+: [^\s-]" ;; a setting of some sort
))

我認為問題尤其在於無障礙的開瓶器。 對不起,我只是在向您轉儲一些代碼。 希望無論如何這會有所幫助。

完成后,致電RET,而不是Cj

退格鍵將降低級別

一切正常AFAIS,沒有錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM