Skip to content

Instantly share code, notes, and snippets.

@mogita
Created June 30, 2021 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mogita/07fcadf0e2d829312c8e976f9c25bc68 to your computer and use it in GitHub Desktop.
Save mogita/07fcadf0e2d829312c8e976f9c25bc68 to your computer and use it in GitHub Desktop.
Vim Simple Auto Complete
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Auto Complete
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Navigate the complete menu item like CTRL+n / CTRL+p would
inoremap <expr> <Down> pumvisible() ? "<C-n>" : "<Down>"
inoremap <expr> <Tab> pumvisible() ? "<C-n>" : "<Tab>"
inoremap <expr> <Up> pumvisible() ? "<C-p>" : "<Up>"
" Select the complete menu item like CTRL+y would
inoremap <expr> <CR> pumvisible() ? "<C-y>" : "<CR>"
" Cancel the complete menu item like CTRL+e would
inoremap <expr> <Left> pumvisible() ? "<C-e><Left>" : "<Left>"
inoremap <expr> <Right> pumvisible() ? "<C-e><Right>" : "<Right>"
@mogita
Copy link
Author

mogita commented Jun 30, 2021

To use the key mapping, install this plugin first:

https://github.com/vim-scripts/AutoComplPop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment