mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 19:30:01 +02:00
nvim
This commit is contained in:
parent
35c3cc49d5
commit
08bf9aad64
14 changed files with 264 additions and 110 deletions
|
|
@ -17,4 +17,14 @@ function M.CloseAll()
|
|||
end
|
||||
end
|
||||
|
||||
function M.GetLoaded()
|
||||
local loaded = {}
|
||||
for i, hnd in ipairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.api.nvim_buf_is_loaded(hnd) then
|
||||
loaded[i] = hnd
|
||||
end
|
||||
end
|
||||
return loaded
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -1,45 +1,44 @@
|
|||
|
||||
local luasnip = require('luasnip')
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.selectNext(opts)
|
||||
return cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item(opts or {})
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"})
|
||||
return cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item(opts or {})
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" })
|
||||
end
|
||||
|
||||
function M.selectPrev(opts)
|
||||
return cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item(opts or {})
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"})
|
||||
return cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item(opts or {})
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" })
|
||||
end
|
||||
|
||||
function M.confirm(opts)
|
||||
return cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
if luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
cmp.confirm(opts or {})
|
||||
end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end)
|
||||
return cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
-- if luasnip.expand_or_jumpable() then
|
||||
-- luasnip.expand_or_jump()
|
||||
-- else
|
||||
cmp.confirm(opts or {})
|
||||
-- end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -19,4 +19,14 @@ function M.document_highlight(bufnr)
|
|||
})
|
||||
end
|
||||
|
||||
function M.signature_help_on_hover(bufnr)
|
||||
local group = vim.api.nvim_create_augroup('lsp_hover', { clear = false })
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
group = group,
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.hover,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue