I have selected text by visual mode and pressed :.
I run the following command unsuccessfully
w >> ~/Documents/Test/test.java
The result is an empty file.
How can you append text in Vim’s visual mode to another file?
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.
After selecting the text in visual mode and typing “:”, you should see “:'<,’>” already typed out for you. This means between the start and end of your visual selection. You can add “w >> ~/Documents/Test/test.java” after the “:'<,’>”. What you will see before hitting enter will be:
If the file doesn’t exist or you don’t have appropriate permissions, you will get an error, otherwise it should say “appended” and work. I tested that out and it works on Vim 7.2.