Add cliphist to the xclipboard layer.

This commit is contained in:
Hong Xu 2019-07-07 10:29:31 -07:00 committed by duianto
parent d642095380
commit cd24a73429
5 changed files with 66 additions and 5 deletions

View File

@ -2598,6 +2598,10 @@ Other:
(thanks to Voleking)
**** Xclipboard
- Added Requirements documentation (thanks to Chris Glass)
- Added =cliphist= with the following bindings: (thanks to Hong Xu)
- ~SPC x P~ paste item from history (cliphist must be enabled)
- ~SPC x R~ rectangly paste item from history (cliphist must be enabled)
- ~SPC x s~ select item from history (cliphist must be enabled)
**** Ycmd
- Search for =compile_commands.json= in build sub-directory
(thanks to Amos Bird and Eivind Fonn)

View File

@ -6,6 +6,8 @@
- [[#description][Description]]
- [[#features][Features:]]
- [[#requirements][Requirements]]
- [[#usage][Usage]]
- [[#clipboard-manager-integration][Clipboard Manager Integration]]
- [[#key-bindings][Key bindings]]
* Description
@ -14,6 +16,7 @@
** Features:
- adds copy support to the X-clipboard from the terminal.
- adds paste support to the X-clipboard from the terminal.
- [[https://github.com/redguardtoo/cliphist][cliphist]] package: integration with clipboard managers on Linux and Mac.
* Requirements
This layer depends on a few platform-specific command-line tools:
@ -23,9 +26,23 @@ This layer depends on a few platform-specific command-line tools:
Note that =xsel= might not be installed by default on e.g. Ubuntu systems.
Clipboard manager integration requires [[http://parcellite.sourceforge.net/][Parcellite]] or [[https://github.com/CristianHenzel/ClipIt][ClipIt]] installed on Linux
and [[https://github.com/TermiT/Flycut][Flycut]] installed on MacOS.
* Usage
** Clipboard Manager Integration
Clipboard manager integration can be enabled by setting =xclipboard-enable-cliphist= to =t=.
#+BEGIN_SRC emacs-lisp
dotspacemacs-configuration-layers '(
(xclipboard :variables xclipboard-enable-cliphist t))
#+END_SRC
* Key bindings
| Key binding | Description |
|-------------+---------------------------------------------|
| ~SPC x p~ | Paste clipboard contents at cursor position |
| ~SPC x y~ | Copy selection to clipboard |
| Key binding | Description |
|-------------+--------------------------------------------------------------|
| ~SPC x p~ | Paste clipboard contents at cursor position |
| ~SPC x y~ | Copy selection to clipboard |
| ~SPC x P~ | paste item from history (cliphist must be enabled) |
| ~SPC x R~ | rectangly paste item from history (cliphist must be enabled) |
| ~SPC x s~ | select item from history (cliphist must be enabled) |

View File

@ -0,0 +1,15 @@
;;; config.el --- xclipboard configuration File for Spacemacs
;;
;; Copyright (c) 2012-2019 Sylvain Benner & Contributors
;;
;; Author: Hong Xu <hong@topbug.net>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; Variables
(defvar xclipboard-enable-cliphist nil
"If non-nil, cliphist is enabled.")

View File

@ -0,0 +1,14 @@
;;; funcs.el --- xclipboard layer functions file for Spacemacs.
;;
;; Copyright (c) 2012-2019 Sylvain Benner & Contributors
;;
;; Author: Hong Xu <hong@topbug.net>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacemacs/xclipboard-cliphist-paste-item-rectangle ()
(interactive)
(cliphist-paste-item 1))

View File

@ -1,9 +1,10 @@
;;; packages.el --- xclipboard layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;; Copyright (c) 2012-2019 Sylvain Benner & Contributors
;;
;; Authors: Charles Weill <weill@google.com>
;; Google LLC.
;; Hong Xu <hong@topbug.net>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
@ -13,8 +14,18 @@
(defconst xclipboard-packages
'(
(spacemacs-xclipboard :location local)
(cliphist :requires ivy
:toggle xclipboard-enable-cliphist)
))
(defun xclipboard/init-cliphist ()
(use-package cliphist
:init (spacemacs/set-leader-keys
"xP" 'cliphist-paste-item
"xR" 'spacemacs/xclipboard-cliphist-paste-item-rectangle
"xs" 'cliphist-select-item)
:config (setq cliphist-cc-kill-ring t)))
(defun xclipboard/init-spacemacs-xclipboard ()
(use-package spacemacs-xclipboard
:init (spacemacs/set-leader-keys