I've identified that the root cause was in another part of the code, and it's now resolved. Thank you all for your assistance.
Salman Halim <salmanha...@gmail.com> 於 2025年6月11日 週三 下午8:45寫道: > Use .. in Vim 9 (mappings 2 and 3 below). Also, you have v.count and > v:count. They probably aren't both correct (all of them have that). > > What happens when you just type the whole thing on the command line > directly? > > Salman > > On Wed, Jun 11, 2025, 08:21 Yu Lang Chiang <seanexp...@gmail.com> wrote: > >> I tried the following combinations: >> >> <C-U>exe "" . (v.count ? v:count : "") . "bprevious"<CR> >> <C-U>exe "” .. (v.count ? v:count : "") .. "bprevious"<CR> >> <C-U>execute "” .. (v.count ? v:count : "") .. "bprevious"<CR> >> <C-U>execute "” . (v.count ? v:count : "") . "bprevious"<CR> >> >> >> None of them work. >> >> Vim has been updated to version 9.1.1435 >> >> Maxim Kim <haba...@gmail.com> 於 2025年6月11日 上午11:05 寫道: >> >> vim9script enforces spaces between operators, your mappings are defined >> in vim9script context so it expects spaces between concatenation operator . >> >> :<C-U>exe "" . (v.count ? v:count : "") . "bprevious"<CR> >> >> On Tuesday, June 3, 2025 at 4:45:56 PM UTC+10 Yu Lang Chiang wrote: >> >>> Recently I've been trying to learn Vim 9 script by rewriting Vim plugins >>> into Vim 9 script. While attempting to modify *vim-unimpaired*, I >>> discovered that functions related to setting up mappings do not work >>> properly when ported to Vim 9 script. For example, in the >>> `plugin/unimpaired.vim` file, the function `MapNextFamilty` is problematic. >>> >>> **Original version:** >>> >>> ```vim >>> execute 'nnoremap <silent> '.prefix.'previous) :<C-U>exe >>> "'.cmd.'previous'.end >>> execute 'nnoremap <silent> '.prefix.'next) :<C-U>exe >>> "'.cmd.'next'.end >>> execute 'nnoremap '.prefix.'first) :<C-U><C-R>=v:count ? v:count . "' >>> . a:current . '" : "' . a:cmd . 'first"<CR><CR>' . zv >>> execute 'nnoremap '.prefix.'last) :<C-U><C-R>=v:count ? v:count . "' >>> . a:current . '" : "' . a:cmd . 'last"<CR><CR>' . zv >>> execute 'nnoremap <silent> '.map.'Previous :<C-U>exe >>> "'.cmd.'previous'.end >>> execute 'nnoremap <silent> '.map.'Next :<C-U>exe "'.cmd.'next'.end >>> execute 'nnoremap <silent> '.map.'First :<C-U>exe "'.cmd.'first'.end >>> execute 'nnoremap <silent> '.map.'Last a:<C-U>exe "'.cmd.'last'.end >>> ``` >>> >>> **Vim 9 script version:** >>> >>> ```vim >>> execute 'nnoremap <silent> ' .. prefix .. 'previous) :<C-U>exe "' .. >>> tcmd .. 'previous' .. end >>> execute 'nnoremap <silent> ' .. prefix .. 'next) :<C-U>exe "' .. >>> tcmd .. 'next' .. end >>> execute 'nnoremap ' .. prefix .. 'first) :<C-U><C-R>=v:count ? >>> v:count . "' .. current .. '" : "' .. cmd .. 'first"<CR><CR>' .. zv >>> execute 'nnoremap ' .. prefix .. 'last) :<C-U><C-R>=v:count ? >>> v:count . "' .. current .. '" : "' .. cmd .. 'last"<CR><CR>' .. zv >>> execute 'nnoremap <silent> ' .. tmap .. 'Previous :<C-U>exe "' .. tcmd >>> .. 'previous' .. end >>> execute 'nnoremap <silent> ' .. tmap .. 'Next :<C-U>exe "' .. tcmd >>> .. 'next' .. end >>> execute 'nnoremap <silent> ' .. tmap .. 'First :<C-U>exe "' .. tcmd >>> .. 'first' .. end >>> execute 'nnoremap <silent> ' .. tmap .. 'Last :<C-U>exe "' .. tcmd >>> .. 'last' .. end >>> ``` >>> >>> When inspecting the mappings using: >>> >>> ```vim >>> echo maparg('<Plug>('unimpaired-commmand')', 'n') >>> ``` >>> >>> you find that both versions produce identical mappings. For example: >>> >>> - **Original version:** >>> >>> ``` >>> :<C-U>exe "".(v.count ? v:count : "")."bprevious"<CR> >>> ``` >>> >>> - **Vim 9 script version:** >>> >>> ``` >>> :<C-U>exe "".(v.count ? v:count : "")."bprevious"<CR> >>> ``` >>> >>> Despite the mappings appearing the same, the one defined in the Vim 9 >>> script version does not work. Even after removing `<silent>`, no error >>> messages are reported. Any advice? >>> >>> **Test Environment:** >>> >>> - **OS:** Fedora Linux 42 (x86-64) >>> - **Vim:** 9.1.1418 >>> >>> My repository is >>> https://github.com/seanexplus/vim-unimpaired/tree/master . All vim 9 >>> script rewriting is in vim-9-test branch. >>> >> >> -- >> -- >> You received this message from the "vim_use" maillist. >> Do not top-post! Type your reply below the text you are replying to. >> For more information, visit http://www.vim.org/maillist.php >> >> --- >> You received this message because you are subscribed to the Google Groups >> "vim_use" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to vim_use+unsubscr...@googlegroups.com. >> To view this discussion visit >> https://groups.google.com/d/msgid/vim_use/98ea42d5-faba-46f9-b642-f1c82d957d71n%40googlegroups.com >> <https://groups.google.com/d/msgid/vim_use/98ea42d5-faba-46f9-b642-f1c82d957d71n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> >> -- >> -- >> You received this message from the "vim_use" maillist. >> Do not top-post! Type your reply below the text you are replying to. >> For more information, visit http://www.vim.org/maillist.php >> >> --- >> You received this message because you are subscribed to the Google Groups >> "vim_use" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to vim_use+unsubscr...@googlegroups.com. >> To view this discussion visit >> https://groups.google.com/d/msgid/vim_use/0C87B90E-C27A-466E-B58E-60A4A837C3B4%40gmail.com >> <https://groups.google.com/d/msgid/vim_use/0C87B90E-C27A-466E-B58E-60A4A837C3B4%40gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/vim_use/CANuxnEdyMUNHo5ZEBmV_JJm338GtjwpKMSpb6aXOfLb2DApDiw%40mail.gmail.com > <https://groups.google.com/d/msgid/vim_use/CANuxnEdyMUNHo5ZEBmV_JJm338GtjwpKMSpb6aXOfLb2DApDiw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_use/CALZ2XgjzgUjmDeHC%3D2TJUyYzg1zfKx%2BdzAy84FRZFZjPv%3DThjA%40mail.gmail.com.