Your problem is that that you put comments at the end of your lines separated by whitespaces. Vim interprets these whitespaces as part of your commands and mappings.
If you replace:
inoremap ii <esc> " ii to go back into command mode
By
" ii to go back into command mode
inoremap ii <Esc>
You will solve your problem.
As a general rule don't put comments at the end of your lines in your .vimrc
And as a bonus Here is a method to transform your .vimrc
in a proper format.
Edit Use this command. (Compared to the original one, the new line character \r
can be directly copied and you don't have to use ^M
. Thanks @Sato!)
:%s/\(^.*\)\s\+\(".*\)/\2\r\1
Original command
:%s/\(^.*\)\s\+\(".*\)/\2^M\1
(To insert the ^M
properly use Ctrl-vEnter to insert a real new line character)(To insert the ^M
properly use Ctrl-vEnter to insert a real new line character)
This command will capture the beginning of lines containing a comment on the end of the line and replace the full line with two lines containing the comment and then the command.
(Note that the command seems to mess with the function my_cr_function
so you might want to check that it doesn't create to much trouble in your .vimrc
maybe replace %
by some ranges and change your .vimrc
step by step)
@Sato also suggested this link about how comments and multiline works it is worth reading it.