Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Customization

Wael Nasreddine edited this page Nov 19, 2011 · 16 revisions

Customization

~/.vimrc.before

You can use the file located at ~/.vimrc.before, this file is sourced before any other file or plugin, please understand that Janus core is loaded before this script, so you get access to all the functions defined in janus.vim.

This file is perfect for setting for example the mapleader, because any mappings using the <leader> keywords that is parsed before changing the mapleader, the mapleader won't have any effect on them.

~/.vimrc.after

The file ~/.vimrc.after is loaded at the end of Janus, after all plugins are loaded as well, this allows you to override anything set by Janus or by any plugin.

This is useful for example to re-map some of the bindings to your linking, setting the colorscheme, changing the encoding or the expandtab or ...

Adding a new plugin, color-scheme, ...

To add a new plugin, a new color-scheme or anything else, you should do that using git sub-modules, you should only use the custom group located at janus/vim/custom for the your custom stuff.

Even if not every vim-script hosted on vim.org has a git repository (by the author or a mirror), you can easily get a git repository for it using Vim-scripts Github mirror.

The custom group will be loaded before any other group, except of course the core group, this will ensure that your version of any already-installed plugin will be loaded instead, so for example, if you have a new version (or another fork) of a plugin, just add it to your custom folder and will be loaded first.

WARNING: Any uncommited file inside the janus folder and outside the custom folder will be removed the next time your run rake so make sure to either put them in the custom folder, or entirely outside the janus folder or commit them with Git. We clean the janus folder in case we replace a manually installed plugin (using rake tasks) with a submodule.

Disabling a plugin

Janus makes it too easy to disable any included plugin, color-scheme, lang etc.. Disabling a plug-in is done withing your ~/.vimrc.before file using the janus#disable_plugin() method. This methods takes two arguments, the plugin name and optionally the reason for disabling the plugin, if reason is given, all bindings that Janus binds to the plugin, will still be bind but the action will just be an echo that the plugin is disabled, so for example:

Janus adds the binding <C-t> or <D-t> on MacVim to open Command-t plugin which requires Vim built with ruby support. If your Vim is not built with ruby support, your Vim will not throw errors about it because Janus will disable the plugin automatically, however you try <C-t> or <D-t> (you might expect that nothing happens but..) the following message appears in the command-line area:

The plugin command-t is disabled for the following reason: Vim is compiled without ruby support.

Here's the signature of the janus#disable_plugin function, you might notice in the source code that it supports specifying the group as well, but since this feature is not working yet, please ignore it.

" Disable a plugin
"
" @param [String] The plugin name
" @param [String] The reason why it is disabled
" @return [Bool]
function! janus#disable_plugin(...)
endfunction

Disabling a plugin in ~/.vimrc.before example:

" Disable command-t because I don't like it, but keep the bindings to remind me
call janus#disable_plugin('command-t', "I don't like it")

" Disable Hammer because it doesn't work and remove the bindings
call janus#disable_plugin('hammer')
Clone this wiki locally