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

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

Sponsored

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

Data Sovereignty: Key to Protection Amid Geopolitical Tensions

The Fortress of Data: Why Sovereignty Spells Survival for Nations and Businesses in a Fractured…

1 day ago

AI Sameness Syndrome: Experts Warn of Eroding Edges in 2026 AI Rush

The Paradox of Shared Intelligence In the rush to adopt artificial intelligence, companies are inadvertently…

1 day ago

Google’s Gemini AI Fights Doomscrolling with Interactive Tools

From Scroll Fatigue to AI Sparks: Gemini’s Rise as the Antidote to Digital Boredom In…

1 day ago

US Electricity Demand Surges 3.1% in 2025, Solar Meets 61% Growth

Solar’s Eclipse of Tradition: Powering America’s Unprecedented 2025 Demand Spike In a year marked by…

1 day ago

ACA Subsidy Expiration Triggers 1.4M Enrollment Drop, Premium Surges

The Subsidy Sunset: Unraveling the Affordable Care Act’s Enrollment Plunge in 2026 The dawn of…

1 day ago

Wikipedia’s 25th Anniversary: Reshaping Journalism in an AI-Driven World

In the ever-shifting realm of information dissemination, Wikipedia stands as a monumental experiment that has…

1 day ago

This website uses cookies.