pit-ray / win-vind

You can operate Windows with key bindings like Vim.
https://pit-ray.github.io/win-vind/
MIT License
1.91k stars 45 forks source link

Deleting words/characters before the cursor (Ctrl +W / Ctrl + H) don't work in Edit Mode #223

Closed d0verenny closed 8 months ago

d0verenny commented 8 months ago

About Bug

When hitting Ctrl + h/ Ctrl + W in Edit Mode, nothing happens neither in MS Word, nor in any other text editor or a website.

Steps to reproduce

  1. Launch win-vind
  2. Open a document with words in it.
  3. Place a cursor after a word
  4. Hit Ctrl +h / Ctrl + w
  5. See that a character / a word before the cursor won't delete.
Additional info

I turned off the "Use smart paragraph selection" in Word — still won't work.

Environments

Environments Delete the example and fill in your information.
Windows Edition 11 Home
Windows Version 22H2
Windows Build 22621.3007
Architecture 64bit
win-vind Version 5.10.0.0
win-vind Install Type winget
Salted-Bread commented 8 months ago

How did you bind it in your config? I couldn't find anything on https://pit-ray.github.io/win-vind/cheat_sheet/defaults/normal/ that says that you can do that with CTRL + H/CTRL + W by default. You can still use dw and db to delete words forward and backwards and x/X to delete characters.

d0verenny commented 8 months ago

How did you bind it in your config? I couldn't find anything on https://pit-ray.github.io/win-vind/cheat_sheet/defaults/normal/ that says that you can do that with CTRL + H/CTRL + W by default. You can still use dw and db to delete words forward and backwards and x/X to delete characters.

Thanks for the reply. In what file can I bind it and how exactly?

Also, sorry for the offtop, but where is the file to store key mappings NOT temporarily? In vim those are stored in vimrc file.

Salted-Bread commented 8 months ago

With the program running you can enter the command :e to open the config file where you place your custom bindings and settings. It's stored in C:\Users\{username}\.win-vind.

The mapping depends on what keybinds you want. You can find a list of all the available functions on https://pit-ray.github.io/win-vind/cheat_sheet/functions/

If you want to rebind delete word to a custom keybind like CTRL + h you can write something like ennoremap <C-h> dw to make CTRL + H delete a word in front of the cursor.

I'd recommend reading through the little tutorial available on the website to get a hang of it https://pit-ray.github.io/win-vind/usage/

If you tell me what exactly you want each keybind to do I can offer to help write a config for it.

d0verenny commented 8 months ago

With the program running you can enter the command :e to open the config file where you place your custom bindings and settings. It's stored in C:\Users\{username}\.win-vind.

The mapping depends on what keybinds you want. You can find a list of all the available functions on https://pit-ray.github.io/win-vind/cheat_sheet/functions/

If you want to rebind delete word to a custom keybind like CTRL + h you can write something like ennoremap <C-h> dw to make CTRL + H delete a word in front of the cursor.

I'd recommend reading through the little tutorial available on the website to get a hang of it https://pit-ray.github.io/win-vind/usage/

If you tell me what exactly you want each keybind to do I can offer to help write a config for it.

Thank you very much for the help, I managed to figure the :e thing out myself :)

Now I have 2 questions:

  1. Can I map something like ennormap <Space> i<Space><C-[> to add a space in Edit Normal mode? (Press Space to enter Insert mode, add Space, and immediately go back to Edit Normal mode)? I tried and it didn't work for me. It only enters Insert Mode, but doesn't add space, and doesn't go back to Edit Normal mode.

  2. Are yiw yaw viw diw commands supposed to work in win-vind? Because they don't seem to work for me.

Salted-Bread commented 8 months ago
  1. I wasn't able to make anything that doesn't cause an infinite loop due to it being triggered by space and pressing space itself. Maybe somebody else can figure something out or you can change the hotkey that triggers it. This is what I had: ennoremap <space> {<space>}<to_insert>{<space>}<to_edi_normal>

  2. They do for me. Are you using any clipboard manager or program that could potentially interfere with it? I couldn't get it to work at first either due to a AHK script I had running that I used as clipboard manager.

d0verenny commented 8 months ago

Hello

2. They do for me. Are you using any clipboard manager or program that could potentially interfere with it? I couldn't get it to work at first either due to a AHK script I had running that I used as clipboard manager

I used Clipboard history (built-in Windows 10-11 feature). I turned it off, but yiw viw etc., still aren't working.

d0verenny commented 8 months ago

I turned every program off, and still can't use yiw etc. properly.

pit-ray commented 8 months ago

@d0verenny Hi.

The win-vind does not fully support text objects as in Vim. As a simpler alternative, you can use dw or yw using <delete_with_motion> or <yank_with_motion>.

Thanks.

d0verenny commented 8 months ago

@d0verenny Hi.

The win-vind does not fully support text objects as in Vim. As a simpler alternative, you can use dw or yw using <delete_with_motion> or <yank_with_motion>.

Thanks.

Hi :)

Do you mean that yiw yaw viw diw won't work?

pit-ray commented 8 months ago

@d0verenny Yes, these commands are not supported yet.

d0verenny commented 8 months ago

@d0verenny Yes, these commands are not supported yet.

Oh, ok, thank you!