Search code examples
vimmacvimiterm2

iTerm don't save 'set' parameters to use vim


I'm using iTerm2 with vim to work with python files. When I create or start editing a file using 'vi', I always have to introduce all the configuration values like ':set number', ':syntax on', etc. I have edited '.vimrc' from MacVim to save this parameters, but when I restart iTerm I have to put the values again, the configuration didn't save this 'set' values.

This is an example how i start the program: 'vi file.py'. It opens vim but without the 'set' values I have previously introduced.

It would be nice if someone could help me. Thank you.


Solution

    1. First rule: NEVER DO ANYTHING IN VIM'S RUNTIME FILES.

      In Vim, do :echo $VIM. That directory, /Applications/MacVim.app/Contents/Resources/vim, in your case, is off limits. You are not supposed to change/add/remove anything, there. There's no good reason to even look at it!

    2. Second rule: ALWAYS DO CUSTOMIZATION IN YOUR HOME DIRECTORY.

      Your customization belongs to your home directory.

      Your vimrc is here:

      ~/.vimrc    ~/ being a shortcut for /Users/username/
      

      Your vim/ is here:

      ~/.vim/     ~/ being a shortcut for /Users/username/
      

      You must create those files and directories if they don't already exist.

    Note: MacVim is a GUI app that won't work in your terminal unless you did some (simple) specific things. Did you do anything toward that goal? It looks like you are just using the default Vim that will obviously not source MacVim's runtime files.