Renaming the current file in Vim

The command is called :saveas, but unfortunately it will not delete your old file, you’ll have to do that manually. see :help saveas for more info. EDIT: Most vim installations have an integrated file explorer, which you can use for such operations. Try :Explore in command mode (I would actually map that to a function … Read more

What are the benefits of learning Vim? [closed]

I’ve been using vi and vim also for some 20 years, and I’m still learning new things. David Rayner’s Best of Vim Tips site is an excellent list, though it’s probably more useful once you have some familiarity with vim. I also want to mention the ViEmu site which has some great info on vi/vim … 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 Caps Lock as Esc in Mac OS X

Edit: As described in this answer, newer versions of MacOS now have native support for rebinding Caps Lock to Escape. Thus it is no longer necessary to install third-party software to achieve this. Here’s my attempt at a comprehensive, visual walk-through answer (with links) of how to achieve this using Seil (formerly known as PCKeyboardHack). … Read more

How to convert the ^M linebreak to ‘normal’ linebreak in a file opened in vim?

Command :%s/<Ctrl-V><Ctrl-M>/\r/g Where <Ctrl-V><Ctrl-M> means type Ctrl+V then Ctrl+M. Explanation :%s substitute, % = all lines <Ctrl-V><Ctrl-M> ^M characters (the Ctrl-V is a Vim way of writing the Ctrl ^ character and Ctrl-M writes the M after the regular expression, resulting to ^M special character) /\r/ with new line (\r) g And do it globally … Read more

Changing case in Vim

Visual select the text, then U for uppercase or u for lowercase. To swap all casing in a visual selection, press ~ (tilde). Without using a visual selection, gU<motion> will make the characters in motion uppercase, or use gu<motion> for lowercase. For more of these, see Section 3 in Vim’s change.txt help file.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)