GithubHelp home page GithubHelp logo

vim-glaive's Introduction

Glaive is a utility for configuring maktaba plugins. It turns this:

let g:myplugin_enablefeature = 1
let g:myplugin_defaultdir = $HOME
let g:myplugin_weirdmode = 'm'

into this:

Glaive myplugin enablefeature defaultdir=`$HOME` weirdmode='m'

In order for this to work, the plugin must use the maktaba flag API. Any plugin using the flag API can be configured by glaive.

Maktaba is a vimscript library for plugin authors. It handles parsing the setting syntax, looking up the plugins, and applying the settings. Glaive itself is merely a thin wrapper around the hooks that maktaba provides: any plugin can support a similar interface with minimal effort. Plugin manager plugins in particular are encouraged to do so.

For details, see the executable documentation in the vroom/ directory or the helpfiles in the doc/ directory. The helpfiles are also available via :help glaive if Glaive is installed (and helptags have been generated).

Usage example

This example uses Vundle.vim, whose plugin-adding command is Plugin. Note that Vundle does not add plugins to the runtime path until vundle#end(), so Glaive commands must come after this function call.

We will use two plugins for demonstration:

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

...

" Add maktaba, glaive, and codefmt to the runtimepath.
" (Glaive must also be installed before it can be used.)
Plugin 'google/vim-maktaba'
Plugin 'google/vim-glaive'
Plugin 'google/vim-codefmt'

...

vundle#end()
filetype plugin indent on

" Add helloworld to the runtime path. (Normally this would be done with another
" Plugin command, but helloworld doesn't have a repository of its own.)
call maktaba#plugin#Install(maktaba#path#Join([maktaba#Maktaba().location,
    \ 'examples', 'helloworld']))

call glaive#Install()

" Configure helloworld using glaive.
Glaive helloworld plugin[mappings] name='Bram'

" Real world example: configure vim-codefmt
Glaive codefmt google_java_executable='java -jar /path/to/google-java-format.jar'

Now, <Leader>Hh should say Hello, Bram!, and <Leader>Hg should say Goodbye, Bram!. (Recall that <Leader> defaults to \.)

vim-glaive's People

Contributors

artasparks avatar chiphogg avatar dbarnett avatar fowles avatar glts avatar malcolmr avatar omrisarig13 avatar rocketdonkey avatar xanderman 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.