Skip to content

Latest commit

 

History

History
777 lines (645 loc) · 25.8 KB

emacs.org

File metadata and controls

777 lines (645 loc) · 25.8 KB

Emacs

customize

helps

C-h v comands
customize the settings
C-M-\ zusammen runs the command indent-region (ESC C-\ getrennt)
C-h c runs the command describe-key-briefly
C-j runs the command org-return-and-maybe-indent
C-q runs the command quoted-insert
C-d runs the command org-delete-char
M-DEL (translated from <M-backspace>) runs the command backward-kill-word
M eqaul to C-u

bookmark

C-x r mbookmarks set
C-x r bbookmark jump

configuration with packages

how to extension the packages from someone already wrote

M-x load file ~/.emacs.d/packages/echo-keys.el
M-x echo-keys-mode
(global-set-key "\C-o" 'compile)
(global-set-key "\C-\M-r" 'ranger)


file control dired & treemacs

mode dired

enter or a or fenter the file
c or C-oother buffer view
+creat a directory
mmark
Ccopy to
Rrename or move
Ddelete

mode treemacs

this can be another helpful control tool, ? for help

C-M-rtreemacsopen folder
?help
M-oto treemacsfrom file to treemacs

Virtual environment

在terminal 打开虚拟环境后,在打开 Emacs Emacs 会继承这些环境变量

shortcut Emacsclient

emacsclient -a "" -c

hotkey setting

M-x: global-set-key Press the wanted keybindings input the mapped command

(global-set-key "\C-o" 'compile)

chinese fonts

M-x install cnfonts安装
(require ‘cnfonts)enable config
M-x cnfonts-edit-profileconfig
(cnfonts-enable)load from start
M-x cnfonts-set-font-with-saved-step手动加载
M-x cnfonts-decrease-fontsize增大整个系统的字体大小
M-x cnfonts-increase-fontsize减小

daemon process

alias emc=”emacsclient -c ”

emacs --daemon
emc xxx.org

error

if by configuration failed, emacs –debug-init find the postion M-x: goto-char postion

EMACS Commands

commandsfunctionsexplain
C-c C-pcall the functionsexecute buffer for language (python)
C-c C-cexecute programm or functionwatch out the execute envirment
C-c C-oopen website linklinks or website both
C-c C-wsave as另存为
C-u C-x C-eexecute expression forcethe results show where the cursor it
C-M-xopen shellM-x term
C-M-SPCmark the wordthe whole worlds
M-xcustomize-option Word-wrapON, 关掉换行

Timer

commandsfunctionsexpression
C-c C-x 0start the timerfrom 00:00:00
C-c C-x -print the timehow long has been start
C-c C-x ,pause or continueone pause, one continue
C-u C-c C-x ,stopclear all

Extension

Yasnippes

first make sure wich mode you are, so the new setting can only be used in the same mode, and the mode must be save in this mode

M-x yas-new-snippes

mu4e

mu4eopen mail client
A e 1 & 1view attachments
C-c C-aadd attachment
g 2go to the second link

eww

q :for quit w(eww-copy-page-url) :copy the URL

d (eww-download) g (eww-reload) l(eww-back-url) :previous seit r(eww-forward-url) :forward seit

b(eww-add-bookmark) : add current seit as bookmark B(eww-list-bookmarks) : view bookmark

S(eww-list-buffers) s(eww-switch-to-buffer)

& (eww-browse-with-external-browser) eww-use-external-browser-for-content-type v (eww-view-source)

C (url-cookie-list)

helpful mode for edit

M-x linum mode
M-x check parens
M-x show-parent-mode  (Error :end file of parsing) can be caused by lack of parentheses

Rectangle

add content for all select linesstring-insert-rectangle
add content for all select linesstring-rectangle
cut content for all select mark regionC-x SPE C-w
post content for all select mark regionC-x SPE C-y

Org mode

rich text

Everything should be made as simple as possible, but not any simpler —Albert Einstein

Everything should be made as simple as possible,
but not any simpler

here I will try some nows, and this is to be funny, and underlined.

commods

org mode manual in emccsM-x org-info
C-x C-qenable readonly
C-;可以检查当前单词的拼写
sudo apt install grip, M-x grip modelive compile for markdown
C-c C-zadd note to items, quick note
C-c C-cswitch between them

checklist

可以在item后面加上[0/2] or [0%]

  • [ ] S-A-Ent for a new checklist
  • [ ] C-c C-c to finish this checklist

link

commandsfunctionexplain
C-c C-ogoto the linkmust in the link description
C-c C-ledit the linkalso in the link
C-c C-.go back

mark the link in file

* headline
#+NAME: target
<<target>>
#+alias
#+title
org-store-link

use the mark, which is marked

[[.../file.org::345]] go to the file of line 345
[[.../file.org::target]] to to the file with target, 3 kinds of internal
[[file:~/code/main.c::255  ]]               进入到 255 行
[[file:~/xx.org::My Target ]]                   找到目标‘<<My Target>>’
[[file:~/xx.org::#my-custom-id]]               查找自定义 id 的项

org-insert-link


org-msg

- mbsync setting seeing in Dropbox
- C-c C-m to send email
- math :file output.png -> C-c C-c
- digraph ->
- graph --

org-noter

M-x: package install : org-noter
- open xxx.pdf as emacs
- M-x: org-noter -> create a file as assige its position(a image without type name will be created)
- i for generic notes, M-i for special note with mouse to click
- give name and make notes
- C-M- (. p n) check notes for current, previous, and after notes 
with a rot arrow to the file

org-reveal reveal.js & ox-reveal

need to download reveal-js(unzip, and path pass to org-reveal-root) reveal.js download need to download org-reveal(were replace by ox-reveal) org reveal ox reveal

#+OPTIONS: num:nil toc:nil
#+REVEAL_TRANS: None/Fade/Slide/Convex/Concave/Zoom
#+REVEAL_THEME: Black/White/League/Sky/Beige/Simple/Serif/Blood/Night/Moon/Solarized
#+Title: Title of Your Talk
#+Author: Your Name
#+Email: Your Email Address or Twitter Handle

org-html-themes

org-html-themes github

add this at the top 
#+SETUPFILE: https://fniessen.github.io/org-html-themes/setup/theme-readtheorg.setup

或者下载后用本地的模板

# -*- mode: org; -*-

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="/home/sx/Dropbox/Sprache/Emacs/orgmode/org-html-themes/styles/readtheorg/css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="/home/sx/Dropbox/Sprache/Emacs/orgmode/org-html-themes/styles/readtheorg/css/readtheorg.css"/>

#+HTML_HEAD: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="/home/sx/Dropbox/Sprache/Emacs/orgmode/org-html-themes/styles/lib/js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="/home/sx/Dropbox/Sprache/Emacs/orgmode/org-html-themes/styles/readtheorg/js/readtheorg.js"></script>


org-mind-map

github link is here,

M-x org-mind-map-write to execute

add legend, text display, image display

:org-mind-map-include-text t :org-mind-map-include-image t

org-roam

org-roam-mode org-roam-db-build-cache org-roam-find-index org-roam-find-file org-roam-insert

org-journal

<<quickstart>>

M-x org-journal-modeactivate the mode
C-c C-j(org-journal-new-entry)create one, can be today, can be in the futher
C-u C-c C-jgo to the current entry
C-c C-tadd TODO
C-c C-dadd deadline
C-c a aview in agenda

lsp-java

lsp-java github.io

dap-java github.io

lsp-java github

dap-java github

lsp-java-generate-getters-and-setters需要安装helm在所有的可选中 C-SPE 选中

helm

for C-x C-f :find files C-l go back to the above directory

(helm-mode 1)
(require 'helm-config)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
(global-set-key (kbd "C-x C-f") 'helm-find-files)

helm-org-rifle

在已经打开的所有文件中匹配搜索关键词,是所有打开文件
keywords searching in all opened files, external files,

tree graph

(graph-draw-binary-tree '(1 (2 (3) (4)) (5)))

(graph-draw-tree '((north-america (usa
                                    (miami)
                                    (seattle)
                                    (idaho (boise))))
                   (europe (germany)
                            (france (paris)
                                     (lyon)
                                     (cannes)))))

ox-beamer

for images see hpc report

SRC block

commands

<s Tabold version (require ‘org-tempo) new version executable
C-c C-,new version
C-c C-x C-vview png of latex in SRC
C-c C-x C-lview image of latex in pure orgmode
C-c ’edit all src in a new buffer with mode

options

src 前缀

#+name: blocknameblockname 可以被:noweb yes的代码块调用
#+call :blockname(x = 3)
#+PROPERTY: tangle xxx.tex全文所有相关码块导出到xxx.tex文件
#+PROPERTY: comments org全文org格式内容(不在src块中)导出时被注释

src 后缀

languagefunction
C/python/emacs-lisp
:file abc.org
:dir指定生成代码的路径
:results output
:export (到html文件)code 只导出代码,results 只是结果 ,both
:session my可切换到生成的my buffer 操作
:tangle (创建源码)文件名,yes, no
:noweb yes对tangle和export作用
:tangle xxx.py输出文件
:var x=2
:shebang指定码块的解释器

noweb:可以使用任何设定了名字的代码块,每次都是重新执行一遍所有相关代码。 session:后台会启动一个相应的解释器控制台,所有名称相同的代码块都会被加 载到该控制台,一直运行,并可以交互。

ditaa

sudo apt-get install ditaa C-c C-x C-v to view

+---------+
|         |
| 1       |
|         |
+----+----+---+
|222 |233     |
|    |        |
+----+--------+

+------+   +-----+   +-----+   +-----+
|{io}  |   |{d}  |   |{s}  |   |cBLU |
| 2oo  +---+ Bar +---+ Baz +---+ Moo |
|      |   |     |   |     |   |     |
+------+   +-----+   +--+--+   +-----+
                        |
           /-----\      |      +------+
           |     |      |      | c1AB |
           | Goo +------+---=--+ Sh12 |
           \-----/             |      |
                               +------+

graphviz

sudo apt install graphviz

  digraph diagramm {
          MG [shape= box,color = red]
          MG1 [shape=box,color=red]        
          lambdaL1 [color=red]
          ROOT [shape=diamond]
          ROOT2 [shape=diamond]

          mh2 -> MG;
          mh3 -> MG;
          lambdaL1->MG;
          MG -> cs1[label = "pp>h2h2j"];
          cs1 -> ROOT[label = "w"];
          MG -> data_file;
          data_file -> Events_file [label = "1"];
          Events_file -> ROOT;
          ROOT -> sigma1;
          sigma1 -> lambdaL2[label = "2"];
          lambdaL2 -> MG1;	
          MG1->cs2;
          cs2 -> ROOT2[label = "w"];
          MG1 -> data_file_1;
          data_file_1 -> ROOT2 [label = "1"];
          ROOT2 -> sigma2;
          sigma2 -> lambdaL;

}

\begin{eqnarray*} \hat{f}(x) & \propto & ∑ν \frac{|F(ν)H(ν)|^2}{|N(ν)|^2} \frac{G(ν)}{H(ν)} e\frac{2 π i ν x{N}}
& \propto & ∑ν \frac{|F(ν)|^2}{|N(ν)|^2} H(ν) H^*(ν) \frac{G(ν)}{H(ν)} e\frac{2 π i ν x{N}}\ & \propto & ∑ν H^*(ν) G(ν) e\frac{2 π i ν x{N}} \end{eqnarray*}

Maxwell’s Equations

\begin{align} ∇ × \vec{\mathbf{B}} -\, \frac1c\, \frac{∂\vec{\mathbf{E}}}{∂ t} & = \frac{4π}{c}\vec{\mathbf{j}}
∇ ⋅ \vec{\mathbf{E}} & = 4 π ρ \ ∇ × \vec{\mathbf{E}}\, +\, \frac1c\, \frac{∂\vec{\mathbf{B}}}{∂ t} & = \vec{\mathbf{0}} \ ∇ ⋅ \vec{\mathbf{B}} & = 0 \end{align}

Matrix

\begin{equation} skk’= \left( \begin{array}{ccc} h1k & \cdots & hnk \end{array} \right) \left( \begin{array}{ccc} \bar{q}11 & \cdots & \bar{q}12
\vdots & \ddots & \vdots\ \bar{q}n1 & \cdots & \bar{q}n2 \end{array} \right) \left( \begin{array}{c} h1k’ \ \vdots \ hnk’ \end{array} \right) \end{equation}

\begin{matrix} 0 & 1 \ 1 & 0 \end{matrix} \begin{pmatrix} 0 & 1 \ 1 & 0 \end{pmatrix} \begin{bmatrix} 0 & 1 \ 1 & 0 \end{bmatrix} \begin{Bmatrix} 0 & 1 \ 1 & 0 \end{Bmatrix} \begin{vmatrix} 0 & 1 \ 1 & 0 \end{vmatrix} \begin{Vmatrix} 0 & 1 \ 1 & 0 \end{Vmatrix}

symbolic math

$α$ $β$ $γ$ $Δ$ If $a^2=b$ and \( b=2 \), then the solution must be either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].

parentheses

set $$ X = \left( \begin{aligned} aa \ bb\cc \end{aligned} \right) $$

Tabelle

\begin{table}[htbp]
\centering
\begin{tabular}{|c|c|c|}
Überschrift 1 & Überschrift 2 & berschrift 3 \\
\hline
Eins & Zwei & Drei \\
Vier & Fünf & Sechs \\
\end{tabular}
\caption[Tabelle]{Tolle Tabelle}
\label{tab:toll1}
\end{table}

Special characters

 latex-math-preview-insert-mathematical-symbol
this is to add special characters for latex

Formation

添加大括号

\begin{cases}
\end{cases}

增加分行

\begin{aligned}
\end{aligned}

在orgmode中,Esc下面的~键可以调出希腊字母输入 C-z也可以调出特殊字符输入

$\mathcal{L}$
$\mathcal{B}$

$\mathcal{L}$ $\mathcal{B}$

Compile Python2

1. in Orgmode using SRC to save a python2 programm, with its interpreter
2. C-c ' opening the buffer
3. C-c C-p open the python interpreter, weather it is wanted
4. mark the region in programm buffer
5. C-c C-r import the marked region to the interpreter

Agenda & capture & todo

comandsexplainfunction
C-c cadd new capturecapture
C-c C-s [fn:01]add new scheduling to itemsagenda
C-c C-t [fn:02]add new TODO to itemstodo
C-c C-dadd new deadline to itemsagenda
C-c acheck agenda functionagenda
C-c a acheck all agenda itemsf, b
S-ffrom capture list to fileagenda
C-’ [fn:03]switch in all agenda fileagenda
C-c C-x C-cview todo, pri and tags of itemssummary
C-c C-c(q)add tags in itemsmust in items

[fn:01] 在任何的item上,C-c C-s都可以增加scheduling,可以个性的指定加入的 日期和时间。如果该item有TODO 特性,增加 ++1w 在时间后面,可以多次更新

[fn:02] 在上次更新的-State “DONE”之前加上本次的完成情况,然后不管TODO 的标签是什么,C-c C-t d (done), 该item的scheduling将会被自动更新到下 一次的设定时间(一周后)。在时间轴上显示历次完成情况.

[fn:03] shift + f can dynamical view the agenda items. and Tab goto the linked agenda file.

ispell-region

mark all the region I want to check, and M-X ispell-region space for nothing and numbers for replace.

notebook-jupyter

conda activate tf emacs xxx.ipynb C-c C-o

official link document emacs ipython notebook github link

Install

M-x package-refresh-contents RET M-x package-install RET ein RET

emacs xxx.ipynb C-c C-l/o

commands

C-c C-aein:worksheet-insert-cell-above-km向上插入cell
C-c C-bein:worksheet-insert-cell-below-km向下插入cell
C-c C-cein:worksheet-execute-cell-km执行cell
C-c C-kein:worksheet-kill-cell-kmkill cell
C-c C-sein:worksheet-split-cell-at-point-km划分cell
C-c C-wein:worksheet-copy-cell-km复制cell
C-c C-lein:worksheet-clear-output-km清除结果
C-c C-uein:worksheet-change-cell-type-km更换属性cell
C-c C-zein:notebook-kernel-interrupt-command-km中断cell
C-c C-yein:worksheet-yank-cell-kmyank cell
C-c RETein:worksheet-merge-cell-km向上融合cell
C-c C-fein:file-open-km打开文件
C-c C-pein:worksheet-goto-next-input-kmprevious(<C-down>)
C-c C-nein:worksheet-goto-prev-input-kmNext (<C-up>)
M-Entein:worksheet-execute-cell-and-goto-next-kmexecute, goto next
C-u C-c C-cein:worksheet-execute-all-cells
C-c C-eein:worksheet-toggle-output-km
C-c C-nein:worksheet-goto-next-input-km
C-c C-oein:notebook-open-km
C-c C-pein:worksheet-goto-prev-input-km
C-c C-qein:notebook-kill-kernel-then-close-command-km
C-c C-rein:notebook-reconnect-session-command-km
C-c C-tein:worksheet-toggle-cell-type-km
C-c C-vein:worksheet-set-output-visibility-all-km
C-c C-xPrefix Command