twitter: improve layer

- Refactor configuration
- Change logo
- Better default key bindings
- Add a transient state
This commit is contained in:
syl20bnr 2016-03-24 00:46:52 -04:00
parent 9d0558992c
commit 92cc50bbaa
3 changed files with 137 additions and 25 deletions

View File

@ -1,15 +1,16 @@
#+TITLE: Twitter contribution layer for Spacemacs
[[file:img/twitter.png]]
* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Features][Features]]
- [[Install][Install]]
- [[Layer][Layer]]
- [[Configuration][Configuration]]
- [[Key Bindings][Key Bindings]]
* Description
This layer adds Twitter support to Spacemacs via the package =twittering-mode=,
do not hesitate to check the original package README [[https://github.com/hayamiz/twittering-mode][here]].
This layer adds Twitter support to Spacemacs via the package [[https://github.com/hayamiz/twittering-mode][twittering-mode]].
* Features
- Activities on Twitter
@ -33,11 +34,46 @@ do not hesitate to check the original package README [[https://github.com/hayami
- Secure connection via HTTPS (cURL, GNU Wget, OpenSSL or GnuTLS is required)
* Install
** Layer
#+begin_src emacs-lisp
(setq-default dotspacemacs-configuration-layers '(twitter))
#+end_src
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =twitter= to the existing =dotspacemacs-configuration-layers= list in this
file.
* Configuration
Exhaustive configuration documentation can be found on the README page of the
package [[https://github.com/hayamiz/twittering-mode][here]].
You can authenticate easily via a PIN number, or you can use GnuPG by setting
the variable =twittering-use-master-password= to =t= in the =user-config=
function of your dotfile.
* Key Bindings
Check out the original package doc [[https://github.com/hayamiz/twittering-mode/blob/master/README.markdown#usage][here]] as the key bindings =feel= evil enough :).
| Key Binding | Description |
|-------------+------------------------------------------|
| ~?~ | Open/Quit transient state |
| ~/~ | Search |
| ~a~ | Toggle auto-refresh |
| ~b~ | Heart |
| ~B~ | Unheart |
| ~d~ | Direct message to user around point |
| ~e~ | Edit tweet |
| ~f~ | Follow user around point |
| ~F~ | Unfollow user around point |
| ~g~ | First tweet |
| ~G~ | Last tweet |
| ~i~ | View user profile around point |
| ~q~ | Quit transient state |
| ~Q~ | Quit twittering mode |
| ~j~ | Next tweet |
| ~J~ | Next tweet of same user around point |
| ~k~ | Previous tweet |
| ~K~ | Previous tweet of same user around point |
| ~n~ | New tweet |
| ~o~ | Open URL |
| ~r~ | Retweet (native) |
| ~R~ | Retweet (organic) |
| ~t~ | View tweet replies |
| ~u~ | Update timeline |
| ~X~ | Delete tweet |
| ~y~ | Copy tweet URI |
| ~Y~ | Copy tweet content |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -12,25 +12,101 @@
;; List of all packages to install and/or initialize. Built-in packages
;; which require an initialization must be listed explicitly in the list.
(setq twitter-packages
'(twittering-mode))
(setq twitter-packages '(twittering-mode))
(defun twitter/init-twittering-mode ()
(use-package twittering-mode
:commands twit
:defer t
:init
(evil-leader/set-key
"at" 'twit)
(when (configuration-layer/package-usedp 'flyspell)
(add-hook 'twittering-edit-mode-hook (lambda () (flyspell-mode 1))))
(push 'twittering-edit-mode evil-insert-state-modes)
(progn
(evil-leader/set-key "at" 'twit)
(setq twittering-initial-timeline-spec-string '(":home")
twittering-icon-mode t
twittering-use-icon-storage 1
twittering-enable-unread-status-notifier t
twittering-display-remaining t
twittering-edit-skeleton 'inherit-any
twittering-url-show-status nil
twittering-timeline-header ""
twittering-timeline-footer ""
twitter-images-directory (concat spacemacs-cache-directory "twitter")
twittering-status-format "%i %S, %RT{%FACE[bold]{%S}} %@ %FACE[shadow]{%p%f%L%r}\n%FOLD[ ]{%T}\n")
(unless (file-exists-p twitter-images-directory)
(make-directory twitter-images-directory))
)
:config
(setq twitter-images-directory
(expand-file-name
(concat spacemacs-cache-directory "twitter-images")))
(unless (file-exists-p twitter-images-directory)
(make-directory twitter-images-directory))
(setq twittering-icon-mode t)
(setq twittering-url-show-status nil)
(setq twittering-use-master-password t)
(setq twittering-use-icon-storage 1)))
(progn
;; twittering mode overwrite the leader key
(define-key twittering-mode-map (kbd "SPC") spacemacs-default-map)
;; redefine better defaults
(let ((map twittering-mode-map))
(define-key map "?" 'spacemacs/twittering-mode-transient-state/body)
(define-key map "/" 'twittering-search)
(define-key map "a" 'twittering-toggle-activate-buffer)
(define-key map "b" 'twittering-favorite)
(define-key map "B" 'twittering-unfavorite)
(define-key map "d" 'twittering-direct-message)
(define-key map "e" 'twittering-edit-mode)
(define-key map "f" 'twittering-follow)
(define-key map "F" 'twittering-unfollow)
(define-key map "g" 'beginning-of-buffer)
(define-key map "G" 'end-of-buffer)
(define-key map "i" 'twittering-view-user-page)
(define-key map "Q" 'twittering-kill-buffer)
(define-key map "j" 'twittering-goto-next-status)
(define-key map "J" 'twittering-goto-next-status-of-user)
(define-key map "k" 'twittering-goto-previous-status)
(define-key map "K" 'twittering-goto-previous-status-of-user)
(define-key map "n" 'twittering-update-status-interactive)
(define-key map "o" 'twittering-click)
(define-key map "r" 'twittering-native-retweet)
(define-key map "R" 'twittering-organic-retweet)
(define-key map "t" 'twittering-toggle-or-retrieve-replied-statuses)
(define-key map "u" 'twittering-current-timeline)
(define-key map "X" 'twittering-delete-status)
(define-key map "y" 'twittering-push-uri-onto-kill-ring)
(define-key map "Y" 'twittering-push-tweet-onto-kill-ring))
;; associated transient state
(spacemacs|define-transient-state twittering-mode
:title "Twittering Mode Transient State"
:doc "
Tweets^^^^^^ User^^^^ Other^^
^^^^^^ ^^^^ ^^
[_j_/_k_] down/up [_r_] retweet [_d_]^^ direct message [_a_] toggle auto-refresh
[_RET_]^^ open or reply [_R_] retweet & edit [_f_]^^ follow [_q_] quit
[_b_]^^ heart [_n_] post new tweet [_F_]^^ unfollow [_Q_] quit twitter
[_B_]^^ unheart [_t_] show thread [_i_]^^ profile [_u_] update
[_e_]^^ edit mode [_X_] delete tweet [_J_/_K_] down/up [_/_] search
[_g_]^^ first [_y_] yank url
[_G_]^^ last [_Y_] yank tweet
[_o_]^^ open url"
:bindings
("?" nil :exit t)
("RET" twittering-enter :exit t)
("/" twittering-search :exit t)
("a" twittering-toggle-activate-buffer)
("b" twittering-favorite)
("B" twittering-unfavorite)
("d" twittering-direct-message :exit t)
("e" twittering-edit-mode :exit t)
("f" twittering-follow)
("F" twittering-unfollow)
("g" beginning-of-buffer)
("G" end-of-buffer)
("i" twittering-view-user-page)
("q" nil :exit t)
("Q" twittering-kill-buffer :exit t)
("j" twittering-goto-next-status)
("J" twittering-goto-next-status-of-user)
("k" twittering-goto-previous-status)
("K" twittering-goto-previous-status-of-user)
("n" twittering-update-status-interactive :exit t)
("o" twittering-click :exit t)
("r" twittering-native-retweet :exit t)
("R" twittering-organic-retweet :exit t)
("t" twittering-toggle-or-retrieve-replied-statuses :exit t)
("u" twittering-current-timeline)
("X" twittering-delete-status)
("y" twittering-push-uri-onto-kill-ring)
("Y" twittering-push-tweet-onto-kill-ring)))))