[PYTHON] Introducing the definitive RSS reader canto


Since Feedly is unstable and slow, or it may not be obtained, I tried using canto that can be used on the command line. It's pretty good. ¡

This time, I will introduce how to use canto. In addition, I will also introduce how to use the browser that can be recommended for users who like CLI.

For the time being, I will write the procedure to work on Linux, but it can also be run on Mac. However, please note that the specifications of canto differ considerably depending on the version.


canto installation


$ sudo yaourt -S canto
$ canto


$ sudo port install canto

$ canto

canto startup options


$ canto -u 
#Checking the number of unread
$ canto -a

Basic operation of canto

Basically, it is divided into normal mode (Normal Mode) and read mode (Reader Mode), and the key bindings are also different.


Key Contents Setting
h help help
j Move cursor(under) next_item
k Move cursor(Up) prev_item
space Read(Shift to read mode) "reader"
q End quit
R All read all_read

reference: http://codezen.org/canto/config/#main-view


You can read the article by pressing Space. The key bindings that are valid at that time are as follows.

Key Contents Setting
l Display link number toggle_show_links
g Open the link number in your browser goto
scroll(under) page_down
scroll(Up) page_up

reference: http://codezen.org/canto/config/#reader-view

Open the link in your browser

To open the link in your browser, first switch to read mode with Space.

This will display the content of the article at the top. If you press l (L) here, the links will be numbered.

If you press g there, you can specify the number and open it in the browser.

The browser settings are as follows. You can separate the browser (tool) by the header and the image.


link_handler("w3m \"%u\"", text=True)
image_handler("dwb \"%u\"", fetch=True)

However, do not set it here yet. Next, I will introduce the initial setting method of canto.

canto initialization

Mac and Linux will have different versions installed depending on the popular package manager. Therefore, the settings will be slightly different. Please note.

Specifically, for Mac, after downloading the settings file, you must write the settings for only ʻURL in conf`.

Then, the following introduces the setting method that is effective in Linux.

First, download the configuration file.


$ cd ~/.canto
$ curl -O http://codezen.org/static/conf.py.example
$ chmod +x conf.py.example
$ cp conf.py.example conf.py
$ vim conf.py

Next, let's review the settings in the configuration file.

To add a feed, write as follows. You can specify the number of displays, tag, filter, etc.


add("http://someurl", rate=30, keep=100)
add("http://some-blog", tags=[None, "blogs"])
add("http://some-other-blog", tags=[None, "blogs"])
filters = [ None, with_tag_in("blogs") ]
add("http://feeds.penny-arcade.com/pa-mainsite") # Implicitly creates "Penny Arcade" tag
add_tag("Penny Arcade", filters=[only_with("Comic:"), only_with("News:")])

Next is the key binding setting. There are normal mode and read mode. The key binding differs depending on the mode.


keys['/'] = search_filter
keys['y'] = yank
reader_key['n'] = ["destroy", "just_read", "next_item", "reader", "toggle_show_links"]
reader_key['p'] = ["destroy", "just_read", "prev_item", "reader", "toggle_show_links"]

Let's look only at the last line.

reader_key['p'] = ["destroy", "just_read", "prev_item", "reader", "toggle_show_links"]

This setting is to move the previous article open. Since toggle_show_links was added at the end, the process is to display the link number.

In other words, in the last line, pressing p will set the key to" open the previous article "with the link number displayed".

This saves you the trouble of pressing l.

The browser settings are as follows.


link_handler("w3m \"%u\"", text=True)
image_handler("dwb \"%u\"", fetch=True)

Please note that the description will change depending on whether it is a text browser or not.

Here, I set up the browsers w3m and dwb.

In other words, opening the link with g (goto) will launch w3m, and opening the image will launch dwb.

reference: http://codezen.org/canto/config/#example-config

Then, in the following, I would like to introduce the basic usage of w3m and dwb.

However, I will introduce it as long as it is useful for cooperation with canto.


w3m installation


$ sudo pacman -S w3m xclip

Convenient setting of w3m

If you set w3m in your browser, it is convenient to set the following key bindings.


keymap m EXTERN_LINK "echo %s | xclip -i -selection clipboard"
keymap M EXTERN "echo %s | xclip -i -selection clipboard"

reference: http://mba-hack.blogspot.jp/2012/10/w3m.html

x11 Clipboard

The Linux x11 clipboard has the following format. Specify with -selection.

-selection Contents
primary When the text is inverted and copied with the mouse
clipboard If you flip the text with the mouse, right-click and select Copy
secondary -

This is essential knowledge when using the Linux x11 clipboard. If you want to set your own in the shell or terminal, use this command.

x11 throw into clipboard

$ xclip -i -selection clipboard

x11 Read from clipboard

$ xclip -o -selection clipboard

reference: http://l-w-i.net/t/x/clipboard_001.txt

In addition, xsel is also often used for the Linux clipboard. ʻArch Wiki etc. recommends xclip` ...

However, the richness of ʻArch Wiki` is wonderful. This is a big influence for me to use Arch.

The story went awry. Return the story.

This is the end of the story of w3m. Next, I will introduce how to use a browser called deb.


What is dwb

A lightweight GUI browser.

I use a browser called dwb for everyday use on Linux. I recommend it for simple browsing.

Also, the default key bindings are very good. The extensions that dwb has by default are unnecessary and easy.

I personally think that dwb doesn't need much extension because it's unnecessary because the basic features and key bindings are great by default.

dwb key bindings

Key Contents alias,command
i Shift to insert mode i
: Move to command mode -
Esc,C-n Shift to normal mode -
/ Search ffind
f Open link hi
F Open link in tab thi
j, k, h, l Scroll, back, forward down …etc
C+Tab Tab move ttab
d Close tab close_tab
;y Save the link to the clipboard chi
yy Save the URL to the clipboard yank
yt Save the title to the clipboard tyank
Sk Open key binding settings skeys
Ss Open settings ssettings
C-q End q

dwb settings

To set a custom key, write it in ~ / .config / dwb / default / custom_keys.

The writing style is as follows.


Control ;g :t http://google.com;; 150zoom
Control w :close_tab

For example, the above is to press ; g to open Google in a tab with zoom + 150.

Other settings are also in the same folder.

reference: http://portix.bitbucket.org/dwb/resources/manpage.html https://wiki.archlinux.org/index.php/Dwb

Text copy with dwb

For example, select the text as follows.

  1. /https + n

  2. i + Shift + → + C+c

Simply search and then select and copy the text in insert mode.

If you want to copy the link, a key such as ; y is convenient.


Cooperation with tmux

When using a text browser, it is convenient to use tmux so that you can copy the screen. We have devised a way to copy with one key.


#Settings reload
bind r source-file ~/.tmux.conf \; display-message "Reload Config!!"
# "C-b, ["Copy mode setting vi
#set-window-option -g mode-keys vi
setw -g mode-keys vi
# [?]Confirm key binding
# [p]pasting
bind p paste-buffer
# c[Enter]copy
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind -t vi-copy Enter copy-pipe "xclip -i -selection clipboard"
# c[Space]Choice
# [y]1 line copy(When there is no cooperation with the clipboard)
bind -t vi-copy Enter copy-pipe "xclip -i -selection clipboard"
bind -t vi-copy Y select-line
bind y run 'tmux copy-mode\; send-keys Y Enter'
## [y]1 line copy(When there is cooperation with the clipboard)
#bind -t vi-copy Y select-line
#bind y run 'tmux copy-mode\; send-keys Y'
# [v]All line copy
bind -t vi-copy V begin-selection
bind v run 'tmux copy-mode\; send-keys ggVG Enter'

reference: http://mba-hack.blogspot.jp/2013/05/tmux.html


Please let me know if anyone has a macro or tips to do continuous hints with dwb.

Recommended Posts

Introducing the definitive RSS reader canto
About understanding the 3-point reader [...]