├── .gitignore ├── test ├── test.go ├── test.md ├── test.css ├── test.js ├── test.html ├── test.json ├── test.php └── test.py ├── vimrc.plugins ├── vimrc.language ├── vimrc.append ├── vimrc.local ├── LICENSE ├── install.sh ├── README.md └── vimrc /.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | fmt.Println("vim-go") 7 | } 8 | -------------------------------------------------------------------------------- /vimrc.plugins: -------------------------------------------------------------------------------- 1 | " =============================================================== 2 | " CUSTOMIZE PLUGINS 3 | " =============================================================== 4 | 5 | " Coffee Script 6 | " Plug 'kchmck/vim-coffee-script' " CoffeeScript 7 | -------------------------------------------------------------------------------- /test/test.md: -------------------------------------------------------------------------------- 1 | # H1 2 | 3 | ## List 4 | 5 | * item 1 6 | * item 1.1 7 | ```bash 8 | # some text under item 1.1 9 | ``` 10 | * item 1.2 11 | * item 2 12 | 13 | ## Code Preview 14 | 15 | ```bash 16 | # blah blah 17 | if [ -e ~/.vimrc ] 18 | then 19 | echo 'OK!' 20 | fi 21 | ``` 22 | -------------------------------------------------------------------------------- /vimrc.language: -------------------------------------------------------------------------------- 1 | " ------------------------------------------------- 2 | " CUSTOMIZE LANGUAGE 3 | " ------------------------------------------------- 4 | 5 | " Edit the following line to enable/disable languages your want 6 | let g:language_group = ['markdown', 'html', 'css', 'js', 'json', 'php', 'python', 'c', 'go', ] 7 | -------------------------------------------------------------------------------- /vimrc.append: -------------------------------------------------------------------------------- 1 | let g:airline_theme='dracula' 2 | colorscheme dracula 3 | 4 | 5 | " ------------------------------------------------- 6 | " LOAD CUSTOMIZE SETTINGS 7 | " ------------------------------------------------- 8 | if filereadable(expand($HOME . '/.vimrc.local')) 9 | source $HOME/.vimrc.local 10 | endif 11 | -------------------------------------------------------------------------------- /vimrc.local: -------------------------------------------------------------------------------- 1 | " =============================================================== 2 | " CUSTOMIZE SETTINGS 3 | " =============================================================== 4 | 5 | "set wrap " 自动折行 6 | 7 | " macOS: brew tap caskroom/fonts && brew cask install font-hack-nerd-font 8 | "set guifont=Knack\ Nerd\ Font:h12 9 | -------------------------------------------------------------------------------- /test/test.css: -------------------------------------------------------------------------------- 1 | div { 2 | color: white; 3 | margin: 0; 4 | padding: 0; 5 | line-height: 1.5; 6 | } 7 | 8 | div > li { 9 | color: green; 10 | list-style: none; 11 | } 12 | 13 | #id-element { 14 | background-color: #fc0; 15 | } 16 | 17 | .class-element { 18 | display: flex; 19 | background-color: rgb(196, 100, 6); 20 | } 21 | -------------------------------------------------------------------------------- /test/test.js: -------------------------------------------------------------------------------- 1 | export default { 2 | config: { 3 | 4 | }, 5 | // on page load 6 | onLoad (options) { 7 | let num = 7; 8 | let arr = ['string', num, 1979]; 9 | 10 | arr.forEach((item, index) => { 11 | console.log(`item: ${item}`) 12 | }) 13 | 14 | return (function () { 15 | return arr.length; 16 | })(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Page Title 4 | 5 | 6 | 7 |

Test Page

8 | 13 |
14 | copyright © 2017 phpz.org 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /test/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "number": 7, 3 | "string": "some text", 4 | "array": [ 5 | 1, 2, 3, 6 | "..." 7 | ], 8 | "colors": [ 9 | "black", 10 | "gray", 11 | "white", 12 | "red", 13 | "lightblue", 14 | "pink", 15 | "darkblue", 16 | "blue", 17 | "orange" 18 | ], 19 | "object": { 20 | "//commont": "I Love Google!", 21 | "name": "Seven" 22 | }, 23 | wrongKey: '¯\_(ツ)_/¯' 24 | } 25 | -------------------------------------------------------------------------------- /test/test.php: -------------------------------------------------------------------------------- 1 | 6 | * @Version: 2.0.1 7 | * 8 | * */ 9 | 10 | // config 11 | define('DB_HOST', 'YOUR DATABASE HOST'); // default: localhost 12 | define('DB_USER', 'YOUR DATABASE USER'); 13 | define('DB_PASS', 'PASSWORD'); 14 | define('DB_NAME', 'DATABASE NAME'); // default: test 15 | 16 | // project folder 17 | define('USER_CODE_PATH', dirname(__file__) . '/../'); 18 | 19 | include USER_CODE_PATH . '../src/SevenApplication.php'; 20 | 21 | // new controller 22 | $app = new SevenApplication(); 23 | 24 | // run 25 | $app->run(); 26 | 27 | // code demo 28 | class COMM 29 | { 30 | static public function gets($key = null, $default = null) 31 | { 32 | if($key == null) 33 | { 34 | return $_GET; 35 | } 36 | else 37 | { 38 | if(isset($_GET[$key])) 39 | return $_GET[$key]; 40 | else 41 | return $default; 42 | } 43 | } 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Seven Yu 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 | -------------------------------------------------------------------------------- /test/test.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # Above the run-comment and file encoding comment. 4 | 5 | # Comments. 6 | 7 | # TODO FIXME XXX 8 | 9 | # Keywords. 10 | 11 | with break continue del exec return pass print raise global assert lambda yield 12 | for while if elif else import from as try except finally and in is not or 13 | 14 | yield from 15 | 16 | def functionname 17 | class Classname 18 | def функция 19 | class Класс 20 | 21 | await 22 | async def Test 23 | async with 24 | async for 25 | 26 | # Builtin objects. 27 | 28 | True False Ellipsis None NotImplemented 29 | 30 | # Builtin function and types. 31 | 32 | __import__ abs all any apply basestring bool buffer callable chr classmethod 33 | cmp coerce compile complex delattr dict dir divmod enumerate eval execfile file 34 | filter float frozenset getattr globals hasattr hash help hex id input int 35 | intern isinstance issubclass iter len list locals long map max min object oct 36 | open ord pow property range raw_input reduce reload repr reversed round set 37 | setattr slice sorted staticmethod str sum super tuple type unichr unicode vars 38 | xrange zip 39 | 40 | # Builtin exceptions and warnings. 41 | 42 | BaseException Exception StandardError ArithmeticError LookupError 43 | EnvironmentError 44 | 45 | AssertionError AttributeError EOFError FloatingPointError GeneratorExit IOError 46 | ImportError IndexError KeyError KeyboardInterrupt MemoryError NameError 47 | NotImplementedError OSError OverflowError ReferenceError RuntimeError 48 | StopIteration SyntaxError IndentationError TabError SystemError SystemExit 49 | TypeError UnboundLocalError UnicodeError UnicodeEncodeError UnicodeDecodeError 50 | UnicodeTranslateError ValueError WindowsError ZeroDivisionError 51 | 52 | Warning UserWarning DeprecationWarning PendingDepricationWarning SyntaxWarning 53 | RuntimeWarning FutureWarning ImportWarning UnicodeWarning 54 | 55 | # Decorators. 56 | 57 | @ decoratorname 58 | @ object.__init__(arg1, arg2) 59 | @ декоратор 60 | @ декоратор.décorateur 61 | 62 | # Numbers 63 | 64 | 0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77 1023434 0x0 65 | 66 | # Erroneous numbers 67 | 68 | 077 100L 0xfffffffL 0L 08 0xk 0x 0b102 0o78 0o123LaB 69 | 70 | # Strings 71 | 72 | " test " ' test ' 73 | """ 74 | test 75 | """ 76 | ''' 77 | test 78 | ''' 79 | 80 | " \a\b\c\"\'\n\r \x34\077 \08 \xag" 81 | r" \" \' " 82 | 83 | "testтест" 84 | 85 | b"test" 86 | 87 | b"test\r\n\xffff" 88 | 89 | b"тестtest" 90 | 91 | br"test" 92 | 93 | br"\a\b\n\r" 94 | 95 | # Formattings 96 | 97 | " %f " 98 | b" %f " 99 | 100 | "{0.name!r:b} {0[n]} {name!s: } {{test}} {{}} {} {.__len__:s}" 101 | b"{0.name!r:b} {0[n]} {name!s: } {{test}} {{}} {} {.__len__:s}" 102 | 103 | "${test} ${test ${test}aname $$$ $test+nope" 104 | b"${test} ${test ${test}aname $$$ $test+nope" 105 | 106 | # Doctests. 107 | 108 | """ 109 | Test: 110 | >>> a = 5 111 | >>> a 112 | 5 113 | 114 | Test 115 | """ 116 | 117 | ''' 118 | Test: 119 | >>> a = 5 120 | >>> a 121 | 5 122 | 123 | Test 124 | ''' 125 | 126 | # Erroneous symbols or bad variable names. 127 | 128 | $ ? 6xav 129 | 130 | && || === 131 | 132 | # Indentation errors. 133 | 134 | break 135 | 136 | # Trailing space errors. 137 | 138 | 139 | break 140 | """ 141 | 142 | test 143 | """ 144 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # print colored text 4 | print_style() { 5 | 6 | if [ "$2" == "info" ]; then 7 | COLOR="96m" 8 | elif [ "$2" == "succ" ]; then 9 | COLOR="92m" 10 | elif [ "$2" == "warn" ]; then 11 | COLOR="95m" 12 | elif [ "$2" == "error" ]; then 13 | COLOR="91m" 14 | else 15 | COLOR="0m" #default color 16 | fi 17 | 18 | STARTCOLOR="\e[$COLOR" 19 | ENDCOLOR="\e[0m" 20 | 21 | printf "$STARTCOLOR%b$ENDCOLOR" "$1" 22 | } 23 | 24 | info() { 25 | print_style "$1" "info" 26 | } 27 | 28 | succ() { 29 | print_style "$1" "succ" 30 | } 31 | 32 | warn() { 33 | print_style "$1" "warn" 34 | } 35 | 36 | error() { 37 | print_style "$1" "error" 38 | } 39 | 40 | normal() { 41 | print_style "$1" "-" 42 | } 43 | 44 | die() { 45 | error "$1" 46 | exit 1 47 | } 48 | 49 | logo() { 50 | warn '======================================\n' 51 | warn ' _____ _ _ _ \n' 52 | warn ' |___ | |_| |__ __ _(_)_ __ ___ \n' 53 | warn ' / /| __| `_ \ \ \ / / | `_ ` _ \ \n' 54 | warn ' / / | |_| | | | \ V /| | | | | | |\n' 55 | warn ' /_/ \__|_| |_| \_/ |_|_| |_| |_|\n' 56 | warn '======================================\n' 57 | } 58 | 59 | help() { 60 | logo 61 | echo 62 | echo 'Usage: install.sh ' 63 | echo 64 | echo 'Options:' 65 | echo ' -i -- install' 66 | echo ' -u -- update' 67 | echo ' -b -- remove config files and backup' 68 | echo ' -c -- check dependencies' 69 | echo ' -l -- show the list of supported languages' 70 | echo ' -h -- show help' 71 | echo 72 | exit 0 73 | } 74 | 75 | language_support_info() { 76 | info '-------------------------------------------------------------------\n' 77 | info 'Edit ' 78 | succ '~/.vimrc.language' 79 | info ' to enable/disable language support you need.\n' 80 | info 'Supported languages:\n' 81 | normal ' - markdown\n' 82 | normal ' - html\n' 83 | normal ' - css\n' 84 | normal ' - js\n' 85 | normal ' - json\n' 86 | normal ' - php\n' 87 | normal ' - python\n' 88 | #normal ' - c/c++\n' 89 | normal ' - go\n' 90 | info '-------------------------------------------------------------------\n' 91 | } 92 | 93 | # check dependent 94 | check() { 95 | E=0 96 | info '>> Checking Git ...' 97 | if which git >/dev/null; then 98 | succ '\t OK!\n' 99 | else 100 | E=1 101 | error '\t NO!\n' 102 | how_to git 103 | fi 104 | 105 | info '>> Checking Python ...' 106 | if which python3 >/dev/null; then 107 | succ '\t OK!\n' 108 | else 109 | E=1 110 | error '\t NO!\n' 111 | how_to python 112 | fi 113 | 114 | if [ $E -ne 0 ]; then 115 | warn '>>> The 7th-Vim ' 116 | die 'install failed!\n' 117 | fi 118 | } 119 | 120 | how_to() { 121 | if [ $1 == git ]; then 122 | warn 'How to install Git:\n' 123 | info '- for macOS, refer to the following url:\n' 124 | normal 'https://git-scm.com/book/en/v2/Getting-Started-Installing-Git\n' 125 | info '- for Ubuntu\n' 126 | info '$ ' 127 | normal 'sudo apt-get install -y git-all\n' 128 | info '- for CentOS\n' 129 | info '$ ' 130 | normal 'sudo yum install -y git-all\n' 131 | elif [ $1 == python ]; then 132 | warn 'How to install Python:\n' 133 | info '- for macOS\n' 134 | info '$ ' 135 | normal 'brew install python\n' 136 | info '- for Ubuntu\n' 137 | info '$ ' 138 | normal 'sudo apt-get install -y python-dev python3-dev\n' 139 | info '- for CentOS\n' 140 | info '$ ' 141 | normal 'sudo yum install -y python-devel python3-devel\n' 142 | fi 143 | } 144 | 145 | create_undo_dir() { 146 | mkdir -p ~/.vim/.undodir 147 | } 148 | 149 | install_backup() { 150 | # remove and backup old files 151 | info '>>> Remove and backup old files ...\n' 152 | mkdir -p ~/7th-vim-bak 153 | mv ~/.vimrc ~/7th-vim-bak 154 | mv ~/.vimrc.local ~/7th-vim-bak 155 | mv ~/.vimrc.plugins ~/7th-vim-bak 156 | mv ~/.vimrc.language ~/7th-vim-bak 157 | } 158 | 159 | update_backup() { 160 | # remove and backup old files 161 | info '>>> Remove and backup old files ...\n' 162 | mkdir -p ~/7th-vim-bak 163 | mv ~/.vimrc ~/7th-vim-bak 164 | } 165 | 166 | load_vimrc() { 167 | # download .vimrc file 168 | info '>>> Download .vimrc file ...\n' 169 | curl -fLo ~/.vimrc \ 170 | https://raw.githubusercontent.com/dofy/7th-vim/master/vimrc 171 | 172 | # download .vimrc.language file 173 | if [ ! -f ~/.vimrc.language ]; then 174 | info '>>> Download .vimrc.language file ...\n' 175 | curl -fLo ~/.vimrc.language \ 176 | https://raw.githubusercontent.com/dofy/7th-vim/master/vimrc.language 177 | fi 178 | 179 | # download .vimrc.plugins file 180 | if [ ! -f ~/.vimrc.plugins ]; then 181 | info '>>> Download .vimrc.plugins file ...\n' 182 | curl -fLo ~/.vimrc.plugins \ 183 | https://raw.githubusercontent.com/dofy/7th-vim/master/vimrc.plugins 184 | fi 185 | 186 | # download .vimrc.local file 187 | if [ ! -f ~/.vimrc.local ]; then 188 | info '>>> Download .vimrc.local file ...\n' 189 | curl -fLo ~/.vimrc.local \ 190 | https://raw.githubusercontent.com/dofy/7th-vim/master/vimrc.local 191 | fi 192 | } 193 | 194 | append_settings() { 195 | # append settings 196 | curl -f \ 197 | https://raw.githubusercontent.com/dofy/7th-vim/master/vimrc.append \ 198 | >>~/.vimrc 199 | } 200 | 201 | install_plugin() { 202 | # download vim-plug 203 | info '>>> Download vim-plug ...\n' 204 | curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ 205 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 206 | 207 | # install plugins 208 | info '>>> Install plugins ...\n' 209 | vim +PlugClean! +PlugUpdate +qal 210 | } 211 | 212 | update_plugin() { 213 | # update plugins 214 | info '>>> Update plugins ...\n' 215 | vim +PlugClean! +PlugUpdate +qal 216 | } 217 | 218 | install_ycm() { 219 | info '>>> Install YouCompleteMe ...\n' 220 | ~/.vim/bundle/YouCompleteMe/install.py --all 221 | } 222 | 223 | run_install() { 224 | logo 225 | succ '>>> Thanks for Installing The 7th-Vim\n' 226 | check 227 | create_undo_dir 228 | install_backup 229 | load_vimrc 230 | install_plugin 231 | install_ycm 232 | append_settings 233 | language_support_info 234 | succ '>>> DONE!\n\n' 235 | } 236 | 237 | run_update() { 238 | logo 239 | succ '>>> Thanks for Updating The 7th-Vim\n' 240 | create_undo_dir 241 | update_backup 242 | load_vimrc 243 | append_settings 244 | update_plugin 245 | language_support_info 246 | succ '>>> DONE!\n\n' 247 | } 248 | 249 | run_backup() { 250 | install_backup 251 | succ '>>> DONE!\n\n' 252 | } 253 | 254 | if [ $# -ne 1 ]; then 255 | help 256 | fi 257 | 258 | while getopts ":iubcl" opts; do 259 | case $opts in 260 | i) 261 | run_install 262 | ;; 263 | u) 264 | run_update 265 | ;; 266 | b) 267 | logo 268 | run_backup 269 | ;; 270 | c) 271 | logo 272 | check 273 | ;; 274 | l) 275 | logo 276 | language_support_info 277 | ;; 278 | :) 279 | help 280 | ;; 281 | ?) 282 | help 283 | ;; 284 | esac 285 | done 286 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The 7th Vim 2 | 3 | ``` 4 | _____ _ _ _ 5 | |___ | |_| |__ __ _(_)_ __ ___ 6 | / /| __| '_ \ \ \ / / | '_ ` _ \ 7 | / / | |_| | | | \ V /| | | | | | | 8 | /_/ \__|_| |_| \_/ |_|_| |_| |_| 9 | ``` 10 | 11 | 安装简单,轻量、易用、高可配置性。 12 | 13 | > 现在我已经转到 [neovim][neovim] 阵营,对应的配置请参考 [dofy/nvim][dofy/nvim] 项目。 14 | 15 | ## Index 16 | 17 | - [The 7th Vim](#the-7th-vim) 18 | - [Index](#index) 19 | - [Screenshot](#screenshot) 20 | - [Install](#install) 21 | - [Check dependent](#check-dependent) 22 | - [Show language supported list](#show-language-supported-list) 23 | - [Remove current config files and backup](#remove-current-config-files-and-backup) 24 | - [Help](#help) 25 | - [Update](#update) 26 | - [Customize](#customize) 27 | - [Plugins](#plugins) 28 | - [Key Mapping](#key-mapping) 29 | - [Q\&A](#qa) 30 | 31 | ## Screenshot 32 | 33 | ![7thvim][screen-shot-1] 34 | 35 | ![7thvim][screen-shot-2] 36 | 37 | ![7thvim][screen-shot-3] 38 | 39 | ![7thvim][screen-shot-4] 40 | 41 | ![7thvim][screen-shot-5] 42 | 43 | ## Install 44 | 45 | ```bash 46 | # curl 47 | bash <(curl -L https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh) -i 48 | ``` 49 | 50 | or 51 | 52 | ```bash 53 | # wget 54 | bash <(wget --no-check-certificate https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh -O -) -i 55 | ``` 56 | 57 | ### Check dependent 58 | 59 | ```bash 60 | # curl 61 | bash <(curl -L https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh) -c 62 | ``` 63 | 64 | or 65 | 66 | ```bash 67 | # wget 68 | bash <(wget --no-check-certificate https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh -O -) -c 69 | ``` 70 | 71 | ### Show language supported list 72 | 73 | ```bash 74 | # curl 75 | bash <(curl -L https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh) -l 76 | ``` 77 | 78 | or 79 | 80 | ```bash 81 | # wget 82 | bash <(wget --no-check-certificate https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh -O -) -l 83 | ``` 84 | 85 | ### Remove current config files and backup 86 | 87 | ```bash 88 | bash <(curl -L https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh) -b 89 | ``` 90 | 91 | or 92 | 93 | ```bash 94 | # wget 95 | bash <(wget --no-check-certificate https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh -O -) -b 96 | ``` 97 | 98 | ### Help 99 | 100 | ```bash 101 | # curl 102 | bash <(curl -L https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh) -h 103 | ``` 104 | 105 | or 106 | 107 | ```bash 108 | # wget 109 | bash <(wget --no-check-certificate https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh -O -) -h 110 | ``` 111 | 112 | ## Update 113 | 114 | ```bash 115 | # curl 116 | bash <(curl -L https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh) -u 117 | ``` 118 | 119 | or 120 | 121 | ```bash 122 | # wget 123 | bash <(wget --no-check-certificate https://raw.githubusercontent.com/dofy/7th-vim/master/install.sh -O -) -u 124 | ``` 125 | 126 | ## Customize 127 | 128 | ```bash 129 | # Edit the following file to enable/disable language support you need 130 | vim ~/.vimrc.language 131 | 132 | # Edit your customize config file 133 | vim ~/.vimrc.local 134 | 135 | # Reload .vimrc (IN VIM!!!) 136 | :source ~/.vimrc 137 | ``` 138 | 139 | ## Plugins 140 | 141 | | 插件 | 说明 | 142 | | :----------------------------------------------------- | -------------------------- | 143 | | [scrooloose / **nerdtree**][plug1] | 以树形目录窗格方式浏览文件 | 144 | | [Xuyuanp / **nerdtree-git-plugin**][plug2] | NerdTree 显示 git 状态 | 145 | | [tiagofumo / **vim-nerdtree-syntax-highlight**][plug3] | NerdTree 文件类型高亮 | 146 | | [vim-airline / **vim-airline**][plug4] | 美化 Vim 状态栏 | 147 | | [vim-airline / **vim-airline-themes**][plug5] | Airline Themes | 148 | | [junegunn / **vim-easy-align**][plug6] | 对齐插件,强迫症福音 | 149 | | [iamcco / **markdown-preview.nvim**][plug7] | Markdown 预览 | 150 | | [junegunn / **vim-slash**][plug8] | 优化搜索,移动清除搜索高亮 | 151 | | [gorodinskiy / **vim-coloresque**][plug9] | 颜色值预览 | 152 | | [jiangmiao / **auto-pairs**][plug10] | 符号自动补全 | 153 | | [tpope / **vim-surround**][plug11] | 自动增加、替换配对符 | 154 | | [junegunn / **fzf.vim**][plug12] | 强大、高效的搜索引擎 | 155 | | [chxuan / **change-colorscheme**][plug13] | 配色方案切换 | 156 | | [docunext / **closetag.vim**][plug14] | 自动关闭 HTML 标签 | 157 | | [neoclide / **coc.nvim**][plug15] | 代码自动完成 | 158 | | [ryanoasis / **vim-devicons**][plug16] | Vim Dev Icons | 159 | | [tpope / **vim-repeat**][plug17] | 增强 . 命令 | 160 | | [mhinz / **vim-startify**][plug18] | 启动页 | 161 | | [roman / **golden-ratio**][plug19] | 自动控制窗口大小 | 162 | | [tomtom / **tcomment_vim**][plug20] | 添加/清除 注释 | 163 | | [dracula / **vim**][color] | dracule 配色 | 164 | 165 | > **补充说明:** 插件相关功能及用法请参考对应网站 166 | 167 | ## Key Mapping 168 | 169 | | 快捷键/命令 | 说明 | 170 | | :-----------------------: | ------------------------------ | 171 | | `,` | **Leader Key** | 172 | | ` A` | INSERT 模式下移动光标到行首 | 173 | | ` E` | INSERT 模式下移动光标到行尾 | 174 | | ` B` | INSERT 模式下光标左移一位 | 175 | | ` F` | INSERT 模式下光标右移一位 | 176 | | ` J` | 跳转到下面的窗口 | 177 | | ` K` | 跳转到上面的窗口 | 178 | | ` H` | 跳转到左侧的窗口 | 179 | | ` L` | 跳转到右侧的窗口 | 180 | | ` N` | 打开 Buffer 列表中的下一个文件 | 181 | | ` P` | 打开 Buffer 列表中的上一个文件 | 182 | | ` F` / `ff` | 在当前工作目录中搜索文件 | 183 | | `fb` | 在 Buffer 中搜索文件 | 184 | | `fh` | 在历史文件中搜索 | 185 | | `fc` | 搜索可用配色方案 | 186 | | `fl` | 在 Buffer 文件中进行文本搜索 | 187 | | `fm` | 搜索 Vim 中可用的命令 | 188 | | `-H` | 跳转到前一个 Tab | 189 | | `-L` | 跳转到后一个 Tab | 190 | | `t` | 开启新 Tab | 191 | | `w` | 关闭当前 Tab | 192 | | ` E` / `e` | 开启 Nerdtree | 193 | | `` | 开启 Markdown 预览 | 194 | | `` | 关闭 Markdown 预览 | 195 | | `` | 上一个配色方案 | 196 | | `` | 下一个配色方案 | 197 | | `gcc` | 注释/取消注释 当前行 | 198 | | `g>` | 注释选中文本(VISUAL 模式) | 199 | | `:W` | 用 `sudo` 命令保存文件 | 200 | 201 | ## Q&A 202 | 203 | - 字体的问题: 204 | - 参考 [issues/2][issues2] 和 [issues/3][issues3] 205 | 206 | [screen-shot-1]: https://user-images.githubusercontent.com/344197/34345993-42b0397c-ea2e-11e7-9003-e8c7f6453cba.png 207 | [screen-shot-2]: https://user-images.githubusercontent.com/344197/34291098-a32023d6-e735-11e7-9fd5-285b4939c1c8.png 208 | [screen-shot-3]: https://user-images.githubusercontent.com/344197/34345994-444dac1a-ea2e-11e7-98a1-3a21c4d000a9.png 209 | [screen-shot-4]: https://user-images.githubusercontent.com/344197/34291099-a37b0102-e735-11e7-9ee4-e03b7f180af0.png 210 | [screen-shot-5]: https://user-images.githubusercontent.com/344197/34291095-a2399ca4-e735-11e7-9883-6b1a27364fe4.png 211 | [plug1]: https://github.com/scrooloose/nerdtree 212 | [plug2]: https://github.com/Xuyuanp/nerdtree-git-plugin 213 | [plug3]: https://github.com/tiagofumo/vim-nerdtree-syntax-highlight 214 | [plug4]: https://github.com/vim-airline/vim-airline 215 | [plug5]: https://github.com/vim-airline/vim-airline-themes 216 | [plug6]: https://github.com/junegunn/vim-easy-align 217 | [plug7]: https://github.com/iamcco/markdown-preview.nvim 218 | [plug8]: https://github.com/junegunn/vim-slash 219 | [plug9]: https://github.com/gorodinskiy/vim-coloresque 220 | [plug10]: https://github.com/jiangmiao/auto-pairs 221 | [plug11]: https://github.com/tpope/vim-surround 222 | [plug12]: https://github.com/junegunn/fzf.vim 223 | [plug13]: https://github.com/chxuan/change-colorscheme 224 | [plug14]: https://github.com/docunext/closetag.vim 225 | [plug15]: https://github.com/neoclide/coc.nvim 226 | [plug16]: https://github.com/ryanoasis/vim-devicons 227 | [plug17]: https://github.com/tpope/vim-repeat 228 | [plug18]: https://github.com/mhinz/vim-startify 229 | [plug19]: https://github.com/roman/golden-ratio 230 | [plug20]: https://github.com/tomtom/tcomment_vim 231 | [color]: https://github.com/dracula/vim 232 | [issues2]: https://github.com/dofy/7th-vim/issues/2 233 | [issues3]: https://github.com/dofy/7th-vim/issues/3 234 | [neovim]: https://neovim.io/ 235 | [dofy/nvim]: https://github.com/dofy/nvim 236 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | " =============================================================== 2 | " _____ _ _ _ 3 | " |___ | |_| |__ __ _(_)_ __ ___ 4 | " / /| __| '_ \ \ \ / / | '_ ` _ \ 5 | " / / | |_| | | | \ V /| | | | | | | 6 | " /_/ \__|_| |_| \_/ |_|_| |_| |_| 7 | " 8 | " =============================================================== 9 | " 10 | " Author: Seven Yu 11 | " Source: https://github.com/dofy/7th-vim 12 | " Version: 2.1.0 13 | " Created: 2017-11-24 14 | " 15 | " Sections: 16 | " - Common Settings 17 | " - Extend Settings 18 | " - Language Supports 19 | " - Plugins 20 | " - Key Mapping 21 | " - Plugin Settings 22 | " - Load Customize Settings 23 | " 24 | " =============================================================== 25 | 26 | 27 | " ------------------------------------------------- 28 | " COMMON SETTINGS 29 | " ------------------------------------------------- 30 | set nocompatible 31 | filetype plugin indent on " 开启文件类型检测 32 | syntax on " 开启语法高亮 33 | 34 | set nofoldenable " 默认关闭代码折叠 35 | 36 | " 可以修改 .vimrc.local 开启代码折叠 37 | " set foldenable 38 | " set foldmethod=syntax 39 | 40 | " set shell=/bin/bash 41 | 42 | set backspace=indent,eol,start " 智能回删 43 | set whichwrap+=h,l,<,>,[,] " 光标循环 44 | set virtualedit=block,onemore " 允许光标出现在最后一个字符的后面 45 | 46 | set number " 显示行号 nu 47 | set relativenumber " 显示相对行号 rnu 48 | set ruler " 显示标尺信息 49 | 50 | set expandtab " Tab 替换为空格 et 51 | set smartindent " 智能缩进 si 52 | 53 | set softtabstop=2 " Tab 缩进单位 sts 54 | set shiftwidth=2 " 自动缩进单位 sw 55 | set encoding=utf-8 " UTF-8 编码 56 | set t_Co=256 " 开启 256 色(若终端支持) 57 | set background=dark 58 | set nowrap " 禁止折行 59 | 60 | set ignorecase " 搜索忽略大小写 ic 61 | set incsearch " 搜索时实时高亮 is 62 | set hlsearch " 高亮所有搜索结果 hls 63 | 64 | set cursorcolumn " 高亮当前列 cuc 65 | set cursorline " 高亮当前行 cul 66 | 67 | set scrolloff=5 " 屏幕顶/底部保持 5 行文本 68 | set laststatus=2 " 显示状态栏 69 | set noshowmode " 不显示当前状态 70 | set showcmd " 显示输入的命令 71 | set wildmenu " Vim 命令行提示 72 | set nobackup " 不生成临时文件 73 | set noswapfile " 不生成 swap 文件 74 | set autoread " 自动加载外部修改 75 | set autowrite " 自动保存 76 | set confirm " 弹出文件未保存确认 77 | 78 | set history=1024 79 | set undofile 80 | set undodir=~/.vim/.undodir 81 | 82 | set timeoutlen=700 " Time to wait for a command 83 | let mapleader=',' " Change the mapleader 84 | 85 | 86 | " ------------------------------------------------- 87 | " EXTEND SETTINGS 88 | " ------------------------------------------------- 89 | " Close relative number in INSERT mode 90 | augroup relative_numbser 91 | autocmd! 92 | autocmd InsertEnter * :set norelativenumber 93 | autocmd InsertLeave * :set relativenumber 94 | augroup end 95 | 96 | 97 | " ------------------------------------------------- 98 | " LANGUAGE SUPPORTS 99 | " ------------------------------------------------- 100 | if filereadable(expand($HOME . '/.vimrc.language')) 101 | source $HOME/.vimrc.language 102 | endif 103 | 104 | 105 | " ------------------------------------------------- 106 | " PLUGINS 107 | " ------------------------------------------------- 108 | call plug#begin('~/.vim/bundle') 109 | 110 | Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } 111 | Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' } 112 | Plug 'tiagofumo/vim-nerdtree-syntax-highlight' 113 | Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes' 114 | Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } 115 | Plug 'junegunn/fzf.vim' 116 | Plug 'mhinz/vim-startify' " 启动页 117 | Plug 'roman/golden-ratio' " 自动控制窗口大小 118 | Plug 'junegunn/vim-easy-align' " 对齐插件,强迫症福音 119 | Plug 'junegunn/vim-slash' " 优化搜索,移动清除搜索高亮 120 | Plug 'gorodinskiy/vim-coloresque' " 颜色预览 121 | Plug 'jiangmiao/auto-pairs' " 符号自动补全 122 | Plug 'tpope/vim-surround' " 自动增加、替换配对符 123 | Plug 'chxuan/change-colorscheme' " 配色切换 124 | Plug 'tomtom/tcomment_vim' " 添加注释 125 | Plug 'ryanoasis/vim-devicons' " Vim Dev Icons 126 | Plug 'tpope/vim-repeat' " 增强 . 命令 127 | Plug 'dracula/vim' " dracula 配色 128 | 129 | " Plugins for language 130 | " markdown 131 | if count(g:language_group, 'markdown') 132 | Plug 'plasticboy/vim-markdown' " Markdown 代码高亮,自动格式化 133 | Plug 'iamcco/markdown-preview.nvim', { 'do': ':call mkdp#util#install()', 'for': 'markdown' } " Markdown 预览 134 | endif 135 | 136 | " html 137 | if count(g:language_group, 'html') 138 | Plug 'docunext/closetag.vim' " 自动关闭 HTML 标签 139 | endif 140 | 141 | " css 142 | if count(g:language_group, 'css') 143 | Plug 'hail2u/vim-css3-syntax', {'for': 'css'} 144 | endif 145 | 146 | " js 147 | if count(g:language_group, 'js') 148 | Plug 'pangloss/vim-javascript' 149 | Plug 'neoclide/coc.nvim', { 'branch': 'release' } 150 | endif 151 | 152 | " json 153 | if count(g:language_group, 'json') 154 | Plug 'elzr/vim-json' " json 语法检查 155 | endif 156 | 157 | " php 158 | if count(g:language_group, 'php') 159 | Plug 'mageekguy/php.vim', {'for': 'php'} 160 | Plug 'shawncplus/phpcomplete.vim', {'for': 'php'} 161 | Plug 'vim-scripts/phpfolding.vim', {'for': 'php'} 162 | Plug '2072/PHP-Indenting-for-VIm', {'for': 'php'} 163 | endif 164 | 165 | " python 166 | if count(g:language_group, 'python') 167 | Plug 'hdima/python-syntax' 168 | endif 169 | 170 | " c 171 | if count(g:language_group, 'c') 172 | endif 173 | 174 | " go 175 | if count(g:language_group, 'go') 176 | Plug 'fatih/vim-go', { 'for': 'go' } " Golang 177 | endif 178 | 179 | " ------------------------------------------------- 180 | " LOAD CUSTOMIZE PLUGINS 181 | " ------------------------------------------------- 182 | if filereadable(expand($HOME . '/.vimrc.plugins')) 183 | source $HOME/.vimrc.plugins 184 | endif 185 | 186 | call plug#end() 187 | 188 | 189 | " ------------------------------------------------- 190 | " KEY MAPPING 191 | " ------------------------------------------------- 192 | " Shortcut for Moving in INSERT mode 193 | imap 194 | imap 195 | imap 196 | imap 197 | 198 | " Navigation Between Windows 199 | nnoremap j 200 | nnoremap k 201 | nnoremap h 202 | nnoremap l 203 | 204 | " Buffer Jump 205 | nnoremap :bn 206 | nnoremap :bp 207 | 208 | " Prev Tab 209 | nnoremap gT 210 | " Next Tab 211 | nnoremap gt 212 | 213 | " New Tab 214 | nnoremap t :tabnew 215 | " Close Tab 216 | nnoremap w :tabclose 217 | 218 | " Change Color Scheme 219 | map :NextColorScheme 220 | imap :NextColorScheme 221 | map :PreviousColorScheme 222 | imap :PreviousColorScheme 223 | 224 | " Use tab for trigger completion with characters ahead and navigate 225 | " NOTE: There's always complete item selected by default, you may want to enable 226 | " no select by `"suggest.noselect": true` in your configuration file 227 | " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by 228 | " other plugin before putting this into your config 229 | inoremap 230 | \ coc#pum#visible() ? coc#pum#next(1) : 231 | \ CheckBackspace() ? "\" : 232 | \ coc#refresh() 233 | inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" 234 | 235 | " Make to accept selected completion item or notify coc.nvim to format 236 | " u breaks current undo, please make your own choice 237 | inoremap coc#pum#visible() ? coc#pum#confirm() 238 | \: "\u\\=coc#on_enter()\" 239 | 240 | " :W to save file by sudo 241 | command W w !sudo tee % > /dev/null 242 | 243 | " Markdown Preview 244 | if count(g:language_group, 'markdown') 245 | nmap MarkdownPreview 246 | imap MarkdownPreview 247 | nmap MarkdownPreviewStop 248 | imap MarkdownPreviewStop 249 | endif 250 | 251 | " FZF 252 | nnoremap :Files 253 | nnoremap ff :Files 254 | nnoremap fb :Buffers 255 | nnoremap fc :Colors 256 | nnoremap fh :History 257 | nnoremap fl :Lines 258 | nnoremap fm :Commands 259 | 260 | " NERDTree 261 | nnoremap :NERDTreeToggle 262 | nnoremap e :NERDTreeToggle 263 | 264 | " EasyAlign 265 | xmap ga (EasyAlign) 266 | nmap ga (EasyAlign) 267 | 268 | 269 | " ------------------------------------------------- 270 | " PLUGIN SETTINGS 271 | " ------------------------------------------------- 272 | " coc.nvim settings 273 | let g:coc_global_extensions = [ 274 | \ 'coc-json', 275 | \ 'coc-html', 276 | \ 'coc-css', 277 | \ 'coc-markdownlint', 278 | \ 'coc-prettier', 279 | \ 'coc-pairs', 280 | \ 'coc-snippets', 281 | \ 'coc-php-cs-fixer', 282 | \ 'coc-pyright', 283 | \ 'coc-go' 284 | \ ] 285 | 286 | " Language plugin settings 287 | if count(g:language_group, 'markdown') 288 | let g:vim_markdown_new_list_item_indent = 2 289 | endif 290 | 291 | if count(g:language_group, 'css') 292 | augroup VimCSS3Syntax 293 | autocmd! 294 | autocmd FileType css setlocal iskeyword+=- 295 | augroup END 296 | endif 297 | 298 | if count(g:language_group, 'js') 299 | let g:javascript_plugin_jsdoc = 1 300 | endif 301 | 302 | " Startify Header 303 | let g:startify_custom_header=[ 304 | \' _____ _ _ _ ', 305 | \' |___ | |_| |__ __ _(_)_ __ ___ ', 306 | \' / /| __| `_ \ \ \ / / | `_ ` _ \ ', 307 | \' / / | |_| | | | \ V /| | | | | | |', 308 | \' /_/ \__|_| |_| \_/ |_|_| |_| |_|', 309 | \'', 310 | \' The answer exists only in the Tao. '] 311 | 312 | " FZF 313 | let g:fzf_layout = { 'down': '~35%' } 314 | 315 | " EasyAlign 316 | let g:easy_align_delimiters = { 317 | \ '>': { 'pattern': '>>\|=>\|>' }, 318 | \ '/': { 319 | \ 'pattern': '//\+\|/\*\|\*/', 320 | \ 'delimiter_align': 'l', 321 | \ 'ignore_groups': ['!Comment'] }, 322 | \ ']': { 323 | \ 'pattern': '[[\]]', 324 | \ 'left_margin': 0, 325 | \ 'right_margin': 0, 326 | \ 'stick_to_left': 0 327 | \ }, 328 | \ ')': { 329 | \ 'pattern': '[()]', 330 | \ 'left_margin': 0, 331 | \ 'right_margin': 0, 332 | \ 'stick_to_left': 0 333 | \ }, 334 | \ 'd': { 335 | \ 'pattern': ' \(\S\+\s*[;=]\)\@=', 336 | \ 'left_margin': 0, 337 | \ 'right_margin': 0 338 | \ } 339 | \ } 340 | 341 | " NERDTree 342 | let NERDTreeChDirMode=2 343 | let NERDTreeShowHidden=1 344 | let NERDTreeQuitOnOpen=1 345 | let NERDTreeShowLineNumbers=1 346 | let g:NERDTreeWinSize=35 347 | let g:NERDTreeFileExtensionHighlightFullName = 1 348 | let g:NERDTreeExactMatchHighlightFullName = 1 349 | let g:NERDTreePatternMatchHighlightFullName = 1 350 | let g:NERDTreeHighlightFolders = 1 " enables folder icon highlighting using exact match 351 | let g:NERDTreeHighlightFoldersFullName = 1 " highlights the folder name 352 | 353 | " airline 354 | let g:airline#extensions#tabline#enabled=1 355 | let g:airline#extensions#tabline#left_sep = '' 356 | let g:airline#extensions#tabline#left_alt_sep = '' 357 | let g:airline_left_sep = '' 358 | let g:airline_left_alt_sep = '' 359 | let g:airline_right_sep = '' 360 | let g:airline_right_alt_sep = '' 361 | 362 | --------------------------------------------------------------------------------