pappasam / nvim-repl

52 stars 12 forks source link

Change s:exists to s:command_exists, and only handle exact match #2

Closed davidroeca closed 4 years ago

davidroeca commented 4 years ago

This fixes a bug where some of these commands don't get defined if they are a substring of another user command. One case is :Replace in vim-easygrep, which prevents :Repl from being defined.

Check :help exists for more--let me know if you find cases where handling _exists == 3 makes sense as well. I wasn't able to find such a case.

  exists({expr})  The result is a Number, which is TRUE if {expr} is
                  defined, zero otherwise.

                  For checking for a supported feature use has().
                  For checking if a file exists use filereadable().

                  The {expr} argument is a string, which contains one of these:

...

                          :cmdname        Ex command: built-in command, user
                                          command or command modifier :command.
                                          Returns:
                                          1  for match with start of a command
                                          2  full match with a command
                                          3  matches several user commands
                                          To check for a supported command
                                          always check the return value to be 2.