A Mobile man who was set to go on trial this week for a 2022 shooting instead has pleaded guilty to attempted murder.