16 Commits

Autor SHA1 Mensaje Fecha
  10sr 66dd908126 Update makefile hace 3 meses
  10sr 87fe8af5e6 Update hace 3 meses
  10sr b48f87006a Update hace 5 meses
  10sr 978f569123 Update hace 8 meses
  10sr 482e844821 Update hace 8 meses
  10sr 619bfcb18f Update hace 8 meses
  10sr 955b14f23f Update hace 10 meses
  10sr cea4c18a71 Update hace 10 meses
  10sr 3a3aa13493 Update hace 10 meses
  10sr 7cac3cc1c6 Update hace 10 meses
  10sr 00b875c770 Update hace 10 meses
  10sr 5213b63436 Update option hace 10 meses
  10sr eba871d647 Update hace 10 meses
  10sr 04d3c47d3e Use skim if available hace 10 meses
  10sr 3b32997de2 Update remember data path hace 11 meses
  10sr 595b45ebb7 Update memo hace 11 meses
Se han modificado 3 ficheros con 62 adiciones y 27 borrados
Dividir vista
  1. +2
    -1
      Makefile
  2. +58
    -26
      emacs.el
  3. +2
    -0
      shrc

+ 2
- 1
Makefile Ver fichero

@@ -370,7 +370,8 @@ endif
# $(dotfiles_dir).
# The load codes are appended to $(topfile).

setup_rcs := setup-rc-vimrc setup-rc-tmux.conf setup-rc-emacs.el
# vimrc has been removed in 26a56d8d36ec2ed04dcbfddd012f32648997883d
setup_rcs := setup-rc-tmux.conf setup-rc-emacs.el
setup-rc: $(setup_rcs) ## Setup initialize files
.PHONY: $(setup_rcs)



+ 58
- 26
emacs.el Ver fichero

@@ -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


+ 2
- 0
shrc Ver fichero

@@ -351,6 +351,8 @@ __safe_alias pipenv="env -u PIP_USER pipenv"
__safe_alias pipx="env -u PIP_USER pipx"

alias f='less `fzf`'
# TODO: Use find if bfs is not available
alias fcd='cd `bfs . -type d 2>/dev/null | fzf`'


# Sometimes SHELL cannot be used. For example, when running bash inside zsh


Cargando…
Cancelar
Guardar