<commit_before>======================
Reddit Terminal Viewer
======================

.. image:: https://pypip.in/version/rtv/badge.svg?text=version
    :target: https://pypi.python.org/pypi/rtv/
    :alt: Latest Version

**Reddit Terminal Viewer (RTV)** is a lightweight browser for Reddit (www.reddit.com) built into a terminal window.
RTV is built in Python and utilizes the **curses** library. 
It is compatible with a large range of terminal emulators on Linux and OSX systems. 

.. image:: http://i.imgur.com/4a3Yrov.gif

------------
Installation
------------
The recommended installation method is pip.

.. code-block:: bash
   
   $ sudo pip install --pre rtv

Alternatively, clone the repo and install with python.

.. code-block:: bash

   $ git clone https://github.com/michael-lazar/rtv.git
   $ cd rtv
   $ sudo python setup.py install

As part of the installation, an executable script will be placed in your system path.

.. code-block:: bash

   $ rtv
   $ rtv --help

-----
Usage 
-----

RTV currently supports browsing both subreddits and individual submissions. In each mode the controls are slightly different.

**Global Commands**

:``Arrow Keys`` or ``hjkl``: RTV supports both the arrow keys and vim bindings for navigation. Move up and down to scroll through items on the page.
:``r`` or ``F5``: Refresh the current page.
:``q``: Quit the program.
:``o``: Open the url of the selected item in the default web browser.

**Subreddit Mode**

In subreddit mode you can browse through the top submissions on either the front page or a specific subreddit.

:``Right`` or ``Enter``: Open the currently selected submission in a new page.
:``/``: Open a prompt to switch to a different subreddit. For example, pressing ``/`` and typing *python* will open */r/python*. You can return to Reddit's front page by using the alias */r/front*.

**Submission Mode**

In submission mode you can view the self text for a submission and browse comments.

:``Right`` or ``Enter``: Toggle the currently selected comment between hidden and visible. Alternatively, load additional comments identified by *[+] more comments*.
:``Left``: Exit the submission page and return to the subreddit.
<commit_msg>Added configuration section to readme.<commit_after>======================
Reddit Terminal Viewer
======================

.. image:: https://pypip.in/version/rtv/badge.svg?text=version
    :target: https://pypi.python.org/pypi/rtv/
    :alt: Latest Version

**Reddit Terminal Viewer (RTV)** is a lightweight browser for Reddit (www.reddit.com) built into a terminal window.
RTV is built in Python and utilizes the **curses** library. 
It is compatible with a large range of terminal emulators on Linux and OSX systems. 

.. image:: http://i.imgur.com/4a3Yrov.gif

------------
Installation
------------
The recommended installation method is pip.

.. code-block:: bash
   
   $ sudo pip install --pre rtv

Alternatively, clone the repo and install with python.

.. code-block:: bash

   $ git clone https://github.com/michael-lazar/rtv.git
   $ cd rtv
   $ sudo python setup.py install

As part of the installation, an executable script will be placed in your system path.

.. code-block:: bash

   $ rtv
   $ rtv --help

-----
Usage 
-----

RTV currently supports browsing both subreddits and individual submissions. In each mode the controls are slightly different.

**Global Commands**

:``Arrow Keys`` or ``hjkl``: RTV supports both the arrow keys and vim bindings for navigation. Move up and down to scroll through items on the page.
:``r`` or ``F5``: Refresh the current page.
:``q``: Quit the program.
:``o``: Open the url of the selected item in the default web browser.

**Subreddit Mode**

In subreddit mode you can browse through the top submissions on either the front page or a specific subreddit.

:``Right`` or ``Enter``: Open the currently selected submission in a new page.
:``/``: Open a prompt to switch to a different subreddit. For example, pressing ``/`` and typing *python* will open */r/python*. You can return to Reddit's front page by using the alias */r/front*.

**Submission Mode**

In submission mode you can view the self text for a submission and browse comments.

:``Right`` or ``Enter``: Toggle the currently selected comment between hidden and visible. Alternatively, load additional comments identified by *[+] more comments*.
:``Left``: Exit the submission page and return to the subreddit.

-------------
Configuration
-------------

RTV will read a configuration dotfile located at **~/.rtv**.
This can be used to avoid having to re-enter login credentials every time the program is launched.
Each line in the file will replace the corresponding default argument in the launch script.

Example config file (**~/.rtv**):

::

  [rtv]
  username=MyUsername
  password=<PASSWORD>
  
  # Default subreddit
  subreddit=CollegeBasketball

{'fraction_non_alphanumeric': 0.13095238095238096, 'fraction_numerical': 0.0012315270935960591, 'mean_word_length': 3.63212927756654, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4243793', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1333, 'n_words': 630}