How to run mvim (MacVim) from Terminal?

前端 未结 12 893
北荒
北荒 2020-11-30 15:55

I have MacVim installed and I am trying to set it up as the editor for Git (version control), but I can\'t run \'mvim\' from the command line as it isn\'t recognised. How d

相关标签:
12条回答
  • 2020-11-30 16:38

    In addition, if you want to use MacVim (or GVim) as $VISUAL or $EDITOR, you should be aware that by default MacVim will fork a new process from the parent, resulting in the MacVim return value not reaching the parent process. This may confuse other applications, but Git seems to check the status of a temporary commit message file, which bypasses this limitation. In general, it is a good practice to export VISUAL='mvim -f' to ensure MacVim will not fork a new process when called, which should give you what you want when using it with your shell environment.

    0 讨论(0)
  • 2020-11-30 16:39

    If you go the brew route, the best way to install would be:

    brew install macvim --with-override-system-vim
    

    That will provide mvim, vim, vi, view, etc. in /usr/local/bin (all symlinked to the copy in the Cellar). This also removes the need to create any aliases and also changes your vi, vim, etc. to all use the same Vim distribution as your MacVim.

    0 讨论(0)
  • 2020-11-30 16:39

    Assume MacVim is installed in the Application folder.

    Instead of adding MacVim path to your environment, create a link by typing this in terminal:

    sudo ln -s /Applications/MacVim.app/Contents/bin/mvim /usr/local/bin/mvim

    Then, open a new terminal window/tab and type mvim.

    0 讨论(0)
  • 2020-11-30 16:43

    I'm adding Bard Park's comment here for that was the real answer for me:

    Since mvim is simply a shell script, you can download it directly from the MacVim source at GitHub here: http://raw.github.com/b4winckler/macvim/master/src/MacVim/mvim

    0 讨论(0)
  • 2020-11-30 16:45

    There should be a script named mvim in the root of the .bz2 file. Copy this somewhere into your $PATH ( /usr/local/bin would be good ) and you should be sorted.

    0 讨论(0)
  • 2020-11-30 16:48

    I don't think I'd to add anything to the path, did

    brew install macvim
    
    mvim -v
    

    should then open macvim in the terminal, you can also go ahead and alias that

    alias vim='mvim -v'
    
    0 讨论(0)
提交回复
热议问题