Combining the construction "ir + gerúndio" and past subjunctives

I wanted to say something like “if I were to live in Portugal, maybe I would (gradually) get used to walking on calçadas” and I wrote:

Se eu vivesse em Portugal, talvez me fosse habituando a andar nas calçadas.

Is this correct? Is this the right way to combine the construction “ir + gerúndio” and past subjunctives in a conditional sentence?

@q70007, yes, this is grammatically correct and a fine way to express the progressiveness that the gerúndio is so useful for. It also works because you are specifically using talvez. If you were to use an alternative such as se calhar, the past subjunctive would no longer be triggered on the second clause, only the first:

  • Se eu vivesse em Portugal, se calhar ia [or iria] habituar-me a andar nas calçadas. ~ Se eu vivesse em Portugal, se calhar ia-me [or ir-me-ia] habituando a andar nas calçadas.