Skip to content

thalesmello/webcomplete.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webcomplete.vim

A Vim plugin that completes words from the currently open web page in your browser.

Currently works with:

demo

Installation

With vim-plug:

Plug 'thalesmello/webcomplete.vim'

Using with deoplete

deoplete is an awesome asynchronous completion engine for Neovim. webcomplete works with deoplete out of the box. Just start typing to see suggestions of words comming from your browser.

  • g:deoplete#sources#webcomplete#script: Execute this command-line string to get a list of words instead of default internal sh/webcomplete. You may add arguments to the string, e.g. cat /tmp/words.txt.

Using with ncm2

ncm2 is also supported. Once ncm2 is configured in your configuration files, the completions for webcomplete should be enabled by default.

  • g:ncm2_webcomplete_script: Same as option for deoplete, but for ncm2.

Using with coc

coc is also supported. Once coc is configured in your configuration files, the completions for webcomplete should be enabled by default.

  • g:coc_webcomplete_script: Same as option for deoplete, but for coc.

Using with completefunc or omnifunc

Vim allows you to define a completefunc or an omnifunc to give you completions during insert mode. webcomplete provides you with a function that you can plug into these built in features.

To set it up, use either of the two lines below:

" Use <C-X><C-U> in insert mode to get completions
set completefunc=webcomplete#complete

" Use <C-X><C-O> in insert mode to get completions
set omnifunc=webcomplete#complete

Using with Google Chrome

Currently this plugin only supports Google Chrome on Mac OS.

To use it, you must enable "Allow JavaScript from Apple Events" in View > Developer submenu.

Using with Qutebrowser

Set one of the _webcomplete_script variables (described above) to $plugin_dir/sh/qutebrowser/webcomplete, where $plugin_dir is the location of this plugin.

Using with Firefox

Currently there is no official support for Firefox, but there is a fork with Firefox support

Limitations

  • Currently works on Mac OS because of the osascript command line utility, which is used to fetch text from the page
  • Assumes you have only one browser window opened. If there is more than one window open, it picks the most recently used.
  • Currently works only on Chrome, but it's possible to use with other browsers.

Contributing

If you would like to contribute to the project by supporting your browser or operating system, I would be happy to accept pull requests.

Inspiration

The project was only possible with the help of Reddit user 18252 and by looking at tmux-complete.vim as reference when implementing this plugin.

About

A plugin for Vim that completes words from your browser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •