Compare commits

...

1 Commits

Author SHA1 Message Date
Yannick Reiß f745054bbf
Code completion with easycomplete 2024-02-20 08:02:09 +01:00
3 changed files with 61 additions and 110 deletions

38
lazy-lock.json Normal file
View File

@ -0,0 +1,38 @@
{
"UltiSnips": { "branch": "master", "commit": "b393ba65386d47664421e1f8b246a87a6e8b218c" },
"barbar.nvim": { "branch": "master", "commit": "71ac376acd000743146b1e08e62151b4d887bbac" },
"bufstop": { "branch": "master", "commit": "e453ed3f03d53df9e8ba69225fbe523cf44b1b13" },
"cyberspace.vim": { "branch": "master", "commit": "8d002ef6a449f08025d75249078ecae75a136a2d" },
"formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" },
"fuzzy.nvim": { "branch": "master", "commit": "67a42ad2fa6d5ff41f0ef3cf69bb247410da5d7a" },
"git-blame.nvim": { "branch": "master", "commit": "196602b570b1d754b7b8f9a9f75fa7bd88f12ef8" },
"indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
"lexima.vim": { "branch": "master", "commit": "5513d686801993b40c55baa65602f79cd3cf3c77" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "fe4cce44dec93c69be17dad79b21de867dde118a" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"nerdtree": { "branch": "master", "commit": "bdf81a086dd271571104a11f555b79e5cdff5dc5" },
"nerdtree-git-plugin": { "branch": "master", "commit": "e1fe727127a813095854a5b063c15e955a77eafb" },
"nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" },
"nvim-doxyscan": { "branch": "master", "commit": "2c266fdb9395d6afa5d7188f8212fd7757193990" },
"nvim-lspconfig": { "branch": "master", "commit": "1699ce10c3aaf861cfa0c1303fcd19d2ed93e7ad" },
"nvim-sourcer": { "branch": "main", "commit": "a2f6bc737a63a208d39fcc5c211076ea5aa9f390" },
"nvim-treesitter": { "branch": "master", "commit": "917d696592a34917a12208f579d5e72c1a904aee" },
"nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" },
"nvim-web-devicons": { "branch": "master", "commit": "14ac5887110b06b89a96881d534230dac3ed134d" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope-ultisnips.nvim": { "branch": "main", "commit": "d1cca4b5aa809a90b7a8caddeb860329d5a8c2ff" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" },
"vim-airline": { "branch": "master", "commit": "d9f42cb46710e31962a9609939ddfeb0685dd779" },
"vim-airline-themes": { "branch": "master", "commit": "a9aa25ce323b2dd04a52706f4d1b044f4feb7617" },
"vim-devicons": { "branch": "master", "commit": "71f239af28b7214eebb60d4ea5bd040291fb7e33" },
"vim-easycomplete": { "branch": "master", "commit": "dcad32ab5e935bf3042208803c09f5fc8b25adc5" },
"vim-monokai-tasty": { "branch": "master", "commit": "57c67feac63158a232c43aee2f463a994029b699" },
"vim-speeddating": { "branch": "master", "commit": "5a36fd29df63ea3f65562bd2bb837be48a5ec90b" },
"vim-startify": { "branch": "master", "commit": "4e089dffdad46f3f5593f34362d530e8fe823dcf" },
"vim-startuptime": { "branch": "master", "commit": "308b0088a864c4711a96e45b6734cf9294074f65" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-visual-multi": { "branch": "master", "commit": "cff14071098de5279743b009c496303995fe4df9" }
}

View File

@ -4,103 +4,29 @@
-- preview: show more details -- preview: show more details
vim.opt.completeopt = { "menu", "menuone" } vim.opt.completeopt = { "menu", "menuone" }
-- shortmess is used to reduce verbocity vim.g.easycomplete_cursor_word_hl = 1
-- vim.opt.shortmess = vim.opt.shortmess + { c = true } vim.g.easycomplete_nerd_font = 1
local cmp = require("cmp")
cmp.setup({
-- configuration
snippet = {
expand = function(args)
vim.fn["UltiSnips#Anon"](args.body)
end,
},
-- Add borders to the windows -- Bind reference and navigation options (using f as primary)
-- window = { vim.keymap.set("n", "fr", ":EasyCompleteReference<CR>")
-- completion = cmp.config.window.bordered(), vim.keymap.set("n", "fd", ":EasyCompleteGotoDefinition<CR>")
-- documentation = cmp.config.window.bordered(), vim.keymap.set("n", "fn", ":EasyCompleteRename<CR>")
-- }, vim.keymap.set("n", "fb", ":BackToOriginalBuffer<CR>")
-- mapping vim.g.easycomplete_pum_format = { "kind", "abbr", "menu" }
mapping = cmp.mapping.preset.insert({ vim.cmd([[
-- Shift+TAB to go to the Previous Suggested item hi EasyFuzzyMatch guifg=lightblue
["<C-k>"] = cmp.mapping.select_prev_item(), ]])
-- Tab to go to the next suggestion vim.g.easycomplete_directory_enable = 1
["<C-j>"] = cmp.mapping.select_next_item(),
-- CTRL+SHIFT+f to scroll backwards in description
["<C-S-f>"] = cmp.mapping.scroll_docs(-4),
-- CTRL+F to scroll forwards in the description
["<C-f>"] = cmp.mapping.scroll_docs(4),
-- CTRL+SPACE to bring up completion at current Cursor location
["<C-Space>"] = cmp.mapping.complete(),
-- CTRL+e to exit suggestion and close it
["<C-d>"] = cmp.mapping.close(), -- TODO: Search better option
-- CR (enter or return) to CONFIRM the currently selection suggestion
-- We set the ConfirmBehavior to insert the Selected suggestion
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
}),
-- installed sources for code suggestion vim.g.easycomplete_tab_trigger = "<c-j>"
sources = cmp.config.sources({ vim.g.easycomplete_shift_tab_trigger = "<c-k>"
{ name = "ultisnips", keyword_length = 1 },
{ name = "path" },
{ name = "nvim_lsp", keyword_length = 2 },
{ name = "nvim_lsp_signature_help" },
{ name = "nvim_lua", keyword_length = 4 },
{ name = "buffer", keyword_length = 3 },
{ name = "calc" },
{ name = "lua-latex-symbols", option = { cache = true } },
-- { name = "spell", option = { keep_all_entries = false }, keyword_length = 2 },
-- { name = "fuzzy_buffer", keyword_length = 2 }, -- Throwing unknown errors
}),
-- add formatting of the different sources -- Diagnostics
formatting = { vim.g.easycomplete_diagnostics_next = "<c-n>"
fields = { "menu", "abbr", "kind" }, vim.g.easycomplete_diagnostics_prev = "<c-p>"
format = function(entry, item) vim.g.easycomplete_signature_offset = 0
local menu_icon = { vim.g.easycomplete_diagnostics_enable = 1
nvim_lsp = "λ", vim.g.easycomplete_signature_enable = 1
ultisnips = "", vim.g.easycomplete_diagnostics_hover = 1
path = "🌐", vim.g.easycomplete_lsp_checking = 0 -- suppress warning on startup, must run LSPInstall manually
calc = "Σ",
buffer = "📚",
lualatexsymbols = "𝕋",
spell = "📚",
fuzzy_buffer = "📄",
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
})
-- Set configuration for specific filetype.
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = "buffer" },
}),
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
{ name = "cmdline_history", keyword_length = 15 },
}, {
{ name = "cmdline" },
}),
})

View File

@ -39,18 +39,6 @@ return {
"mhinz/vim-startify", "mhinz/vim-startify",
"folke/tokyonight.nvim", "folke/tokyonight.nvim",
"patstockwell/vim-monokai-tasty", "patstockwell/vim-monokai-tasty",
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-cmdline",
"dmitmel/cmp-cmdline-history",
"amarakon/nvim-cmp-lua-latex-symbols",
"f3fora/cmp-spell",
{ "petertriho/cmp-git", requires = "nvim-lua/plenary.nvim" },
"williamboman/mason.nvim", "williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
@ -59,8 +47,7 @@ return {
"mg979/vim-visual-multi", "mg979/vim-visual-multi",
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }, { "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
{ "tzachar/fuzzy.nvim", requires = { "nvim-telescope/telescope-fzf-native.nvim" } }, { "tzachar/fuzzy.nvim", requires = { "nvim-telescope/telescope-fzf-native.nvim" } },
{ "tzachar/cmp-fuzzy-buffer", requires = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" } },
"quangnguyen30192/cmp-nvim-ultisnips",
"mihaifm/bufstop", "mihaifm/bufstop",
"https://git.nickr.eu/yannickreiss/nvim-sourcer.git", "https://git.nickr.eu/yannickreiss/nvim-sourcer.git",
"jayli/vim-easycomplete",
} }