Categories: Web and IT News

Vim split to a specific size

Vim supports two kinds of splits: vertical (:vsplit) and horizontal (:split). You can open any file in a split by calling :split path/to/file or :vsplit path/to/file. By default, the full width or height of the current buffer will be divided in two. The new split will take up 50% of the available real estate, and the existing will be reduced to 50% of its original size.

But! Vim has a way to open splits to a specific size: By prepending a number to a split command, that split will be opened to the exact character width or height you specify. For example: :20 vsplit path/to/file will open a split that is exactly 20 characters wide, instead of 50% of the current width.

Note that the number includes the line numbers, gutter, and bar between buffers. For a vertical split, 4 characters will typically be lost to that space.

You can enter this with or without the space between the number. For example: :30split path/to/file and :30 split path/to/file will do the same thing.

We have written a ton about splits, so be sure to check the archives. Our post about resizing slits will come in handy paired with this tip.

The post Vim split to a specific size appeared first on VimTricks.

Vim split to a specific size first appeared on Web and IT News.

awnewsor

Recent Posts

Metaplanet Expands Bitcoin Treasury Strategy to US Markets Following MicroStrategy Model

Japan’s Metaplanet has officially expanded its Bitcoin accumulation strategy into the United States, signaling a…

14 hours ago

Samsung Galaxy S26 FE Launching October 2025: Price, Specs, and Features

Samsung continues to expand its Fan Edition lineup with the anticipated arrival of the Galaxy…

14 hours ago

ONEOK’s Quiet AI Power Play: How a Pipeline Giant Is Fueling Data Centers

Wall Street has spent the past year chasing nuclear reactors and utility giants in the…

14 hours ago

Remote Work Delivers Top Well-Being Scores in Major Healthcare Study

Remote workers logged the highest well-being scores. Onsite staff came in last. The gap emerged…

14 hours ago

Rivian Spins Out Battery Tech Unit, Raises $150M for Energy Storage

Rivian has taken another step in reshaping its corporate structure by spinning out a new…

14 hours ago

Terrapower’s Natrium Reactor Delivers 50% On-Demand Power Boost for AI Data Centers

Terrapower, the nuclear innovation company backed by Bill Gates, has developed an advanced reactor design…

14 hours ago

This website uses cookies.