Skip to content

NextJump/jarvis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jarvis

This .vimrc was developed by a few engineers at Next Jump and features some of the best plugins and shorcuts that we've found while using Vim. The hope is that this installation will get you up-and-running quickly without needing much vim knowledge in advance.

Beautiful, isn't it?

###Dependencies

  1. Ctags - Ctags is required for a few of the plugins. After you have it installed, if you have a project located at ~/code/project1 you can run this command: ctags -R -f ~/.vim/mytags/project1 ~/code/project1 to have ctags recursively generate a tags file for your project located at ~/code/project1 and then place that tags file in ~/.vim/mytags/project1. It's not required to do this but storing tag files in folders named after the project they represent is a nice way of keeping things organized. The final step is to run :set tags=~/.vim/mytags/project1 inside of Vim. Here are a few things you can do with a tags file set up:
    • (leader)] - Vim's built in function jumping command. Simply place your cursor over a function definition and this command will take you to where that function was defined (opening up a new file if necessary).
    • Autocomplete with SuperTab - SuperTab allows you to take advantage of Vim's built in auto-completion and a tags file allows it to know about functions and classes in your entire project.
    • Tagbar uses ctags to generate an overview of the current file so you can get an idea of the functions/variables that exists. This is especially helpful for large files.
      • Patched fonts for Vim Airline - For the fancy symbols to appear (and they do look good) you will need a patched font. Here are the instructions from the vim-airline github page:

        For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline documentation. Prepatched fonts can be found in the powerline-fonts repository.

      • Colorscheme - This setup comes with solarized, an extremely popular colorscheme that comes in both light and dark. We've also included molokai and jellybeans. You can also choose to use a built-in colorscheme. You can check those out by typing :colorscheme (tab). You can view a large selection of Vim colorschemes here. Here are some screenshots of the included colorschemes:

Installation

Simply type this into your CLI

curl -L https://raw.github.com/NextJump/jarvis/master/install.sh | sh

Warning: This will move your .vim directory to .vim.bkp.

This will install a copy of jarvis in you current directory so be aware of that when you run the above code. After it backs up the ~/.vim directory it will create a symlink from ~/.vim to where you installed jarvis.

After this script runs you should be ready to go aside from the dependencies listed below. Any custom changes can be put in a file called vimrc.local inside of your jarvis directory. If the file doesn't exists when you run the above script it will copy the vimrc.custom file to vimrc.local so you can get started with a few custom options like font and colorscheme. Feel free to make any changes you want here as they won't be overwritten when you do a git pull.

###Plugins Note: (leader) representes your leader key, defaulted to "," in this .vimrc

  1. Vundle – A fantastic package manager for Vim.
  2. Nerdtree – The best file explorer for Vim. You can set bookmarks and open files in new tabs or splits.
    • (leader)f - Jumps to current file's location in NerdTree. Useful for browsing in the same folder quickly without navigating through file structure
  3. Tagbar – Tagbar uses the ctags library to display the tags of a file ordered by scope in a sidebar. This plugin requires ctags to work
  4. Ctrlp – A full path fuzzy file, buffer, mru, tag, … finder for Vim. Allows you to quickly search your file system or buffer for a file.
    • (leader)b - Opens CtrlP in buffer search mode (for quickly finding files you have previuosly opened)
    • (ctrl)p - Opens Ctrlp in file search mode. You can default it to open at a specific location in your .vimrc (like the root of your project, for example)
  5. Syntastic – An awesome syntax checking plugin that works with external syntax checkers and displays syntax errors to you.
  6. Vim-airline - Highly customizable vim status bar that allows you to display exactly what you want and comes with several awesome color schemes and even integrates with common Vim plugins like Tagbar and Ctrlp. img
  7. Bufexplorer - Easy and quickly switch between buffers(aka files). Quickly switch back and forth between a group of files.
    • (leader)be - Opens bufexplorer and shows list of recently opened files (in order of MRU by default)
  8. SuperTab - Allows you to use tab for all of your auto-complete needs.
  9. PHPComplete - Provides improved PHP omni-completion. In combination with Supertab it allows for $this->(tab) or self::(tab) to generate accurate auto-complete menus.
  10. Easy Motion - Gives you the ability to quickly and precisely hop around a file with Vim motions.
    • (leader)(leader) is the default mapping to trigger motions. For example, (leader)(leader)w will highlight the first letter in each word below the cursor and allow you to select the exact word you want to cursor to hop to.
    Animated demonstration from github page: Animated demonstration
  11. Sparkup - Lets you write HTML code faster. Simply type shortand version of HTML and press (ctrl)e and sparkup will automatically generate valid HTML for you. A few examples from the docs:

    div.align-left#header expands to:

        <div id="header" class="align-left"></div>
    

    table > tr*2 > td.name + td*3 expands to:

        <table>
            <tr>
                <td class="name"></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td class="name"></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </table>
    

Start Coding!

Feel free to browse the source code as most of the vimrc file settings have comments explaining what they do. Be sure to check out the documentation of the plugins to take advantage of their full feature set. What we have mentioned here is only a small part of their functionality.

Please don't hesitate to fork and send pull requests for improvements or report any issues.

Happy Vimming!
Next Jump