Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation Width #86

Open
BenSapiens opened this issue Sep 9, 2018 · 5 comments
Open

Indentation Width #86

BenSapiens opened this issue Sep 9, 2018 · 5 comments

Comments

@BenSapiens
Copy link

BenSapiens commented Sep 9, 2018

If anyone is having the same struggle trying to change indentation width from 2 spaces to 4, try altering the variable sgml-basic-offset. I had previously altered sgml-shift-width, which was apparently sufficient for other modes, including web-mode, react-mode, rjsx-mode, and js2-mode, but not for this one.

Besides this, great experience so far.

@AdamNiederer
Copy link
Owner

AdamNiederer commented Oct 9, 2018

Hm, that's strange - I don't have an sgml-shift-width in my Emacs (26.1; sgml-mode loaded). vue-mode and vue-html-mode do not directly refer to sgml-basic-offset, but are submodes of html-mode. Because of this, giving vue-mode and vue-html-mode a separate indent width would involve some hacks.

Also, please avoid using denigrating language in your issue reports. I understand this issue may be frusturating, but let's keep it professional. I've edited your initial comment accordingly.

@BenSapiens
Copy link
Author

I'm using the standard Emacs installation from the emacs-plus package via Homebrew, and I do indeed have a sgml-basic-offset variable, documented and everything. In contrast, my sgml-shift-width variable isn't documented, although it's equally true that it was working fine until I ran into this package.

Continuing the thread theme of noting down little idiosyncrasies, sometime in the last month I also discovered that vue-mode semi-regularly drops the ball when it comes to reliably identifying which chunks of text are covered by which mode, necessitating a call to the vue-mode-reparse function, naturally with the (interactive) specifier. Other than that, and a related problem which similarly breaks syntax highlighting (and indentation) whenever I hit enter with my cursor positioned as follows:

<script lang="js">
                  ^
</script>

(with or without closing tag)

...it's all pretty great.

P.S. With respect, "retarded" is a description of fact, not an insult. In the world at this very moment there are retards, and they are retarded. It isn't a value judgement... unless you make it one.

@fernao
Copy link

fernao commented Mar 1, 2019

Hi there, I'm also having some difficulties while changing from two to four spaces. My team adopted a Lint of four spaces and my emacs with vue-mode is using two! At the moment, I can only indent with four using other modes - such as web-mode etc.

Any ideas??

@BenSapiens
Copy link
Author

@fernao

Hi there, I'm also having some difficulties while changing from two to four spaces. My team adopted a Lint of four spaces and my emacs with vue-mode is using two! At the moment, I can only indent with four using other modes - such as web-mode etc.

Any ideas??

Assuming you haven't already figured this out, have a look at the variable tab-width. For me, at least, it has sometimes overridden other values I've set elsewhere.

Furthermore, in general, I recommend attempting to introspect Emacs with the describe-key, describe-function, and describe-variable helper functions, accessible by default with C-h k, C-h f, and C-h v, respectively.

@fernao
Copy link

fernao commented May 14, 2019

I've come to a solution, that attends to the lint rules of the project:

When I'm editing inside <template> area on a .vue file, i use web-mode. When editing code inside the <script>, i use vue-mode. It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants