diff options
Diffstat (limited to 'basics.el')
-rw-r--r-- | basics.el | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/basics.el b/basics.el index 3905003..15831d3 100644 --- a/basics.el +++ b/basics.el | |||
@@ -192,7 +192,7 @@ | |||
192 | auto-save-interval 1 | 192 | auto-save-interval 1 |
193 | auto-save-no-message t | 193 | auto-save-no-message t |
194 | auto-save-timeout 1 | 194 | auto-save-timeout 1 |
195 | auto-save-visited-interval 1 | 195 | auto-save-visited-interval 10 |
196 | remote-file-name-inhibit-auto-save-visited t) | 196 | remote-file-name-inhibit-auto-save-visited t) |
197 | (add-to-list 'auto-save-file-name-transforms | 197 | (add-to-list 'auto-save-file-name-transforms |
198 | `(".*" ,(etc/ "auto-save/" t) t)) | 198 | `(".*" ,(etc/ "auto-save/" t) t)) |
@@ -208,7 +208,8 @@ | |||
208 | (setq-default ;; recentf-save-file (etc/ "recentf" t) | 208 | (setq-default ;; recentf-save-file (etc/ "recentf" t) |
209 | recentf-max-menu-items 500 | 209 | recentf-max-menu-items 500 |
210 | recentf-max-saved-items nil ; Save the whole list | 210 | recentf-max-saved-items nil ; Save the whole list |
211 | recentf-auto-cleanup 'mode) | 211 | recentf-auto-cleanup 'mode |
212 | recentf-case-fold-search t) | ||
212 | (add-to-list 'recentf-exclude etc/) | 213 | (add-to-list 'recentf-exclude etc/) |
213 | (add-to-list 'recentf-exclude "-autoloads.el\\'") | 214 | (add-to-list 'recentf-exclude "-autoloads.el\\'") |
214 | (add-hook 'buffer-list-update-hook #'recentf-track-opened-file) | 215 | (add-hook 'buffer-list-update-hook #'recentf-track-opened-file) |
@@ -309,13 +310,62 @@ current line." | |||
309 | (list (line-beginning-position) | 310 | (list (line-beginning-position) |
310 | (line-end-position)))))) | 311 | (line-end-position)))))) |
311 | 312 | ||
313 | (defun +kill-buffer (&optional buffer-or-name) | ||
314 | "Kill the current buffer, or BUFFER-OR-NAME. | ||
315 | When called interactively, prompt the user when given a prefix | ||
316 | argument." | ||
317 | (interactive "P") | ||
318 | (cond | ||
319 | ((bufferp buffer-or-name) | ||
320 | (kill-buffer buffer-or-name)) | ||
321 | ((null buffer-or-name) | ||
322 | (kill-current-buffer)) | ||
323 | (:else | ||
324 | (kill-buffer (read-buffer "Kill: " nil :require-match))))) | ||
325 | |||
326 | (defun +backward-kill-word (arg) | ||
327 | "Kill ARG words backward unless at the beginning of a line. | ||
328 | When at the beginning of a line, delete blank lines before point." | ||
329 | (interactive "p") | ||
330 | (cond | ||
331 | ((bolp) | ||
332 | ;; This is the first bit of `delete-blank-lines'. -- acdw | ||
333 | (let (thisblank singleblank) | ||
334 | (save-excursion | ||
335 | (beginning-of-line) | ||
336 | (setq thisblank (looking-at "[ \t]*$")) | ||
337 | ;; Set singleblank if there is just one blank line here. | ||
338 | (setq singleblank | ||
339 | (and thisblank | ||
340 | (not (looking-at "[ \t]*\n[ \t]*$")) | ||
341 | (or (bobp) | ||
342 | (progn (forward-line -1) | ||
343 | (not (looking-at "[ \t]*$"))))))) | ||
344 | ;; Delete preceding blank lines, and this one too if it's the only one. | ||
345 | (if thisblank | ||
346 | (progn | ||
347 | (beginning-of-line) | ||
348 | (if singleblank (forward-line 1)) | ||
349 | (delete-region (point) | ||
350 | (if (re-search-backward "[^ \t\n]" nil t) | ||
351 | (progn (forward-line 1) (point)) | ||
352 | (point-min))))) | ||
353 | (if (or (not thisblank) | ||
354 | singleblank) | ||
355 | (progn | ||
356 | (beginning-of-line) | ||
357 | (backward-delete-char 1))))) | ||
358 | (:else | ||
359 | (backward-kill-word arg)))) | ||
360 | |||
312 | (global-set-key [remap eval-expression] #'pp-eval-expression) | 361 | (global-set-key [remap eval-expression] #'pp-eval-expression) |
313 | (global-set-key (kbd "M-o") #'other-window|switch-buffer) | 362 | (global-set-key (kbd "M-o") #'other-window|switch-buffer) |
314 | (global-set-key [remap delete-window] #'delete-window|bury-buffer) | 363 | (global-set-key [remap delete-window] #'delete-window|bury-buffer) |
315 | (global-set-key [remap cycle-spacing] #'+cycle-spacing) | 364 | (global-set-key [remap cycle-spacing] #'+cycle-spacing) |
316 | (global-set-key (kbd "C-x C-k") #'kill-this-buffer) | 365 | (global-set-key (kbd "C-x C-k") #'+kill-buffer) |
317 | (global-set-key [remap comment-dwim] #'+comment-dwim) | 366 | (global-set-key [remap comment-dwim] #'+comment-dwim) |
318 | (global-set-key [remap undo] #'undo-only) | 367 | (global-set-key [remap undo] #'undo-only) |
368 | (global-set-key [remap backward-kill-word] #'+backward-kill-word) | ||
319 | 369 | ||
320 | (global-set-key [f10] #'tmm-menubar) | 370 | (global-set-key [f10] #'tmm-menubar) |
321 | (advice-add 'tmm-add-prompt :after 'minibuffer-hide-completions) | 371 | (advice-add 'tmm-add-prompt :after 'minibuffer-hide-completions) |
@@ -533,6 +583,12 @@ current line." | |||
533 | ;; :preview-key (kbd "M-.") | 583 | ;; :preview-key (kbd "M-.") |
534 | :preview-key '(:debounce 0.4 any)) | 584 | :preview-key '(:debounce 0.4 any)) |
535 | 585 | ||
586 | ;; (consult-customize consult-line | ||
587 | ;; consult-ripgrep | ||
588 | ;; :initial (when (use-region-p) | ||
589 | ;; (buffer-substring-no-properties | ||
590 | ;; (region-beginning) (region-end)))) | ||
591 | |||
536 | ;; Optionally configure the narrowing key. | 592 | ;; Optionally configure the narrowing key. |
537 | ;; Both < and C-+ work reasonably well. | 593 | ;; Both < and C-+ work reasonably well. |
538 | (setq consult-narrow-key "<") ;; (kbd "C-+") | 594 | (setq consult-narrow-key "<") ;; (kbd "C-+") |