Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace \n with actual new line in Sublime Text

How can I replace \n in Sublime Text with real in-editor displayed new line so:

foo\nbar 

becomes:

foo bar 

in the editor when I view the file in it.

like image 466
leemour Avatar asked Dec 11 '13 09:12

leemour


People also ask

How do you replace N with a new line?

So: Press CTRL-h and the Replace dialog will open. Type \r\n in "Find what" and \\r\\n in "Replace with". Then select search mode Extended (\r, \n, \t, \x..., \0) and click "Replace All".

How do I insert a line break in sublime?

To insert a new line below the current line in your code, hit Cmd–Return (Mac) or Ctrl–Enter(Windows).

How do I find and replace in Sublime Text?

To use Find and Replace in Sublime Text 3, you can either click “Find” in the top-bar, then select “Replace” from the list, or you can press the keyboard shortcut Ctrl+H – the same way it works in, for example, Microsoft Office Word.

How do I create a new line in Find and Replace in Visual Studio?

In the local searchbox ( Ctrl + F ) you can insert newlines by pressing Ctrl + Enter . If you use the global search ( Ctrl + Shift + F ) you can insert newlines by pressing Shift + Enter .


1 Answers

Turn on Regex Search and Replace (icon most to the left in search and replace bar or shortcut Alt + R)

Find What: \\n
Replace with: \n

like image 87
chrisg86 Avatar answered Sep 28 '22 12:09

chrisg86