Browse Source

Update autocomplete and autocomplete bindings

master
Taylor Bockman 1 year ago
parent
commit
562ccea4af
  1. 3
      README.md
  2. 22
      lua/conf/keybinds.lua
  3. 5
      lua/conf/ui.lua

3
README.md

@ -102,6 +102,9 @@ To move seamlessly between splits.
Autocompletion is provided by [asyncomplete.vim](https://github.com/prabirshrestha/asyncomplete.vim). Additionally
LSP-based autocompletion is installed.
Automatic popups are disabled. In order to see suggestions begin typing and then hit `<C-Space>` in insert mode.
Once in the popup you can use `<Tab>` and `<S-Tab>` to go up and down the suggestions.
### Default Leader
The default leader is the space key.

22
lua/conf/keybinds.lua

@ -22,6 +22,27 @@ vim.api.nvim_set_keymap('n', '<Leader>r', '<cmd>lua NumberToggle()<CR>', keymap_
-- the next search.
vim.api.nvim_set_keymap('n', '<CR>', ':noh<CR><CR>', keymap_opts)
-- Autocomplete bindings
vim.keymap.set('i', '<Tab>', function()
if vim.fn.pumvisible() == 1 then return '<C-n>' end
return '<Tab>'
end, {expr = true})
vim.keymap.set('i', '<S-Tab>', function()
if vim.fn.pumvisible() == 1 then return '<C-p>' end
return '<S-Tab>'
end, {expr = true})
vim.keymap.set('i', '<CR>', function()
if vim.fn.pumvisible() == 1 then
vim.cmd [[ asyncomplete#close_popup() . "\<CR>" ]]
else
return '<CR>'
end
end, {expr = true})
vim.keymap.set('i', '<C-Space>', '<Plug>(asyncomplete_force_refresh)', keymap_opts)
-- This one maps F5 to delete all trailing whitespace
vim.api.nvim_set_keymap(
'n',
@ -29,4 +50,3 @@ vim.api.nvim_set_keymap(
[[:let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>]],
keymap_opts)

5
lua/conf/ui.lua

@ -8,5 +8,10 @@ vim.opt.termguicolors = true
-- Always show hidden files in nerdtree
vim.g.NERDTreeShowHidden = 1
-- Disable auto-popup for autocomplete
-- This prevents autocomplete spamming when
-- you dont want it.
vim.g.asyncomplete_auto_popup = 0

Loading…
Cancel
Save