5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,4 +1,9 @@
|
||||
.*
|
||||
!.travis.yml
|
||||
!.pylintrc
|
||||
!.gitignore
|
||||
!.gitattributes
|
||||
!.coveragerc
|
||||
*~
|
||||
*.pyc
|
||||
build
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
language: python
|
||||
dist: precise
|
||||
python:
|
||||
- 2.7
|
||||
- 3.3
|
||||
|
||||
48
README.rst
48
README.rst
@@ -100,9 +100,9 @@ See `CONTROLS <https://github.com/michael-lazar/rtv/blob/master/CONTROLS.rst>`_
|
||||
Settings
|
||||
========
|
||||
|
||||
-------------
|
||||
Configuration
|
||||
-------------
|
||||
------------------
|
||||
Configuration File
|
||||
------------------
|
||||
|
||||
Configuration files are stored in the ``{HOME}/.config/rtv/`` directory
|
||||
|
||||
@@ -112,9 +112,9 @@ See `rtv.cfg <https://github.com/michael-lazar/rtv/blob/master/rtv/templates/rtv
|
||||
|
||||
$ rtv --copy-config
|
||||
|
||||
-----
|
||||
Media
|
||||
-----
|
||||
-------------------
|
||||
Viewing Media Links
|
||||
-------------------
|
||||
|
||||
You can use `mailcap <https://en.wikipedia.org/wiki/Media_type#Mailcap>`_ to configure
|
||||
how RTV will open different types of links
|
||||
@@ -134,26 +134,30 @@ This template contains examples for common MIME types that work with popular red
|
||||
|
||||
Once you've setup your mailcap file, enable it by launching rtv with the ``rtv --enable-media`` flag (or set it in your **rtv.cfg**)
|
||||
|
||||
-----------
|
||||
Environment
|
||||
-----------
|
||||
---------------------
|
||||
Environment Variables
|
||||
---------------------
|
||||
|
||||
RTV will respect the following environment variables when accessing external programs
|
||||
The default programs that RTV interacts with can be configured through environment variables
|
||||
|
||||
``$BROWSER``
|
||||
Submission links will be opened inside of your web browser. On most systems, the default web browser will pop up in a new window. If you prefer the complete terminal experience, try using a console-based web browser (`w3m <http://w3m.sourceforge.net/>`_, `lynx <http://lynx.isc.org/>`_, and `elinks <http://elinks.or.cz/>`_ are all good choices).
|
||||
``$PAGER``
|
||||
Extra long comments and submissions can be opened using the system's pager.
|
||||
``$RTV_EDITOR``
|
||||
Composing posts and replying to comments is done using your preferred text editor. If not specified, the default system ``$EDITOR`` (or *nano*) will be used.
|
||||
``$RTV_URLVIEWER``
|
||||
A url viewer is a tool that can be used to extract hyperlinks from inside of blocks of text. `urlview <https://github.com/sigpipe/urlview>`_ and `urlscan <https://github.com/firecat53/urlscan>`_ are known to be compatible with rtv. These applications don't come pre-installed, but are available through most systems' package managers.
|
||||
| A program used to compose text submissions and comments, e.g. **vim**, **emacs**, **gedit**
|
||||
| *If not specified, will fallback to ``$VISUAL`` and ``$EDITOR`` in that order.*
|
||||
|
||||
----
|
||||
Copy
|
||||
----
|
||||
RTV supports copying submission links to the OS clipboard. For macOS it is supported out of the box,
|
||||
in Linux systems RTV will need `xsel <http://www.vergenet.net/~conrad/software/xsel/>`_ or `xclip <https://sourceforge.net/projects/xclip/>`_ commands to be installed in the system.
|
||||
``$RTV_BROWSER``
|
||||
| A program used to open links to external websites, e.g. **firefox**, **google-chrome**, **w3m**, **lynx**, **elinks**
|
||||
| *If not specified, will fallback to ``$BROWSER``, or try to intelligently choose a browser supported by your system.*
|
||||
|
||||
``$RTV_URLVIEWER``
|
||||
| A tool used to extract hyperlinks from blocks of text, e.g. `urlview <https://github.com/sigpipe/urlview>`_, `urlscan <https://github.com/firecat53/urlscan>`_
|
||||
| *If not specified, will fallback to urlview if it is installed.*
|
||||
|
||||
------------------------
|
||||
Copying to the Clipboard
|
||||
------------------------
|
||||
RTV supports copying submission links to the OS clipboard.
|
||||
On macOS this is supported out of the box.
|
||||
On Linux systems you will need to install either `xsel <http://www.vergenet.net/~conrad/software/xsel/>`_ or `xclip <https://sourceforge.net/projects/xclip/>`_.
|
||||
|
||||
===
|
||||
FAQ
|
||||
|
||||
@@ -106,13 +106,16 @@ def main():
|
||||
_logger.info('%s, %s', sys.executable, sys.version)
|
||||
env = [
|
||||
('$DISPLAY', os.getenv('DISPLAY')),
|
||||
('$TERM', os.getenv('TERM')),
|
||||
('$XDG_CONFIG_HOME', os.getenv('XDG_CONFIG_HOME')),
|
||||
('$RTV_EDITOR', os.getenv('RTV_EDITOR')),
|
||||
('$RTV_URLVIEWER', os.getenv('RTV_URLVIEWER')),
|
||||
('$RTV_BROWSER', os.getenv('RTV_BROWSER')),
|
||||
('$BROWSER', os.getenv('BROWSER')),
|
||||
('$PAGER', os.getenv('PAGER')),
|
||||
('$RTV_EDITOR', os.getenv('RTV_EDITOR')),
|
||||
('$RTV_URLVIEWER', os.getenv('RTV_URLVIEWER'))]
|
||||
('$VISUAL', os.getenv('VISUAL')),
|
||||
('$EDITOR', os.getenv('EDITOR'))]
|
||||
_logger.info('Environment: %s', env)
|
||||
|
||||
else:
|
||||
# Add an empty handler so the logger doesn't complain
|
||||
logging.root.addHandler(logging.NullHandler())
|
||||
|
||||
@@ -569,7 +569,10 @@ class Terminal(object):
|
||||
fp.write(data)
|
||||
_logger.info('File created: %s', filepath)
|
||||
|
||||
editor = os.getenv('RTV_EDITOR') or os.getenv('EDITOR') or 'nano'
|
||||
editor = (os.getenv('RTV_EDITOR') or
|
||||
os.getenv('VISUAL') or
|
||||
os.getenv('EDITOR') or
|
||||
'nano')
|
||||
command = shlex.split(editor) + [filepath]
|
||||
try:
|
||||
with self.suspend():
|
||||
|
||||
Reference in New Issue
Block a user