Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete first word on mutiline with sublime text 2?

Tags:

sublimetext2

I want to delete mutiline word with sublime-text.

e.g. I want to delete all the line number (there are line numbers because I paste the code from somewhere) as follow:

enter image description here

like image 406
why Avatar asked Jan 07 '13 03:01

why


People also ask

How do you edit multiple lines in Sublime Text?

To select multiple regions using the keyboard, select a block of text, then press Ctrl+Shift+L to split it into one selection per line. When you're done with using multiple selections, just press Ctrl+K to trim all but the first.

How do I select multiple words in sublime?

Find All. To add all occurrences of the current word to the selection, use Find All: Windows/Linux: Alt+F3. Mac: ⌃+⌘+G.

How do you delete a line in Sublime Text?

To quickly delete a line in your code, place your cursor anywhere in the line and hit Ctrl–Shift–K (Mac and Windows).


2 Answers

Use column edit mode to remove them: http://www.sublimetext.com/docs/2/column_selection.html

For Windows with Mouse

Select with Right Mouse Button + Shift

OR

Select with Middle Mouse Button

Press CTRL for add to selection

Press ALT for subtract from selection

Using Only Keyboard

CTRL + ALT + Up

CTRL + ALT + Down

like image 110
Frank He Avatar answered Sep 28 '22 00:09

Frank He


You can also search and replace using regular expressions. The following is tested in the Windows-version:

  1. CTRL+H to open Replace dialog.
  2. Make sure regular expressions are used: click the icon to the far left in the replace dialog or use ALT+R.
  3. Enter ^[\d]+ in the Find What field to select any digits in the beginning of all lines.
  4. Leave the Replace With field blank to remove the digits.
  5. Click Replace All.

(Search for ^[\w]+ if you want to select the first word instead of only digits)

like image 45
Olle Sjögren Avatar answered Sep 27 '22 22:09

Olle Sjögren