diff options
| author | LostNeophyte <[email protected]> | 2023-02-04 16:22:41 +0100 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-04 17:22:41 +0200 | 
| commit | 60c7ad77fddf6d23a2427844f368d247fef1ed5a (patch) | |
| tree | 1af3e0387c31134b2f25a1569824aa5590c60b43 /lua/lvim/core/autocmds.lua | |
| parent | c18cd3f0a89443d4265f6df8ce12fb89d627f09e (diff) | |
perf: lazy load most plugins (#3750)
* perf: lazy load most plugins
* fix(lazy): suggested fixes for pref/lazyloading branch (#3754)
fix(lazy): Suggested fixes from previous comments
fix(lazy): applying suggestions from code review
Co-authored-by: LostNeophyte <[email protected]>
Co-authored-by: Pratyush Bharati <[email protected]>
Co-authored-by: LostNeophyte <[email protected]>
* chore: format
* move lazy utils to modules.lua
* simplify telescope actions
* refactor: cmp_window local name
* feat: more lazy loading cmds
* refactor(cmp): minor clean up
* perf: set lazy loading by default
* refactor(alpha): remove broken lazy load
* revert: explictily set lazy loading
This reverts commit ba38193e4ebfa5acc8afa2b35247c5420d9a2739.
* test: enable lazy-loading for bigfile
* perf: defer projects and alpha to VimEnter
* refactor(bufferline): add comment
* perf: better lazy load dap/dapui
* perf: lazy load ts-commentstring with Comment.nvim pre_hook
---------
Co-authored-by: pr-313 <[email protected]>
Co-authored-by: Pratyush Bharati <[email protected]>
Co-authored-by: opalmay <[email protected]>
Co-authored-by: kylo252 <[email protected]>
Diffstat (limited to 'lua/lvim/core/autocmds.lua')
| -rw-r--r-- | lua/lvim/core/autocmds.lua | 29 | 
1 files changed, 29 insertions, 0 deletions
| diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index f8da317e..a9f7115a 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -119,6 +119,35 @@ function M.load_defaults()          end,        },      }, +    { -- taken from AstroNvim +      "BufEnter", +      { +        group = "_dir_opened", +        once = true, +        callback = function(args) +          local bufname = vim.api.nvim_buf_get_name(args.buf) +          if require("lvim.utils").is_directory(bufname) then +            vim.api.nvim_del_augroup_by_name "_dir_opened" +            vim.cmd "do User DirOpened" +            vim.api.nvim_exec_autocmds("BufEnter", {}) +          end +        end, +      }, +    }, +    { -- taken from AstroNvim +      { "BufRead", "BufWinEnter", "BufNewFile" }, +      { +        group = "_file_opened", +        once = true, +        callback = function(args) +          local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf }) +          if not (vim.fn.expand "%" == "" or buftype == "nofile") then +            vim.cmd "do User FileOpened" +            require("lvim.lsp").setup() +          end +        end, +      }, +    },    }    M.define_autocmds(definitions) | 
