i dont know|
This commit is contained in:
parent
4f7e6068f3
commit
86bc70fb4a
3 changed files with 42 additions and 5 deletions
43
lua/init.lua
43
lua/init.lua
|
@ -21,7 +21,8 @@ vim.opt.termguicolors = true
|
|||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
pl = 'prolog'
|
||||
pl = 'prolog',
|
||||
slint = 'slint'
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -46,6 +47,7 @@ vim.api.nvim_set_keymap("", "<UP>", "<NOP>", {})
|
|||
vim.api.nvim_set_keymap("", "<DOWn>", "<NOP>", {})
|
||||
vim.api.nvim_set_keymap("", "<LEFT>", "<NOP>", {})
|
||||
vim.api.nvim_set_keymap("", "<RIGHT>", "<NOP>", {})
|
||||
vim.lsp.inlay_hint.enable()
|
||||
|
||||
require('goto-preview').setup {
|
||||
width = 120, -- Width of the floating window
|
||||
|
@ -94,6 +96,9 @@ cmp.setup({
|
|||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered()
|
||||
},
|
||||
experimental = {
|
||||
-- ghost_text = true
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
|
@ -101,19 +106,25 @@ cmp.setup({
|
|||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<TAB>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm({ behaviour = cmp.ConfirmBehavior.Insert, select = true })
|
||||
cmp.confirm({ behaviour = cmp.ConfirmBehavior.Replace, select = true })
|
||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" })
|
||||
end, { "i", "s" }),
|
||||
['<S-TAB>'] = cmp.mapping(function(fallback)
|
||||
if vim.fn["vsnip#available"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||
end
|
||||
end, { "i", "s" })
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" },
|
||||
{ name = "path" }
|
||||
}, {
|
||||
{ name = "buffer" }
|
||||
{ name = "file" }
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -126,6 +137,21 @@ require("mason-lspconfig").setup_handlers {
|
|||
require("lspconfig")[server_name].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
end,
|
||||
|
||||
["clangd"] = function()
|
||||
require("lspconfig").clangd.setup {
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
completionItem = {
|
||||
snippetSupport = true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
filetyped = { "c", "cpp", "cc", "h", "hpp", "hh" }
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
|
@ -236,6 +262,15 @@ vim.api.nvim_create_autocmd("TermClose", {
|
|||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = buffer,
|
||||
callback = function()
|
||||
if vim.bo.filetype == "go" then
|
||||
vim.lsp.buf.format { async = false }
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
require("ibl").setup()
|
||||
|
||||
vim.g.barbar_auto_setup = false
|
||||
|
|
|
@ -20,11 +20,12 @@ map("n", "<leader>s", ":Telescope live_grep glob_pattern=*.{ts,html,c,cc,cpp,h,g
|
|||
map("n", "<leader>sc", ":noh<CR>")
|
||||
|
||||
-- map("n", "gs", ":call CocAction('jumpDefinition', 'split')<CR>")
|
||||
-- map("n", "gt", ":CocCommand clangd.switchSourceHeader<CR>")
|
||||
map("n", "gt", ":ClangdSwitchSourceHeader<CR>")
|
||||
--
|
||||
map("n", "p<C-]>", "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", {noremap=true})
|
||||
map("n", "q<C-]>", "<cmd>lua require('goto-preview').close_all_win()<CR>", {noremap=true})
|
||||
map("n", "r<C-]>", "<cmd>lua require('goto-preview').goto_preview_references()<CR>", {noremap=true})
|
||||
map("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", {noremap=true})
|
||||
|
||||
map("n", "<leader>1", "1gt")
|
||||
map("n", "<leader>2", "2gt")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue