Giter Site home page Giter Site logo

zeavim.vim's Introduction

Zeavim - Zeal for Vim

Description | Installation | Usage | Mapping | Commands | Customization | Notes

Description

Zeavim allows to use Zeal documentation browser directly from Vim.

This plugin works on GNU/Linux and Windows.

Installation

To use zeavim, you need of course to have Zeal installed. Grab it from here and install it .

Manual installation

Install the distributed files into Vim runtime directory which is usually ~/.vim/, or $HOME/vimfiles on Windows.

Using a plugin manager

And this is the best way, use a vim plugin manager:

Plugin manager In vimrc Installation command
Vim-plug Plug 'KabbAmine/zeavim.vim' PlugInstall
Vundle Plugin 'KabbAmine/zeavim.vim' PluginInstall
NeoBundle NeoBundle 'KabbAmine/zeavim.vim' NeoBundleInstall

Usage

They are 3 ways of using zeavim:

  1. <leader>z - Execute Zeal with the current word (Or visual selection in VISUAL mode) as a query and the file type as a docset *.
  2. <leader>Z (Note the capital z) - To specify a query in the current docset *.

Zeavim using <leader>Z

  1. <leader><leader>z - To specify manually both query and docset (The docset name can be completed using tab, see completion for that. ).

Zeavim using <leader><leader>z

* If the file type is not defined, the plugin use file extension or the docset name specified by the command Docset.

Mapping

You can easily change the mapping keys of zeavim:

nmap NEW_MAPPING <Plug>Zeavim			" <leader>z (NORMAL mode)
vmap NEW_MAPPING <Plug>ZVVisSelection	" <leader>z (VISUAL mode)
nmap NEW_MAPPING <Plug>ZVKeyword		" <leader>Z
nmap NEW_MAPPING <Plug>ZVKeyDocset		" <leader><leader>z

If you don't want to use all those functionalities, you can disable the default mapping and map only what you want.

Commands

Main commands

For those of you who prefer using commands, here they are:

Zeavim  " Normal
ZvV     " VISUAL mode
ZvK     " Type query
ZvKD    " Type docset and query

Specify manually a docset

If you need a lazy way to specify a docset, you can use:

Docset DOCSET_NAME

As an example, I'm working on a scss file but I want to get compass documentation when using Zeavim, so I just need to specify manually this docset:

Docset compass

Then Zeavim only for the current buffer will use compass as a docset.

The docset name can be completed, for that see completion.

To revert that and get zeavim working like usually, a simple Docset without argument is enough.

Specify manually a docset

Customization

Location of Zeal

By default zeavim looks for an executable named zeal on your system. If that fails, zeavim assumes that zeal is located in %ProgramFiles%/Zeal/zeal.exe for Windows and /usr/bin/zeal for UNIX systems. You can specify Zeal's location manually by adding in your vimrc:

if has('win32') || has('win64')
    let g:zv_zeal_executable = "path\\to\\zeal.exe"
else
    let g:zv_zeal_executable = "/usr/bin/zeal"
endif

Add file types

Zeavim generates the zeal docset name from the extension (Or the filetype vim option) of the current file, but if you need to add some other file types, you can create in your vimrc a dictionary with the extension or the vim file type as the key and the value as the docset name:

let g:zv_added_files_type = {
    \ 'EXTENSION': 'DOCSET_NAME',
    \ 'FILE_TYPE': 'DOCSET_NAME',
    \ }

As an example (Those file types are already included into zeavim):

let g:zv_added_files_type = {
    \ 'cpp': 'C++',
    \ 'js': 'Javascript',
    \ 'md': 'Markdown',
    \ 'mdown': 'Markdown',
    \ 'mkd': 'Markdown',
    \ 'scss': 'Sass',
    \ }

Disable default mappings

You can disable the default mappings by adding to your vimrc:

let g:zv_disable_mapping = 1

Docset name completion

When using <leader><leader>z or the command Docset, you can get a docset name completion with Tab (Or with <C-d> depending of your vim options).

There are 2 ways to enable that:

  1. The docset names can be taken from your zeal's docset directory (The one specified in Zeal's options), just set the correct path in g:zv_docsets_dir in your vimrc (by default zeavim assumes that Zeal docsets are located in %LOCALAPPDATA%\Local\Zeal\Zeal\docsets, which expands into something like C:\Users\you\AppData\Local\Zeal\Zeal\docsets, for Windows and ~/.local/share/Zeal/Zeal/docsets for UNIX systems):

    if has('win32') || has('win64')
    	let g:zv_docsets_dir = 'path\\to\\docsets\\directory\\'
    else
    	let g:zv_docsets_dir = 'path/to/docsets/directory'
    endif
    
  2. If you want to enable completion just for a few docsets (Why not!), instead of g:zv_docsets_dir you can use g:zv_lazy_docset_list.

    There is an example:

    let g:zv_lazy_docset_list = [ 'Compass', 'Bootstrap', 'Vagrant', 'Font Awesome' ]
    

Notes

Zeavim is my first vim plugin and it was created in the beginning for a personal use, so please feel free to report bug(s) and contact me if you want, I usually answer in 1-2 days.

Thank to Jerzy Kozera for creating such wonderful open-source application.

Thank to Bram Moolenaar for creating the best piece of software in the world :D

Thank to you if you're using zeavim.

zeavim.vim's People

Contributors

kabbamine avatar sunaku avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.