Skip to content

Instantly share code, notes, and snippets.

@koturn
Created February 8, 2018 12:29
Show Gist options
  • Select an option

  • Save koturn/78ddb664fb33ac8a432b856ec4a27ed6 to your computer and use it in GitHub Desktop.

Select an option

Save koturn/78ddb664fb33ac8a432b856ec4a27ed6 to your computer and use it in GitHub Desktop.
if &compatible
set nocompatible
endif
let s:compl_key_dict = {
\ char2nr("\<C-l>"): "\<C-x>\<C-l>",
\ char2nr("\<C-n>"): "\<C-x>\<C-n>",
\ char2nr("\<C-p>"): "\<C-x>\<C-p>",
\ char2nr("\<C-k>"): "\<C-x>\<C-k>",
\ char2nr("\<C-t>"): "\<C-x>\<C-t>",
\ char2nr("\<C-i>"): "\<C-x>\<C-i>",
\ char2nr("\<C-]>"): "\<C-x>\<C-]>",
\ char2nr("\<C-f>"): "\<C-x>\<C-f>",
\ char2nr("\<C-d>"): "\<C-x>\<C-d>",
\ char2nr("\<C-v>"): "\<C-x>\<C-v>",
\ char2nr("\<C-u>"): "\<C-x>\<C-u>",
\ char2nr("\<C-o>"): "\<C-x>\<C-o>",
\ char2nr('s'): "\<C-x>s",
\ char2nr("\<C-s>"): "\<C-x>s"
\}
let s:hint_i_ctrl_x_msg_lines = [
\ '<C-l>: While lines',
\ '<C-n>: keywords in the current file',
\ "<C-k>: keywords in 'dictionary'",
\ "<C-t>: keywords in 'thesaurus'",
\ '<C-i>: keywords in the current and included files',
\ '<C-]>: tags',
\ '<C-f>: file names',
\ '<C-d>: definitions or macros',
\ '<C-v>: Vim command-line',
\ '<C-u>: User defined completion',
\ '<C-o>: omni completion',
\ 's: Spelling suggestions'
\]
let s:hint_i_ctrl_x_msg = join(s:hint_i_ctrl_x_msg_lines, "\n")
function! s:hint_i_ctrl_x() abort " {{{
echo (&lines > len(s:hint_i_ctrl_x_msg_lines)) ? s:hint_i_ctrl_x_msg : join(s:hint_i_ctrl_x_msg_lines[: &lines - 2], "\n")
return get(s:compl_key_dict, getchar(), '')
endfunction " }}}
inoremap <silent><expr><C-x> <SID>hint_i_ctrl_x()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment