/vim-jira-complete

AutoComplete JIRA issues in Vim

Primary LanguageVim script

vim-jira-complete

jira-complete is a Vim plugin that queries JIRA issues and make a AutoComplete list for you.

This will be helpful if you are using Jira with DVCS smart commits and Fugitive.vim

Demo

demo

How to use

<F5> in insert mode.

This binding can be configured in your .vimrc with for instance:

imap <silent> <unique> <leader>j <Plug>JiraComplete

Installation

Vim-Plug (https://github.com/junegunn/vim-plug)
Plug 'mnpk/vim-jira-complete'
Vundle (https://github.com/gmarik/Vundle.vim)
Plugin 'mnpk/vim-jira-complete'
VAM
" For the official version
InstallAddon mnpk/vim-jira-complete
" For Luc Hermitte's fork
InstallAddon LucHermitte/vim-jira-complete
Manual Install
cd ~/.vim/bundle
git clone git://github.com/mnpk/vim-jira-complete.git

Dependency

Python support and requests package.

pip install requests

Settings

Credentials

The settings can be global, for instance, write in your .vimrc:

let g:jiracomplete_url = 'http://your.jira.url/'
let g:jiracomplete_email = 'your_jira_email'
let g:jiracomplete_token = 'your_jira_token'

or settings can be local to a project (for those who work on several projects, each managed with a different JIRA):

let b:jiracomplete_url = 'http://your.jira.url/'
let b:jiracomplete_email = 'your_jira_username'
let b:jiracomplete_token = 'your_jira_token'

Format of the string inserted

By default, upon <F5>, the completion menu will insert the ID of the issue selected. If you also want the string, you can change the format with the option [bg]:jiracomplete_format:

let g:jiracomplete_format = 'v:val.abbr . " -> " . v:val.menu'

for KEY-123 -> Your Issue Title

let g:jiracomplete_format = '"[". v:val.abbr . "]"'

for [KEY-123]

Certificates

If the JIRA site is using a certificate that is not installed on your local machine, you will see this kind of error message:

requests.exceptions.SSLError: [Errno 185090050] _ssl.c:328: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib

In that case, you'll have to install a certificate that requests library will be able to use. In you cannot install any, you'll have to parametrize the JIRA URL to say: Please don't try to verify anything this way:

let g:jiracomplete_url = {'url': 'http://your.jira.url/', 'verify': 'False' }

In other words, the URL can be a dictionary of options that'll be passed to requests get() function. Consult the relevant documentation for more information on what you could do with it.

Query

By default, all unresolved issues assigned to the current user are shown. If you want to override this, you can specify a custom jql query with the [bg]:jiracomplete_jql setting

You can use "${user}" in the query as a placeholder for the currently logged in user.

let g:jiracomplete_jql = 'project=MYPROJ+and+resolution=unresolved'

to see all unresolved issues for project MYRPOJ

let g:jiracomplete_jql = 'project=MYPROJ+and+assignee=${user}'

to see all issues in project MYPROJ assigned to the current user

Credits

vim-jira-complete has been initiated by mnpk.

Luc Hermitte provided some enhancements.

Using Luc Hermitte's Vim library lh-vim-lib.