Skip to content

Commit 9d50661

Browse files
authored
fix: allow to be lazy loaded on InsertEnter (#243)
1 parent 4465e51 commit 9d50661

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/blink/cmp/keymap.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ function keymap.setup(opts)
102102
end
103103

104104
-- handle presets
105-
if type(opts) == 'string' then
106-
mappings = keymap.get_preset_keymap(opts)
107-
end
105+
if type(opts) == 'string' then mappings = keymap.get_preset_keymap(opts) end
108106

109107
-- we set on the buffer directly to avoid buffer-local keymaps (such as from autopairs)
110108
-- from overriding our mappings. We also use InsertEnter to avoid conflicts with keymaps
@@ -115,6 +113,10 @@ function keymap.setup(opts)
115113
keymap.apply_keymap_to_current_buffer(mappings)
116114
end,
117115
})
116+
117+
if vim.api.nvim_get_mode().mode == 'i' and not utils.is_blocked_buffer() then
118+
keymap.apply_keymap_to_current_buffer(mappings)
119+
end
118120
end
119121

120122
--- Gets the preset keymap for the given preset name

0 commit comments

Comments
 (0)