Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).

Please use new tips to discuss whether this page should be a permanent tip, or whether it should be merged to an existing tip.
created May 3, 2012 · complexity basic · author Baliganikhil · version 7.0

Many first time users find it very hard to use Vim. Especially those who come from X-Windows based editors (GUI Editors). This is a small tip to map standard shortcuts which we find in most editors with shortcuts in Vim.

Mapping short-cut keysEdit

Open the ~/.vimrc file if it exists, if not, create a new file. Paste the following remapping code into it.

set smartindent
set tabstop=4
set shiftwidth=4
set expandtab

set mouse=a
set nu

:map <C-a> GVgg
:map <C-n> :enew
:map <C-o> :e . <Enter>
:map <C-s> :w <Enter>
:map <C-c> y
:map <C-v> p
:map <C-x> d
:map <C-z> u
:map <C-t> :tabnew <Enter>
:map <C-i> >>
:map <C-w> :close <Enter>
:map <C-W> :q! <Enter>
:map <C-f> /
:map <F3> n
:map <C-h> :%s/
:map <S-t> vat
:map <S-T> vit
:map <S-{> vi{
:map <S-(> vi(
:map <S-[> vi[

Once you are done, restart Vim. Now the following should work.

Ctrl + a --> Select All
Ctrl + n --> New File (Also See Ctrl + t)
Ctrl + o --> Open File (Opens current folder to browse)
Ctrl + s --> Save File
Ctrl + c --> Copy
Ctrl + v --> Paste
Ctrl + x --> Cut
Ctrl + z --> Undo
Ctrl + r --> Redo
Ctrl + t --> Open new tab
Tab --> Indent
Ctrl + w --> Close (tab)
Ctrl + W --> Force close (Quit)
Ctrl + f --> Find
F3 --> Find Next
Ctrl + h --> Replace All
Shift + t --> Select (HTML, XML etc.) tag (inclusive)
Shift + T --> Select (HTML, XML etc.) tag (exclusive)
Shift + { --> Select text between flower brackets
Shift + [ --> Select text between square brackets
Shift + ( --> Select text between parentheses


This is my first tip - If there are some mistakes or improvements that can be made, please do let me know

If You don't want to lose some of vim's powerfull commands its' WORTH TO READ BENEATH!

I don't think I'd ever recommend anything like this, without offering replacements for the lost functionality. Almost everything you use here overrides a very useful built-in command.

Ctrl + a --> Increment number
Ctrl + n --> ''this one is OK, a synonym for the j command''
Ctrl + o --> Navigate backward in jump list
Ctrl + s --> ''this one is OK, it doesn't do anything on its own''
Ctrl + c --> Interrupt action that is taking too long
Ctrl + v --> Start "visual block" mode
Ctrl + x --> Decrement number
Ctrl + z --> Send Vim to background ''admittedly, probably OK for GUI vim''
Ctrl + r --> No need for a mapping, this is already a redo action
Ctrl + t --> Go back in tag list
Ctrl + i/Tab --> Navigate forward in jump list
Ctrl + w --> prefix for ALL the window switching commands
Ctrl + W --> Indistinguishable from the above
Ctrl + f --> ''probably OK, there are synonyms and this is probably infrequently used''
F3 --> ''This is OK, Vim doesn't use any F{num} keys by default''
Ctrl + h --> ''this is OK, synonym for the h command''
Shift + t --> Jump to previous specified letter
Shift + T --> indistinguishable from above (think about it, how do you type 'T' compared to 't'?)
Shift + { --> { is "jump to previous paragraph", very useful...I'm not sure how you'd even type Shift+{, it's already a shifted key.
Shift + [ --> [ starts many movement commands, Shift+[ gives you a {.
Shift + ( --> ( jumps between sentences, but ( is already shifted, how do you even type this?

If you want a point-and-click editor, you might try the Cream distribution of Vim. But in general, intentionally crippling Vim's powerful interface is a bad idea. --Preceding unsigned comment added by Fritzophrenic 20:54, May 3, 2012

You are right in that some features get overwritten. This tip is not for advanced users - it is for beginners who find it very hard to remember commands but are used to these in other editors. --Preceding unsigned comment added by Baliganikhil 08:46, May 4, 2012
Thanks to Baliganikhil for the new tip, but Fritzophrenic is correct: Vim users should work how to use Vim (Tutorial is the start of an attempt to provide guidance), so these mappings are more of a current individual preference than general advice. Perhaps this should be moved to a user page?
I do agree about Ctrl-A/C/V/X: when I used Konversation for the first time (the IRC client with KDE on Linux) I wondered how to copy some of the messages, and sure enough Ctrl-C worked. About that time I decided that Vim old timers had lost the battle over those keys, and I worked out how to properly map them (I intend fixing 356 Quick yank and paste one day). However, mapping Ctrl-C to y is not helpful. I only use Ctrl-C/V for copy/paste with other applications: within Vim, it is essential to learn the basics like y and p. Also, it is never a good idea to map a key that is easy to press for :q! because sooner or later the key will be pressed accidentally and a lot of work will be lost. JohnBeckett 10:38, May 4, 2012 (UTC)

I think that the above reply paired with the original tip is very useful. For example, I never use tags (maybe that's my fault?) but I find it very convenient to have a hotkey for opening a new tab, and vim doesn't provide this. I can rest assured that, at least for the time being, I haven't lost any functionality that I might care about, and now I've learned some new commands about tagging that might help me in the future.

This is a nice summary of what "normal hotkeys" do in vim. Very convenient as a reference.

18:08:2014 - a guest added the first line of comments - he could never know about that vim's native commands. Thanks to Fritzophrenic, he knows now.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.