Mercurial > vim
comparison src/testdir/test_cmdline.vim @ 27914:9a997de62da2 v8.2.4482
patch 8.2.4482: no fuzzy cmdline completion for user defined completion
Commit: https://github.com/vim/vim/commit/afd4ae35d66b2e7732eceb5ad9f6b4ece6b7c64c
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Feb 27 21:03:21 2022 +0000
patch 8.2.4482: no fuzzy cmdline completion for user defined completion
Problem: No fuzzy cmdline completion for user defined completion.
Solution: Add fuzzy completion for user defined completion. (Yegappan
Lakshmanan, closes #9858)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Feb 2022 22:15:04 +0100 |
parents | be9e6e0b1591 |
children | 6efa2f193c94 |
comparison
equal
deleted
inserted
replaced
27913:38695d6adf31 | 27914:9a997de62da2 |
---|---|
2453 call assert_equal("\"dlist 10 /pat\\\t", @:) | 2453 call assert_equal("\"dlist 10 /pat\\\t", @:) |
2454 call feedkeys(":dlist 10 /pat/ | chist\<Tab>\<C-B>\"\<CR>", 'xt') | 2454 call feedkeys(":dlist 10 /pat/ | chist\<Tab>\<C-B>\"\<CR>", 'xt') |
2455 call assert_equal("\"dlist 10 /pat/ | chistory", @:) | 2455 call assert_equal("\"dlist 10 /pat/ | chistory", @:) |
2456 endfunc | 2456 endfunc |
2457 | 2457 |
2458 " Test for 'fuzzy' in 'wildoptions' (fuzzy completion) | 2458 " argument list (only for :argdel) fuzzy completion |
2459 func Test_wildoptions_fuzzy() | 2459 func Test_fuzzy_completion_arglist() |
2460 " argument list (only for :argdel) | |
2461 argadd change.py count.py charge.py | 2460 argadd change.py count.py charge.py |
2462 set wildoptions& | 2461 set wildoptions& |
2463 call feedkeys(":argdel cge\<C-A>\<C-B>\"\<CR>", 'tx') | 2462 call feedkeys(":argdel cge\<C-A>\<C-B>\"\<CR>", 'tx') |
2464 call assert_equal('"argdel cge', @:) | 2463 call assert_equal('"argdel cge', @:) |
2465 set wildoptions=fuzzy | 2464 set wildoptions=fuzzy |
2466 call feedkeys(":argdel cge\<C-A>\<C-B>\"\<CR>", 'tx') | 2465 call feedkeys(":argdel cge\<C-A>\<C-B>\"\<CR>", 'tx') |
2467 call assert_equal('"argdel change.py charge.py', @:) | 2466 call assert_equal('"argdel change.py charge.py', @:) |
2468 %argdelete | 2467 %argdelete |
2469 | 2468 set wildoptions& |
2470 " autocmd group name fuzzy completion | 2469 endfunc |
2470 | |
2471 " autocmd group name fuzzy completion | |
2472 func Test_fuzzy_completion_autocmd() | |
2471 set wildoptions& | 2473 set wildoptions& |
2472 augroup MyFuzzyGroup | 2474 augroup MyFuzzyGroup |
2473 augroup END | 2475 augroup END |
2474 call feedkeys(":augroup mfg\<Tab>\<C-B>\"\<CR>", 'tx') | 2476 call feedkeys(":augroup mfg\<Tab>\<C-B>\"\<CR>", 'tx') |
2475 call assert_equal('"augroup mfg', @:) | 2477 call assert_equal('"augroup mfg', @:) |
2479 call feedkeys(":augroup mfg\<Tab>\<C-B>\"\<CR>", 'tx') | 2481 call feedkeys(":augroup mfg\<Tab>\<C-B>\"\<CR>", 'tx') |
2480 call assert_equal('"augroup MyFuzzyGroup', @:) | 2482 call assert_equal('"augroup MyFuzzyGroup', @:) |
2481 call feedkeys(":augroup My*p\<Tab>\<C-B>\"\<CR>", 'tx') | 2483 call feedkeys(":augroup My*p\<Tab>\<C-B>\"\<CR>", 'tx') |
2482 call assert_equal('"augroup My*p', @:) | 2484 call assert_equal('"augroup My*p', @:) |
2483 augroup! MyFuzzyGroup | 2485 augroup! MyFuzzyGroup |
2484 | 2486 set wildoptions& |
2485 " buffer name fuzzy completion | 2487 endfunc |
2488 | |
2489 " buffer name fuzzy completion | |
2490 func Test_fuzzy_completion_bufname() | |
2486 set wildoptions& | 2491 set wildoptions& |
2487 edit SomeFile.txt | 2492 edit SomeFile.txt |
2488 enew | 2493 enew |
2489 call feedkeys(":b SF\<Tab>\<C-B>\"\<CR>", 'tx') | 2494 call feedkeys(":b SF\<Tab>\<C-B>\"\<CR>", 'tx') |
2490 call assert_equal('"b SF', @:) | 2495 call assert_equal('"b SF', @:) |
2494 call feedkeys(":b SF\<Tab>\<C-B>\"\<CR>", 'tx') | 2499 call feedkeys(":b SF\<Tab>\<C-B>\"\<CR>", 'tx') |
2495 call assert_equal('"b SomeFile.txt', @:) | 2500 call assert_equal('"b SomeFile.txt', @:) |
2496 call feedkeys(":b S*File.txt\<Tab>\<C-B>\"\<CR>", 'tx') | 2501 call feedkeys(":b S*File.txt\<Tab>\<C-B>\"\<CR>", 'tx') |
2497 call assert_equal('"b S*File.txt', @:) | 2502 call assert_equal('"b S*File.txt', @:) |
2498 %bw! | 2503 %bw! |
2499 | 2504 set wildoptions& |
2500 " buffer name (full path) fuzzy completion | 2505 endfunc |
2501 if has('unix') | 2506 |
2502 set wildoptions& | 2507 " buffer name (full path) fuzzy completion |
2503 call mkdir('Xcmd/Xstate/Xfile.js', 'p') | 2508 func Test_fuzzy_completion_bufname_fullpath() |
2504 edit Xcmd/Xstate/Xfile.js | 2509 CheckUnix |
2505 cd Xcmd/Xstate | 2510 set wildoptions& |
2506 enew | 2511 call mkdir('Xcmd/Xstate/Xfile.js', 'p') |
2507 call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') | 2512 edit Xcmd/Xstate/Xfile.js |
2508 call assert_equal('"b CmdStateFile', @:) | 2513 cd Xcmd/Xstate |
2509 set wildoptions=fuzzy | 2514 enew |
2510 call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') | 2515 call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') |
2511 call assert_match('Xcmd/Xstate/Xfile.js$', @:) | 2516 call assert_equal('"b CmdStateFile', @:) |
2512 cd - | 2517 set wildoptions=fuzzy |
2513 call delete('Xcmd', 'rf') | 2518 call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') |
2514 endif | 2519 call assert_match('Xcmd/Xstate/Xfile.js$', @:) |
2515 | 2520 cd - |
2516 " :behave suboptions fuzzy completion | 2521 call delete('Xcmd', 'rf') |
2522 set wildoptions& | |
2523 endfunc | |
2524 | |
2525 " :behave suboptions fuzzy completion | |
2526 func Test_fuzzy_completion_behave() | |
2517 set wildoptions& | 2527 set wildoptions& |
2518 call feedkeys(":behave xm\<Tab>\<C-B>\"\<CR>", 'tx') | 2528 call feedkeys(":behave xm\<Tab>\<C-B>\"\<CR>", 'tx') |
2519 call assert_equal('"behave xm', @:) | 2529 call assert_equal('"behave xm', @:) |
2520 call feedkeys(":behave xt*m\<Tab>\<C-B>\"\<CR>", 'tx') | 2530 call feedkeys(":behave xt*m\<Tab>\<C-B>\"\<CR>", 'tx') |
2521 call assert_equal('"behave xterm', @:) | 2531 call assert_equal('"behave xterm', @:) |
2526 call assert_equal('"behave xt*m', @:) | 2536 call assert_equal('"behave xt*m', @:) |
2527 let g:Sline = '' | 2537 let g:Sline = '' |
2528 call feedkeys(":behave win\<C-D>\<F4>\<C-B>\"\<CR>", 'tx') | 2538 call feedkeys(":behave win\<C-D>\<F4>\<C-B>\"\<CR>", 'tx') |
2529 call assert_equal('mswin', g:Sline) | 2539 call assert_equal('mswin', g:Sline) |
2530 call assert_equal('"behave win', @:) | 2540 call assert_equal('"behave win', @:) |
2531 | 2541 set wildoptions& |
2532 " colorscheme name fuzzy completion - NOT supported | 2542 endfunc |
2533 | 2543 |
2534 " built-in command name fuzzy completion | 2544 " " colorscheme name fuzzy completion - NOT supported |
2545 " func Test_fuzzy_completion_colorscheme() | |
2546 " endfunc | |
2547 | |
2548 " built-in command name fuzzy completion | |
2549 func Test_fuzzy_completion_cmdname() | |
2535 set wildoptions& | 2550 set wildoptions& |
2536 call feedkeys(":sbwin\<Tab>\<C-B>\"\<CR>", 'tx') | 2551 call feedkeys(":sbwin\<Tab>\<C-B>\"\<CR>", 'tx') |
2537 call assert_equal('"sbwin', @:) | 2552 call assert_equal('"sbwin', @:) |
2538 call feedkeys(":sbr*d\<Tab>\<C-B>\"\<CR>", 'tx') | 2553 call feedkeys(":sbr*d\<Tab>\<C-B>\"\<CR>", 'tx') |
2539 call assert_equal('"sbrewind', @:) | 2554 call assert_equal('"sbrewind', @:) |
2540 set wildoptions=fuzzy | 2555 set wildoptions=fuzzy |
2541 call feedkeys(":sbwin\<Tab>\<C-B>\"\<CR>", 'tx') | 2556 call feedkeys(":sbwin\<Tab>\<C-B>\"\<CR>", 'tx') |
2542 call assert_equal('"sbrewind', @:) | 2557 call assert_equal('"sbrewind', @:) |
2543 call feedkeys(":sbr*d\<Tab>\<C-B>\"\<CR>", 'tx') | 2558 call feedkeys(":sbr*d\<Tab>\<C-B>\"\<CR>", 'tx') |
2544 call assert_equal('"sbr*d', @:) | 2559 call assert_equal('"sbr*d', @:) |
2545 | 2560 set wildoptions& |
2546 " compiler name fuzzy completion - NOT supported | 2561 endfunc |
2547 | 2562 |
2548 " :cscope suboptions fuzzy completion | 2563 " " compiler name fuzzy completion - NOT supported |
2549 if has('cscope') | 2564 " func Test_fuzzy_completion_compiler() |
2550 set wildoptions& | 2565 " endfunc |
2551 call feedkeys(":cscope ret\<Tab>\<C-B>\"\<CR>", 'tx') | 2566 |
2552 call assert_equal('"cscope ret', @:) | 2567 " :cscope suboptions fuzzy completion |
2553 call feedkeys(":cscope re*t\<Tab>\<C-B>\"\<CR>", 'tx') | 2568 func Test_fuzzy_completion_cscope() |
2554 call assert_equal('"cscope reset', @:) | 2569 CheckFeature cscope |
2555 set wildoptions=fuzzy | 2570 set wildoptions& |
2556 call feedkeys(":cscope ret\<Tab>\<C-B>\"\<CR>", 'tx') | 2571 call feedkeys(":cscope ret\<Tab>\<C-B>\"\<CR>", 'tx') |
2557 call assert_equal('"cscope reset', @:) | 2572 call assert_equal('"cscope ret', @:) |
2558 call feedkeys(":cscope re*t\<Tab>\<C-B>\"\<CR>", 'tx') | 2573 call feedkeys(":cscope re*t\<Tab>\<C-B>\"\<CR>", 'tx') |
2559 call assert_equal('"cscope re*t', @:) | 2574 call assert_equal('"cscope reset', @:) |
2560 endif | 2575 set wildoptions=fuzzy |
2561 | 2576 call feedkeys(":cscope ret\<Tab>\<C-B>\"\<CR>", 'tx') |
2562 " :diffget/:diffput buffer name fuzzy completion | 2577 call assert_equal('"cscope reset', @:) |
2578 call feedkeys(":cscope re*t\<Tab>\<C-B>\"\<CR>", 'tx') | |
2579 call assert_equal('"cscope re*t', @:) | |
2580 set wildoptions& | |
2581 endfunc | |
2582 | |
2583 " :diffget/:diffput buffer name fuzzy completion | |
2584 func Test_fuzzy_completion_diff() | |
2563 new SomeBuffer | 2585 new SomeBuffer |
2564 diffthis | 2586 diffthis |
2565 new OtherBuffer | 2587 new OtherBuffer |
2566 diffthis | 2588 diffthis |
2567 set wildoptions& | 2589 set wildoptions& |
2573 call feedkeys(":diffget sbuf\<Tab>\<C-B>\"\<CR>", 'tx') | 2595 call feedkeys(":diffget sbuf\<Tab>\<C-B>\"\<CR>", 'tx') |
2574 call assert_equal('"diffget SomeBuffer', @:) | 2596 call assert_equal('"diffget SomeBuffer', @:) |
2575 call feedkeys(":diffput sbuf\<Tab>\<C-B>\"\<CR>", 'tx') | 2597 call feedkeys(":diffput sbuf\<Tab>\<C-B>\"\<CR>", 'tx') |
2576 call assert_equal('"diffput SomeBuffer', @:) | 2598 call assert_equal('"diffput SomeBuffer', @:) |
2577 %bw! | 2599 %bw! |
2578 | 2600 set wildoptions& |
2579 " directory name fuzzy completion - NOT supported | 2601 endfunc |
2580 | 2602 |
2581 " environment variable name fuzzy completion | 2603 " " directory name fuzzy completion - NOT supported |
2604 " func Test_fuzzy_completion_dirname() | |
2605 " endfunc | |
2606 | |
2607 " environment variable name fuzzy completion | |
2608 func Test_fuzzy_completion_env() | |
2582 set wildoptions& | 2609 set wildoptions& |
2583 call feedkeys(":echo $VUT\<Tab>\<C-B>\"\<CR>", 'tx') | 2610 call feedkeys(":echo $VUT\<Tab>\<C-B>\"\<CR>", 'tx') |
2584 call assert_equal('"echo $VUT', @:) | 2611 call assert_equal('"echo $VUT', @:) |
2585 set wildoptions=fuzzy | 2612 set wildoptions=fuzzy |
2586 call feedkeys(":echo $VUT\<Tab>\<C-B>\"\<CR>", 'tx') | 2613 call feedkeys(":echo $VUT\<Tab>\<C-B>\"\<CR>", 'tx') |
2587 call assert_equal('"echo $VIMRUNTIME', @:) | 2614 call assert_equal('"echo $VIMRUNTIME', @:) |
2588 | 2615 set wildoptions& |
2589 " autocmd event fuzzy completion | 2616 endfunc |
2617 | |
2618 " autocmd event fuzzy completion | |
2619 func Test_fuzzy_completion_autocmd_event() | |
2590 set wildoptions& | 2620 set wildoptions& |
2591 call feedkeys(":autocmd BWout\<Tab>\<C-B>\"\<CR>", 'tx') | 2621 call feedkeys(":autocmd BWout\<Tab>\<C-B>\"\<CR>", 'tx') |
2592 call assert_equal('"autocmd BWout', @:) | 2622 call assert_equal('"autocmd BWout', @:) |
2593 set wildoptions=fuzzy | 2623 set wildoptions=fuzzy |
2594 call feedkeys(":autocmd BWout\<Tab>\<C-B>\"\<CR>", 'tx') | 2624 call feedkeys(":autocmd BWout\<Tab>\<C-B>\"\<CR>", 'tx') |
2595 call assert_equal('"autocmd BufWipeout', @:) | 2625 call assert_equal('"autocmd BufWipeout', @:) |
2596 | 2626 set wildoptions& |
2597 " vim expression fuzzy completion | 2627 endfunc |
2628 | |
2629 " vim expression fuzzy completion | |
2630 func Test_fuzzy_completion_expr() | |
2598 let g:PerPlaceCount = 10 | 2631 let g:PerPlaceCount = 10 |
2599 set wildoptions& | 2632 set wildoptions& |
2600 call feedkeys(":let c = ppc\<Tab>\<C-B>\"\<CR>", 'tx') | 2633 call feedkeys(":let c = ppc\<Tab>\<C-B>\"\<CR>", 'tx') |
2601 call assert_equal('"let c = ppc', @:) | 2634 call assert_equal('"let c = ppc', @:) |
2602 set wildoptions=fuzzy | 2635 set wildoptions=fuzzy |
2603 call feedkeys(":let c = ppc\<Tab>\<C-B>\"\<CR>", 'tx') | 2636 call feedkeys(":let c = ppc\<Tab>\<C-B>\"\<CR>", 'tx') |
2604 call assert_equal('"let c = PerPlaceCount', @:) | 2637 call assert_equal('"let c = PerPlaceCount', @:) |
2605 | 2638 set wildoptions& |
2606 " file name fuzzy completion - NOT supported | 2639 endfunc |
2607 | 2640 |
2608 " files in path fuzzy completion - NOT supported | 2641 " " file name fuzzy completion - NOT supported |
2609 | 2642 " func Test_fuzzy_completion_filename() |
2610 " filetype name fuzzy completion - NOT supported | 2643 " endfunc |
2611 | 2644 |
2612 " user defined function name completion | 2645 " " files in path fuzzy completion - NOT supported |
2613 set wildoptions& | 2646 " func Test_fuzzy_completion_filesinpath() |
2614 call feedkeys(":call Test_w_fuz\<Tab>\<C-B>\"\<CR>", 'tx') | 2647 " endfunc |
2615 call assert_equal('"call Test_w_fuz', @:) | 2648 |
2616 set wildoptions=fuzzy | 2649 " " filetype name fuzzy completion - NOT supported |
2617 call feedkeys(":call Test_w_fuz\<Tab>\<C-B>\"\<CR>", 'tx') | 2650 " func Test_fuzzy_completion_filetype() |
2618 call assert_equal('"call Test_wildoptions_fuzzy()', @:) | 2651 " endfunc |
2619 | 2652 |
2620 " user defined command name completion | 2653 " user defined function name completion |
2654 func Test_fuzzy_completion_userdefined_func() | |
2655 set wildoptions& | |
2656 call feedkeys(":call Test_f_u_f\<Tab>\<C-B>\"\<CR>", 'tx') | |
2657 call assert_equal('"call Test_f_u_f', @:) | |
2658 set wildoptions=fuzzy | |
2659 call feedkeys(":call Test_f_u_f\<Tab>\<C-B>\"\<CR>", 'tx') | |
2660 call assert_equal('"call Test_fuzzy_completion_userdefined_func()', @:) | |
2661 set wildoptions& | |
2662 endfunc | |
2663 | |
2664 " user defined command name completion | |
2665 func Test_fuzzy_completion_userdefined_cmd() | |
2621 set wildoptions& | 2666 set wildoptions& |
2622 call feedkeys(":MsFeat\<Tab>\<C-B>\"\<CR>", 'tx') | 2667 call feedkeys(":MsFeat\<Tab>\<C-B>\"\<CR>", 'tx') |
2623 call assert_equal('"MsFeat', @:) | 2668 call assert_equal('"MsFeat', @:) |
2624 set wildoptions=fuzzy | 2669 set wildoptions=fuzzy |
2625 call feedkeys(":MsFeat\<Tab>\<C-B>\"\<CR>", 'tx') | 2670 call feedkeys(":MsFeat\<Tab>\<C-B>\"\<CR>", 'tx') |
2626 call assert_equal('"MissingFeature', @:) | 2671 call assert_equal('"MissingFeature', @:) |
2627 | 2672 set wildoptions& |
2628 " :help tag fuzzy completion - NOT supported | 2673 endfunc |
2629 | 2674 |
2630 " highlight group name fuzzy completion | 2675 " " :help tag fuzzy completion - NOT supported |
2676 " func Test_fuzzy_completion_helptag() | |
2677 " endfunc | |
2678 | |
2679 " highlight group name fuzzy completion | |
2680 func Test_fuzzy_completion_hlgroup() | |
2631 set wildoptions& | 2681 set wildoptions& |
2632 call feedkeys(":highlight SKey\<Tab>\<C-B>\"\<CR>", 'tx') | 2682 call feedkeys(":highlight SKey\<Tab>\<C-B>\"\<CR>", 'tx') |
2633 call assert_equal('"highlight SKey', @:) | 2683 call assert_equal('"highlight SKey', @:) |
2634 call feedkeys(":highlight Sp*Key\<Tab>\<C-B>\"\<CR>", 'tx') | 2684 call feedkeys(":highlight Sp*Key\<Tab>\<C-B>\"\<CR>", 'tx') |
2635 call assert_equal('"highlight SpecialKey', @:) | 2685 call assert_equal('"highlight SpecialKey', @:) |
2636 set wildoptions=fuzzy | 2686 set wildoptions=fuzzy |
2637 call feedkeys(":highlight SKey\<Tab>\<C-B>\"\<CR>", 'tx') | 2687 call feedkeys(":highlight SKey\<Tab>\<C-B>\"\<CR>", 'tx') |
2638 call assert_equal('"highlight SpecialKey', @:) | 2688 call assert_equal('"highlight SpecialKey', @:) |
2639 call feedkeys(":highlight Sp*Key\<Tab>\<C-B>\"\<CR>", 'tx') | 2689 call feedkeys(":highlight Sp*Key\<Tab>\<C-B>\"\<CR>", 'tx') |
2640 call assert_equal('"highlight Sp*Key', @:) | 2690 call assert_equal('"highlight Sp*Key', @:) |
2641 | 2691 set wildoptions& |
2642 " :history suboptions fuzzy completion | 2692 endfunc |
2693 | |
2694 " :history suboptions fuzzy completion | |
2695 func Test_fuzzy_completion_history() | |
2643 set wildoptions& | 2696 set wildoptions& |
2644 call feedkeys(":history dg\<Tab>\<C-B>\"\<CR>", 'tx') | 2697 call feedkeys(":history dg\<Tab>\<C-B>\"\<CR>", 'tx') |
2645 call assert_equal('"history dg', @:) | 2698 call assert_equal('"history dg', @:) |
2646 call feedkeys(":history se*h\<Tab>\<C-B>\"\<CR>", 'tx') | 2699 call feedkeys(":history se*h\<Tab>\<C-B>\"\<CR>", 'tx') |
2647 call assert_equal('"history search', @:) | 2700 call assert_equal('"history search', @:) |
2648 set wildoptions=fuzzy | 2701 set wildoptions=fuzzy |
2649 call feedkeys(":history dg\<Tab>\<C-B>\"\<CR>", 'tx') | 2702 call feedkeys(":history dg\<Tab>\<C-B>\"\<CR>", 'tx') |
2650 call assert_equal('"history debug', @:) | 2703 call assert_equal('"history debug', @:) |
2651 call feedkeys(":history se*h\<Tab>\<C-B>\"\<CR>", 'tx') | 2704 call feedkeys(":history se*h\<Tab>\<C-B>\"\<CR>", 'tx') |
2652 call assert_equal('"history se*h', @:) | 2705 call assert_equal('"history se*h', @:) |
2653 | 2706 set wildoptions& |
2654 " :language locale name fuzzy completion | 2707 endfunc |
2655 if has('unix') | 2708 |
2656 set wildoptions& | 2709 " :language locale name fuzzy completion |
2657 call feedkeys(":lang psx\<Tab>\<C-B>\"\<CR>", 'tx') | 2710 func Test_fuzzy_completion_lang() |
2658 call assert_equal('"lang psx', @:) | 2711 CheckUnix |
2659 set wildoptions=fuzzy | 2712 set wildoptions& |
2660 call feedkeys(":lang psx\<Tab>\<C-B>\"\<CR>", 'tx') | 2713 call feedkeys(":lang psx\<Tab>\<C-B>\"\<CR>", 'tx') |
2661 call assert_equal('"lang POSIX', @:) | 2714 call assert_equal('"lang psx', @:) |
2662 endif | 2715 set wildoptions=fuzzy |
2663 | 2716 call feedkeys(":lang psx\<Tab>\<C-B>\"\<CR>", 'tx') |
2664 " :mapclear buffer argument fuzzy completion | 2717 call assert_equal('"lang POSIX', @:) |
2718 set wildoptions& | |
2719 endfunc | |
2720 | |
2721 " :mapclear buffer argument fuzzy completion | |
2722 func Test_fuzzy_completion_mapclear() | |
2665 set wildoptions& | 2723 set wildoptions& |
2666 call feedkeys(":mapclear buf\<Tab>\<C-B>\"\<CR>", 'tx') | 2724 call feedkeys(":mapclear buf\<Tab>\<C-B>\"\<CR>", 'tx') |
2667 call assert_equal('"mapclear buf', @:) | 2725 call assert_equal('"mapclear buf', @:) |
2668 set wildoptions=fuzzy | 2726 set wildoptions=fuzzy |
2669 call feedkeys(":mapclear buf\<Tab>\<C-B>\"\<CR>", 'tx') | 2727 call feedkeys(":mapclear buf\<Tab>\<C-B>\"\<CR>", 'tx') |
2670 call assert_equal('"mapclear <buffer>', @:) | 2728 call assert_equal('"mapclear <buffer>', @:) |
2671 | 2729 set wildoptions& |
2672 " map name fuzzy completion | 2730 endfunc |
2731 | |
2732 " map name fuzzy completion | |
2733 func Test_fuzzy_completion_mapname() | |
2673 " test regex completion works | 2734 " test regex completion works |
2674 set wildoptions=fuzzy | 2735 set wildoptions=fuzzy |
2675 call feedkeys(":cnoremap <ex\<Tab> <esc> \<Tab>\<C-B>\"\<CR>", 'tx') | 2736 call feedkeys(":cnoremap <ex\<Tab> <esc> \<Tab>\<C-B>\"\<CR>", 'tx') |
2676 call assert_equal("\"cnoremap <expr> <esc> \<Tab>", @:) | 2737 call assert_equal("\"cnoremap <expr> <esc> \<Tab>", @:) |
2677 nmap <plug>MyLongMap :p<CR> | 2738 nmap <plug>MyLongMap :p<CR> |
2702 nunmap <Plug>goformat | 2763 nunmap <Plug>goformat |
2703 nunmap <Plug>TestFOrmat | 2764 nunmap <Plug>TestFOrmat |
2704 nunmap <Plug>fendoff | 2765 nunmap <Plug>fendoff |
2705 nunmap <Plug>state | 2766 nunmap <Plug>state |
2706 nunmap <Plug>FendingOff | 2767 nunmap <Plug>FendingOff |
2707 | 2768 set wildoptions& |
2708 " abbreviation fuzzy completion | 2769 endfunc |
2770 | |
2771 " abbreviation fuzzy completion | |
2772 func Test_fuzzy_completion_abbr() | |
2709 set wildoptions=fuzzy | 2773 set wildoptions=fuzzy |
2710 call feedkeys(":iabbr wait\<Tab>\<C-B>\"\<CR>", 'tx') | 2774 call feedkeys(":iabbr wait\<Tab>\<C-B>\"\<CR>", 'tx') |
2711 call assert_equal("\"iabbr <nowait>", @:) | 2775 call assert_equal("\"iabbr <nowait>", @:) |
2712 iabbr WaitForCompletion WFC | 2776 iabbr WaitForCompletion WFC |
2713 call feedkeys(":iabbr fcl\<Tab>\<C-B>\"\<CR>", 'tx') | 2777 call feedkeys(":iabbr fcl\<Tab>\<C-B>\"\<CR>", 'tx') |
2714 call assert_equal("\"iabbr WaitForCompletion", @:) | 2778 call assert_equal("\"iabbr WaitForCompletion", @:) |
2715 call feedkeys(":iabbr a1z\<Tab>\<C-B>\"\<CR>", 'tx') | 2779 call feedkeys(":iabbr a1z\<Tab>\<C-B>\"\<CR>", 'tx') |
2716 call assert_equal("\"iabbr a1z\t", @:) | 2780 call assert_equal("\"iabbr a1z\t", @:) |
2717 iunabbrev WaitForCompletion | 2781 iunabbrev WaitForCompletion |
2718 | 2782 set wildoptions& |
2719 " menu name fuzzy completion | 2783 endfunc |
2720 if has('gui_running') | 2784 |
2721 set wildoptions& | 2785 " menu name fuzzy completion |
2722 call feedkeys(":menu pup\<Tab>\<C-B>\"\<CR>", 'tx') | 2786 func Test_fuzzy_completion_menu() |
2723 call assert_equal('"menu pup', @:) | 2787 CheckGui |
2724 set wildoptions=fuzzy | 2788 set wildoptions& |
2725 call feedkeys(":menu pup\<Tab>\<C-B>\"\<CR>", 'tx') | 2789 call feedkeys(":menu pup\<Tab>\<C-B>\"\<CR>", 'tx') |
2726 call assert_equal('"menu PopUp.', @:) | 2790 call assert_equal('"menu pup', @:) |
2727 endif | 2791 set wildoptions=fuzzy |
2728 | 2792 call feedkeys(":menu pup\<Tab>\<C-B>\"\<CR>", 'tx') |
2729 " :messages suboptions fuzzy completion | 2793 call assert_equal('"menu PopUp.', @:) |
2794 set wildoptions& | |
2795 endfunc | |
2796 | |
2797 " :messages suboptions fuzzy completion | |
2798 func Test_fuzzy_completion_messages() | |
2730 set wildoptions& | 2799 set wildoptions& |
2731 call feedkeys(":messages clr\<Tab>\<C-B>\"\<CR>", 'tx') | 2800 call feedkeys(":messages clr\<Tab>\<C-B>\"\<CR>", 'tx') |
2732 call assert_equal('"messages clr', @:) | 2801 call assert_equal('"messages clr', @:) |
2733 set wildoptions=fuzzy | 2802 set wildoptions=fuzzy |
2734 call feedkeys(":messages clr\<Tab>\<C-B>\"\<CR>", 'tx') | 2803 call feedkeys(":messages clr\<Tab>\<C-B>\"\<CR>", 'tx') |
2735 call assert_equal('"messages clear', @:) | 2804 call assert_equal('"messages clear', @:) |
2736 | 2805 set wildoptions& |
2737 " :set option name fuzzy completion | 2806 endfunc |
2807 | |
2808 " :set option name fuzzy completion | |
2809 func Test_fuzzy_completion_option() | |
2738 set wildoptions& | 2810 set wildoptions& |
2739 call feedkeys(":set brkopt\<Tab>\<C-B>\"\<CR>", 'tx') | 2811 call feedkeys(":set brkopt\<Tab>\<C-B>\"\<CR>", 'tx') |
2740 call assert_equal('"set brkopt', @:) | 2812 call assert_equal('"set brkopt', @:) |
2741 set wildoptions=fuzzy | 2813 set wildoptions=fuzzy |
2742 call feedkeys(":set brkopt\<Tab>\<C-B>\"\<CR>", 'tx') | 2814 call feedkeys(":set brkopt\<Tab>\<C-B>\"\<CR>", 'tx') |
2745 call feedkeys(":set fixeol\<Tab>\<C-B>\"\<CR>", 'tx') | 2817 call feedkeys(":set fixeol\<Tab>\<C-B>\"\<CR>", 'tx') |
2746 call assert_equal('"set fixendofline', @:) | 2818 call assert_equal('"set fixendofline', @:) |
2747 set wildoptions=fuzzy | 2819 set wildoptions=fuzzy |
2748 call feedkeys(":set fixeol\<Tab>\<C-B>\"\<CR>", 'tx') | 2820 call feedkeys(":set fixeol\<Tab>\<C-B>\"\<CR>", 'tx') |
2749 call assert_equal('"set fixendofline', @:) | 2821 call assert_equal('"set fixendofline', @:) |
2750 | 2822 set wildoptions& |
2751 " :set <term_option> | 2823 endfunc |
2824 | |
2825 " :set <term_option> | |
2826 func Test_fuzzy_completion_term_option() | |
2752 set wildoptions& | 2827 set wildoptions& |
2753 call feedkeys(":set t_E\<Tab>\<C-B>\"\<CR>", 'tx') | 2828 call feedkeys(":set t_E\<Tab>\<C-B>\"\<CR>", 'tx') |
2754 call assert_equal('"set t_EC', @:) | 2829 call assert_equal('"set t_EC', @:) |
2755 call feedkeys(":set <t_E\<Tab>\<C-B>\"\<CR>", 'tx') | 2830 call feedkeys(":set <t_E\<Tab>\<C-B>\"\<CR>", 'tx') |
2756 call assert_equal('"set <t_EC>', @:) | 2831 call assert_equal('"set <t_EC>', @:) |
2757 set wildoptions=fuzzy | 2832 set wildoptions=fuzzy |
2758 call feedkeys(":set t_E\<Tab>\<C-B>\"\<CR>", 'tx') | 2833 call feedkeys(":set t_E\<Tab>\<C-B>\"\<CR>", 'tx') |
2759 call assert_equal('"set t_EC', @:) | 2834 call assert_equal('"set t_EC', @:) |
2760 call feedkeys(":set <t_E\<Tab>\<C-B>\"\<CR>", 'tx') | 2835 call feedkeys(":set <t_E\<Tab>\<C-B>\"\<CR>", 'tx') |
2761 call assert_equal('"set <t_EC>', @:) | 2836 call assert_equal('"set <t_EC>', @:) |
2762 | 2837 set wildoptions& |
2763 " :packadd directory name fuzzy completion - NOT supported | 2838 endfunc |
2764 | 2839 |
2765 " shell command name fuzzy completion - NOT supported | 2840 " " :packadd directory name fuzzy completion - NOT supported |
2766 | 2841 " func Test_fuzzy_completion_packadd() |
2767 " :sign suboptions fuzzy completion | 2842 " endfunc |
2843 | |
2844 " " shell command name fuzzy completion - NOT supported | |
2845 " func Test_fuzzy_completion_shellcmd() | |
2846 " endfunc | |
2847 | |
2848 " :sign suboptions fuzzy completion | |
2849 func Test_fuzzy_completion_sign() | |
2768 set wildoptions& | 2850 set wildoptions& |
2769 call feedkeys(":sign ufe\<Tab>\<C-B>\"\<CR>", 'tx') | 2851 call feedkeys(":sign ufe\<Tab>\<C-B>\"\<CR>", 'tx') |
2770 call assert_equal('"sign ufe', @:) | 2852 call assert_equal('"sign ufe', @:) |
2771 set wildoptions=fuzzy | 2853 set wildoptions=fuzzy |
2772 call feedkeys(":sign ufe\<Tab>\<C-B>\"\<CR>", 'tx') | 2854 call feedkeys(":sign ufe\<Tab>\<C-B>\"\<CR>", 'tx') |
2773 call assert_equal('"sign undefine', @:) | 2855 call assert_equal('"sign undefine', @:) |
2774 | 2856 set wildoptions& |
2775 " :syntax suboptions fuzzy completion | 2857 endfunc |
2858 | |
2859 " :syntax suboptions fuzzy completion | |
2860 func Test_fuzzy_completion_syntax_cmd() | |
2776 set wildoptions& | 2861 set wildoptions& |
2777 call feedkeys(":syntax kwd\<Tab>\<C-B>\"\<CR>", 'tx') | 2862 call feedkeys(":syntax kwd\<Tab>\<C-B>\"\<CR>", 'tx') |
2778 call assert_equal('"syntax kwd', @:) | 2863 call assert_equal('"syntax kwd', @:) |
2779 set wildoptions=fuzzy | 2864 set wildoptions=fuzzy |
2780 call feedkeys(":syntax kwd\<Tab>\<C-B>\"\<CR>", 'tx') | 2865 call feedkeys(":syntax kwd\<Tab>\<C-B>\"\<CR>", 'tx') |
2781 call assert_equal('"syntax keyword', @:) | 2866 call assert_equal('"syntax keyword', @:) |
2782 | 2867 set wildoptions& |
2783 " syntax group name fuzzy completion | 2868 endfunc |
2869 | |
2870 " syntax group name fuzzy completion | |
2871 func Test_fuzzy_completion_syntax_group() | |
2784 set wildoptions& | 2872 set wildoptions& |
2785 call feedkeys(":syntax list mpar\<Tab>\<C-B>\"\<CR>", 'tx') | 2873 call feedkeys(":syntax list mpar\<Tab>\<C-B>\"\<CR>", 'tx') |
2786 call assert_equal('"syntax list mpar', @:) | 2874 call assert_equal('"syntax list mpar', @:) |
2787 set wildoptions=fuzzy | 2875 set wildoptions=fuzzy |
2788 call feedkeys(":syntax list mpar\<Tab>\<C-B>\"\<CR>", 'tx') | 2876 call feedkeys(":syntax list mpar\<Tab>\<C-B>\"\<CR>", 'tx') |
2789 call assert_equal('"syntax list MatchParen', @:) | 2877 call assert_equal('"syntax list MatchParen', @:) |
2790 | 2878 set wildoptions& |
2791 " :syntime suboptions fuzzy completion | 2879 endfunc |
2792 if has('profile') | 2880 |
2793 set wildoptions& | 2881 " :syntime suboptions fuzzy completion |
2794 call feedkeys(":syntime clr\<Tab>\<C-B>\"\<CR>", 'tx') | 2882 func Test_fuzzy_completion_syntime() |
2795 call assert_equal('"syntime clr', @:) | 2883 CheckFeature profile |
2796 set wildoptions=fuzzy | 2884 set wildoptions& |
2797 call feedkeys(":syntime clr\<Tab>\<C-B>\"\<CR>", 'tx') | 2885 call feedkeys(":syntime clr\<Tab>\<C-B>\"\<CR>", 'tx') |
2798 call assert_equal('"syntime clear', @:) | 2886 call assert_equal('"syntime clr', @:) |
2799 endif | 2887 set wildoptions=fuzzy |
2800 | 2888 call feedkeys(":syntime clr\<Tab>\<C-B>\"\<CR>", 'tx') |
2801 " tag name fuzzy completion - NOT supported | 2889 call assert_equal('"syntime clear', @:) |
2802 | 2890 set wildoptions& |
2803 " tag name and file fuzzy completion - NOT supported | 2891 endfunc |
2804 | 2892 |
2805 " user names fuzzy completion - how to test this functionality? | 2893 " " tag name fuzzy completion - NOT supported |
2806 | 2894 " func Test_fuzzy_completion_tagname() |
2807 " user defined variable name fuzzy completion | 2895 " endfunc |
2896 | |
2897 " " tag name and file fuzzy completion - NOT supported | |
2898 " func Test_fuzzy_completion_tagfile() | |
2899 " endfunc | |
2900 | |
2901 " " user names fuzzy completion - how to test this functionality? | |
2902 " func Test_fuzzy_completion_username() | |
2903 " endfunc | |
2904 | |
2905 " user defined variable name fuzzy completion | |
2906 func Test_fuzzy_completion_userdefined_var() | |
2808 let g:SomeVariable=10 | 2907 let g:SomeVariable=10 |
2809 set wildoptions& | 2908 set wildoptions& |
2810 call feedkeys(":let SVar\<Tab>\<C-B>\"\<CR>", 'tx') | 2909 call feedkeys(":let SVar\<Tab>\<C-B>\"\<CR>", 'tx') |
2811 call assert_equal('"let SVar', @:) | 2910 call assert_equal('"let SVar', @:) |
2812 set wildoptions=fuzzy | 2911 set wildoptions=fuzzy |
2813 call feedkeys(":let SVar\<Tab>\<C-B>\"\<CR>", 'tx') | 2912 call feedkeys(":let SVar\<Tab>\<C-B>\"\<CR>", 'tx') |
2814 call assert_equal('"let SomeVariable', @:) | 2913 call assert_equal('"let SomeVariable', @:) |
2815 | 2914 set wildoptions& |
2816 " Test for sorting the results by the best match | 2915 endfunc |
2916 | |
2917 " Test for sorting the results by the best match | |
2918 func Test_fuzzy_completion_cmd_sort_results() | |
2817 %bw! | 2919 %bw! |
2818 command T123format : | 2920 command T123format : |
2819 command T123goformat : | 2921 command T123goformat : |
2820 command T123TestFOrmat : | 2922 command T123TestFOrmat : |
2821 command T123fendoff : | 2923 command T123fendoff : |
2829 delcommand T123TestFOrmat | 2931 delcommand T123TestFOrmat |
2830 delcommand T123fendoff | 2932 delcommand T123fendoff |
2831 delcommand T123state | 2933 delcommand T123state |
2832 delcommand T123FendingOff | 2934 delcommand T123FendingOff |
2833 %bw | 2935 %bw |
2834 | 2936 set wildoptions& |
2835 " Test for fuzzy completion of a command with lower case letters and a | 2937 endfunc |
2836 " number | 2938 |
2939 " Test for fuzzy completion of a command with lower case letters and a number | |
2940 func Test_fuzzy_completion_cmd_alnum() | |
2837 command Foo2Bar : | 2941 command Foo2Bar : |
2838 set wildoptions=fuzzy | 2942 set wildoptions=fuzzy |
2839 call feedkeys(":foo2\<Tab>\<C-B>\"\<CR>", 'tx') | 2943 call feedkeys(":foo2\<Tab>\<C-B>\"\<CR>", 'tx') |
2840 call assert_equal('"Foo2Bar', @:) | 2944 call assert_equal('"Foo2Bar', @:) |
2841 call feedkeys(":foo\<Tab>\<C-B>\"\<CR>", 'tx') | 2945 call feedkeys(":foo\<Tab>\<C-B>\"\<CR>", 'tx') |
2842 call assert_equal('"Foo2Bar', @:) | 2946 call assert_equal('"Foo2Bar', @:) |
2843 call feedkeys(":bar\<Tab>\<C-B>\"\<CR>", 'tx') | 2947 call feedkeys(":bar\<Tab>\<C-B>\"\<CR>", 'tx') |
2844 call assert_equal('"Foo2Bar', @:) | 2948 call assert_equal('"Foo2Bar', @:) |
2845 delcommand Foo2Bar | 2949 delcommand Foo2Bar |
2846 | 2950 set wildoptions& |
2847 " Test for command completion for a command starting with 'k' | 2951 endfunc |
2952 | |
2953 " Test for command completion for a command starting with 'k' | |
2954 func Test_fuzzy_completion_cmd_k() | |
2848 command KillKillKill : | 2955 command KillKillKill : |
2849 set wildoptions& | 2956 set wildoptions& |
2850 call feedkeys(":killkill\<Tab>\<C-B>\"\<CR>", 'tx') | 2957 call feedkeys(":killkill\<Tab>\<C-B>\"\<CR>", 'tx') |
2851 call assert_equal("\"killkill\<Tab>", @:) | 2958 call assert_equal("\"killkill\<Tab>", @:) |
2852 set wildoptions=fuzzy | 2959 set wildoptions=fuzzy |
2853 call feedkeys(":killkill\<Tab>\<C-B>\"\<CR>", 'tx') | 2960 call feedkeys(":killkill\<Tab>\<C-B>\"\<CR>", 'tx') |
2854 call assert_equal('"KillKillKill', @:) | 2961 call assert_equal('"KillKillKill', @:) |
2855 delcom KillKillKill | 2962 delcom KillKillKill |
2856 | 2963 set wildoptions& |
2857 set wildoptions& | 2964 endfunc |
2858 %bw! | 2965 |
2966 " Test for fuzzy completion for user defined custom completion function | |
2967 func Test_fuzzy_completion_custom_func() | |
2968 func Tcompl(a, c, p) | |
2969 return "format\ngoformat\nTestFOrmat\nfendoff\nstate" | |
2970 endfunc | |
2971 command -nargs=* -complete=custom,Tcompl Fuzzy : | |
2972 set wildoptions& | |
2973 call feedkeys(":Fuzzy fo\<C-A>\<C-B>\"\<CR>", 'tx') | |
2974 call assert_equal("\"Fuzzy format", @:) | |
2975 call feedkeys(":Fuzzy xy\<Tab>\<C-B>\"\<CR>", 'tx') | |
2976 call assert_equal("\"Fuzzy xy", @:) | |
2977 call feedkeys(":Fuzzy ttt\<C-A>\<C-B>\"\<CR>", 'tx') | |
2978 call assert_equal("\"Fuzzy ttt", @:) | |
2979 set wildoptions=fuzzy | |
2980 call feedkeys(":Fuzzy \<C-A>\<C-B>\"\<CR>", 'tx') | |
2981 call assert_equal("\"Fuzzy format goformat TestFOrmat fendoff state", @:) | |
2982 call feedkeys(":Fuzzy fo\<C-A>\<C-B>\"\<CR>", 'tx') | |
2983 call assert_equal("\"Fuzzy format TestFOrmat goformat fendoff", @:) | |
2984 call feedkeys(":Fuzzy xy\<Tab>\<C-B>\"\<CR>", 'tx') | |
2985 call assert_equal("\"Fuzzy xy", @:) | |
2986 call feedkeys(":Fuzzy ttt\<C-A>\<C-B>\"\<CR>", 'tx') | |
2987 call assert_equal("\"Fuzzy TestFOrmat", @:) | |
2988 delcom Fuzzy | |
2989 set wildoptions& | |
2859 endfunc | 2990 endfunc |
2860 | 2991 |
2861 " vim: shiftwidth=2 sts=2 expandtab | 2992 " vim: shiftwidth=2 sts=2 expandtab |