Wordpressor
Wordpressor

Reputation: 7553

How to select multiple lines in Sublime Text (quickly)

I have a JS file that has over 100000 lines of code, I want to get rid of the first 25000, I've been trying hard but can't figure out how do I select them all at once (holding left mouse button and scrolling down is not an option as it would take forever).

I guess holding SHIFT and arrow DOWN is the way to go, but I have absolutely no idea how to select them all at once anyway. Maybe selecting 25000th line, pressing shift, left arrow and then HOME would help, but I'm working on OS X and have no HOME button my Macbook. Also shortcut for "going to line" (ctrl+q) doesn't seem to work with selection.

How do I do that? Sorry for so dumb question, would've been a second in VIM, but I'm stuck to SE2 now.

Thanks a lot!

Upvotes: 2

Views: 5031

Answers (3)

Ionuț G. Stan
Ionuț G. Stan

Reputation: 179219

  1. go to line 25000: CMD+L, enter 25000
  2. hit CMD+SHIFT+UP ARROW
  3. done

Upvotes: 3

Noctisdark
Noctisdark

Reputation: 348

Any programming language will do, for example in python: lines = open('yourfile.txt','r').readlines() open('yourfile.txt','w').write(lines[24999:100000])

Upvotes: 0

Ioan-Radu Tanasescu
Ioan-Radu Tanasescu

Reputation: 566

See this forum topic about the "Mark" feature from Sublime Text: https://www.sublimetext.com/forum/viewtopic.php?f=2&t=16844

Ctrl-G to go to the last line you want to select, by number.

Edit > Mark > Set Mark to set your selection-end marker.

Ctrl-G (or Ctrl-Home) to go to the first line you want to select.

Edit > Mark > Select to Mark

Upvotes: 3

Related Questions