Skip to content

Commit fb22483

Browse files
committed
some configrations hav been changed...
- nvim-cmp will only start on event when enter in insert mode. - nvim-cmdline has set very lazy to work. - packer plugin has been deleted. - packer_compiled file has been deleted. - changed completion and snippets keymaps. - [ USAGE ] - ALT+Up - to scroll docs up. - ALT+Down - to scroll docs down. - CTRL+Space - to show completion menu. - Tab - to jump next snippet point. - ALT+Left - to jump previous snippet point. - Enter - to select the current option in completion menu.
1 parent b2e7003 commit fb22483

File tree

4 files changed

+19
-174
lines changed

4 files changed

+19
-174
lines changed

lazy-lock.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,3 @@
66
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
77
"everforest-nvim": { "branch": "main", "commit": "5e0e32a569fb464911342f0d421721cc1c94cf25" },
88
"friendly-snippets": { "branch": "main", "commit": "d5f74ce4dfdd82848f3f4eac65fe6e29ac5df4c2" },
9-
"lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" },
10-
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
11-
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
12-
"nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" },
13-
"packer.nvim": { "branch": "master", "commit": "ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3" }
14-
}

lua/user/completion.lua

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local cmp = require'cmp'
2+
local luasnip = require("luasnip")
23

34
cmp.setup({
45
snippet = {
@@ -11,11 +12,21 @@ cmp.setup({
1112
documentation = cmp.config.window.bordered(),
1213
},
1314
mapping = cmp.mapping.preset.insert({
14-
['<A-Down>'] = cmp.mapping.scroll_docs(-4),
15-
['<A-Up>'] = cmp.mapping.scroll_docs(4),
16-
['<C-Space>'] = cmp.mapping.complete(),
17-
['<C-a>'] = cmp.mapping.abort(),
18-
['<CR>'] = cmp.mapping.confirm({ select = false }),
15+
['<M-Up>'] = cmp.mapping.scroll_docs(-4),
16+
['<M-Down>'] = cmp.mapping.scroll_docs(4),
17+
['<M-Space>'] = cmp.mapping.complete(),
18+
['<M-c>'] = cmp.mapping.abort(),
19+
['<CR>'] = cmp.mapping.confirm({ select = true }),
20+
["<Tab>"] = cmp.mapping(function(fallback)
21+
if luasnip.jumpable(1) then luasnip.jump(1)
22+
else fallback()
23+
end
24+
end, { "i", "s" }),
25+
["<M-Left>"] = cmp.mapping(function(fallback)
26+
if luasnip.jumpable(-1) then luasnip.jump(-1)
27+
else fallback()
28+
end
29+
end, { "i", "s" }),
1930
}),
2031
sources = cmp.config.sources({
2132
{ name = 'nvim_lsp' },
@@ -50,4 +61,5 @@ cmp.setup.cmdline(':', {
5061
matching = { disallow_symbol_nonprefix_matching = true }
5162
})
5263

64+
-- this loads friendly-snippets as lazy-load.
5365
require('luasnip.loaders.from_vscode').lazy_load()

lua/user/plugins.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ end
66
vim.opt.rtp:prepend(lazypath)
77

88
require("lazy").setup({
9-
-- Plugin for packer starter.
10-
'wbthomason/packer.nvim',
119
-- Plugin for everforest colorscheme.
1210
'OurCodeBase/everforest-nvim',
1311
-- Plugin for lualine for ui.
@@ -20,13 +18,13 @@ require("lazy").setup({
2018
end
2119
},
2220
-- Plugin for nvim-completion.
23-
'hrsh7th/nvim-cmp',
21+
{ 'hrsh7th/nvim-cmp', event = "InsertEnter" },
2422
-- Plugin for buffer completion.
2523
'hrsh7th/cmp-buffer',
2624
-- Plugin for path completion.
2725
'hrsh7th/cmp-path',
2826
-- Plugin for cmdline completion.
29-
'hrsh7th/cmp-cmdline',
27+
{ 'hrsh7th/cmp-cmdline', event = 'VeryLazy' },
3028
-- Plugin for snippets.
3129
'L3MON4D3/LuaSnip',
3230
'saadparwaiz1/cmp_luasnip',

plugin/packer_compiled.lua

Lines changed: 0 additions & 159 deletions
This file was deleted.

0 commit comments

Comments
 (0)