1

I've setup the indentation for tabs in Rust to be 2 whitespaces. That's what I want. And in my config it looks like this:

(add-hook 'rust-mode-hook
  (lambda ()
    (setq indent-tabs-mode nil)
    (setq tab-width 2)
    (setq rust-indent-offset 2)))

What's the difference between tab-width and rust-indent-offset or <lang>-indent-offset?

Dmitry
  • 3,578
  • 16
  • 20
Oskar K.
  • 278
  • 1
  • 7

1 Answers1

1

tab-width is the width used to display a TAB character. It also has an effect when indent-tabs-mode is non-nil, in which case Emacs uses tab-width to decide when to replace so many spaces with one TAB.

ruby-indent-offset and similar variables control by how many spaces to indent.

Stefan
  • 26,404
  • 3
  • 48
  • 85
Dmitry
  • 3,578
  • 16
  • 20