Browse Source

Shortcuts for things, editable codesearch results, misc stuff

* Added shortcut for toggling line wrapping (useful when using
  multiple-cursors)
* Added shortcut for toggling whitespace mode
* Codesearch-search-src now uses the same query function as the rest
of select-search
* Added shortcut for opening files normally in Dired
* Codesearch can now take a regex. The quoting wasn't working anyways
* Read-only-mode is disabled in codesearch results so you can
eliminate things with C-k
master
macoymadson@gmail.com 5 years ago
parent
commit
9b1fccfaa6
  1. 7
      Emacs/build-systems.el
  2. 9
      Emacs/dotEmacs.el
  3. 3
      Emacs/keybinds.el
  4. 13
      Emacs/search.el
  5. 2
      Emacs/source-control.el
  6. 18
      Emacs/visual-early.el

7
Emacs/build-systems.el

@ -85,3 +85,10 @@
(global-set-key (kbd "<f7>") 'macoy-build-system-build)
(global-set-key (kbd "S-<f7>") 'macoy-build-system-select-then-build)
;; Doesn't work because it needs to select the buffer. This shouldn't happen for search results too, but would
;; (defun macoy-on-compilation-mode ()
;; (end-of-buffer)
;; )
;; (add-hook 'compilation-mode-hook 'macoy-on-compilation-mode)

9
Emacs/dotEmacs.el

@ -104,11 +104,12 @@
;; - Isearch: Customize colors
;; - Search Everything/projectile-find-files which will work on non-vc dirs
;; - Code reference to org: mark block of code, run command; command copies string to clipboard with file:line org link and code block. Good for deep dives where you have to take notes
;;
;; - Quick shortcut to switch to header/source file
;; Split todo
;; - Put all things which are user-specific at the top of respective files
;; - Search: Make Codesearch data folder user-specific
;;;;
;; Criticism improvements:
;; - [DONE] Select word at point
;; - [DONE] Reopen closed file
@ -131,6 +132,7 @@
;; Use re-builder to create a regex by seeing the results of it in the current buffer (super awesome)
;; Hit C-f while in ido to disable all completion (for when you're fighting it)
;; Amazing multiline editing: C-f to isearch-forward, then C-a to see all results, then e to edit all lines
;; diff-buffer-with-file to see a diff of current (unsaved) modifications
;; Used to load separate configuration files I've created. Order matters so they're scattered a bit
(setq user-init-dir "~/.emacs.d/macoy")
@ -205,7 +207,8 @@
(load-user-file "visual-early.el")
;; Stuff unique to certain machines (mine here for reference)
(when (string-equal (user-login-name) "macoy")
(when (or (string-equal (user-login-name) "macoy")
(string-equal (user-login-name) "mmadson"))
(load-file "~/.emacs-this-machine-only.el")
)

3
Emacs/keybinds.el

@ -148,8 +148,9 @@
(dired-hide-details-mode 1))
(add-hook 'dired-mode-hook 'macoy-dired-mode-setup)
;; Reuse buffer (from http://ergoemacs.org/emacs/emacs_dired_tips.html)
;; Was dired-advertised-find-file
;; Was dired-find-file
(define-key dired-mode-map (kbd "<return>") 'dired-find-alternate-file)
(define-key dired-mode-map (kbd "S-<return>") 'dired-find-file)
;; Was dired-up-directory
(define-key dired-mode-map (kbd "<backspace>") (lambda () (interactive) (find-alternate-file "..")))

13
Emacs/search.el

@ -203,6 +203,8 @@ If there's a string at point, offer that as a default."
;; Refer to ag.el for customization
(define-compilation-mode macoy-codesearch-mode "Codesearch"
"Codesearch results compilation mode"
;; This is so you can delete results with C-S-k. This doesn't break n and p which is cool
(read-only-mode 0)
)
(define-key macoy-codesearch-mode-map (kbd "p") #'compilation-previous-error)
@ -215,9 +217,7 @@ If there's a string at point, offer that as a default."
(setq macoy-codesearch-ignore-lines-pattern "_ast\.|_autogen")
(defun macoy-codesearch-search-with-filter-directory (pattern directory)
(interactive
(list
(read-string "Search: " (thing-at-point 'symbol))))
(interactive (list (macoy-read-from-minibuffer "Search string")))
;; Use the compile command so we have nice clickable links
;; Note that without regexp-quote, this does support regexes. I don't want them in my case
;; Args explanation: -n (Line numbers) -i (ignore case)
@ -229,7 +229,8 @@ If there's a string at point, offer that as a default."
;; This temp-file thing sucks but seems necessary for Windows
(compilation-start (format "%s -n -i \"%s\" > %s && grep -i -E -v \"%s\" %s && rm %s"
codesearch-csearch-exe
(regexp-quote pattern)
;; (regexp-quote pattern) ;; This doesn't work because more escape(\) chars are added
pattern
codesearch-temp-file
macoy-codesearch-ignore-lines-pattern
codesearch-temp-file
@ -240,9 +241,7 @@ If there's a string at point, offer that as a default."
)
(defun macoy-codesearch-search-src (pattern)
(interactive
(list
(read-string "Search: " (thing-at-point 'symbol))))
(interactive (list (macoy-read-from-minibuffer "Search string")))
(macoy-codesearch-search-with-filter-directory pattern nil)
)

2
Emacs/source-control.el

@ -44,6 +44,8 @@
)
)
(global-set-key (kbd "<f6>") 'macoy-svn-status)
(setq macoy-commit-message-backup "~/Macoy_Emacs_CommitMessage_Backup.txt")
;; SVN and Magit commit message finished
(defun macoy-commit-message-done ()

18
Emacs/visual-early.el

@ -94,6 +94,15 @@
(my-global-adaptive-wrap-mode 1)
(setq-default adaptive-wrap-extra-indent 1)
;; Toggle off wrapping (useful for multiple-cursors operations)
(defun macoy-toggle-wrapping ()
"Toggle line wrapping for the current buffer"
(interactive)
(toggle-truncate-lines)
)
(global-set-key (kbd "C-<f9>") 'macoy-toggle-wrapping)
;; Show whitespace
;; Not enabled globally because it looks a bit too ugly for my tastes; I can toggle it when needed
;;(require 'whitespace)
@ -102,6 +111,15 @@
(setq whitespace-line-column 100)
(setq whitespace-newline nil)
(defun macoy-toggle-whitespace-mode ()
(interactive)
(if (bound-and-true-p whitespace-mode)
(whitespace-mode 0)
(whitespace-mode)
)
)
(global-set-key (kbd "S-<f9>") 'macoy-toggle-whitespace-mode)
;;
;; Auto Theming
;;

Loading…
Cancel
Save