Vim Tips Wiki

Enhance the word complete.vim script

Redirected from VimTip526

1,625pages on
this wiki
Add New Page
Talk0 Share
Tip 526 Printable Monobook Previous Next

created 2003 · complexity intermediate · author Adrian von Bidder · version 6.0

I suggest you first look at the script itself: script#73

Since the script has some problems (at least for me) when I paste text in X11 with the mouse, and since I need to switch to paste more anyway, I now use this in my vimrc:

" the word_complete.vim plugin just *rocks*
autocmd VimEnter * call DoWordComplete()

fun! SetComplete()
  call DoWordComplete()
  set nopaste
  nunmap <F12>
  iunmap <F12>
  nmap <F12> :call UnsetComplete()<CR>
  imap <F12> <Esc>:call UnsetComplete()<CR>a

fun! UnsetComplete()
  call EndWordComplete()
  set paste
  nunmap <F12>
  iunmap <F12>
  nmap <F12> :call SetComplete()<CR>
  imap <F12> <Esc>:call SetComplete()<CR>a

nmap <F12> :call UnsetComplete()<CR>
imap <F12> <Esc>:call UnsetComplete()<CR>a


In insert mode, F12 switches to paste mode, but not back again. In normal mode, it works.


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.