Emacs 환경 업데이트(straight.el)
17974 단어 straight.comEmacs
MacBookPro Mid2010
에서 MacBookAir2018
로 교체했습니다.계기가 없으면 좀처럼 설정을 재검토하지 않기 때문에, 몇 년만에 실시입니다.
지금까지는 아래와 같이 패키지마다 설정 파일을 나누어 왔습니다만, 거기까지 고집한 사용법을 하고 있지 않기 때문에, init.el에 정리하기로 했습니다.
조건을 설정하기 시작하면 파일 분리하는 것이 좋을지도 모릅니다만, 개인적으로는 깨끗이 해 만족합니다.
기동 시간도 거기까지 신경이 쓰일 정도가 아니기 때문에
use-package
도 사용하지 않고 갑니다.~/.emacs.d/
init.el
./inits/
├── 01_basic.el
└── 02_helm.el
└── 03_recentf.el
Emacs
straight.com
패키지 관리자입니다.init.el
에 straight-use-package
를 쓰면 패키지 설치까지 완료됩니다.
init.el(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
참고 : Emacs 패키지 관리자 결정판 : 앞으로의 패키지 관리는 straight.el에서 결정!
helm
init.el(straight-use-package 'helm)
(helm-mode 1)
(define-key global-map (kbd "M-y") 'helm-show-kill-ring)
(define-key global-map (kbd "C-x C-f") 'helm-find-files)
(define-key global-map (kbd "C-x C-r") 'helm-recentf)
(define-key helm-map (kbd "C-h") 'helm-ff-delete-char-backward)
(define-key helm-find-files-map (kbd "TAB") 'helm-execute-persistent-action)
개인 익숙한 문제에서 C-h
및 TAB
를 정의합니다.
참고 : Emacs에 혁명을 일으키는 패키지 "helm"
recentf-ext
최근 열린 파일을 목록으로 표시해 준다.
대단히 자주 사용하는 기능.C-x C-r
로 설정합니다.
init.el(straight-use-package 'recentf-ext)
(recentf-mode 1)
(setq recentf-max-saved-items 200)
(setq recentf-save-file "~/.emacs.d/recentf")
(setq recentf-auto-cleanup 'never)
(setq helm-for-files-preferred-list
'(helm-source-buffers-list
helm-source-recentf
helm-source-bookmarks
helm-source-file-cache
helm-source-files-in-current-dir
helm-source-bookmark-set
helm-source-locate))
company
보완 패키지.
init.el(straight-use-package 'company)
(global-company-mode)
(setq company-transformers '(company-sort-by-backend-importance))
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 3)
(setq company-selection-wrap-around t)
(setq completion-ignore-case t)
(setq company-dabbrev-downcase nil)
(global-set-key (kbd "C-M-i") 'company-complete)
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-p") 'company-select-previous)
(define-key company-search-map (kbd "C-n") 'company-select-next)
(define-key company-search-map (kbd "C-p") 'company-select-previous)
(define-key company-active-map (kbd "C-s") 'company-filter-candidates)
(define-key company-active-map (kbd "C-i") 'company-complete-selection)
(define-key company-active-map [tab] 'company-complete-selection)
(define-key company-active-map (kbd "C-f") 'company-complete-selection)
(define-key emacs-lisp-mode-map (kbd "C-M-i") 'company-complete)
web-mode
HTML 쓸 때용.
init.el(straight-use-package 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(defun web-mode-hook ()
(setq web-mode-html-offset 2)
(setq web-mode-css-offset 2)
(setq web-mode-script-offset 2)
(setq indent-tabs-mode nil)
(setq tab-width 2))
(add-hook 'web-mode-hook 'web-mode-hook)
php-mode
PHP 쓸 때 사용. 보완에 company-php
넣습니다.
init.el(straight-use-package 'php-mode)
(straight-use-package 'company-php)
(add-hook 'php-mode-hook
'(lambda ()
(company-mode t)
(ac-php-core-eldoc-setup)
(make-local-variable 'company-backends)
(add-to-list 'company-backends 'company-ac-php-backend)))
screenshot
js2-mode
js 쓸 때 용. 보완에 company-tern
넣습니다.
init.el(straight-use-package 'js2-mode)
(straight-use-package 'company-tern)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-hook 'js2-mode-hook 'tern-mode)
(add-to-list 'company-backends 'company-tern)
별도 tern을 설치해야합니다.npm install -g tern
screenshot
flycheck
신택스 체크용.
init.el(straight-use-package 'flycheck)
(add-hook 'after-init-hook #'global-flycheck-mode)
미게도
일본어 증분 검색.
init.el(straight-use-package 'migemo)
(straight-use-package 'helm-migemo)
(setq migemo-command "cmigemo")
(setq migemo-options '("-q" "--emacs"))
(setq migemo-dictionary "/usr/local/Cellar/cmigemo/20110227/share/migemo/utf-8/migemo-dict")
(setq migemo-user-dictionary nil)
(setq migemo-regex-dictionary nil)
(setq migemo-coding-system 'utf-8-unix)
(load-library "migemo")
(migemo-init)
참고 : migemo.el : 로마자로 일본어 검색하는 신 도구 Migemo가 업데이트되었습니다!
swiper+migemo
isearch를 일람으로 내준다. +일본어 대응.
init.el(global-set-key "\C-s" 'swiper)
(defvar swiper-include-line-number-in-search t)
(straight-use-package 'avy)
(straight-use-package 'swiper-helm)
(straight-use-package 'avy-migemo)
(avy-migemo-mode 1)
(require 'avy-migemo-e.g.swiper)
screenshot
번외: VSCode
평상시는 emacs
입니다만, 마크다운을 프리뷰 보면서 쓰고 싶을 때나, PDF로 하고 싶을 때용으로 VSCode
넣었습니다.
확장
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'helm)
(helm-mode 1)
(define-key global-map (kbd "M-y") 'helm-show-kill-ring)
(define-key global-map (kbd "C-x C-f") 'helm-find-files)
(define-key global-map (kbd "C-x C-r") 'helm-recentf)
(define-key helm-map (kbd "C-h") 'helm-ff-delete-char-backward)
(define-key helm-find-files-map (kbd "TAB") 'helm-execute-persistent-action)
(straight-use-package 'recentf-ext)
(recentf-mode 1)
(setq recentf-max-saved-items 200)
(setq recentf-save-file "~/.emacs.d/recentf")
(setq recentf-auto-cleanup 'never)
(setq helm-for-files-preferred-list
'(helm-source-buffers-list
helm-source-recentf
helm-source-bookmarks
helm-source-file-cache
helm-source-files-in-current-dir
helm-source-bookmark-set
helm-source-locate))
(straight-use-package 'company)
(global-company-mode)
(setq company-transformers '(company-sort-by-backend-importance))
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 3)
(setq company-selection-wrap-around t)
(setq completion-ignore-case t)
(setq company-dabbrev-downcase nil)
(global-set-key (kbd "C-M-i") 'company-complete)
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-p") 'company-select-previous)
(define-key company-search-map (kbd "C-n") 'company-select-next)
(define-key company-search-map (kbd "C-p") 'company-select-previous)
(define-key company-active-map (kbd "C-s") 'company-filter-candidates)
(define-key company-active-map (kbd "C-i") 'company-complete-selection)
(define-key company-active-map [tab] 'company-complete-selection)
(define-key company-active-map (kbd "C-f") 'company-complete-selection)
(define-key emacs-lisp-mode-map (kbd "C-M-i") 'company-complete)
(straight-use-package 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(defun web-mode-hook ()
(setq web-mode-html-offset 2)
(setq web-mode-css-offset 2)
(setq web-mode-script-offset 2)
(setq indent-tabs-mode nil)
(setq tab-width 2))
(add-hook 'web-mode-hook 'web-mode-hook)
(straight-use-package 'php-mode)
(straight-use-package 'company-php)
(add-hook 'php-mode-hook
'(lambda ()
(company-mode t)
(ac-php-core-eldoc-setup)
(make-local-variable 'company-backends)
(add-to-list 'company-backends 'company-ac-php-backend)))
(straight-use-package 'js2-mode)
(straight-use-package 'company-tern)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-hook 'js2-mode-hook 'tern-mode)
(add-to-list 'company-backends 'company-tern)
(straight-use-package 'flycheck)
(add-hook 'after-init-hook #'global-flycheck-mode)
(straight-use-package 'migemo)
(straight-use-package 'helm-migemo)
(setq migemo-command "cmigemo")
(setq migemo-options '("-q" "--emacs"))
(setq migemo-dictionary "/usr/local/Cellar/cmigemo/20110227/share/migemo/utf-8/migemo-dict")
(setq migemo-user-dictionary nil)
(setq migemo-regex-dictionary nil)
(setq migemo-coding-system 'utf-8-unix)
(load-library "migemo")
(migemo-init)
(global-set-key "\C-s" 'swiper)
(defvar swiper-include-line-number-in-search t)
(straight-use-package 'avy)
(straight-use-package 'swiper-helm)
(straight-use-package 'avy-migemo)
(avy-migemo-mode 1)
(require 'avy-migemo-e.g.swiper)
평상시는
emacs
입니다만, 마크다운을 프리뷰 보면서 쓰고 싶을 때나, PDF로 하고 싶을 때용으로 VSCode
넣었습니다.확장
screenshot
Reference
이 문제에 관하여(Emacs 환경 업데이트(straight.el)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/yuze/items/a145b1e3edb6d0c24cbf텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)