practicalli / spacemacs

Content for the book - Clojure Development with Spacemacs
https://practical.li/spacemacs
Creative Commons Attribution Share Alike 4.0 International
110 stars 33 forks source link

Configure / search to use swoop #204

Open practicalli-johnny opened 4 years ago

practicalli-johnny commented 4 years ago

Replace the command called with / to search the current project with helm-swoop for Evil normal mode only. Update the practicalli/spacemacs.d repository with a suitable configuration in dotspacemacs/user-config

Using helm swoop provides a more effective search and avoids some of the issues with the default search command. https://github.com/practicalli/spacemacs-content/issues/93 https://github.com/practicalli/spacemacs-content/issues/28

There are a few approaches to defining keys

(define-key global-map (kbd "/") 'helm-swoop)

This uses the global map and affects Evil insert state but not Evil normal state, preventing the / character being entered as a character in a buffer.

(define-key evil-normal-state-map (kbd "/") 'helm-swoop)

This changes the key binding just in the keyboard map for Evil normal.

(evil-global-set-key 'normal "/" 'helm-swoop)

Is the preferred way to set a key with global scope for a particular Evil mode, according to the Spacemacs keymap guide https://github.com/syl20bnr/spacemacs/wiki/Keymaps-guide