# Jump to next empty line?

**URL:** <https://forum.sublimetext.com/t/jump-to-next-empty-line/3000>\
**Category:** General Discussion\
**Created:** [October 30, 2011, 10:06am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000 "2011-10-30T10:06:57Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![yatayata](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/yatayata/32/69083_2.png) [@yatayata](https://forum.sublimetext.com/u/yatayata)\
**Post date:** [October 30, 2011, 10:06am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/1 "2011-10-30T10:06:57Z")

</div>

is there a way to remap ctrl-up/down to jumpt to the next empty line?

i use this for navigation in emacs all the time, and just leave an empty line as punctuation in my code…

tx!

---

<div class="post-metadata">

**Author:** ![spadgos](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/spadgos/32/26080_2.png) [@spadgos](https://forum.sublimetext.com/u/spadgos)\
**Post date:** [November 1, 2011, 1:37pm UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/2 "2011-11-01T13:37:18Z")

</div>

you could look at using bookmarks. Ctrl+F2 to toggle a bookmark, and F2 to go to the next one.

---

<div class="post-metadata">

**Author:** ![lappri](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/lappri/32/63331_2.png) [@lappri](https://forum.sublimetext.com/u/lappri)\
**Post date:** [November 2, 2011, 12:21am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/3 "2011-11-02T00:21:18Z")

</div>

You could use the code below and tweek it a bit.  
My previous editor was TextPad and I used _move by paragraph_ all the time. I missed it dearly and wrote a command for it.  
I have it mapped to alt+up/down and the selecting variants mapped to ctrl+shift+up/down.  
Hope this helps.

…\AppData\Roaming\Sublime Text 2\Packages\User\move\_by\_paragraph.py:

[code]import sublime, sublime\_plugin

class MoveByParagraphCommand(sublime\_plugin.TextCommand):  
def run(self, edit, extend = False, forward = True):  
self.view.run\_command(“move\_to”, {“to”: “hardbol”, “extend”: extend}) # to mimic TextPad’s behaviour  
pt = self.view.sel()[0].b  
if forward:  
rg = self.view.find("\n\s\*\n", pt)  
new\_pt = rg.b if rg else self.view.size()  
else:  
# couldn’t find “find previous” command  
rgs = self.view.find\_all("\n\s]\*\n")  
new\_pt = 0  
for rg in rgs:  
if rg.b \< pt:  
new\_pt = rg.b  
new\_pt\_visible = self.view.visible\_region().contains(new\_pt)  
#  
# obviously inefficient way of doing it (couldn’t find amount for move command)  
# becomes slow for veeeeery long paragraphs  
self.view.run\_command(“move”, {“by”: “lines”, “forward”: forward, “extend”: extend})  
while (self.view.sel()[0].b \< new\_pt) == forward and self.view.sel()[0].b != pt:  
pt = self.view.sel()[0].b  
self.view.run\_command(“move”, {“by”: “lines”, “forward”: forward, “extend”: extend})  
while self.view.sel()[0].b != new\_pt:  
self.view.run\_command(“move”, {“by”: “characters”, “forward”: self.view.sel()[0].b \< new\_pt, “extend”: extend})  
if not new\_pt\_visible:  
self.view.show\_at\_center(new\_pt)  
[/code]

In …\AppData\Roaming\Sublime Text 2\Packages\User\Default (Windows).sublime-keymap:

`	{ "keys": "ctrl+shift+up"], "command": "move_by_paragraph", "args": {"extend": true, "forward": false} },
	{ "keys": "ctrl+shift+down"], "command": "move_by_paragraph", "args": {"extend": true} },
	{ "keys": "alt+up"], "command": "move_by_paragraph", "args": {"extend": false, "forward": false} },
	{ "keys": "alt+down"], "command": "move_by_paragraph", "args": {"extend": false} },
`

---

<div class="post-metadata">

**Author:** ![jps](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/j/b4bc9f/32.png) [@jps](https://forum.sublimetext.com/u/jps)\
**Post date:** [November 2, 2011, 12:42am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/4 "2011-11-02T00:42:08Z")

</div>

Another option is:

```auto
{ "keys": "alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false} },
{ "keys": "alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true} }
```

---

<div class="post-metadata">

**Author:** ![tobia](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/t/6f9a4e/32.png) [@tobia](https://forum.sublimetext.com/u/tobia)\
**Post date:** [October 16, 2012, 2:57pm UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/5 "2012-10-16T14:57:06Z")

</div>

[quote=“jps”]Another option is:

`
{ "keys": "alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false} },
{ "keys": "alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true} }
`[/quote]

I was looking for the same command (curly braces in Vim command mode, I always used it) and this is the correct answer, thanks.

---

<div class="post-metadata">

**Author:** ![bizoo](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@bizoo](https://forum.sublimetext.com/u/bizoo)\
**Post date:** [October 16, 2012, 3:27pm UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/6 "2012-10-16T15:27:39Z")

</div>

Didn’t know “move by stops” exists !!!

Is there a comprehensive list of command and their arguments ?  
Maybe there’s a way to generate it automatically ?

---

<div class="post-metadata">

**Author:** ![tobia](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/t/6f9a4e/32.png) [@tobia](https://forum.sublimetext.com/u/tobia)\
**Post date:** [October 19, 2012, 10:44am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/7 "2012-10-19T10:44:52Z")

</div>

More to the point: how do we extend the above command with shift to get selection by whole paragraphs?  
(shift+alt+up/down = select up to the prev/next empty line)

This would be very useful to quickly move blocks of code around.

Is there a select by stops command?

---

<div class="post-metadata">

**Author:** ![adzenith](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/a/f08c70/32.png) [@adzenith](https://forum.sublimetext.com/u/adzenith)\
**Post date:** [October 19, 2012, 5:07pm UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/8 "2012-10-19T17:07:08Z")

</div>

You can add “extend”:“true” to any movement command, I think. Just create another binding with the shift key involved.

---

<div class="post-metadata">

**Author:** ![tobia](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/t/6f9a4e/32.png) [@tobia](https://forum.sublimetext.com/u/tobia)\
**Post date:** [November 9, 2012, 11:36am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/9 "2012-11-09T11:36:31Z")

</div>

Thank you!

This is the complete set of bindings that solve my issue:

```auto
{"keys": "alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false}},
{"keys": "alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true}},
{"keys": "shift+alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true}},
{"keys": "shift+alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true, "extend": true}},
```

---

<div class="post-metadata">

**Author:** ![catman](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/c/4491bb/32.png) [@catman](https://forum.sublimetext.com/u/catman)\
**Post date:** [May 8, 2013, 5:50pm UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/10 "2013-05-08T17:50:29Z")

</div>

Thanks lappri,

I have been missing paragraph jumping tonnes.

---

<div class="post-metadata">

**Author:** ![bkdotcom](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/b/ee59a6/32.png) [@bkdotcom](https://forum.sublimetext.com/u/bkdotcom)\
**Post date:** [December 13, 2013, 6:57am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/11 "2013-12-13T06:57:20Z")

</div>

[quote=“jps”]Another option is:

`
{ "keys": "alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false} },
{ "keys": "alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true} }
`[/quote]

Most excellent.  
Trying to make the transition from TextPad. Adding this makes me feel a bit more at home.  
Thanks

---

<div class="post-metadata">

**Author:** ![nh2](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/nh2/32/30026_2.png) [@nh2](https://forum.sublimetext.com/u/nh2)\
**Post date:** [July 12, 2019, 2:54am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/12 "2019-07-12T02:54:50Z")

</div>

The syntax in all posts shown so far was incorrect, `"keys": "alt+up"]` lacks an open bracket `[`.

Here’s my fixed version:

```
// Jumping over blocks (to next empty line)
{"keys": ["alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false}},
{"keys": ["alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true}},
// With selecting
{"keys": ["ctrl+shift+alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true}},
{"keys": ["ctrl+shift+alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true, "extend": true}},
```

---

<div class="post-metadata">

**Author:** ![EmilBeBri](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/e/b77776/32.png) [@EmilBeBri](https://forum.sublimetext.com/u/EmilBeBri)\
**Post date:** [February 7, 2022, 10:56am UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/13 "2022-02-07T10:56:27Z")

</div>

This is great - but it would be nice if it was clever enough so that, if there are two empty lines below each other, it would skip to the next non-empty line. Anybody has a suggestion for this?

---

<div class="post-metadata">

**Author:** ![MrSnuggles](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/mrsnuggles/32/74773_2.png) [@MrSnuggles](https://forum.sublimetext.com/u/MrSnuggles)\
**Post date:** [May 12, 2023, 3:42pm UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/14 "2023-05-12T15:42:53Z")

</div>

Yeah, I’d like to know how to skip multiple empty lines as well. There is an extension called “Block Travel Plus” for VS Code that does that… would be nice to have the same functionality on ST 😃

---

<div class="post-metadata">

**Author:** ![EmilBeBri](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/e/b77776/32.png) [@EmilBeBri](https://forum.sublimetext.com/u/EmilBeBri)\
**Post date:** [May 12, 2023, 3:56pm UTC](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000/15 "2023-05-12T15:56:05Z")

</div>

What I did was to move to neovim instead. Steep Learning curve but worth imo
