Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To format only specific Ruby files with rubyfmt, name those paths on the command line—for example, rubyfmt -i lib/a.rb lib/b.rb rewrites those files in place. For broader runs, use .rubyfmtignore or rubyfmt’s Git-ignore and header options to control which files are included. Formatting selected files is different from formatting selected lines inside a file, which the Formatto VS Code extension supports only experimentally.

Install rubyfmt

The rubyfmt project README describes it as “A fast, opinionated Ruby formatter written in Rust.” It documents installation through Homebrew or by building from source with Cargo and putting the resulting executable on your PATH. Homebrew lists the package as a Ruby autoformatter and links to the official rubyfmt repository. Check the README and your installed version’s command-line help for current installation details.

Format only named files from the command line

Passing explicit paths is the simplest way to avoid formatting the rest of a project. The official rubyfmt README documents these command forms:

Command Result
rubyfmt lib/a.rb lib/b.rb Formats the named files and writes formatted output to standard output.
rubyfmt -i lib/a.rb lib/b.rb Formats the named files in place.
rubyfmt -c lib/a.rb lib/b.rb Shows a diff for the named files.

Use -c when you want to inspect proposed changes before deciding whether to write them. Use -i only when you intend to modify the specified files. The README also documents passing directories to process multiple files; directory-wide discovery is broader than naming individual paths, so apply ignore controls before using it on a project tree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Exclude files from directory-wide formatting

Use a rubyfmt ignore file

Create a .rubyfmtignore file at the repository root and list paths or patterns using .gitignore syntax. This is useful for excluding generated files or directories when you want to format a wider part of the project without naming every file individually.

Account for Git-ignored files

rubyfmt respects .gitignore by default, so files ignored by Git are normally omitted during discovery. Pass --include-gitignored when you specifically want rubyfmt to include files that Git ignore rules would otherwise exclude. The behavior and options are documented in the project README.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Opt files in or out with header comments

rubyfmt can use a comment at the top of a file as a per-file formatting control, but the control takes effect only when its matching command-line flag is enabled.

  • For an opt-in workflow, place # rubyfmt: true at the top of files eligible for formatting, then run rubyfmt with --header-opt-in.
  • For an opt-out workflow, put # rubyfmt: false at the top of files to skip, then use --header-opt-out.

These are alternative policies: choose the one that fits the repository. A header comment by itself does not activate either policy; the corresponding CLI option does. See the rubyfmt README for the documented options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Format changed Ruby files in VS Code

The Formatto extension supports rubyfmt and provides a Format Pending Changes command for modified Ruby files in open Git repositories. Because the command operates on files on disk, save unsaved editor changes first; otherwise, those buffer edits are not included in the pending-changes operation.

  1. Install and configure Formatto in VS Code, then confirm that rubyfmt is the selected formatter. The extension defaults to rubyfmt.
  2. Save any modified files whose current buffer contents you want formatted.
  3. Run Format Pending Changes to format modified Ruby files in the open Git repository.

For an individual document, use VS Code’s Format Document command or enable Format on Save after configuring the extension. The extension lists .rb, .rbs, .rbi, .gemspec, and .podspec among the supported rubyfmt file extensions.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Configure Formatto’s rubyfmt options

Formatto’s settings let you choose a formatter, set formatto.rubyfmtPath if the executable is not found at the expected location, add rubyfmt arguments such as --header-opt-in, and define exclusions with formatto.excludePatterns. Consult the Formatto extension listing for the extension’s current settings and instructions.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Can rubyfmt format only selected lines?

Choosing files to format is a supported command-line workflow; formatting an arbitrary selection of lines within a file is a different operation. Formatto’s range formatting is experimental and heuristic. An incomplete or syntactically broken selection may not change, and formatting a range can produce output different from formatting the entire document. The extension documentation notes that Ruby formatters normally work on complete, syntactically valid code, so do not rely on range formatting as a dependable substitute for whole-file formatting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Does rubyfmt use a style configuration file?

The official rubyfmt README reviewed for this guide documents file paths and directories, ignore behavior, and optional header controls; it does not describe a general style configuration file. Do not assume a .rubyfmt.yml file configures this project: a similarly named rfmt project is a different formatter. For current behavior, check the README and CLI help for the rubyfmt version you have installed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.