Compare commits
2 Commits
15720ff6b2
...
d293c265b7
Author | SHA1 | Date |
---|---|---|
|
d293c265b7 | |
|
129d5edf66 |
2
init.lua
2
init.lua
|
@ -1,2 +1,4 @@
|
||||||
require ("vanilla")
|
require ("vanilla")
|
||||||
require ("plugin")
|
require ("plugin")
|
||||||
|
require ("snippets")
|
||||||
|
require ("completion")
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
vim.opt.completeopt = { "menu", "menuone", "popup" }
|
||||||
|
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
-- snippet setup configuration
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["UltiSnips#Anon"](args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Window/Menu
|
||||||
|
view = {
|
||||||
|
entries = "custom"
|
||||||
|
},
|
||||||
|
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Add ghost text because it's fancy
|
||||||
|
experimental = {
|
||||||
|
ghost_text = {},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- mapping
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
-- Shift+TAB to go to the Previous Suggested item
|
||||||
|
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||||
|
-- Tab to go to the next suggestion
|
||||||
|
["<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,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- sources
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "ultisnips", keyword_length = 1 },
|
||||||
|
{ name = "calc" },
|
||||||
|
{ name = "lua-latex-symbols", option = { cache = true } },
|
||||||
|
{ name = "buffer", keyword_length = 3 },
|
||||||
|
{ name = "nvim_lsp", keyword_length = 2},
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- formatting
|
||||||
|
formatting = {
|
||||||
|
fields = { "menu", "abbr", "kind" },
|
||||||
|
format = function (entry, item)
|
||||||
|
local menu_icon = {
|
||||||
|
path = "𝦶",
|
||||||
|
ultisnips = "✂",
|
||||||
|
calc = "Σ",
|
||||||
|
lualatexsymbols = "",
|
||||||
|
buffer = "",
|
||||||
|
nvim_lsp = "⌨"
|
||||||
|
}
|
||||||
|
item.menu = menu_icon[entry.source.name]
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline({ "/", "?" }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "fuzzy_path", keyword_length = 4 },
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
fields = { "menu", "abbr", "kind" },
|
||||||
|
format = function(entry, item)
|
||||||
|
local menu_icon = {
|
||||||
|
buffer = "",
|
||||||
|
fuzzy_path = "",
|
||||||
|
}
|
||||||
|
item.menu = menu_icon[entry.source.name]
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
view = {
|
||||||
|
entries = { name = 'wildmenu', separator = "|" }
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "cmdline_history", keyword_length = 24 },
|
||||||
|
}, {
|
||||||
|
{ name = "cmdline", keyword_length = 1 },
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
fields = { "menu", "abbr", "kind" },
|
||||||
|
format = function(entry, item)
|
||||||
|
local menu_icon = {
|
||||||
|
path = "",
|
||||||
|
cmdline = "",
|
||||||
|
cmdline_history = " ",
|
||||||
|
}
|
||||||
|
item.menu = menu_icon[entry.source.name]
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
|
@ -1,4 +1,31 @@
|
||||||
require "paq" {
|
require "paq" {
|
||||||
'savq/paq-nvim',
|
'savq/paq-nvim',
|
||||||
'mhartington/formatter.nvim'
|
|
||||||
|
-- Optics
|
||||||
|
'vim-airline/vim-airline',
|
||||||
|
'vim-airline/vim-airline-themes',
|
||||||
|
'ryanoasis/vim-devicons',
|
||||||
|
'mhinz/vim-startify',
|
||||||
|
|
||||||
|
-- Mason related stuff
|
||||||
|
-- Language server protocol
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
-- Formatter
|
||||||
|
'mhartington/formatter.nvim',
|
||||||
|
|
||||||
|
-- Editing
|
||||||
|
'cohama/lexima.vim',
|
||||||
|
'tpope/vim-surround',
|
||||||
|
'SirVer/UltiSnips',
|
||||||
|
|
||||||
|
-- Behavior
|
||||||
|
'dstein64/vim-startuptime',
|
||||||
|
|
||||||
|
-- Completions
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'hrsh7th/cmp-buffer',
|
||||||
|
'hrsh7th/cmp-path',
|
||||||
|
'hrsh7th/cmp-cmdline',
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
'quangnguyen30192/cmp-nvim-ultisnips'
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ vim.opt.encoding = "UTF-8"
|
||||||
vim.opt.conceallevel = 2
|
vim.opt.conceallevel = 2
|
||||||
vim.g.tex_flavor = "latex"
|
vim.g.tex_flavor = "latex"
|
||||||
vim.opt.showmatch = true
|
vim.opt.showmatch = true
|
||||||
|
vim.opt.colorscheme = "murphy"
|
||||||
|
|
||||||
-- Spell
|
-- Spell
|
||||||
vim.opt.spell = true
|
vim.opt.spell = true
|
||||||
|
|
Loading…
Reference in New Issue