fix: emacs - code highlighting is buggy, remove lsp-bridge, add lsp-mode & copilot

fix: emacs - unicode symbols rendering is buggy, remove +pretty from org-mode
feat: emacs - add pandoc & jupyter for orgmode
This commit is contained in:
Ryan Yin
2024-01-13 14:55:15 +08:00
parent 1ec9c22fd0
commit 11bbedcde7
7 changed files with 53 additions and 71 deletions

View File

@@ -51,6 +51,13 @@ just emacs-reload
just emacs-clean
```
## Limits
- Emacs's markdown-mode works not well with tables, see:
- https://github.com/jrblevin/markdown-mode/issues/380
## Cheetsheet
Here is the cheetsheet related to my DoomEmacs configs. Please read vim's common cheetsheet at [../README.md](../README.md) before reading the following.

View File

@@ -72,11 +72,6 @@ in {
force = true;
};
xdg.configFile."emacs/lsp-bridge-user-langserver" = {
source = ./lsp-bridge-user-langserver;
force = true;
};
home.activation.installDoomEmacs = lib.hm.dag.entryAfter ["writeBoundary"] ''
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${doomemacs}/ ${config.xdg.configHome}/emacs/

View File

@@ -96,41 +96,21 @@
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
(after! vterm
(setq vterm-shell "nu")) ; use nushell by defualt
(use-package! lsp-bridge
:config
(setq lsp-bridge-enable-log nil) ;; disabled for performance
;; for user's custom langserver file
(setq lsp-bridge-user-langserver-dir "~/.config/emacs/lsp-bridge-user-langserver")
(setq lsp-bridge-enable-auto-format-code 1)
(global-lsp-bridge-mode))
(use-package! wakatime-mode :ensure t)
;; fully enable tree-sitter highlighting
(after! tree-sitter
(setq +tree-sitter-hl-enabled-modes t))
;; fix: https://github.com/jrblevin/markdown-mode/issues/380
;; even add this one, editing a large markdown table is still very slow.
;; so avoid editing large markdown file in emacs, use neovim instead...
;; and this setting make vterm's color theme not work!
;; (after! markdown-mode
;; (global-font-lock-mode 0))
;; use alejandra to format nix files
;; (use-package! lsp-nix
;; :ensure lsp-mode
;; :after
;; (lsp-mode)
;; :demand t
;; :custom
;; (lsp-nix-nil-formatter
;; ["alejandra"]))
(use-package! lsp-nix
:ensure lsp-mode
:after
(lsp-mode)
:demand t
:custom
(lsp-nix-nil-formatter
["alejandra"]))
(use-package! nushell-mode
:config
(setq nushell-enable-auto-indent 1))
(after! vterm
(setq vterm-shell "nu")) ; use nushell by defualt
;; emacs-rime
(use-package! rime
@@ -179,3 +159,16 @@
;; save on find-file
(add-to-list 'super-save-hook-triggers 'find-file-hook)
(use-package! copilot
:hook
(prog-mode . copilot-mode)
:bind
(:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word))
:config
(copilot-mode +1))
(use-package! wakatime-mode :ensure t)

View File

@@ -61,7 +61,7 @@
(format +onsave)
; automated prettiness
;; multiple-cursors ; editing in many places at once
;; objed ; text object editing for the innocent
;; objed ; text object editing for the innocent, conflict with parinfer
parinfer ; turn lisp into python, sort of, conflict with copilot/objed/smartparens
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
@@ -98,7 +98,7 @@
(eval +overlay)
; run code, run (also, repls)
lookup ; navigate your code and its documentation
;; lsp ; lsp-mode, conflict with lsp-bridge
lsp ; lsp-mode, conflict with lsp-bridge
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
@@ -117,7 +117,7 @@
:lang
;;agda ; types of types of types of types...
;;beancount ; mind the GAAP
(cc +tree-sitter)
(cc +lsp +tree-sitter)
; C > C++ == 1
;;clojure ; java with a lisp
;;common-lisp ; if you've seen one lisp, you've seen them all
@@ -138,17 +138,17 @@
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
(go +tree-sitter) ;; disable go-mode, use lsp-bridge instead
(go +lsp +tree-sitter) ;; disable go-mode, use lsp-bridge instead
; the hipster dialect
;;(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 +tree-sitter)
(json +lsp +tree-sitter)
; At least it ain't XML
(java +tree-sitter)
(java +lsp +tree-sitter)
; the poster child for carpal tunnel syndrome
(javascript +tree-sitter)
(javascript +lsp +tree-sitter)
; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
@@ -156,19 +156,19 @@
; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
(lua +tree-sitter)
(lua +lsp +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 +tree-sitter)
(nix +lsp +tree-sitter)
; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
(org +pandoc +present +roam2 +hugo +pretty) ; organize your plain life in plain text
(org +pandoc +hugo +jupyter) ; organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
(python +tree-sitter +pyright)
(python +lsp +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 +tree-sitter)
(rust +lsp +tree-sitter)
; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
(scheme +guile)
; a fully conniving family of lisps
(sh +tree-sitter)
(sh +lsp +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 +tree-sitter)
(web +lsp +tree-sitter)
; support for various web languages, including HTML5, CSS, SASS/SCSS, Pug/Jade/Slim, and more
(yaml +tree-sitter)
(yaml +lsp +tree-sitter)
; JSON, but readable
;;zig ; C, but simpler

View File

@@ -15,15 +15,10 @@
(package! nushell-mode :recipe
(:host github :repo "mrkkrp/nushell-mode"))
(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))
(package! copilot
:recipe
(:host github :repo "copilot-emacs/copilot.el" :files
("*.el" "dist")))
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;; (package! some-package)

View File

@@ -1,10 +0,0 @@
{
"name": "nil",
"languageId": "nix",
"command": ["nil"],
"settings": {
"nil": {
"formatting": { "command": ["alejandra"] }
}
}
}

View File

@@ -14,7 +14,7 @@
checkmake
# c/c++ compiler, required by nvim-treesitter!
gcc
# c/c++ tools with clang-tools, the unwrapped version won't
# c/c++ tools with clang-tools, the unwrapped version won't
# add alias like `cc` and `c++`, so that it won't conflict with gcc
llvmPackages.clang-unwrapped
lldb
@@ -27,6 +27,7 @@
ruff-lsp
black # python formatter
jupyter
ipython
pandas
requests
@@ -120,6 +121,7 @@
marksman # language server for markdown
glow # markdown previewer
fzf
pandoc # document converter
#-- Optional Requirements:
gdu # disk usage analyzer, required by AstroNvim