On Wed, 24 Aug 2011, Peng Yu wrote:

On Wed, Aug 24, 2011 at 8:52 AM, Benjamin R. Haskell wrote:
On Wed, 24 Aug 2011, Peng  Yu wrote:

Hi,

Path completion (C-X C-F) does not recognize /tmp as a path, rather it recognize PATH=/tmp as a path. I'm wondering if there is a way to change this "feature" of vim? Thanks!

Not sure why "feature" is in quotes.  It is a feature.  It's controlled by the 'isfname' (= 'isf') option.  Filenames can contain '='.

To prevent Vim from thinking '=' is valid:

set isf-==

See:

:help 'isf'

export TEST_VAR=/tmp/a====b/

It seems that vim is unaware of the context of '='. The first '=' and the remaining '='s mean differently, using isf, vim does not recognize the remaining '='s correctly. That is why I call it "feature". I know making vim more context sensitive require more resources (as it requires parsing, which is against the speed philosophy of vim), which may not be implement in vim.

But I'm just wondering, in case there is a solution. Do you know?

If you want it to be "smarter" you can always switch to omnicompletion (C-X C-O) and handle the context sensitivity in a function. So, short answer: there's no easy way to add it, but for the 95-99% of cases where you don't have directory names with '=' in them, 'isf' suffices.

Although, come to think of it, you might be able to easily add this for the filetype 'sh' completion, since you can test the syntax for the preceding items (so, something after shSetIdentifier, and possibly ':'-separated if the identifier has 'PATH' in it, etc.). Regardless, it'd be 'omnicompletion' and not file completion, and AFAIK it's unwritten. Perhaps someone else knows of a plugin that does this already.

--
Best,
Ben

--
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

Reply via email to