Adding settings to .vimrc doesn't work

76 views
Skip to first unread message

vital...@gmail.com

unread,
May 2, 2017, 2:42:43 PM5/2/17
to vim_mac
Hello!

My system:
Mac OS 10.11.6

My version of Macvim:
Custom Version 8.0.525 (130)

Vim version installed on my Mac is:
version 7.3

I am only the beginner. In one of the videos I watched the tutor
gives a great advice on switching off arrows key to avoid temptation
to use them when in an insert mode, for example. I tried to follow the
recommendation by entering a few lines (see below) into .vimrc file,
but nothing's changed - I am still able to play around with those arrows.

I will be grateful for your help.
As I am using Macvim, I have opened .vimrc file by typing:

:tabe ~/.vimrc

Then I entered 8 lines:

"Unmap the arrow keys

no <down> <Nop>
no <left> <Nop>
no <right> <Nop>
no <up> <Nop>

ino <down> <Nop>
ino <left> <Nop>
ino <right> <Nop>
ino <up> <Nop>

Then I closed the file saving the content by typing:
:wq

Then I checked if the content is saved by opening the file again:
:tabe ~/.vimrc

and indeed everything is there.

But when I enter insert mode in another file I am currently editing,
I can freely move around with those arrow keys while in the insert
mode, so the above lines didn't do the job. Please, help me to find
my mistake, and to correct it.

Thank you very much!

Yongwei Wu

unread,
May 2, 2017, 10:20:29 PM5/2/17
to vim...@googlegroups.com
I laughed at the self-abusing "great advice", but it did work for me.
Did you start a new Vim instance after saving .vimrc?

(Let me state again, it is a bad, silly advice. The tool should be
there to help you. You shall not be treated as having to adapt to
specific tools or machines.)
> --
> --
> You received this message from the "vim_mac" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_mac" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.




--
Yongwei Wu
URL: http://wyw.dcweb.cn/

David Henderson

unread,
May 2, 2017, 10:42:03 PM5/2/17
to vim...@googlegroups.com

On 02 May 2017, at 19:20, Yongwei Wu <wuyo...@gmail.com> wrote:

> I laughed at the self-abusing "great advice", but it did work for me.
> Did you start a new Vim instance after saving .vimrc?
>
> (Let me state again, it is a bad, silly advice. The tool should be
> there to help you. You shall not be treated as having to adapt to
> specific tools or machines.)
>

Or one could just :source ~/.vimrc in vim to reload the changed rc file.

David P Henderson
c: xxx.xxx.xxxx
--
"You don't use science to show that you're right, you use science to become right."
-- Randall Munroe (http://xkcd.com)

Alla

unread,
May 3, 2017, 1:09:28 AM5/3/17
to vim...@googlegroups.com
On 5/3/17 05:20, Yongwei Wu wrote:
> I laughed at the self-abusing "great advice", but it did work for me.
> Did you start a new Vim instance after saving .vimrc?
>
> (Let me state again, it is a bad, silly advice. The tool should be
> there to help you. You shall not be treated as having to adapt to
> specific tools or machines.)

<snip>


Thank you for your reply. Nice that my post elicited your laughter. :-)
I see your point, and thank you for explaining this. As a beginner in
programming
I still can't decipher a good advice from a bad one. That one sounded
reasonable for those who are just starting using Vim, and this could
help them
to develop a physical habit of avoiding "easy" conventional tools, which
are
redundant and not useful in Vim.
And no, I didn't start the new instance of Vim. I just did, and, yes, it
works.

Could you, please, share what types of changes/settings are reasonable
to add to vimrc?

--
Respectfully,
Alla

Alla

unread,
May 3, 2017, 1:10:33 AM5/3/17
to vim...@googlegroups.com

On 5/3/17 05:39, David Henderson wrote:
> On 02 May 2017, at 19:20, Yongwei Wu <wuyo...@gmail.com> wrote:
>
>> I laughed at the self-abusing "great advice", but it did work for me.
>> Did you start a new Vim instance after saving .vimrc?
>>
>> (Let me state again, it is a bad, silly advice. The tool should be
>> there to help you. You shall not be treated as having to adapt to
>> specific tools or machines.)
>>
> Or one could just :source ~/.vimrc in vim to reload the changed rc file.

Thank you!

--
Respectfully,
Alla

Yongwei Wu

unread,
May 3, 2017, 1:54:10 AM5/3/17
to vim...@googlegroups.com
On 3 May 2017 at 13:11, Alla <vital...@gmail.com> wrote:
> I see your point, and thank you for explaining this. As a beginner in
> programming
> I still can't decipher a good advice from a bad one. That one sounded
> reasonable for those who are just starting using Vim, and this could help
> them
> to develop a physical habit of avoiding "easy" conventional tools, which are
> redundant and not useful in Vim.

Let me be more specific in this case. The arrow keys are designed to
help you navigate. No matter what Vim enthusiasts say, I do not
consider using arrow keys is a problem. You have to use arrow keys in
other application, so using them is not a bad habit. It is especially
the case in Insert Mode, as there are no alternatives.

> And no, I didn't start the new instance of Vim. I just did, and, yes, it
> works.
>
> Could you, please, share what types of changes/settings are reasonable
> to add to vimrc?

There are simply too many settings in Vim. I believe you can find a
lot of tutorials. It is process of continuous learning. And people
normally also have a lot of plugins, which may or may not be reflected
in their .vimrc files.

I have an old Linux .vimrc already on the web. Although it is a bit
outdated, my current .vimrc on Mac is evolved from that one. Maybe you
can consult that one first:

http://wyw.dcweb.cn/vim/.vimrc.html

It is commented, and you can do ":help keyword" for features you are
not familiar with.

A few more additions:

" The plugin package bundled with Vim 8 is useful, when you
" accidentally opening a file a second time.
if v:version >= 800
packadd! editexisting
endif

" Vim 7+ has spelling check
if has('syntax')
nmap <silent> <F7> :setlocal spell!<CR>
imap <silent> <F7> <C-O>:setlocal spell!<CR>
endif

" Make syntax highlighting more accurate by synchronizing more lines
au BufReadPost * syn sync minlines=1000

Alla

unread,
May 3, 2017, 3:07:35 AM5/3/17
to vim...@googlegroups.com

On 5/3/17 08:54, Yongwei Wu wrote:
> On 3 May 2017 at 13:11, Alla <vital...@gmail.com> wrote:
>> I see your point, and thank you for explaining this. As a beginner in
>> programming
>> I still can't decipher a good advice from a bad one. That one sounded
>> reasonable for those who are just starting using Vim, and this could help
>> them
>> to develop a physical habit of avoiding "easy" conventional tools, which are
>> redundant and not useful in Vim.
> Let me be more specific in this case. The arrow keys are designed to
> help you navigate. No matter what Vim enthusiasts say, I do not
> consider using arrow keys is a problem. You have to use arrow keys in
> other application, so using them is not a bad habit. It is especially
> the case in Insert Mode, as there are no alternatives.

I see.
>
>> And no, I didn't start the new instance of Vim. I just did, and, yes, it
>> works.
>>
>> Could you, please, share what types of changes/settings are reasonable
>> to add to vimrc?
> There are simply too many settings in Vim. I believe you can find a
> lot of tutorials.

Yes, there are a lot of those online. But as you can see there might be
misleading nuances.
I am grateful for being able to consult here to get a proper understanding.
> It is process of continuous learning. And people
> normally also have a lot of plugins, which may or may not be reflected
> in their .vimrc files.
>
> I have an old Linux .vimrc already on the web. Although it is a bit
> outdated, my current .vimrc on Mac is evolved from that one. Maybe you
> can consult that one first:
>
> http://wyw.dcweb.cn/vim/.vimrc.html
>
> It is commented, and you can do ":help keyword" for features you are
> not familiar with.

<snipped more very helpful comments>

Thank you very much! I will study your file, and implement your advice.

--
Respectfully,
Alla

Tony Mechelynck

unread,
May 3, 2017, 2:12:40 PM5/3/17
to vim_mac
I agree. In many cases there are several different ways to get a certain result in Vim, and IMHO this is an advantage, not an inconvenient. Some Vim users pefer to move with hjkl. Others prefer to use arrow keys. Still others prefer to click the mouse where they want to go. Others use one or the other of these different methods depending on circumstances. So what? If it works for you, use it.

Let me take a comparison from a different field of experience: Most people feel more at ease when writing with the right hand, but a significant minority prefers to use the left hand, and a small minority can start with the chalk in the left hand on the left side of the blackboard and end the same line with the chalk in the right hand on the right side of the same blackboard (or vice-versa if using RTL script like among others Hebrew or Arabic. When my mother was in grade school (in the 1930s) all lefties were forced to write with the right hand: so my mother ended up writing with the right hand (because she was forced) and sewing with the left (because she wasn't). When playing tennis some 50 years ago, she used to pass the racket from one hand to the other, which upset her friends playing with her.

Nowadays most teachers let lefties write with their right hand, they think they have better things to learn than which hand to put the pen in. By forcing yourself to use always hjkl and never ←↓↑→ you are figuratively (and voluntarily) putting yourself into the position of one of these "forced lefties" of 85 years ago. Good luck!

Best regards,
Tony.

Tony Mechelynck

unread,
May 3, 2017, 2:19:44 PM5/3/17
to vim_mac
Oops! Nowadays they let lefties write with their _left_ hand of course.

Alla

unread,
May 4, 2017, 12:39:24 AM5/4/17
to vim...@googlegroups.com


On 5/3/17 21:12, Tony Mechelynck wrote:
> On Wednesday, May 3, 2017 at 7:54:10 AM UTC+2, Yongwei Wu wrote:
>> On 3 May 2017 at 13:11, Alla <vital...@gmail.com> wrote:
>>

<snip>
> Nowadays most teachers let lefties write with their right hand, they think they have better things to learn than which hand to put the pen in. By forcing yourself to use always hjkl and never ←↓↑→ you are figuratively (and voluntarily) putting yourself into the position of one of these "forced lefties" of 85 years ago. Good luck!

I don't agree that this is a good comparison: being a left-handed person
is a natural feature, while anything one does in Vim is a matter of
acquiring a certain skill - mental and physical.
>
> Best regards,
> Tony.
>

--
Respectfully,
Alla

Tony Mechelynck

unread,
May 4, 2017, 5:48:42 AM5/4/17
to vim...@googlegroups.com
Well, in one case you acquire certain mental and physical skills with
Vim, in other cases you acquire mental and physical skills with a pen.
The only difference I see is that being left-handed is congenital,
possibly even innate, while preferring to use ←↓↑→ over hjkl is
acquired — you probably hadn't even met hjkl before you started using
Vim.

I still think — together with Yongwei Wu, another old-timer — that one
should not artificially restrict oneself not to use some particular
abilities of Vim. But, well, you want to learn to "write" with the
"hand" you don't feel most at ease with, it's your problem, go ahead.

Best regards,
Tony.

Alla

unread,
May 4, 2017, 5:55:42 AM5/4/17
to vim...@googlegroups.com
Tony, I came here for an advice, and I am happy I got it, and I did heed
to it. :-)
If not the help from Yongwei Wu, I wouldn't know that it's all right to
use such
things as arrow keys. Time and practice will help me to get a better
understanding
about the tools.
Reply all
Reply to author
Forward
0 new messages