Questions tagged [web-mode]

web-mode.el is a major mode for editing HTML templates containing parts (CSS, JavaScript) and blocks (server/client side engines)

web-mode.el is a major mode for editing web templates, i.e. HTML documents with embedded client-side (CSS, Javascript, …) and server-side (PHP, JSP, ASP, ERB, Twig, Django, JSX, …) blocks.

105 questions
22
votes
2 answers

How do I set up indentation to 2 spaces in web-mode

I just installed web-mode. It works, but the indentation seems to be set to 4 spaces by default. How does one properly set it to 2 spaces?
Boris Stitnicky
  • 543
  • 2
  • 4
  • 10
12
votes
2 answers

Make web-mode always indent with spaces

I am using emacs web-mode, and the tabbing in JS files seems to be acting strangely. I have tab set to indent 2 spaces, but when the indent reaches 8 spaces, web-mode turns them into a tab, and then continues to tab 2 spaces until in reaches another…
dieuwe
  • 123
  • 1
  • 8
11
votes
1 answer

How do I set up key bindings for modes in a specific Evil state?

I have a set of key bindings that I use for both web-mode and php-mode in insert mode (of Evil). So I cannot use set-local-map or something. Because in normal mode, the same keys will then call other commands. So the bindings need to be active in…
ReneFroger
  • 3,855
  • 22
  • 63
9
votes
1 answer

Using multiple flycheck syntax checkers in web-mode

I'm trying to configure Flycheck to use both csslint and tidy checkers in web-mode without any success. This post suggests using this code for tidy: (eval-after-load 'flycheck '(flycheck-add-mode 'html-tidy 'web-mode)) But adding an extra line…
Sineau
  • 91
  • 1
  • 2
8
votes
1 answer

turn off auto-quotes in web-mode

Currently I have jsx in my js files but when using web-mode it is only possible to have single quotes or double quotes for html attributes with this setting the web-mode-auto-quote-style setting, e.g: (setq web-mode-auto-quote-style 2) ; use single…
dagda1
  • 595
  • 1
  • 3
  • 16
8
votes
1 answer

Formatting jsx in js files with web-mode

Say I have a function like this in a .js file: import React, { Component, PropTypes } from 'react'; const Forecast = ({ summary, details }) => { if (!summary) return
; const image =…
dagda1
  • 595
  • 1
  • 3
  • 16
8
votes
1 answer

Change comment style in web-mode

I am using web-mode 20161003.1327 At the moment when I comment a region in web-mode, it comments like this; /* import chai from 'chai'; * import 'babel-polyfill'; * import configureMockStore from 'redux-mock-store'; * import thunk from…
dagda1
  • 595
  • 1
  • 3
  • 16
8
votes
2 answers

no html/jsx indentation in jsx-mode

For some reason the html/jsx in my react source files always wants to indent as follows, i.e. there is almost no indentation: return (
flooose
  • 511
  • 6
  • 14
7
votes
1 answer

How to stop web-mode from reindenting after yank?

I'm editing this code: callFunction({ x: somearray, }); Then I want to extract somearray to be a variable with a copy. I cut somearray and delete the colon, then enter (_ is the cursor): const x = [..._ callFunction({ x }); Then yank, and…
Arry
  • 203
  • 1
  • 3
7
votes
1 answer

Web mode HTML tag highlighting

First off, a picture of what I see, editing a handlebars file: My colour theme is base16-grayscale, so that blue is probably hard coded somewhere. I asked on the web-mode mailing list, but was told to ask here instead. Can I disable and/or change…
mkaito
  • 741
  • 6
  • 16
5
votes
1 answer

Pasting text doesn't work properly in evil-/web-mode

In certain situations Emacs doesn't properly paste text. Apparently this only happens if the current buffer isn't saved and both web-mode and evil-mode are loaded. I was able to reproduce this behavior with the following config: (require…
5
votes
1 answer

Smartparens and web-mode conflict to add extra angular bracket

I am fairly new to customizing my emacs, so please be gentle. I did try to find a solution for this, but all I found was a page on git where someone asked a similar question but (as far as I can tell) never received an answer. I have both…
Kittenmittons
  • 203
  • 1
  • 6
5
votes
1 answer

web-mode custom indent setting ignored

In web-mode, indentation for markup gets set to 8 when I open a new buffer. I have set web-mode-indent-markup-indent-offset via customize to 2. When I check it outside of a web-mode buffer, it is set to 2. Lines concerning web-mode in my…
Patrick J. S.
  • 235
  • 1
  • 7
4
votes
1 answer

How can I comment a block of CSS or HTML in web mode?

I am using web-mode.el to edit my CSS and HTML files. I am 90% sure that I haven't touched it but, just in case I modified it in the past, you can find the actual web-mode.el file I'm using here. I have mapped the shortcut C-cc to comment-region in…
terdon
  • 745
  • 6
  • 21
4
votes
1 answer

Configuring web-mode for Vue.js (.vue) files

It seems that web-mode has supported Vue.js since May 2017, the "Venora Release". Configuring Emacs to handle Vue.js files (extension .vue) is as easy as writing (add-to-list 'auto-mode-alist '("\\.vue\\'" . web-mode)) in one's .emacs file. But…
Calaf
  • 483
  • 3
  • 16
1
2 3 4 5 6 7