#닷파일: #크래프트이맥스
2024-01-17 Note craftedemacs dotfiles notes#프로젝트: #둠이맥스 #스타터 - #최소설정 #최대효과
동작한다. 근데 기능이 부족하다. 그래서 둠이맥스 기반으로 다시 만들었다.Stow on Crated-Dotfiles
목표는 syncthing 중인 git 폴더를 홈 폴더에 stow 하는 것이다. 그래야 디바이스 간에 간단히 코드를 관리 할 수 있다.
crated-emacs 최신 + crated-dotfiles 은 11 월에 커스텀 한 것이다. 이 녀석을 가지고 튜닝하면 된다.
https://github.com/junghan0611/crafted-emacs/ https://github.com/junghan0611/crafted-dotfiles
update-stow.sh
echo -e "Stow - Crafted Emacs\n"
# mkdir -p ~/crafted-dotfiles/cli/shell
# mkdir -p ~/crafted-dotfiles/alacritty
# mkdir -p ~/crafted-dotfiles/emacs/custom-modules
# cd ~/sync/emacs/crafted-dotfiles/emacs
# ln -s ~/sync/emacs/crafted-emacs
cd ~/sync/emacs/
stow crafted-dotfiles -t ~/crafted-dotfiles
tree ~/crafted-dotfiles/emacs
date
cd ~
echo -e "Stow Done\n"
~/.local/share/applications/crafted-emacs.desktop
[Desktop Entry]
Name=Crafted-Emacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
# Exec=env GTK_IM_MODULE=emacs XMODIFIERS=@im=emacs /usr/local/bin/emacs --init-directory=~/spacemacs %F
Exec=/usr/local/bin/emacs --init-directory=~/crafted-dotfiles/emacs %F
Icon=crafted-emacs.png
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupNotify=true
StartupWMClass=Emacs
.stow-local-ignores
이 파일이 필요하다.
# Comments and blank lines are allowed.
# Ref: https://www.gnu.org/software/stow/manual/stow.html#Types-And-Syntax-Of-Ignore-Lists
# Default
RCS
.+,v
CVS
\.\#.+ # CVS conflict files / emacs lock files
\.cvsignore
\.svn
_darcs
\.hg
\.git
\.gitignore
.+~ # emacs backup files
\#.*\# # emacs autosave files
# ^/README.*
^/LICENSE.*
^/COPYING
# ADD
## dotfile sync with Git repo
Crafted Emacs Documentation
Crafted Emacs IDE Module
TL;DR
정리하자면 개발 환경을 이렇게 간단하게 구성할 수 있음에 놀랍다. 물론 언어 별로 필요한 패키지가 있겠지만 트리시터에서 해당 언어의 기본을 커버해주고, 거기에 LSP 를 빌트인 패키지를 사용하기 때문에 무엇보다도 Emacs 는 건들지 않고 최신 환경을 보장할 수 있다는게 장점이다. 더불어 Emacs 가 처리하지 않기에 성능 이슈도 적다. Flymake 도 마찬가지로 빌트인 패키지다.
키바인딩 관련하여 코지 키 바인딩을 통해서 일관성 있게 Spacemacs 버전과 동일하게 가져갈 것이다.
Installation
To use this module, simply require them in your init.el
at the appropriate points.
;; add crafted-ide package definitions to selected packages list
(require 'crafted-ide-packages)
;; install the packages
(package-install-selected-packages :noconfirm)
;; Load crafted-ide configuration
(require 'crafted-ide-config)
Description
The crafted-ide
module sets up (and installs if necessary) functionality that makes Emacs act like a integrated development environment (IDE).
This module includes:
- Project-based buffer management (ibuffer-project)
- ibuffer-projectile for Jh-Emacs
- LSP client (Eglot)
- Next-generation syntax parsing (Tree-Sitter)
- EditorConfig support (editorconfig-emacs).
Aggressive Indentation
필요하다.
By default Emacs enables Electric Indent, a minor mode that automatically indents code after a RET key is pressed.
crafted-ide
adds support for Aggressive Indent, which re-indents code as it is typed. You can enable it for programming modes with the following:
(add-hook 'prog-mode-hook #'aggressive-indent-mode)
Eglot
Eglot is a client for the Language Server Protocol (LSP) built into Emacs (>=29). For it to work, you have to have a language server installed for the language of your choice. Usually, these have to be installed through your operating system. See this list of servers that work with Eglot out of the box.
Automatically start Eglot when visiting language buffers
It’s convenient to add a call to
eglot-ensure
for major modes that have an accompanying language server so that Eglot automatically initializes when that major mode is activated.crafted-ide
makes a function available that will automatically addeglot-ensure
to all major mode hooks for which a language server is installed and detected. You can enable this behavior with the following:(require 'crafted-ide-config) (crafted-ide-eglot-auto-ensure-all)
Tree-Sitter
Tree-Sitter support (built-in since Emacs 29) enables Emacs to better understand the syntax of your code, thus improving syntax highlighting and similar functions. Usage of Tree-Sitter is optional.
To compile the language grammars on initial startup, a C compiler is required.
Configuring Tree-Sitter (Emacs 29 or later)
Call
crafted-ide-configure-tree-sitter
after requiringcrafted-ide-config
. This will install all known language grammars for Tree-Sitter. To opt-out of one or more language grammars, pass them as a list tocrafted-ide-configure-tree-sitter
. This can be useful if a language grammar doesn’t build on your setup or you generally do not want a language grammar included as you would otherwise be re-prompted to install new grammars on every Emacs startup.treesit-auto 패키지를 사용.
(require 'crafted-ide-config) ;; install all language grammars (crafted-ide-configure-tree-sitter) ;; install all language grammars, except protobuf (crafted-ide-configure-tree-sitter '(protobuf))
Combobulate
일부 모드만 제공하고 있지만. 쉬운 접근 방법이 될 것 임. Evil 전용 패키지가 대안이 될 수 있음. 그러나 크래프트에서 공식으로 이야기하는 것부터.
Another use is the package Combobulate, which uses Tree-Sitter to provide a structured movement within your code. Combobulate is not installed by this module (it is not yet available on (M)ELPA etc.). But if you have installed it manually, it is automatically loaded for programming modes.
See Combobulate for details.
If you’re interested in a more in-depth look at both Tree-Stitter and Combobulate, the author of the package has written an extensive blog post about it: Combobulate: Structured Movement and Editing with Tree-Sitter.