Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

drzel/vim-split-line

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
12 Commits
 
 
 
 
 
 
 
 

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:

Context Keyboard
Splitting on cursor i Enter Esc
Splitting on one char of whitespace r Enter
Splitting on more than one char of whitespace c i w Enter Esc

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

nnoremap S :SplitLine<CR>

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

Alternatives

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

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

About

vim plugin to easily split the line at the cursor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.