derekwyatt / vim-fswitch

Vim plug for switching between companion source files (e.g. ".h" and ".cpp")
179 stars 57 forks source link

abcd.cc switched to abcd.hh #15

Closed khingblue closed 8 years ago

khingblue commented 8 years ago

I'm editing abcd.cc, and tried :FSHere, it opens abcd.hh as a new file, instead of opening existing abcd.h.

I also tried following configuration, but still not working:

augroup mycppfiles
  au!
  au BufEnter *.h let b:fswitchdst  = 'cpp,cc,C'
augroup END

Is there any other configuration need to be added? Thanks.

derekwyatt commented 8 years ago

I haven't used this plugin in a lot of years, so this might not be correct, but... I think you have it backwards. If you're trying to switch from a cc file to an h file then you need to set the configuration up when you enter a cc file. Something like this:

augroup mycppfiles
  au!
  au BufEnter *.h let b:fswitchdst  = 'cpp,cc,C'
  au BufEnter *.cc let b:fswitchdst  = 'h'
augroup END
khingblue commented 8 years ago

Thanks, that works for me.