{"action":"created","issue":{"url":"https://api.github.com/repos/vim/vim/issues/3666","repository_url":"https://api.github.com/repos/vim/vim","labels_url":"https://api.github.com/repos/vim/vim/issues/3666/labels{/name}","comments_url":"https://api.github.com/repos/vim/vim/issues/3666/comments","events_url":"https://api.github.com/repos/vim/vim/issues/3666/events","html_url":"https://github.com/vim/vim/issues/3666","id":388024660,"node_id":"MDU6SXNzdWUzODgwMjQ2NjA=","number":3666,"title":"feature request: gv in operator pending mode","user":{"login":"liushapku","id":12460646,"node_id":"MDQ6VXNlcjEyNDYwNjQ2","avatar_url":"https://avatars2.githubusercontent.com/u/12460646?v=4","gravatar_id":"","url":"https://api.github.com/users/liushapku","html_url":"https://github.com/liushapku","followers_url":"https://api.github.com/users/liushapku/followers","following_url":"https://api.github.com/users/liushapku/following{/other_user}","gists_url":"https://api.github.com/users/liushapku/gists{/gist_id}","starred_url":"https://api.github.com/users/liushapku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liushapku/subscriptions","organizations_url":"https://api.github.com/users/liushapku/orgs","repos_url":"https://api.github.com/users/liushapku/repos","events_url":"https://api.github.com/users/liushapku/events{/privacy}","received_events_url":"https://api.github.com/users/liushapku/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-12-06T02:03:19Z","updated_at":"2018-12-06T13:58:08Z","closed_at":null,"author_association":"NONE","body":"vim already have a very nice `gn` mapping, which works for normal, visual and as well as **operator-pending**. But `gv` cannot be used in operator pending mode. To achieve this, we need to enter `g@:normal gv<cr>`.  \r\n\r\nDue to [one limitation](https://github.com/vim/vim/issues/3490) of the `:normal` commands in operator pending mode, the motion-wiseness cannot be forced to a different one **if it selects visual area**. By introducing `gv` as an textobject, we do not only save many typings, but also bypass the limitation above. We will easily get `g@vgv`, `g@Vgv`, `g@<c-v>gv` to have different motion-wiseness. \r\n\r\nWith this, the creation of new textobject will be much easier and consistent. For example, we can define the text object as follows\r\n\r\n    function! MyTextObject()\r\n       call setpos(\"'<\", position1)\r\n       call setpos(\"'>\", position2)\r\n       let deisred_motionwiseness = 'v'    \" can be others depending the nature of the textobject\r\n       let change = visualmode() == deisred_motionwiseness ? deisred_motionwiseness : ''\r\n       return \"gv\" . change\r\n    endfunction\r\n    omap <expr> mto MyTextObject()\r\n\r\nHere `change` is used to set the motion-wiseness of the visual area to be the desired one while the last visual mode (as used by `gv`) may be different. (For example, if the previous visual area is linewise but `MyTextObject` should be characterwise, `gv` will still be linewise whlie `gvv` will be character wise; like what happens in normal mode.)\r\n\r\nNow come to the user, they are still free to type `g@Vmto` or `g@<c-v>mto` to force a different motion-wiseness other than the `desired` one as provided by the plugin author.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/vim/vim/issues/comments/444879053","html_url":"https://github.com/vim/vim/issues/3666#issuecomment-444879053","issue_url":"https://api.github.com/repos/vim/vim/issues/3666","id":444879053,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDg3OTA1Mw==","user":{"login":"liushapku","id":12460646,"node_id":"MDQ6VXNlcjEyNDYwNjQ2","avatar_url":"https://avatars2.githubusercontent.com/u/12460646?v=4","gravatar_id":"","url":"https://api.github.com/users/liushapku","html_url":"https://github.com/liushapku","followers_url":"https://api.github.com/users/liushapku/followers","following_url":"https://api.github.com/users/liushapku/following{/other_user}","gists_url":"https://api.github.com/users/liushapku/gists{/gist_id}","starred_url":"https://api.github.com/users/liushapku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liushapku/subscriptions","organizations_url":"https://api.github.com/users/liushapku/orgs","repos_url":"https://api.github.com/users/liushapku/repos","events_url":"https://api.github.com/users/liushapku/events{/privacy}","received_events_url":"https://api.github.com/users/liushapku/received_events","type":"User","site_admin":false},"created_at":"2018-12-06T13:58:08Z","updated_at":"2018-12-06T13:58:08Z","author_association":"NONE","body":"To clarify: I want `gv` to be used in operator-pending mode, like what `gn` does."}}
{"actor":{"display_login":"liushapku"}}