4

I downloaded the vimrc from amix/vimrc which is very helpful for starting out in vim. But as I try to edit the .vim_runtime I keep getting errors. Here is my .vimrc

set runtimepath+=~/.vim_runtime
    source ~/.vim_runtime/vimrcs/basic.vim
    source ~/.vim_runtime/vimrcs/filetypes.vim
    source ~/.vim_runtime/vimrcs/plugins_config.vim
    source ~/.vim_runtime/vimrcs/extended.vim
 try
    source ~/.vim_runtime/my_configs.vim
 catch
 endtry

Now I wanted to change the settings for my NERDTree plugin but I don't know where to edit my setting. The configuration is confusing to a new person to vim. I found this similiar question but it doesn't doesn't help in my endevour. Can someone explain the difference between the vimrc and vimruntime? I can see that the vimrc grabs the settings from the .vim_runtime but do I add settings to vimrc or vimruntime? Which one is the best place to add settings?

Community
  • 1
  • 1
Victor Frank
  • 39
  • 1
  • 5

1 Answers1

10

You are using someone else Vim config files which is a can be a bit tricky, especially when the vimrc file is large or broken up into many files.

What's going on here?

amix has decided to break up his vimrc config into smaller files to help organize his vimrc file. He has done this by :source-ing these files form his vimrc file (See :h :source). Now in theory you can add your NerdTree setting inside one of these other files, probably ~/.vim_runtime/vimrcs/plugins_config.vim.

It should be noted that this file convention is not native Vim, just something that amix has invented to help him deal with a sprawling vimrc file. His conventions may not line up with your own organization and may hinder if you seek help in the future.

A friendly warning

There are a few thing to note about young vimmers using other's configuration files:

  • Often using a large and/or complex vimrc will lead confusion when you want to make your own customizations
  • A vimrc file is a very opinionated file. Your opinions may clash
  • Assumpting that the vimrc your copied is "good" or more likely: "good for your workflow"
  • Often many settings are simply copied without any understanding. Good example is the 'gdefault' option (See :h 'gdefault')
  • Copying without understanding can lead to cargo cult programming
  • Vimrc files are prone to cruft. This means you are probably copying things that aren't being used anymore, are confusing, or just plain broken

Thoughts

It is often best to start with a small vimrc file and slowly add to it as you learn. This means you understand every line in your vimrc. A good place to start with your vimrc is: idiomatic-vimrc.

For general Vim customization advice I will point you to Drew Neil's Vimcast post: On sharpening the saw

For more information see:

:h vimrc-intro
:h vimrc_example.vim
:h vimrc
:h startup
:h :source
:h 'gdefault'
Peter Rincker
  • 43,539
  • 9
  • 74
  • 101
  • Great answer very helpful and direct! Thank you for the advice I do not disagree, I was hoping to get a jump into a working text editor so that I would enjoy using it and thus work in it more frequently. Maybe a little too eager.. – Victor Frank May 21 '15 at 02:24