在 sublime 裡刪除空白行

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

  1. Press CTRL + SHIFT + P
  2. Type Install onto the dialog window
  3. Select “Package Control: Install Package” and press “Enter”
  4. Search for and install “DeleteBlankLines

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” 鍵。

相關文章

寫留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *