Switch to blink.cmp for completion
This commit is contained in:
parent
aaaa3bdf85
commit
dce9687cb0
1 changed files with 133 additions and 139 deletions
272
init.lua
272
init.lua
|
@ -16,6 +16,8 @@ o.guifont = 'IosevkaTermSlab Nerd Font,IosevkaTerm Nerd Font,Iosevka Term Slab,I
|
||||||
g.neovide_floating_z_height = 1
|
g.neovide_floating_z_height = 1
|
||||||
g.neovide_confirm_quit = true -- Confirm closing neovide window when changes are unsaved
|
g.neovide_confirm_quit = true -- Confirm closing neovide window when changes are unsaved
|
||||||
g.neovide_cursor_smooth_blink = true
|
g.neovide_cursor_smooth_blink = true
|
||||||
|
g.neovide_text_gamma = 0.8
|
||||||
|
g.neovide_text_contrast = 0.1
|
||||||
if fn.hostname() == 'tappy' then
|
if fn.hostname() == 'tappy' then
|
||||||
g.neovide_refresh_rate = 144
|
g.neovide_refresh_rate = 144
|
||||||
end
|
end
|
||||||
|
@ -134,6 +136,10 @@ local function zoom_out()
|
||||||
zoom(-1)
|
zoom(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not workman then
|
||||||
|
vim.keymap.set('n', 'j', 'gj')
|
||||||
|
vim.keymap.set('n', 'k', 'gk')
|
||||||
|
end
|
||||||
vim.keymap.set('n', '<C-w>!', '<Cmd>copen<CR>', { desc = 'Quickfix window' })
|
vim.keymap.set('n', '<C-w>!', '<Cmd>copen<CR>', { desc = 'Quickfix window' })
|
||||||
vim.keymap.set('n', '<F2>', '<Cmd>set number! relativenumber!<CR>', { desc = 'Toggle relative numbers' })
|
vim.keymap.set('n', '<F2>', '<Cmd>set number! relativenumber!<CR>', { desc = 'Toggle relative numbers' })
|
||||||
vim.keymap.set('n', '<F3>', '<Cmd>set number!<CR>', { desc = 'Toggle line numbers' })
|
vim.keymap.set('n', '<F3>', '<Cmd>set number!<CR>', { desc = 'Toggle line numbers' })
|
||||||
|
@ -189,8 +195,8 @@ vim.keymap.set('n', '<Leader>es', vim.diagnostic.show, { desc = 'Show diagnostic
|
||||||
vim.keymap.set('n', '<Leader>eC', vim.diagnostic.reset, { desc = 'Clear diagnostics' })
|
vim.keymap.set('n', '<Leader>eC', vim.diagnostic.reset, { desc = 'Clear diagnostics' })
|
||||||
|
|
||||||
if vim.g.neovide then
|
if vim.g.neovide then
|
||||||
vim.keymap.set('l', '<C-v>', '<C-r>+', { desc = 'Paste' })
|
vim.keymap.set({'i', 'c'}, '<C-v>', '<C-r>+', { desc = 'Paste' })
|
||||||
vim.keymap.set('l', '<C-S-v>', '<C-r>+', { desc = 'Paste' })
|
vim.keymap.set({'i', 'c'}, '<C-S-v>', '<C-r>+', { desc = 'Paste' })
|
||||||
vim.keymap.set('t', '<C-S-v>', '<C-\\><C-n>pi', { desc = 'Paste' })
|
vim.keymap.set('t', '<C-S-v>', '<C-\\><C-n>pi', { desc = 'Paste' })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -304,21 +310,21 @@ require('lazy').setup({
|
||||||
'rhysd/vim-crystal',
|
'rhysd/vim-crystal',
|
||||||
'bakpakin/fennel.vim',
|
'bakpakin/fennel.vim',
|
||||||
'mboughaba/i3config.vim',
|
'mboughaba/i3config.vim',
|
||||||
{'OXY2DEV/markview.nvim', lazy = false, opts = { initial_state = false }},
|
{'OXY2DEV/markview.nvim', lazy = false, opts = { preview = { enable = false } }},
|
||||||
'mracos/mermaid.vim',
|
'mracos/mermaid.vim',
|
||||||
'lifepillar/pgsql.vim',
|
'lifepillar/pgsql.vim',
|
||||||
|
'digitaltoad/vim-pug',
|
||||||
'ajouellette/sway-vim-syntax',
|
'ajouellette/sway-vim-syntax',
|
||||||
'cespare/vim-toml',
|
|
||||||
'mfussenegger/nvim-ansible',
|
'mfussenegger/nvim-ansible',
|
||||||
|
|
||||||
-- Editing
|
-- Editing
|
||||||
{'LunarWatcher/auto-pairs', init = function()
|
{'altermo/ultimate-autopair.nvim', branch = 'v0.6', opts = {
|
||||||
vim.g.AutoPairsMultilineClose = 0
|
-- Settings for moving delimiter after cursor/Alt-E mapping
|
||||||
vim.g.AutoPairsMapBS = 1
|
fastwarp = {
|
||||||
vim.g.AutoPairsMapCR = 1
|
-- Don't make the cursor stay in place
|
||||||
vim.g.AutoPairsCompatibleMaps = 1
|
nocursormove = false,
|
||||||
vim.g.AutoPairsShortcutToggleMultilineClose = ''
|
}
|
||||||
end},
|
}},
|
||||||
'ojroques/nvim-bufdel',
|
'ojroques/nvim-bufdel',
|
||||||
{'stevearc/conform.nvim', config = function ()
|
{'stevearc/conform.nvim', config = function ()
|
||||||
require'conform'.setup {
|
require'conform'.setup {
|
||||||
|
@ -390,10 +396,10 @@ require('lazy').setup({
|
||||||
'hrsh7th/vim-vsnip',
|
'hrsh7th/vim-vsnip',
|
||||||
|
|
||||||
-- LSP --
|
-- LSP --
|
||||||
{'neovim/nvim-lspconfig', dependencies = {'hrsh7th/cmp-nvim-lsp', 'williamboman/mason-lspconfig.nvim'}, config = function()
|
{'neovim/nvim-lspconfig', dependencies = {'saghen/blink.cmp', 'williamboman/mason-lspconfig.nvim'}, config = function()
|
||||||
local lspconfig = require'lspconfig'
|
local lspconfig = require'lspconfig'
|
||||||
-- Tweak the advertized LSP client capabilities
|
-- Extend the LSP client capabilities advertized to servers
|
||||||
local capabilities = require'cmp_nvim_lsp'.default_capabilities()
|
local capabilities = require'blink.cmp'.get_lsp_capabilities()
|
||||||
-- Set options for nvim-ufo
|
-- Set options for nvim-ufo
|
||||||
capabilities.textDocument.foldingRange = {
|
capabilities.textDocument.foldingRange = {
|
||||||
dynamicRegistration = false,
|
dynamicRegistration = false,
|
||||||
|
@ -406,7 +412,17 @@ require('lazy').setup({
|
||||||
lspconfig.ansiblels.setup {}
|
lspconfig.ansiblels.setup {}
|
||||||
lspconfig.bashls.setup {}
|
lspconfig.bashls.setup {}
|
||||||
lspconfig.clangd.setup {}
|
lspconfig.clangd.setup {}
|
||||||
lspconfig.eslint.setup { autostart = false }
|
lspconfig.cssls.setup {}
|
||||||
|
lspconfig.eslint.setup {
|
||||||
|
settings = {
|
||||||
|
rulesCustomizations = {
|
||||||
|
{ rule = '*no-shadow*', severity = 'off' },
|
||||||
|
{ rule = '*no-unused-vars', severity = 'off' }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
lspconfig.html.setup {}
|
||||||
|
lspconfig.jsonls.setup {}
|
||||||
lspconfig.lemminx.setup {}
|
lspconfig.lemminx.setup {}
|
||||||
lspconfig.lua_ls.setup {
|
lspconfig.lua_ls.setup {
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -428,119 +444,90 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lspconfig.nil_ls.setup {}
|
lspconfig.nil_ls.setup {}
|
||||||
lspconfig.basedpyright.setup {}
|
--lspconfig.basedpyright.setup {}
|
||||||
|
lspconfig.pyright.setup {}
|
||||||
lspconfig.vimls.setup {}
|
lspconfig.vimls.setup {}
|
||||||
|
lspconfig.yamlls.setup {}
|
||||||
|
end},
|
||||||
|
{'Saghen/blink.cmp', dependencies = {'altermo/ultimate-autopair.nvim', 'rcarriga/cmp-dap'}, lazy = false, build = 'cargo build --release', opts_extend = {'sources.default'}, opts = {
|
||||||
|
keymap = {
|
||||||
|
-- Tab to select completion, enter to accept
|
||||||
|
preset = 'enter',
|
||||||
|
['<Tab>'] = {'select_next', 'snippet_forward', 'fallback'},
|
||||||
|
['<S-Tab>'] = {'select_prev', 'snippet_backward', 'fallback'},
|
||||||
|
['<C-s>'] = {'show_signature', 'hide_signature', 'fallback'},
|
||||||
|
},
|
||||||
|
|
||||||
-- TODO decide what to do with autocmd
|
enabled = function()
|
||||||
end},
|
return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt"
|
||||||
{'hrsh7th/nvim-cmp', dependencies = {
|
or require("cmp_dap").is_dap_buffer()
|
||||||
'rcarriga/cmp-dap',
|
end,
|
||||||
'hrsh7th/cmp-nvim-lua',
|
appearance = {
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
-- Use nvim-cmp highlight groups as fallback for plugins without direct support for blink.cmp
|
||||||
'hrsh7th/cmp-buffer',
|
use_nvim_cmp_as_default = true,
|
||||||
'hrsh7th/cmp-path',
|
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
'hrsh7th/cmp-cmdline',
|
-- Adjusts spacing to ensure icons are aligned
|
||||||
'dcampos/nvim-snippy',
|
nerd_font_variant = 'normal',
|
||||||
'dcampos/cmp-snippy',
|
},
|
||||||
'LunarWatcher/auto-pairs'
|
|
||||||
}, config = function()
|
cmdline = {
|
||||||
local cmp = require'cmp'
|
completion = {
|
||||||
local cmp_dap = require'cmp_dap'
|
list = {
|
||||||
local snippy = require'snippy'
|
selection = { preselect = false, auto_insert = true }
|
||||||
vim.opt.completeopt:append({'menuone', 'noinsert', 'noselect'})
|
},
|
||||||
local has_words_before = function()
|
menu = {
|
||||||
unpack = unpack or table.unpack
|
auto_show = true
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
},
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
cmp.setup {
|
|
||||||
enabled = function()
|
|
||||||
return vim.bo.buftype ~= 'prompt' or cmp_dap.is_dap_buffer()
|
|
||||||
end,
|
|
||||||
preselect = cmp.PreselectMode.None,
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require('snippy').expand_snippet(args.body)
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert {
|
},
|
||||||
-- Next item, or expand or jump snippet, or fallback
|
completion = {
|
||||||
['<Tab>'] = cmp.mapping(
|
list = {
|
||||||
function(fallback)
|
-- Don't automatically select the first completion item
|
||||||
if cmp.visible() then
|
selection = { preselect = false, auto_insert = true }
|
||||||
cmp.select_next_item()
|
|
||||||
elseif snippy.can_expand_or_advance() then
|
|
||||||
snippy.expand_or_advance()
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
{'i', 's'}
|
|
||||||
),
|
|
||||||
-- Prev item, or jump snippet back, or fallback
|
|
||||||
['<S-Tab>'] = cmp.mapping(
|
|
||||||
function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif snippy.can_jump(-1) then
|
|
||||||
snippy.previous()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
{'i', 's'}
|
|
||||||
),
|
|
||||||
-- Scroll documentation up
|
|
||||||
['<C-e>'] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}),
|
|
||||||
-- Scroll documentation down
|
|
||||||
['<C-y>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}),
|
|
||||||
-- Complete common substring
|
|
||||||
['<C-l>'] = cmp.mapping(cmp.mapping.complete_common_string(), {'i', 'c'}),
|
|
||||||
-- Complete
|
|
||||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete {}, {'i', 'c'}),
|
|
||||||
-- Confirm
|
|
||||||
['<CR>'] = cmp.mapping(cmp.mapping.confirm { select = false }, {'i', 'c'}),
|
|
||||||
},
|
},
|
||||||
sources = {
|
|
||||||
{ name = 'path' },
|
accept = {
|
||||||
{ name = 'nvim_lsp' },
|
-- Disable experimental automatic bracket insertion
|
||||||
{ name = 'nvim_lua' },
|
auto_brackets = { enabled = false }
|
||||||
{ name = 'snippy' },
|
|
||||||
},
|
},
|
||||||
-- Experimental features
|
|
||||||
experimental = {
|
documentation = {
|
||||||
-- Show completion result as virtual text
|
-- Show documentation in the completion menu automatically
|
||||||
ghost_text = true,
|
auto_show = true,
|
||||||
},
|
},
|
||||||
}
|
|
||||||
cmp.setup.cmdline(':', {
|
-- Show virtual text of completion result after cursor
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
ghost_text = { enabled = true },
|
||||||
sources = cmp.config.sources({
|
},
|
||||||
{ name = 'path' }
|
|
||||||
|
-- Experimental function signature help
|
||||||
|
signature = {
|
||||||
|
enabled = true,
|
||||||
|
window = {
|
||||||
|
-- Prefer showing signature help below cursor
|
||||||
|
direction_priority = {'s', 'n'},
|
||||||
|
-- Don't show documentation by default
|
||||||
|
show_documentation = false,
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
{
|
|
||||||
name = 'cmdline',
|
-- Default list of sources
|
||||||
option = {
|
sources = {
|
||||||
ignore_cmds = { 'Man', '!' }
|
default = {'lsp', 'path', 'snippets'},
|
||||||
}
|
per_filetype = {
|
||||||
}
|
['dap-repl'] = {'dap'},
|
||||||
}),
|
dapui_watches = {'dap'},
|
||||||
})
|
dapui_hover = {'dap'},
|
||||||
cmp.setup.cmdline({'/', '?'}, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' }
|
|
||||||
},
|
},
|
||||||
})
|
providers = {
|
||||||
cmp.setup.filetype({'dap-repl', 'dapui_watches', 'dapui_hover'}, {
|
dap = {
|
||||||
sources = {
|
name = 'dap',
|
||||||
{ name = 'dap' },
|
module = 'blink.compat.source',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
end},
|
}},
|
||||||
|
{'Saghen/blink.compat', lazy = true, opts = {}},
|
||||||
{'mfussenegger/nvim-jdtls', dependencies = {'neovim/nvim-lspconfig'}, config = function()
|
{'mfussenegger/nvim-jdtls', dependencies = {'neovim/nvim-lspconfig'}, config = function()
|
||||||
au('FileType', {
|
au('FileType', {
|
||||||
pattern = 'java',
|
pattern = 'java',
|
||||||
|
@ -562,6 +549,8 @@ require('lazy').setup({
|
||||||
'--jvm-arg=-Dlog.protocol=true',
|
'--jvm-arg=-Dlog.protocol=true',
|
||||||
-- Enable lombok
|
-- Enable lombok
|
||||||
'--jvm-arg=-javaagent:' .. mason_path('jdtls') .. '/lombok.jar',
|
'--jvm-arg=-javaagent:' .. mason_path('jdtls') .. '/lombok.jar',
|
||||||
|
-- Shut the warning up
|
||||||
|
'--jvm-arg=-XX:+EnableDynamicAgentLoading',
|
||||||
-- store workpace data in ~/.local/share/eclipse/<project-name>
|
-- store workpace data in ~/.local/share/eclipse/<project-name>
|
||||||
'-data', vim.fn.expand('~/.local/share/eclipse/') .. vim.fn.fnamemodify(root_dir, ':p:h:t')
|
'-data', vim.fn.expand('~/.local/share/eclipse/') .. vim.fn.fnamemodify(root_dir, ':p:h:t')
|
||||||
},
|
},
|
||||||
|
@ -650,8 +639,14 @@ require('lazy').setup({
|
||||||
}},
|
}},
|
||||||
{'pmizio/typescript-tools.nvim', opts = {
|
{'pmizio/typescript-tools.nvim', opts = {
|
||||||
settings = {
|
settings = {
|
||||||
tsserve_file_preferences = {
|
tsserver_file_preferences = {
|
||||||
quotePreference = 'single'
|
quotePreference = 'single',
|
||||||
|
semicolons = 'remove',
|
||||||
|
convertTabsToSpaces = false,
|
||||||
|
},
|
||||||
|
tsserver_format_options = {
|
||||||
|
semicolons = 'remove',
|
||||||
|
convertTabsToSpaces = false,
|
||||||
},
|
},
|
||||||
tsserver_plugins = (function ()
|
tsserver_plugins = (function ()
|
||||||
if fn.has('nvim-0.10') == 0 then return end
|
if fn.has('nvim-0.10') == 0 then return end
|
||||||
|
@ -771,14 +766,6 @@ require('lazy').setup({
|
||||||
vim.g.db_ui_auto_execute_table_helpers = 1
|
vim.g.db_ui_auto_execute_table_helpers = 1
|
||||||
vim.g.db_ui_win_position = 'right'
|
vim.g.db_ui_win_position = 'right'
|
||||||
vim.o.previewheight = 40
|
vim.o.previewheight = 40
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = 'luarc',
|
|
||||||
pattern = {'sql','mysql','plsql'},
|
|
||||||
callback = function()
|
|
||||||
require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} })
|
|
||||||
end,
|
|
||||||
desc = 'SQL dadbod completion',
|
|
||||||
})
|
|
||||||
end},
|
end},
|
||||||
{'mfussenegger/nvim-dap', dependencies = {'folke/which-key.nvim'}, config = function()
|
{'mfussenegger/nvim-dap', dependencies = {'folke/which-key.nvim'}, config = function()
|
||||||
local dap = require'dap'
|
local dap = require'dap'
|
||||||
|
@ -917,12 +904,6 @@ require('lazy').setup({
|
||||||
dap.listeners.after.event_initialized.dapui_config = function()
|
dap.listeners.after.event_initialized.dapui_config = function()
|
||||||
dapui.open {}
|
dapui.open {}
|
||||||
end
|
end
|
||||||
dap.listeners.before.event_terminated.dapui_config = function()
|
|
||||||
dapui.close {}
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_exited.dapui_config = function()
|
|
||||||
dapui.close {}
|
|
||||||
end
|
|
||||||
require'which-key'.register {
|
require'which-key'.register {
|
||||||
['<Leader>dd'] = {dapui.toggle, 'Toggle'}
|
['<Leader>dd'] = {dapui.toggle, 'Toggle'}
|
||||||
}
|
}
|
||||||
|
@ -949,7 +930,10 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
file_panel = {
|
file_panel = {
|
||||||
["gq"] = "<CMD>DiffviewClose<CR>",
|
["gq"] = "<CMD>DiffviewClose<CR>",
|
||||||
}
|
},
|
||||||
|
file_history_panel = {
|
||||||
|
["gq"] = "<CMD>DiffviewClose<CR>",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
{'stevearc/dressing.nvim', opts = {
|
{'stevearc/dressing.nvim', opts = {
|
||||||
|
@ -993,7 +977,7 @@ require('lazy').setup({
|
||||||
}, build = function()
|
}, build = function()
|
||||||
require'gitlab.server'.build(true)
|
require'gitlab.server'.build(true)
|
||||||
end, opts = {
|
end, opts = {
|
||||||
attachment_dir = vim.fn.expand('~/Downloads/'),
|
attachment_dir = vim.fn.expand('~/Desktop/'),
|
||||||
keymaps = {
|
keymaps = {
|
||||||
global = {
|
global = {
|
||||||
disable_all = true,
|
disable_all = true,
|
||||||
|
@ -1108,7 +1092,17 @@ require('lazy').setup({
|
||||||
vim.notify = require'notify'
|
vim.notify = require'notify'
|
||||||
require'telescope'.load_extension('notify')
|
require'telescope'.load_extension('notify')
|
||||||
end},
|
end},
|
||||||
{'stevearc/overseer.nvim', dependencies = {'folke/which-key.nvim'}, config = function(plugin, opts)
|
{'stevearc/overseer.nvim', dependencies = {'folke/which-key.nvim'}, opts = {
|
||||||
|
task_list = {
|
||||||
|
bindings = {
|
||||||
|
['x'] = 'Stop',
|
||||||
|
['dd'] = 'Dispose',
|
||||||
|
['r'] = '<Cmd>OverseerQuickAction restart<CR>',
|
||||||
|
['<C-l>'] = false,
|
||||||
|
['<C-h>'] = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, config = function(plugin, opts)
|
||||||
require'overseer'.setup(opts)
|
require'overseer'.setup(opts)
|
||||||
require'which-key'.register {
|
require'which-key'.register {
|
||||||
['<Leader>r'] = {
|
['<Leader>r'] = {
|
||||||
|
@ -1147,7 +1141,7 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
end},
|
end},
|
||||||
{'nvim-telescope/telescope.nvim', dependencies = {
|
{'nvim-telescope/telescope.nvim', dependencies = {
|
||||||
'LunarWatcher/auto-pairs',
|
'altermo/ultimate-autopair.nvim',
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
'nvim-telescope/telescope-file-browser.nvim',
|
'nvim-telescope/telescope-file-browser.nvim',
|
||||||
'nvim-telescope/telescope-project.nvim',
|
'nvim-telescope/telescope-project.nvim',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue