|
|
|
@@ -78,8 +78,7 @@ Otherwize hook it." |
|
|
|
(set-variable 'package-archives |
|
|
|
`(,@package-archives |
|
|
|
("melpa" . "https://melpa.org/packages/") |
|
|
|
;; Somehow fails to download via https |
|
|
|
("10sr-el" . "http://10sr.github.io/emacs-lisp/elpa/"))) |
|
|
|
("10sr-el" . "https://10sr.github.io/emacs-lisp/elpa/"))) |
|
|
|
(when (< emacs-major-version 27) |
|
|
|
(package-initialize)) |
|
|
|
|
|
|
|
@@ -207,7 +206,7 @@ Otherwize hook it." |
|
|
|
;; start and quit |
|
|
|
|
|
|
|
(setq inhibit-startup-message t) |
|
|
|
(setq initial-buffer-choice 'messages-buffer) |
|
|
|
(setq initial-buffer-choice ".") |
|
|
|
(setq confirm-kill-emacs 'y-or-n-p) |
|
|
|
;; (setq gc-cons-threshold (* 1024 1024 16)) |
|
|
|
(setq garbage-collection-messages nil) |
|
|
|
@@ -235,8 +234,9 @@ Otherwize hook it." |
|
|
|
;; (view-echo-area-messages) |
|
|
|
;; (view-emacs-news) |
|
|
|
) |
|
|
|
(display-buffer (messages-buffer)) |
|
|
|
|
|
|
|
(with-current-buffer "*Messages*" |
|
|
|
(with-current-buffer (messages-buffer) |
|
|
|
(emacs-lock-mode 'kill)) |
|
|
|
|
|
|
|
(cd ".") ; when using windows use / instead of \ in `default-directory' |
|
|
|
@@ -640,6 +640,12 @@ THEM are function and its args." |
|
|
|
(str (expand-file-name str))) |
|
|
|
(kill-new str))) |
|
|
|
|
|
|
|
(defun my-copy-whole-buffer-as-kill () |
|
|
|
"Copy whole buffer." |
|
|
|
(interactive) |
|
|
|
(copy-region-as-kill (point-min) |
|
|
|
(point-max))) |
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;; title and mode-line |
|
|
|
|
|
|
|
@@ -1173,18 +1179,26 @@ THEM are function and its args." |
|
|
|
|
|
|
|
;; fuzzy-finder |
|
|
|
|
|
|
|
(set-variable 'fuzzy-finder-executable "fzf") |
|
|
|
(set-variable 'fuzzy-finder-default-arguments |
|
|
|
(concat "--ansi " |
|
|
|
"--color='bg+:-1' " |
|
|
|
"--inline-info " |
|
|
|
"--cycle " |
|
|
|
"--reverse " |
|
|
|
"--multi " |
|
|
|
"--print0 " |
|
|
|
"--prompt=\"[`pwd`]> \" ")) |
|
|
|
(set-variable 'fuzzy-finder-default-output-delimiter |
|
|
|
"\0") |
|
|
|
(progn |
|
|
|
(set-variable 'fuzzy-finder-executable "fzf") |
|
|
|
(set-variable 'fuzzy-finder-default-arguments |
|
|
|
(concat "--ansi " |
|
|
|
"--color='bg+:-1' " |
|
|
|
"--inline-info " |
|
|
|
"--cycle " |
|
|
|
"--reverse " |
|
|
|
"--multi " |
|
|
|
"--print0 " |
|
|
|
"--prompt=\"[`pwd`]FZF: \" ")) |
|
|
|
(set-variable 'fuzzy-finder-default-output-delimiter |
|
|
|
"\0")) |
|
|
|
|
|
|
|
;; I like fzf because it has --cycle option |
|
|
|
;; (when (executable-find "sk") ;; skim |
|
|
|
;; (set-variable 'fuzzy-finder-executable "sk") |
|
|
|
;; (set-variable 'fuzzy-finder-default-arguments "--ansi --inline-info --cycle --multi --reverse --print0 --prompt=\"[`pwd`]SK: \" ") |
|
|
|
;; (set-variable 'fuzzy-finder-default-output-delimiter "\0") |
|
|
|
;; ) |
|
|
|
|
|
|
|
(set-variable 'fuzzy-finder-default-input-command |
|
|
|
(let ((find (or (executable-find "bfs") ;; Breadth-first find https://github.com/tavianator/bfs |
|
|
|
@@ -1192,7 +1206,7 @@ THEM are function and its args." |
|
|
|
"find")) |
|
|
|
(fd (or (executable-find "fdfind") |
|
|
|
(executable-find "fd")))) |
|
|
|
(if fd |
|
|
|
(if nil ;; fd |
|
|
|
(concat "set -eu; set -o pipefail; " |
|
|
|
"echo .; " |
|
|
|
"echo ..; " |
|
|
|
@@ -1219,7 +1233,7 @@ THEM are function and its args." |
|
|
|
"Call `fuzzy-finder' if usable or call `find-file'." |
|
|
|
(declare (interactive-only t)) |
|
|
|
(interactive) |
|
|
|
(if (and (executable-find "fzf") |
|
|
|
(if (and (executable-find fuzzy-finder-executable) |
|
|
|
(fboundp 'fuzzy-finder) |
|
|
|
(not (file-remote-p default-directory))) |
|
|
|
(fuzzy-finder-find-files-projectile) |
|
|
|
@@ -1241,7 +1255,9 @@ THEM are function and its args." |
|
|
|
(defun my-fuzzy-finder-dired () |
|
|
|
"Fuzzy finder directory." |
|
|
|
(interactive) |
|
|
|
(fuzzy-finder :input-command "fd --hidden --no-ignore --type directory" |
|
|
|
(fuzzy-finder :input-command (if (executable-find "bfs") |
|
|
|
"bfs -type d 2>/dev/null" |
|
|
|
"fd --hidden --no-ignore --type directory") |
|
|
|
:directory (expand-file-name "~"))) |
|
|
|
(define-key ctl-x-map "d" 'my-fuzzy-finder-dired) |
|
|
|
|
|
|
|
@@ -2321,6 +2337,14 @@ ORIG-FUNC is the target function, and ARGS is the argument when it is called." |
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;; dired |
|
|
|
|
|
|
|
(defun dired-default-directory () |
|
|
|
"Open dired `default-directory'." |
|
|
|
(interactive) |
|
|
|
(pop-to-buffer (dired-noselect default-directory))) |
|
|
|
|
|
|
|
(define-key ctl-x-map "D" 'dired-default-directory) |
|
|
|
|
|
|
|
|
|
|
|
(defun my-file-head (filename &optional n) |
|
|
|
"Return list of first N lines of file FILENAME." |
|
|
|
;; TODO: Fix for janapese text |
|
|
|
@@ -2640,10 +2664,9 @@ ARG is num to show, or defaults to 7." |
|
|
|
(defun memo (&optional dir) |
|
|
|
"Open memo.txt in DIR." |
|
|
|
(interactive) |
|
|
|
(pop-to-buffer (find-file-noselect (concat (if dir |
|
|
|
(file-name-as-directory dir) |
|
|
|
"") |
|
|
|
"memo.txt")))) |
|
|
|
(pop-to-buffer (find-file-noselect (expand-file-name "memo.txt" |
|
|
|
(or dir |
|
|
|
default-directory))))) |
|
|
|
|
|
|
|
;; TODO: remember-projectile |
|
|
|
|
|
|
|
@@ -2674,13 +2697,13 @@ condition to choose COMMAND when evaluated.") |
|
|
|
;; ripgrep |
|
|
|
("rg" |
|
|
|
(executable-find "rg") |
|
|
|
"rg -nH --no-heading --hidden --no-ignore-parent --glob '!.git/' --smart-case -M 1280 ") |
|
|
|
"rg -nH --no-heading --color=never --hidden --no-ignore-parent --glob '!.git/' --smart-case -M 1280 ") |
|
|
|
|
|
|
|
;; git grep |
|
|
|
("gitgrep" |
|
|
|
(eq 0 |
|
|
|
(shell-command "git rev-parse --git-dir")) |
|
|
|
"git --no-pager grep -nH -e ") |
|
|
|
"git --no-pager grep -nH --color=never --ignore-case -e ") |
|
|
|
|
|
|
|
;; sift |
|
|
|
("sift" |
|
|
|
@@ -2888,7 +2911,7 @@ and search from projectile root (if projectile is available)." |
|
|
|
"Set `remember-data-file'." |
|
|
|
(when (require 'projectile nil t) |
|
|
|
(setq-local remember-data-file |
|
|
|
(expand-file-name ".remember.notes" |
|
|
|
(expand-file-name "remember.notes" |
|
|
|
(projectile-project-root))))) |
|
|
|
|
|
|
|
(add-hook 'after-change-major-mode-hook |
|
|
|
@@ -3100,6 +3123,15 @@ BEGIN { |
|
|
|
} |
|
|
|
") |
|
|
|
|
|
|
|
(defun my-git-info-exclude () |
|
|
|
"Open .git/info/exlucde file." |
|
|
|
(interactive) |
|
|
|
(if-let* ((dir (locate-dominating-file default-directory |
|
|
|
".git/info/exclude"))) |
|
|
|
(find-file (expand-file-name ".git/info/exclude" |
|
|
|
dir)) |
|
|
|
(error "No .git/info/exclude file found"))) |
|
|
|
|
|
|
|
'(progn |
|
|
|
;; https://web.sfc.wide.ad.jp/~sagawa/gnujdoc/elisp-manual-20-2.5/elisp-ja_39.html#SEC629 |
|
|
|
;; https://emacs.stackexchange.com/questions/15078/inserting-before-an-after-string-overlay |
|
|
|
|