Diff from Travis Cole with input from myself and sthen@. OK sthen@ Thanks!
Needed for neovim. Input and OK tb@. Thanks.