I want to delete everything up to the cursor or after the cursor or everything but selected text.
What you want sounds a pretty infrequent thing to be done, but here are a few ways to do it:
First, put cursor on start of text you want to keep. Press C-space to set mark. Then, use M-< (beginning-of-buffer) and afterwards C-w (kill-region-x). Now, everything before text is deleted.
Next, go to end of text and set mark once again with C-space. Now, go to end of buffer with M-> and once again delete everything with C-w.
This is one way to do it.
Other way is to simply copy selected text and put it into new buffer. I'll leave it to you as an exercise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With