Browse Source

Added codesearch, iy-go-to-char, ag filters, binding customizations

* Added hack for working around edebug and C-x rebindings bug
* Turned on global-auto-revert-mode (auto reload files if changed and
  no modifications)
* Fix macoy-kill-transient-buffers not killing Compile-Log
* Commented the delight code because diminish hides all those modes
* Added iy-go-to-char and bindings
* Added ag file filters to speed it up when doing code searches
* Swapped macoy-add-edit-newline* function bindings to be more natural
* Dired: Move up a directory with backspace; hide details by default
* Jump to next compilation error with n, back with p (in compilation
  window; these were mostly for codesearch results but should be nice
  for actual compile error logs too)
master
Macoy Madson 5 years ago
parent
commit
c661064612
  1. 99
      Emacs/emacsConfig.txt
  2. 1
      Emacs/emacsPackages.txt

99
Emacs/emacsConfig.txt

@ -38,18 +38,19 @@
;; https://stackoverflow.com/questions/885793/emacs-error-when-calling-server-start
;; 4. Setup magit credentials:
;; https://stackoverflow.com/questions/22580873/how-can-i-configure-magit-to-use-my-github-user-name
;; 5. If you want to use codesearch (fancy ultra fast indexed code searching), install it:
;; https://github.com/google/codesearch
;; ...then set codesearch-csearch-exe and codesearch-cindex-exe to their respective executable locations
;; Search for codesearch in this file to adjust indexing settings
;;
;; TODO (there are more scattered around this file):
;; - TAGS has to be set up per-project; doesn't allow cross-repository finding afaik
;; It does, you just need to set tags-table-list.
;; See https://www.gnu.org/software/emacs/manual/html_node/emacs/Select-Tags-Table.html
;; - Would be nice to have buffers and files merged like Sublime's C-p (but not essential)
;; - Buffer reverting automatically instantly if no changes, otherwise prompt the file has
;; been changed underneath and ask to reload or save over
;; - Tab key behavior confuses me especially in plaintext files
;; - Get back and forward working (back doesn't work too well)
;; - Build system selection via Ido custom list (like Sublime's C-S-b)
;; - Ag filter files (esp. auto-generated files)
;; - Determine what smooth-scrolling actually does (if anything)
;; - Copy line when nothing is marked
;; - Ido jump to file anywhere does more harm than good (especially when creating new files)
@ -70,22 +71,29 @@
;; - Fix windows OpenSSL/TLS support
;; - Fix multiple-cursors slow parenthesis completion (due to pause to show matching?)
;; - Build system management (use (funcall (intern "my-func-name")) to ido select build system?)
;; - Reliable quick mark set and return for jumping to X from Y then going back to Y
;; - Jump copy thing at point then paste back at start
;; e.g. the macro would avy prompt, jump to destination, copy it, then go back and paste it at start mark
;; - Make new line above/below and start typing
;; Is this just a problem with autocomplete not being fast enough?
;; Learn how to do custom mode for jumping back
;; - Expand-region does strange things with the region. Eg. C-s-' after moving cursor, expand region then type over (damn it; it went away after re-evaluating .emacs)
;; - Start using Abbrev more
;; - Create an explicit setup for jump to go back to last location (don't rely on marks; just store position)
;; i.e. Reliable quick mark set and return for jumping to X from Y then going back to Y
;; This would be useful without jumping too. Basically just use register and one key to set/jump to (C- vs C-S)
;; - It seems like iy-goto-char will eventually trip me up in its temporary mode
;; - Seems like it would be cool to have a "copy to references" thing which would take marked and
;; put it in a references.org file or something for deep code reading dives (what about projects?)
;; - Macoy-Codesearch should have something for whole word searches as well as sanitizing regex symbols
;;
;; Criticism improvements:
;; - [DONE] Select word at point
;; - [DONE] Reopen closed file
;; - [DONE-ish] Get find references working
;; - [DONE] Autorevert if no modifications (do tell me in modeline that this happened)
;; Eventually make tags-search and tags-loop-continue async and list results in a buffer
;; - Faster browse symbols (first, figure out where most symbols come from and eliminate; then separate projects?)
;; Separate lists by first letter for x26 speedup? (kindof defeats purpose if not knowing first letter)
;; Copy swiper-all requiring multiple letters? (this doesn't seem to help too much
;; Copy swiper-all requiring multiple letters? (this doesn't seem to help too much)
;; - Faster/better Ag
;; - Autorevert if no modifications (do tell me in modeline that this happened)
;; - Swiper is too damn slow
@ -108,6 +116,11 @@
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
;; This is a stupid hack around an apparent bug in edebug.
;; If set, don't define C-x anywhere. If C-x is defined then edebug complains about it not being a prefix key
;; You'll need to restart in order for it to work
(setq macoy-edebug-prefix-hack nil)
;; Some settings from http://ergoemacs.org/emacs/emacs_make_modern.html
;; make cursor movement stop in between camelCase words. (don't)
@ -125,6 +138,9 @@
;; remember cursor position, for emacs 25.1 or later
(save-place-mode 1)
;; Make garbage collection happen less often (https://github.com/lewang/flx)
(setq gc-cons-threshold 20000000)
;; stop creating those backup~ files
(setq make-backup-files nil)
@ -137,6 +153,9 @@
;; save/restore opened files
(desktop-save-mode 1)
;; Automatically revert buffers if file changes underneath (unless there are unsaved changes)
(global-auto-revert-mode 1)
;; Set cursor to I-beam
(modify-all-frames-parameters (list (cons 'cursor-type '(bar . 2))))
@ -166,7 +185,7 @@
(if (get-buffer "*Ediff Registry*") (kill-buffer "*Ediff Registry*"))
(if (get-buffer "*Help*") (kill-buffer "*Help*"))
(if (get-buffer "*Completions*") (kill-buffer "*Completions*"))
(if (get-buffer "*Compile-log*") (kill-buffer "*Compile-log*"))
(if (get-buffer "*Compile-Log*") (kill-buffer "*Compile-Log*"))
)
;; Store recently closed files so we can easily reopen them
@ -263,9 +282,10 @@
;; powerline-vim-theme
;; powerline-nano-theme
;; Make some modes have shorter names in the modeline
(require 'delight)
(delight 'abbrev-mode " Abv" "Abbrev")
;; Make some modes have shorter names in the modeline (replaced by diminish)
;; (require 'delight)
;; This is no longer necessary because Abbrev is diminished below
;; (delight 'abbrev-mode " Abv" "Abbrev")
(setq projectile-mode-line '(:eval (format " [%s]" (projectile-project-name))))
;; Hide these modes completely (for a more minimal look)
@ -275,6 +295,7 @@
(diminish 'yas-minor-mode)
(diminish 'auto-complete-mode)
(diminish 'visual-line-mode)
(diminish 'org-indent-mode)
;; The following might not do anything/are unnecessary
(diminish 'adaptive-wrap-prefix-mode)
(diminish 'wrap-region-mode)
@ -354,8 +375,10 @@
(global-set-key (kbd "M-c") 'macoy-quick-jump-copy-paste)
;; Make garbage collection happen less often (https://github.com/lewang/flx)
(setq gc-cons-threshold 20000000)
;; Go to char. This is like avy quick jump but instead just goes to the next one, not any onscreen
(require 'iy-go-to-char)
(global-set-key (kbd "C-n") 'iy-go-to-char)
(global-set-key (kbd "C-S-n") 'iy-go-to-char-backward)
;; Show whitespace
;; Not enabled globally because it looks a bit too ugly for my tastes; I can toggle it when needed
@ -384,11 +407,32 @@
;; Searching in files (Ag)
;; Make ag.el reuse the same *ag* buffer for all your searches:
(setq ag-reuse-buffers 't)
;; TODO: Figure out how to ignore files
;; Doesn't work (sometimes it will search for "--" or some other random thing seemingly)
;;(setq ag-arguments '("--before" "3" "--after" "3"))
(setq ag-arguments '("--smart-case" "--stats" "-G"
"(\\.txt|\\.org|\\.cpp|\\.c|\\.h|\\.inl|\\.html|\\.css|\\.lua|\\.js|\\.py|\\.cdm|\\.el)"
"--ignore" "AutoGen"))
(global-set-key (kbd "C-S-f") 'ag)
;; Codesearch: Use a pregenerated index to search files. Requires Codesearch
(when (string-equal (user-login-name) "mmadson")
(setq codesearch-csearch-exe "c:/Users/mmadson/go/bin/csearch.exe")
(setq codesearch-cindex-exe "c:/Users/mmadson/go/bin/cindex.exe")
(setq codesearch-dir-to-index "f:/CJUNCTIONS/src")
)
(defun macoy-codesearch-index-src ()
(interactive)
(start-process "CodesearchIndex" "*Codesearch-Index*" codesearch-cindex-exe codesearch-dir-to-index)
)
(defun macoy-codesearch-search (pattern)
(interactive
(list
(read-string "Pattern: " (thing-at-point 'symbol))))
;; Just use the compile command so we have nice clickable links
;; Refer to ag.el or codesearch.el for other ways to do this. I did this way because it's simple
(compile (format "%s -n %s" codesearch-csearch-exe pattern))
)
;; Simpleclip makes system clipboard and emacs kill ring separate
;; This is sane copy paste behavior
(require 'simpleclip)
@ -909,8 +953,9 @@
(call-interactively 'indent-for-tab-command)
)
(global-set-key (kbd "C-<return>") 'macoy-add-edit-newline-after)
(global-set-key (kbd "S-<return>") 'macoy-add-edit-newline-before)
(global-set-key (kbd "C-S-<return>") 'macoy-add-edit-newline-after)
(global-set-key (kbd "C-S-<return>") 'macoy-add-edit-newline-before)
;;
;;
@ -922,7 +967,8 @@
;; Custom copy/paste functions for working with simpleclip and multiple-cursors
(define-key map (kbd "C-c") 'macoyCopy)
(define-key map (kbd "C-v") 'macoyPaste)
(define-key map (kbd "C-x") 'macoyCut)
(unless macoy-edebug-prefix-hack
(define-key map (kbd "C-x") 'macoyCut))
;; In case you need the dumb copy paste (or multiple cursors clipboard after exiting mc)
(define-key map (kbd "C-S-c") 'kill-ring-save)
(define-key map (kbd "C-S-v") 'yank)
@ -1018,7 +1064,8 @@
;; These are also set in my-keys mode with macoyCopy functions for multiple-cursors support,
;; overriding these defaults
(global-set-key (kbd "C-c") 'simpleclip-copy)
(global-set-key (kbd "C-x") 'simpleclip-cut)
(unless macoy-edebug-prefix-hack
(global-set-key (kbd "C-x") 'simpleclip-cut))
(global-set-key (kbd "C-v") 'simpleclip-paste)
;; point-to-register and jump-to-register (was reverse search)
@ -1054,6 +1101,20 @@
;; Replace all of a tag in all files
(global-set-key (kbd "M-a") 'tags-query-replace)
;; Dired customizations
(require 'dired)
;; Hide details by default (show with '(')
;; See http://ergoemacs.org/emacs/emacs_dired_tips.html
(defun macoy-dired-mode-setup ()
"To be run as a hook for `dired-mode'."
(dired-hide-details-mode 1))
(add-hook 'dired-mode-hook 'macoy-dired-mode-setup)
(define-key dired-mode-map (kbd "<backspace>") 'dired-up-directory)
;; Compilation mode customizations
(define-key compilation-mode-map (kbd "n") 'compilation-next-error)
(define-key compilation-mode-map (kbd "p") 'compilation-previous-error)
;; Make bindings work with org-mode
(with-eval-after-load 'org
(define-key org-mode-map (kbd "C-<tab>") nil)
@ -1163,7 +1224,7 @@ static char *gnus-pointer[] = {
("melpa" . "http://melpa.org/packages/"))))
'(package-selected-packages
(quote
(diminish engine-mode ivy expand-region ivy-xref everything magit dsvn delight adaptive-wrap web-beautify etags-select simpleclip yasnippet swiper auto-complete clang-format avy ag xah-find flx-ido ido-vertical-mode sublime-themes smooth-scrolling alect-themes base16-theme powerline darktooth-theme projectile smex helm-dash better-defaults multiple-cursors zenburn-theme marmalade-demo)))
(iy-go-to-char diminish engine-mode ivy expand-region ivy-xref everything magit dsvn delight adaptive-wrap web-beautify etags-select simpleclip yasnippet swiper auto-complete clang-format avy ag xah-find flx-ido ido-vertical-mode sublime-themes smooth-scrolling alect-themes base16-theme powerline darktooth-theme projectile smex helm-dash better-defaults multiple-cursors zenburn-theme marmalade-demo)))
'(pos-tip-background-color "#36473A")
'(pos-tip-foreground-color "#FFFFC8")
'(projectile-globally-ignored-directories

1
Emacs/emacsPackages.txt

@ -16,6 +16,7 @@ flx-ido 20180117.719 flx integration for ido
ido-vertical-mode 0.1.1 Makes ido-mode display vertically.
ivy
ivy-xref
iy-go-to-char
magit
marmalade-demo 0.0.5 a demonstration elpa package
multiple-cursors 20180406.1350 Multiple cursors for Emacs.

Loading…
Cancel
Save