improvedft
improvedft copied to clipboard
t/T lands the cursor in an unexpected place when multi-character support is enabled
First of all, thanks a lot for the plugin! I have been using it for years but never had a chance to say thank you. It's simple, non-intrusive, and does exactly what you expect… most of the time! :)
The only exception from that rule appears to be if I use t or T when g:ft_improved_multichars is set to 1. In that case, running the following lends me on the second occurrence of g:
echo "abcdefgx abcefgy" > test.txt
nvim -c 'normal tabcdefgy' test.txt
However, at least to me, the expected behaviour would be to land on the second occurrence of b.
Additional info:
$ sw_vers
ProductName: macOS
ProductVersion: 12.6
BuildVersion: 21G115
$ nvim --version
NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.8.0/share/nvim"
Run :checkhealth for more info
normal tabcdefgy
Hm, what exactly are you trying to do?
I guess this should jump to the string starting with abcdefg and then y (yank)?
It's not clear to me.
Note: In general I have a feeling that the multichar feature was a mistake. I should probably remove that feature. It causes more pain and is not really useful.
Hm, what exactly are you trying to do?
My apologies, I must have been very tiered when I wrote this report. Let me correct a few inconsistencies, get rid of the noise in the example, and explain the issue in a few more details:
- Create the test file:
echo "az12 bz56 cz89" > test.txt - Open the test file with neovim but without loading any plugins –
nvim --noplugin test.txt. For simplicity sake, we'll use the middle word (bz56) to establish baseline behaviour:- Jump to the end of the first word
^e(this is only needed so that our next search targets the middle word), followed bytz– the cursor lends onb - Jump to the start of the last word
$b(this is only needed so that our next search targets the middle word), followed byTz– the cursor lends on5
- Jump to the end of the first word
- Open the test file with neovim (
nvim ./test.txt) and ensure that improvedf is enabled, andg:ft_improved_multicharsis set to1- Jump to column 1 (
^) and search for the middlezwithtz5– the cursor lands on the middlez(col 7), notbas above. - Jump to the last column (
$) and search for the same middlezwithTz5– the cursor lands on6, not5as above.
- Jump to column 1 (
I hope this clarifies the issue a bit.
Note: In general I have a feeling that the multichar feature was a mistake. I should probably remove that feature. It causes more pain and is not really useful.
At the end of the day, it's your plugin and I'm sure we would all understand if you wanted to take it in a slightly different direction. But, from my personal point of view, it would be a real shame if you dropped support for multichar.
Out of all similar plugins I've used (sneak, easymotion, etc), I feel like yours really nails the multichar support: it's simple, it doesn't get in the way of other functionality, and it closely follows vim's built-in behaviour.