├── .gitignore ├── LICENSE ├── README.en.md ├── README.md ├── cheat ├── nova ├── setup.sh └── test.sh ├── git ├── .gitkeep ├── gitconfig └── setup.sh ├── img ├── ag.png ├── axel.jpg ├── cloc.jpg ├── fpp-demo.jpg ├── fuck.gif ├── fzf.jpg ├── fzf_history.png ├── git-diff.jpg ├── htop.png ├── iterm.jpg ├── jq_demo.png ├── jq_filter.png ├── mycli.png ├── shellcheck.png ├── tig-demo.jpg ├── tig.png ├── tmux.jpg ├── vim-comment.jpg ├── vim-ctrlp.jpg ├── vim-easymotion.jpg ├── vim-mark.jpg ├── vim-nerdtree.jpg ├── vim-paste.jpg ├── vim-taglist.jpg ├── vim-ycm-2.jpg ├── vim-ycm.jpg └── zsh-syntax.jpg ├── iterm └── solarized_enhanced.itermcolors ├── pip ├── pip.conf └── setup.sh ├── ssh ├── README.md ├── config └── setup.sh ├── tmux ├── .gitkeep ├── README.md ├── setup.sh └── tmux.conf ├── vim ├── README.md ├── install_for_MacOS.sh ├── install_on_CentOS.sh ├── setup.sh └── vimrc └── zsh ├── .gitkeep ├── README.md ├── alias.zsh ├── setup.sh └── zshrc /.gitignore: -------------------------------------------------------------------------------- 1 | vim/vim/bundle/ShowTrailingWhitespace 2 | *~ 3 | *.swp 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 int32bit 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.en.md: -------------------------------------------------------------------------------- 1 | [中文版本](README.md) 2 | 3 | # dotfiles 4 | 5 | A set of vim, zsh, git, and tmux configuration files. 6 | 7 | ## ssh 8 | 9 | ### Setup 10 | 11 | ### SSH Multiplexing 12 | 13 | SSH multiplexing is the ability to carry multiple SSH sessions over a single TCP connection. 14 | 15 | ``` 16 | ControlMaster auto 17 | ControlPersist yes 18 | ControlPath ~/.ssh/socks/%h-%p-%r 19 | ``` 20 | 21 | ### Keep session from disconnecting 22 | 23 | ``` 24 | ServerAliveInterval 60 25 | ``` 26 | 27 | ### Disable strict host key checking 28 | 29 | ``` 30 | StrictHostKeyChecking no 31 | UserKnownHostsFile /dev/null 32 | ``` 33 | 34 | ## tmux 35 | 36 | ## vim 37 | 38 | ### Setup 39 | 40 | You need install following package to compile YCM: 41 | 42 | * ctags 43 | * cmake 44 | * g++(Centos:gcc-c++) 45 | * python-devel 46 | 47 | ### Base Configuration 48 | 49 | 50 | 51 | ### Plugins 52 | 53 | * VundleVim/Vundle.vim' 54 | * Lokaltog/vim-powerline' "status 美化 55 | * octol/vim-cpp-enhanced-highlight' "对c++语法高亮增强 56 | * kshenoy/vim-signature' "书签可视化的插件 57 | * vim-scripts/BOOKMARKS--Mark-and-Highlight-Full-Lines' "书签行高亮 58 | * majutsushi/tagbar' "taglist的增强版,查看标签,依赖于ctags 59 | * scrooloose/nerdcommenter' "多行注释,leader键+cc生成, leader+cu删除注释 60 | * scrooloose/nerdtree' "文件浏览 61 | * Valloric/YouCompleteMe' "自动补全 62 | * kien/ctrlp.vim' "搜索历史打开文件,在命令行模式下按ctrl+p触发 63 | * vim-scripts/grep.vim' "在命令行模式使用grep命令,:Grep 64 | * Lokaltog/vim-easymotion' "快速跳转,按两下leader键和f组合 65 | * vim-scripts/ShowTrailingWhitespace.git' "高亮显示行尾的多余空白字符 66 | * vim-scripts/indentpython.vim.git' 67 | * vim-scripts/Solarized.git' "主题方案 68 | * nathanaelkane/vim-indent-guides.git' "缩进对齐显示 69 | * davidhalter/jedi-vim' "python 补全,不依赖于tags,但比较慢,可以使用indexer替换,但不能跳转项目外 70 | * vim-scripts/Markdown' 71 | * tpope/vim-surround' 72 | * ekalinin/Dockerfile.vim' 73 | 74 | ### Theme 75 | 76 | ## zsh 77 | 78 | ### Setup 79 | 80 | ### Base Configration 81 | 82 | ### Plugins 83 | 84 | * git 85 | * zsh-syntax-highlighting 86 | * extract 87 | * z 88 | 89 | ### Themes 90 | 91 | * robbyrussell 92 | 93 | ## git 94 | 95 | ## Awesome Command-line Tools 96 | 97 | * [ag](https://github.com/ggreer/the_silver_searcher): Recursively search for PATTERN in PATH. Like grep or ack, but faster. 98 | * [tig](https://github.com/jonas/tig): Text-mode interface for Git. 99 | * [mycli](https://github.com/dbcli/mycli): A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. 100 | * [jq](https://github.com/stedolan/jq): Command-line JSON processor. 101 | * [shellcheck](https://github.com/koalaman/shellcheck): A static analysis tool for shell scripts. 102 | * [yapf](https://github.com/google/yapf): A formatter for Python files. 103 | * [mosh](https://mosh.org/#getting): Mosh is a replacement for SSH. It's more robust and responsive, especially over Wi-Fi, cellular, and long-distance links. 104 | * [fzf](https://github.com/junegunn/fzf): A command-line fuzzy finder written in Go. 105 | * [PathPicker(fpp)](https://github.com/facebook/PathPicker): A simple command line tool that solves the perpetual problem of selecting files out of bash output. 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 👉[English](README.en.md) 2 | 3 | # dotfiles 4 | 5 | 快速配置\*nix开发环境以及装机必备神器。 6 | 7 | ## 1 ssh 8 | 9 | 如果条件允许的话,建议使用[mosh](https://mosh.org/)替代ssh,mosh基于UDP传输,比ssh更稳定、更容忍网络故障和延迟,不会像ssh那样轻易掉线。由于很多服务器目前并没有安装mosh,使用ssh的还是占主流,并且mosh也不支持ssh-agent、X11-forward等。因此在本地需要配置下ssh。 10 | 11 | ### 1.1 快速配置 12 | 13 | 在ssh目录下直接运行`setup.sh`脚本即可,不需要其它额外配置。 14 | 15 | ### 1.2 连接复用 16 | 17 | 通常我们ssh连接到一台服务器退出后连接即断开,再次连接时会重新建立连接,需要重新校验密钥或密码。如果使用密码登录,则需要反复输入密码,在需要管理大量远程服务器时效率极低。密码是静态不变使用sshpass可以避免每次输入密码,但显然这是极其不安全的。如果密码是动态生成的,比如跳板机,每次需要打开手机查看动态密码非常麻烦。 18 | 19 | ssh连接复用是指一旦成功建立远程主机的ssh连接会保持一段时间的session,在session有效期内可以复用该连接,不需要重新做身份验证。这有点类似sudo命令,第一次输入密码后,再次执行sudo命令不需要输入密码了。 20 | 21 | ssh连接复用配置如下: 22 | 23 | ``` 24 | ControlMaster auto 25 | ControlPersist yes 26 | ControlPath ~/.ssh/socks/%h-%p-%r 27 | ``` 28 | 29 | 第一次建立连接时会在ControlPath目录下生成一个socket文件,文件格式为`%h-%p-%r`, 其中`%h`表示远程主机名,`%p`指连接的端口,`%r`是登录用户名。 30 | 31 | **注意:** 32 | 33 | * `.ssh`目录权限应设为`600`. 34 | * `~/.ssh/socks`目录需要手动创建。 35 | 36 | ### 1.3 保持会话 37 | 38 | ssh成功登录到一台服务器即创建了一个新的会话,当该会话超过一定时间内没有接收任何请求时,会话会自动断开连接。有时这不是我们所期望的,比如ssh到一台服务器后,google下资料回来发现ssh断开了。 39 | 40 | 为了保持会话,可以设置ssh客户端每隔一段时间自动发送一个心跳,比如每隔60s发送一个hello包。 41 | 42 | ``` 43 | ServerAliveInterval 60 44 | ``` 45 | 46 | 我们还可以设置允许发送心跳的最大数量`ServerAliveCountMax`,当超过这个数量仍然没有接收用户响应时则会自动断开连接。 47 | 48 | ### 1.4 禁用主机key校验 49 | 50 | ssh连接时会检查主机的公钥,如果第一次连接主机会显示该主机的公钥指纹,需要用户确实是否信任该主机。 51 | 52 | ``` 53 | The authenticity of host '192.168.56.4 (192.168.56.4444)' can't be established. 54 | RSA key fingerprint is a3:ca:ad:95:a1:45:d2:57:3a:e9:e7:75:a8:4c:1f:9f. 55 | Are you sure you want to continue connecting (yes/no)? 56 | ``` 57 | 58 | 如果我们跑后台脚本时就会堵塞直到接收用户输入,导致后台脚本不能正常运行。 59 | 60 | 如果确认信任该主机并且保证不会被劫持攻击的话,可以跳过主机公钥校验,配置如下: 61 | 62 | ``` 63 | StrictHostKeyChecking no 64 | UserKnownHostsFile /dev/null 65 | ``` 66 | 67 | 如果通过shell连接,不建议禁用公钥校验。 68 | 69 | ### 1.5 ssh操作自动安全退出 70 | 71 | 我们经常需要通过堡垒机连接生产环境,如果是通过windows共享session方式访问,使用xshell或者其他ssh client 连接远程主机,往往容易忘记退出登录,其他人 72 | 连接该session时可看到没退出的ssh session,存在巨大的安全隐患。可以设置TMOUT环境变量,比如设置TMOUT=60,则终端超过60秒未操作时,session会自动退出。 73 | 一般安全加固的Linux操作系统都会在/etc/profile下export TMOUT=300。 74 | 75 | ```bash 76 | # /etc/profile 77 | 78 | export TMOUT=300 79 | ``` 80 | 81 | ## 2 tmux 82 | 83 | ![tmux](img/tmux.jpg) 84 | 85 | ### 2.1 快速配置 86 | 87 | 运行`tmux/setup.sh`脚本即可,不需要其它额外配置。 88 | 89 | ### 2.2 配置说明 90 | 91 | `prefix`键为默认的`ctrl-b`,个人感觉`ctrl-b`挺方便的,很多人设置为`ctrl-a`,这会与在命令行下快速移动光标到行首冲突,需要按两下ctrl-a。 92 | 93 | 设置分屏: 94 | 95 | ``` 96 | # Split windows 97 | bind \ split-window -h 98 | bind - split-window -v 99 | ``` 100 | 101 | 这样容易记住,`|`垂直分屏,`-`水平分屏。 102 | 103 | 禁用windows自动命名,主要是它会覆盖原来的名字: 104 | 105 | ``` 106 | set-option -g allow-rename off # prevent system from renaming our window 107 | ``` 108 | 109 | 设置windows从1开始索引: 110 | 111 | ``` 112 | set -g base-index 1 # window index from 1, not zero 113 | ``` 114 | 115 | 重新加载配置文件(prefix+r): 116 | 117 | ``` 118 | bind r source-file ~/.tmux.conf \; display "Reloaded!" 119 | ``` 120 | 121 | 打开一个临时窗口查看man手册: 122 | 123 | ``` 124 | bind-key / command-prompt "split-window -h 'exec man %%'" 125 | ``` 126 | 127 | 只需要输入`prefix+/`,然后输入需要查询的命令即可。 128 | 129 | ## 2.3 主题方案 130 | 131 | 选用的主题是Solarized,参考[Making tmux Pretty and Usable - A Guide to Customizing your tmux.conf](http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/),为了和iterm以及vim集成,手动调节了部分颜色,包括panel boder颜色以及windows菜单颜色等。 132 | 133 | status bar设置在顶部,为了避免和vim status重叠。 134 | 135 | ## 3 vim 136 | 137 | 注意:当加载太多插件时,vim启动会很慢,并且vim 8以前插件加载都是同步的,必须等待插件执行完才能继续下一个任务. 因此我把自动生成tags功能默认是关闭的, 避免每打开一个文件都要卡顿几秒。可以使用[neovim](https://neovim.io/)替代vim。 138 | 139 | ### 3.1 Setup 140 | 141 | 在`dotfiles/vim`目录下运行`setup.sh`即可自动完成配置,配置过程中会自动安装vundle以及插件。 142 | 143 | 配置过程中可能出现Solarized方案不存在错误,由于该方案还没有安装,直接忽略该错误即可。 144 | 145 | 除了以上配置还需要系统完成以下包的安装: 146 | 147 | * `ctags` 148 | * `cmake` 149 | * `g++`(CentOS下包名为`gcc-c++`) 150 | * `python-devel` 151 | 152 | ```sh 153 | yum install ctags cmake gcc-c++ python-devel 154 | ``` 155 | 156 | 检查ctags是否安装成功: 157 | 158 | ``` 159 | ctags --list-languages 160 | ``` 161 | 162 | 打开vim,执行`:PluginInstall`命令或者直接运行以下命令: 163 | 164 | ```sh 165 | vim "+PluginInstall" "+x" "+x" 166 | ``` 167 | 168 | 最后配置YCM,在`~/.vim/bundle/YouCompleteMe`目录下运行`install.py`脚本。注意执行该脚本时必须已经安装`cmake`、`g++`、`python-devel`等,否则会build失败。 169 | 170 | ``` 171 | ~/.vim/bundle/YouCompleteMe/install.sh 172 | ``` 173 | 174 | 检查是否配置成功,大多数功能一般不会有什么问题,不需要检查,唯独自动补全功能需要确定是否工作,随便编辑一个C文件,看是否支持自动补全。 175 | 176 | ### 3.2 全局配置 177 | 178 | 全局配置指vim原生支持的功能配置,不需要安装任何插件。 179 | 180 | #### 3.2.1 通用配置 181 | 182 | ```vim 183 | " 开启文件类型侦测 184 | filetype on 185 | " 根据侦测到的不同类型加载对应的插件 186 | filetype plugin on 187 | " 自动缩进 188 | filetype indent on 189 | 190 | " 开启语法高亮功能 191 | syntax enable 192 | " 允许用指定语法高亮配色方案替换默认方案 193 | syntax on 194 | 195 | set nocompatible "禁用vi兼容模式 196 | set incsearch "开启增量搜索 197 | set ignorecase "搜索忽略大小写 198 | set wildmenu "vim命令自动补全 199 | set autoread "文件自动更新 200 | set gcr=a:block-blinkon0 "禁止光标闪烁 201 | set laststatus=2 "总是显示状态栏 202 | set ruler "显示光标位置 203 | set number "显示行号 204 | set cursorline "高亮显示当前行 205 | "set cursorcolumn "高亮显示当前列 206 | set hlsearch "高亮显示搜索结果 207 | set backspace=2 "回退键生效 208 | 209 | " 每行不能超过80字符,否则高亮显示。 210 | highlight OverLength ctermbg=red ctermfg=white guibg=#592929 211 | match OverLength /\%80v.\+/ 212 | ``` 213 | 214 | 215 | #### 3.2.2 设置Leader键 216 | 217 | Leader键是快捷键的前缀,类似于tmux的prefix键。根据个人习惯可以自定义Leader键,有人设置为`;`(分号),也有人设置为空格键`"let mapleader="\"`,空格键默认功能是向右移动光标,如果设置为Leader键,恢复原来的功能需要按两次空格键。为了方便,我设置Leader键为`'`(单引号): 218 | 219 | ```vim 220 | let mapleader="'" 221 | ``` 222 | #### 3.2.3 设置制表符 223 | 224 | 设置制表符占用4个空格字符,并且自动扩展为4个空格: 225 | 226 | ```vim 227 | set expandtab " 将制表符扩展为空格 228 | set tabstop=4 " 制表符占用空格数 229 | set shiftwidth=4 " 设置格式化时制表符占用空格数 230 | set softtabstop=4 " 让 vim 把连续数量的空格视为一个制表符 231 | ``` 232 | 233 | #### 3.2.4 打开上次关闭文件的位置 234 | 235 | 打开一个文件时vim光标位置默认位于第一行,如果需要设置光标位于上次关闭时位置,配置如下: 236 | 237 | ```vim 238 | if has("autocmd") 239 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 240 | endif 241 | ``` 242 | **注意:**如果不生效,可能是由于~/.viminfo没有访问权限,需要修改owner: 243 | 244 | ```bash 245 | chown yourname ~/.viminfo 246 | ``` 247 | 248 | #### 3.2.5 快捷键配置 249 | 250 | ```vim 251 | " 设置快捷键将选中文本块复制至系统剪贴板 252 | vnoremap y "+y 253 | 254 | " 设置快捷键将系统剪贴板内容粘贴至 vim 255 | nmap p "+p 256 | 257 | " 定义快捷键关闭当前分割窗口 258 | nmap q :q 259 | 260 | " 定义快捷键保存当前窗口内容 261 | nmap w :w 262 | 263 | " 定义快捷键保存所有窗口内容并退出 vim 264 | "nmap WQ :wa:q 265 | 266 | " 不做任何保存,直接退出 vim 267 | "nmap Q :qa! 268 | 269 | " 跳转至右方的窗口 270 | nnoremap l l 271 | 272 | " 跳转至左方的窗口 273 | nnoremap h h 274 | 275 | " 跳转至上方的子窗口 276 | nnoremap k k 277 | 278 | " 跳转至下方的子窗口 279 | nnoremap j j 280 | 281 | " 清除高亮显示 282 | nmap N :noh 283 | " 定义快捷键在结对符之间跳转 284 | nmap M % 285 | 286 | nnoremap g 287 | nnoremap b 288 | ``` 289 | 290 | #### 3.2.6 gvim配置 291 | 292 | 图形化vim配置,通常不需要: 293 | 294 | ```vim 295 | " 禁止显示滚动条 296 | set guioptions-=l 297 | set guioptions-=L 298 | set guioptions-=r 299 | set guioptions-=R 300 | 301 | " 禁止显示菜单和工具条 302 | set guioptions-=m 303 | set guioptions-=T 304 | ``` 305 | 306 | #### 3.2.7 sudo强制保存文件 307 | 308 | 有时我们编辑文件时需要root权限,但忘了使用sudo,我们可以通过在vim调用系统命令把当前缓冲区内容强制写入到当前文件中。 309 | 310 | ```vim 311 | :w !sudo tee % 312 | ``` 313 | 314 | 解释下以上这个命令,`w`表示write,后面不加任何参数即保存到当前文件,如果后面有文件名,则会另存为指定的文件中,写入文件其实就是把当前缓冲区内容重定向到文件中,当然我们也可以重定向(管道)到另一个系统命令中作为该系统命令的输入。`!`表示在vim命令模式下执行shell命令,后面接的就是所要执行的命令。`%`可以认为是vim的一个寄存器,保存着当前打开的文件路径,因此`:w`其实就相当于`:w %`,知道这几个字符的含义后就大致知道这个命令的原理了,相当于: 315 | 316 | ```bash 317 | vim write buffer | sudo tee ${CURRENT_FILE_PATH} 318 | ``` 319 | 320 | 为了便捷,设置了如下快捷键: 321 | 322 | ```vim 323 | nmap W :w !sudo tee % 324 | ``` 325 | 326 | 此时只需要按下Leader键`'`再按大写字母`W`就可以强制写入文件。 327 | 328 | 注意当写入成功后会有以下警告信息: 329 | 330 | ``` 331 | W12: Warning: File "test.sh" has changed and the buffer was changed in Vim as well 332 | See ":help W12" for more info. 333 | [O]K, (L)oad File: 334 | ``` 335 | 336 | 直接回车即可,保存文件后,我们使用`:q!`强制退出vim。 337 | 338 | 339 | ### 3.3 插件列表 340 | 341 | #### 1. Vundle 342 | 343 | Vim bundle的简写,它是当前最流行的vim插件管理工具。虽然目前最新版vim已经内置支持插件管理了,不过鉴于目前使用的大多数还是7.3、7.4,因此本人仍使用vundle插件管理,以下所有的插件均是通过vundle管理的。 344 | 345 | 安装vundle: 346 | 347 | ``` 348 | git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 349 | ``` 350 | 351 | 在vim配置文件`~/.vimrc`中启用vundle: 352 | 353 | ```vim 354 | set rtp+=~/.vim/bundle/Vundle.vim 355 | " vundle 管理的插件列表必须位于 vundle#begin() 和 vundle#end() 之间 356 | call vundle#begin() 357 | Plugin '1' 358 | Plugin '2' 359 | ... 360 | Plugin 'n' 361 | " 插件列表结束 362 | call vundle#end() 363 | ``` 364 | 365 | 查看插件列表: 366 | 367 | ```vim 368 | :PluginList 369 | ``` 370 | 371 | 安装插件: 372 | 373 | ``` 374 | :PluginInstall 375 | ``` 376 | 377 | 或者 378 | 379 | ```bash 380 | vim "+PluginInstall" "+x" "+x" 381 | ``` 382 | 383 | 更新插件: 384 | 385 | ``` 386 | :PluginUpdate 387 | ``` 388 | 389 | 禁用插件直接在~/.vimrc注释插件即可,如果需要从本地彻底删除,运行以下命令: 390 | 391 | ``` 392 | :PluginClean 393 | ``` 394 | 395 | 或者 396 | 397 | ``` 398 | vim "+PluginClean" "+x" "+x" 399 | ``` 400 | 401 | #### 2. vim-powerline 402 | 403 | 主要功能是使vim底部的状态栏更美观。 404 | 405 | #### 3. vim-cpp-enhanced-highlight 406 | 407 | c++语法高亮增强,支持c++11/14,增加标准库/boost类型和函数高亮。 408 | 409 | #### 4. vim-signature & BOOKMARKS--Mark-and-Highlight-Full-Lines 410 | 411 | 书签可视化以及书签行高亮。在命令行下输入m然后任意字母创建标签,效果如图: 412 | 413 | ![vim-mark-demo](./img/vim-mark.jpg) 414 | 415 | #### 5. tagbar 416 | 417 | taglist的增强版本,需要安装ctags包,设置的快捷键为键+t: 418 | 即按下`'`然后按`t`打开标签列表: 419 | 420 | ![vim-taglist](img/vim-taglist.jpg) 421 | 422 | 其它配置项如下: 423 | 424 | ``` 425 | let tagbar_left=1 426 | nnoremap t :TagbarToggle 427 | let tagbar_width=32 428 | "tagbar 子窗口中不显示冗余帮助信息 429 | let g:tagbar_compact=1 430 | ``` 431 | 432 | #### 6. nerdcommenter 433 | 434 | 方便批量注释,能够自动识别语言,比如shell增加`#`,而C语言使用`/* ... */`等。 435 | 436 | 使用可视化v`(Shift+V)`选中文本后,使用 cc注释,使用 cu取消注释: 437 | 438 | ![vim-nerdcommenter](img/vim-comment.jpg) 439 | 440 | #### 7. nerdtree 441 | 442 | 项目文件浏览,使用 f打开: 443 | 444 | ![vim-nerdtree](img/vim-nerdtree.jpg) 445 | 446 | #### 8. YouCompleteMe 447 | 448 | Vim自动补全插件,能够集成ctags以及jedi等,效果如图: 449 | 450 | ![ycm](img/vim-ycm.jpg) 451 | 452 | ![ycm](img/vim-ycm-2.jpg) 453 | 454 | #### 9. ctrlp 455 | 456 | 文件搜索功能,能够在vim上快速搜索文件并打开。在命令行模式下输入`ctrl+p`触发: 457 | 458 | ![ctrlp](img/vim-ctrlp.jpg) 459 | 460 | #### 10 vim-easymotion 461 | 462 | 快速在文本中跳转,f命令的增强版,按两下Leader键和f命令组合使用,比如跳转在有a字母的位置: 463 | 464 | ``` 465 | fa 466 | ``` 467 | 468 | 此时再按高亮显示的字母即可以快速跳转到选择的位置。 469 | 470 | 效果如图: 471 | 472 | ![easymotion](img/vim-easymotion.jpg) 473 | 474 | #### 11. vim-surround 475 | 476 | 处理各种括号以及html标签,比如`()[]()` 477 | 478 | 比如把`"Hello World!"`删除引号转化为`Hello World!`,输入`ds"`. 需要把双引号修改为单引号,输入`cs"'`。 479 | 480 | 参考[sdf13](http://vim.spf13.com/): 481 | 482 | ``` 483 | Old text Command New text ~ 484 | "Hello world!" ds" Hello world! 485 | [123+456]/2 cs]) (123+456)/2 486 | "Look ma, I'm HTML!" cs" Look ma, I'm HTML! 487 | if x>3 { ysW( if ( x>3 ) { 488 | my $str = whee!; vllllS' my $str = 'whee!'; 489 | ``` 490 | 491 | #### 12. vim-bracketed-paste 492 | 493 | 在vim使用系统粘贴板粘贴代码时,vim会根据缩进语法自动格式化代码,插入的多余的缩进符,这往往不是我们所预期的。比如我复制的内容为: 494 | 495 | ```python 496 | class HelloObject(object): 497 | 498 | def __init__(self): 499 | pass 500 | 501 | def sayHello(): 502 | print("HelloWorld!") 503 | 504 | 505 | if __name__ == "__main__": 506 | HelloObject().sayHello() 507 | ``` 508 | 509 | 在vim中insert粘贴内容效果为: 510 | 511 | ![vim paste](img/vim-paste.jpg) 512 | 513 | 通常的做法是使vim进入paste模式: 514 | 515 | ```vim 516 | :set paste 517 | ``` 518 | 519 | 每次粘贴复制都需要切换paste模式,这太麻烦了,而且容易忘记。我们可以利用[bracketed paste mode](http://cirw.in/blog/bracketed-paste),该模式下粘贴时会自动在两端加入特殊字符,如复制的内容如果是`HelloWorld`,粘贴后的内容为: 520 | 521 | ``` 522 | 00~HelloWorld01~ 523 | ``` 524 | 525 | 这使程序能够根据这些特殊字符判断输入是粘贴的还是用户手动输入的。vim-bracketed-paste插件正是利用了这个特性,判断如果是粘贴的内容,自动进入paste模式,内容粘贴结束,自动退出paste模式,完美解决了以上问题。 526 | 527 | #### 其它插件 528 | 529 | ```vim 530 | * vim-scripts/grep.vim' "在命令行模式使用grep命令,:Grep 531 | * vim-scripts/ShowTrailingWhitespace.git' "高亮显示行尾的多余空白字符 532 | * vim-scripts/indentpython.vim.git' 533 | * vim-scripts/Solarized.git' "主题方案 534 | * nathanaelkane/vim-indent-guides.git' "缩进对齐显示 535 | * davidhalter/jedi-vim' "python自动补全,不依赖于tags,但比较慢,可以使用indexer替换,但不能跳转项目外 536 | * vim-scripts/Markdown' " Markdown语法高亮 537 | * ekalinin/Dockerfile.vim' " Dockerfile语法高亮 538 | * fatih/vim-go " go语言语法高亮 539 | ``` 540 | 541 | ### 3.4 Theme 542 | 543 | 使用Solarized主题方案。 544 | 545 | ## 4 zsh 546 | 547 | ### 4.1 配置 548 | 549 | 直接运行`zsh/setup.sh`,该脚本会自动安装oh-my-zsh。 550 | 551 | ### 全局配置 552 | 553 | 待补充。 554 | 555 | ### 4.2 插件列表 556 | 557 | #### git 558 | 559 | 提供git常用简化别名,并且当工作目录在git项目下会自动显示所在的分支。 560 | 561 | #### zsh-syntax-highlighting 562 | 563 | 语法高亮,命令错误或者命令返回错误会高亮显示。 564 | 565 | ![zsh-syntax](img/zsh-syntax.jpg) 566 | 567 | 上图中`sl`命令不存在,因此红色高亮显示,并且`➜`显示红色,表示上条命令返回了错误码。 568 | 569 | #### extract 570 | 571 | 只需要输入`x+文件名`就能解压缩文件,不需要知道它是tar、gz还是xz。 572 | 573 | #### z 574 | 575 | 类似autojump,输入`z`能够查看cd历史记录以及权重,输入`z 模糊路径`能够快速cd到匹配的目录中。 576 | 577 | #### safe-paste 578 | 579 | 默认情况下当复制粘贴文本到终端时,当遇到换行符,终端会立马执行该命令。如果同时复制多行内容,终端会把所有内容根据换行符拆分成多个命令依次执行。这显然不是我们所期望的。利用[bracketed paste mode](http://cirw.in/blog/bracketed-paste)特性,终端可以通过两端的特殊字符判断输入是粘贴的还是手动输入的,从而避免遇到换行符就立马执行。 580 | 581 | ### 4.3 主题列表 582 | 583 | 使用默认的`robbyrussell`主题。 584 | 585 | ### 4.4 alias列表 586 | 587 | 待补充。 588 | 589 | ```bash 590 | alias rm='rm -i' 591 | alias mv='mv -i' 592 | alias cp='cp -i' 593 | alias grep='grep -E' 594 | alias df='df -h' 595 | 596 | # alias for harborclient 597 | alias harbor='docker run \ 598 | -e HARBOR_USERNAME="admin" \ 599 | -e HARBOR_PASSWORD="Harbor12345" \ 600 | -e HARBOR_URL="http://192.168.56.4" \ 601 | --net host --rm krystism/harborclient' 602 | # get my ip 603 | alias my_ip="docker run -t -i --rm alpine sh -c 'ip route get 8.8.8.8' | cut -d ' ' -f 8 | head -n 1" 604 | 605 | # ipcalc not on Mac 606 | ipcalc='docker run -t -i --rm alpine ipcalc' 607 | 608 | ``` 609 | ## 5 pip 610 | 611 | 使用中科大源: 612 | 613 | ```bash 614 | cat >>~/.pip/pip.conf <time.txt session.typescript # 开始录制 945 | [root@mistral ~]# ls 946 | dotfiles mistral mistral-actions openrc session.typescript time.txt workbook.yaml workflows 947 | [root@mistral ~]# date 948 | Wed May 3 20:21:14 CST 2017 949 | [root@mistral ~]# cal 950 | May 2017 951 | Su Mo Tu We Th Fr Sa 952 | 1 2 3 4 5 6 953 | 7 8 9 10 11 12 13 954 | 14 15 16 17 18 19 20 955 | 21 22 23 24 25 26 27 956 | 28 29 30 31 957 | 958 | [root@mistral ~]# exit #结束录制 959 | ``` 960 | 961 | session回放: 962 | 963 | ``` 964 | scriptreplay -t time.txt session.typescript 965 | ``` 966 | 967 | ### [cheat](https://github.com/chrisallenlane/cheat) 968 | 969 | 命令笔记,保存一些有用但是老是记不住的命令。 970 | 971 | 比如OpenStack的`nova`命令,只需要把有用的命令保存到`~/.cheat/nova`文件中: 972 | 973 | ``` 974 | ➜ nova git:(mitaka) ✗ cat ~/.cheat/nova 975 | # To list VMs on current tenant: 976 | nova list 977 | 978 | # To list VMs of all tenants (admin user only): 979 | nova list --all-tenants 980 | 981 | # To boot a VM on a specific host: 982 | nova boot --nic net-id= \ 983 | --image \ 984 | --flavor \ 985 | --availability-zone nova: 986 | 987 | # To stop a server 988 | nova stop 989 | 990 | # To start a server 991 | nova start 992 | 993 | # To attach a network interface to a specific VM: 994 | nova interface-attach --net-id 995 | ``` 996 | 997 | 要用的时候,使用`cheat`查询: 998 | 999 | ``` 1000 | ➜ nova git:(mitaka) ✗ cheat nova 1001 | # To list VMs on current tenant: 1002 | nova list 1003 | 1004 | # To list VMs of all tenants (admin user only): 1005 | nova list --all-tenants 1006 | 1007 | # To boot a VM on a specific host: 1008 | nova boot --nic net-id= \ 1009 | --image \ 1010 | --flavor \ 1011 | --availability-zone nova: 1012 | 1013 | # To stop a server 1014 | nova stop 1015 | 1016 | # To start a server 1017 | nova start 1018 | 1019 | # To attach a network interface to a specific VM: 1020 | nova interface-attach --net-id 1021 | ``` 1022 | 1023 | 如果连命令都忘了,cheat还支持模糊搜索: 1024 | 1025 | ``` 1026 | ➜ nova git:(mitaka) ✗ cheat -s 'nov' 1027 | nova: 1028 | nova list 1029 | nova list --all-tenants 1030 | nova boot --nic net-id= \ 1031 | --availability-zone nova: 1032 | nova stop 1033 | nova start 1034 | nova interface-attach --net-id 1035 | ``` 1036 | 1037 | cheat还收集了一些常用的命令,比如`tar`: 1038 | 1039 | ``` 1040 | # To extract an uncompressed archive: 1041 | tar -xvf /path/to/foo.tar 1042 | 1043 | # To create an uncompressed archive: 1044 | tar -cvf /path/to/foo.tar /path/to/foo/ 1045 | 1046 | # To extract a .gz archive: 1047 | tar -xzvf /path/to/foo.tgz 1048 | 1049 | # To create a .gz archive: 1050 | tar -czvf /path/to/foo.tgz /path/to/foo/ 1051 | 1052 | # To list the content of an .gz archive: 1053 | tar -ztvf /path/to/foo.tgz 1054 | 1055 | # To extract a .bz2 archive: 1056 | tar -xjvf /path/to/foo.tgz 1057 | 1058 | # To create a .bz2 archive: 1059 | tar -cjvf /path/to/foo.tgz /path/to/foo/ 1060 | 1061 | # To list the content of an .bz2 archive: 1062 | tar -jtvf /path/to/foo.tgz 1063 | 1064 | # To create a .gz archive and exclude all jpg,gif,... from the tgz 1065 | tar czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/ 1066 | 1067 | # To use parallel (multi-threaded) implementation of compression algorithms: 1068 | tar -z ... -> tar -Ipigz ... 1069 | tar -j ... -> tar -Ipbzip2 ... 1070 | tar -J ... -> tar -Ipixz ... 1071 | ``` 1072 | 1073 | ## Mac专有的命令行工具 1074 | 1075 | ### say 1076 | 1077 | 文本朗读工具,支持各种怪异(恐怖)的声音和语气。在终端下跑这个命令体验所有的声音,小心别被吓着了: 1078 | 1079 | ``` 1080 | for i in `say -v '?' | cut -d ' ' -f 1`; do echo $i && say -v "$i" 'Hello World';done 1081 | ``` 1082 | 1083 | ### pbcopy/pbpaste 1084 | 1085 | pbcopy把终端输出通过管道传到系统粘贴板: 1086 | 1087 | ``` 1088 | cat test.sh | pbcopy 1089 | ``` 1090 | 1091 | pbpaste把系统粘贴板内容输出到终端: 1092 | 1093 | ``` 1094 | pbpaste 1095 | ``` 1096 | 1097 | ## 参考 1098 | 1099 | 1. [vim-sdf13](http://vim.spf13.com/)。 1100 | 2. [所需即所获:像 IDE 一样使用 vim](https://github.com/yangyangwithgnu/use_vim_as_ide)。 1101 | -------------------------------------------------------------------------------- /cheat/nova: -------------------------------------------------------------------------------- 1 | # To list VMs on current tenant: 2 | nova list 3 | 4 | # To list VMs of all tenants (admin user only): 5 | nova list --all-tenants 6 | 7 | # To boot a VM on a specific host: 8 | nova boot --nic net-id= \ 9 | --image \ 10 | --flavor \ 11 | --availability-zone nova: 12 | 13 | # To stop a server 14 | nova stop 15 | 16 | # To start a server 17 | nova start 18 | 19 | # To attach a network interface to a specific VM: 20 | nova interface-attach --net-id 21 | -------------------------------------------------------------------------------- /cheat/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mkdir -p ~/.cheat 3 | cp * ~/.cheat 4 | rm -f ~/.cheat/$(basename $0) 5 | -------------------------------------------------------------------------------- /cheat/test.sh: -------------------------------------------------------------------------------- 1 | echo $(basename $0) 2 | -------------------------------------------------------------------------------- /git/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/git/.gitkeep -------------------------------------------------------------------------------- /git/gitconfig: -------------------------------------------------------------------------------- 1 | [color] 2 | ui = true 3 | [color "branch"] 4 | current = yellow reverse 5 | local = yellow 6 | remote = green 7 | [color "diff"] 8 | meta = yellow bold 9 | frag = magenta bold 10 | old = red 11 | new = green 12 | [alias] 13 | s = status 14 | ss = status -s 15 | 16 | # via http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ 17 | snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}" 18 | snapshots = !git stash list --grep snapshot 19 | 20 | #via http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit 21 | recent-branches = !git for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(refname:short)' 22 | 23 | # branch 24 | b = branch # branch 25 | ba = branch -av # branch (verbose) 26 | 27 | # commit 28 | c = commit 29 | amend = commit --amend # ammend your last commit 30 | retry = commit -a --amend 31 | 32 | # checkout 33 | ck = checkout # checkout 34 | 35 | # cherry-pick 36 | cp = cherry-pick -x # grab a change from a branch 37 | 38 | # diff 39 | d = diff # diff unstaged changes 40 | dc = diff --cached # diff staged changes 41 | last = diff HEAD^ # diff last committed change 42 | 43 | # log 44 | l = log --graph --date=short 45 | changes = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\" --name-status 46 | short = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\" 47 | simple = log --pretty=format:\" * %s\" 48 | shortnocolor = log --pretty=format:\"%h %cr %cn %s\" 49 | 50 | 51 | # remote 52 | r = remote -v # show remotes (verbose) 53 | 54 | # reset 55 | unstage = reset HEAD # remove files from index (tracking) 56 | uncommit = reset --soft HEAD^ # go back before last commit, with files in uncommitted state 57 | filelog = log -u # show changes to a file 58 | mt = mergetool # fire up the merge tool 59 | 60 | # stash 61 | #ss = stash # stash changes 62 | #sl = stash list # list stashes 63 | #sa = stash apply # apply stash (restore changes) 64 | #sd = stash drop # drop stashes (destory changes) 65 | 66 | # push 67 | p = push 68 | 69 | # tag 70 | t = tag -n # show tags with lines of each tag message 71 | 72 | # svn helpers 73 | svnr = svn rebase 74 | svnd = svn dcommit 75 | svnl = svn log --oneline --show-commit 76 | [format] 77 | pretty = format:%C(blue)%ad%Creset %C(yellow)%h%C(green)%d%Creset %C(blue)%s %C(magenta) [%an]%Creset 78 | [mergetool] 79 | prompt = false 80 | [mergetool "mvimdiff"] 81 | cmd="mvim -c 'Gdiff' $MERGED" # use fugitive.vim for 3-way merge 82 | keepbackup=false 83 | [merge] 84 | summary = true 85 | verbosity = 1 86 | tool = mvimdiff 87 | [apply] 88 | whitespace = nowarn 89 | [branch] 90 | autosetupmerge = true 91 | [push] 92 | # 'git push' will push the current branch to its tracking branch 93 | # the usual default is to push all branches 94 | default = upstream 95 | [core] 96 | autocrlf = false 97 | editor = vim 98 | quotepath = false # 解决git status中文乱码 99 | [advice] 100 | statusHints = true 101 | [diff] 102 | # Git diff will use (i)ndex, (w)ork tree, (c)ommit and (o)bject 103 | # instead of a/b/c/d as prefixes for patches 104 | mnemonicprefix = true 105 | algorithm = patience 106 | [rerere] 107 | # Remember my merges 108 | # http://gitfu.wordpress.com/2008/04/20/git-rerere-rereremember-what-you-did-last-time/ 109 | enabled = true 110 | [include] 111 | #path = .gitconfig.user 112 | -------------------------------------------------------------------------------- /git/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cp ./gitconfig ~/.gitconfig 4 | -------------------------------------------------------------------------------- /img/ag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/ag.png -------------------------------------------------------------------------------- /img/axel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/axel.jpg -------------------------------------------------------------------------------- /img/cloc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/cloc.jpg -------------------------------------------------------------------------------- /img/fpp-demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/fpp-demo.jpg -------------------------------------------------------------------------------- /img/fuck.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/fuck.gif -------------------------------------------------------------------------------- /img/fzf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/fzf.jpg -------------------------------------------------------------------------------- /img/fzf_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/fzf_history.png -------------------------------------------------------------------------------- /img/git-diff.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/git-diff.jpg -------------------------------------------------------------------------------- /img/htop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/htop.png -------------------------------------------------------------------------------- /img/iterm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/iterm.jpg -------------------------------------------------------------------------------- /img/jq_demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/jq_demo.png -------------------------------------------------------------------------------- /img/jq_filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/jq_filter.png -------------------------------------------------------------------------------- /img/mycli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/mycli.png -------------------------------------------------------------------------------- /img/shellcheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/shellcheck.png -------------------------------------------------------------------------------- /img/tig-demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/tig-demo.jpg -------------------------------------------------------------------------------- /img/tig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/tig.png -------------------------------------------------------------------------------- /img/tmux.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/tmux.jpg -------------------------------------------------------------------------------- /img/vim-comment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-comment.jpg -------------------------------------------------------------------------------- /img/vim-ctrlp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-ctrlp.jpg -------------------------------------------------------------------------------- /img/vim-easymotion.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-easymotion.jpg -------------------------------------------------------------------------------- /img/vim-mark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-mark.jpg -------------------------------------------------------------------------------- /img/vim-nerdtree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-nerdtree.jpg -------------------------------------------------------------------------------- /img/vim-paste.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-paste.jpg -------------------------------------------------------------------------------- /img/vim-taglist.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-taglist.jpg -------------------------------------------------------------------------------- /img/vim-ycm-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-ycm-2.jpg -------------------------------------------------------------------------------- /img/vim-ycm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/vim-ycm.jpg -------------------------------------------------------------------------------- /img/zsh-syntax.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/img/zsh-syntax.jpg -------------------------------------------------------------------------------- /iterm/solarized_enhanced.itermcolors: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansi 0 Color 6 | 7 | Alpha Component 8 | 1 9 | Blue Component 10 | 0.19370138645172119 11 | Color Space 12 | Calibrated 13 | Green Component 14 | 0.15575926005840302 15 | Red Component 16 | 0.0 17 | 18 | Ansi 1 Color 19 | 20 | Alpha Component 21 | 1 22 | Blue Component 23 | 0.14145714044570923 24 | Color Space 25 | Calibrated 26 | Green Component 27 | 0.10840655118227005 28 | Red Component 29 | 0.81926977634429932 30 | 31 | Ansi 10 Color 32 | 33 | Alpha Component 34 | 1 35 | Blue Component 36 | 0.23294100165367126 37 | Color Space 38 | Calibrated 39 | Green Component 40 | 0.92800295352935791 41 | Red Component 42 | 0.13237467408180237 43 | 44 | Ansi 11 Color 45 | 46 | Alpha Component 47 | 1 48 | Blue Component 49 | 0.13187217712402344 50 | Color Space 51 | Calibrated 52 | Green Component 53 | 0.92886501550674438 54 | Red Component 55 | 0.97948682308197021 56 | 57 | Ansi 12 Color 58 | 59 | Alpha Component 60 | 1 61 | Blue Component 62 | 0.81517148017883301 63 | Color Space 64 | Calibrated 65 | Green Component 66 | 0.42266538739204407 67 | Red Component 68 | 0.079833135008811951 69 | 70 | Ansi 13 Color 71 | 72 | Alpha Component 73 | 1 74 | Blue Component 75 | 0.72908437252044678 76 | Color Space 77 | Calibrated 78 | Green Component 79 | 0.33896297216415405 80 | Red Component 81 | 0.34798634052276611 82 | 83 | Ansi 14 Color 84 | 85 | Alpha Component 86 | 1 87 | Blue Component 88 | 0.7544025182723999 89 | Color Space 90 | Calibrated 91 | Green Component 92 | 0.66200166940689087 93 | Red Component 94 | 0.15339583158493042 95 | 96 | Ansi 15 Color 97 | 98 | Alpha Component 99 | 1 100 | Blue Component 101 | 0.99999129772186279 102 | Color Space 103 | Calibrated 104 | Green Component 105 | 0.99997437000274658 106 | Red Component 107 | 1 108 | 109 | Ansi 2 Color 110 | 111 | Alpha Component 112 | 1 113 | Blue Component 114 | 0.31279435753822327 115 | Color Space 116 | Calibrated 117 | Green Component 118 | 0.76263582706451416 119 | Red Component 120 | 0.12317244708538055 121 | 122 | Ansi 3 Color 123 | 124 | Alpha Component 125 | 1 126 | Blue Component 127 | 0.023484811186790466 128 | Color Space 129 | Calibrated 130 | Green Component 131 | 0.46751424670219421 132 | Red Component 133 | 0.64746475219726562 134 | 135 | Ansi 4 Color 136 | 137 | Alpha Component 138 | 1 139 | Blue Component 140 | 0.83575129508972168 141 | Color Space 142 | Calibrated 143 | Green Component 144 | 0.49319809675216675 145 | Red Component 146 | 0.13469523191452026 147 | 148 | Ansi 5 Color 149 | 150 | Alpha Component 151 | 1 152 | Blue Component 153 | 0.61576437950134277 154 | Color Space 155 | Calibrated 156 | Green Component 157 | 0.73429191112518311 158 | Red Component 159 | 0.14068999886512756 160 | 161 | Ansi 6 Color 162 | 163 | Alpha Component 164 | 1 165 | Blue Component 166 | 0.44449725747108459 167 | Color Space 168 | Calibrated 169 | Green Component 170 | 0.48283308744430542 171 | Red Component 172 | 0.12711982429027557 173 | 174 | Ansi 7 Color 175 | 176 | Alpha Component 177 | 1 178 | Blue Component 179 | 0.99999129772186279 180 | Color Space 181 | Calibrated 182 | Green Component 183 | 0.99997437000274658 184 | Red Component 185 | 1 186 | 187 | Ansi 8 Color 188 | 189 | Alpha Component 190 | 1 191 | Blue Component 192 | 0.15170273184776306 193 | Color Space 194 | Calibrated 195 | Green Component 196 | 0.11783610284328461 197 | Red Component 198 | 0.0 199 | 200 | Ansi 9 Color 201 | 202 | Alpha Component 203 | 1 204 | Blue Component 205 | 0.073530435562133789 206 | Color Space 207 | Calibrated 208 | Green Component 209 | 0.21325300633907318 210 | Red Component 211 | 0.74176257848739624 212 | 213 | Background Color 214 | 215 | Alpha Component 216 | 1 217 | Blue Component 218 | 0.077523812651634216 219 | Color Space 220 | Calibrated 221 | Green Component 222 | 0.077522493898868561 223 | Red Component 224 | 0.077524803578853607 225 | 226 | Badge Color 227 | 228 | Alpha Component 229 | 0.5 230 | Blue Component 231 | 0.0 232 | Color Space 233 | Calibrated 234 | Green Component 235 | 0.0 236 | Red Component 237 | 1 238 | 239 | Bold Color 240 | 241 | Alpha Component 242 | 1 243 | Blue Component 244 | 0.56363654136657715 245 | Color Space 246 | Calibrated 247 | Green Component 248 | 0.56485837697982788 249 | Red Component 250 | 0.50599193572998047 251 | 252 | Cursor Color 253 | 254 | Alpha Component 255 | 1 256 | Blue Component 257 | 0.51685798168182373 258 | Color Space 259 | Calibrated 260 | Green Component 261 | 0.50962930917739868 262 | Red Component 263 | 0.44058024883270264 264 | 265 | Cursor Guide Color 266 | 267 | Alpha Component 268 | 0.25 269 | Blue Component 270 | 1 271 | Color Space 272 | Calibrated 273 | Green Component 274 | 0.9100000262260437 275 | Red Component 276 | 0.64999997615814209 277 | 278 | Cursor Text Color 279 | 280 | Alpha Component 281 | 1 282 | Blue Component 283 | 0.19370138645172119 284 | Color Space 285 | Calibrated 286 | Green Component 287 | 0.15575926005840302 288 | Red Component 289 | 0.0 290 | 291 | Foreground Color 292 | 293 | Alpha Component 294 | 1 295 | Blue Component 296 | 0.75558114051818848 297 | Color Space 298 | Calibrated 299 | Green Component 300 | 0.75556838512420654 301 | Red Component 302 | 0.75559091567993164 303 | 304 | Link Color 305 | 306 | Alpha Component 307 | 1 308 | Blue Component 309 | 0.67799997329711914 310 | Color Space 311 | Calibrated 312 | Green Component 313 | 0.27000001072883606 314 | Red Component 315 | 0.023000000044703484 316 | 317 | Selected Text Color 318 | 319 | Alpha Component 320 | 1 321 | Blue Component 322 | 0.056133434176445007 323 | Color Space 324 | Calibrated 325 | Green Component 326 | 0.056132487952709198 327 | Red Component 328 | 0.056134156882762909 329 | 330 | Selection Color 331 | 332 | Alpha Component 333 | 1 334 | Blue Component 335 | 0.99999129772186279 336 | Color Space 337 | Calibrated 338 | Green Component 339 | 0.99997437000274658 340 | Red Component 341 | 1 342 | 343 | 344 | 345 | -------------------------------------------------------------------------------- /pip/pip.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | index-url = http://mirrors.aliyun.com/pypi/simple/ 3 | [install] 4 | trusted-host=mirrors.aliyun.com 5 | -------------------------------------------------------------------------------- /pip/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | mkdir -p ~/.pip 4 | cp ./pip.conf ~/.pip/ 5 | -------------------------------------------------------------------------------- /ssh/README.md: -------------------------------------------------------------------------------- 1 | ## ssh复用连接配置 2 | 3 | ssh支持复用连接,只要第一次登录跳板机,以后登录不需要再输入密码了,方便开发。 4 | 5 | ``` 6 | Host * 7 | KeepAlive yes 8 | ServerAliveInterval 60 9 | ControlMaster auto 10 | ControlPersist yes 11 | ControlPath ~/.ssh/socks/%h-%p-%r 12 | ``` 13 | -------------------------------------------------------------------------------- /ssh/config: -------------------------------------------------------------------------------- 1 | # 设置session复用,在session生命周期内,不需要重复输入密码,在使用跳板机时特别有用 2 | Host * 3 | KeepAlive yes 4 | ServerAliveInterval 60 5 | ControlMaster auto 6 | ControlPersist yes 7 | ControlPath ~/.ssh/socks/%h-%p-%r 8 | -------------------------------------------------------------------------------- /ssh/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SSH_ROOT=~/.ssh 3 | cp -i ./config $SSH_ROOT/ 4 | mkdir -p $SSH_ROOT/socks 5 | -------------------------------------------------------------------------------- /tmux/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/tmux/.gitkeep -------------------------------------------------------------------------------- /tmux/README.md: -------------------------------------------------------------------------------- 1 | # Tmux configuration 2 | 3 | ## About prefix key 4 | 5 | Some people like to use Ctrl_a to send prefix signal, but I don't like it, because this key is a shortcut to move pointer to the beginning of the line. Besides, I don't want to 6 | override the prefix of `screen`. If you like to use Ctrl_a, please append following configuration items: 7 | 8 | ``` 9 | set -g prefix C-a 10 | unbind C-b 11 | ``` 12 | 13 | ## Quick Start 14 | 15 | You need do nothing except executing following setup script: 16 | 17 | ```bash 18 | ./setup.sh 19 | ``` 20 | -------------------------------------------------------------------------------- /tmux/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cp -v tmux.conf ~/.tmux.conf 4 | -------------------------------------------------------------------------------- /tmux/tmux.conf: -------------------------------------------------------------------------------- 1 | #set -g prefix C-b # Some people like set leader key to Crtl_a, but I don't like it! 2 | #unbind C-b 3 | 4 | # Split windows 5 | bind \ split-window -h 6 | bind - split-window -v 7 | 8 | #set-option -g default-shell zsh 9 | setw -g mode-keys vi 10 | #set-option -g default-command "reattach-to-user-namespace -l zsh" 11 | # start selecting text typing 'v' key (once you are in copy mode) 12 | bind-key -t vi-copy v begin-selection 13 | # copy selected text to the system's clipboard 14 | #bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" 15 | 16 | set -g base-index 1 # window index from 1, not zero 17 | set -s escape-time 0 18 | 19 | bind r source-file ~/.tmux.conf \; display "Reloaded!" 20 | bind-key / command-prompt "split-window -h 'exec man %%'" 21 | 22 | set-option -g allow-rename off # prevent system from renaming our window 23 | 24 | 25 | set -g default-terminal "screen-256color" 26 | 27 | set -g status-justify left 28 | set -g status-interval 1 29 | set -g status-position top 30 | set -g status-bg colour234 31 | set -g status-fg colour137 32 | set -g status-attr dim 33 | set -g status-left '' 34 | # status右边显示当前时间 35 | set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' 36 | set -g status-right-length 50 37 | set -g status-left-length 20 38 | 39 | # 设置windows菜单颜色 Prefix+w 40 | setw -g clock-mode-colour colour135 41 | setw -g mode-attr bold 42 | setw -g mode-fg colour15 43 | setw -g mode-bg colour238 44 | 45 | # pane border 46 | set -g pane-border-bg colour235 47 | set -g pane-border-fg colour238 48 | set -g pane-active-border-bg colour236 49 | set -g pane-active-border-fg colour15 50 | 51 | 52 | # 设置status面板当前windows颜色 53 | setw -g window-status-current-fg colour81 54 | setw -g window-status-current-bg colour238 55 | setw -g window-status-current-attr bold 56 | setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' 57 | 58 | # 设置status非活跃windows颜色 59 | setw -g window-status-fg colour138 60 | setw -g window-status-bg colour235 61 | setw -g window-status-attr none 62 | setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' 63 | 64 | setw -g window-status-bell-attr bold 65 | setw -g window-status-bell-fg colour255 66 | setw -g window-status-bell-bg colour1 67 | 68 | # 设置message字体颜色 69 | set -g message-attr bold 70 | #set -g message-fg colour232 71 | set -g message-fg colour15 72 | set -g message-bg colour236 73 | -------------------------------------------------------------------------------- /vim/README.md: -------------------------------------------------------------------------------- 1 | ## Prerequisites 2 | 3 | * Unix-based operating system (OS X or Linux) 4 | * vundle 5 | * vim >= 7.4 6 | * ctags 7 | * cmake 8 | 9 | ## Quick Start 10 | 11 | ### 1. Set up vim 12 | 13 | ```bash 14 | brew install vim 15 | ``` 16 | 17 | ### 2. Set up Vundle: 18 | 19 | ```bash 20 | git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 21 | ``` 22 | 23 | ### 3. Set up Plugins 24 | 25 | ```bash 26 | vim "+PluginInstall" "+x" "+x" 27 | ``` 28 | 29 | Or open vim and type following command on normal mode: 30 | 31 | ``` 32 | :PluginInstall 33 | ``` 34 | 35 | ### 4. Install YCM 36 | 37 | ```bash 38 | cd ~/.vim/bundle/YouCompleteMe 39 | ./install.sh 40 | ``` 41 | -------------------------------------------------------------------------------- /vim/install_for_MacOS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sudo brew install ctags cmake 4 | 5 | if ! ctags --list-languages | grep -qi python; then 6 | echo "Fail to install ctags!" 7 | exit 1 8 | fi 9 | 10 | if [ ! -d ~/.vim/bundle/Vundle.vim ]; then 11 | echo "Install vundle ..." 12 | git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 13 | fi 14 | 15 | cp -v vimrc ~/.vimrc 16 | vim "+PluginInstall" "+x" "+x" 17 | 18 | ~/.vim/bundle/YouCompleteMe/install.sh 19 | -------------------------------------------------------------------------------- /vim/install_on_CentOS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | yum install -y ctags cmake gcc-c++ python-devel 4 | 5 | if ! ctags --list-languages | grep -qi python; then 6 | echo "Fail to install ctags!" 7 | exit 1 8 | fi 9 | 10 | if [ ! -d ~/.vim/bundle/Vundle.vim ]; then 11 | echo "Install vundle ..." 12 | git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 13 | fi 14 | 15 | cp -v vimrc ~/.vimrc 16 | vim "+PluginInstall" "+x" "+x" 17 | 18 | ~/.vim/bundle/YouCompleteMe/install.sh 19 | -------------------------------------------------------------------------------- /vim/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cp -v vimrc ~/.vimrc 3 | vim "+PluginInstall" "+x" "+x" 4 | -------------------------------------------------------------------------------- /vim/vimrc: -------------------------------------------------------------------------------- 1 | " ***************** 全局设置 ************** " 2 | 3 | " 开启文件类型侦测 4 | filetype on 5 | " 根据侦测到的不同类型加载对应的插件 6 | filetype plugin on 7 | 8 | " 自动缩进 9 | filetype indent on 10 | 11 | " 开启语法高亮功能 12 | syntax enable 13 | " 允许用指定语法高亮配色方案替换默认方案 14 | syntax on 15 | 16 | set nocompatible "关闭兼容模式 17 | set incsearch "开启实时搜索功能 18 | set ignorecase "搜索时忽略大小写 19 | set smartcase "搜索时如果只包含小写字母,匹配结果忽略大小写,如果包含大写字母,匹配结果是大小写敏感。 20 | set wildmenu "vim命令自动补全 21 | set autoread "文件自动更新 22 | set gcr=a:block-blinkon0 "禁止关闭闪烁 23 | set laststatus=2 "总是显示状态栏 24 | set ruler "显示光标位置 25 | set number "显示行号 26 | set cursorline "高亮显示当前行 27 | "set cursorcolumn "高亮显示当前列 28 | set hlsearch "高亮显示搜索结果 29 | " set nowrap "禁止折行 30 | set backspace=2 "回退键生效 31 | "set backspace=indent,eol,start 32 | 33 | " 禁止显示滚动条 34 | set guioptions-=l 35 | set guioptions-=L 36 | set guioptions-=r 37 | set guioptions-=R 38 | 39 | " 禁止显示菜单和工具条 40 | set guioptions-=m 41 | set guioptions-=T 42 | 43 | " 将制表符扩展为空格 44 | set expandtab 45 | " 设置编辑时制表符占用空格数 46 | set tabstop=4 47 | " 设置格式化时制表符占用空格数 48 | set shiftwidth=4 49 | " 让 vim 把连续数量的空格视为一个制表符 50 | set softtabstop=4 51 | " 基于缩进或语法进行代码折叠 52 | set foldmethod=syntax 53 | " 启动 vim 时关闭折叠代码 54 | set nofoldenable 55 | 56 | " 打开上次文件关闭的位置 57 | if has("autocmd") 58 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 59 | endif 60 | 61 | 62 | " *************** 设置全局快捷键 ***************** 63 | 64 | " 定义快捷键的前缀,即 65 | "let mapleader="\" 66 | let mapleader="'" 67 | 68 | " 设置快捷键将选中文本块复制至系统剪贴板 69 | vnoremap y "+y 70 | 71 | " 设置快捷键将系统剪贴板内容粘贴至 vim 72 | nmap p "+p 73 | 74 | " 定义快捷键关闭当前分割窗口 75 | nmap q :q 76 | 77 | " 定义快捷键保存当前窗口内容 78 | nmap w :w 79 | " 使用sudo强制保存文件 80 | nmap W :w !sudo tee % 81 | 82 | " 定义快捷键保存所有窗口内容并退出 vim 83 | "nmap WQ :wa:q 84 | 85 | " 不做任何保存,直接退出 vim 86 | "nmap Q :qa! 87 | 88 | " 跳转至右方的窗口 89 | nnoremap l l 90 | 91 | " 跳转至左方的窗口 92 | nnoremap h h 93 | 94 | " 跳转至上方的子窗口 95 | nnoremap k k 96 | 97 | " 跳转至下方的子窗口 98 | nnoremap j j 99 | 100 | " 清除高亮显示 101 | nmap N :noh 102 | 103 | " 定义快捷键在结对符之间跳转 104 | nmap M % 105 | 106 | nnoremap g 107 | nnoremap b 108 | 109 | 110 | " ************** 插件管理与设置 ************ " 111 | 112 | " vundle 环境设置 113 | filetype off 114 | set rtp+=~/.vim/bundle/Vundle.vim 115 | " vundle 管理的插件列表必须位于 vundle#begin() 和 vundle#end() 之间 116 | call vundle#begin() 117 | Plugin 'VundleVim/Vundle.vim' 118 | Plugin 'Lokaltog/vim-powerline' "status 美化 119 | Plugin 'octol/vim-cpp-enhanced-highlight' "对c++语法高亮增强 120 | Plugin 'kshenoy/vim-signature' "书签可视化的插件 121 | Plugin 'vim-scripts/BOOKMARKS--Mark-and-Highlight-Full-Lines' "书签行高亮 122 | Plugin 'majutsushi/tagbar' "taglist的增强版,查看标签,依赖于ctags 123 | Plugin 'scrooloose/nerdcommenter' "多行注释,leader键+cc生成, leader+cu删除注释 124 | Plugin 'scrooloose/nerdtree' "文件浏览 125 | Plugin 'Valloric/YouCompleteMe' "自动补全 126 | Plugin 'kien/ctrlp.vim' "搜索历史打开文件,在命令行模式下按ctrl+p触发 127 | Plugin 'vim-scripts/grep.vim' "在命令行模式使用grep命令,:Grep 128 | Plugin 'Lokaltog/vim-easymotion' "快速跳转,按两下leader键和f组合 129 | Plugin 'vim-scripts/ShowTrailingWhitespace.git' "高亮显示行尾的多余空白字符 130 | Plugin 'vim-scripts/indentpython.vim.git' 131 | Plugin 'vim-scripts/Solarized.git' "主题方案 132 | Plugin 'nathanaelkane/vim-indent-guides.git' "缩进对齐显示 133 | "Plugin 'vim-scripts/indexer.tar.gz' "自动生成标签 134 | "Plugin 'vim-scripts/DfrankUtil' "indexer 依赖 135 | "Plugin 'vim-scripts/vimprj' "indexer 依赖 136 | Plugin 'davidhalter/jedi-vim' "python 补全,不依赖于tags,但比较慢,可以使用indexer替换,但不能跳转项目外 137 | Plugin 'vim-scripts/Markdown' 138 | Plugin 'tpope/vim-surround' 139 | Plugin 'ekalinin/Dockerfile.vim' 140 | Plugin 'ConradIrwin/vim-bracketed-paste' " 使用bracketed-paste mode,粘贴代码时避免格式化 141 | " 插件列表结束 142 | call vundle#end() 143 | filetype on 144 | 145 | " Powerline 设置 146 | " 设置状态栏主题风格 147 | let g:Powerline_colorscheme='solarized256' 148 | 149 | 150 | 151 | " 设置tagbar 152 | " 设置 tagbar 子窗口的位置出现在主编辑区的左边 153 | let tagbar_left=1 154 | " " 设置显示/隐藏标签列表子窗口的快捷键。速记:identifier list by tag 155 | nnoremap t :TagbarToggle 156 | " " 设置标签子窗口的宽度 157 | let tagbar_width=32 158 | " " tagbar 子窗口中不显示冗余帮助信息 159 | let g:tagbar_compact=1 160 | " " 设置 ctags 对哪些代码标识符生成标签 161 | 162 | " signature设置 163 | let g:SignatureMap = { 164 | \ 'Leader' : "m", 165 | \ 'PlaceNextMark' : "m,", 166 | \ 'ToggleMarkAtLine' : "m.", 167 | \ 'PurgeMarksAtLine' : "m-", 168 | \ 'DeleteMark' : "dm", 169 | \ 'PurgeMarks' : "mda", 170 | \ 'PurgeMarkers' : "m", 171 | \ 'GotoNextLineAlpha' : "']", 172 | \ 'GotoPrevLineAlpha' : "'[", 173 | \ 'GotoNextSpotAlpha' : "`]", 174 | \ 'GotoPrevSpotAlpha' : "`[", 175 | \ 'GotoNextLineByPos' : "]'", 176 | \ 'GotoPrevLineByPos' : "['", 177 | \ 'GotoNextSpotByPos' : "mn", 178 | \ 'GotoPrevSpotByPos' : "mp", 179 | \ 'GotoNextMarker' : "[+", 180 | \ 'GotoPrevMarker' : "[-", 181 | \ 'GotoNextMarkerAny' : "]=", 182 | \ 'GotoPrevMarkerAny' : "[=", 183 | \ 'ListLocalMarks' : "ms", 184 | \ 'ListLocalMarkers' : "m?" 185 | \ } 186 | 187 | " 使用 NERDTree 插件查看工程文件。设置快捷键,速记:file list 188 | nmap f :NERDTreeToggle 189 | " 设置NERDTree子窗口宽度 190 | let NERDTreeWinSize=32 191 | " 设置NERDTree子窗口位置 192 | let NERDTreeWinPos="right" 193 | " 显示隐藏文件 194 | let NERDTreeShowHidden=1 195 | " NERDTree 子窗口中不显示冗余帮助信息 196 | let NERDTreeMinimalUI=1 197 | " 删除文件时自动删除文件对应 buffer 198 | let NERDTreeAutoDeleteBuffer=1 199 | 200 | " YCM 补全菜单配色 201 | " 菜单 202 | "highlight Pmenu ctermfg=2 ctermbg=3 guifg=#005f87 guibg=#EEE8D5 203 | " 选中项 204 | "highlight PmenuSel ctermfg=2 ctermbg=3 guifg=#AFD700 guibg=#106900 205 | " 补全功能在注释中同样有效 206 | let g:ycm_complete_in_comments=1 207 | " 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示 208 | let g:ycm_confirm_extra_conf=0 209 | " 开启 YCM 标签补全引擎 210 | let g:ycm_collect_identifiers_from_tags_files=1 211 | " 引入 C++ 标准库tags 212 | set tags+=/data/misc/software/misc./vim/stdcpp.tags 213 | " YCM 集成 OmniCppComplete 补全引擎,设置其快捷键 214 | "inoremap ; 215 | " 补全内容不以分割子窗口形式出现,只显示补全列表 216 | set completeopt-=preview 217 | " 从第一个键入字符就开始罗列匹配项 218 | let g:ycm_min_num_of_chars_for_completion=1 219 | " 禁止缓存匹配项,每次都重新生成匹配项 220 | let g:ycm_cache_omnifunc=0 221 | " 语法关键字补全 222 | let g:ycm_seed_identifiers_with_syntax=1 223 | let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' 224 | 225 | 226 | """ color settings 227 | set t_Co=256 228 | if has("gui_running") 229 | set guioptions=gR 230 | set mousemodel=popup 231 | set background=light 232 | ""hi LineNr cterm=bold guibg=black guifg=white 233 | ""hi CursorLine cterm=none ctermbg=lightgray ctermfg=none 234 | ""hi CursorColumn cterm=none ctermbg=lightgray ctermfg=none 235 | else 236 | set background=dark 237 | ""hi LineNr cterm=bold ctermbg=black ctermfg=white 238 | ""hi CursorLine cterm=none ctermbg=darkgray ctermfg=none 239 | ""hi CursorColumn cterm=none ctermbg=darkgray ctermfg=none 240 | endif 241 | 242 | :silent! colorscheme solarized 243 | "colorscheme default 244 | 245 | " indent guides 246 | "let g:indent_guides_enable_on_vim_startup=1 247 | " 从第二层开始可视化显示缩进 248 | let g:indent_guides_start_level=2 249 | "let g:indent_guides_auto_colors = 0 250 | "hi IndentGuidesOdd guibg=red ctermbg=3 251 | "hi IndentGuidesEven guibg=green ctermbg=4 252 | " 色块宽度 253 | let g:indent_guides_guide_size=1 254 | " 快捷键 i 开/关缩进可视化 255 | noremap sj :IndentGuidesToggle 256 | 257 | " 每行不能超过80字符,否则高亮显示 258 | highlight OverLength ctermbg=red ctermfg=white guibg=#592929 259 | match OverLength /\%80v.\+/ 260 | -------------------------------------------------------------------------------- /zsh/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/int32bit/dotfiles/7a31997c723d05f5263db34f7de8790e52e0f992/zsh/.gitkeep -------------------------------------------------------------------------------- /zsh/README.md: -------------------------------------------------------------------------------- 1 | ## Prerequisites 2 | 3 | * zsh 4 | * git 5 | * oh-my-zsh 6 | 7 | ## Quick Start 8 | 9 | You need do nothing except executing setup script: 10 | 11 | ``` 12 | ./setup.sh 13 | ``` 14 | -------------------------------------------------------------------------------- /zsh/alias.zsh: -------------------------------------------------------------------------------- 1 | alias rm='rm -i' 2 | alias mv='mv -i' 3 | alias cp='cp -i' 4 | alias grep='grep -E' 5 | alias df='df -h' 6 | alias ag='ag --color-match "1;31"' 7 | alias tailf='tail -f' 8 | 9 | if which vim &>/dev/null; then 10 | alias vi='vim' 11 | fi 12 | 13 | alias j='z' 14 | -------------------------------------------------------------------------------- /zsh/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | if [[ ! -d ~/.oh-my-zsh ]]; then 4 | echo "Install oh-my-zsh ..." 5 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 6 | fi 7 | 8 | cp -v alias.zsh ~/.alias 9 | cp -v zshrc ~/.zshrc 10 | 11 | source ~/.zshrc 12 | -------------------------------------------------------------------------------- /zsh/zshrc: -------------------------------------------------------------------------------- 1 | export ZSH=$HOME/.oh-my-zsh 2 | ZSH_THEME="robbyrussell" 3 | plugins=(git zsh-syntax-highlighting extract z safe-paste zsh-completions kubectl) 4 | export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" 5 | source $ZSH/oh-my-zsh.sh 6 | export LANG=en_US.UTF-8 7 | export EDITOR='vim' 8 | 9 | test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" 10 | PATH=/usr/local/go/bin:$PATH 11 | 12 | z_replacement() 13 | { 14 | [ $# -gt 0 ] && _z "$*" && return 15 | cd "$(_z -l 2>&1 | fzf-tmux +s --tac --query "$*" | sed 's/^[0-9,.]* *//')" 16 | } 17 | 18 | if which fzf &>/dev/null 19 | then 20 | alias z='z_replacement' 21 | fi 22 | 23 | [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh 24 | 25 | if [[ -e ~/.alias ]]; then 26 | source ~/.alias 27 | fi 28 | 29 | if [[ -e ~/.extra_config ]]; then 30 | source ~/.extra_config 31 | fi 32 | 33 | fh() { 34 | eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//') 35 | } 36 | 37 | f() { 38 | if [[ $# -lt 2 ]]; then 39 | echo "f " 40 | return 1 41 | fi 42 | dir=$1 43 | query=$2 44 | pushd "$dir" &>/dev/null && fzf -1 -e -q "$query" && popd &>/dev/null 45 | } 46 | 47 | --------------------------------------------------------------------------------