mickael-menu/ShadowVim

Dot repeat seems to be broken

darvelo opened this issue · 3 comments

Check if applicable

  • I have searched the existing issues (required)
  • I reproduced the issue with an empty Neovim configuration (init.vim or init.lua)
  • I'm willing to help fix the problem and contribute a pull request

Describe the bug

First of all thank you so much for making this project! It's so essential to have real vim in an Xcode workflow. 👏🏽

Using dot repeat seems to only capture a part of the action. In the video below you can see I ciw to replace the word, then go a couple lines below and press . to repeat, but instead it deletes the word.

Screen.Recording.2023-06-24.at.5.04.11.PM.mov

How to reproduce?

  1. Open a source file
  2. ciw to replace a word
  3. Use . to repeat the action on some other word

Neovim configuration

This happens with an empty vim configuration.

Environment

ShadowVim 0.2.0 (3)

$ sw_vers -productVersion
13.4

$ uname -m
arm64

$ whereis nvim
nvim: /opt/homebrew/bin/nvim /opt/homebrew/share/man/man1/nvim.1

$ nvim --version
NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.1/share/nvim"

Run :checkhealth for more info

$ xcodebuild -version
Xcode 14.3.1
Build version 14E300c

$ defaults read -app Xcode KeyBindingsMode
Default

$ defaults read -app Xcode DVTTextAutoCloseBlockComment
exit status: 1

$ defaults read -app Xcode DVTTextAutoInsertCloseBrace
exit status: 1

$ defaults read -app Xcode DVTTextEditorTrimTrailingWhitespace
1

$ defaults read -app Xcode DVTTextEnableTypeOverCompletions
exit status: 1

$ defaults read -app Xcode DVTTextIndentCaseInC
exit status: 1

$ defaults read -app Xcode DVTTextUsesSyntaxAwareIndenting
exit status: 1

Unfortunately, it's a side effect of having the Insert mode handled by Xcode instead of Neovim (for performance reasons, and to improve the auto-completion, auto-indentation, etc.).

A workaround is to explicitly set the input to Neovim when in Insert mode. You can do that with :SVSetInputNvim.

Personally, I have a binding on C-n that I use after doing ciw.

imap <C-n> <Cmd>SVSetInputNvim<CR>

Alternatively, you can override ciw to toggle the Neovim input on-the-fly. You will need to do that for all the mappings you use.

noremap ciw <Cmd>SVSetInputNvim<CR>ciw

Note that by using SVSetInputNvim in Insert mode, the Xcode auto-completion won't be optimal.

Thank you, this was very helpful. I started adding overrides for the movements like ciw and they're working great.