From bdaadb921abfb2e18f41b570dc36548da4bcaa5e Mon Sep 17 00:00:00 2001 From: gaze <397334393@qq.com> Date: Tue, 29 Aug 2023 17:11:19 +0800 Subject: [PATCH] feat: translate --- README.md | 400 +++++++++++++++++++++++++-------------------------- README_EN.md | 327 +++++++++++++++++++++++++++++++++++++++++ Rakefile | 4 +- 3 files changed, 528 insertions(+), 203 deletions(-) create mode 100644 README_EN.md diff --git a/README.md b/README.md index bb3b86e..2c4743e 100644 --- a/README.md +++ b/README.md @@ -1,141 +1,142 @@

-

Dotar is an all-in-one dev configuration for your mac/linux which includes setup for zsh, spacevim(nvim), tmux and many more

+

Dotar是一个包含了zsh, spacevim(nvim), tmux和许多其它工具的多合一的Mac/Ubuntu开发环境

-# The story -Dotar got its name by the combination of `dot` and `tar` which means package(`tar`) dotfiles togeter. -# Get started -## Requirements -* `zsh`, `tmux`, `vim`, `ag` are installed and zsh is set as your login shell: +# 背景 +Dotar的名字源于`dot`和`tar`的结合,代表者打包(`tar`)文件。 +# 开始 +## 需求 +* `zsh`, `tmux`, `vim`, `ag`已经安装,并且zsh作为你的默认终端: ```sh chsh -s $(which zsh) ``` -* `Python 3` and `pynvim` as some layers(`denite`) can't be loaded if they are missing +* 如果缺少`Python 3`和`pynvim`等一些层(如`denite`),则无法加载它们。 ```sh python3 -m pip install --user --upgrade pynvim ``` -## Install +## 安装 ```sh -bash -c "`curl -fsSL https://git.bitnet.fun:5004/Gaze/dotar/raw/commit/21638953a830aa657b1e0fe1b14ff65a1694ef60/install.sh`" +bash -c "`curl -fsSL https://git.bitnet.fun:5004/Gaze/dotar/raw/branch/master/install.sh`" ``` -## Upgrade +## 升级 ```sh cd ~/.yadr git pull --rebase rake update ``` -# Modules +# 模块 * ZSH - * [Prezto - the zsh behind YADR's](http://github.com/sorin-ionescu/prezto) - * [How to add your own ZSH theme](doc/zsh/themes.md) + * [Prezto - YADR背后的zsh配置框架](http://github.com/sorin-ionescu/prezto) + * [如何添加你自己的ZSH主题](doc/zsh/themes.md) ## Zsh Commands -#### [Files](./zsh/files.zsh) -Command | Args | Description +#### [文件](./zsh/files.zsh) +命令 | 参数 | 描述 :--------|:------|:----------- -swap | F1 F2 | swap file F1 with file F2 -Replace |[doc](#Replace) |Replace text recursively +交换 | F1 F2 | swap file F1 with file F2 +替换 |[doc](#Replace) |Replace text recursively -Replace -options: +替换 +选项: ```sh - -f File regex pattern - -s Source pattern - -d Destination pattern - -r Remove line - --regex Match pattern with regex - --seperator= Seperator, # by default - -h Display this message" + -f 文件正则表达式模式 + -s 源模式 + -d 目标模式 + -r 删除行 + --regex 使用正则表达式匹配模式 + --seperator= 分隔符, # 默认 + -h 显示这条信息" ``` -#### Editing -Shortcut | Alias +#### 编辑 +快捷键 | 别名 :-----------|:-------- -Ctrl-R | Vim mode and bash style historical anti-query -ae | Edit alias -ar | Reload alias -ESC C-x C-e |Edit current command line in vim +Ctrl-R | Vim模式和Bash风格的历史反向查询 +ae | 编辑别名 +ar | 重载别名 +ESC C-x C-e | 在vim中编辑当前的命令行 -#### Network -Command | Description +#### 网络 +命令 | 描述 :-----------|:-------- -test-port PORT | test whether PORT is opened -intercept-request-hosts | intercept requests and show hosts -host-ip | show host ip of your system +test-port PORT | 测试这个PORT是否打开 +intercept-request-hosts | 拦截请求并显示主机信息 +host-ip | 显示您系统的主机IP地址 -#### System -Command | Description +#### 系统 +命令 | 描述 :-----------|:-------- -yell | print the script name and all arguments to stderr -die | does the same as yell, but exits with a non-0 exit status, which means "fail". -try | uses the || (boolean OR), which only evaluates the right side if the left one didn’t fail. -list-large-files DIR | list large files sort by reversed order of size and print size in the order of `KB`, `MB`, `GB` +yell | 将脚本名称和所有参数打印到标准错误(stderr)流中 +die | 与yell相同,但以非0退出状态退出,表示“失败” +try | 使用 ||(布尔逻辑中的"或")运算符,只有在左侧表达式未失败时才会评估右侧表达式 +list-large-files DIR | 列出大文件,按照文件大小的倒序排序,并按照`KB`, `MB`, `GB`的顺序打印文件大小 -#### String -Command | Description +#### 字符串 +命令 | 描述 :------------|:-------- -random-hex | print random hex -random-string| print random string of alphabets `a-zA-Z0-9` -contains |str1 str2 ... target |test whether a target string is included in an array of strings +random-hex | 打印随机十六进制数 +random-string| 打印由字母`a-zA-Z0-9`组成的随机字符串 +contains |str1 str2 ... target |测试目标字符串是否包含在字符串数组中 #### Git -YADR will take over your ~/.gitconfig, so if you want to store your git username and other settings, please put them in ~/.gitconfig.user +YADR将接管您的~/.gitconfig文件,因此如果您想要存储git用户名和其他设置,请将它们放在~/.gitconfig.user中。 -We recommend setting your user information in this file. In addition, you can set your environment variables appropriately in your ~/.secrets. +我们建议在此文件中设置您的用户信息。此外,您可以在~/.secrets中适当设置环境变量。 -Command | Alias -:--------|:-------- -`ga` |`git add` -`gb` |`git branch` -`gbc` or `gnb` |`git checkout -b` -`gbs` |`git show-branch` -`gc` |`git commit --verbose` -`gco` |`git checkout` -`gcp` |`git cherry-pick --ff` -`gd` |`git diff` -`gf` |`git fetch` -`gfc` |`git clone` -`gfm` |`git pull` -`gfr` |`git pull --rebase` -`gl` |`git log` -`gpc` |`git push --set-upstream origin "$(git-branch-current 2> /dev/null)"` -`gr` |`git rebase` -`gra` |`git rebase --abort` -`grc` |`git rebase --continue` -`grs` |`git rebase --skip` -`gsd` |`git stash drop` -`gsl` |`git stash list` -`gsp` |`git stash pop` -`gst` |`git stash` +命令 | 别名 | 描述 +:--------|:--------|:--------- +`ga` |`git add`| +`gb` |`git branch`|新建分支 +`gbc` or `gnb` |`git checkout -b`|新建并切换到新分支 +`gbs` |`git show-branch`| +`gc` |`git commit --verbose`| +`gco` |`git checkout`|切换到目标分支 +`gcp` |`git cherry-pick --ff`| +`gcf` |`git commit --amend --reuse-message HEAD`|重新提交且不更改commit信息 +`gd` |`git diff`| +`gf` |`git fetch`| +`gfc` |`git clone`| +`gfm` |`git pull`| +`gfr` |`git pull --rebase`|拉取远程分支更新到本地 +`gl` |`git log`| +`gpc` |`git push --set-upstream origin "$(git-branch-current 2> /dev/null)"`|将本地更改推送到远程的同名分支 +`gr` |`git rebase`|合并分支到此分支 +`gra` |`git rebase --abort`| +`grc` |`git rebase --continue`| +`grs` |`git rebase --skip`| +`gsd` |`git stash drop`| +`gsl` |`git stash list`| +`gsp` |`git stash pop`| +`gst` |`git stash`| -#### Other -- `secure_source` -source `~/.yadr/zsh/function.zsh` file, let `function.zsh` modify work immediately in current window -- `pp $1` -useage:`pp xx`, grep process by name -- `set_proxy` -set terminal proxy use http proxy -- `set_vagrant_proxy` -set terminal proxy use vagrant http proxy -- `set_ss_proxy` -set terminal proxy use socks proxy -- `unset_proxy` -cancel all proxy -- `post $1 $2` -curl POST with application/json -- `docker_rm_all` -delete all docker images -- `kexec` -execute k8s pod by regex pod name -- `klog` -show k8s pod log by regex pod name -- `git_tag_delete` -delete gtihub tag -- `git_tag_add` -add gtihub tag -- `dc` -alias of docker-compose +#### 其它 +- `secure_source` - 使 `~/.yadr/zsh/function.zsh` 文件生效, 使 `function.zsh` 中的更改在当前窗口生效 +- `pp $1` - 用法:`pp xx`, 按名称搜索进程 +- `set_proxy` - 设置终端代理以使用HTTP代理 +- `set_vagrant_proxy` - 设置终端代理以使用Vagrant的HTTP代理 +- `set_ss_proxy` - 设置终端代理以使用SOCKS代理 +- `unset_proxy` - 取消所有代理设置 +- `post $1 $2` - 使用application/json进行curl的POST请求 +- `docker_rm_all` - 删除所有Docker镜像 +- `kexec` - 通过正则表达式匹配的Pod名称执行Kubernetes Pod +- `klog` - 通过正则表达式匹配的Pod名称显示Kubernetes Pod日志 +- `git_tag_delete` - 删除GitHub标签 +- `git_tag_add` - 添加GitHub标签 +- `dc` - docker-compose的别名 ## [fasd](https://github.com/clvv/fasd) -The name fasd comes from the default suggested aliases f(files), a(files/directories), s(show/search/select), d(directories). +"fasd"的名称来源于默认建议的别名:f(文件)、a(文件/目录)、s(显示/搜索/选择)、d(目录)。 -Some situations where you can type in the command on the left and fasd will "expand" your command into the right side. +一些情况下,您可以输入左侧的命令,而fasd会将您的命令“展开”为右侧的内容。 ``` v def conf => vim /some/awkward/path/to/type/default.conf j abc => cd /hell/of/a/awkward/path/to/get/to/abcdef @@ -144,7 +145,7 @@ Some situations where you can type in the command on the left and fasd will "exp vim `f rc lo` => vim /etc/rc.local vim `f rc conf` => vim /etc/rc.conf ``` -Fasd comes with some useful aliases by default: +Fasd默认附带了一些有用的别名: ```sh alias a='fasd -a' # any @@ -156,9 +157,7 @@ alias sf='fasd -sif' # interactive file selection alias z='fasd_cd -d' # cd, same functionality as j in autojump alias zz='fasd_cd -d -i' # cd with interactive selection ``` -Fasd will smartly detect when to display a list of files or just the best -match. For instance, when you call fasd in a subshell with some search -parameters, fasd will only return the best match. This enables you to do: +Fasd会智能地检测何时显示文件列表,何时只显示最佳匹配项。例如,当您在子shell中使用一些搜索参数调用fasd时,fasd只会返回最佳匹配项。这使您可以执行以下操作: ```sh mv update.html `d www` @@ -166,162 +165,161 @@ cp `f mov` . ``` ## Tmux -#### Settings +#### 设置 -`tmux.conf` provides some reasonable default settings for tmux on Mac OS, such as a powerful status bar and VIM keyboard bindings. You can modify the configuration in `~/.tmux.conf.user`. -#### Shortcuts -Prefix is defined as `C-a`(`PRE` for short) -Shortcut | Function +`tmux.conf`为Mac OS上的tmux提供了一些合理的默认设置,例如强大的状态栏和VIM键盘绑定。您可以在`~/.tmux.conf.user`中修改配置。 +#### 快捷键 +起手式被定义为了 `ctrl+a`(下面的`PRE`就代表起手式) +快捷键 | 功能 :---------|:-------- -C-h(jkl) |←(↓↑→)Move pane -PRE c |Craete a new pane -PRE s |Split panes up and down -PRE v |Split panes left and right -PRE x |Kill pane -PRE h(jkl)|←(↓↑→)Move dividing line -PRE , |Rename window -PRE d |Exit Session -PRE D |Exit Session -PRE 1 |Enter pane 1 -PRE >/< |Cheatsheet -PRE {/} |Move pane to previous/next position -PRE C-o |rotate window ‘up’ (i.e. move all panes) -PRE M-o |rotate window ‘down’ -PRE z |Zoom/Unzoom -PRE m |Mark -PRE ! |Move the current pane into a new separate -PRE o |Go to the next pane (cycle through all of them) -PRE ; |Go to the ‘last’ (previously used) pane -> `C` is short for `Ctrl` +Ctrl+h(jkl) |←(↓↑→)移动面板 +PRE c |创建新面板 +PRE s |上下分屏 +PRE v |左右分屏 +PRE x |关闭面板 +PRE shift+h(jkl)|←(↓↑→)移动分割线 +PRE , |重命名窗口 +PRE d |退出会话 +PRE D |退出会话 +PRE 1 |进入面板1 +PRE >/< |速查表 +PRE {/} |将面板向前/后移动 +PRE C-o |旋转窗口“向上”(即移动所有面板) +PRE M-o |旋转窗口“向下” +PRE z |全屏/取消全屏面板 +PRE m |标记 +PRE ! |将当前面板移动到一个新的独立窗格中 +PRE o |前往下一个窗格(循环遍历所有窗格) +PRE ; |前往“最后一个”(之前使用过的)窗格 +> `C` 是 `Ctrl` 的简写 -Press `PRE [` to enter Scroll Mode +按下 `PRE [` 来进入滚动模式 -Shortcut | Function | +快捷键 | 功能 | :--------|:---------| -`Shift-V`| Select Text| -`Enter` | Copy Text | -`]` | Paste text copied from scroll mode | +`Shift-V`| 选择文本| +`Enter` | 复制文本 | +`]` | 粘贴从滚动模式复制的文本 | ## Vim & Spacevim -* ``: Short for ``, which is `\` in our setup +* ``: ``的缩写, 在我们的设置中是 `\` -**Defined by Us** +**我们定义的内容** -#### Basic +#### 基础 [Here](doc/vim-basic.md) -#### Shortcuts -**General** -Shortcut | Function +#### 快捷键 +**全局** +快捷键 | 功能 :-------:|:--------: -C-v | Enter visual mode -C-x C-v | Paste text from system clipboard -tp | Toggle paste -SPC f v d| Open configuration file -SPC g . | Enter version control transient-state -SPC l p | Preview markdown +C-v | 进入Visual模式 +C-x C-v | 从系统剪贴板粘贴文本 +tp | 切换粘贴模式 +SPC f v d| 打开配置文件 +SPC g . | 进入版本控制瞬态状态 +SPC l p | 预览Markdown **Typescript** -Shortcut | Function +快捷键 | 功能 :-------:|:--------: -SPC l p | Definitaion Preview -SPC l t | Type -SPC l e | Rename -SPC l d | Doc -g d | Go to definition -SPC e L | List checkers +SPC l p | 定义预览 +SPC l t | 类型 +SPC l e | 重命名 +SPC l d | 文档 +g d | 前往定义 +SPC e L | 列出检查器 **Tab** -Shortcut | Function +快捷键 | 功能 :--------:|:--------: -\\[1-9] | Open tab 1-9 -SPC t t | Open tab management window -SPC w F | Open a new tab -SPC w o | Switch tab +\\[1-9] | 打开标签页1-9 +SPC t t | 打开标签管理窗口 +SPC w F | 打开一个新标签页 +SPC w o | 切换标签页 -**History** -Shortcut | Function +**历史** +快捷键 | 功能 :--------:|:--------: -`F7` | Undo history +`F7` | 撤销历史 **Debug** -Shortcut | Function +快捷键 | 功能 :-----------:|:--------: -SPC h I | Show Debug Info +SPC h I | 显示Debug信息 **Git Blame** -Shortcut | Function -:-------:|:--------: - b | Togggle git blame info at the end of current line - s | See Git Blame information in the status bar for the currently selected line. - gb | Open git blame window +快捷键 | 功能 +:----------:|:--------: + b | 在当前行末尾切换显示Git Blame信息 + s | 在状态栏中查看当前选定行的Git Blame信息 + gb | 打开Git Blame窗口 #### markdown -* Install `prettier`: `yarn global add prettier` or `npm install --global prettier` -* Open vim and enter command: `:SPUPdate` +* 安装 `prettier`: `yarn global add prettier` 或 `npm install --global prettier` +* 打开vim然后输入命令: `:SPUPdate` -#### Option window, window, split bar -- `Ctrl-h,l,j,k` - use to move to left、right、top、bottom commpartment. This is still valid when vim and the split bar are together, thanks to `vim-tmux-navigator`。 -- `Q` - Enter Ex mode -- `vv` - Vertical separation (`Ctrl-w,v`) -- `ss` - Horizontal separation (`Ctrl-w,s`) -- `,qo` - Open quickfix window (The output of grep will go to this window) -- `,qc` - close quickfix +#### 选项窗口、窗口、分割栏 +- `Ctrl-h,l,j,k` - 用于在左、右、上、下分隔中移动。即使在vim和分割栏并排的情况下,也可以使用 `vim-tmux-navigator`实现此功能。 +- `Q` - 进入Ex模式 +- `vv` - 垂直分割 (`Ctrl-w,v`) +- `ss` - 水平分割 (`Ctrl-w,s`) +- `,qo` - 打开快速修复窗口(grep的输出将显示在此窗口中) +- `,qc` - 关闭快速修复窗口 #### Rails & Ruby -- `,vv` & `,cc` to switch between view and controller-they are the mappings corresponding to :Rcontroller and :Rview. Explore: R family commands can learn more about the fun of rails.vim! -- `,rs` & `,rl` to run rspec or a spec line in iTerm (check the iTerm window for information). -- `,tt` Add `now: true`tag to a block of the spec file, and then test the block by `rspec --tag=now`. -- `,ss` & `,sl` To achieve the same thing, by using `spring rspec`, one can make your Rails specs faster, by caching `Rails env` (must have spring gem installed). +- `,vv` & `,cc` 切换视图和控制器之间的命令是与:Rcontroller和:Rview相对应的映射。通过探索R系列命令,您可以更多地了解rails.vim的乐趣! +- `,rs` & `,rl` 在iTerm中运行rspec或特定的spec行(在iTerm窗口中查看信息)。 +- `,tt`在spec文件中给一个块添加`now: true`标签, 然后通过`rspec --tag=now`测试该块。 +- `,ss` & `,sl` 通过使用`spring rspec`来实现相同的功能,可以通过缓存`Rails env`(必须安装spring gem)来加速Rails的测试。 -#### Vim Dev -- `,vc` - (Vim command) Copy the command under the cursor and run it. Very useful for testing single-line changes in vimrc. -- `,vr` - (Vim re-documented) Use the current file as a vim file to load the source. +#### Vim开发 +- `,vc` - (Vim命令)复制光标下的命令并运行它。在测试vimrc中的单行更改时非常有用。 +- `,vr` - (重新记录的Vim命令)将当前文件作为Vim文件使用,加载源代码。 -#### SpaceVim Interface elements: -The interface elements of SpaceVim start with [SPC] t or [SPC] T. You can view the second-level instructions by pressing the [SPC] key in the vim window. In the same way, press the required second-level instructions and then you can check the three Level instructions to view. +#### SpaceVim界面元素: +SpaceVim的界面元素以[SPC] t或[SPC] T开头。您可以通过在vim窗口中按下[SPC]键来查看第二级指令。同样地,按下所需的第二级指令,然后您可以查看三级指令以进行查看。 -- `SPC t h s` - Show/hide syntax highlighting -- `SPC t n` - Show/hide line number -- `SPC t h h` - Highlight current line -- `SPC T m` - Show/hide the menu bar (no difference is seen) -- `SPC T t` - Show/hide the toolbar (don’t see the difference) -- `SPC [1-9]` - Jump to the specified window -- `SPC f t` - Open file tree -- `SPC p f` - find files in current project -- `SPC f y` - show and copy current file absolute path in the cmdline -- `SPC f S` - save all files -- `SPC f o` - Find current file in file tree -- `SPC f D` - delete a file and the associated buffer with confirmation -- `SPC f p` - search word in current project -- `SPC p /` - fuzzy search for text in current project -- `SPC c l` - toggle comment lines -- `SPC c p` - toggle comment paragraphs +- `SPC t h s` - 显示/隐藏语法高亮显示 +- `SPC t n` - 显示/隐藏行号 +- `SPC t h h` - 高亮显示当前行 +- `SPC T m` - 显示/隐藏菜单栏(看不出区别) +- `SPC T t` - 显示/隐藏工具栏(看不出区别) +- `SPC [1-9]` - 跳转到指定的窗口 +- `SPC f t` - 打开文件树 +- `SPC p f` - 在当前项目中查找文件 +- `SPC f y` - 在命令行中显示并复制当前文件的绝对路径 +- `SPC f S` - 保存所有文件 +- `SPC f o` - 在文件树中查找当前文件 +- `SPC f D` - 删除文件并附带确认删除相关缓冲区 +- `SPC f p` - 在当前项目中搜索单词 +- `SPC p /` - 在当前项目中进行模糊搜索文本 +- `SPC c l` - 切换注释行状态 +- `SPC c p` - 切换注释段落状态 -#### Search text -- `SPC s J` - Search text under cursor in current project +#### 搜索文本 +- `SPC s J` - 在当前项目中搜索光标下的文本 -#### Help -- `SPC h d k` - Start a input prompt, Then press the key bindings you want to describe +#### 帮助 +- `SPC h d k` - 开始一个输入提示,然后按下您想要描述的按键绑定。 ## iTerm ### iTerm Solarized Colors -YADR will install the Solarized color scheme into iTerm. You can choose Solarized Dark in Profiles => Colors => Load Presets. +YADR将会在iTerm中安装Solarized颜色方案。您可以在“Profiles => Colors => Load Presets”中选择Solarized Dark。 ## [Homebrew](http://mxcl.github.com/homebrew/) +Homebrew是一个缺失的OSX包管理系统,它将会自动安装。 -Homebrew is a missing OSX package management system, and it will be installed automatically. +我们自动安装了一些常用的软件包,如ctags、git、macvim、hub和RipGrep(‘rg’)。请注意,我们的自动完成插件需要MacVim支持Lua。安装程序知道如何安装它,但如果您之前已经安装过它,您需要手动删除之前的MacVim。 -We automatically installed some commonly used packages, such as ctags, git, macvim, hub, and RipGrep (‘rg’). Note that our auto-completion plugin requires MacVim to support Lua. The installer knows how to install it, but if you have installed it before, you need to manually delete your previous MacVim. - -## Frequently Asked Questions +## 常见问题 [Check FAQ](./FAQ.md) diff --git a/README_EN.md b/README_EN.md new file mode 100644 index 0000000..bb3b86e --- /dev/null +++ b/README_EN.md @@ -0,0 +1,327 @@ +

+ +

+

Dotar is an all-in-one dev configuration for your mac/linux which includes setup for zsh, spacevim(nvim), tmux and many more

+ +# The story +Dotar got its name by the combination of `dot` and `tar` which means package(`tar`) dotfiles togeter. +# Get started +## Requirements +* `zsh`, `tmux`, `vim`, `ag` are installed and zsh is set as your login shell: +```sh +chsh -s $(which zsh) +``` +* `Python 3` and `pynvim` as some layers(`denite`) can't be loaded if they are missing +```sh +python3 -m pip install --user --upgrade pynvim +``` + +## Install + +```sh +bash -c "`curl -fsSL https://git.bitnet.fun:5004/Gaze/dotar/raw/commit/21638953a830aa657b1e0fe1b14ff65a1694ef60/install.sh`" +``` + +## Upgrade +```sh +cd ~/.yadr +git pull --rebase +rake update +``` + +# Modules +* ZSH + * [Prezto - the zsh behind YADR's](http://github.com/sorin-ionescu/prezto) + * [How to add your own ZSH theme](doc/zsh/themes.md) + +## Zsh Commands +#### [Files](./zsh/files.zsh) +Command | Args | Description +:--------|:------|:----------- +swap | F1 F2 | swap file F1 with file F2 +Replace |[doc](#Replace) |Replace text recursively + + + +Replace +options: + +```sh + -f File regex pattern + -s Source pattern + -d Destination pattern + -r Remove line + --regex Match pattern with regex + --seperator= Seperator, # by default + -h Display this message" +``` + + +#### Editing +Shortcut | Alias +:-----------|:-------- +Ctrl-R | Vim mode and bash style historical anti-query +ae | Edit alias +ar | Reload alias +ESC C-x C-e |Edit current command line in vim + +#### Network +Command | Description +:-----------|:-------- +test-port PORT | test whether PORT is opened +intercept-request-hosts | intercept requests and show hosts +host-ip | show host ip of your system + +#### System +Command | Description +:-----------|:-------- +yell | print the script name and all arguments to stderr +die | does the same as yell, but exits with a non-0 exit status, which means "fail". +try | uses the || (boolean OR), which only evaluates the right side if the left one didn’t fail. +list-large-files DIR | list large files sort by reversed order of size and print size in the order of `KB`, `MB`, `GB` + +#### String +Command | Description +:------------|:-------- +random-hex | print random hex +random-string| print random string of alphabets `a-zA-Z0-9` +contains |str1 str2 ... target |test whether a target string is included in an array of strings + +#### Git +YADR will take over your ~/.gitconfig, so if you want to store your git username and other settings, please put them in ~/.gitconfig.user + +We recommend setting your user information in this file. In addition, you can set your environment variables appropriately in your ~/.secrets. + +Command | Alias +:--------|:-------- +`ga` |`git add` +`gb` |`git branch` +`gbc` or `gnb` |`git checkout -b` +`gbs` |`git show-branch` +`gc` |`git commit --verbose` +`gco` |`git checkout` +`gcp` |`git cherry-pick --ff` +`gd` |`git diff` +`gf` |`git fetch` +`gfc` |`git clone` +`gfm` |`git pull` +`gfr` |`git pull --rebase` +`gl` |`git log` +`gpc` |`git push --set-upstream origin "$(git-branch-current 2> /dev/null)"` +`gr` |`git rebase` +`gra` |`git rebase --abort` +`grc` |`git rebase --continue` +`grs` |`git rebase --skip` +`gsd` |`git stash drop` +`gsl` |`git stash list` +`gsp` |`git stash pop` +`gst` |`git stash` + +#### Other +- `secure_source` -source `~/.yadr/zsh/function.zsh` file, let `function.zsh` modify work immediately in current window +- `pp $1` -useage:`pp xx`, grep process by name +- `set_proxy` -set terminal proxy use http proxy +- `set_vagrant_proxy` -set terminal proxy use vagrant http proxy +- `set_ss_proxy` -set terminal proxy use socks proxy +- `unset_proxy` -cancel all proxy +- `post $1 $2` -curl POST with application/json +- `docker_rm_all` -delete all docker images +- `kexec` -execute k8s pod by regex pod name +- `klog` -show k8s pod log by regex pod name +- `git_tag_delete` -delete gtihub tag +- `git_tag_add` -add gtihub tag +- `dc` -alias of docker-compose + +## [fasd](https://github.com/clvv/fasd) +The name fasd comes from the default suggested aliases f(files), a(files/directories), s(show/search/select), d(directories). + +Some situations where you can type in the command on the left and fasd will "expand" your command into the right side. +``` + v def conf => vim /some/awkward/path/to/type/default.conf + j abc => cd /hell/of/a/awkward/path/to/get/to/abcdef + m movie => mplayer /whatever/whatever/whatever/awesome_movie.mp4 + o eng paper => xdg-open /you/dont/remember/where/english_paper.pdf + vim `f rc lo` => vim /etc/rc.local + vim `f rc conf` => vim /etc/rc.conf +``` +Fasd comes with some useful aliases by default: + +```sh +alias a='fasd -a' # any +alias s='fasd -si' # show / search / select +alias d='fasd -d' # directory +alias f='fasd -f' # file +alias sd='fasd -sid' # interactive directory selection +alias sf='fasd -sif' # interactive file selection +alias z='fasd_cd -d' # cd, same functionality as j in autojump +alias zz='fasd_cd -d -i' # cd with interactive selection +``` +Fasd will smartly detect when to display a list of files or just the best +match. For instance, when you call fasd in a subshell with some search +parameters, fasd will only return the best match. This enables you to do: + +```sh +mv update.html `d www` +cp `f mov` . +``` + +## Tmux +#### Settings + +`tmux.conf` provides some reasonable default settings for tmux on Mac OS, such as a powerful status bar and VIM keyboard bindings. You can modify the configuration in `~/.tmux.conf.user`. +#### Shortcuts +Prefix is defined as `C-a`(`PRE` for short) +Shortcut | Function +:---------|:-------- +C-h(jkl) |←(↓↑→)Move pane +PRE c |Craete a new pane +PRE s |Split panes up and down +PRE v |Split panes left and right +PRE x |Kill pane +PRE h(jkl)|←(↓↑→)Move dividing line +PRE , |Rename window +PRE d |Exit Session +PRE D |Exit Session +PRE 1 |Enter pane 1 +PRE >/< |Cheatsheet +PRE {/} |Move pane to previous/next position +PRE C-o |rotate window ‘up’ (i.e. move all panes) +PRE M-o |rotate window ‘down’ +PRE z |Zoom/Unzoom +PRE m |Mark +PRE ! |Move the current pane into a new separate +PRE o |Go to the next pane (cycle through all of them) +PRE ; |Go to the ‘last’ (previously used) pane +> `C` is short for `Ctrl` + +Press `PRE [` to enter Scroll Mode + +Shortcut | Function | +:--------|:---------| +`Shift-V`| Select Text| +`Enter` | Copy Text | +`]` | Paste text copied from scroll mode | + + +## Vim & Spacevim +* ``: Short for ``, which is `\` in our setup + +**Defined by Us** + +#### Basic +[Here](doc/vim-basic.md) + +#### Shortcuts +**General** +Shortcut | Function +:-------:|:--------: +C-v | Enter visual mode +C-x C-v | Paste text from system clipboard +tp | Toggle paste +SPC f v d| Open configuration file +SPC g . | Enter version control transient-state +SPC l p | Preview markdown + +**Typescript** + +Shortcut | Function +:-------:|:--------: +SPC l p | Definitaion Preview +SPC l t | Type +SPC l e | Rename +SPC l d | Doc +g d | Go to definition +SPC e L | List checkers + +**Tab** +Shortcut | Function +:--------:|:--------: +\\[1-9] | Open tab 1-9 +SPC t t | Open tab management window +SPC w F | Open a new tab +SPC w o | Switch tab + +**History** +Shortcut | Function +:--------:|:--------: +`F7` | Undo history + + +**Debug** +Shortcut | Function +:-----------:|:--------: +SPC h I | Show Debug Info + +**Git Blame** +Shortcut | Function +:-------:|:--------: + b | Togggle git blame info at the end of current line + s | See Git Blame information in the status bar for the currently selected line. + gb | Open git blame window + +#### markdown + +* Install `prettier`: `yarn global add prettier` or `npm install --global prettier` +* Open vim and enter command: `:SPUPdate` + +#### Option window, window, split bar +- `Ctrl-h,l,j,k` - use to move to left、right、top、bottom commpartment. This is still valid when vim and the split bar are together, thanks to `vim-tmux-navigator`。 +- `Q` - Enter Ex mode +- `vv` - Vertical separation (`Ctrl-w,v`) +- `ss` - Horizontal separation (`Ctrl-w,s`) +- `,qo` - Open quickfix window (The output of grep will go to this window) +- `,qc` - close quickfix + +#### Rails & Ruby +- `,vv` & `,cc` to switch between view and controller-they are the mappings corresponding to :Rcontroller and :Rview. Explore: R family commands can learn more about the fun of rails.vim! +- `,rs` & `,rl` to run rspec or a spec line in iTerm (check the iTerm window for information). +- `,tt` Add `now: true`tag to a block of the spec file, and then test the block by `rspec --tag=now`. +- `,ss` & `,sl` To achieve the same thing, by using `spring rspec`, one can make your Rails specs faster, by caching `Rails env` (must have spring gem installed). + +#### Vim Dev +- `,vc` - (Vim command) Copy the command under the cursor and run it. Very useful for testing single-line changes in vimrc. +- `,vr` - (Vim re-documented) Use the current file as a vim file to load the source. + +#### SpaceVim Interface elements: +The interface elements of SpaceVim start with [SPC] t or [SPC] T. You can view the second-level instructions by pressing the [SPC] key in the vim window. In the same way, press the required second-level instructions and then you can check the three Level instructions to view. + +- `SPC t h s` - Show/hide syntax highlighting +- `SPC t n` - Show/hide line number +- `SPC t h h` - Highlight current line +- `SPC T m` - Show/hide the menu bar (no difference is seen) +- `SPC T t` - Show/hide the toolbar (don’t see the difference) +- `SPC [1-9]` - Jump to the specified window +- `SPC f t` - Open file tree +- `SPC p f` - find files in current project +- `SPC f y` - show and copy current file absolute path in the cmdline +- `SPC f S` - save all files +- `SPC f o` - Find current file in file tree +- `SPC f D` - delete a file and the associated buffer with confirmation +- `SPC f p` - search word in current project +- `SPC p /` - fuzzy search for text in current project +- `SPC c l` - toggle comment lines +- `SPC c p` - toggle comment paragraphs + +#### Search text +- `SPC s J` - Search text under cursor in current project + +#### Help +- `SPC h d k` - Start a input prompt, Then press the key bindings you want to describe + + +## iTerm + +### iTerm Solarized Colors + +YADR will install the Solarized color scheme into iTerm. You can choose Solarized Dark in Profiles => Colors => Load Presets. + + +## [Homebrew](http://mxcl.github.com/homebrew/) + + +Homebrew is a missing OSX package management system, and it will be installed automatically. + +We automatically installed some commonly used packages, such as ctags, git, macvim, hub, and RipGrep (‘rg’). Note that our auto-completion plugin requires MacVim to support Lua. The installer knows how to install it, but if you have installed it before, you need to manually delete your previous MacVim. + +## Frequently Asked Questions +[Check FAQ](./FAQ.md) diff --git a/Rakefile b/Rakefile index 6b5d8e6..c73c61f 100644 --- a/Rakefile +++ b/Rakefile @@ -57,14 +57,14 @@ end desc 'install spacevim and related config files' task :install_spacevim do - run 'curl -sLf https://spacevim.org/install.sh | sed "s;github.com/SpaceVim;yuancode.co/ruilisi;" | bash' + run 'curl -sLf https://spacevim.org/install.sh | sed "s;github.com/SpaceVim;git.bitnet.fun:Gaze;" | bash' end desc 'Update spacevim' task :update_spacevim do run %( cd ~/.SpaceVim - git remote set-url origin https://yuancode.co/ruilisi/SpaceVim.git + git remote set-url origin git@git.bitnet.fun:Gaze/SpaceVim.git git pull --rebase ) end