Skip to content

Latest commit

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

vim-split-line

Without exiting normal mode, joining two lines is easy: J

But splitting and auto-indenting a line is a little awkward:

ContextKeyboard
Splitting on cursoriEnterEsc
Splitting on one char of whitespacerEnter
Splitting on more than one char of whitespaceciwEnterEsc

vim-split-line gives the :SplitLine command. Without leaving normal mode it:

  • Splits the line under the cursor
  • Remove trailing whitespace on first line
  • Auto-indents second line

Installation

Install with a plugin manager.

Configuration

nnoremapS:SplitLine<CR>

I use S because the default behaviour is almost identical to cc, and it has a nice symmetry with J.

Alternatives

You don't actually need this plugin, the below also works:

nnoremapS:keeppatterns substitute/\s*\%#\s*/\r/e <bar> normal! ==<CR>

About

vim plugin to easily split the line at the cursor

Resources

Stars

29 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages