emacs备忘录

emacs

Posted by Deetch on June 4, 2018

源码安装

cd /usr/src
sudo mkdir emacs
sudo chmod 777 emacs
cd emacs
wget https://ftp.gnu.org/gnu/emacs/emacs-26.3.tar.xz
tar -xf emacs-VERSION.tar.xz
sudo apt-get build-dep emacs25 emacs25-bin-common emacs25-common emacs25-el
cd emacs-26.3
./configure
make
src/emacs -Q      # to test if its operating correct
sudo make install
make distclean

插件配置

company-mode

company-diag 可以查看使用的backend

~counsel-gtags~

deprecated

ggtags-mode

irony-mode

1.可以在.clang_complete(放置在项目根目录下即可)中设置参数,例如:

-std=c++11
-I/path/to/headers

2.可以使用JSON Compilation Database,如果使用cmake,可以这样使用:

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../

lsp-mode

Emacs client/library for the language server protocol

ccls

c/c++/objc language server supporting

cquery

c/c++ language server

rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang

selectrum

替代ivy

projectile

  • Find file in current project (s-p f)

  • Switch project (s-p p) (you can also switch between open projects with s-p q)

  • Grep (search for text/regexp) in project (s-p s g)

  • Replace in project (s-p r)

  • Invoke any Projectile command via the Projectile Commander (s-p m)

  • Toggle between implementation and test (s-p t)

  • Toggle between related files (e.g. foo.h <→ foo.c and Gemfile <→ Gemfile.lock) (s-p a)

  • Run a shell command in the root of the project (s-p ! for a sync command and s-p & for an async command)

  • Run various pre-defined project commands like:

    ** build/compile project (s-p c)

    ** test project (s-p T)

markdown-mode

本机安装markdown解析器 https://github.com/markedjs/marked

customize emacs shell command: marked

C-c C-c p        markdown转html

按键序列

xterm中打开emacs, C-q(quoted-insert) + 键组合()。 还可以从xterm.el中推测

FAQ

package找不到时

package-refresh-contents

mac

mac下使用homebrew-emacsmacport替代gnu emacs

META 和 ESC

META + KEY = ESC 后,再按 KEY