What does ^M character mean in Vim?

Unix uses 0xA for a newline character. Windows uses a combination of two characters: 0xD 0xA. 0xD is the carriage return character. ^M happens to be the way vim displays 0xD (0x0D = 13, M is the 13th letter in the English alphabet). You can remove all the ^M characters by running the following: :%s/^M//g … Read more

Vim and Ctags tips and tricks [closed]

Ctrl+] – go to definition Ctrl+T – Jump back from the definition. Ctrl+W Ctrl+] – Open the definition in a horizontal split Add these lines in vimrc map <C-\> :tab split<CR>:exec(“tag “.expand(“<cword>”))<CR> map <A-]> :vsp <CR>:exec(“tag “.expand(“<cword>”))<CR> Ctrl+\ – Open the definition in a new tab Alt+] – Open the definition in a vertical split … Read more

Using Vim’s tabs like buffers

Stop, stop, stop. This is not how Vim’s tabs are designed to be used. In fact, they’re misnamed. A better name would be “viewport” or “layout”, because that’s what a tab is—it’s a different layout of windows of all of your existing buffers. Trying to beat Vim into 1 tab == 1 buffer is an … Read more

What is your most productive shortcut with Vim?

Your problem with Vim is that you don’t grok vi. You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way … Read more