Install Vim Mac Terminal

Posted on  by admin

Sep 24, 2019 Normally when you have to edit a file in the terminal, you use vim filename command for that. But some command line utilities allow you to edit their configuration files in the default text editor. Since Nano is the default text editor in Ubuntu, you might not like that the files are being opened in Nano. To install a plugin using vim-plug, add the list of plugin names between the two call statements. Then restart Vim and run the Vim command:PlugInstall to install all the plugins declared in the.vimrc file. Read more vim-plug usage here. Tip: Instead of restarting Vim, you can reload the Vim configuration by running the Vim command:so%.

All configuration options for vim are stored in the user’s home directory in a file named .vimrc

The script code is below but there are somethings you’ll want to do before setting it up.

You’ll need to create directories for the following: backups, colors, swaps and undo.

Execute this command to set up the directories in the terminal ( The ~ character will set the path to your home directory. ex: /Users/username/ ):

Mac

$ cd ~/.vim ; mkdir backups ; mkdir colors ; mkdir swaps; mkdir undo;

This will keep all your backups, swaps and undos in your .vim user directory. Also the colors directory is for installing themes.

Visit vimninjas.com if you would like to download a color scheme. Once you find a color scheme you like, just download it and copy and paste the code into the relevant scheme file and place the file in ~/.vim/colors/

For example if you download the Candy theme, you would name the file candy.vim and place it in the relevant directory described above. Then in your .vimrc config file you would set the theme like so:

I've created a github repo with the .vimrc configuration. Please take a look at the repo and download from here.

Install Vim Mac Terminals

Install vim mac terminals

Checkout or download the git zip and setup the .vimrc file by using the cp command.

$ cd ~/Downloads/MacOSVimConfig-master
$ cp vimrc-example ~/.vimrc

Otherwise you can create your .vimrc file by copying the Raw text from github and pasting the text below. NOTE: While in vim before you paste try doing this command.

Mac vim commands

:set paste

This should paste the text with the best result. Once the .vimrc file is configured open a new terminal windows and open a file to test out the setup.

$ vim ~/.vimrc

Mac Vim Setup

------------ .vimrc example configuration ------------------

Vim

Then paste in these configuration options: