emacs - deleting
Table of Contents
Delete all lines in a buffer that do not have the work ‘abcdef’
- Use the
keep-linescommand. M-x keep-lines- Enter the string or regular expression
- This will remove all lines that do not contain the literal string ‘abcdef’
Deleting characters and words in a line
Here is a summary of the delete operations:
| Command | Description |
|---|---|
| <DEL> | Delete the character just before the cursor |
| Ctrl d | Delete the next character after the cursor |
| Meta <DEL> | Kill the word immediately before the cursor |
| Meta d | Kill the next word after the cursor |
| Ctrl k | Kill from the cursor position to end of line |
| Meta k | Kill to the end of the current sentence (the next full stop) |
Delete empty lines in a region or in the buffer
M-x flush-lines RET ^$ RET