Compare commits

..

3 Commits

View File

@ -184,6 +184,7 @@ Finish up
evil-goggles
avy
all-the-icons-ibuffer
drag-stuff
;; ace-window
;; Mail
smtpmail
@ -224,6 +225,7 @@ Finish up
org-fancy-priorities
org-roam
org-download
valign
;; Programming Languages
highlight-quoted
rustic
@ -601,6 +603,46 @@ weren't working, until I randomly saw this in someone's init.el
(setq sentence-end-double-space nil)
#+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
*** COMMENT Hydra
#+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-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
(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 bb") 'consult-buffer
(kbd "SPC bi") 'ibuffer
(kbd "SPC bu") 'recentf-open-most-recent-file
(kbd "SPC bm") 'joe/toggle-buffer-mode
(kbd "SPC br") 'joe/revert-buffer-no-confirm
(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
"^\\*rustic-compilation\\*" rustic-compilation-mode
"^\\*ansi-term\\*$" term-mode
"^\\*Async Shell Command\\*$" shell-mode
;; "^\\*Async Shell Command\\*$" shell-mode
"^\\*Async Shell Command\\*$"
("^\\*Warnings\\*$" . hide)
help-mode
helpful-mode))
@ -1455,7 +1498,7 @@ Stuff to immediately switch to Jetbrains for debugging
(interactive)
(shell-command
(mapconcat #'shell-quote-argument
(list "rider"
(list "pycharm"
"--line"
(int-to-string (line-number-at-pos))
"--column"
@ -1549,35 +1592,20 @@ Stuff to immediately switch to Jetbrains for debugging
*** Embark
#+begin_src emacs-lisp
(require 'embark)
#+end_src
;; TODO Try using embark to kill this buffer
(defun prot-simple-kill-buffer-current (&optional arg)
"Kill current buffer.
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))))
These two lines allow you to kill buffers without a confirmation and without
closing the mini-buffer so you can quickly kill multiple buffers if needed. The
odd looking ~'(t .t)~ is for specifying a default for all other actions.
(defun prot-simple-kill-buffer (buffer)
"Kill current BUFFER.
When called interactively, prompt for BUFFER."
(interactive (list (read-buffer "Select buffer: ")))
(let ((kill-buffer-query-functions nil))
(kill-buffer (or buffer (current-buffer)))))
#+begin_src emacs-lisp
(setq embark-quit-after-action '((t . t)
(kill-buffer . nil)))
(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
;; ("\\*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
#+begin_src emacs-lisp
(defun embark-which-key-indicator ()
"An embark indicator that displays keymaps using which-key.
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")
("b" "~/Documents/Books/" "Books")
("p" "~/Development/" "Dev")
("t" "~/TYCS/" "Teachyourselfcs")
("t" "~/Tutorials/" "Tutorials")
("n" "~/Notes/" "OrgNotes")
("r" "~/Repositories" "Repos")
("B" "~/pCloudDrive/" "pCloud")))
@ -1878,7 +1906,8 @@ be kept here commented out in case we want to try it again.
(require 'avy)
(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))
(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 "M-g c") 'avy-goto-char)
(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
*** Python
#+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-p") #'comint-previous-input)
#+end_src>
#+end_src
*** Rust
#+begin_src emacs-lisp
(setq rustic-lsp-setup-p nil)