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?
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?
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:
:'<,'>w >> ~/Documents/Test/test.java
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.