Pilgrim
Emacs Web-mode left arrow without the right closing angle bracket
When using Elixir html template (.eex) in web-mode, I sometimes need to type code like <%= for bid <- @bids do %> . At the moment because the opening left angled bracked is closed immediately with a matching right angled bracket, after I type <-, I’m left with a closing angled bracket that I don’t need and have to delete.
I need help coming up with a way to prevent the left angled bracket from auto closing.
Below is my current web-mode and smartpatens configs:
Web-mode
(use-package web-mode
:ensure t
:mode (("\\.erb\\'" . web-mode)
("\\.mustache\\'" . web-mode)
("\\.html?\\'" . web-mode)
("\\.eex\\'" . web-mode)
("\\.php\\'" . web-mode)
("\\.jsx$" . web-mode))
:init
(setq web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2
web-mode-code-indent-offset 2)
;; make web-mode play nice with smartparens
(setq web-mode-enable-auto-pairing nil)
;(setq web-mode-enable-auto-closing nil)
(setq web-mode-enable-current-element-highlight t)
(setq web-mode-enable-current-column-highlight t)
:config
(sp-with-modes '(web-mode)
(sp-local-pair "<" nil :actions nil)
(sp-local-pair "% " " %"
:unless '(sp-in-string-p)
:post-handlers '(((lambda (&rest _ignored)
(just-one-space)
(save-excursion (insert " ")))
"SPC" "=" "#")))
(sp-local-pair "<% " " %>" :insert "C-b %")
(sp-local-pair "<%= " " %>" :insert "C-b =")
(sp-local-pair "<%# " " %>" :insert "C-b #")
(sp-local-pair "<-" "")))
Smartparens
(use-package smartparens
:ensure t
:hook (prog-mode . smartparens-mode)
:init
;; https://stackoverflow.com/questions/23789962/how-to-disable-emacs-highlighting-whitespace-in-parenthesis
(setq sp-highlight-pair-overlay nil)
:bind
(:map smartparens-mode-map
("C-M-f" . sp-forward-sexp)
("C-M-b" . sp-backward-sexp)
("C-M-a" . sp-backward-down-sexp)
("C-M-e" . sp-up-sexp)
("C-M-w" . sp-copy-sexp)
("C-M-k" . sp-change-enclosing)
("M-k" . sp-kill-sexp)
("C-M-<backspace>" . sp-splice-sexp-killing-backward)
("C-S-<backspace>" . sp-splice-sexp-killing-around)
("C-]" . sp-select-next-thing-exchange))
:config
(require 'smartparens-config)
(sp-local-pair 'emacs-lisp-mode "'" nil :actions nil)
(sp-local-pair 'org-mode "[" nil :actions nil)
(sp-local-pair 'prog-mode "{" nil :post-handlers '((my-create-newline-and-enter-sexp "RET")))
(sp-local-pair 'prog-mode "(" nil :post-handlers '((my-create-newline-and-enter-sexp "RET"))))
Thanks.
PS: I posted this here Emacs Stackexchange in case you think you’ve seen it asked before.
Most Liked
NobbZ
Popular in Questions
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Hello, how can I check the Phoenix version ?
Thanks !
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
How to handle excepions in elixir?
Suppose i have A, B, C ,D, E modules. and each module has get() function.
A.get() method will call t...
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)?
Would
mix ecto.rollback -v 200809061...
New
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
Other popular topics
I have VueJS GUIs with the project generated using Webpack.
I have Elixir modules that will need to be used by the VueJS GUIs.
I forese...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Hi all,
I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I’m trying to use Postgres...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
I would like to know what is the best IDE for elixir development?
New
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something…
Haskell reminds me of Java, and e...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









