sponsor Vim development Vim logo Vim Book Ad

vim-mr-interface : vim plugin that support doing CRs and MRs in gitlab from vim

 script karma  Rating 1/1, Downloaded by 376  Comments, bugs, improvements  Vim wiki

created by
Omri Sarig
 
script type
utility
 
description
Active development of the plugin is done here:
https://github.com/omrisarig13/vim-mr-interface
for full information about it, with more updated versions and more issues, please look at the project there.

Introduction

Writing code require doing code reviews (CRs) on this code. Since you are writing the code in vim, why not do the CR inside vim as well?

The aim of this plugin is to let you do CR on code in gitlab from vim. CR usually include opening a merge request (MR), and then moving over the diff in the code and adding comments into the gitlab's MR. Since you are reading about vim plugins, you probably know and understand why vim is a good tool for writing and reading code. Why won't you want to do your CR in vim as well? This plugin let you do the CR from vim, adding comments and discussion threads wherever you want and updating all this information on the gitlab's MR.

The plugin does all this by using gitlab's API, which let you get, add, change or delete comments from MRs in it (with a lot of other stuff that this plugin doesn't touch).
Usage

This plugin lets you review the code and add comments directly into an open MR.

In order to use it, you should have an open MR in gitlab. Add your comments from vim using the various commands of the plugin, instead of by opening gitlab's web.
Commands
Gitlab Commands

    MRInterfaceAddComment - Add a comment into the MR.
    MRInterfaceAddGeneralDiscussionThread - Add a general discussion thread into the MR. A general discussion thread is the same as a comment, but it can be resolved.
    MRInterfaceAddCodeDiscussionThread - Add a discussion thread on specific location for the MR. This location currently can be only a line of text in one of the changed files (which is enough for almost anything).

Cache Commands

The plugin has some commands that can control the internal cache it keeps. This cache will make you type the common values for the MR just once for every merge request. You can read in the help file more about this cache mechanism.

The commands are:

    MRInterfaceResetCache - Reset the cache.
    MRInterfaceSetCache - Set all the values in the cache. You will be prompted to insert the values for the different keys one by one.
    MRInterfaceUpdateValueInCache - Set a specific value in the cache.

Configuration Options

These flags can be configured for the plugin. These flags should be configured using Glaive.

    gitlab_server_address - The address of the gitlab server to use (in case you are not using gitlab.com).
    gitlab_private_token - Your private token to authenticate with gitlab.
    automatically_insert_cache - Should the cache be inserted authomatically, or should it be only the default.
 
install details
This plugin is written in pure vimscript, but it require some other plugins and system commands in the system.

The plugin can be installed using any method of plugin installation for vim as long as all the Dependencies will be present when the plugin is loaded and run.

Vundle

An example of how to install this plugin using Vundle:

Plugin 'google/vim-maktaba'
Plugin 'google/vim-glaive'
Plugin 'LucHermitte/lh-vim-lib'
Plugin 'omrisarig13/vim-mr-interface'

Dependencies

    Curl - command line tool and library for transferring data with URLs
    google/vim-maktaba - A vimscript plugin library. Used internally by the plugin.
    google/vim-glaive - utility for configuring maktaba plugins. It is used to set the different configurable variables in the plugin.
    LucHermitte/lh-vim-lib - Library of Vim functions.

Supported platforms

This plugin should work on any platform that can run the CURL from within vim. However, it was tested only on Linux, so it is not guaranteed to work the same under other systems.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-mr-interface-0.2.tar.gz v0.2 2020-05-10 7.0 Omri Sarig Adds lots of new features to the plugin:
* Change comments to use temporary buffers
* Print errors for bad requests
* Add option to create a comment on current line
* Add parameter calculation to the plugin
* Add documentation and recommended mappings
vim-mr-interface-0.1.tar.gz 0.1 2020-05-02 7.0 Omri Sarig Initial upload
ip used for rating: 18.191.147.190

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github