Thursday, April 17, 2014

Re: Going from linux vim to Macvim?

On Friday, April 18, 2014 6:26:12 AM UTC+12, eNG1Ne wrote:
> > Plus point, though: opening a file from the Finder points vim to the directory the file lives in, which is a lot better than Ubuntu's feeble default of opening everything in usr

Erik Falor replied:
> This behavior may have more to do with the setting of the 'autochdir'
> option than with the OS or file manager.

(To which I'll add, setting autochdir can be annoying, and in the past caused plugins to fail, though there was an effort to make plugins cope.)

eNG1Ne replied:

> something I'll certainly follow up ‒ pity no-one on the Ubuntu forum ever suggested it :-}

I looked into this, and I'm still looking. I was surprised to find that the "desktop entry specification" does not have a generic way to make the working directory that of the file you edit. I have edited my .desktop file to use the command

/usr/local/bin/gvim -f +"cd %:h" %F

I use KDE, and the way I got to this .desktop file was right-click a file to edit in dolphin -> Properties -> File Type Options -> click on gvim, Edit -> Application tab. (I'd previously had to edit this to make KDE use my local vim; the command entry does not honour my PATH, despite determined effort on my part, including setting it system-wide).

By editing the .desktop entry, KDE made a private copy of it in ~/.local/share/applications. Gnome should work the same way, and I presume other DEs like Unity or whatever Ubuntu has these days.

More generically, I've seen people suggest changing the command to

cd %d;command %F

and that works, but %d is deprecated and now undocumented. Also,

x="%f";cd "${x%/*}";command %F

works too, but the "desktop entry specification" says one should have only one of %f, %F, %u or %U appearing in the command, and that only once.

Ah, once the curiosity bug bites... I'll take this to my other favourite forum (kubuntuforums.net) though I expect some KDE forum might be better. Google shows there was some interest in extending the "desktop entry specification" by the KDE folks some years ago, though I couldn't find anything more about it, other than with KDE one can use environment variables in the working directory setting by using the Path[$e]= syntax.

Regards, John Little

--
--
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/d/optout.

No comments: