# 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:** 1\
**Showing post:** 3

<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} },
`

---

_[View the full topic](https://forum.sublimetext.com/t/jump-to-next-empty-line/3000)._
