-
Notifications
You must be signed in to change notification settings - Fork 59
docs: add default keybinding maps available in the help #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+81
−0
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a260f64
Release (#490)
harrisoncramer e29909c
Bugfixes, Etc. (#502)
harrisoncramer 8f51d11
docs: add default keybinding maps available in the help
makbari 2a5dcae
chore: review from comments
makbari 2f9ac72
Merge branch 'develop' into doc/readme
makbari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,40 @@ | ||
| # gitlab.nvim | ||
| gitlab.nvim | ||
| =========== | ||
|
|
||
| This Neovim plugin is designed to make it easy to review Gitlab MRs from within the editor. This means you can do things like: | ||
|
|
||
| - Create, approve, and merge MRs for the current branch | ||
| - Read and edit an MR description | ||
| - Add or remove reviewers and assignees | ||
| - Resolve, reply to, and unresolve discussion threads | ||
| - Create, edit, delete, and reply to comments | ||
| - View and manage pipeline Jobs | ||
| - Upload files, jump to the browser, and a lot more! | ||
| - Create, approve, and merge MRs for the current branch | ||
| - Read and edit an MR description | ||
| - Add or remove reviewers and assignees | ||
| - Resolve, reply to, and unresolve discussion threads | ||
| - Create, edit, delete, and reply to comments | ||
| - View and manage pipeline Jobs | ||
| - Upload files, jump to the browser, and a lot more! | ||
|
|
||
|  | ||
|
|
||
| https://github.com/harrisoncramer/gitlab.nvim/assets/32515581/dc5c07de-4ae6-4335-afe1-d554e3804372 | ||
|
|
||
| To view these help docs and to get more detailed help information, please run `:h gitlab.nvim` | ||
|
|
||
| ## Requirements | ||
| Requirements | ||
| ------------ | ||
|
|
||
| - <a href="https://go.dev/">Go</a> >= v1.19 | ||
| - <a href="https://go.dev/">Go</a> >= v1.19 | ||
|
|
||
| ## Quick Start | ||
| Quick Start | ||
| ----------- | ||
|
|
||
| 1. Install Go | ||
| 2. Add configuration (see Installation section) | ||
| 3. Run `:lua require("gitlab").choose_merge_request()` or `:lua require("gitlab").review()` if already in review branch/worktree. | ||
| 1. Install Go | ||
| 2. Add configuration (see Installation section) | ||
| 3. Run `:lua require("gitlab").choose_merge_request()` or `:lua require("gitlab").review()` if already in review branch/worktree. | ||
|
|
||
| This will checkout the branch locally, and open the plugin's reviewer pane. | ||
|
|
||
| For more detailed information about the Lua APIs please run `:h gitlab.nvim.api` | ||
|
|
||
| ## Installation | ||
| Installation | ||
| ------------ | ||
|
|
||
| With <a href="https://github.com/folke/lazy.nvim">Lazy</a>: | ||
|
|
||
|
|
@@ -73,11 +77,13 @@ And with <a href="https://github.com/lewis6991/pckr.nvim">pckr.nvim</a>: | |
|
|
||
| Add `branch = "develop",` to your configuration if you want to use the (possibly unstable) development version of `gitlab.nvim`. | ||
|
|
||
| ## Contributing | ||
| Contributing | ||
| ------------ | ||
|
|
||
| Contributions to the plugin are welcome. Please read [.github/CONTRIBUTING.md](.github/CONTRIBUTING.md) before you start working on a pull request. | ||
|
|
||
| ## Connecting to Gitlab | ||
| Connecting to Gitlab | ||
| -------------------- | ||
|
|
||
| This plugin requires an <a href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token">auth token</a> to connect to Gitlab. The token can be set in the root directory of the project in a `.gitlab.nvim` environment file, or can be set via a shell environment variable called `GITLAB_TOKEN` instead. If both are present, the `.gitlab.nvim` file will take precedence. | ||
|
|
||
|
|
@@ -97,10 +103,10 @@ gitlab_url=https://my-personal-gitlab-instance.com/ | |
|
|
||
| The plugin will look for the `.gitlab.nvim` file in the root of the current project by default. However, you may provide a custom path to the configuration file via the `config_path` option. This must be an absolute path to the directory that holds your `.gitlab.nvim` file. | ||
|
|
||
| In case even more control over the auth config is needed, there is the possibility to override the `auth_provider` settings field. It should be | ||
| a function that returns the `token` as well as the `gitlab_url` value, and a nilable error. If the `gitlab_url` is `nil`, `https://gitlab.com` is used as default. | ||
| In case even more control over the auth config is needed, there is the possibility to override the `auth_provider` settings field. It should be a function that returns the `token` as well as the `gitlab_url` value, and a nilable error. If the `gitlab_url` is `nil`, `https://gitlab.com` is used as default. | ||
|
|
||
| Here an example how to use a custom `auth_provider`: | ||
|
|
||
| ```lua | ||
| require("gitlab").setup({ | ||
| auth_provider = function() | ||
|
|
@@ -111,13 +117,96 @@ require("gitlab").setup({ | |
|
|
||
| For more settings, please see `:h gitlab.nvim.connecting-to-gitlab` | ||
|
|
||
| ## Configuring the Plugin | ||
| Configuring the Plugin | ||
| ---------------------- | ||
|
|
||
| The plugin expects you to call `setup()` and pass in a table of options. All of these values are optional, and if you call this function with no values the defaults will be used. | ||
|
|
||
| For a list of all these settings please run `:h gitlab.nvim.configuring-the-plugin` which will show you the help stored in [doc/gitlab.nvim.txt](doc/gitlab.nvim.txt). | ||
|
|
||
| ## Keybindings | ||
| Keybindings | ||
| ----------- | ||
|
|
||
| `gitlab.nvim` comes with a set of default `keymaps` for different contexts. You can override any of these in your configuration. | ||
|
|
||
| ### Global Keymaps | ||
|
|
||
| These keymaps are available globally (i.e., in any buffer). | ||
|
|
||
| ``` | ||
| g? Open a help popup for local keymaps | ||
| glaa Add assignee | ||
| glad Delete assignee | ||
| glla Add label | ||
| glld Delete label | ||
| glra Add reviewer | ||
| glrd Delete reviewer | ||
| glA Approve MR | ||
| glR Revoke MR approval | ||
| glM Merge the feature branch to the target branch and close MR | ||
| glC Create a new MR for currently checked-out feature branch | ||
| glc Chose MR for review | ||
| glS Start review for the currently checked-out branch | ||
| gls Show the editable summary of the MR | ||
| glu Copy the URL of the MR to the system clipboard | ||
| glo Open the URL of the MR in the default Internet browser | ||
| gln Create a note (comment not linked to a specific line) | ||
| glp Show the pipeline status | ||
| gld Toggle the discussions window | ||
| glD Toggle between draft mode and live mode | ||
| glP Publish all draft comments/notes | ||
| ``` | ||
|
|
||
| #### Popup Keymaps | ||
|
|
||
| These `keymaps` are active in the popup windows (e.g., for creating comments, editing the summary, etc.). | ||
|
|
||
| ``` | ||
| <Tab> Cycle to the next field | ||
| <S-Tab> Cycle to the previous field | ||
| ZZ Perform action (e.g., save comment) | ||
| ZA Perform linewise action | ||
| ZQ Discard changes and quit the popup | ||
| ``` | ||
|
|
||
| #### Discussion Tree Keymaps | ||
|
|
||
| These `keymaps` are active in the discussion tree window. | ||
|
|
||
| ``` | ||
| Ea Add an emoji to the note/comment | ||
| Ed Remove an emoji from a note/comment | ||
| dd Delete comment | ||
| e Edit comment | ||
| r Reply to comment | ||
| - Toggle the resolved status of the whole discussion | ||
| o Jump to comment location in file | ||
| a Jump to the comment location in the reviewer window | ||
| b Jump to the URL of the current note/discussion | ||
| u Copy the URL of the current node to clipboard | ||
| c Toggle between the notes and discussions views | ||
| i Toggle type of discussion tree | ||
| P Publish the currently focused note/comment | ||
| dt Toggle between date formats | ||
| D Toggle between draft mode and live mode | ||
| st Toggle whether discussions are sorted by the "latest_reply", or by "original_comment" | ||
| t Open or close the discussion | ||
| T Open or close separately both resolved and unresolved discussions | ||
| R Open or close all resolved discussions | ||
| U Open or close all unresolved discussions | ||
| <C-R> Refresh the data in the view | ||
| <leader>p Print the current node (for debugging) | ||
| ``` | ||
|
|
||
| #### Reviewer Keymaps | ||
|
|
||
| These `keymaps` are active in the reviewer window (the diff view). | ||
|
|
||
| ``` | ||
| c Create a comment for the lines that the following {motion} moves over | ||
| s Create a suggestion for the lines that the following {motion} moves over | ||
| a Jump to the comment in the discussion tree | ||
| ``` | ||
|
|
||
| The plugin sets up a number of useful keybindings in the special buffers it creates, and some global keybindings as well. Refer to the relevant section of the manual `:h gitlab.nvim.keybindings` for more details. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should merge this line with the information under the |
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,44 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Setup and run tests for lua part of gitlab.nvim. | ||
| # | ||
| # In order to run tests you need to have `luarocks` and `git` installed. This script will check if | ||
| # environment is already setup, if not it will initialize current directory with `luarocks`, | ||
| # install `busted` framework and download plugin dependencies. | ||
| # | ||
| # Requires `luarocks`, `git`, and `nvim` installed. | ||
| # | ||
| set -e | ||
|
|
||
| LUA_VERSION="5.1" | ||
| set -euo pipefail | ||
|
|
||
| PLUGINS_FOLDER="tests/plugins" | ||
| PLUGINS=( | ||
| "https://github.com/MunifTanjim/nui.nvim" | ||
| "https://github.com/nvim-lua/plenary.nvim" | ||
| "https://github.com/sindrets/diffview.nvim" | ||
| "https://github.com/MunifTanjim/nui.nvim" | ||
| "https://github.com/nvim-lua/plenary.nvim" | ||
| "https://github.com/sindrets/diffview.nvim" | ||
| ) | ||
|
|
||
| if ! command -v luarocks > /dev/null 2>&1; then | ||
| echo "You need to have luarocks installed in order to run tests." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! command -v git > /dev/null 2>&1; then | ||
| echo "You need to have git installed in order to run tests." | ||
| exit 1 | ||
| if ! command -v luarocks >/dev/null 2>&1; then | ||
| echo "Error: luarocks not found. Please install LuaRocks." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! luarocks --lua-version=$LUA_VERSION which busted > /dev/null 2>&1; then | ||
| echo "Installing busted." | ||
| luarocks init | ||
| luarocks config --scope project lua_version "$LUA_VERSION" | ||
| luarocks install --lua-version="$LUA_VERSION" busted | ||
| if ! command -v git >/dev/null 2>&1; then | ||
| echo "Error: git not found. Please install Git." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| for arg in "$@"; do | ||
| if [[ $arg =~ "--coverage" ]] && ! luarocks --lua-version=$LUA_VERSION which luacov > /dev/null 2>&1; then | ||
| luarocks install --lua-version="$LUA_VERSION" luacov | ||
| # lcov reporter for luacov - lcov format is supported by `nvim-coverage` | ||
| luarocks install --lua-version="$LUA_VERSION" luacov-reporter-lcov | ||
| if ! command -v nvim >/dev/null 2>&1; then | ||
| echo "Error: nvim not found. Please install Neovim." >&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| # Clone test plugin dependencies | ||
| mkdir -p "$PLUGINS_FOLDER" | ||
| for plugin in "${PLUGINS[@]}"; do | ||
| plugin_name=${plugin##*/} | ||
| plugin_folder="$PLUGINS_FOLDER/$plugin_name" | ||
|
|
||
| # Check if plugin was already downloaded | ||
| if [[ -d "$plugin_folder/.git" ]]; then | ||
| # We could also try to pull here but I am not sure if that wouldn't slow down tests too much. | ||
| continue | ||
| fi | ||
|
|
||
| plugin_name="${plugin##*/}" | ||
| plugin_folder="$PLUGINS_FOLDER/$plugin_name" | ||
| if [[ ! -d "$plugin_folder/.git" ]]; then | ||
| echo "Cloning $plugin..." | ||
| git clone --depth 1 "$plugin" "$plugin_folder" | ||
|
|
||
| fi | ||
| done | ||
|
|
||
| nvim -u NONE -U NONE -N -i NONE -l tests/init.lua "$@" | ||
| # Run tests | ||
| echo "Running tests with Neovim..." | ||
| nvim -u NONE -U NONE -N -i NONE -l tests/init.lua "$@" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @makbari. Your contribution is appreciated. Just a suggestion: These style changes don't seem to be necessary, they are not mentioned in the PR description, and so they make the review more difficult as the reviewer has to look for the substantial changes which are advertised in the description. So I think you might just as well revert the style changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there,
Sorry, i oversee this, it was automatic change via a plugin. a good reminder that i need to check the changes with more open eyes 👀