It depends on the charger. If it has a true "float" mode, then keeping it connected is probably best. Otherwise letting them run down a *little* bit and recharging will be fine. You don't want to cook the batteries, nor do you want them to self-discharge too much.
One reason you might want to keep the charger (usually) disconnected is to reduce the electrolysis
you might get from your shore-power connection. This also depends on your boat wiring
, the marina wiring
, and the boats nearby.
I have solar panels
that keep the batteries topped-off, which I think is the best arrangement. Removing the shore-power cord did reduce the rate at which I had to replace zincs. I could have added an isolator or transformer to the shore-power connection, but since I needed the solar panels
anyway, this was easiest and it works well.