Giter Club home page Giter Club logo

Comments (6)

anuvyklack avatar anuvyklack commented on July 20, 2024 6

The solution I use:

autocmd BufRead * autocmd BufWinEnter * ++once normal! zx

or the same but with new autocmd API:

vim.api.nvim_create_autocmd('BufRead', {
   callback = function()
      vim.api.nvim_create_autocmd('BufWinEnter', {
         once = true,
         command = 'normal! zx'
      })
   end
})

BufWinEnter needed to take into account the modeline settings.
And why it not used alone but after BufRead, because BufWinEnter need to be executed only once for each buffer.

from simpylfold.

tmhedberg avatar tmhedberg commented on July 20, 2024

This appears to be a bug in Telescope: nvim-telescope/telescope.nvim#1277.

As a temporary workaround, maybe you could add an autocommand that updates folds after the file is loaded:

autocmd BufRead *.py normal zx

or perhaps

autocmd FileType python normal zx

I don't use nvim, nor am I familiar with Telescope, so it's not easy for me to test this myself, but something like that may help if you can't live with typing zx manually.

from simpylfold.

wintermute-cell avatar wintermute-cell commented on July 20, 2024

Knowing that's an active bug with telescope is answer enough for me!
Thank you for finding the telescope issue that i apparently couldn't find,
and I'll try out your temporary solution asap.

from simpylfold.

wintermute-cell avatar wintermute-cell commented on July 20, 2024

autocmd BufRead *.py normal zx zR works perfectly, opening the file with all folds open. Thanks again!

from simpylfold.

danielnehrig avatar danielnehrig commented on July 20, 2024
  telescope.setup({
    pickers = {
      find_files = {
        hidden = true,
        attach_mappings = function(_)
          action_set.select:enhance({
            post = function()
              vim.cmd(":normal! zx")
            end,
          })
          return true
        end,
      },
    },
...

from simpylfold.

anuvyklack avatar anuvyklack commented on July 20, 2024

@danielnehrig your solution, unfortunately, does not work.

from simpylfold.

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.