In the good old days, I used Emacs but for the last 15 years or so, I have been using kate for all purposes, same as @TrekJunky . It’s very mature, has excellent syntax highlighting, and, as common with KDE-apps, lots of options for customizing.
However, for C++, I recently started to use VS Code but I consider it to be more an IDE (Integrated Development Environment) than a mere editor.
In terminal, I never really got familiar with vi, so I mostly used joe (Joe’s Own Editor - with WordStar inspired commands) when in need. Nowadays, I take nano which is almost identical and comes preinstalled almost anywhere.