{"action":"closed","issue":{"url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/312","repository_url":"https://api.github.com/repos/airblade/vim-gitgutter","labels_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/312/labels{/name}","comments_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/312/comments","events_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/312/events","html_url":"https://github.com/airblade/vim-gitgutter/issues/312","id":136158826,"number":312,"title":"Need command to select entire hunk for a vim operation","user":{"login":"mnebuerquo","id":10221914,"avatar_url":"https://avatars.githubusercontent.com/u/10221914?v=3","gravatar_id":"","url":"https://api.github.com/users/mnebuerquo","html_url":"https://github.com/mnebuerquo","followers_url":"https://api.github.com/users/mnebuerquo/followers","following_url":"https://api.github.com/users/mnebuerquo/following{/other_user}","gists_url":"https://api.github.com/users/mnebuerquo/gists{/gist_id}","starred_url":"https://api.github.com/users/mnebuerquo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnebuerquo/subscriptions","organizations_url":"https://api.github.com/users/mnebuerquo/orgs","repos_url":"https://api.github.com/users/mnebuerquo/repos","events_url":"https://api.github.com/users/mnebuerquo/events{/privacy}","received_events_url":"https://api.github.com/users/mnebuerquo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-24T19:16:04Z","updated_at":"2016-04-21T14:34:11Z","closed_at":"2016-04-21T14:34:11Z","body":"For my changes to a legacy codebase, I would like to make any hunks I commit match a set of rules for things like whitespace, even if the surrounding code does not follow these rules.\r\n\r\nWhat I want to do is select a hunk before I stage it, and run some cleanups on it, such as replace leading spaces with tabs, remove trailing whitespace, etc. There might even be some other formatting changes to this code, given specific rules I can code into vim.\r\n\r\nI might even want to put these into a `autocmd BufWritePre`.\r\n\r\nWhat I'd like to be able to do is bind a key to select next hunk, or select all hunks. Then do something with that selection (yank, indent, clean whitespace, etc.) as if I had used visual mode to select the lines where the gutter shows a symbol.\r\n\r\nThis might look like the other bindings, as in this completely hypothetical example:\r\n```\r\nnmap ]v <Plug>GitGutterSelectNextHunk\r\nnmap [v <Plug>GitGutterSelectPrevHunk\r\nnmap ]a <Plug>GitGutterSelectAllHunks\r\n```\r\nThe documentation in the README.mkd doesn't suggest this is available currently. My guess is that this should be feasible, since the gitgutter has marked or highlighted the lines already, and updates every so often. I just want to be able to bind a keystroke to select those lines.\r\n\r\nThanks!"}}