commit da67c3a3a7a8d4e13276d445d621c35ac6f79c2f
parent e1628ad2456c87e4d04ef0377572720fc573b7a5
Author: Tomas Nemec <nemi@skaut.cz>
Date: Tue, 17 Jan 2023 06:15:40 +0100
update
Diffstat:
4 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua
@@ -44,7 +44,7 @@ local cmp = require('cmp')
-- })
-- cmp.register_source('exe', require('tms.p.cmp.exe_source').new())
-local doOrOpen = function(fn, t)
+local function doOrOpen(fn, t)
return function(_)
if cmp.visible() then
fn(t)
@@ -123,7 +123,13 @@ cmp.setup({
})
cmp.setup.cmdline('/', { --
- mapping = cmp.mapping.preset.cmdline(),
+ mapping = {
+ ['<c-e>'] = { c = cmp.mapping.close() },
+ ['<c-y>'] = cmp.mapping.confirm({ select = true }),
+ ['<c-space>'] = cmp.mapping { i = doOrOpen(cmp.confirm, { select = true }) },
+ ['<c-p>'] = cmp.mapping({ c = doOrOpen(cmp.select_prev_item, { behavior = cmp.SelectBehavior.Select }) }),
+ ['<c-n>'] = cmp.mapping({ c = doOrOpen(cmp.select_next_item, { behavior = cmp.SelectBehavior.Select }) }),
+ },
sources = cmp.config.sources({ --
{ name = 'nvim_lsp_document_symbol' },
}, { --
@@ -131,14 +137,19 @@ cmp.setup.cmdline('/', { --
}),
})
--- `:` cmdline setup.
cmp.setup.cmdline(':', {
- mapping = cmp.mapping.preset.cmdline(),
- sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }, { { name = 'cmdline_history' } }),
+ mapping = {
+ ['<c-e>'] = { c = cmp.mapping.close() },
+ ['<c-y>'] = cmp.mapping.confirm({ select = true }),
+ ['<c-space>'] = cmp.mapping { i = doOrOpen(cmp.confirm, { select = true }) },
+ ['<c-p>'] = cmp.mapping({ c = doOrOpen(cmp.select_prev_item, { behavior = cmp.SelectBehavior.Select }) }),
+ ['<c-n>'] = cmp.mapping({ c = doOrOpen(cmp.select_next_item, { behavior = cmp.SelectBehavior.Select }) }),
+ },
+ sources = cmp.config.sources({ --
+ { name = 'path' },
+ }, { --
+ { name = 'cmdline' },
+ }, { --
+ { name = 'cmdline_history' },
+ }),
})
-
--- cmp.setup.cmdline('/', { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } })
--- cmp.setup.cmdline(':', {
--- mapping = cmp.mapping.preset.cmdline(),
--- sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }),
--- })
diff --git a/after/plugin/neoscroll.lua b/after/plugin/neoscroll.lua
@@ -2,7 +2,7 @@ if not pcall(require, 'neoscroll') then
return
end
-require('neoscroll').setup {}
+require('neoscroll').setup { mappings = { '<C-u>', '<C-d>', '<C-b>', '<C-f>', 'zt', 'zz', 'zb' } }
require('neoscroll.config').set_mappings {
['<C-u>'] = { 'scroll', { '-vim.wo.scroll', 'true', '80' } },
['<C-d>'] = { 'scroll', { 'vim.wo.scroll', 'true', '80' } },
diff --git a/ftplugin/go.lua b/ftplugin/go.lua
@@ -3,8 +3,8 @@ vim.bo.makeprg = [[go run %]]
vim.api.nvim_create_autocmd('BufWritePre',
{ callback = require('tms.ft.go').org_imports, buffer = 0, desc = 'GO Organize Imports' })
vim.keymap.set('n', '<leader>ao', require('tms.ft.go').org_imports, { buffer = true, desc = 'Go Organize Imports' })
-vim.keympa.set('n', '<leader>ar', vim.cmd.make, { buffer = true })
-vim.keympa.set('n', '<leader>at', function()
+vim.keymap.set('n', '<leader>ar', vim.cmd.make, { buffer = true })
+vim.keymap.set('n', '<leader>at', function()
local tmp = vim.bo.makeprg
vim.bo.makeprg = 'go test'
vim.cmd.make()
diff --git a/plugin/trun.lua b/plugin/trun.lua
@@ -106,13 +106,15 @@ local function select()
end)
end
--- Make functions globally accessible
-_G.Trun = { complete = trun_list }
-
vim.api.nvim_create_user_command('Trun', function(opts)
if #opts.fargs == 0 then
select()
else
trun_to_qf(opts.fargs[1])
end
-end, { nargs = '?', complete = 'customlist,v:lua.Trun.complete' })
+end, {
+ nargs = '?',
+ complete = function(ArgLead, CmdLine, CursorPos)
+ return trun_list()
+ end,
+})