dev-resources.site
for different kinds of informations.
Format on save for ERB and Ruby files in Zed IDE
Published at
10/15/2024
Categories
ruby
rails
zed
Author
mrispoli24
Author
10 person written this
mrispoli24
open
Something that I really wanted when working with (Zed)[https://zed.dev] and Ruby on Rails was format on save ability for my .rb and .erb files. The setup is simple so I thought I'd give it a share:
First open your settings.json
file with cmnd + ,
or going to Zed -> Settings -> Open Settings.
Then add a key for languages with the following:
{
...other_settings_here,
"languages": {
"Ruby": {
"format_on_save": "on",
"formatter": {
"external": {
"command": "./bin/bundle",
"arguments": [
"exec",
"rubocop",
"--auto-correct",
"--stdin",
"corrected.rb",
"--stderr"
]
}
}
},
"ERB": {
"formatter": [
{
"external": {
"command": "sh",
"arguments": [
"-c",
"f=erblinttemp_$RANDOM$RANDOM.html.erb; cat > $f; erblint -a $f &>/dev/null; cat $f; rm $f;"
]
}
},
{
"external": {
"command": "htmlbeautifier",
"arguments": []
}
}
],
"format_on_save": "on"
}
}
}
There you have it format on save for your template files and ruby files ready to go.
zed Article's
16 articles in total
Zed IDE vs. NeoVim and Other IDEs: The Future of Modern Coding Environments
read article
The Future of Rust Programming and My Experience with Rust-Based Tools
read article
Short appreciation for dev tools
read article
How I configured the Zed editor for daily-driving
read article
Setting up Zed for Elixir development 💧
read article
Lightning-Fast Development with Zed and Dev Containers
read article
Who Can Apply for the ZED Certificate
read article
Format on save for ERB and Ruby files in Zed IDE
currently reading
Styling code syntax in Zed
read article
Why I Started Using Zed
read article
ZED-Score Calculator
read article
Zed and AI will save us millions... and you might soon lose your job
read article
Exploring Zed, an open source code editor written in Rust
read article
Working with Zed for a week
read article
List of apps I use every day - Version 2023
read article
Zed El Mejor Editor De Texto Del Mundo
read article
Featured ones: