From 263b842758e1022c0dfdb21f39ffd1d8f4b6dace Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Thu, 11 Sep 2014 21:14:17 -0400 Subject: [PATCH] Better key bindings for bookmarks Use default helm action in helm-bookmark buffer --- README.md | 19 +++++++++++++------ spacemacs/keybindings.el | 6 ------ spacemacs/packages.el | 15 +++++++++++---- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index eb1733ee5..c31bf86b2 100644 --- a/README.md +++ b/README.md @@ -281,16 +281,23 @@ Key Binding | Description #### Bookmarks Bookmarks can be set anywhere in a file. Bookmarks are persistent. They are very -useful to jump to/open a known project. +useful to jump to/open a known project. `Spacemacs` used `helm-bookmarks` to +manage them. -Bookmarks commands (start with `k`): +Open an `helm` window with the current bookmarks by pressing: + + h b + +Then in the `helm-bookmarks` buffer: Key Binding | Description --------------|---------------------------------------------------------------- -` k d` | delete a bookmark -` k g` | go to a bookmark using `helm` -` k r` | rename a bookmark -` k s` | save a bookmark +`CTRL+d` | delete the selected bookmark +`CTRL+e` | edit the selected bookmark +`CTRL+f` | toggle filename location +`CTRL+o` | open the selected bookmark in another window + +To save a new bookmark, just type the name of the bookmark and press `RET`. ### Window manipulation diff --git a/spacemacs/keybindings.el b/spacemacs/keybindings.el index 1863126ed..f26c0c854 100644 --- a/spacemacs/keybindings.el +++ b/spacemacs/keybindings.el @@ -120,12 +120,6 @@ (evil-leader/set-key "jh" (lambda () (interactive) (push-mark (point)) (evil-beginning-of-line)) "jl" (lambda () (interactive) (push-mark (point)) (evil-end-of-line))) -;; bookmarks ------------------------------------------------------------------ -(evil-leader/set-key - "kd" 'bookmark-delete - "kg" 'bookmark-jump - "kr" 'bookmark-rename - "ks" 'bookmark-set) ;; Compilation ---------------------------------------------------------------- (evil-leader/set-key "cc" 'compile) ;; narrow & widen ------------------------------------------------------------- diff --git a/spacemacs/packages.el b/spacemacs/packages.el index 0fd34a96d..7436224bd 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -429,8 +429,7 @@ which require an initialization must be listed explicitly in the list." :config (setq bookmark-default-file "~/.emacs.d/bookmarks" ; keep my ~/ clean - bookmark-save-flag 1) ; autosave each change - )) + bookmark-save-flag 1))) ; autosave each change (defun spacemacs/init-buffer-move () (use-package buffer-move @@ -957,8 +956,16 @@ which require an initialization must be listed explicitly in the list." (evil-leader/set-key ":" 'helm-M-x "bs" 'helm-mini - "kil" 'helm-how-kill-ring - "hg" 'helm-bookmarks)) + "hb" 'helm-bookmarks + "kil" 'helm-how-kill-ring) + ;; alter helm-bookmark key bindings to be simpler + (defun simpler-helm-bookmark-keybindings () + (define-key helm-bookmark-map (kbd "C-d") 'helm-bookmark-run-delete) + (define-key helm-bookmark-map (kbd "C-e") 'helm-bookmark-run-edit) + (define-key helm-bookmark-map (kbd "C-f") 'helm-bookmark-toggle-filename) + (define-key helm-bookmark-map (kbd "C-o") 'helm-bookmark-run-jump-other-window) + (define-key helm-bookmark-map (kbd "C-/") 'helm-bookmark-help)) + (add-hook 'helm-mode-hook 'simpler-helm-bookmark-keybindings)) :config (progn ;; helm keybindings tweaks