feat: emacs - replace company/lsp with lsp-bridge, add fonts

This commit is contained in:
Ryan Yin
2024-01-05 20:41:53 +08:00
parent d5ef998239
commit 292809783d
9 changed files with 80 additions and 35 deletions

View File

@@ -172,6 +172,8 @@ reload-emacs-cmd := if os() == "macos" {
"launchctl unload " + emacs-plist-path
+ "\n"
+ "launchctl load " + emacs-plist-path
+ "\n"
+ "tail -f ~/Library/Logs/emacs-daemon.stderr.log"
} else {
"systemctl --user restart emacs.service"
+ "\n"
@@ -186,7 +188,6 @@ test-emacs:
doom clean
doom sync
{{reload-emacs-cmd}}
tail -f $"($env.HOME)//Library/Logs/emacs-daemon.stderr.log"
reload-emacs:
{{reload-emacs-cmd}}

View File

@@ -30,7 +30,7 @@ when in doubt, run `doom sync`!
## Why emacs?
1. Explore the unknown, just for fun!
3. Org Mode
2. Org Mode
## Cheetsheet
@@ -41,6 +41,8 @@ Here is the cheetsheet related to my DoomEmacs configs. Please read vim's common
| Action | Shortcut |
| ---------------------- | ------------- |
| Open file tree sidebar | `SPC + o + p` |
| Popup Terminal | `SPC + o + t` |
| Open Terminal | `SPC + o + T` |
| Exit | `M-x C-c` |
### Window Navigation

View File

@@ -21,8 +21,8 @@ with lib; let
shellAliases = {
e = "emacsclient --create-frame --tty";
};
librime-dir = "${config.xdg.dataHome}/librime/";
parinfer-rust-lib-dir = "${config.xdg.dataHome}/parinfer-rust/";
librime-dir = "${config.xdg.dataHome}/librime";
parinfer-rust-lib-dir = "${config.xdg.dataHome}/parinfer-rust";
in {
options.modules.editors.emacs = {
enable = mkEnableOption "Emacs Editor";
@@ -31,10 +31,6 @@ in {
config = mkIf cfg.enable (mkMerge [
{
home.packages = with pkgs; [
emacs-all-the-icons-fonts
# epkgs.rime
## Doom dependencies
git
(ripgrep.override {withPCRE2 = true;})
@@ -73,11 +69,11 @@ in {
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${doomemacs}/ ${config.xdg.configHome}/emacs/
# librime for emacs-rime
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.librime}/ ${librime-dir}
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.librime}/ ${librime-dir}/
# libparinfer_rust for emacs' parinfer-rust-mode
mkdir -p ${parinfer-rust-lib-dir}
cp ${pkgs.vimPlugins.parinfer-rust}/lib/libparinfer_rust.* ${parinfer-rust-lib-dir}/parinfer-rust.so
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.vimPlugins.parinfer-rust}/lib/libparinfer_rust.* ${parinfer-rust-lib-dir}/parinfer-rust.so
'';
}

View File

@@ -21,8 +21,10 @@
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
(setq doom-font (font-spec :family "JetBrainsMono Nerd Font" :size 15 :weight 'light)
doom-variable-pitch-font (font-spec :family "DejaVu Sans" :size 16)
doom-symbol-font (font-spec :family "JuliaMono")
doom-big-font (font-spec :family "JetBrainsMono Nerd Font" :size 26))
;;
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
@@ -74,6 +76,19 @@
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
(use-package! nerd-icons
;; :custom
;; The Nerd Font you want to use in GUI
;; "Symbols Nerd Font Mono" is the default and is recommended
;; but you can use any other Nerd Font if you want
;; (nerd-icons-font-family "Symbols Nerd Font Mono")
)
(use-package! lsp-bridge
:config
(setq lsp-bridge-enable-log nil)
(global-lsp-bridge-mode))
(use-package! wakatime-mode :ensure t)
;; fully enable tree-sitter highlighting
(after! tree-sitter

View File

@@ -22,7 +22,7 @@
;;layout ; auie,ctsrnm is the superior home row
:completion
(company +childframe)
;; (company +childframe) ; conflict with lsp-bridge
; the ultimate code completion backend
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
@@ -92,19 +92,19 @@
;;collab ; buffers with friends
;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv
(docker +lsp)
(docker)
editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay)
; run code, run (also, repls)
lookup ; navigate your code and its documentation
lsp ; M-x vscode
;; lsp ; lsp-mode, conflict with lsp-bridge
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
(terraform +lsp)
(terraform)
; infrastructure as code
tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp
@@ -117,7 +117,7 @@
:lang
;;agda ; types of types of types of types...
;;beancount ; mind the GAAP
(cc +lsp +tree-sitter)
(cc +tree-sitter)
; C > C++ == 1
;;clojure ; java with a lisp
;;common-lisp ; if you've seen one lisp, you've seen them all
@@ -138,37 +138,37 @@
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
(go +lsp +tree-sitter)
(go +tree-sitter)
; the hipster dialect
;;(graphql +lsp) ; Give queries a REST
;;(haskell +lsp) ; a language that's lazier than I am
;;(graphql) ; Give queries a REST
;;(haskell) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
(json +lsp +tree-sitter)
(json +tree-sitter)
; At least it ain't XML
(java +lsp +tree-sitter)
(java +tree-sitter)
; the poster child for carpal tunnel syndrome
(javascript +lsp +tree-sitter)
(javascript +tree-sitter)
; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
(latex +lsp)
(latex)
; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
(lua +lsp +tree-sitter)
(lua +tree-sitter)
; one-based indices? one-based indices
(markdown +grip)
; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
(nix +lsp +tree-sitter)
(nix +tree-sitter)
; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
org ; organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
(python +lsp +tree-sitter +pyright)
(python +tree-sitter +pyright)
; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
racket ; a DSL for DSLs
@@ -176,20 +176,20 @@
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
(rust +lsp +tree-sitter)
(rust +tree-sitter)
; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
(scheme +guile)
; a fully conniving family of lisps
(sh +lsp +tree-sitter)
(sh +tree-sitter)
; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
(web +lsp +tree-sitter)
(web +tree-sitter)
; support for various web languages, including HTML5, CSS, SASS/SCSS, Pug/Jade/Slim, and more
(yaml +lsp +tree-sitter)
(yaml +tree-sitter)
; JSON, but readable
;;zig ; C, but simpler

View File

@@ -4,6 +4,9 @@
;; To install a package with Doom you must declare them here and run 'doom sync'
;; on the command line, then restart Emacs for the changes to take effect -- or
;; use 'M-x doom/reload'.
(package! nerd-icons)
(package! rime)
(package! wakatime-mode
:recipe
(:host github :repo "wakatime/wakatime-mode" :files
@@ -12,7 +15,15 @@
(package! nushell-mode :recipe
(:host github :repo "mrkkrp/nushell-mode"))
(package! rime)
(when (package! lsp-bridge
:recipe (:host github
:repo "manateelazycat/lsp-bridge"
:branch "master"
:files ("*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources")
;; do not perform byte compilation or native compilation for lsp-bridge
:build (:not compile)))
(package! markdown-mode)
(package! yasnippet))
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;; (package! some-package)

View File

@@ -12,18 +12,26 @@
#-- python
nodePackages.pyright # python language server
python3Packages.black # python formatter
python3Packages.ruff-lsp
(python310.withPackages (
ps:
with ps; [
pynvim # Python client and plugin host for Nvim
ruff-lsp
black # python formatter
ipython
pandas
requests
pyquery
pyyaml
## emacs's lsp-bridge dependenciesge
epc
orjson
sexpdata
six
setuptools
paramiko
rapidfuzz
]
))

View File

@@ -188,13 +188,19 @@
source-han-serif # 思源宋体
# nerdfonts
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/data/fonts/nerdfonts/shas.nix
(nerdfonts.override {
fonts = [
# symbols icon only
"NerdFontsSymbolsOnly"
# Characters
"FiraCode"
"JetBrainsMono"
"Iosevka"
];
})
julia-mono
dejavu_fonts
];
};
}

View File

@@ -25,13 +25,19 @@
source-han-serif # 思源宋体
# nerdfonts
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/data/fonts/nerdfonts/shas.nix
(nerdfonts.override {
fonts = [
# symbols icon only
"NerdFontsSymbolsOnly"
# Characters
"FiraCode"
"JetBrainsMono"
"Iosevka"
];
})
julia-mono
dejavu_fonts
];
# user defined fonts