scrooloose / vim-colon-therapy

Handle trailing colons and line numbers in the filename when `:edit`ing
Do What The F*ck You Want To Public License
10 stars 1 forks source link

Also works as argument from command line, but prevents editing filename with colon and numbers in it #1

Open jamespharvey20 opened 5 years ago

jamespharvey20 commented 5 years ago

Love it!

Just saw this, and was going to ask if it would be possible to make it work not only through :e, but also through specifying a file as an argument from the command line.

I installed it to see, and found that it does. Wanted to mention this for 2 reasons: (primarily reason 1)

  1. Could update the readme to say it works that way too.

  2. If someone had this installed and had a file with a colon as part of the filename, and numbers after it, I'm not sure if they'd be able to edit it. i.e.:

$ touch stupidFileName:2
$ vim stupidFileName:2
$ vim stupidFileName\:2

In both runs of vim, it opens a new file stupidFileName. The escaped colon doesn't help, being processed by bash into a colon.

If the filename is a colon followed by letters, it properly opens the file.

Not sure there would be a way around this, besides temporarily disabling the addon. I doubt this would happen often. I don't make filenames with colons, and don't run across them often, but they happen.

syyyr commented 8 months ago

It seems that this has been fixed in https://github.com/scrooloose/vim-colon-therapy/commit/700b1521ad95cfde26c01c3a4ad81fd10db12a7a. I tested this and if the filename with a colon is a real file, it will be opened.