Wednesday, September 26, 2012

Re: why is it so difficult to start using vim (may be just for me).

On Wednesday, September 26, 2012 5:04:51 AM UTC-5, MarcWeber wrote:
> First try
>
>
>
> vimtutor
>
>
>
> (run it within your shell)
>
>
>
> Its a command opening a special file containing some initial training
>
> such as how to delete, insert, edit text and the like
>
>

I will second this, "vimtutor" is pretty much the first thing anybody should run after installing Vim for the first time.

After you've mastered the basics, browsing http://vim.wikia.com/wiki/Category:Getting_started is probably a good idea, too.

>
> Then next have a look at additional minimal information. The one I
>
> consider most important is here:
>
> https://github.com/MarcWeber/vim-addon-manager/blob/master/autoload/sample_vimrc_for_new_users.vim
>
>

Here, I have to disagree. I think a "minimal" .vimrc for new users should NOT:

1. rely on or configure external plugins, like your "tlib" plugin mappings in this example .vimrc
2. set 'hidden'. While it is useful for many workflows, by default Vim will not let you accidentally leave a file modified and unsaved. This is a GOOD default for new users. I think 'confirm' would be a far better default than 'hidden', and perhaps the warning given when trying to leave a buffer with neither set could point to these options, but certainly 'hidden' will cause all sorts of headaches for people who don't understand all its implications. And I doubt a brand-new Vim user will understand all those implications.
3. include text outside of comments after a "finish" statement. While a neat trick, this is just confusing, especially when syntax highlighting is turned on.
4. include complicated mappings or functions whose meaning or purpose cannot be easily grasped by new users without a bunch of searching.

I think a far better example .vimrc is the vimrc_example.vim included with Vim. Admittedly it has its faults, but it doesn't do anything completely crazy. Another good example is http://vim.wikia.com/wiki/Example_vimrc but this one also sets the 'hidden' option, which as I note above I disagree with in a beginners example .vimrc. At least this one has the decency to explain the reasoning and alternatives in a comment.

While I write this, http://vim.wikia.com/wiki/Example_vimrc does not explain a couple things very well about 'hidden', I think I'll fix this later this week:
1. It claims 'hidden' will allow you to "keep an undo history for multiple files". This is true, but it can also be accomplished using any or all of:
a. persistent undo
b. multiple split windows
c. multiple tab pages
2. It says "Vim will complain if you try to quit without saving", presumably as a way of helping with the accidentally leaving modified files unsaved. However, I (and many others) just leave Vim running throughout most of the day, editing and closing files as I go. When I go to compile my code or test my script (outside of Vim more often than not), I want to know that all files involved have been saved without searching for hidden buffers. :wa is not a good alternative, sometimes I have some things open in the editor which I'm not ready to save just yet in addition to whatever code I'm working on.

--
You received this message from the "vim_use" 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

No comments: