shaunsingh / nix-darwin-dotfiles

Dotfiles managed via Nix-Darwin and Mk-Darwin-System, for schoolwork and kotlin, lua, and rust programming
391 stars 27 forks source link

Loading Telescope before "BufRead" won't work? #2

Closed monsonjeremy closed 3 years ago

monsonjeremy commented 3 years ago

Hey, thanks so much for sharing your config on reddit and helping people optimize their loading times and startup.

I was setting my config up to lazy load like yours and ran into a weird edge case.

Based on the telescope.nvim README, it depends on plenary.nvim:

use {
  'nvim-telescope/telescope.nvim',
  requires = { {'nvim-lua/plenary.nvim'} }
}

In your config you don't seem to require plenary.nvim with Telescope. That means that until you have entered a buffer and BufRead has fired, you use Telescope or it will throw an error because plenary.nvim has not been loaded.

Is this a correct reading of your setup? In this case I think it just makes sense for my config to load plenary by default (since my workflow is usually just to open up nvim and then navigate via telescope before entering a buffer)

shaunsingh commented 3 years ago

I think as you said with your workflow, it makes more sense to load plenary (and therefore telescope) by default.

My workflow is usual cd/ls'ing to the directory and opening a file in the project, then loading telescope in which case the lazy loading should work.

monsonjeremy commented 3 years ago

Thanks that makes sense. It's weird that Dashboard isn't considered a buffer, since I load dashboard on enter.

One last question if you don't mind! Do your LSP servers automatically become active when you open a file? I noticed that now that I lazy load my servers are setup but not active and I needed to add vim.cmd('bufdo e') at the end of my lsp setup file to get it to properly activate in the file.

Thanks so much for your help!

shaunsingh commented 3 years ago

I was actually tinkering with that earlier. Sometimes it loads, sometimes it doesn't, I'm thinking of not lazy loading lsp altogether

monsonjeremy commented 3 years ago

Awesome! My solution seems to work well with the forced buffer reload. Thanks for your help!