Guest User

Untitled

a guest
Feb 22nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. if &compatible
  2. set nocompatible
  3. endif
  4.  
  5.  
  6. function! s:hint_n_m() abort " {{{
  7. redir => str
  8. :marks
  9. redir END
  10. echo str
  11. return 'm' . nr2char(getchar())
  12. endfunction " }}}
  13. nnoremap <expr> m <SID>hint_n_m()
  14.  
  15.  
  16. function! s:hint_n_quote() abort " {{{
  17. redir => str
  18. :marks
  19. redir END
  20. echo str
  21. return '`' . nr2char(getchar())
  22. endfunction " }}}
  23. nnoremap <expr> ` <SID>hint_n_quote()
  24. nnoremap <expr> ' <SID>hint_n_quote()
  25.  
  26.  
  27. function! s:hint_n_doublequote() abort " {{{
  28. redir => str
  29. :registers
  30. redir END
  31. echo str
  32. return '"' . nr2char(getchar())
  33. endfunction " }}}
  34. nnoremap <expr> " <SID>hint_n_doublequote()
  35.  
  36.  
  37. let s:compl_key_dict = {
  38. \ char2nr("\<C-l>"): "\<C-x>\<C-l>",
  39. \ char2nr("\<C-n>"): "\<C-x>\<C-n>",
  40. \ char2nr("\<C-p>"): "\<C-x>\<C-p>",
  41. \ char2nr("\<C-k>"): "\<C-x>\<C-k>",
  42. \ char2nr("\<C-t>"): "\<C-x>\<C-t>",
  43. \ char2nr("\<C-i>"): "\<C-x>\<C-i>",
  44. \ char2nr("\<C-]>"): "\<C-x>\<C-]>",
  45. \ char2nr("\<C-f>"): "\<C-x>\<C-f>",
  46. \ char2nr("\<C-d>"): "\<C-x>\<C-d>",
  47. \ char2nr("\<C-v>"): "\<C-x>\<C-v>",
  48. \ char2nr("\<C-u>"): "\<C-x>\<C-u>",
  49. \ char2nr("\<C-o>"): "\<C-x>\<C-o>",
  50. \ char2nr('s'): "\<C-x>s",
  51. \ char2nr("\<C-s>"): "\<C-x>s"
  52. \}
  53. let s:hint_i_ctrl_x_msg = join([
  54. \ '<C-l>: While lines',
  55. \ '<C-n>: keywords in the current file',
  56. \ "<C-k>: keywords in 'dictionary'",
  57. \ "<C-t>: keywords in 'thesaurus'",
  58. \ '<C-i>: keywords in the current and included files',
  59. \ '<C-]>: tags',
  60. \ '<C-f>: file names',
  61. \ '<C-d>: definitions or macros',
  62. \ '<C-v>: Vim command-line',
  63. \ "<C-u>: User defined completion ('completefunc')",
  64. \ "<C-o>: omni completion ('omnifunc')",
  65. \ "s: Spelling suggestions ('spell')"
  66. \], "\n")
  67. function! s:hint_i_ctrl_x() abort " {{{
  68. echo s:hint_i_ctrl_x_msg
  69. let c = getchar()
  70. return get(s:compl_key_dict, c, nr2char(c))
  71. endfunction " }}}
  72. inoremap <expr> <C-x> <SID>hint_i_ctrl_x()
Add Comment
Please, Sign In to add comment