You must reside in Virginia at least half of the year.
You CAN be a resident of two states and while you are living in each state, you can legally purchase.
The problem is credentials -- the VSP documents go by ID -- usually driver license, but you can also show passport or USID/CAC but you will need to prove residence by showing other items such as utility bill, rental agreement, etc. Some dealers may not like that and MOST private sellers will probably not like it at all.
Here is the ATF's statement on dual-state residency WRT firearms purchases:
"ATF has previously addressed the eligibility of individuals to acquire firearms who maintain residences in more than one State. Federal regulations at 27 CFR 478.11 (definition of State of Residence), Example 2, clarify that a U.S. citizen with homes in two States may, during the period of time the person actually resides in a particular State, purchase a firearm in that State. See also ATF Publication 5300.4 (2005), Question and Answer B12, page 179. Similarly, in ATF Ruling 80-21 (ATFB 1980-4, 25), ATF held that, during the time college students actually reside in a college dormitory or at an off-campus location, they are considered residents of the State where the on-campus or off-campus housing is located."
See Ruling 2010-6
ATF Pub 5300.4 (2005) Q&A B12:
(B12) May a person (who is not an alien) who resides in one State and owns property in another State purchase a handgun in either State?
If a person maintains a home in 2 States and resides in both States for certain periods of the year, he or she may, during the period of time the person actually resides in a particular State, purchase a handgun in that State. However, simply owning property in another State does not qualify the person to purchase a handgun in that State.
[27 CFR 478.11]