neovim-qt: GuiShowContextMenu is incompatible with mswin.vim

Additional information

nvim --version
NVIM v0.4.4
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-eK2ojg/neovim-0.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=1 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim-eK2ojg/neovim-0.4.4/build/config -I/build/neovim-eK2ojg/neovim-0.4.4/src -I/usr/include -I/usr/include/lua5.1 -I/build/neovim-eK2ojg/neovim-0.4.4/build/src/nvim/auto -I/build/neovim-eK2ojg/neovim-0.4.4/build/include
Compiled by team+vim@tracker.debian.org

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Output of checkhealth

health#nvim#check
========================================================================
## Configuration
  - WARNING: Missing user config file: /home/df0/.config/nvim/init.vim
    - ADVICE:
      - :help |nvim-from-vim|

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $VTE_VERSION='6203'
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 10ms
  - INFO: $TERM: screen-256color
  - WARNING: Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
    - ADVICE:
      - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
          set-option -sa terminal-overrides ',XXX:RGB'
      - For older tmux versions use this instead:
          set-option -ga terminal-overrides ',XXX:Tc'

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/bin/python does not have the "neovim" module. :help |provider-python|
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Multiple python3 executables found.  Set `g:python3_host_prog` to avoid surprises.
  - INFO: Executable: /usr/bin/python3
  - INFO: Other python executable: /bin/python3
  - INFO: Python version: 3.9.2
  - INFO: pynvim version: 0.4.2 (outdated; from /usr/lib/python3/dist-packages/neovim)
  - WARNING: Latest pynvim is NOT installed: 0.4.3

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - WARNING: `node` and `npm` (or `yarn`) must be in $PATH.
    - ADVICE:
      - Install Node.js and verify that `node` and `npm` (or `yarn`) commands work.
nvim-qt --version
NVIM-QT v0.2.16.0
Build type: Release
Compilation:-g -O2 -fdebug-prefix-map=/build/neovim-qt-tKBgNt/neovim-qt-0.2.16=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wno-unused-parameter -std=c++11 -Wfatal-errors
Qt Version: 5.12.5
Environment: 
  nvim: nvim
  args: --cmd let &rtp.=',/usr/share/nvim-qt/runtime' --cmd set termguicolors
  runtime: /usr/share/nvim-qt/runtime

NVIM v0.4.4
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-eK2ojg/neovim-0.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=1 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim-eK2ojg/neovim-0.4.4/build/config -I/build/neovim-eK2ojg/neovim-0.4.4/src -I/usr/include -I/usr/include/lua5.1 -I/build/neovim-eK2ojg/neovim-0.4.4/build/src/nvim/auto -I/build/neovim-eK2ojg/neovim-0.4.4/build/include
Compiled by team+vim@tracker.debian.org

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Steps to reproduce

cut

  1. remove all configuration files (or put only the content of step 3 in a config file)
  2. start nvim-qt
  3. write :source $VIMRUNTIME/mswin.vim, :set mouse=a and :inoremap <silent><RightMouse> <Esc>:call GuiShowContextMenu()<CR>
  4. add some text in insert mode
  5. ctrl+A to select everything and enter insert mode
  6. left mouse click
  7. click on cut
  8. selected text is replaced by "+x

copy

  1. remove all configuration files (or put only the content of step 3 in a config file)
  2. start nvim-qt
  3. write :source $VIMRUNTIME/mswin.vim, :set mouse=a and :inoremap <silent><RightMouse> <Esc>:call GuiShowContextMenu()<CR>
  4. add some text in insert mode
  5. ctrl+A to select everything and enter insert mode
  6. left mouse click
  7. click on copy
  8. selected text is replaced by "+y

paste

  1. remove all configuration files (or put only the content of step 3 in a config file)
  2. start nvim-qt
  3. write :source $VIMRUNTIME/mswin.vim, :set mouse=a and :inoremap <silent><RightMouse> <Esc>:call GuiShowContextMenu()<CR>
  4. add some text (different that "+gP) in insert mode, then delete it (for example with dd, or with the context menu by selecting cut)
  5. ctrl+A to select everything and enter insert mode
  6. left mouse click
  7. click on paste
  8. the text "+gP is inserted, not what has been cutted (with dd or context menu)

expected behavior

Cut to work like when using ctrl+x, copy to work like ctrl+c and paste to work like ctrl+v (since I’ve source $VIMRUNTIME/mswin.vim). The mentioned keyboard shortcuts do work as expected (I’ve also used those for posting here the output of :checkhealth)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20

Most upvoted comments

@jgehrig ,your last VimScript seems to work correctly