Friday, December 27, 2013

Re: Why is `:f` abbrev of `:file` and not of (much more useful) `:find`?

On Friday, December 27, 2013 2:36:01 AM UTC+1, Tim Chase wrote:
> On 2013-12-26 17:02, Bruno Sutic wrote:
>
> > Now to the question:
>
> > why is the `:f` an abbreviation to `:file`? Why not `:f` -> `:find`?
>
>
>
> Historical/backwards compatibility. The :file command (and ":f"
>
> shorthand) has existed for decades, including other vi clones.
>
>

That's a bummer.

>
> > `:file` command does not seem that useful, at least not as useful
>
> > as `:find` in everyday work. And Ctrl-G does the same thing as
>
> > `:file`! I solved this in my vimrc with `cab f find` - but I'm more
>
> > interested in the root cause of this.
>
>
>
> That abbreviation would drive me nuts--it might be better to just
>
> make a ":command" to use "F" instead of intercepting every "f" typed
>
> on the command-line. Or at least make it an <expr> mapping
>
>
>
> :help :map-<expr>
>
>
>
> with some smarts to only expand when at the beginning of a command.
>
> I'd hate to try and type
>
>
>
> :%s/foo/bar/g
>
>
>
> and and up with
>
>
>
> :%s/findoo/bar/g
>
>

Tim, the abbreviation (cab) is triggered only when typed as a standalone word.
":%s/foo/bar/g" - "f" in word "foo" is *not* expanded!

Some other random examples:
":new f<space>" would be expanded to ":new find "
":new f<dot>" would be expanded to ":new find."
":new fff.fff<space>" *not* expanded
":new asdf<space>" *not* expanded

Anyway, in practice I think `cab f find` works just fine.

>
> > Do you think Bram would be open to changing the `:f` vim default?
>
>
>
> I'm pretty certain that it wouldn't be entertained, as Vim tends to
>
> be pretty strict about backwards compatibility.
>
>
>
> There's a theoretical possibility that one could create some sort of
>
> 'cpoption' that would change the meaning of it, but that sort of
>
> thing is usually only done for new functionality, not just changing
>
> default abbreviations.
>
>
>
> While I confess that I use ":file newname" more than I use ":find",
>
> it's mostly because :file has my finger memory, and :find doesn't (and
>
> either way, I type out ":file" rather than ":f"). I'll have to work
>
> on bringing ":find" into my muscle memory.
>
>
>
> > (although I have a feeling I would not be the first one to ask)
>
>
>
> I've been vimming for over a decade and on the mailing list for most
>
> of that, and this is the first I've seen of such a request, so you
>
> may be a lone trail-blazer. :-)
>
>

Thanks for letting me know :)

>
> -tim

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment