Compare commits

..

3 Commits

View File

@ -184,6 +184,7 @@ Finish up
evil-goggles evil-goggles
avy avy
all-the-icons-ibuffer all-the-icons-ibuffer
drag-stuff
;; ace-window ;; ace-window
;; Mail ;; Mail
smtpmail smtpmail
@ -224,6 +225,7 @@ Finish up
org-fancy-priorities org-fancy-priorities
org-roam org-roam
org-download org-download
valign
;; Programming Languages ;; Programming Languages
highlight-quoted highlight-quoted
rustic rustic
@ -601,6 +603,46 @@ weren't working, until I randomly saw this in someone's init.el
(setq sentence-end-double-space nil) (setq sentence-end-double-space nil)
#+end_src #+end_src
~drag-stuff~ package to move lines around, here's a snippet that re-indents
#+begin_src emacs-lisp
(defun indent-region-advice (&rest ignored)
(let ((deactivate deactivate-mark))
(if (region-active-p)
(indent-region (region-beginning) (region-end))
(indent-region (line-beginning-position) (line-end-position)))
(setq deactivate-mark deactivate)))
(advice-add 'drag-stuff-up :after 'indent-region-advice)
(advice-add 'drag-stuff-down :after 'indent-region-advice)
(define-key prog-mode-map (kbd "M-<up>") #'drag-stuff-up)
(define-key prog-mode-map (kbd "M-<down>") #'drag-stuff-down)
(define-key prog-mode-map (kbd "M-<left>") #'drag-stuff-left)
(define-key prog-mode-map (kbd "M-<right>") #'drag-stuff-right)
#+end_src
Simple function more quickly align text
#+begin_src emacs-lisp
(defun joe/align-whitespace (beg end)
"Align column text in region by whitespace."
(interactive "r")
(align-regexp beg end "\\(\\s-*\\)\\s-" 1 0 t)
(indent-region beg end))
#+end_src
#+begin_src emacs-lisp
(add-hook 'csv-mode-hook #'csv-header-line)
(add-hook 'csv-mode-hook #'csv-align-mode)
(defun csv-align-visible ()
"Align visible fields."
(interactive)
(csv-align-fields nil (window-start) (window-end)))
(add-hook 'csv-mode-hook
(lambda ()
(define-key csv-mode-map (kbd "C-c C-a") 'csv-align-mode)))
#+end_src #+end_src
*** COMMENT Hydra *** COMMENT Hydra
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -776,7 +818,6 @@ weren't working, until I randomly saw this in someone's init.el
(evil-mode t) (evil-mode t)
(evil-global-set-key 'insert (kbd "C-w") #'evil-delete-backward-word) (evil-global-set-key 'insert (kbd "C-w") #'evil-delete-backward-word)
(evil-define-key 'normal 'global (kbd "q") 'avy-goto-word-0)
;; vv to expand selection to line ;; vv to expand selection to line
(evil-global-set-key 'visual (evil-global-set-key 'visual
@ -824,6 +865,7 @@ weren't working, until I randomly saw this in someone's init.el
(kbd "SPC ba") 'switch-to-buffer (kbd "SPC ba") 'switch-to-buffer
(kbd "SPC bb") 'consult-buffer (kbd "SPC bb") 'consult-buffer
(kbd "SPC bi") 'ibuffer (kbd "SPC bi") 'ibuffer
(kbd "SPC bu") 'recentf-open-most-recent-file
(kbd "SPC bm") 'joe/toggle-buffer-mode (kbd "SPC bm") 'joe/toggle-buffer-mode
(kbd "SPC br") 'joe/revert-buffer-no-confirm (kbd "SPC br") 'joe/revert-buffer-no-confirm
(kbd "SPC gg") 'magit-status (kbd "SPC gg") 'magit-status
@ -1073,7 +1115,8 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really
"^\\*cargo-run\\*" cargo-run-mode "^\\*cargo-run\\*" cargo-run-mode
"^\\*rustic-compilation\\*" rustic-compilation-mode "^\\*rustic-compilation\\*" rustic-compilation-mode
"^\\*ansi-term\\*$" term-mode "^\\*ansi-term\\*$" term-mode
"^\\*Async Shell Command\\*$" shell-mode ;; "^\\*Async Shell Command\\*$" shell-mode
"^\\*Async Shell Command\\*$"
("^\\*Warnings\\*$" . hide) ("^\\*Warnings\\*$" . hide)
help-mode help-mode
helpful-mode)) helpful-mode))
@ -1455,7 +1498,7 @@ Stuff to immediately switch to Jetbrains for debugging
(interactive) (interactive)
(shell-command (shell-command
(mapconcat #'shell-quote-argument (mapconcat #'shell-quote-argument
(list "rider" (list "pycharm"
"--line" "--line"
(int-to-string (line-number-at-pos)) (int-to-string (line-number-at-pos))
"--column" "--column"
@ -1549,35 +1592,20 @@ Stuff to immediately switch to Jetbrains for debugging
*** Embark *** Embark
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'embark) (require 'embark)
#+end_src
;; TODO Try using embark to kill this buffer These two lines allow you to kill buffers without a confirmation and without
(defun prot-simple-kill-buffer-current (&optional arg) closing the mini-buffer so you can quickly kill multiple buffers if needed. The
"Kill current buffer. odd looking ~'(t .t)~ is for specifying a default for all other actions.
With optional prefix ARG (\\[universal-argument]) delete the
buffer's window as well."
(interactive "P")
(let ((kill-buffer-query-functions nil))
(if (and arg (not (one-window-p)))
(kill-buffer-and-window)
(kill-buffer))))
(defun prot-simple-kill-buffer (buffer) #+begin_src emacs-lisp
"Kill current BUFFER. (setq embark-quit-after-action '((t . t)
When called interactively, prompt for BUFFER." (kill-buffer . nil)))
(interactive (list (read-buffer "Select buffer: ")))
(let ((kill-buffer-query-functions nil))
(kill-buffer (or buffer (current-buffer)))))
(setq embark-quit-after-action '((kill-buffer . nil))) (setf (alist-get 'kill-buffer embark-pre-action-hooks) nil)
#+end_src
;; TODO Add this to display-buffer-alist #+begin_src emacs-lisp
;; ("\\*Embark Actions\\*"
;; (display-buffer-reuse-mode-window display-buffer-at-bottom)
;; (window-height . fit-window-to-buffer)
;; (window-parameters . ((no-other-window . t)
;; (mode-line-format . none))))
;; TODO Remove the which-key stuff because it seems to be breaking things
(defun embark-which-key-indicator () (defun embark-which-key-indicator ()
"An embark indicator that displays keymaps using which-key. "An embark indicator that displays keymaps using which-key.
The which-key help message will show the type and value of the The which-key help message will show the type and value of the
@ -1695,7 +1723,7 @@ When called interactively, prompt for BUFFER."
("D" "~/Documents/" "Documents") ("D" "~/Documents/" "Documents")
("b" "~/Documents/Books/" "Books") ("b" "~/Documents/Books/" "Books")
("p" "~/Development/" "Dev") ("p" "~/Development/" "Dev")
("t" "~/TYCS/" "Teachyourselfcs") ("t" "~/Tutorials/" "Tutorials")
("n" "~/Notes/" "OrgNotes") ("n" "~/Notes/" "OrgNotes")
("r" "~/Repositories" "Repos") ("r" "~/Repositories" "Repos")
("B" "~/pCloudDrive/" "pCloud"))) ("B" "~/pCloudDrive/" "pCloud")))
@ -1878,7 +1906,8 @@ be kept here commented out in case we want to try it again.
(require 'avy) (require 'avy)
(setq avy-case-fold-search nil) (setq avy-case-fold-search nil)
(setq avy-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l ?q ?w ?e ?r ?u ?i ?o ?p ?z ?x ?c ?v ?n ?m)) (setq avy-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l ?q ?w ?e ?r ?u ?i ?o ?p ?z ?x ?c ?v ?n ?m))
(define-key global-map (kbd "C-;") 'avy-goto-char) ;; I use this most frequently ;; (define-key global-map (kbd "C-;") 'avy-goto-char) ;; I use this most frequently
(define-key global-map (kbd "M-s") 'avy-goto-char) ;; I use this most frequently
;; (define-key global-map (kbd "C-'") 'avy-goto-line) ;; Consistent with ivy-avy ;; (define-key global-map (kbd "C-'") 'avy-goto-line) ;; Consistent with ivy-avy
(define-key global-map (kbd "M-g c") 'avy-goto-char) (define-key global-map (kbd "M-g c") 'avy-goto-char)
(define-key global-map (kbd "M-g e") 'avy-goto-word-0) ;; lots of candidates (define-key global-map (kbd "M-g e") 'avy-goto-word-0) ;; lots of candidates
@ -2202,11 +2231,14 @@ the right frame, I'm going to use the frame's name to close and remove the hook
** Programming Languages ** Programming Languages
*** Python *** Python
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'python)
(setq python-shell-interpreter "python")
(setq python-shell-interpreter-args "--pylab") ;; What is this for?
(setq python-shell-interpreter-args "") ;; What is this for?
(define-key inferior-python-mode-map (kbd "C-n") #'comint-next-input) (define-key inferior-python-mode-map (kbd "C-n") #'comint-next-input)
(define-key inferior-python-mode-map (kbd "C-p") #'comint-previous-input) (define-key inferior-python-mode-map (kbd "C-p") #'comint-previous-input)
#+end_src> #+end_src
*** Rust *** Rust
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq rustic-lsp-setup-p nil) (setq rustic-lsp-setup-p nil)