本文就我最近开发的一个先后端的项目(名字叫作 yavueblog) 来简单介绍两个神器css
我在开发这个先后端的项目的时候要开启要经过很多的命令来启动服务:前端
个人平常任务以下以下:vue
之前的作法都是新建三个终端选项卡,而后第一个终端分两屏,而后分别到各个终端 cd 或者 autojump 到对应的目录,而后手动运行命令。mysql
加上运行 npm run dev:theme 的时候,我是经过 Python 的 watchdog 来实现对指定目录和指定类型文件的变化进行监听的,因此还要切换 PyEnv 自定义的 Python 的环境中。git
这些命令反反复复输入仍是挺麻烦的事情,为什么不用工具来解决呢?github
先安装sql
brew install tmux
brew install ruby
gem install tmuxinator
复制代码
什么是 tmux? 简单而言,就是一个终端复用软件。 什么是 tmuxinator? 简单而言,就是为了简化 tmux 操做的软件。只须要编写 yaml 即快速开启一个比较适合你的终端窗口布局。docker
关于 tmux 的配置,推荐这个 repo数据库
https://github.com/gpakosz/.tmuxnpm
输入 tmuxinator new yavueblog
修改文件以下
# ~/.tmuxinator/yavueblog.yml
name: yavueblog
root: ~/Codes/PublicRepos/YaBlogSystem/
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
pre_window: pyenv activate 3.5.2/envs/py3-daily
windows:
- "网站开发":
layout: main-vertical
# Synchronize all panes of this window, can be enabled before or after the pane commands run.
# 'before' represents legacy functionality and will be deprecated in a future release, in favour of 'after'
# synchronize: after
panes:
- "cd ./YaVueBlog/ && npm run dev"
- "cd ./YaVueBlog/ && npm run dev:theme"
- "iconfont 构建": "cd ./YaVueBlog/ && npm run dev:iconfont"
- "DockerizedDjango": "cd ./YaDjangoBlog/ && make docker-compose-build-up"
复制代码
这样的话,每次开发就只须要运行 tmuxinator start yavueblog,而且打开 IDE 直接捋起袖子就是干就行了。
若是你刚用 tmux 的话,火速掌握下面三个小技巧。要否则会抓狂的。
https://superuser.com/questions/209437/how-do-i-scroll-in-tmux
https://superuser.com/questions/196060/selecting-text-in-tmux-copy-mode
ChangeLog: