how to disable autoload packer_compiled.lua on vscode neovim
Describe the feature
disable load packer_compiled.lua on vscode when useing Vscode-Neovim
I have the same problem with neovim-vscode
not sure how vscode-neovim works internally
but couldn't this be changed by changing the compile_path?
Instead of having packer compile to a plugin folder using the lua folder so it can be required manually.
local packer = require("packer")
packer.init({ compile_path = vim.fn.stdpath("data") .. "/lua/packer_compiled.lua" })
At the end of your init file
if not vim.g.vscode then
require("packer_compiled")
end
I found that you can do this to fix these problems:
- change the default Packer compiled file path: example:
packer.init({
display = {
open_fn = function()
return require("packer.util").float({ border = "rounded" })
end,
},
compile_path = vim.fn.stdpath('config') .. '/lua/plugins/' .. 'packer_compiled.lua',
profile = {
enable = true,
threshold = 0, -- the amount in ms that a plugins load time must be over for it to be included in the profile
},
})
this is my config for packer.init()
- require the packer compiled file in somewhere you want:
I just require it in my lua/plugins/init.lua
require('plugins.packer_compiled')
then it works well.... hope this can help someone
@JuanZoran can you confirm if my understanding is correct. This is what I have currently:
require('packer').startup(function(use)
-- Package manager
use 'wbthomason/packer.nvim'
-- rest of the plugins go here --
I should change this to:
packer = require('packer')
packer.init({
compile_path = vim.fn.stdpath('config') .. '/lua/plugins/' .. 'packer_compiled.lua',
})
How do I specify the plugins? If possible, could you please point me to a complete solution?
What you should do is just set up the packer, if you don't mind. then you load your plugin like this:
packer = require('packer')
packer.init( -- this function like a configure function
-- todo set up packer
)
-- load your plugins here
local use = require('packer').use
-- then use some plugin you like
I hope this can help you understand what is packer doing
@JuanZoran thanks for the explanation; that worked!
Another solution for disabling plugins in vscode-neovim is to use the cond attribute for plugins and passing a function that checks for g.vscode.
However, today lazyvim with the vscode spec is the best solution.
Another solution for disabling plugins in vscode-neovim is to use the
condattribute for plugins and passing a function that checks for g.vscode.However, today lazyvim with the vscode spec is the best solution.
For packer and using cond you can follow an example as described here.