Skip to content

appleshan/my-spacemacs-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apple Shan 的 Emacs 配置 ✨

'||''''|  '||    ||'     |       ..|'''.|  .|'''.|
 ||  .     |||  |||     |||    .|'     '   ||..  '
 ||''|     |'|..'||    |  ||   ||           ''|||.
 ||        | '|' ||   .''''|.  '|.      . .     '||
.||.....| .|. | .||. .|.  .||.  ''|....'  |'....|'

Hacking 始于 2012 年。2015 年爱上 Spacemacs 😄 💖

我的 Spacemacs 配置一共有两部分: 一个 .emacs.d 目录,是 Spacemacs 的原始代码,未做任何修改; 一个 .spacemacs.d 目录,存放私有 layer。

Emacs version

Tested on versions:

Screenshot

./local/img/spacemacs-demo-1.png ./local/img/spacemacs-demo-2.png

🔰 Installing

#!/usr/bin/env bash
##########################################################################
# install emacs config automatically.
# by Apple Shan (apple.shan@gmail.com)
##########################################################################

# sudo pacman -S emacs

cd ~/projects/

# clone syl20bnr/spacemacs repo
git clone -b develop --depth 1 https://github.com/syl20bnr/spacemacs.git spacemacs-develop

# clone appleshan/my-spacemacs-config and submodule
git clone --recursive https://github.com/appleshan/my-spacemacs-config.git spacemacs-private

# git submodule
# 如果已經抓下來才發現 submodule 是空的,可以用以下指令去抓
cd spacemacs-private
git submodule update --init --recursive

rm ~/.emacs.d
rm ~/.spacemacs.d

# 建立软链接
# ln -s <源文件> <目标> 创建一个符号链接
ln -s ~/projects/spacemacs-develop ~/.emacs.d
ln -s ~/projects/spacemacs-private ~/.spacemacs.d

# 验证软链接建立成功
la ~/ |grep emacs

################################################################################
# 按照其他 package

# all-the-icons
# Installing Fonts
M-x all-the-icons-install-fonts

# dired-k
cd ~/.spacemacs.d/local/
git clone https://github.com/appleshan/emacs-dired-k dired-k

# terminal-here
cd ~/.spacemacs.d/local/
git clone https://github.com/appleshan/terminal-here terminal-here

# pyim-bigdict.pyim
wget http://tumashu.github.io/pyim-bigdict/pyim-bigdict.pyim.gz

################################################################################
# 安装外部程序

# Install miniconda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh
rm -rf ./Miniconda3-latest-Linux-x86_64.sh

# ditaa
mkdir -p /opt/java/ditaa0_9
cd /opt/java/ditaa0_9
wget https://downloads.sourceforge.net/project/ditaa/ditaa/0.9/ditaa0_9.zip
unzip ditaa0_9.zip

# graphviz

现在可以打开 Emacs 24.5+ 开始使用我的配置了。

📚 配置说明

  1. 我的配置主要分成 16 个 layer:
  • appleshan-core
  • appleshan-complete
  • appleshan-appearance
  • appleshan-navigation
  • appleshan-notify
  • appleshan-shell
  • appleshan-dired
  • appleshan-org
  • appleshan-chinese
  • appleshan-programming
  • appleshan-python
  • appleshan-java
  • appleshan-javascript
  • appleshan-web
  • appleshan-lisp
  • appleshan-misc 这些 layer 是对 spacemacs 本身的一些扩展。
  1. 我的这个配置使用了 evil。 所以,对于 Vim 党来说会比较友好一点。
  2. 我的配置用了很长时间了,相信你也会喜欢的。

Dependencies

设置 HOME 环境变量

  • Linux 无需设置。例如:/home/appleshan
  • Windows 10 HOME=D:/home/appleshan

使用软链接(符号链接)管理配置

  • Linux
  • Windows 10
mklink /D d:\.emacs.d d:\projects\spacemacs-develop.d
mklink /D d:\.spacemacs.d d:\projects\my-spacemacs-config.d

注意:mklink 支持 Windows 7 及以上版本

Fonts

我最近几乎一直都在使用 Hack 或 Source Code Pro,在 Linux 和任何其他计算机上,对我来说都是相当不错的。 字体我可能会或可能不会使用(没有特定的顺序):

  • Hack
  • Source Code Pro
  • Input Mono
  • Inconsolata
  • DejaVu Sans
  • 文泉驿
  • 微软雅黑

diff

  • Windows 10

http://gnuwin32.sourceforge.net/packages/diffutils.htm 下载:Binaries 与 Dependencies,然后把 Dependencies 中解压出来的 libintl-2 和 libiconv-2 copy 到 Binaries 的 bin 目录,最后,把 bin 目录加入环境变量 PATH .

Git

@see http://blog.miniasp.com/post/2014/05/22/Credential-Store-for-Git-HTTP-HTTPS.aspx

# 设置 github 的用户名
git config --global user.name "appleshan"
git config --global user.email apple.shan@gmail.com

# 设置编辑器
git config --global core.editor emacs

# 设置永久存储用户名和密码
git config --global credential.helper store

# 关闭 git 自动改换行符的功能
git config --global core.autocrlf false

python

Python Language Server

pip install python-language-server[all]

Auto-completion: Anaconda dependencies

pip install --upgrade "jedi>=0.9.0" "json-rpc>=1.8.1" "service_factory>=0.1.5"

Syntax checking

Syntax checking uses `flake8` package:

pip install flake8

importmagic

importmagic 用来自动引入需要的包

pip install importmagic epc

autoflake

To be able to suppress unused imports easily, install autoflake:

pip install autoflake

autopep8

autopep8 用来检查 PEP8 规范

pip install autopep8

yapf

yapf 用来格式化代码

pip install yapf

rope

a python refactoring library

pip install rope

pylookup

要离线浏览 python 文档,按以下步骤安装环境:

该包提供了 makefile 可以完成以上的 3 个步骤:

make download

注意:如果 OS 中的 python 版本与 python 文档的版本不一样,可以先手动修改 makefile 中的 VER 行, 指定文档的版本,再执行”make download”.

VER := 3.6.4

Setup up Shell Environment

~.spacemacs.d\layers\appleshan-shell\config.el

  • Linux
/home/appleshan/bin
/home/appleshan/bin/cli
/home/appleshan/.local/bin
/home/appleshan/perl5/bin
/home/appleshan/bin/sift
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/opt/oracle/lib
/opt/jdk/jdk1.8.0_102/bin
/opt/jdk/apache-maven-3.3.9/bin
/opt/eclipse-jee-neon/eclipse
  • Windows 10
D:/bin
D:/lang/python/Python361
D:/lang/python/Python361/Scripts
D:/lang/python/Python2713
D:/lang/python/Python2713/Scripts
D:/portable-soft/cmder
D:/portable-soft/PortableGit/bin
D:/portable-soft/PortableGit/mingw64/libexec/git-core
C:/Program Files (x86)/GnuPG/bin/
C:/Windows/System32

Skill

用 Emacs, 需: 忘记鼠标, 无视菜单.

Emacs lsp-mode

@see https://github.com/emacs-lsp/lsp-mode

  • completion

C-M-i (completion-at-point)

  • Goto definition

M-. (xref-find-definition)

  • Symbol references

M-? (xref-find-references)

  • Flycheck

SPC e l (spacemacs/toggle-flycheck-error-list)

  • Imenu

helm-imenu

References & Resources

Happy Hacking