CTRL-V in Vim

This year starts well with this small discovery of the CTRL-V keystroke in Vim insert mode. In fact, I did not need this before but as I had to learn the Go language, this tricks became very useful.

In Go, strangely, the indentation character is the tabulation and this is enforced by the language itself. Until now, I indented my code with several spaces depending on the file type. So, by default, I set Vim to expand the tabulation into spaces:

" Spaces instead of tabs
set expandtab

I must say the vim-go is excellent and I don't need to pay attention on this when I am coding. But the problem comes when I edit some text files containing some Go code, like in Markdown files. When I edit some code sections in these files, I need to force Vim to insert the real tab.

To do this, you only need to enter in Insert Mode and use CTRL-V. This is explained here: :h ins-expandtab.

Ok it is not the discovery of the year, but it can be useful.

Happy New Year !

Emacs 29.4 (Org mode 9.6.15)

Validate