Run brew link macvim You now have the latest versions of vim and macvim managed by brew. Run brew update && brew upgradeevery once in a while to upgrade them. This includes the installation of the CLI mvimand the mac application (which both point to the same thing). Setup Tmux with Vim for Mac Posted by Ha.Minh in Productivity Why Tmux. When working on the Mac Terminal, I used to create multiple tabs. Then I can switch quickly between tabs using Ctrl + Shift + and Ctrl + Shift +. While this works smoothly, one annoying. I tried to update my vim using homebrew by typing brew install vim and everything seemed to be fine. When I type vim I still see the system vim loading (version 7.3). I feel like I'm missing a step that's keeping me from using the updated vim I got from homebrew.
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
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:
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
.
Customizations:
- 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.
Mac Vim Setup
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
Mac Install Vim
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
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
spf13-vim ships with a few additional syntaxes:
- Markdown (bound to *.markdown, *.md, and *.mk)
- Twig
- Git commits (set your
EDITOR
tomvim -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.
Install Vim Mac Brew
Tutorials
- Type
vimtutor
into a shell to go through a brief interactive tutorial inside VIM. - Read the slides at VIM: Walking Without Crutches.
Modes
- 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
Discussion Group
Discuss issues, ideas, plugins
Contributing
GitHub makes for easy contribution
All development is done via GitHub. Fork and issue a pull request or file an issue.
Introduction
Vim which stands for vi improved is a text editor and an improved version of vi editor that is designed to run on CLI (Command Line Interface) as well as GUI (Graphical user interface) .
It was developed by Bram Moolenaar in 1991. It is a free and open source software which was released under the license which includes some charityware clauses.
In this tutorial, we will learn the steps involved in the installation of Vim on MacOS.
Prerequisites
- MacOS
- Login as an administrator on terminal.
Installation
The following steps are used to install Vim on MacOS.
1) Download the latest version
To install Vim editor on MacOS, we have to download its latest version by visiting the official website I.e. https://vim.sourceforge.io/download.php
2) Mount the disk image file
The downloaded file stored in Downloads folder (in my case) is a disk image file which needs to be mounted to the Volumes directory. mounting needs a simple command as follows.
3) Copy the application file to Applications
The file is mounted as Vim.app which is an executable application file stored inside the Volumes directory. This file needs to be copied to the Application directory where the Applications are installed. This will be done via a simple command given below.
4) Unmount the file
We have done with installing vim on our MacOS. The next step which needs to be done is unmounting the file. This will be done by using unmount option with hdiutil command.
5) Working with Vim
Once we install Vim on our MacOS, we can use it for programming in any of the languages or for editing of any of the documents. To get started with the Vim, we either type simply vim on command line or we can open it via GUI by double clicking the vim icon shown in the Applications. Vim opens in the terminal which is shown in the image.
Well, we have successfully installed and get started with the VIM editor on MacOS.