GithubHelp home page GithubHelp logo

Comments (2)

wookayin avatar wookayin commented on July 24, 2024

From :help expand()

  When 'verbose' is set then expanding '%', '#' and <> items
  will result in an error message if the argument cannot be
  expanded.

Per the documentation, it is not quite clear whether printing error message should result in the Lua executor throwing Error (which is the current implementation) or shouldn't interfere with the control flow. So I assumed this is by design (from upstream vim).

For the record, this behavior has been there since Neovim 0.8.0 -- it was not throwing an error before (a9e6cf0). Ref #19905

A possible workaround is: (see also nvim-neo-tree/neo-tree.nvim#1145 (comment))

-- Simply ignore expand(...) error when &verbose>0
local function safe_expand(args)
  if vim.o.verbose > 0 then
    return vim.F.npcall(vim.fn.expand, args) or ''
  else
    return vim.fn.expand(args)
  end
end

from neovim.

stevearc avatar stevearc commented on July 24, 2024

Ah, so the idea is that expanding <afile> is actually "failing" in the normal case by expanding to the empty string, and that with -V1 it is intentionally throwing an error instead. I don't love that changing the verbosity affects control flow, but agree that it makes sense to align with upstream vim.

Thanks for the clarification!

from neovim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.