Browse Source

Fix end of line for multiple cursors, projectile old version

* Keep the old projectile formatter for my other computer
* Use end-of-line instead of end-of-visual-line when using
  multiple-cursors so the view doesn't affect mark/editing in mc
* Change select search hotkey to be more convenient
* Clear mark during isearch so Occur works better
master
macoymadson@gmail.com 3 years ago
parent
commit
3592848c53
  1. 14
      Emacs/core-settings.el
  2. 12
      Emacs/keybinds.el
  3. 11
      Emacs/search.el

14
Emacs/core-settings.el

@ -136,13 +136,17 @@
(projectile-mode 1)
;; Make projectile mode-line more minimal
(defun macoy-projectile-mode-line ()
(format " [%s]" (projectile-project-name))
(when (string-equal (user-login-name) "macoy")
(defun macoy-projectile-mode-line ()
(format " [%s]" (projectile-project-name))
)
(setq projectile-mode-line-function 'macoy-projectile-mode-line)
)
(setq projectile-mode-line-function 'macoy-projectile-mode-line)
;; Older version syntax
;; (setq projectile-mode-line '(:eval (format " [%s]" (projectile-project-name))))
(when (string-equal (user-login-name) "mmadson")
;; Older version syntax
(setq projectile-mode-line '(:eval (format " [%s]" (projectile-project-name))))
)
;;
;; File-related shortcuts

12
Emacs/keybinds.el

@ -91,6 +91,18 @@
;; Go to first character of line, not beginning of line. Was move-beginning-of-line
(global-set-key (kbd "<home>") 'back-to-indentation)
;; Go to end of line if multiple-cursors is active. This is important because you
;; might be editing lines which wrap without your knowledge
(defun macoy-end-of-line ()
(interactive)
(if (bound-and-true-p multiple-cursors-mode)
(call-interactively 'end-of-line)
(call-interactively 'end-of-visual-line)
)
)
(global-set-key (kbd "<end>") 'macoy-end-of-line)
;; Toggle comment lines (same keybind as Sublime). This also works for regions
(global-set-key (kbd "C-/") 'comment-line)

11
Emacs/search.el

@ -62,7 +62,7 @@ If there's a string at point, offer that as a default."
;; Ag with browse directory
(define-key map (kbd "b") (lambda () (interactive) (macoy-select-do-search
'ag (read-directory-name "Directory: "))))
;; Agg with project filter
;; Ag with project filter
(define-key map (kbd "f") (lambda () (interactive) (macoy-select-do-search
'macoy-ag-with-project-filter (read-directory-name "Directory: "))))
;; Codesearch source with filter (directory defined by `codesearch-dir-to-index', aka use ~/.csearchindex)
@ -111,7 +111,7 @@ If there's a string at point, offer that as a default."
(macoy-select-search-minor-mode 1)
))
(global-set-key (kbd "C-M-f") 'macoy-select-search)
(global-set-key (kbd "C-e") 'macoy-select-search)
;; Searching in files (Ag)
;; Make ag.el reuse the same *ag* buffer for all your searches:
@ -293,6 +293,13 @@ If there's a string at point, offer that as a default."
;; (isearch-search)
;; (call-interactively 'isearch-forward)
(isearch-yank-string (buffer-substring (region-beginning) (region-end)))
;; Clear the mark for two reasons:
;; 1. Occur will only search the region, but whenever I use occur I expect
;; it to show me all results in the entire file
;; 2. I don't like how it looks visually when the mark is expanding while I'm going
;; through results.
;; I never use isearch to change my region, so this seemed like an acceptable tradeoff
(setq mark-active nil)
)
)
(global-set-key (kbd "C-f") 'macoy-isearch-search-mark)

Loading…
Cancel
Save