Ability to change what happens when pasting with Cmd+v the editor while still being able to use Cmd+v to paste in dialogs
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 25/100
- Issue 類型
- 功能
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 技術堆疊
- macos, vim
- 領域
- desktop
研究方向
先查看 MacVim 中關於自訂選單的說明,尤其是 Edit.Paste 項目及其 paste: 動作,然後追蹤該動作如何進入 Vim 輸入處理和 GUI 對話框。比較現有的 macmenu、inoremap、cnoremap 和 macaction 行為。完成標準是:可以在 Vim 插入模式中自訂 Cmd+V,同時仍能在圖形對話框中進行貼上。
由索引模型根據 Issue 內容生成。
描述
Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
I'm trying to customize paste behavior in MacVim in insert mode, to add come <C-g>u sequences to create undo points before and after the pasted text.
I can do that with an inoremap <D-v>. But in order for <D-v> to make it to the Vim input processing, it can't be bound in the MacVim menu system to the paste: action. So the folks at SuperUser suggest:
macmenu Edit.Paste key=<nop>
noremap <D-v> "*P
cnoremap <D-v> <C-r><C-o>*
inoremap <D-v> <C-g>u<C-r><C-o>*
But if you do that, then paste doesn't work in dialogs and other non-Vim UI elements insider MacVim, such as the graphical find dialog. As noted in the MacVim help on customizing the menu:
(E.g. the menu item "Edit.Paste" must be bound to the action "paste:" otherwise pasting won't work in dialogs since that is the action that instructs them to paste something.)
And I can't find any documentation on how to either change what happens when a paste: action is received by the Vim layer, or to set what happens when a <D-v> is sent to the GUI layer when it's not bound to a menu option.
So I'm not able to achieve the configuration where pressing Command+v creates undo points around the pasted text in Vim's insert mode, but also still works on text boxes in the GUI.
Describe the solution you'd like
My ideal approach would be to have paste: reach the Vim core exactly as if <D-v> were being typed, so that remapping <D-v> with inoremap would Just Work without having to unbind it from the menu item.
Describe alternatives you've considered
Other approaches would be:
- Providing a command to control what MacVim actions like
paste:do when they reach the Vim level. - Providing an option on the
macmenucommand to set key sequences to be issued in Vim before/after the action is processed. - Providing a mode-specific
map-like command to map keys in the "mode" of having a dialog box selected, so that you could<something>noremap <D-v>to:macaction paste:and have that work in the dialogs. This might be totally impossible since then Vim internals would have to process all the keypresses in the dialogs. - Documenting some already-existing way to customize what the
paste:action does by overwriting/replacing some VimScript function it already invokes.
Additional context
I only barely know enough about Vim input processing to articulate what I want to achieve, so it's possible I'm missing something obvious about how pasting works in Vim.
- 主要語言
- Vim Script
- 星號
- 7.9k
- 分支
- 691
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
macvim-dev/macvim 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
macvim-dev/macvim#1697 · 5 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
macvim-dev/macvim#1658 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
macvim-dev/macvim#1657 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
macvim-dev/macvim#1655 ·
-
難度 2/5 半天 新手友好度 72/100
macvim-dev/macvim#1653 ·
查看 macvim-dev/macvim 的全部 Issue
相似的 Issue
-
bug good first issue
難度 2/5 1-3 小時 新手友好度 75/100
alexgorbatchev/simple-ptt#11 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
bug good first issue multicut serialization
難度 2/5 1-3 小時 新手友好度 70/100
-
accepted bug via-triage
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 75/100
seagle0128/doom-modeline#835 ·