4 years ago
When typing C++'s scope resolution operator (
::) in vim, the program will dedent your line to the first line typing when typing the first colon, and reindent when typing the second colon. This is because vim assumes you are typing a label. This jump can be at best jarring and at worst annoying.
Since labels are rarely used in C++, this snippet will disable this automatic dedent. If you are typing a label, you can always dedent it yourself.
" Disable automatic label dedent. " Can also be set in ~/.vim/after/ftplugin/cpp.vim autocmd FileType cpp setlocal cinoptions+=L0