A hackathon project written with https://github.com/bobbybee. Inspired by code written by https://github.com/hardmath123 and me.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nickolas360 6f8385d26c Add short description to README 2 years ago
markov Initial commit 2 years ago
readline Regenerate patches 2 years ago
vim Initial commit 2 years ago
weechat Allow adding WeeChat bindings manually 2 years ago
.gitignore Initial commit 2 years ago
LICENSE Add license 2 years ago
Makefile Update build process 2 years ago
README Add short description to README 2 years ago

README

                                         _
_ __ ___ __ _ _ __| | _______ __
| '_ ` _ \ / _` | '__| |/ / _ \ \ / /
| | | | | | (_| | | | < (_) \ V /
|_| |_| |_|\__,_|_| |_|\_\___/ \_/
_ _
___ ___ _ __ ___ _ __ | | ___| |_ ___
/ __/ _ \| '_ ` _ \| '_ \| |/ _ \ __/ _ \
| (_| (_) | | | | | | |_) | | __/ || __/
\___\___/|_| |_| |_| .__/|_|\___|\__\___|
|_|


markov-complete adds Markov chain text completion to GNU Readline, Vim, and
WeeChat.


Installation
------------

To install markov-complete, run:

$ make libs
$ sudo make install-libs
$ make
$ sudo make install

A Vim plugin will be installed in /etc/vimrc/plugin. WeeChat will be installed
in /usr/local/bin/ with new default keybindings for markov-complete. You may
need to regenerate ~/.weechat/weechat.conf. You can also add the bindings
manually under the [key] section of your weechat.conf. See weechat/keys.conf.

To patch readline once you've completed the above steps, run:

$ export LD_PRELOAD=/usr/local/lib/libreadline.so.7.0

Programs which dynamically link to readline will now use the patched version.


Generating the chain
--------------------

You will need a "markov-chain" file in order to receive suggestions. Once
you've installed markov-complete, run (from this directory):

$ cd markov/markov
$ cp <path-to-your-corpus-text> corpus-text
$ cat corpus-text | ./generate.py
$ ./transpile.py chain.json > markov-chain
$ sudo cp markov-chain /usr/local/share/

You can also set the environment variable MARKOV_CHAIN to specify a different
chain to use.


Usage
-----

Once you've typed a few words in a program that uses markov-complete, press
` (backtick) to autocomplete the next word. Press Ctrl+o to cycle through
Markov suggestions. Ctrl+Shift+` will enter a normal backtick.

You can use `rlwrap` to enable markov-complete with any program that runs in
canonical mode (as opposed to raw mode).


System requirements
-------------------

markov-complete has been tested on Debian stretch (9.0). It may work on other
systems (possibly with some minor modifications).


Dependencies
------------

* gcc
* g++
* make
* cmake
* libncurses5-dev
* libcurl4-openssl-dev
* zlib1g-dev
* libgcrypt20-dev
* vim-nox