I want to delete everything up to the cursor or after the cursor or everything but selected text.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.