(setq
file-name-handler-alist nil
- message-log-max 16384
- gc-cons-threshold 100000000 ;; 100 mb
- ;; package-enable-at-startup nil
- gc-cons-percentage 0.6
- auto-window-vscroll nil)
+ message-log-max 16384
+ gc-cons-threshold 100000000 ;; 100 mb
+ ;; package-enable-at-startup nil
+ gc-cons-percentage 0.6
+ auto-window-vscroll nil)
(add-hook 'after-init-hook
#'(lambda ()
(cond ((equal (car custom-enabled-themes) 'naquadah)
(override-theme 'ef-light))
(t
+ (global-hide-mode-line-mode -1)
(override-theme 'naquadah))))
+
(setq ef-themes-mixed-fonts t
ef-themes-variable-pitch-ui t)
savehist-file (concat user-emacs-directory ".savehist"))
(savehist-mode 1))
+
+
;;; vertico
(setq read-file-name-completion-ignore-case t
read-buffer-completion-ignore-case t
:custom
;; (vertico-scroll-margin 0) ;; Different scroll margin
(vertico-count 20) ;; Show more candidates
- ;;(vertico-resize t) ;; Grow and shrink the Vertico minibuffer
(vertico-cycle t) ;; Enable cycling for `vertico-next/previous'
+ ;; default tab inserts current candidate.
(keymap-set vertico-map "TAB" #'minibuffer-complete)
+ ;; just stumbled upon this searching for a solution. There might be
+ ;; some better way.
+ (keymap-set vertico-map "C-f" #'vertico-kill-line)
:init
(vertico-mode))
+;;(keymap-set vertico-map "C-f" 'vertico-kill-line)
+
+
;; Emacs minibuffer configurations.
(use-package emacs
:custom
(completion-category-overrides '((file (styles partial-completion)))))
+(defun vertico-kill-line ()
+ "Remove text from the echo area by killing backwards"
+ (interactive)
+ (kill-line 0))
+
+
;;; dired
;;; modes with little configuration needed
-
+(setq sqlformat-command 'sqlfluff)
(custom-set-variables
'(css-indent-offset 2)
;; program to work partly and for an error that is not near the missing semicolon.
;; This works super well to find missing semicolons.
(defun perl-iank-regex ()
- "Start regexp isearch forward with pre-populated search string."
+ "Start regexp isearch forward with pre-populated search string."
(interactive)
(let ((search-string "^[^#]*[^
{};,]$"))
(setq global-mark-ring (nbutlast global-mark-ring))
(goto-char (marker-position (mark-marker)))))
+(defun replace-regexp-in-buffer (regexp replace-string)
+ "Replace all matches of REGEXP with REPLACE-STRING in current buffer."
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward regexp nil t)
+ (replace-match replace-string nil nil))))
+
+;; I have 2 sql formatters. I prefer the format of sqlfluff, but it is
+;; very picky and will refuse to work sometimes. So, here is a function
+;; to more easily use the other one.
+;;(defun sqlformat-iank-alt ())
+
(defun indent-buffer ()
"Indents the entire buffer."
(interactive)
(cond ((derived-mode-p 'org-mode)
(org-indent-region (point-min) (point-max)))
+ ((derived-mode-p 'sql-mode)
+ ;;;; i dun think this is needed, but leaving it here just in case.
+ ;; (let ((err-buf (get-buffer "*sqlformat errors*")))
+ ;; (when err-buf (kill-buffer err-buf)))
+
+ ;; fixes parsing errors for the perl i've been writing.
+ (replace-regexp-in-buffer "?" "'?'")
+ (sqlformat-buffer)
+ (replace-regexp-in-buffer "'\\?'" "?")
+ (let ((err-buf (get-buffer "*sqlformat errors*"))
+ err-str)
+ (when err-buf
+ (with-current-buffer err-buf
+ (setq err-str (buffer-substring-no-properties (point-min) (point-max))))
+ (when (not (string-empty-p err-str))
+ (message "using alt formatter due to error: %s" err-str)
+ (setq sqlformat-command 'sqlformat
+ sqlformat-args (list "-k" "lower" "-r" "--wrap_after=80"))
+ (sqlformat-buffer)
+ (setq sqlformat-command 'sqlfluff
+ sqlformat-args nil)))))
((derived-mode-p 'python-mode)
(py-autopep8))
(t
(?w (file . ,"/p/w.org"))
(?k (file . ,"/a/bin/ds/Arduino/Model01-Firmware/Model01-Firmware.ino"))
(?x (file . ,"/a/x.txt"))
+ (?q (file . ,"/a/x.sql"))
))
(set-register (car r) (cadr r)))
(global-set-key (kbd "C-e") 'copy-line)
-;;;;; M-e ?? unused
+;;;;; M-e goto-line
(global-set-key (kbd "M-e") 'goto-line)
;;;;; C-r isearch-backward
(lambda ()
(define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp)))
-;;;;; M-r ?? unused
-
+;;;;; M-r sql-up
+(global-set-key (kbd "M-r") 'sqlformat-region)
;;;;; C-a copy buffer