Mac Install Vim

Posted on  by admin

Brew install vim Check the messages it produced for any manual actions you might be required to perform, although with Vim formula there should be no issues. One more thing you should do is to check your environment variables for those that might contain a full path to the system vi / vim, like EDITOR and update them to use the /usr/local/bin/vim. Apr 02, 2021 install mac vim / gvim. GitHub Gist: instantly share code, notes, and snippets.

  1. Mac Install Vim Plugin
  2. Mac Install Vim Plugins
  3. Mac Install Vimdiff
  4. Gvim For Mac Os X
  5. Mac Install Vim-go

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.

Mac install vim download

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/ ):

$ 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.

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.

: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

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

Then paste in these configuration options:

spf13 presents

spf13-vim is a distribution of vim plugins and resources for Vim, GVim and MacVim.
It is a completely cross platform distribution that stays true to the feel of vim while providing modern features like a plugin management system, autocomplete, tags and tons more.

  • Featured Plugins
  • Other Awesome stuff
  • Community
spf13-vim

Easy Installation *nix and os x

The easiest way to install spf13-vim is to use our automatic installer by simply copying and pasting the following line into a terminal. This will install spf13-vim and backup your existing vim configuration.

If you are upgrading from a prior version (before 3.0) this is also the recommended installation.

Updating to the latest version

Installing on Windows

On Windows and *nix Git and Curl are required.

Installing dependencies

Install msysgit

After installation try running git --version within command prompt (press Win-R, type cmd, press Enter) to make sure all good:

Setup Curl

Instructions blatently copied from vundle readmeInstalling Curl on Windows is easy as Curl is bundled with msysgit!But before it can be used with Vundle it's required make curl run in command prompt.The easiest way is to create curl.cmd with this content

And copy it to C:Program FilesGitcmdcurl.cmd, assuming msysgit was installed to c:Program FilesGit

to verify all good, run:

Installing spf13-vim on Windows

The easiest way is to download and run the spf13-vim-windows-install.cmd file.

The .vimrc file is suited to programming. It is extremely well organized and folds in sections. Each section is labeled and each option is commented.

It fixes many of the inconveniences of vanilla vim including

  • A single config can be used across Windows, Mac and linux
  • Eliminates swap and backup files from littering directories, preferring to store in a central location.
  • Fixes common typos like :W, :Q, etc
  • Setup a solid set of settings for Formatting (change to meet your needs)
  • Setup the interface to take advantage of vim's features including
    • omnicomplete
    • line numbers
    • syntax highlighting
    • A better ruler & status line
    • & more
  • Configuring included plugins

Customization

Create ~/.vimrc.local and ~/.gvimrc.local for any local customizations.

For example, to override the default color schemes:

Mac install vim-latex

Vundle The best plugin manager

Vundle is an excellent system built on the same principles as Pathogen, but with an integrated plugin management system that is Git and Github aware.

spf13-vim uses the Vundle plugin management system to have a well organized vim directory (Similar to mac's app folders). Vundle also ensures that the latest versions of your plugins are installed and makes it easy to keep them up to date.

NERDTreefile navigation

NERDTree is a file explorer plugin that provides 'project drawer' functionality to your vim editing. You can learn more about it with :help NERDTree or checkout my post on NERDTree.

QuickStart Launch using <Leader>e.

Mac install vim-go

Customizations:

Vim download mac
  • Use <C-E> to toggle NERDTree
  • Use <leader>e or <leader>nt to load NERDTreeFind which opens NERDTree where the current file is located.
  • Hide clutter ('.pyc', '.git', '.hg', '.svn', '.bzr')
  • Treat NERDTree more like a panel than a split.

ctrlpfast file finder

Ctrlp replaces the Command-T plugin with a 100% viml plugin. It provides an intuitive and fast mechanism to load files from the file system (with regex and fuzzy find), from open buffers, and from recently used files.

QuickStart Launch using <c-p>.

Surroundmanaging all the '[{}]' etc

This plugin is a tool for dealing with pairs of 'surroundings.' Examples of surroundings include parentheses, quotes, and HTML tags. They are closely related to what Vim refers to as text-objects. Provided are mappings to allow for removing, changing, and adding surroundings.

Details follow on the exact semantics, but first, consider the following examples. An asterisk (*) is used to denote the cursor position.

For instance, if the cursor was inside 'foo bar', you could type cs' to convert the text to 'foo bar'.

There's a lot more, check it out at :help surround

NERDCommentercomment++

NERDCommenter allows you to wrangle your code comments, regardless of filetype. View help :NERDCommenter for all the details.

QuickStart Toggle comments using <Leader>c<space> in Visual or Normal mode.

Syntasticintegrated syntax checking

Syntastic is a syntax checking plugin that runs buffers through external syntax checkers as they are saved and opened. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them.

numbers.vimbetter line numbers

This plugin will alternate between relative numbering (normal mode) and absolute numbering (insert mode) depending on the mode you are in. This allows you to easily move code around with the relative line numbers when in normal mode. As well as providing accurate line numbers when writing code in insert mode

neocomplcacheautocomplete++

NeoComplCache is an amazing autocomplete plugin with additional support for snippets. It can complete simulatiously from the dictionary, buffer, omnicomplete and snippets. This is the one true plugin that brings Vim autocomplete on par with the best editors.

QuickStart Just start typing, it will autocomplete where possible

Customizations:

  • Automatically present the autocomplete menu
  • Support tab and enter for autocomplete
  • <C-k> for completing snippets.

Fugitive deep git integration

Fugitive adds pervasive git support to git directories in vim. For more information, use :help fugitive

Use :Gstatus to view git status and type - on any file to stage or unstage it. Type p on a file to enter git add -p and stage specific hunks in the file.

Use :Gdiff on an open file to see what changes have been made to that file

QuickStart<leader>gs to bring up git status

Customizations:

  • <leader>gs :Gstatus
  • <leader>gd :Gdiff
  • <leader>gc :Gcommit
  • <leader>gb :Gblame
  • <leader>gl :Glog
  • <leader>gp :Git push
  • :Git ___ will pass anything along to git.

PIV PHP editing

The most feature complete and up to date PHP Integration for Vim with proper support for PHP 5.3+ including latest syntax, functions, better fold support, etc.

PIV provides:

  • PHP 5.3 support
  • Auto generation of PHP Doc (,pd on (function, variable, class) definition line)
  • Autocomplete of classes, functions, variables, constants and language keywords
  • Better indenting
  • Full PHP documentation manual (hit K on any function for full docs)

Tabularize align everything

Tabularize lets you align statements on their equal signs and other characters

Customizations:

  • <Leader>a= :Tabularize /=
  • <Leader>a: :Tabularize /:
  • <Leader>a:: :Tabularize /:zs
  • <Leader>a, :Tabularize /,
  • <Leader>a<Bar> :Tabularize /

Tagbartag generation and navigation

spf13-vim includes the Tagbar plugin. This plugin requires exuberant-ctags and will automatically generate tags for your open files. It also provides a panel to navigate easily via tags

QuickStartCTRL-] while the cursor is on a keyword (such as a function name) to jump to it's definition.

Customizations: spf13-vim binds <Leader>tt to toggle the tagbar panel

Note: For full language support, run brew install ctags to install exuberant-ctags.

Tip: Check out :help ctags for information about VIM's built-in ctag support. Tag navigation creates a stack which can traversed via Ctrl-] (to find the source of a token) and Ctrl-T (to jump back up one level).

EasyMotionjump anywhere

Vim

EasyMotion provides an interactive way to use motions in Vim.

It quickly maps each possible jump destination to a key allowing very fast and straightforward movement.

QuickStart EasyMotion is triggered using the normal movements, but prefixing them with <leader><leader>

For example this screen shot demonstrates pressing ,w

Adding Your Own Bundles

Create ~/.vimrc.bundles.local for any additional bundles.

To add a new bundle

Custom Settings

Create ~/.vimrc.local and ~/.gvimrc.local for any local customizations.

For example, to override the default color schemes:

Additional Syntaxes

Mac Install Vim Plugin

spf13-vim ships with a few additional syntaxes:

  • Markdown (bound to *.markdown, *.md, and *.mk)
  • Twig
  • Git commits (set your EDITOR to mvim -f)

Amazing Colors

spf13-vim includes solarized and spf13 vim color pack:

  • ir_black
  • molokai
  • peaksea

Use :color molokai to switch to a color scheme.

Snippets

It also contains a very complete set of snippets for use with snipmate or NeoComplCache.

Tutorials

  • Type vimtutor into a shell to go through a brief interactive tutorial inside VIM.
  • Read the slides at VIM: Walking Without Crutches.

Modes

Mac Install Vim Plugins

  • VIM has two (common) modes:
    • insert mode- stuff you type is added to the buffer
    • normal mode- keys you hit are interpreted as commands
  • To enter insert mode, hit i
  • To exit insert mode, hit <ESC>

Useful commands

  • Use :q to exit vim
  • Certain commands are prefixed with a <Leader> key, which by default maps to .
  • Spf13-vim uses let mapleader = ',' to change this to , which is in a consistent and convenient location.
  • Keyboard cheat sheet.

Mailing List
Be notified of major updates

Mac Install Vimdiff

Discussion Group
Discuss issues, ideas, plugins

Gvim For Mac Os X

Contributing
GitHub makes for easy contribution

Mac Install Vim-go

All development is done via GitHub. Fork and issue a pull request or file an issue.