Skip to content

Commit

Permalink
Merge pull request #2 from jeffgran-dox/master
Browse files Browse the repository at this point in the history
emacs 29 and other changes from work
  • Loading branch information
jeffgran authored Jan 20, 2024
2 parents d4eceed + a0da419 commit 055b2ac
Show file tree
Hide file tree
Showing 22 changed files with 167 additions and 79 deletions.
1 change: 0 additions & 1 deletion init.el
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
(add-to-list 'load-path (concat user-emacs-directory "jg"))
(load-library "jg-init")
(put 'downcase-region 'disabled nil)
2 changes: 1 addition & 1 deletion jg/custom.el
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'(magit-push-arguments nil)
'(markdown-command "maruku")
'(package-selected-packages
'(dired-filter doom-modeline yard-mode which-key lsp-ui avy vue-mode forge git-link persp-projectile xterm-color hotfuzz selectrum-prescient amx selectrum k8s-mode poly-markdown lsp-mode company-native-complete company-go flymake-go jenkinsfile-mode tide elixir-mode graphql-mode lsp-typescript company-terraform swift-mode web-mode fish-completion fish-mode enh-ruby-mode rubocop undo-tree dired-subtree company-flow flycheck-flow flow-mode zoom-frm yaml-mode ws-butler vkill vimrc-mode use-package unicode-fonts swbuff ssh smooth-scroll smartparens slim-mode scad-mode rust-mode ruby-additional rspec-mode redo+ rbenv rake rainbow-mode rainbow-delimiters python-mode projectile prodigy processing-mode popwin ponylang-mode php-mode pbcopy paredit pallet nyan-mode multiple-cursors modeline-posn maxframe magit lua-mode less-css-mode keyfreq jsx-mode json-mode js2-mode jg-quicknav idle-highlight-mode htmlize haml-mode git-timemachine ggtags flycheck-package flycheck-cask expand-region exec-path-from-shell eww-lnum ensime elscreen-buffer-group drag-stuff dired+ deferred csv-mode coffee-mode browse-kill-ring back-button ag adaptive-wrap))
'(dired-filter doom-modeline yard-mode which-key lsp-ui avy vue-mode forge git-link persp-projectile xterm-color hotfuzz amx selectrum k8s-mode poly-markdown lsp-mode company-native-complete company-go flymake-go jenkinsfile-mode tide elixir-mode graphql-mode lsp-typescript company-terraform swift-mode web-mode fish-completion fish-mode enh-ruby-mode rubocop undo-tree dired-subtree company-flow flycheck-flow flow-mode zoom-frm yaml-mode ws-butler vkill vimrc-mode use-package unicode-fonts swbuff ssh smartparens slim-mode scad-mode rust-mode ruby-additional rspec-mode redo+ rbenv rake rainbow-mode rainbow-delimiters python-mode projectile prodigy processing-mode popwin ponylang-mode php-mode pbcopy paredit pallet nyan-mode multiple-cursors modeline-posn maxframe magit lua-mode less-css-mode keyfreq jsx-mode json-mode js2-mode jg-quicknav idle-highlight-mode htmlize haml-mode git-timemachine ggtags flycheck-package flycheck-cask expand-region exec-path-from-shell eww-lnum ensime elscreen-buffer-group drag-stuff dired+ deferred csv-mode coffee-mode browse-kill-ring back-button ag adaptive-wrap))
'(persp-state-default-file "~/.emacs.d/.persp")
'(safe-local-variable-values
'((encoding . utf-8)
Expand Down
63 changes: 23 additions & 40 deletions jg/jg-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@

(define-key jg-navigation-mode-map (kbd "C-x C-b") 'ibuffer)

(define-key jg-navigation-mode-map (kbd "<C-tab>") #'(lambda () (interactive) (if selectrum-is-active
(selectrum-next-candidate)
(define-key jg-navigation-mode-map (kbd "<C-tab>") #'(lambda () (interactive) (if (minibufferp)
(vertico-next)
(call-interactively 'persp-switch-to-buffer*))))
(define-key jg-navigation-mode-map (kbd "C-v") 'persp-switch-to-buffer*)

Expand All @@ -145,6 +145,8 @@
;;(define-key jg-navigation-mode-map (kbd "C-o") 'jg-quicknav)
(define-key jg-navigation-mode-map (kbd "C-S-o") 'projectile-find-file)
(define-key jg-navigation-mode-map (kbd "C-o") 'find-file)
(define-key jg-navigation-mode-map (kbd "C-x C-r") 'recentf-open)
(define-key jg-navigation-mode-map (kbd "H-p x r") 'projectile-recentf)
(define-key jg-navigation-mode-map (kbd "M-o") 'find-file-at-point-with-line)
(define-key jg-navigation-mode-map (kbd "C-/") #'(lambda ()
(interactive)
Expand All @@ -157,18 +159,10 @@
(define-key jg-navigation-mode-map (kbd "C->") 'back-button-global-forward)
;; same, but only within the current file

(defun jg-back-button ()
(interactive)
(cond (selectrum-is-active (selectrum-backward-kill-sexp))
(t (back-button-local-backward) )))

(defun jg-forward-button ()
(interactive)
(cond (selectrum-is-active nil)
(t (back-button-local-forward))))

(define-key jg-navigation-mode-map (kbd "C-,") 'jg-back-button)
(define-key jg-navigation-mode-map (kbd "C-.") 'jg-forward-button)
(define-key jg-navigation-mode-map (kbd "C-,") #'(lambda () (interactive) (if (minibufferp) (vertico-directory-up) (back-button-local-backward))))
(define-key jg-navigation-mode-map (kbd "C-.") #'(lambda () (interactive) (if (minibufferp) (vertico-insert) (back-button-local-forward))))
;;(define-key jg-navigation-mode-map (kbd "C-d") #'(lambda () (interactive) (if (minibufferp) (vertico-delete-buffer) (back-button-local-forward))))
(define-key vertico-map (kbd "C-d") 'vertico-delete-buffer)

;; lsp mode
(define-key jg-navigation-mode-map (kbd "H-M-.") 'lsp-find-definition)
Expand Down Expand Up @@ -284,17 +278,30 @@
(define-key jg-code-mode-map (kbd "C-M-z") 'undo-tree-visualize)


(defun switch-to-shell ()
(interactive)
(let ((buf (seq-find '(lambda (b)
(with-current-buffer b
(and (eq major-mode 'shell-mode)
(not (null (get-buffer-process
(current-buffer)))))))
(persp-buffer-list-filter (buffer-list)))))
(if (bufferp buf)
(switch-to-buffer buf)
(shell))))

(define-key jg-code-mode-map (kbd "C-x s") 'shell)
(define-key jg-navigation-mode-map (kbd "C-x C-s") 'switch-to-shell)
(define-key jg-code-mode-map (kbd "C-x C-s") 'switch-to-shell)
(define-key jg-code-mode-map (kbd "M-s") nil)
(define-key jg-code-mode-map (kbd "M-s") 'save-buffer)
(define-key jg-code-mode-map (kbd "C-M-j") 'join-line)

;;*******************
;; Search/Replace/Etc
;;*******************
;;(define-key jg-code-mode-map (kbd "C-S-f") 'ag)
(define-key jg-code-mode-map (kbd "C-S-f") 'projectile-ag)
(define-key jg-code-mode-map (kbd "C-S-f") 'ag)
;;(define-key jg-code-mode-map (kbd "C-S-f") 'projectile-ag)
(define-key jg-code-mode-map (kbd "C-M-f") 'grep-buffers)
(define-key jg-code-mode-map (kbd "C-S-r") 'query-replace)

Expand Down Expand Up @@ -333,13 +340,6 @@
(transient-append-suffix 'magit-dispatch "r" '("s" "Status" magit-status))


;; set up a new help key prefix since I use C-h for movement
;; this breaks shit. apparently it has to be a single key, not a sequence.
;; (if window-system
;; (progn
;; (setq help-char ?\M-?)
;; (global-set-key "\M-?" 'help-for-help)
;; ))
(define-key help-mode-map (kbd "B") 'help-go-back)
(define-key help-mode-map (kbd "F") 'help-go-forward)

Expand Down Expand Up @@ -381,19 +381,6 @@






;; for some reason they don't take effect unless I bind them every time, in this hook.
;; (add-hook 'ido-setup-hook 'ido-jg-keys)
;; (defun ido-jg-keys ()
;; "Add my keybindings for ido."
;; (define-key ido-completion-map (kbd "C-n") 'ido-next-match)
;; (define-key ido-completion-map (kbd "C-p") 'ido-prev-match)
;; )



(define-key isearch-mode-map (kbd "M-f") 'isearch-repeat-forward)
(define-key isearch-mode-map (kbd "M-r") 'isearch-repeat-backward)
(define-key isearch-mode-map (kbd "C-q") 'isearch-abort)
Expand Down Expand Up @@ -542,7 +529,3 @@


(define-key c++-mode-map (kbd "TAB") nil)

(define-key selectrum-minibuffer-map (kbd "C-,") 'selectrum-backward-kill-sexp)
;;(define-key selectrum-minibuffer-map (kbd "C-.") 'selectrum-select-from-history)
;;(define-key selectrum-minibuffer-map (kbd "<RET>") 'selectrum-select-current-candidate)
126 changes: 99 additions & 27 deletions jg/jg-modes.el
Original file line number Diff line number Diff line change
Expand Up @@ -322,27 +322,29 @@

(add-hook 'ruby-mode-hook #'(lambda() (flycheck-mode))) ; for rubocop/ruby-mode
(add-hook 'enh-ruby-mode-hook #'(lambda() (flycheck-mode))) ; for rubocop/enh-ruby-mode
(add-hook 'ruby-ts-mode-hook #'(lambda() (flycheck-mode))) ; for rubocop/enh-ruby-mode
(add-hook 'enh-ruby-mode-hook 'lsp-deferred)
(add-hook 'enh-ruby-mode-hook 'yard-mode)
(add-hook 'enh-ruby-mode-hook 'eldoc-mode)
(setq flycheck-rubocoprc ".ruby-style.yml")

(add-to-list 'interpreter-mode-alist '("ruby" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.json_builder$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rb$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.builder\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.json_builder\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Guardfile\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Capfile\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Thorfile\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Vagrantfile\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Fastfile" . enh-ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("\\.json_builder$" . ruby-ts-mode))
;;(add-to-list 'auto-mode-alist '("\\.rb$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("\\.builder\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("\\.json_builder\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("Guardfile\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-ts-mode))
(add-to-list 'auto-mode-alist '("Fastfile" . ruby-ts-mode))


(require 'xterm-color)
Expand Down Expand Up @@ -412,16 +414,63 @@
(amx-mode)

;; minibuffer completions vertical display
(selectrum-mode)
(selectrum-prescient-mode) ; not just prefix matching in minibuffer completions
(hotfuzz-selectrum-mode) ; fuzzy matching in completion
(setq prescient-filter-method '(literal fuzzy regexp initialism))
(setq prescient-use-char-folding t)
;(setq prescient-filter-method '(literal fuzzy regexp initialism))
(setq prescient-filter-method '(literal initialism prefix regexp fuzzy)
prescient-use-char-folding t
prescient-use-case-folding 'smart
prescient-sort-full-matches-first t ; Works well with `initialism'.
prescient-sort-length-enable t
vertico-prescient-enable-sorting nil)

(setq completion-ignore-case t)
(setq read-file-name-completion-ignore-case t)
;;(setq completion-styles '(basic substring flex initials))

(vertico-prescient-mode 1)
(prescient-persist-mode 1)
(setq vertico-cycle t)

;;(setq selectrum-display-action '(display-buffer-in-tab)) ;; there are different options
(setq selectrum-display-action nil) ;; default
(defun vertico-delete-buffer ()
(interactive)
(persp-kill-buffer* (vertico--candidate))
(setq vertico--candidates (persp-current-buffer-names)
vertico--total (length (persp-current-buffer-names))
vertico--index (min vertico--total 0)
)
)
;;completion-table-with-predicate

;; taken from https://github.com/minad/vertico/wiki#pre-select-previous-directory-when-entering-parent-directory-from-within-find-file
;;-----------------------------------------------------------------------------
(defvar previous-directory nil
"The directory that was just left. It is set when leaving a directory and
set back to nil once it is used in the parent directory.")

(defun set-previous-directory ()
"Set the directory that was just exited from within find-file."
;; (when (> (minibuffer-prompt-end) (point))
(when t
(save-excursion
(goto-char (1- (point)))
(when (search-backward "/" (minibuffer-prompt-end) t)
;; set parent directory
(setq previous-directory (buffer-substring (1+ (point)) (point-max)))
;; set back to nil if not sorting by directories or what was deleted is not a directory
(when (not (string-suffix-p "/" previous-directory))
(setq previous-directory nil))
t))))

(advice-add #'vertico-directory-up :before #'set-previous-directory)

(define-advice vertico--update (:after (&rest _) choose-candidate)
"Pick the previous directory rather than the prompt after updating candidates."
(cond
(previous-directory ; select previous directory
(setq vertico--index (or (seq-position vertico--candidates previous-directory)
vertico--index))
(setq previous-directory nil))))

;;-----------------------------------------------------------------------------


(require 'ws-butler)
Expand Down Expand Up @@ -461,12 +510,10 @@


(recentf-mode 1)
(setq recentf-max-saved-items 100)
(setq recentf-max-saved-items nil)


;;(require 'smooth-scroll)
;;(smooth-scroll-mode nil)
;;(setq smooth-scroll/vscroll-step-size 4)
(pixel-scroll-precision-mode)
(setq scroll-preserve-screen-position "yes")


Expand Down Expand Up @@ -522,3 +569,28 @@
(require 'keyfreq)
(keyfreq-mode 1)
(keyfreq-autosave-mode 1)


;; tree-sitter
(setq treesit-language-source-alist
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
(cmake "https://github.com/uyha/tree-sitter-cmake")
(css "https://github.com/tree-sitter/tree-sitter-css")
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
(go "https://github.com/tree-sitter/tree-sitter-go")
(html "https://github.com/tree-sitter/tree-sitter-html")
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
(json "https://github.com/tree-sitter/tree-sitter-json")
(make "https://github.com/alemuller/tree-sitter-make")
(markdown "https://github.com/ikatyang/tree-sitter-markdown")
(python "https://github.com/tree-sitter/tree-sitter-python")
(ruby "https://github.com/tree-sitter/tree-sitter-ruby")
(toml "https://github.com/tree-sitter/tree-sitter-toml")
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
(yaml "https://github.com/ikatyang/tree-sitter-yaml")))

;;(mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist)) ; compiles all languages above ^ - should be done periodically to get latest versions


(global-emojify-mode)
2 changes: 2 additions & 0 deletions jg/jg-setup.el
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@
(setq find-program "C:/GnuWin32/bin/find.exe")
(setq grep-program "C:/GnuWin32/bin/grep.exe")
))

(put 'downcase-region 'disabled nil)
52 changes: 42 additions & 10 deletions jg/jg-straight.el
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

(straight-use-package 'adaptive-wrap)
(straight-use-package 'ag)
;;(straight-use-package 'alert)
(straight-use-package 'amx)
(straight-use-package 'async)
(straight-use-package 'avy)
Expand All @@ -25,6 +24,26 @@
(straight-use-package 'browse-kill-ring)
(straight-use-package 'cask)
(straight-use-package 'coffee-mode)
;; (use-package combobulate
;; :preface
;; ;; You can customize Combobulate's key prefix here.
;; ;; Note that you may have to restart Emacs for this to take effect!
;; (setq combobulate-key-prefix "C-c o")

;; ;; Optional, but recommended.
;; ;;
;; ;; You can manually enable Combobulate with `M-x
;; ;; combobulate-mode'.
;; :hook ((python-ts-mode . combobulate-mode)
;; (js-ts-mode . combobulate-mode)
;; (css-ts-mode . combobulate-mode)
;; (yaml-ts-mode . combobulate-mode)
;; (json-ts-mode . combobulate-mode)
;; (typescript-ts-mode . combobulate-mode)
;; (tsx-ts-mode . combobulate-mode))
;; ;; Amend this to the directory where you keep Combobulate's source
;; ;; code.
;; :load-path "combobulate")
(straight-use-package 'company)
(straight-use-package 'company-flow)
(straight-use-package 'company-go)
Expand All @@ -40,8 +59,7 @@
(straight-use-package 'doom-modeline)
(straight-use-package 'drag-stuff)
(straight-use-package 'elixir-mode)
;;(straight-use-package 'elscreen)
;;(straight-use-package 'elscreen-buffer-group)
(straight-use-package 'emacsql-sqlite-builtin)
(straight-use-package 'emojify)
(straight-use-package 'enh-ruby-mode)
(straight-use-package 'epl)
Expand All @@ -61,10 +79,9 @@
(straight-use-package 'git-timemachine)
(straight-use-package 'go-mode)
(straight-use-package 'graphql-mode)
(straight-use-package 'grizzl)
(straight-use-package 'guix)
(straight-use-package 'haml-mode)
(straight-use-package 'hotfuzz)
;;(straight-use-package 'hotfuzz)
(straight-use-package 'helm)
(straight-use-package 'htmlize)
(straight-use-package 'idle-highlight-mode)
(straight-use-package 'jenkinsfile-mode)
Expand Down Expand Up @@ -118,14 +135,10 @@
(straight-use-package 's)
(straight-use-package 'scad-mode)
(straight-use-package 'scss-mode)
(straight-use-package 'selectrum)
(straight-use-package 'selectrum-prescient)
(straight-use-package 'shut-up)
;;(straight-use-package 'slack)
(straight-use-package 'slim-mode)
(straight-use-package 'smartparens)
(straight-use-package 'smartrep)
(straight-use-package 'smooth-scroll)
(straight-use-package 'ssh)
(straight-use-package 'swift-mode)
(straight-use-package 'terraform-mode)
Expand All @@ -134,6 +147,25 @@
(straight-use-package 'undo-tree)
(straight-use-package 'unicode-fonts)
(straight-use-package 'use-package)
(use-package vertico
:straight (:files (:defaults "extensions/*"))
:init
(vertico-mode))
;; Configure directory extension.
(use-package vertico-directory
:after vertico
:ensure nil
;; More convenient directory navigation commands
:bind (:map vertico-map
;; these don't work because they get overridden by jg-navigation-mode
;; ("RET" . vertico-directory-enter)
;; ("DEL" . vertico-directory-delete-char)
;; ("M-DEL" . vertico-directory-delete-word)
;; ("C-," . vertico-directory-delete-word)
)
;; Tidy shadowed file names
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
(straight-use-package 'vertico-prescient)
(straight-use-package 'vimrc-mode)
(straight-use-package 'vue-mode)
(straight-use-package 'web-mode)
Expand Down
Binary file added tree-sitter/libtree-sitter-bash.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-cmake.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-css.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-elisp.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-go.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-html.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-javascript.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-json.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-make.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-markdown.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-python.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-ruby.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-toml.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-tsx.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-typescript.so
Binary file not shown.
Binary file added tree-sitter/libtree-sitter-yaml.so
Binary file not shown.

0 comments on commit 055b2ac

Please sign in to comment.