Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/google/vim-glaive
https://github.com/google/vim-glaive
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/google/vim-glaive
- Owner: google
- License: apache-2.0
- Created: 2013-12-06T23:28:52.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T06:52:36.000Z (almost 2 years ago)
- Last Synced: 2024-05-08T21:33:56.339Z (5 months ago)
- Language: Vim Script
- Size: 67.4 KB
- Stars: 79
- Watchers: 15
- Forks: 21
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Glaive is a utility for configuring maktaba plugins. It turns this:
```VimL
let g:myplugin_enablefeature = 1
let g:myplugin_defaultdir = $HOME
let g:myplugin_weirdmode = 'm'
```into this:
```VimL
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](http://github.com/google/vim-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](https://github.com/VundleVim/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:
* [helloworld](https://github.com/google/maktaba/tree/master/examples/helloworld),
which is an example plugin that comes with
[maktaba](https://github.com/google/maktaba).
* [vim-codefmt](https://github.com/google/vim-codefmt) which is a real-world
plugin used for autoformatting code.```VimL
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, `Hh` should say `Hello, Bram!`, and `Hg` should say
`Goodbye, Bram!`. (Recall that `` defaults to `\`.)