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)

Filter by
Sorted by
Tagged with
1
vote
1answer
443 views

Is it possible to disable aggressive indent mode per file extension?

Would it be possible to disable aggressive indent package just for some file extensions?. I know it's possible to do it by major mode, but I use web-mode for js,html,php and others. And I just want to ...
3
votes
1answer
368 views

web-mode not working inside of org-mode src block

I am trying to write code snippets inside org-mode and I am not able to get the same effect from web-mode. If I write the code in a css file completely I get this: But when I write the same code ...
2
votes
0answers
167 views

Web-mode javascript indentation for “if” and “for”

When writing Javascript, I always put curly brackets after if in a new line, like this: if(a == 0) { .... But when I do that in web-mode, the default is like this: if(a == 0) { .... ...
5
votes
1answer
291 views

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 ...
0
votes
1answer
809 views

Getting proper indentation for Python Flask templates

I've started using the Flask Python framework, and I'm having trouble getting indentation to work properly in the template .html files. I use web-mode, and it seems to really not want me to indent ...
1
vote
2answers
94 views

Convert lines into list in web-mode

How can I convert a number of lines with text into a list? Input: line one line two Then I want to mark the lines and after executing a function it should be: <ul> <li>line one</...
1
vote
0answers
338 views

Delete opening and closing tag in web-mode

Is there a way to delete opening and closing html tags in web-mode? I have tried using sgml-delete-tag from within web-mode but can't get it to work properly (I get an error message sgml-lexical-...
1
vote
1answer
629 views

web-mode for .js suffixed files

I have (somewhat) successfully installed and configured web-mode. But one thing doesn't work /w (react.js) JSX: I'm doing a project that requires the files to have the suffix '.js' and I'm trying to ...
1
vote
1answer
132 views

How to auto highlight buffer or region in web-mode?

I'm using web-mode 13.1.25, but was until today on 12.x with the same issue. It seems I need to continually choose Highlight buffer (C-c C-h) as otherwise, certain functions misbehave. These steps ...
2
votes
1answer
605 views

Migrate php-mode configuration to web-mode

I currently have my php-mode configuration like so: (require 'php-mode) (add-hook 'php-mode-hook (lambda () (require 'ac-php-company) (company-mode t) ...
0
votes
1answer
92 views

How do I configure emacs to stop adding an extra closing bracket when hitting space?

I'm using web-mode to edit my erb files. When I type <% emacs (or web-mode) adds a closing %> bracket. But when I type a space after the percent sign (i.e. %), an additional %> bracket is ...
4
votes
2answers
2k views

HTML tag auto open/close/expand/quote problem

I'm a novice at emacs use in general, and new to spacemacs, so I'm hoping this is just a case of missing a trick or two. I am working in a symlinked app on Mac OSX, not in the terminal. I have a ...
0
votes
0answers
348 views

web-mode javascript auto-indenting without semicolons

I'm editing JSX files with web-mode and our project doesn't use semicolons at the end of the line. Whenever I press enter at the end of the line, web-mode is auto-indenting two spaces because the ...
0
votes
1answer
887 views

problem with web-mode: Symbol's value as variable is void: <html>

I am using Emacs 24.5.1 and I seem to have a problem loading the web-mode package using use-package. I managed to narrow it down to the following .emacs file: (require 'package) (setq package-enable-...
2
votes
0answers
730 views

Web-Mode + Yasnippets + Autocomplete, error before create-php-snippet

I am trying to use auto-complete + php-auto-yasnippets with web-mode, but I can't get the snippets to work correctly. If I start typing imp, I correctly get auto-completion to implode but if I press ...
8
votes
2answers
3k views

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 ( <DateRangePicker ranges={this.state.ranges} startDate={this....
2
votes
0answers
496 views

web-mode django custom block indentions

The official style of the project I'm working on is to indent after template control statements. We're using jinja2 templates with altered open/closing tags too... <ul> {% for category in ...
1
vote
2answers
164 views

Indentation of conditional comments in web-mode.el

I want to set the indentation of conditional comments to 2 space, like this: <!--[if lt IE 9]> <script src="https://...) The default is 4, like this: <!--[if lt IE 9]> <...
3
votes
1answer
483 views

Force web-mode.el Engine

In my django project I use basic .html files for my templates. I want to force the django engine from web-mode.el so I don't have to constantly change between .html and .djhtml. I've tried the ...
0
votes
1answer
576 views

Enable JSX folding in web-mode

I'm using web-mode to edit jsx files and I'm wondering what minor-mode can I use to add folding support. Is there anything out there that works? Thanks
0
votes
0answers
283 views

Strange tabbing behaviour in .erb files

Note that I use spaces for tabs. When I am working in erb files for rails such as example.js.erb or example2.html.erb, I am getting some very odd (and annoying) auto-tabbing behaviour, which I can't ...
1
vote
1answer
342 views

.yas-parents have no effect with web-mode

I'm using web-mode and yasnippet for coding PHP and HTML. To use yasnippet in web-mode, will have to install php-mode, php-auto-yasnippets, emmet-mode and ac-emmet as suggested in web-mode.org. But I ...
4
votes
1answer
560 views

How to preserve code folding in emacs?

I am using web-mode to fold/unfold code. When I fold code, kill buffer and re open it, code folding disappears. How to preserve code folding even after killing and reopening buffer?
0
votes
0answers
70 views

web-mode comment function doesn't work well in php codes

In web-mode, when it comes to HTML file, press M-; will comment the selected region very well. But in PHP file, it does not work correctly, the following is the screenshot: Any more config work ...
1
vote
2answers
1k views

In web-mode PHP block in HTML file doesn't syntax highlight

I'm a emacs beginner, hope this not a stupid question. Here is the issue: when I open a html file that contains php block, every html thing got correct syntax highlight, but the php block. The web-...
0
votes
2answers
138 views

Get web-mode to ignore file extension and racket-mode to honor it

I use both web-mode and racket-mode often. I am also using Pollen, a Racket language for processing text. Pollen uses compound file extensions like: pynchon.html.pm stephenson.css.pp wallace.html.pmd ...
5
votes
1answer
619 views

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)...
4
votes
1answer
328 views

Highlight HTML entities in Web mode

I often edit articles in web-mode (using PHP). Is there some way of fontifying HTML entities (like &#8211;, &eacute;, and so on)? I'd like them to be a lighter color so that they're easier to ...
1
vote
0answers
45 views

web-mode sql detection doesn't activate syntax highlighting

we edit freemarker template engine files with web-mode. The files also contain a lot of SQL. I added (defun my-web-mode-hook () "Hooks for Web mode." (setq web-mode-enable-sql-detection t)...
0
votes
1answer
168 views

Switch syntax highlighting of open buffer from web-mode (freemarker) to sql

we use web-mode (freemarker engine) to edit source files that contain freemarker directives and a lot of SQL. Editing in web-mode (freemarker engine) works fine. It would be very helpful if we could ...
1
vote
1answer
215 views

How does web-mode recognize the php code or html code

It looks a quite magic that the web-mode could mix with php mode. A major mode could contain another major mode. This seems amazing. (add-to-list 'auto-mode-alist '("\\.php\\'" . php-mode)) (add-to-...
0
votes
1answer
196 views

Function to wrap html snippet in a div/span element in web-mode

I have a html snippet like this: <body> <ul> <li>jasmine</li> <li>cinthia</li> </ul> </body> How to wrap the ul element (after selection) ...
9
votes
1answer
3k views

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 '...
7
votes
1answer
2k views

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 ...
1
vote
1answer
284 views

Why is autoheader crashing with web-mode?

I got a situation here, that I couldn't get resolved with the maintainer of web-mode. So I'm asking here, if anyone knows a good suggestion. Ok, what I have here: GNU Emacs GUI (version 24.4.51.1 (...
4
votes
0answers
374 views

Web mode -indentation is misaligned on skipping semicolons

When i indent javascript code (inside html - web mode) that has no semicolons in it, the next statements are indented right with two extra spaces, <script> function processTemplates(){ ...
2
votes
1answer
1k views

How tell web-mode to use tidy syntaxchecker in flycheck?

I have tidy in my setup. When I run HTML-mode as major mode in html file, I do flycheck-verify-setup and I get tidy as syntax checker. the executable is also found. When running web-mode as major ...
1
vote
0answers
565 views

Autocomple not working with yasnippet

I have configured yasnippet and auto-complete bindings so it won't collide, auto complete uses <tab> and yasnippet uses <backtab>: (add-to-list 'load-path "~/.emacs.d/plugins/...
5
votes
1answer
2k views

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 ...
9
votes
1answer
3k views

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 ...
1
vote
1answer
260 views

How automatically load a mode with another mode (web-mode with zencoding-mode)?

I have web-mode (which is awesome, by the way). The following line: (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode)) every time when a .html file is loaded, web-mode will be enabled. But ...
2
votes
2answers
711 views

Encode non-html characters to html equivalent?

I must be overlooking something obvious, but I can't find a way to encode a string/region into HTML, for example "Hölle" to "H&ouml;lle". Is there anything in emacs or web-mode or any other plugin ...
4
votes
1answer
2k views

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 ...
1
vote
0answers
818 views

syntax highlighting and auto-completion for CSS?

How can I set up css-mode for syntax highlighting and autocompletion? I installed web-mode, but it doesn't seem to be giving me any of those features.
10
votes
2answers
5k views

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 ...

1
2