HOW TO DELETE BLANK LINES FROM SELECTION IN SUBLIME TEXT.
我是 sublime 的愛好者,在使用免費的版本一陣子後,在剛好有收入的情況下,也有讚助作者購買其序號,真的是一個好用的編輯器。
不像是 notepad++, sublime 的選單裡預設沒有刪除空白行的功能,需要手動操作:
Select the text
Press:
- Ctrl + H on PC, or
- Command + Alt + F on Mac or
- Click Find->Replace.
Make sure you have selected ‘regular expression’ by pressing:
- Alt + R on PC or
- Command + Alt + R on Mac or
- Click .* in the Find box.
Find what: ^\n
Replace With: (nothing, leave in blank).
上面的操作都太複雜,最佳解法是:
https://packagecontrol.io/packages/DeleteBlankLines
- Press CTRL + SHIFT + P (macOS 是 cmd+shift+p)
- Type Install onto the dialog window
- Select “Package Control: Install Package” and press “Enter”
- Search for and install “DeleteBlankLines”
然後在 menubar 的 Edit – Line 的目錄裡,就會多出一個 delete blank lines 的選項。
Shortcut Keys
Windows: – Ctrl+Alt+Backspace –> Delete Blank Lines – Ctrl+Alt+Shift+Backspace –> Delete Surplus Blank Lines
OSX: – Fn+Ctrl+Option+Delete –> Delete Blank Lines – Fn+Ctrl+Option+Shift+Delete –> Delete Surplus Blank Lines
Linux: – Ctrl+Alt+Backspace –> Delete Blank Lines – Ctrl+Alt+Shift+Backspace –> Delete Surplus Blank Lines
如果你有外接鍵盤的話,在 mac OSX 請使用 “Delete” 鍵,而不是 “Backspace” 鍵。