├── .travis.yml ├── CODIGO_DE_CONDUTA.md ├── CONTRIBUINDO.md ├── LICENSE.txt ├── PLUGINS.md ├── README.md ├── eng-README.md └── static ├── images ├── badge-awesome.svg ├── content-adm-3a-layout.jpg ├── content-block_insert.gif ├── content-homerow.png └── logo-vim-galore.png ├── minimal-vimrc.vim └── plugins.md /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | os: linux 3 | 4 | language: go 5 | go: 1.8 6 | 7 | install: go get github.com/mhinz/gomali 8 | script: gomali *.md 9 | -------------------------------------------------------------------------------- /CODIGO_DE_CONDUTA.md: -------------------------------------------------------------------------------- 1 | # Código de Conduta para Colaboradores 2 | 3 | ## Nossa promessa 4 | 5 | Com o interesse de fomentar uma comunidade aberta e acolhedora, 6 | nós, como colaboradores e administradores deste projeto, comprometemo-nos 7 | a fazer a participação deste projeto uma experiência livre de assédio 8 | para todos, independentemente da aparência pessoal, deficiência, 9 | etnia, gênero, idade, identidade ou expressão de gênero, identidade 10 | ou orientação sexual, nacionalidade, nível de experiência, porte físico, 11 | raça ou religião. 12 | 13 | ## Nossos padrões 14 | 15 | Exemplos de comportamentos que contribuem a criar um ambiente positivo incluem: 16 | 17 | * Usar linguagem acolhedora e inclusiva 18 | * Respeitar pontos de vista e experiências diferentes 19 | * Aceitar crítica construtiva com graça 20 | * Focar no que é melhor para a comunidade 21 | * Mostrar empatia com outros membros da comunidade 22 | 23 | Exemplos de comportamentos inaceitáveis por parte dos participantes incluem: 24 | 25 | * Uso de linguagem ou imagens sexuais e atenção ou avanço sexual indesejada 26 | * Comentários insultuosos e/ou depreciativos e ataques pessoais ou políticos 27 | * (*Trolling*) 28 | * Assédio público ou privado 29 | * Publicar informação pessoal de outros sem permissão explícita, como, por 30 | * exemplo, um endereço eletrônico ou residencial 31 | * Qualquer outra forma de conduta que pode ser razoavelmente considerada 32 | * inapropriada num ambiente profissional 33 | 34 | ## Nossas responsibilidades 35 | 36 | Os administradores do projeto são responsáveis por esclarecer os padrões de 37 | comportamento e deverão tomar ação corretiva apropriada e justa em resposta 38 | a qualquer instância de comportamento inaceitável. 39 | 40 | Os administradores do projeto têm o direito e a responsabilidade de 41 | remover, editar ou rejeitar comentários, commits, código, edições 42 | na wiki, erros ou outras formas de contribuição que não estejam de 43 | acordo com este Código de Conduta, bem como banir temporariamente ou 44 | permanentemente qualquer colaborador por qualquer outro comportamento 45 | que se considere impróprio, perigoso, ofensivo ou problemático. 46 | 47 | ## Escopo 48 | 49 | Este Código de Conduta aplica-se dentro dos espaços do projeto ou 50 | qualquer espaço público onde alguém represente o mesmo ou a sua 51 | comunidade. Exemplos de representação do projeto ou comunidade incluem 52 | usar um endereço de email oficial do projeto, postar por uma conta de 53 | mídia social oficial, ou agir como um representante designado num evento 54 | online ou offline. A representação de um projeto pode ser ainda definida e 55 | esclarecida pelos administradores do projeto. 56 | 57 | ## Aplicação 58 | 59 | Comportamento abusivo, de assédio ou de outros tipos pode ser 60 | comunicado contatando a equipe do projeto mh.codebro@gmail.com. 61 | Todas as queixas serão revistas e investigadas e 62 | resultarão numa resposta necessária e apropriada à situação. 63 | A equipe é obrigada a manter a confidencialidade em relação 64 | ao elemento que reportou o incidente. Demais detalhes de 65 | políticas de aplicação podem ser postadas separadamente. 66 | 67 | Administradores do projeto que não sigam ou não mantenham o Código 68 | de Conduta em boa fé podem enfrentar repercussões temporárias ou permanentes 69 | determinadas por outros membros da liderança do projeto. 70 | 71 | ## Atribuição 72 | 73 | Este Código de Conduta é adaptado do [Contributor 74 | Covenant](http://contributor-covenant.org), 75 | versão 1.4, disponível em http://contributor-covenant.org/version/1/4/pt_br/ 76 | -------------------------------------------------------------------------------- /CONTRIBUINDO.md: -------------------------------------------------------------------------------- 1 | Todos os tipos de contribuições são bem vindas! 2 | 3 | - Documentação errada? Erros técnicos acontecem à toda hora. Comportamentos 4 | podem variar entre diferetes versões do Vim. 5 | - Tem alguma coisa que você não tenha entendido diretamente? A explicação foi 6 | complicada demais? 7 | - Alguma outra sugestão para melhorar? Uma melhor forma de frasear? Erros de 8 | digitação? Endereços que já não funcionam mais? 9 | - Quer adicionar alguns plugins? Por favor certifique-se que eles já coletaram 10 | algumas estrelas (no Github, etc). A cada dia aparecem novos plugins e eu não 11 | posso testar todos, portanto acabo dependendo do "aprovamento social" como um 12 | indicador da utilidade do plugin. (Se você escreveu ou encontrou um plugin sem 13 | ou com poucas estrelas mas ainda assim pensa que ele é útil, promova-o no 14 | [r/vim](https://www.reddit.com/r/vim), pois lá existem muitos leitores e é um 15 | ótimo meio de atrair atenção.) 16 | 17 | Por favor, reporte _qualquer_ coisa que pareça errada para você criando uma 18 | [questão](https://github.com/mhinz/vim-galore/issues/new) ("_issue_") para ela. 19 | 20 | Se você sentir que pode consertar, abra um pedido de puxão (que tradução 21 | esquisita para [pull 22 | request](https://help.github.com/categories/collaborating-with-issues-and-pull-requests)...). 23 | Não se preocupe muito com a formatação da sua mensagem (..."_commit message_"), 24 | o remendo que você está fazendo é muito mais importante. 25 | 26 | Agradecemos pela contribuição! 27 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Segue abaixo a Atribuição-CompartilhaIgual 4.0 Internacional 2 | (CC BY-SA 4.0), em inglês. 3 | 4 | Para saber mais sobre a licença em português, acesse: 5 | https://creativecommons.org/licenses/by-sa/4.0/deed.pt_BR 6 | 7 | 8 | ======================================================================= 9 | Attribution-ShareAlike 4.0 International 10 | 11 | ======================================================================= 12 | 13 | Creative Commons Corporation ("Creative Commons") is not a law firm and 14 | does not provide legal services or legal advice. Distribution of 15 | Creative Commons public licenses does not create a lawyer-client or 16 | other relationship. Creative Commons makes its licenses and related 17 | information available on an "as-is" basis. Creative Commons gives no 18 | warranties regarding its licenses, any material licensed under their 19 | terms and conditions, or any related information. Creative Commons 20 | disclaims all liability for damages resulting from their use to the 21 | fullest extent possible. 22 | 23 | Using Creative Commons Public Licenses 24 | 25 | Creative Commons public licenses provide a standard set of terms and 26 | conditions that creators and other rights holders may use to share 27 | original works of authorship and other material subject to copyright 28 | and certain other rights specified in the public license below. The 29 | following considerations are for informational purposes only, are not 30 | exhaustive, and do not form part of our licenses. 31 | 32 | Considerations for licensors: Our public licenses are 33 | intended for use by those authorized to give the public 34 | permission to use material in ways otherwise restricted by 35 | copyright and certain other rights. Our licenses are 36 | irrevocable. Licensors should read and understand the terms 37 | and conditions of the license they choose before applying it. 38 | Licensors should also secure all rights necessary before 39 | applying our licenses so that the public can reuse the 40 | material as expected. Licensors should clearly mark any 41 | material not subject to the license. This includes other CC- 42 | licensed material, or material used under an exception or 43 | limitation to copyright. More considerations for licensors: 44 | wiki.creativecommons.org/Considerations_for_licensors 45 | 46 | Considerations for the public: By using one of our public 47 | licenses, a licensor grants the public permission to use the 48 | licensed material under specified terms and conditions. If 49 | the licensor's permission is not necessary for any reason--for 50 | example, because of any applicable exception or limitation to 51 | copyright--then that use is not regulated by the license. Our 52 | licenses grant only permissions under copyright and certain 53 | other rights that a licensor has authority to grant. Use of 54 | the licensed material may still be restricted for other 55 | reasons, including because others have copyright or other 56 | rights in the material. A licensor may make special requests, 57 | such as asking that all changes be marked or described. 58 | Although not required by our licenses, you are encouraged to 59 | respect those requests where reasonable. More_considerations 60 | for the public: 61 | wiki.creativecommons.org/Considerations_for_licensees 62 | 63 | ======================================================================= 64 | 65 | Creative Commons Attribution-ShareAlike 4.0 International Public 66 | License 67 | 68 | By exercising the Licensed Rights (defined below), You accept and agree 69 | to be bound by the terms and conditions of this Creative Commons 70 | Attribution-ShareAlike 4.0 International Public License ("Public 71 | License"). To the extent this Public License may be interpreted as a 72 | contract, You are granted the Licensed Rights in consideration of Your 73 | acceptance of these terms and conditions, and the Licensor grants You 74 | such rights in consideration of benefits the Licensor receives from 75 | making the Licensed Material available under these terms and 76 | conditions. 77 | 78 | 79 | Section 1 -- Definitions. 80 | 81 | a. Adapted Material means material subject to Copyright and Similar 82 | Rights that is derived from or based upon the Licensed Material 83 | and in which the Licensed Material is translated, altered, 84 | arranged, transformed, or otherwise modified in a manner requiring 85 | permission under the Copyright and Similar Rights held by the 86 | Licensor. For purposes of this Public License, where the Licensed 87 | Material is a musical work, performance, or sound recording, 88 | Adapted Material is always produced where the Licensed Material is 89 | synched in timed relation with a moving image. 90 | 91 | b. Adapter's License means the license You apply to Your Copyright 92 | and Similar Rights in Your contributions to Adapted Material in 93 | accordance with the terms and conditions of this Public License. 94 | 95 | c. BY-SA Compatible License means a license listed at 96 | creativecommons.org/compatiblelicenses, approved by Creative 97 | Commons as essentially the equivalent of this Public License. 98 | 99 | d. Copyright and Similar Rights means copyright and/or similar rights 100 | closely related to copyright including, without limitation, 101 | performance, broadcast, sound recording, and Sui Generis Database 102 | Rights, without regard to how the rights are labeled or 103 | categorized. For purposes of this Public License, the rights 104 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 105 | Rights. 106 | 107 | e. Effective Technological Measures means those measures that, in the 108 | absence of proper authority, may not be circumvented under laws 109 | fulfilling obligations under Article 11 of the WIPO Copyright 110 | Treaty adopted on December 20, 1996, and/or similar international 111 | agreements. 112 | 113 | f. Exceptions and Limitations means fair use, fair dealing, and/or 114 | any other exception or limitation to Copyright and Similar Rights 115 | that applies to Your use of the Licensed Material. 116 | 117 | g. License Elements means the license attributes listed in the name 118 | of a Creative Commons Public License. The License Elements of this 119 | Public License are Attribution and ShareAlike. 120 | 121 | h. Licensed Material means the artistic or literary work, database, 122 | or other material to which the Licensor applied this Public 123 | License. 124 | 125 | i. Licensed Rights means the rights granted to You subject to the 126 | terms and conditions of this Public License, which are limited to 127 | all Copyright and Similar Rights that apply to Your use of the 128 | Licensed Material and that the Licensor has authority to license. 129 | 130 | j. Licensor means the individual(s) or entity(ies) granting rights 131 | under this Public License. 132 | 133 | k. Share means to provide material to the public by any means or 134 | process that requires permission under the Licensed Rights, such 135 | as reproduction, public display, public performance, distribution, 136 | dissemination, communication, or importation, and to make material 137 | available to the public including in ways that members of the 138 | public may access the material from a place and at a time 139 | individually chosen by them. 140 | 141 | l. Sui Generis Database Rights means rights other than copyright 142 | resulting from Directive 96/9/EC of the European Parliament and of 143 | the Council of 11 March 1996 on the legal protection of databases, 144 | as amended and/or succeeded, as well as other essentially 145 | equivalent rights anywhere in the world. 146 | 147 | m. You means the individual or entity exercising the Licensed Rights 148 | under this Public License. Your has a corresponding meaning. 149 | 150 | 151 | Section 2 -- Scope. 152 | 153 | a. License grant. 154 | 155 | 1. Subject to the terms and conditions of this Public License, 156 | the Licensor hereby grants You a worldwide, royalty-free, 157 | non-sublicensable, non-exclusive, irrevocable license to 158 | exercise the Licensed Rights in the Licensed Material to: 159 | 160 | a. reproduce and Share the Licensed Material, in whole or 161 | in part; and 162 | 163 | b. produce, reproduce, and Share Adapted Material. 164 | 165 | 2. Exceptions and Limitations. For the avoidance of doubt, where 166 | Exceptions and Limitations apply to Your use, this Public 167 | License does not apply, and You do not need to comply with 168 | its terms and conditions. 169 | 170 | 3. Term. The term of this Public License is specified in Section 171 | 6(a). 172 | 173 | 4. Media and formats; technical modifications allowed. The 174 | Licensor authorizes You to exercise the Licensed Rights in 175 | all media and formats whether now known or hereafter created, 176 | and to make technical modifications necessary to do so. The 177 | Licensor waives and/or agrees not to assert any right or 178 | authority to forbid You from making technical modifications 179 | necessary to exercise the Licensed Rights, including 180 | technical modifications necessary to circumvent Effective 181 | Technological Measures. For purposes of this Public License, 182 | simply making modifications authorized by this Section 2(a) 183 | (4) never produces Adapted Material. 184 | 185 | 5. Downstream recipients. 186 | 187 | a. Offer from the Licensor -- Licensed Material. Every 188 | recipient of the Licensed Material automatically 189 | receives an offer from the Licensor to exercise the 190 | Licensed Rights under the terms and conditions of this 191 | Public License. 192 | 193 | b. Additional offer from the Licensor -- Adapted Material. 194 | Every recipient of Adapted Material from You 195 | automatically receives an offer from the Licensor to 196 | exercise the Licensed Rights in the Adapted Material 197 | under the conditions of the Adapter's License You apply. 198 | 199 | c. No downstream restrictions. You may not offer or impose 200 | any additional or different terms or conditions on, or 201 | apply any Effective Technological Measures to, the 202 | Licensed Material if doing so restricts exercise of the 203 | Licensed Rights by any recipient of the Licensed 204 | Material. 205 | 206 | 6. No endorsement. Nothing in this Public License constitutes or 207 | may be construed as permission to assert or imply that You 208 | are, or that Your use of the Licensed Material is, connected 209 | with, or sponsored, endorsed, or granted official status by, 210 | the Licensor or others designated to receive attribution as 211 | provided in Section 3(a)(1)(A)(i). 212 | 213 | b. Other rights. 214 | 215 | 1. Moral rights, such as the right of integrity, are not 216 | licensed under this Public License, nor are publicity, 217 | privacy, and/or other similar personality rights; however, to 218 | the extent possible, the Licensor waives and/or agrees not to 219 | assert any such rights held by the Licensor to the limited 220 | extent necessary to allow You to exercise the Licensed 221 | Rights, but not otherwise. 222 | 223 | 2. Patent and trademark rights are not licensed under this 224 | Public License. 225 | 226 | 3. To the extent possible, the Licensor waives any right to 227 | collect royalties from You for the exercise of the Licensed 228 | Rights, whether directly or through a collecting society 229 | under any voluntary or waivable statutory or compulsory 230 | licensing scheme. In all other cases the Licensor expressly 231 | reserves any right to collect such royalties. 232 | 233 | 234 | Section 3 -- License Conditions. 235 | 236 | Your exercise of the Licensed Rights is expressly made subject to the 237 | following conditions. 238 | 239 | a. Attribution. 240 | 241 | 1. If You Share the Licensed Material (including in modified 242 | form), You must: 243 | 244 | a. retain the following if it is supplied by the Licensor 245 | with the Licensed Material: 246 | 247 | i. identification of the creator(s) of the Licensed 248 | Material and any others designated to receive 249 | attribution, in any reasonable manner requested by 250 | the Licensor (including by pseudonym if 251 | designated); 252 | 253 | ii. a copyright notice; 254 | 255 | iii. a notice that refers to this Public License; 256 | 257 | iv. a notice that refers to the disclaimer of 258 | warranties; 259 | 260 | v. a URI or hyperlink to the Licensed Material to the 261 | extent reasonably practicable; 262 | 263 | b. indicate if You modified the Licensed Material and 264 | retain an indication of any previous modifications; and 265 | 266 | c. indicate the Licensed Material is licensed under this 267 | Public License, and include the text of, or the URI or 268 | hyperlink to, this Public License. 269 | 270 | 2. You may satisfy the conditions in Section 3(a)(1) in any 271 | reasonable manner based on the medium, means, and context in 272 | which You Share the Licensed Material. For example, it may be 273 | reasonable to satisfy the conditions by providing a URI or 274 | hyperlink to a resource that includes the required 275 | information. 276 | 277 | 3. If requested by the Licensor, You must remove any of the 278 | information required by Section 3(a)(1)(A) to the extent 279 | reasonably practicable. 280 | 281 | b. ShareAlike. 282 | 283 | In addition to the conditions in Section 3(a), if You Share 284 | Adapted Material You produce, the following conditions also apply. 285 | 286 | 1. The Adapter's License You apply must be a Creative Commons 287 | license with the same License Elements, this version or 288 | later, or a BY-SA Compatible License. 289 | 290 | 2. You must include the text of, or the URI or hyperlink to, the 291 | Adapter's License You apply. You may satisfy this condition 292 | in any reasonable manner based on the medium, means, and 293 | context in which You Share Adapted Material. 294 | 295 | 3. You may not offer or impose any additional or different terms 296 | or conditions on, or apply any Effective Technological 297 | Measures to, Adapted Material that restrict exercise of the 298 | rights granted under the Adapter's License You apply. 299 | 300 | 301 | Section 4 -- Sui Generis Database Rights. 302 | 303 | Where the Licensed Rights include Sui Generis Database Rights that 304 | apply to Your use of the Licensed Material: 305 | 306 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 307 | to extract, reuse, reproduce, and Share all or a substantial 308 | portion of the contents of the database; 309 | 310 | b. if You include all or a substantial portion of the database 311 | contents in a database in which You have Sui Generis Database 312 | Rights, then the database in which You have Sui Generis Database 313 | Rights (but not its individual contents) is Adapted Material, 314 | 315 | including for purposes of Section 3(b); and 316 | c. You must comply with the conditions in Section 3(a) if You Share 317 | all or a substantial portion of the contents of the database. 318 | 319 | For the avoidance of doubt, this Section 4 supplements and does not 320 | replace Your obligations under this Public License where the Licensed 321 | Rights include other Copyright and Similar Rights. 322 | 323 | 324 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 325 | 326 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 327 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 328 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 329 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 330 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 331 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 332 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 333 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 334 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 335 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 336 | 337 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 338 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 339 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 340 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 341 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 342 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 343 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 344 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 345 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 346 | 347 | c. The disclaimer of warranties and limitation of liability provided 348 | above shall be interpreted in a manner that, to the extent 349 | possible, most closely approximates an absolute disclaimer and 350 | waiver of all liability. 351 | 352 | 353 | Section 6 -- Term and Termination. 354 | 355 | a. This Public License applies for the term of the Copyright and 356 | Similar Rights licensed here. However, if You fail to comply with 357 | this Public License, then Your rights under this Public License 358 | terminate automatically. 359 | 360 | b. Where Your right to use the Licensed Material has terminated under 361 | Section 6(a), it reinstates: 362 | 363 | 1. automatically as of the date the violation is cured, provided 364 | it is cured within 30 days of Your discovery of the 365 | violation; or 366 | 367 | 2. upon express reinstatement by the Licensor. 368 | 369 | For the avoidance of doubt, this Section 6(b) does not affect any 370 | right the Licensor may have to seek remedies for Your violations 371 | of this Public License. 372 | 373 | c. For the avoidance of doubt, the Licensor may also offer the 374 | Licensed Material under separate terms or conditions or stop 375 | distributing the Licensed Material at any time; however, doing so 376 | will not terminate this Public License. 377 | 378 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 379 | License. 380 | 381 | 382 | Section 7 -- Other Terms and Conditions. 383 | 384 | a. The Licensor shall not be bound by any additional or different 385 | terms or conditions communicated by You unless expressly agreed. 386 | 387 | b. Any arrangements, understandings, or agreements regarding the 388 | Licensed Material not stated herein are separate from and 389 | independent of the terms and conditions of this Public License. 390 | 391 | 392 | Section 8 -- Interpretation. 393 | 394 | a. For the avoidance of doubt, this Public License does not, and 395 | shall not be interpreted to, reduce, limit, restrict, or impose 396 | conditions on any use of the Licensed Material that could lawfully 397 | be made without permission under this Public License. 398 | 399 | b. To the extent possible, if any provision of this Public License is 400 | deemed unenforceable, it shall be automatically reformed to the 401 | minimum extent necessary to make it enforceable. If the provision 402 | cannot be reformed, it shall be severed from this Public License 403 | without affecting the enforceability of the remaining terms and 404 | conditions. 405 | 406 | c. No term or condition of this Public License will be waived and no 407 | failure to comply consented to unless expressly agreed to by the 408 | Licensor. 409 | 410 | d. Nothing in this Public License constitutes or may be interpreted 411 | as a limitation upon, or waiver of, any privileges and immunities 412 | that apply to the Licensor or You, including from the legal 413 | processes of any jurisdiction or authority. 414 | 415 | 416 | ======================================================================= 417 | 418 | Creative Commons is not a party to its public 419 | licenses. Notwithstanding, Creative Commons may elect to apply one of 420 | its public licenses to material it publishes and in those instances 421 | will be considered the “Licensor.” The text of the Creative Commons 422 | public licenses is dedicated to the public domain under the CC0 Public 423 | Domain Dedication. Except for the limited purpose of indicating that 424 | material is shared under a Creative Commons public license or as 425 | otherwise permitted by the Creative Commons policies published at 426 | creativecommons.org/policies, Creative Commons does not authorize the 427 | use of the trademark "Creative Commons" or any other trademark or logo 428 | of Creative Commons without its prior written consent including, 429 | without limitation, in connection with any unauthorized modifications 430 | to any of its public licenses or any other arrangements, 431 | understandings, or agreements concerning use of licensed material. For 432 | the avoidance of doubt, this paragraph does not form part of the 433 | public licenses. 434 | 435 | Creative Commons may be contacted at creativecommons.org. 436 | 437 | -------------------------------------------------------------------------------- /PLUGINS.md: -------------------------------------------------------------------------------- 1 | ## lista de plugins 2 | 3 | #### [Esquemas de cores](#esquemas-de-cores-1) 4 | 5 | #### [Por tópico](#por-tópico-1) 6 | 7 | - [Alinhamento(#alinhamento) 8 | - [Building and linting](#building-and-linting) 9 | - [Code completion](#code-completion) 10 | - [Commenters](#commenters) 11 | - [Cycle](#cycle) 12 | - [Delimiter](#delimiter) 13 | - [Fuzzy finders](#fuzzy-finders) 14 | - [Grep tools](#grep-tools) 15 | - [Indent](#indent) 16 | - [Misc](#misc) 17 | - [Navigation](#navigation) 18 | - [Gerenciadores de plugins](#gerenciadores-de-plugins) 19 | - [Snippets](#snippets) 20 | - [Statusline](#statusline) 21 | - [Surround](#surround) 22 | - [Taking notes](#taking-notes) 23 | - [Text objects](#text-objects) 24 | - [Tmux](#tmux) 25 | - [Undo history](#undo-history) 26 | - [Version control](#version-control) 27 | - [Writing](#writing) 28 | 29 | #### [By filetype](#by-filetype-1) 30 | 31 | - [C and C++](#c-and-c) 32 | - [Clojure](#clojure) 33 | - [Elixir](#elixir) 34 | - [Go](#go) 35 | - [HTML](#html) 36 | - [Java](#java) 37 | - [Javascript](#javascript) 38 | - [Lua](#lua) 39 | - [Python](#python) 40 | - [TeX](#tex) 41 | - [VimL](#viml) 42 | 43 | ## Esquemas de cores 44 | 45 | Aque está uma lista de esquemas de cores comumente usados: 46 | 47 | - [acme-colors](https://github.com/plan9-for-vimspace/acme-colors) 48 | - [base16](https://github.com/chriskempson/base16-vim) 49 | - [gotham](https://github.com/whatyouhide/vim-gotham) 50 | - [gruvbox](https://github.com/morhetz/gruvbox) 51 | - [janah](https://github.com/mhinz/vim-janah) 52 | - [jellybeans](https://github.com/nanotech/jellybeans.vim) 53 | - [lucius](https://github.com/jonathanfilip/vim-lucius) 54 | - [molokai](https://github.com/tomasr/molokai) 55 | - [oceanic-next](https://github.com/mhartington/oceanic-next) 56 | - [railscasts](https://github.com/jpo/vim-railscasts-theme) 57 | - [seoul256](https://github.com/junegunn/seoul256.vim) 58 | - [solarized](https://github.com/altercation/vim-colors-solarized) (ou uma 59 | variante mais clara: [flattened](https://github.com/romainl/flattened)) 60 | - [tomorrow](https://github.com/chriskempson/vim-tomorrow-theme) 61 | - [vividchalk](https://github.com/tpope/vim-vividchalk) 62 | - [yowish](https://github.com/kabbamine/yowish.vim) 63 | - [zenburn](https://github.com/jnurmine/Zenburn) 64 | 65 | Alternatively, generate your own colorscheme using [themer](https://github.com/mjswensen/themer). 66 | 67 | ## By topic 68 | 69 | #### Alignment 70 | 71 | - [tabular](https://github.com/godlygeek/tabular) 72 | - [vim-easy-align](https://github.com/junegunn/vim-easy-align) 73 | 74 | #### Building and linting 75 | 76 | - [ale](https://github.com/w0rp/ale) 77 | - [neomake](https://github.com/neomake/neomake) 78 | - [syntastic](https://github.com/vim-syntastic/syntastic) 79 | 80 | #### Code completion 81 | 82 | - [asyncomplete.vim](https://github.com/prabirshrestha/asyncomplete.vim) 83 | - [completor.vim](https://github.com/maralla/completor.vim) 84 | - [deoplete.nvim](https://github.com/Shougo/deoplete.nvim) 85 | - [neocomplete.vim](https://github.com/Shougo/neocomplete.vim) 86 | - [supertab](https://github.com/ervandew/supertab) 87 | - [vim-mucomplete](https://github.com/lifepillar/vim-mucomplete) 88 | - [VimCompletesMe](https://github.com/ajh17/VimCompletesMe) 89 | - [YouCompleteMe](https://github.com/Valloric/YouCompleteMe) 90 | 91 | #### Cycle 92 | 93 | - [switch.vim](https://github.com/AndrewRadev/switch.vim) 94 | - [vim-speeddating](https://github.com/tpope/vim-speeddating) 95 | 96 | #### Commenters 97 | 98 | - [nerdcommenter](https://github.com/scrooloose/nerdcommenter) 99 | - [tcomment_vim](https://github.com/tomtom/tcomment_vim) 100 | - [vim-commentary](https://github.com/tpope/vim-commentary) 101 | 102 | #### Delimiter 103 | 104 | - [auto-pairs](https://github.com/jiangmiao/auto-pairs) 105 | - [delimitMate](https://github.com/Raimondi/delimitMate) 106 | - [vim-endwise](https://github.com/tpope/vim-endwise) 107 | 108 | #### Fuzzy finders 109 | 110 | - [Command-T](https://github.com/wincent/Command-T) (_requires +ruby_) 111 | - [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim) 112 | - [denite.nvim](https://github.com/Shougo/denite.nvim) (_requires +python3_) 113 | - [fzf](https://github.com/junegunn/fzf) (and [fzf.vim](https://github.com/junegunn/fzf.vim)) 114 | - [unite.vim](https://github.com/Shougo/unite.vim) 115 | - [vim-fz](https://github.com/mattn/vim-fz) 116 | 117 | #### Grep tools 118 | 119 | - [ctrlsf.vim](https://github.com/dyng/ctrlsf.vim) 120 | - [ferret](https://github.com/wincent/ferret) 121 | - [vim-grepper](https://github.com/mhinz/vim-grepper) 122 | 123 | #### Indent 124 | 125 | - [indentLine](https://github.com/Yggdroot/indentLine) 126 | - [vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides) 127 | 128 | #### Navigation 129 | 130 | - [nerdtree](https://github.com/scrooloose/nerdtree) 131 | - [tagbar](https://github.com/majutsushi/tagbar) 132 | - [vim-dirvish](https://github.com/justinmk/vim-dirvish) 133 | - [vim-easymotion](https://github.com/easymotion/vim-easymotion) 134 | - [vim-sneak](https://github.com/justinmk/vim-sneak) 135 | - [vim-vinegar](https://github.com/tpope/vim-vinegar) 136 | - [vimfiler.vim](https://github.com/Shougo/vimfiler.vim) (_depends on other plugins_) 137 | 138 | Also see [fuzzy finders](#fuzzy-finders). 139 | 140 | #### Plugin managers 141 | 142 | - [dein.vim](https://github.com/Shougo/dein.vim) 143 | - [minpac](https://github.com/k-takata/minpac) 144 | - [vim-addon-manager](https://github.com/MarcWeber/vim-addon-manager) 145 | - [vim-pathogen](https://github.com/tpope/vim-pathogen) 146 | - [vim-plug](https://github.com/junegunn/vim-plug) 147 | - [vundle.vim](https://github.com/VundleVim/Vundle.vim) 148 | 149 | #### Snippets 150 | 151 | - [neosnippet.vim](https://github.com/Shougo/neosnippet.vim) (_depends on other plugins_) 152 | - [ultisnips](https://github.com/SirVer/ultisnips) 153 | - [vim-snipmate](https://github.com/garbas/vim-snipmate) (_depends on other plugins_) 154 | - [xptemplate](https://github.com/drmingdrmer/xptemplate) 155 | 156 | #### Statusline 157 | 158 | - [lightline.vim](https://github.com/itchyny/lightline.vim) 159 | - [powerline](https://github.com/powerline/powerline) 160 | - [vim-airline](https://github.com/vim-airline/vim-airline) 161 | - [vim-flagship](https://github.com/tpope/vim-flagship) 162 | 163 | #### Surround 164 | 165 | - [vim-operator-surround](https://github.com/rhysd/vim-operator-surround) 166 | - [vim-sandwich](https://github.com/machakann/vim-sandwich) 167 | - [vim-surround](https://github.com/tpope/vim-surround) 168 | 169 | #### Taking notes 170 | 171 | - [vim-dotoo](https://github.com/dhruvasagar/vim-dotoo) 172 | - [vim-journal](https://github.com/junegunn/vim-journal) 173 | - [vim-notes](https://github.com/xolox/vim-notes) 174 | - [vim-orgmode](https://github.com/jceb/vim-orgmode) 175 | - [vim-pad](https://github.com/fmoralesc/vim-pad) 176 | - [vimwiki](https://github.com/vimwiki/vimwiki) 177 | 178 | #### Text objects 179 | 180 | - [targets.vim](https://github.com/wellle/targets.vim) 181 | - [vim-exchange](https://github.com/tommcdo/vim-exchange) 182 | - [vim-textobj-user](https://github.com/kana/vim-textobj-user) 183 | 184 | #### Tmux 185 | 186 | - [tmux-complete.vim](https://github.com/wellle/tmux-complete.vim) 187 | - [vim-dispatch](https://github.com/tpope/vim-dispatch) 188 | - [vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) 189 | - [vitality.vim](https://github.com/sjl/vitality.vim) 190 | 191 | #### Undo history 192 | 193 | - [gundo.vim](https://github.com/sjl/gundo.vim) 194 | - [undotree](https://github.com/mbbill/undotree) 195 | 196 | #### Version control 197 | 198 | - [agit.vim](https://github.com/cohama/agit.vim) 199 | - [committia.vim](https://github.com/rhysd/committia.vim) 200 | - [gist-vim](https://github.com/mattn/gist-vim) 201 | - [github-issues.vim](https://github.com/jaxbot/github-issues.vim) 202 | - [gitv](https://github.com/gregsexton/gitv) 203 | - [gv.vim](https://github.com/junegunn/gv.vim) 204 | - [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) 205 | - [vim-auto-programming](https://github.com/haya14busa/vim-auto-programming) 206 | - [vim-fugitive](https://github.com/tpope/vim-fugitive) 207 | - [vim-gitgutter](https://github.com/airblade/vim-gitgutter) 208 | - [vim-github-dashboard](https://github.com/junegunn/vim-github-dashboard) 209 | - [vim-lawrencium](https://bitbucket.org/ludovicchabant/vim-lawrencium) 210 | - [vim-signify](https://github.com/mhinz/vim-signify) 211 | - [vimagit](https://github.com/jreybert/vimagit) 212 | 213 | #### Writing 214 | 215 | - [vim-grammarous](https://github.com/rhysd/vim-grammarous) 216 | - [vim-online-thesaurus](https://github.com/beloglazov/vim-online-thesaurus) 217 | 218 | #### Misc 219 | 220 | - [CoVim](https://github.com/FredKSchott/CoVim) 221 | - [FastFold](https://github.com/Konfekt/FastFold) 222 | - [NrrwRgn](https://github.com/chrisbra/NrrwRgn) 223 | - [calendar.vim](https://github.com/itchyny/calendar.vim) 224 | - [goyo.vim](https://github.com/junegunn/goyo.vim) 225 | - [sideways.vim](https://github.com/AndrewRadev/sideways.vim) 226 | - [splitjoin.vim](https://github.com/AndrewRadev/splitjoin.vim) 227 | - [targets.vim](https://github.com/wellle/targets.vim) 228 | - [unicode.vim](https://github.com/chrisbra/unicode.vim) 229 | - [vim-bracketed-paste](https://github.com/ConradIrwin/vim-bracketed-paste) 230 | - [vim-devicons](https://github.com/ryanoasis/vim-devicons) 231 | - [vim-diff-enhanced](https://github.com/chrisbra/vim-diff-enhanced) 232 | - [vim-diminactive](https://github.com/blueyed/vim-diminactive) 233 | - [vim-fixkey](https://github.com/drmikehenry/vim-fixkey) 234 | - [vim-gnupg](https://github.com/jamessan/vim-gnupg) 235 | - [vim-hackernews](https://github.com/ryanss/vim-hackernews) 236 | - [vim-move](https://github.com/matze/vim-move) 237 | - [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors) 238 | - [vim-projectionist](https://github.com/tpope/vim-projectionist) 239 | - [vim-rsi](https://github.com/tpope/vim-rsi) 240 | - [vim-startify](https://github.com/mhinz/vim-startify) 241 | - [vim-unimpaired](https://github.com/tpope/vim-unimpaired) 242 | 243 | ## By filetype 244 | 245 | #### C and C++ 246 | 247 | - [a.vim](https://github.com/vim-scripts/a.vim) 248 | - [clang_complete](https://github.com/Rip-Rip/clang_complete) 249 | - [color_coded](https://github.com/jeaye/color_coded) 250 | - [lh-cpp](https://github.com/LucHermitte/lh-cpp) 251 | - [vim-cpp-enhanced-highlight](https://github.com/octol/vim-cpp-enhanced-highlight) 252 | 253 | #### Clojure 254 | 255 | - [paredit](https://github.com/kovisoft/paredit) 256 | - [rainbow_parentheses.vim](https://github.com/junegunn/rainbow_parentheses.vim) 257 | - [vim-clojure-highlight](https://github.com/guns/vim-clojure-highlight) 258 | - [vim-fireplace](https://github.com/tpope/vim-fireplace) 259 | - [vim-salve](https://github.com/tpope/vim-salve) 260 | - [vim-sexp-mappings-for-regular-people](https://github.com/tpope/vim-sexp-mappings-for-regular-people) 261 | - [vim-sexp](https://github.com/guns/vim-sexp) 262 | 263 | #### Elixir 264 | 265 | - [alchemist.vim](https://github.com/slashmili/alchemist.vim) 266 | - [vim-elixir](https://github.com/elixir-editors/vim-elixir) 267 | 268 | #### Go 269 | 270 | - [gofmt.vim](https://github.com/tweekmonster/gofmt.vim) 271 | - [hl-goimport.vim](https://github.com/tweekmonster/hl-goimport.vim) 272 | - [vim-go](https://github.com/fatih/vim-go) 273 | - [vim-godebug](https://github.com/jodosha/vim-godebug) 274 | 275 | #### HTML 276 | 277 | - [emmet-vim](https://github.com/mattn/emmet-vim) 278 | - [html5.vim](https://github.com/othree/html5.vim) 279 | 280 | #### Java 281 | 282 | - [vim-javacomplete2](https://github.com/artur-shaik/vim-javacomplete2) 283 | 284 | #### Javascript 285 | 286 | - [es.next.syntax.vim](https://github.com/othree/es.next.syntax.vim) 287 | - [javascript-libraries-syntax.vim](https://github.com/othree/javascript-libraries-syntax.vim) 288 | - [node-vim-debugger](https://github.com/sidorares/node-vim-debugger) 289 | - [tern_for_vim](https://github.com/ternjs/tern_for_vim) 290 | - [vim-esformatter](https://github.com/millermedeiros/vim-esformatter) 291 | - [vim-javascript-syntax](https://github.com/jelera/vim-javascript-syntax) 292 | - [vim-javascript](https://github.com/pangloss/vim-javascript) 293 | - [vim-node](https://github.com/moll/vim-node) 294 | - [vim-prettier](https://github.com/prettier/vim-prettier) 295 | - [yajs.vim](https://github.com/othree/yajs.vim) 296 | 297 | #### Lua 298 | 299 | - [vim-lua-ftplugin](https://github.com/xolox/vim-lua-ftplugin) 300 | - [vim-lua-inspect](https://github.com/xolox/vim-lua-inspect) 301 | 302 | #### Python 303 | 304 | - [braceless.vim](https://github.com/tweekmonster/braceless.vim) 305 | - [impsort.vim](https://github.com/tweekmonster/impsort.vim) 306 | - [jedi-vim](https://github.com/davidhalter/jedi-vim) 307 | - [python-mode](https://github.com/klen/python-mode) 308 | - [vim-flake8](https://github.com/nvie/vim-flake8) 309 | 310 | #### TeX 311 | 312 | - [vimtex](https://github.com/lervag/vimtex) 313 | 314 | #### VimL 315 | 316 | - [exception.vim](https://github.com/tweekmonster/exception.vim) 317 | - [helpful.vim](https://github.com/tweekmonster/helpful.vim) 318 | - [vim-lookup](https://github.com/mhinz/vim-lookup) 319 | - [vim-scriptease](https://github.com/tpope/vim-scriptease) 320 | -------------------------------------------------------------------------------- /eng-README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | ![vim-galore](https://raw.githubusercontent.com/mhinz/vim-galore/master/contents/images/logo-vim-galore.png) 4 | 5 |
6 | 7 | [![Build Status](https://travis-ci.org/mhinz/vim-galore.svg?branch=master)](https://travis-ci.org/mhinz/vim-galore) 8 | [![badge-translation-japanese](https://img.shields.io/badge/Translation-Japanese-lightgrey.svg)](http://postd.cc/?s=vim-galore) 9 | [![vim-galore](https://cdn.rawgit.com/mhinz/vim-galore/master/contents/images/badge-awesome.svg)](https://github.com/sindresorhus/awesome) 10 | 11 | ## [Intro](#intro-1) 12 | 13 | - [What is Vim?](#what-is-vim) 14 | - [The Vim Philosophy](#the-vim-philosophy) 15 | - [First steps](#first-steps) 16 | - [Minimal vimrc](#minimal-vimrc) 17 | - [What kind of Vim am I running?](#what-kind-of-vim-am-i-running) 18 | - [Cheatsheets](#cheatsheets) 19 | 20 | ## [Basics](#basics-1) 21 | 22 | - [Buffers, windows, tabs](#buffers-windows-tabs) 23 | - [Active, loaded, listed, named buffers](#active-loaded-listed-named-buffers) 24 | - [Argument list](#argument-list) 25 | - [Mappings](#mappings) 26 | - [Mapleader](#mapleader) 27 | - [Registers](#registers) 28 | - [Ranges](#ranges) 29 | - [Marks](#marks) 30 | - [Completion](#completion) 31 | - [Motions, operators, text objects](#motions-operators-text-objects) 32 | - [Autocmds](#autocmds) 33 | - [Changelist, jumplist](#changelist-jumplist) 34 | - [Undo tree](#undo-tree) 35 | - [Quickfix and location lists](#quickfix-and-location-lists) 36 | - [Macros](#macros) 37 | - [Colorschemes](#colorschemes) 38 | - [Folding](#folding) 39 | - [Sessions](#sessions) 40 | - [Locality](#locality) 41 | 42 | ## [Usage](#usage-1) 43 | 44 | - [Getting help offline](#getting-help-offline) 45 | - [Getting help offline (alternative)](#getting-help-offline-alternative) 46 | - [Getting help online](#getting-help-online) 47 | - [Autocmds in practice](#autocmds-in-practice) 48 | - [User events](#user-events) 49 | - [Nested autocmds](#nested-autocmds) 50 | - [Clipboard](#clipboard) 51 | - [Clipboard usage (Windows, OSX)](#clipboard-usage-windows-osx) 52 | - [Clipboard usage (Linux, BSD, ...)](#clipboard-usage-linux-bsd-) 53 | - [Restore cursor position when opening file](#restore-cursor-position-when-opening-file) 54 | - [Handling backup, swap, undo, and viminfo files](#handling-backup-swap-undo-and-viminfo-files) 55 | - [Editing remote files](#editing-remote-files) 56 | - [Managing plugins](#managing-plugins) 57 | - [Block insert](#block-insert) 58 | - [Running external programs and using filters](#running-external-programs-and-using-filters) 59 | - [Cscope](#cscope) 60 | - [MatchIt](#matchit) 61 | 62 | ## [Tips](#tips-1) 63 | 64 | - [Saner behavior of n and N](#saner-behavior-of-n-and-n) 65 | - [Saner command-line history](#saner-command-line-history) 66 | - [Saner CTRL-L](#saner-ctrl-l) 67 | - [Disable audible and visual bells](#disable-audible-and-visual-bells) 68 | - [Quickly move current line](#quickly-move-current-line) 69 | - [Quickly add empty lines](#quickly-add-empty-lines) 70 | - [Quickly edit your macros](#quickly-edit-your-macros) 71 | - [Quickly jump to header or source file](#quickly-jump-to-header-or-source-file) 72 | - [Quickly change font size in GUI](#quickly-change-font-size-in-gui) 73 | - [Change cursor style dependent on mode](#change-cursor-style-dependent-on-mode) 74 | - [Don't lose selection when shifting sidewards](#dont-lose-selection-when-shifting-sidewards) 75 | - [Reload a file on saving](#reload-a-file-on-saving) 76 | - [Smarter cursorline](#smarter-cursorline) 77 | - [Faster keyword completion](#faster-keyword-completion) 78 | - [Cosmetic changes to colorschemes](#cosmetic-changes-to-colorschemes) 79 | 80 | ## [Commands](#commands-1) 81 | 82 | - [:global and :vglobal](#global-and-vglobal) - Execute a command on all matching lines. 83 | - [:normal and :execute](#normal-and-execute) - The scripting dream team. 84 | - [:redir](#redir) - Redirect messages. 85 | 86 | ## [Debugging](#debugging-1) 87 | 88 | - [General tips](#general-tips) 89 | - [Verbosity](#verbosity) 90 | - [Profiling startup time](#profiling-startup-time) 91 | - [Profiling at runtime](#profiling-at-runtime) 92 | - [Debugging Vim scripts](#debugging-vim-scripts) 93 | - [Debugging syntax files](#debugging-syntax-files) 94 | 95 | ## [Miscellaneous](#miscellaneous-1) 96 | 97 | - [Additional resources](#additional-resources) 98 | - [Vim distributions](#vim-distributions) 99 | - [Standard plugins](#standard-plugins) 100 | - [Map CapsLock to Control](#map-capslock-to-control) 101 | - [Easter eggs](#easter-eggs) 102 | - [Why hjkl for navigation?](#why-hjkl-for-navigation) 103 | 104 | ## [Common problems](#common-problems-1) 105 | 106 | - [Editing small files is slow](#editing-small-files-is-slow) 107 | - [Editing huge files is slow](#editing-huge-files-is-slow) 108 | - [Bracketed paste (or why do I have to set 'paste' all the time?)](#bracketed-paste-or-why-do-i-have-to-set-paste-all-the-time) 109 | - [Delays when using escape key in terminal](#delays-when-using-escape-key-in-terminal) 110 | - [Function search undo](#function-search-undo) 111 | 112 | ## [Technical quirks](#technical-quirks-1) 113 | 114 | - [Newline used for NUL](#newline-used-for-nul) 115 | 116 | ## [List of colorschemes](#list-of-colorschemes-1) 117 | 118 | ## [List of plugins](contents/plugins.md) 119 | 120 | --- 121 | 122 | # Intro 123 | 124 | ## What is Vim? 125 | 126 | [Vim](http://www.vim.org) is a text editor with a long line of ancestors that 127 | goes back to [qed](https://en.wikipedia.org/wiki/QED_(text_editor)). [Bram 128 | Moolenaar](https://en.wikipedia.org/wiki/Bram_Moolenaar) released it in 1991. 129 | 130 | The project is hosted online at [vim.org](http://www.vim.org/index.php). 131 | 132 | Getting Vim: Use your favourite package manager or visit the [download 133 | page](http://www.vim.org/download.php) from vim.org. 134 | 135 | Discussions and user questions are best done on the 136 | [vim_use](https://groups.google.com/forum/#!forum/vim_use) mailing list or using 137 | IRC ([Freenode](https://freenode.net)) in the `#vim` channel. 138 | 139 | Development happens on [Github](https://github.com/vim/vim), discussions on the 140 | [vim_dev](https://groups.google.com/forum/#!forum/vim_dev) mailing list. 141 | 142 | Read [Why, oh WHY, do those #?@! nutheads use 143 | vi?](http://www.viemu.com/a-why-vi-vim.html) to see common misconceptions about 144 | Vim explained. 145 | 146 | ## The Vim Philosophy 147 | 148 | Vim adheres to the modal editing philosophy. This means that it provides 149 | multiple modes and the meaning of keys changes according to the mode. You 150 | navigate files in _normal mode_, you insert text in _insert mode_, you select 151 | lines in _visual mode_, you access commands in _command-line mode_ and so on. 152 | This might sound complicated at first, but has a huge advantage: you don't have 153 | to break your fingers by holding several keys at once, most of the time you 154 | simply press them one after the other. The more common the task, the fewer keys 155 | are needed. 156 | 157 | A related concept that works well with modal editing are operators and motions. 158 | _Operators_ start a certain action, e.g. changing, removing, or selecting text. 159 | Afterwards you specify the region of text you want to act on using a _motion_. 160 | To change everything between parentheses, use `ci(` (read _change inner 161 | parentheses_). To remove an entire paragraph of text, use `dap` (read _delete 162 | around paragraph_). 163 | 164 | If you see advanced Vim users working, you'll notice that they speak the 165 | _language of Vim_ as well as pianists handle their instruments. Complex 166 | operations are done using only a few key presses. They don't even think about it 167 | anymore as [muscle memory](https://en.wikipedia.org/wiki/Muscle_memory) took 168 | over already. This reduces [cognitive 169 | load](https://en.wikipedia.org/wiki/Cognitive_load) and helps to focus on the 170 | actual task. 171 | 172 | ## First steps 173 | 174 | Vim comes bundled with an interactive tutorial that teaches the most basic 175 | things you need to know about. You can start it from the shell: 176 | 177 | ``` 178 | $ vimtutor 179 | ``` 180 | 181 | Don't be put off by how boring it looks like and work through the exercises. The 182 | editors or IDEs you used before were most probably all non-modal, so working by 183 | switching modes will seem awkward at first, but the more you use Vim, the more 184 | it becomes [muscle memory](https://en.wikipedia.org/wiki/Muscle_memory). 185 | 186 | Vim was bolted on [Stevie](https://en.wikipedia.org/wiki/Stevie_(text_editor)), a 187 | [vi](https://en.wikipedia.org/wiki/Vi) clone, and supports two operating modes: 188 | "compatible" and "nocompatible". Using Vim in compatible mode means using vi 189 | defaults for all options, opposed to Vim defaults. As long as you didn't create 190 | a user vimrc yet or started Vim with `vim -N`, compatible mode is assumed! Don't 191 | use Vim in compatible mode. Just don't. 192 | 193 | Next steps: 194 | 195 | 1. Create your own [vimrc](#minimal-vimrc). 196 | 2. Have some [cheatsheets](#cheatsheets) ready for the first weeks. 197 | 3. Read through the [basics](#basics-1) section to learn what is even possible. 198 | 4. Learn on demand! You never finish learning Vim. If you encounter any 199 | problems, just look for it on the internet. Your problem was solved already. 200 | Vim comes with great documentation and knowing how to navigate it is a must: 201 | [Getting help offline](#getting-help-offline). 202 | 5. Have a look at the [additional resources](#additional-resources). 203 | 204 | One last advice: Please learn how to use Vim properly before starting to add all 205 | kinds of hyped [plugins](#managing-plugins) that only implement features that 206 | Vim already supports natively. 207 | 208 | ## Minimal vimrc 209 | 210 | The user vimrc can be put into `~/.vimrc` or for the sake of better separation 211 | into `~/.vim/vimrc`. The latter makes it easy to put the entire configuration 212 | under version control and upload it to, let's say Github. 213 | 214 | You find many "minimal vimrcs" all over the net, and maybe my version isn't as 215 | minimal as it should be, but it provides a good set of sane settings that I deem 216 | to be useful for starting out. 217 | 218 | Eventually you have to read up on all the mentioned settings anyway and decide 219 | for yourself. :-) 220 | 221 | So here it is: [minimal-vimrc](contents/minimal-vimrc.vim) 222 | 223 | In case you're interested, here's 224 | [my vimrc][https://github.com/mhinz/dotfiles/blob/master/.vim/vimrc]. 225 | 226 | **TIP**: Most plugin authors maintain several plugins and also publish their 227 | vimrc on Github (often in a repository called "vim-config" or "dotfiles"), so 228 | whenever you find a plugin you like, look up its maintainer's Github page and 229 | look through the repositories. 230 | 231 | ## What kind of Vim am I running? 232 | 233 | Looking at `:version` will give you all the information you need to know about 234 | how the currently running Vim binary was compiled. 235 | 236 | The first line tells you when the binary was compiled and the version, e.g. 7.4. 237 | One of the next lines states `Included patches: 1-1051`, which is the patch 238 | level. Thus, your exact Vim version is 7.4.1051. 239 | 240 | Another line states something like `Tiny version without GUI` or `Huge version 241 | with GUI`. The obvious information from that is whether your Vim includes GUI 242 | support, e.g. for starting `gvim` from the shell or running `:gui` from Vim 243 | within a terminal emulator. The other important information is the `Tiny` and 244 | `Huge`. Vim distinguishes between feature sets called `tiny`, `small`, `normal`, 245 | `big`, and `huge`, all enabling different subsets of features. 246 | 247 | The majority of `:version` output is consumed by the feature list itself. 248 | `+clipboard` means the clipboard feature was compiled in, `-clipboard` means it 249 | wasn't compiled in. 250 | 251 | A few Vim features need to be compiled in for them to work. E.g. for `:prof` to 252 | work, you need a Vim with a huge feature set, because that set enables the 253 | `+profile` feature. 254 | 255 | If that's not the case and you installed Vim from a package manager, make sure 256 | to install a package called `vim-x`, `vim-x11`, `vim-gtk`, `vim-gnome` or 257 | similar, since these packages usually come with the huge feature set. 258 | 259 | You can also test for the version or features programmatically: 260 | 261 | ```vim 262 | " Do something if running at least Vim 7.4.42 with +profile enabled. 263 | if (v:version > 704 || v:version == 704 && has('patch42')) && has('profile') 264 | " do stuff 265 | endif 266 | ``` 267 | 268 | Help: 269 | 270 | ``` 271 | :h :version 272 | :h feature-list 273 | :h +feature-list 274 | :h has-patch 275 | ``` 276 | 277 | ## Cheatsheets 278 | 279 | - http://people.csail.mit.edu/vgod/vim/vim-cheat-sheet-en.png 280 | - https://cdn.shopify.com/s/files/1/0165/4168/files/preview.png 281 | - http://www.nathael.org/Data/vi-vim-cheat-sheet.svg 282 | - http://michael.peopleofhonoronly.com/vim/vim_cheat_sheet_for_programmers_screen.png 283 | - http://www.rosipov.com/images/posts/vim-movement-commands-cheatsheet.png 284 | 285 | Or quickly open a cheatsheet from within Vim: [vim-cheat40](https://github.com/lifepillar/vim-cheat40). 286 | 287 | # Basics 288 | 289 | ## Buffers, windows, tabs 290 | 291 | Vim is a text editor. Every time text is shown, the text is part of a 292 | **buffer**. Each file will be opened in its own buffer. Plugins show stuff in 293 | their own buffers etc. 294 | 295 | Buffers have many attributes, e.g. whether the text it contains is modifiable, 296 | or whether it is associated with a file and thus needs to be synchronized to 297 | disk on saving. 298 | 299 | **Windows** are viewports _onto_ buffers. If you want to view several files at 300 | the same time or even different locations of the same file, you use windows. 301 | 302 | And please, please don't call them _splits_. You can split a window in two, but 303 | that doesn't make them _splits_. 304 | 305 | Windows can be split vertically or horizontally and the heights and widths of 306 | existing windows can be altered, too. Therefore, you can use whatever window 307 | layout you prefer. 308 | 309 | A **tab page** (or just tab) is a collection of windows. Thus, if you want to 310 | use multiple window layouts, use tabs. 311 | 312 | Putting it in a nutshell, if you start Vim without arguments, you'll have one 313 | tab page that holds one window that shows one buffer. 314 | 315 | By the way, the buffer list is global and you can access any buffer from any 316 | tab. 317 | 318 | ## Active, loaded, listed, named buffers 319 | 320 | Run Vim like this `vim file1`. The file's content will be loaded into a buffer. 321 | You have a **loaded buffer** now. The content of the buffer is only synchronized 322 | to disk (written back to the file) if you save it within Vim. 323 | 324 | Since the buffer is also shown in a window, it's also an **active buffer**. Now 325 | if you load another file via `:e file2`, `file1` will become a **hidden buffer** 326 | and `file2` the active one. 327 | 328 | Both buffers are also **listed**, thus they will get listed in the output of 329 | `:ls`. Plugin buffers or help buffers are often marked as unlisted, since 330 | they're not regular files you usually edit with a text editor. Listed and 331 | unlisted buffers can be shown via `:ls!`. 332 | 333 | **Unnamed buffers**, also often used by plugins, are buffers that don't have an 334 | associated filename. E.g. `:enew` will create an unnamed scratch buffer. Add 335 | some text and write it to disk via `:w /tmp/foo`, and it will become a named 336 | buffer. 337 | 338 | ## Argument list 339 | 340 | The [global buffer list](#buffers-windows-tabs) is a Vim thing. Before that, in 341 | vi, there only used to be the argument list, which is also available in Vim. 342 | 343 | Every filename given to Vim on the shell command-line, is remembered in the 344 | argument list. There can be multiple argument lists: by default all arguments 345 | are put into the global argument list, but you can use `:arglocal` to create a 346 | new argument list that is local to the window. 347 | 348 | List the current arguments with `:args`. Switch between files from the argument 349 | list with `:next`, `:previous`, `:first`, `:last` and friends. Alter it with 350 | `:argadd`, `:argdelete` or `:args` with a list of files. 351 | 352 | If you should prefer using the buffer or argument list for working with files is 353 | a matter of taste. My impression is that most people use the buffer list 354 | exclusively. 355 | 356 | Nevertheless, there is one huge use case for the argument list: batch processing 357 | via `:argdo`! A simple refactoring example: 358 | 359 | ```vim 360 | :args **/*.[ch] 361 | :argdo %s/foo/bar/ge | update 362 | ``` 363 | 364 | This replaces all occurrences of "foo" by "bar" in all C source and header files 365 | from the current directory and below. 366 | 367 | Help: `:h argument-list` 368 | 369 | ## Mappings 370 | 371 | You can define your own mappings with the `:map` family of commands. Each 372 | command of that family defines a mapping for a certain set of modes. Technically 373 | Vim comes with a whopping 12 modes, 6 of them can be mapped. Additionally, some 374 | commands act on multiple modes at once. 375 | 376 | | Recursive | Non-recursive | Unmap | Modes | 377 | |-----------|---------------|-----------|----------------------------------| 378 | | `:map` | `:noremap` | `:unmap` | normal, visual, operator-pending | 379 | | `:nmap` | `:nnoremap` | `:nunmap` | normal | 380 | | `:xmap` | `:xnoremap` | `:xunmap` | visual | 381 | | `:cmap` | `:cnoremap` | `:cunmap` | command-line | 382 | | `:omap` | `:onoremap` | `:ounmap` | operator-pending | 383 | | `:imap` | `:inoremap` | `:iunmap` | insert | 384 | 385 | E.g. this defines the mapping for normal mode only: 386 | 387 | ```vim 388 | :nmap :echo "foo" 389 | ``` 390 | 391 | Unmap it again by using `:nunmap `. 392 | 393 | For a few more but rather uncommon modes (or combinations of them), see `:h 394 | map-modes`. 395 | 396 | So far, so good. There's only one problem that can be pretty confusing to 397 | beginners: `:nmap` is _recursive_! That is, the right-hand side takes other 398 | mappings into account. 399 | 400 | So you defined a mapping that simply echoes "Foo": 401 | 402 | ```vim 403 | :nmap b :echo "Foo" 404 | ``` 405 | 406 | But what if you want to map the default behavior of `b` (going one word back) to 407 | another key? 408 | 409 | ```vim 410 | :nmap a b 411 | ``` 412 | 413 | If you hit a, we expect the cursor to go back a word, but instead 414 | "Foo" is printed in the command-line! Because the right-hand side, `b`, was 415 | mapped to another action already, namely `:echo "Foo"`. 416 | 417 | The proper way to resolve this problem is to use a _non-recursive_ mapping 418 | instead: 419 | 420 | ```vim 421 | :nnoremap a b 422 | ``` 423 | 424 | Rule of thumb: Always use non-recursive mappings unless recursing is actually 425 | desired. 426 | 427 | Look up your mappings by not giving a right-hand side. E.g. `:nmap` shows all 428 | normal mappings and `:nmap ` shows all normal mappings that start with 429 | the mapleader. 430 | 431 | If you want to disable a standard mapping, map them to the special `` 432 | character, e.g. `:noremap `. 433 | 434 | Help: 435 | 436 | :h key-notation 437 | :h mapping 438 | :h 05.3 439 | 440 | ## Mapleader 441 | 442 | The mapleader is simply a placeholder than can be used with custom mappings and 443 | is set to `\` by default. 444 | 445 | ```vim 446 | nnoremap h :helpgrep 447 | ``` 448 | 449 | This mapping is triggered by `\h`. If you want to use `h` instead: 450 | 451 | ```vim 452 | let mapleader = ' ' 453 | nnoremap h :helpgrep 454 | ``` 455 | 456 | Moreover, there is `` that is the local counterpart to `` 457 | and is supposed to be used for mappings that are local to the buffer, eg. 458 | filetype-specific plugins. It also defaults to `\`. 459 | 460 | **Note**: Set the mapleaders before mappings! All leader mappings that are in 461 | effect already, won't change just because the mapleader was changed. `:nmap 462 | ` will show all normal mode leader mappings with the mapleader resolved 463 | already, so use it to double-check your mappings. 464 | 465 | See `:h mapleader` and `:h maplocalleader` for more. 466 | 467 | ## Registers 468 | 469 | Registers are slots that save text. Copying text into a register is called 470 | **yanking** and extracting text from a register is called **pasting**. 471 | 472 | Vim provides the following registers: 473 | 474 | | Type | Character | Filled by? | Readonly? | Contains text from? | 475 | |---------------------|------------------------|------------|-----------|---------------------| 476 | | Unnamed | `"` | vim | [ ] | Last yank or deletion. (`d`, `c`, `s`, `x`, `y`) | 477 | | Numbered | `0` to `9` | vim | [ ] | Register `0`: Last yank. Register `1`: Last deletion. Register `2`: Second last deletion. And so on. Think of registers `1`-`9` as a read-only [queue](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) with 9 elements. | 478 | | Small delete | `-` | vim | [ ] | Last deletion that was less than one line. | 479 | | Named | `a` to `z`, `A` to `Z` | user | [ ] | If you yank to register `a`, you replace its text. If you yank to register `A`, you append to the text in register `a`. | 480 | | Read-only | `:`, `.`, `%` | vim | [x] | `:`: Last command, `.`: Last inserted text, `%`: Current filename. | 481 | | Alternate buffer | `#` | vim | [ ] | Most of the time the previously visited buffer of the current window. See `:h alternate-file` | 482 | | Expression | `=` | user | [ ] | Evaluation of the VimL expression that was yanked. E.g. do this in insert mode: `=5+5` and "10" will be inserted in the buffer. | 483 | | Selection | `+`, `*` | vim | [ ] | `*` and `+` are the [clipboard](#clipboard) registers. | 484 | | Drop | `~` | vim | [x] | From last drag'n'drop. | 485 | | Black hole | `_` | vim | [ ] | If you don't want any other registers implicitly affected. E.g. `"_dd` deletes the current line without affecting registers `"`, `1`, `+`, `*`. | 486 | | Last search pattern | `/` | vim | [ ] | Last pattern used with `/`, `?`, `:global`, etc. | 487 | 488 | Each register that is not readonly can be set by the user: 489 | 490 | ```vim 491 | :let @/ = 'register' 492 | ``` 493 | 494 | Afterwards n would jump to the next occurrence of "register". 495 | 496 | There are numerous exceptions when registers get implicitly filled, so be sure 497 | to read `:h registers`. 498 | 499 | Yank with `y` and paste with `p`/`P`, but mind that Vim distinguishes between 500 | characterwise and linewise visual selections. See `:h linewise`. 501 | 502 | **Example: linewise** 503 | 504 | `yy` (or just `Y`) yanks the current line, move the cursor somewhere else, use 505 | `p` to paste below the current line `P` for pasting above it. 506 | 507 | **Example: charwise** 508 | 509 | Yank the first word with `0yw`, move somewhere else, paste after the cursor on 510 | the current line with `p` and before the cursor with `P`. 511 | 512 | **Example: explicit naming of register** 513 | 514 | `"aY` yanks the current line into register `a`. Move to another line. `"AY` 515 | appends the current line to register `a`. 516 | 517 | I suggest playing around with all these registers a bit and constantly checking 518 | `:reg`, so you can see what's actually happening. 519 | 520 | **Fun fact**: In Emacs "yanking" stands for pasting (or _reinserting previously 521 | killed text_) not copying. 522 | 523 | ## Ranges 524 | 525 | Ranges are pretty easy to understand, but many Vimmers don't know about their 526 | full potential. 527 | 528 | - Many commands take ranges. 529 | - An address denotes a certain line. 530 | - A range is either a single address or a pair of addresses separated by either 531 | `,` or `;`. 532 | - Ranges tell commands which lines to act on. 533 | - Most commands act only on the current line by default. 534 | - Only `:write` and `:global` act on all lines by default. 535 | 536 | The usage of ranges is pretty intuitive, so here are some examples (using `:d` 537 | as short form of `:delete`): 538 | 539 | | Command | Lines acted on | 540 | |---------|----------------| 541 | | `:d` | Current line. | 542 | | `:.d` | Current line. | 543 | | `:1d` | First line. | 544 | | `:$d` | Last line. | 545 | | `:1,$d` | All lines. | 546 | | `:%d` | All lines (syntactic sugar for `1,$`). | 547 | | `:.,5d` | Current line to line 5. | 548 | | `:,5d` | Also current line to line 5. | 549 | | `:,+3d` | Current line and the next 3 lines. | 550 | | `:1,+3d` | First line to current line + 3. | 551 | | `:,-3d` | Current line and the last 3 lines. (Vim will prompt you, since this is a reversed range.) | 552 | | `:3,'xdelete` | Lines 3 to the line marked by [mark](#marks) x. | 553 | | `:/^foo/,$delete` | From the next line that starts with "foo" to the end. | 554 | | `:/^foo/+1,$delete` | From the line after the line that starts with "foo" to the end. | 555 | 556 | Note that instead of `,`, `;` can be used as a separator. The difference is that 557 | in the case of `from,to`, the _to_ is relative to the current line, but when 558 | using `from;to`, the _to_ is relative to the address of _from_! Assuming you're 559 | on line 5, `:1,+1d` would delete lines 1 to 6, whereas `:1;+1d` would only 560 | delete lines 1 and 2. 561 | 562 | The `/` address can be preceded with another address. This allows you to _stack_ 563 | patterns, e.g.: 564 | 565 | ```vim 566 | :/foo//bar//quux/d 567 | ``` 568 | 569 | This would delete the first line containing "quux" after the first line 570 | containing "bar" after the first line containing "foo" after the current line. 571 | 572 | Sometimes Vim automatically prepends the command-line with a range. E.g. start a 573 | visual line selection with `V`, select some lines and type `:`. The command-line 574 | will be populated with the range `'<,'>`, which means the following command will 575 | use the previously selected lines as a range. (This is also why you sometimes 576 | see mappings like `:vnoremap foo :command`. Here `` is used to remove 577 | the range, because Vim will throw an error when giving a range to a command that 578 | doesn't support it.) 579 | 580 | Another example is using `!!` in normal mode. This will populate the 581 | command-line with `:.!`. If followed by an external program, that program's 582 | output would replace the current line. So you could replace the current 583 | paragraph with the output of ls by using `:?^$?+1,/^$/-1!ls`. Fancy! 584 | 585 | Help: 586 | 587 | ``` 588 | :h cmdline-ranges 589 | :h 10.3 590 | ``` 591 | 592 | ## Marks 593 | 594 | You use marks to remember a position, that is line number and column, in a file. 595 | 596 | | Marks | Set by.. | Usage | 597 | |-------|----------|-------| 598 | | `a` - `z` | User | Local to file, thus only valid within one file. Jumping to a lowercase mark, means jumping within the current file. | 599 | | `A` - `Z` | User | Global, thus valid between files. Also called _file marks_. Jumping to a file mark may switch to another buffer. | 600 | | `0` - `9` | viminfo | `0` is the position when the viminfo file was written last. In practice this means when the last Vim process ended. `1` is the position of when the second last Vim process ended and so on. | 601 | 602 | Put `'`/`g'` or `` ` ``/`` g` `` in front of a mark to form a motion. 603 | 604 | Use `mm` to remember the current position with mark "m". Move around the file 605 | and then jump back via `'m` (first non-blank) or `` `m `` (exact column). 606 | Lowercase marks will be remembered after exiting Vim, if you tell your viminfo 607 | file to do so, see `:h viminfo-'`. 608 | 609 | Use `mM` to remember the current position with file mark "M". Switch to another 610 | buffer and switch back via `'M` or `` `M ``. 611 | 612 | Other motions include: 613 | 614 | | Motion | Jump to.. | 615 | |------------------|-----------| 616 | | `'[`, `` `[ `` | First line or character of previously changed or yanked text. | 617 | | `']`, `` `] `` | Last line or character of previously changed or yanked text. | 618 | | `'<`, `` `< `` | Beginning line or character of last visual selection. | 619 | | `'>`, `` `> `` | Ending line or character of last visual selection. | 620 | | `''`, ``` `` ``` | Position before the latest jump. | 621 | | `'"`, `` `" `` | Position when last exiting the current buffer. | 622 | | `'^`, `` `^ `` | Position where last insertion stopped. | 623 | | `'.`, `` `. `` | Position where last change was made. | 624 | | `'(`, `` `( `` | Start of current sentence. | 625 | | `')`, `` `) `` | End of current sentence. | 626 | | `'{`, `` `{ `` | Start of current paragraph. | 627 | | `'}`, `` `} `` | End of current paragraph. | 628 | 629 | Marks can also be used in a [range](#ranges). You probably saw this before and 630 | wondered what it means: Select some text in visual mode and do `:`, the 631 | command-line will be prepended with `:'<,'>`, which means the following command 632 | would get a range that denotes the visual selection. 633 | 634 | Use `:marks` to list all marks. Read everything in `:h mark-motions`. 635 | 636 | ## Completion 637 | 638 | Vim provides many kinds of insert mode completions. If there are multiple 639 | matches, a popup menu will let you navigate to the match of your choice. 640 | 641 | Typical kinds of completion are tags, functions from imported modules or 642 | libraries, file names, dictionary or simply words from the current buffer. 643 | 644 | Vim provides a mapping for each kind of completion and they all start with 645 | `` (remember to use them in insert mode): 646 | 647 | | Mapping | Kind | Help | 648 | |---------|------|--------------| 649 | | `` | whole lines | `:h i^x^l` | 650 | | `` | keywords from current file | `:h i^x^n` | 651 | | `` | keywords from `'dictionary'` option | `:h i^x^k` | 652 | | `` | keywords from `'thesaurus'` option | `:h i^x^t` | 653 | | `` | keywords from current and included files | `:h i^x^i` | 654 | | `` | tags | `:h i^x^]` | 655 | | `` | file names | `:h i^x^f` | 656 | | `` | definitions or macros | `:h i^x^d` | 657 | | `` | Vim commands | `:h i^x^v` | 658 | | `` | user defined (as specified in `'completefunc'`) | `:h i^x^u` | 659 | | `` | omni completion (as specified in `'omnifunc'`) | `:h i^x^o` | 660 | | `s` | spelling suggestions | `:h i^Xs` | 661 | 662 | People might be confused about the difference between user defined completion 663 | and omni completion, but technically they do the same thing. They take a 664 | function that inspects the current position and return a list of suggestions. 665 | User defined completion is defined by the user for their own personal purposes. 666 | (Surprise!) It could be anything. Omni completion is meant for filetype-specific 667 | purposes, like completing struct members or class methods, and is often set by 668 | filetype plugins. 669 | 670 | Vim also allows for completing multiple kinds at once by setting the 671 | `'complete'` option. By default that option includes quite a lot, so be sure to 672 | trim it to your taste. You can trigger this completion by using either `` 673 | (next) and `` (previous), which also happen to be the keys used for 674 | choosing entries in the popup menu. See `:h i^n` and `:h 'complete'` for more on 675 | this. 676 | 677 | Be sure to check out `:h 'completeopt'` for configuring the behaviour of the 678 | popup menu. The default is quite sane, but I prefer adding "noselect" as well. 679 | 680 | Help: 681 | 682 | ``` 683 | :h ins-completion 684 | :h popupmenu-keys 685 | :h new-omni-completion 686 | ``` 687 | 688 | ## Motions, operators, text objects 689 | 690 | **Motions** move the cursor. You all know `h`/`j`/`k`/`l`. Or `w` and `b`. Even 691 | `/` is a motion. They also take a count. `2?the` jumps to the second last 692 | occurrence of "the". 693 | 694 | See `:h navigation` and everything below for all available motions. 695 | 696 | **Operators** act on a region of text, e.g. `d`, `~`, `gU`, `>` to name just a 697 | few. They get used in two contexts, either in normal or visual mode. In normal 698 | mode, operators come first followed by a motion, e.g. `>j`. In visual mode, 699 | operators simply act on the selection, e.g. `Vjd`. 700 | 701 | Like motions, operators take a count, e.g. `2gUw` makes the rest of the current 702 | word and the next one uppercase. Since motions and operators take counts, 703 | `2gU2w` works just as well and executes `gU2w` twice. 704 | 705 | See `:h operator` for all available operators. Use `:set tildeop` to make `~` 706 | act as an operator. 707 | 708 | **Text objects** act on the surrounding area, opposed to motions that act into 709 | one direction. Actually they work on objects, e.g. a whole word, a whole 710 | sentence, everything between parentheses, and so on. 711 | 712 | Text objects can't be used to move the cursor in normal mode, because even the 713 | most-skilled cursors can't jump into two directions at the same time. It works 714 | in visual mode though, because then one side of the object is already selected 715 | and the cursor simply jumps to the other side. 716 | 717 | Text objects start with either `i` (think _inner_) or `a` (think _around_) 718 | followed by a character denoting the object. With `i` it only acts on the object 719 | itself, with `a` on the object plus trailing whitespace. E.g. `diw` deletes the 720 | current word and `ci(` changes everything between parentheses. 721 | 722 | Text objects take a count. Imagine `((( )))` and the cursor on or between the 723 | most inner parentheses, then `d2a(` will remove the 2 inner pairs of parentheses 724 | and everything in between. 725 | 726 | See `:h text-objects` for all available text objects. 727 | 728 | ## Autocmds 729 | 730 | On many occasions, Vim emits events. You hook into these events by using 731 | autocmds. 732 | 733 | You wouldn't use Vim if there weren't autocmds. They're used all the time, even 734 | if you don't notice it. Don't believe me? Check `:au`, but don't let the output 735 | overwhelm you. These are all the autocmds that are in effect right now! 736 | 737 | See `:h {event}` for a quick overview of all available events and `:h 738 | autocmd-events-abc` for more details. 739 | 740 | A typical example would be setting filetype-specific settings: 741 | 742 | ```vim 743 | autocmd FileType ruby setlocal shiftwidth=2 softtabstop=2 comments-=:# 744 | ``` 745 | 746 | But how does a buffer even know that it contains Ruby code? Because another 747 | autocmd detected it as that and set the filetype accordingly which again 748 | triggered the `FileType` event. 749 | 750 | One of the first things everyone adds to their vimrc is `filetype on`. This 751 | simply means that `filetype.vim` is read at startup which sets autocmds for 752 | almost all filetypes under the sun. 753 | 754 | If you're brave enough, have a look at it: `:e $VIMRUNTIME/filetype.vim`. Search 755 | for "Ruby" and you'll find that Vim simply uses the file extension `.rb` to 756 | detect Ruby files: 757 | 758 | **NOTE**: Autocmds of the same event are executed in the order they were 759 | created. `:au` shows them in the correct order. 760 | 761 | ```vim 762 | au BufNewFile,BufRead *.rb,*.rbw setf ruby 763 | ``` 764 | 765 | The `BufNewFile` and `BufRead` events in this case are hardcoded in the C 766 | sources of Vim and get emitted everytime you open a file via `:e` and similar 767 | commands. Afterwards all the hundreds of filetypes from `filetype.vim` are 768 | tested for. 769 | 770 | Putting it in a nutshell, Vim makes heavy use of events and autocmds but also 771 | exposes a clean interface to hook into that event-driven system for 772 | customization. 773 | 774 | Help: `:h autocommand` 775 | 776 | ## Changelist, jumplist 777 | 778 | The positions of the last 100 changes are kept in the **changelist**. Several 779 | small changes on the same line will be merged together, but the position will be 780 | that of the last change nevertheless (in case you added something in the middle 781 | of the line). 782 | 783 | Every time you jump, the position _before_ the jump is remembered in the 784 | **jumplist**. A jumplist has up to 100 entries. Each window has its own 785 | jumplist. When you split a window, the jumplist is copied. 786 | 787 | A jump is one of the following commands: `'`, `` ` ``, `G`, `/`, `?`, `n`, `N`, 788 | `%`, `(`, `)`, `[[`, `]]`, `{`, `}`, `:s`, `:tag`, `L`, `M`, `H` and commands 789 | that start editing a new file. 790 | 791 | | List | List all entries | Go to older position | Go to newer position | 792 | |------------|------------------|----------------------|----------------------| 793 | | jumplist | `:jumps` | `[count]` | `[count]` | 794 | | changelist | `:changes` | `[count]g;` | `[count]g,` | 795 | 796 | When you list all entries, a marker `>` will be used to show the current 797 | position. Usually that will be below position 1, the latest position. 798 | 799 | If you want both lists to persist after restarting Vim, you need to use the 800 | viminfo file and `:h viminfo-'`. 801 | 802 | **NOTE**: The position before the latest jump is also kept as a [mark](#marks) 803 | and can be jumped to via ``` `` ``` or `''`. 804 | 805 | Help: 806 | 807 | ``` 808 | :h changelist 809 | :h jumplist 810 | ``` 811 | 812 | ## Undo tree 813 | 814 | The latest changes to the text state are remembered. You can use _undo_ to 815 | revert changes and _redo_ to reapply previously reverted changes. 816 | 817 | The important bit to understand it that the data structure holding recent 818 | changes is not a 819 | [queue](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) but a 820 | [tree](https://en.wikipedia.org/wiki/Tree_(data_structure))! Your changes are 821 | nodes in the tree and each (but the top node) has a parent node. Each node keeps 822 | information about the changed text and time. A branch is a series of nodes that 823 | starts from any node and goes up to the top node. New branches get created when 824 | you undo a change and then insert something else. 825 | 826 | ``` 827 | ifoo 828 | obar 829 | obaz 830 | u 831 | oquux 832 | ``` 833 | 834 | Now you have 3 lines and the undo tree looks like this: 835 | 836 | ``` 837 | foo(1) 838 | / 839 | bar(2) 840 | / \ 841 | baz(3) quux(4) 842 | ``` 843 | 844 | The undo tree has 4 changes. The numbers represent the _time_ the nodes were 845 | created. 846 | 847 | Now there are two ways to traverse this tree, let's call them _branch-wise_ and 848 | _time-wise_. 849 | 850 | Undo (`u`) and redo (``) work branch-wise. They go up and down the current 851 | branch. `u` will revert the text state to the one of node "bar". Another `u` 852 | will revert the text state even further, to the one of node "foo". Now `` 853 | goes back to the state of node "bar" and another `` to the state of node 854 | "quux". (There's no way to reach node "baz" using branch-wise commands anymore.) 855 | 856 | Opposed to this, `g-` and `g+` work time-wise. Thus, `g-` won't revert to the 857 | state of node "bar", like `u` does, but to the chronologically previous state, 858 | node "baz". Another `g-` would revert the state to the one of node "bar" and so 859 | on. Thus, `g-` and `g+` simply go back and forth in time, respectively. 860 | 861 | | Command / Mapping | Action | 862 | |-------------------|--------| 863 | | `[count]u`, `:undo [count]` | Undo [count] changes. | 864 | | `[count]`, `:redo` | Redo [count] changes. | 865 | | `U` | Undo all changes to the line of the latest change. | 866 | | `[count]g-`, `:earlier [count]?` | Go to older text state [count] times. The "?" can be either "s", "m", "h", "d", or "f". E.g. `:earlier 2d` goes to the text state from 2 days ago. `:earlier 1f` will go to the state of the latest file save. | 867 | | `[count]g+`, `:later [count]?` | Same as above, but other direction. | 868 | 869 | The undo tree is kept in memory and will be lost when Vim quits. See [Handling 870 | backup, swap, undo, and viminfo 871 | files](#handling-backup-swap-undo-and-viminfo-files) for how to enable 872 | persistent undo. 873 | 874 | If you're confused by the undo tree, 875 | [undotree](https://github.com/mbbill/undotree) does a great job at visualizing 876 | it. 877 | 878 | Help: 879 | 880 | ``` 881 | :h undo.txt 882 | :h usr_32 883 | ``` 884 | 885 | ## Quickfix and location lists 886 | 887 | Every time an action has to return a list of locations, _quickfix_ or _location_ 888 | lists can be used. In this case a location is a file, a line number and 889 | optionally a column. 890 | 891 | Examples are compiler errors assembled in a quickfix list or matches of an 892 | external grep tool assembled in a location list. 893 | 894 | The big advantage over just putting that stuff in an empty buffer is that you 895 | get a nice uniform interface for browsing the entries. 896 | 897 | At all time there's only one quickfix list, but every window can have its own 898 | location list. Both type of lists _feel_ the same, but use slightly different 899 | commands for navigation. 900 | 901 | Most common commands: 902 | 903 | | Action | Quickfix | Location | 904 | |----------------|--------------|--------------| 905 | | open window | `:copen` | `:lopen` | 906 | | close window | `:cclose` | `:lclose` | 907 | | next entry | `:cnext` | `:lnext` | 908 | | previous entry | `:cprevious` | `:lprevious` | 909 | | first entry | `:cfirst` | `:lfirst` | 910 | | last entry | `:clast` | `:llast` | 911 | 912 | See `:h :cc` and everything below for all commands. 913 | 914 | **Example**: 915 | 916 | Let's use our good old friend `grep` for searching the files in the current 917 | directory recursively for a certain query and put the results in the quickfix 918 | list. 919 | 920 | ```vim 921 | :let &grepprg = 'grep -Rn $* .' 922 | :grep! foo 923 | 924 | :copen 925 | ``` 926 | 927 | Assuming any files contained the string "foo", it should be shown now in the 928 | quickfix window. 929 | 930 | ## Macros 931 | 932 | Vim allows _recording_ typed characters into a [register](#registers). It's a 933 | great way to automate certain tasks on the fly. (For more elaborate tasks, [Vim 934 | scripting](#vim-scripting) should be used instead.) 935 | 936 | - Start recording by typing `q` followed by the register, e.g. `q`. (The 937 | command-line will signify this via "recording @q".) 938 | - Stop recording by hitting `q` once again. 939 | - Execute the macro via `[count]@q`. 940 | - Repeat the last used macro via `[count]@@`. 941 | 942 | **Example 1:** 943 | 944 | Insert a line and repeat it 10 times: 945 | 946 | ``` 947 | qq 948 | iabc 949 | q 950 | 10@q 951 | ``` 952 | 953 | (The same could be done without macros: `oabc10.`) 954 | 955 | **Example 2:** 956 | 957 | For adding line numbers in front of all lines, start on the first line and add 958 | "1. " to it manually. Increment the number under the cursor by using ``, 959 | displayed as `^A`. 960 | 961 | ``` 962 | qq 963 | 0yf jP0^A 964 | q 965 | 1000@q 966 | ``` 967 | 968 | Here we simply hope that the file doesn't contain more than 1000 lines when 969 | using `1000@q`, but we can also use a _recursive macro_, which executes until 970 | the macro can't be applied to a line anymore: 971 | 972 | ``` 973 | qq 974 | 0yf jP0^A@q 975 | q 976 | @q 977 | ``` 978 | 979 | (The same could be done without macros: `:%s/^/\=line('.') . '. '`) 980 | 981 | Mind that I also show how to achieve the same without using macros, but this 982 | mostly works only for such simple examples. For more complex automation, macros 983 | are the bomb! 984 | 985 | Also see: [Quickly edit your macros](#quickly-edit-your-macros) 986 | 987 | Help: 988 | 989 | ``` 990 | :h recording 991 | :h 'lazyredraw' 992 | ``` 993 | 994 | ## Colorschemes 995 | 996 | Colorschemes are the way to style your Vim. Vim consists of many components and 997 | each of those can be customized with different colors for the foreground, 998 | background and a few other attributes like bold text etc. They can be set like 999 | this: 1000 | 1001 | ```vim 1002 | :highlight Normal ctermbg=1 guibg=red 1003 | ``` 1004 | 1005 | This would paint the background of the editor red. See `:h :highlight` for more 1006 | information. 1007 | 1008 | So, colorschemes are mostly collections of `:highlight` commands. 1009 | 1010 | Actually, most colorschemes are really 2 colorschemes! The example above sets 1011 | colors via `ctermbg` and `guibg`. The former definition (`cterm*`) will only be 1012 | used if Vim was started in a terminal emulator, e.g. xterm. The latter (`gui*`) 1013 | will be used in graphical environments like gvim or MacVim. 1014 | 1015 | If you ever happen to use a colorscheme in terminal Vim and the colors don't 1016 | look like the ones in the screenshot at all, chances are that the colorscheme 1017 | only defines colors for the GUI. Conversely, if you use a graphical Vim (e.g. 1018 | gvim or MacVim) and the colors look off, the colorscheme might only define 1019 | colors for the terminal. 1020 | 1021 | The latter case can be "solved" by enabling true colors in Neovim or Vim 1022 | 7.4.1830 and newer. This makes terminal Vim use the GUI definitions instead, but 1023 | also requires the terminal emulator itself and all software in between (e.g. 1024 | tmux) to be capable of handling true colors. ([This 1025 | gist](https://gist.github.com/XVilka/8346728) gives a good overview about the 1026 | topic.) 1027 | 1028 | Help: 1029 | 1030 | - `:h 'termguicolors'` 1031 | - [List of colorschemes](#list-of-colorschemes-1) 1032 | - [Cosmetic changes to colorschemes](#cosmetic-changes-to-colorschemes) 1033 | 1034 | ## Folding 1035 | 1036 | Every text (or source code) has a certain structure. If you have a structure, it 1037 | means you have regions of logically separated text. Folding allows to "fold" 1038 | such a region into a single line and displaying a short description. There are 1039 | many commands that act on these regions called _folds_. Folds can be nested. 1040 | 1041 | Vim distinguishes between several types of fold methods: 1042 | 1043 | | 'foldmethod' | Usage | 1044 | |--------------|-------| 1045 | | diff | Used in diff windows to fold unchanged text. | 1046 | | expr | Uses `'foldexpr'` to basically create a new fold method. | 1047 | | indent | Folds based on indentation. | 1048 | | manual | Create folds yourself via `zf`, `zF`, and `:fold`. | 1049 | | marker | Folds based on markers in the text (often in comments). | 1050 | | syntax | Folds based on syntax, e.g. folding `if` blocks. | 1051 | 1052 | **NOTE**: Folding can be computationally intensive! If you experience any 1053 | performance drawbacks (small delays when typing), have a look at 1054 | [FastFold](https://github.com/Konfekt/FastFold), which prevents Vim from 1055 | updating folds when it's not needed. 1056 | 1057 | Help: 1058 | 1059 | ``` 1060 | :h usr_28 1061 | :h folds 1062 | ``` 1063 | 1064 | ## Sessions 1065 | 1066 | If you save a **view** (`:h :mkview`), the current state of the window (and 1067 | options and mappings) gets saved for later use (`:h :loadview`). 1068 | 1069 | A **session** saves the views of all windows plus global settings. It basically 1070 | makes a snapshot of your current Vim instance and saves it in a session file. 1071 | Let me stress this: it saves the current state; everything done after saving a 1072 | session won't be part of the session file. To "update" a session, simply write 1073 | it out again. 1074 | 1075 | This makes it perfect for saving your _projects_ and easy to switch between 1076 | them. 1077 | 1078 | Try it right now! Open a few windows and tabs and do `:mksession Foo.vim`. If 1079 | you omit the filename, `Session.vim` will be assumed. The file will be saved to 1080 | the current working directory, check `:pwd`. Restart Vim and do `:source 1081 | Foo.vim` and voilà, the buffer list, window layout, mappings, working directory 1082 | etc. should all be the same as before you saved the session. Do some more work 1083 | and update the session by overwriting the already existing session file with 1084 | `:mksession! Foo.vim`. 1085 | 1086 | Note that a session file is really just a collection of Vim commands that are 1087 | supposed to restore a certain state of a Vim instance, so feel free to take a 1088 | look at it: `:vs Foo.vim`. 1089 | 1090 | You can tell Vim what things to save in a session by setting `'sessionoptions'`. 1091 | 1092 | For scripting purposes Vim keeps the name of the last sourced or written session 1093 | in the internal variable `v:this_session`. 1094 | 1095 | Help: 1096 | 1097 | ``` 1098 | :h Session 1099 | :h 'sessionoptions' 1100 | :h v:this_session 1101 | ``` 1102 | 1103 | ## Locality 1104 | 1105 | Many of the concepts mentioned above also have _local_ counterparts: 1106 | 1107 | | Global | Local | Scope | Help | 1108 | |--------|-------|-------|------| 1109 | | `:set` | `:setlocal` | buffer or window | `:h local-options` | 1110 | | `:map` | `:map ` | buffer | `:h :map-local` | 1111 | | `:autocmd` | `:autocmd * ` | buffer | `:h autocmd-buflocal` | 1112 | | `:cd` | `:lcd` | window | `:h :lcd` | 1113 | | `` | `` | buffer | `:h maplocalleader` | 1114 | 1115 | Variables also sport different scopes, but will be explained in 1116 | [Vim scripting](#vim-scripting). 1117 | 1118 | # Usage 1119 | 1120 | ## Getting help offline 1121 | 1122 | Vim comes with great documentation in the form of single text files with a 1123 | special layout. Vim uses a system based on tags for accessing certain parts of 1124 | those help files. 1125 | 1126 | First of all, read this: `:help :help`. This will open the file 1127 | `$VIMRUNTIME/doc/helphelp.txt` in a new window and jump to the `:help` tag 1128 | within that file. 1129 | 1130 | A few simple rules: 1131 | 1132 | - options are enclosed in single quotes, e.g. `:h 'textwidth'` 1133 | - VimL functions end in (), e.g. `:h reverse()` 1134 | - commands start with :, e.g. `:h :echo` 1135 | 1136 | You can use `` (this is ctrl+d) to list all tags that 1137 | match the currently entered query. E.g. `:h tab` will get you a list of all 1138 | tags from `tab` over `'softtabstop'` to `setting-guitablabel`. 1139 | 1140 | You want to list all VimL functions? Simple: `:h ()`. You want to list all 1141 | VimL functions that concern windows? `:h win*()`. 1142 | 1143 | This quickly becomes second nature, but especially in the beginning, you 1144 | sometimes don't know any part of the tag you are looking for. You can only 1145 | imagine some keywords that could be involved. `:helpgrep` to the rescue! 1146 | 1147 | ``` 1148 | :helpgrep backwards 1149 | ``` 1150 | 1151 | This will look for "backwards" in all documentation files and jump to the first 1152 | match. The matches will be assembled in the quickfix list. Use `:cn`/`:cp` to 1153 | jump to the next/previous match. Or use `:copen` to open the quickfix window, 1154 | navigate to an entry and hit `` to jump to that match. See `:h quickfix` for 1155 | the whole truth. 1156 | 1157 | ## Getting help offline (alternative) 1158 | 1159 | This list was compiled by @chrisbra, one of the most active Vim developers, and 1160 | posted to [vim_dev](https://groups.google.com/forum/#!forum/vim_dev). 1161 | 1162 | It's reposted here with minor changes. 1163 | 1164 | --- 1165 | 1166 | If you know what you are looking for, it is usually easier to search for it 1167 | using the help system, because the subjects follow a certain style guide. 1168 | 1169 | Also, the help has the advantage of belonging to your particular Vim version, so 1170 | that obsolete topics or topics that have been added later won't turn up. 1171 | 1172 | Therefore, it is essential to learn the help system and the language it uses. 1173 | Here are some examples (not necessarily complete and I might have forgotten 1174 | something). 1175 | 1176 | 1. Options are enclosed in single quotes. So you would use `:h 'list'` to go to 1177 | the help topic for the list option. If you only know, you are looking for a 1178 | certain option, you can also do `:h options.txt` to open the help page which 1179 | describes all option handling and then you can search using regular 1180 | expressions e.g. `/width`. Certain options have their own namespace, e.g. `:h 1181 | cpo-a`, `:h cpo-A`, `:h cpo-b`, and so on. 1182 | 1183 | 2. Normal mode commands are just that. Use `:h gt` to go to the help page for 1184 | the "gt" command. 1185 | 1186 | 3. Regexp items always start with "/", so `:h /\+` takes you to the help item 1187 | for the "\+" quantifier in Vim regexes. If you need to know anything about 1188 | regular expressions, start reading at `:h pattern.txt`. 1189 | 1190 | 4. Key combinations. They usually start with a single letter indicating the mode 1191 | for which they can be used. E.g. `:h i_CTRL-X` takes you to the family of 1192 | CTRL-X commands for insert mode which can be used to auto complete different 1193 | things. Note that certain keys will always be written the same, e.g. Control 1194 | will always be CTRL. Note, for normal mode commands, the "n" is left away, 1195 | e.g. `:h CTRL-A`. In contrast, `:h c_CTRL-R` will describe what CTRL-R does 1196 | when entering commands in the command line and `:h v_Ctrl-A` talks about 1197 | incrementing numbers in visual mode and `:h g_CTRL-A` talks about the g 1198 | command (thus you have to press "g" then ). Here the "g" stand for 1199 | the normal command "g" which always expect a second key before doing 1200 | something similar to the commands starting with "z". 1201 | 1202 | 5. Registers always start with "quote" so use `:h quote` to find out about the 1203 | special ":" register. 1204 | 1205 | 6. Vim script (VimL) is available at `:h eval.txt`. Certain aspects of the 1206 | language are available at `:h expr-X` where 'X' is a single letter, e.g. `:h 1207 | expr-!` will take you to the topic describing the '!' (Not) operator for 1208 | VimL. Also important, see `:h function-list` to find a short description of 1209 | all functions available. 1210 | 1211 | 7. Mappings are talked about in the help page `:h map.txt`. Use `:h mapmode-i` 1212 | to find out about the `:imap` command. Also use `:map-topic` to find out 1213 | about certain subtopics particular for mappings (e.g. `:h :map-local` for 1214 | buffer-local mappings or `:h map_bar` for how the '|' is handled in mappings. 1215 | 1216 | 8. Command definitions are talked about at `:h command-*`, so use :h command-bar 1217 | to find out about the '!' argument for custom commands. 1218 | 1219 | 9. Window management commands always start with CTRL-W, so you find the 1220 | corresponding help at `:h CTRL-W_*` (e.g. `:h CTRL-W_p` for switch to the 1221 | previously accessed window). You can also access `:h windows.txt` and read 1222 | your way through, if you are looking for window handling command. 1223 | 1224 | 10. Ex commands always start with ":", so `:h :s` covers the ":s" command. 1225 | 1226 | 11. Use CTRL-D after typing a topic and let Vim try to complete to all available 1227 | topics. 1228 | 1229 | 12. Use `:helpgrep` to search in all help pages (usually also includes help 1230 | pages by installed plugins). See `:h :helpgrep` for how to use it. Once you 1231 | have searched for a topic, all matches are available in the quickfix (or 1232 | location) window which can be opened with `:copen` or `:lopen`. There you 1233 | can also use `/` to further filter the matches. 1234 | 1235 | 13. `:h helphelp` contains some information on how to use the help. 1236 | 1237 | 14. The user manual. This describes help topics for beginners in a rather 1238 | friendly way. Start at `:h usr_toc.txt` to find the table of content (as you 1239 | might have guessed). Skimming over that help to find certain topics, .e.g 1240 | you will find an entry "Digraphs" and "Entering special characters" in 1241 | chapter 24 (so use `:h usr_24.txt` to go to that particular help page). 1242 | 1243 | 15. Highlighting groups always start with `hl-*`. E.g. `:h hl-WarningMsg` talks 1244 | about the "WarningMsg" highlighting group. 1245 | 1246 | 16. Syntax highlighting is namespaced to ":syn-topic", e.g. `:h :syn-conceal` 1247 | talks about the conceal argument for the :syn command. 1248 | 1249 | 17. Quickfix commands usually start with ":c", while location list commands 1250 | usually start with ":l". 1251 | 1252 | 18. `:h BufWinLeave` talks about the BufWinLeave autocmd. Also, `:h 1253 | autocommands-events` talks about all possible events. 1254 | 1255 | 19. Startup arguments always start with "-", so `:h -f` takes you to the help of 1256 | the "-f" command switch of Vim. 1257 | 1258 | 20. Compiled extra features always start with "+", so `:h +conceal` talks about 1259 | the conceal support. 1260 | 1261 | 21. Error codes can be looked up directly in the help. `:h E297` takes you 1262 | exactly to the description of the error message. Sometimes however, those 1263 | error codes are not described, but rather are listed at the Vim command that 1264 | usually causes this. E.g. `:h hE128` takes you directly to the `:function` 1265 | command. 1266 | 1267 | 22. Documentation for included syntax files is usually available at `:h 1268 | ft-*-syntax`. E.g. `:h ft-c-syntax` talks about the C syntax file and the 1269 | options it provides. Sometimes, additional sections for omni completion (`:h 1270 | ft-php-omni`) or filetype plugins (`:h ft-tex-plugin`) are available. 1271 | 1272 | Also, a link to the user documentation (which describes certain commands more 1273 | from a user perspective and less detailed) will be mentioned at the top of help 1274 | pages if they are available. So `:h pattern.txt` mentions the user guide topics 1275 | `:h 03.9` and `:h usr_27`. 1276 | 1277 | ## Getting help online 1278 | 1279 | If you have an issue you can't resolve or are in need of general guidance, see 1280 | the [vim_use](https://groups.google.com/forum/#!forum/vim_use) mailing list. 1281 | Another great resource is using 1282 | [IRC](https://de.wikipedia.org/wiki/Internet_Relay_Chat). The channel `#vim` on 1283 | [Freenode](https://freenode.net) is huge and usually full of helpful people. 1284 | 1285 | If you want to report a Vim bug, use the 1286 | [vim_dev](https://groups.google.com/forum/#!forum/vim_dev) mailing list. 1287 | 1288 | ## Autocmds in practice 1289 | 1290 | You can trigger any event right now: `:doautocmd BufRead`. 1291 | 1292 | ### User events 1293 | 1294 | Especially for plugins it's useful to create your own "User" events: 1295 | 1296 | ```vim 1297 | function! Chibby() 1298 | " A lot of stuff is happening here. 1299 | " And at last.. 1300 | doautocmd User ChibbyExit 1301 | endfunction 1302 | ``` 1303 | 1304 | Now users of your plugin can execute anything when Chibby finishes running: 1305 | 1306 | ```vim 1307 | autocmd User ChibbyExit call ChibbyCleanup() 1308 | ``` 1309 | 1310 | By the way, if there's no "catching" :autocmd, :doautocmd will output a pesky 1311 | "No matching autocommands" message. That's why many plugins use `silent 1312 | doautocmd ...` instead. But this has the disadvantage, that you can't simply use 1313 | `echo "foo"` in the :autocmd, you have to use `unsilent echo "foo"` instead.. 1314 | 1315 | That's why it's better to check if there even is a receiving autocmd and not 1316 | bothering emitting the event otherwise: 1317 | 1318 | ```vim 1319 | if exists('#User#ChibbyExit') 1320 | doautocmd User ChibbyExit 1321 | endif 1322 | ``` 1323 | 1324 | Help: `:h User` 1325 | 1326 | ### Nested autocmds 1327 | 1328 | By default, autocmds do not nest! If an autocmd executes a command, which in 1329 | turn would usually trigger another event, it won't happen. 1330 | 1331 | Let's say every time you start Vim, you want to automatically open your vimrc: 1332 | 1333 | ```vim 1334 | autocmd VimEnter * edit $MYVIMRC 1335 | ``` 1336 | 1337 | When you now start Vim, it will open your vimrc, but the first thing you'll 1338 | notice is that there won't be any highlighting although usually there would be. 1339 | 1340 | The problem is that `:edit` in your non-nested autocmd won't trigger the 1341 | "BufRead" event, so the filetype never gets set to "vim" and 1342 | `$VIMRUNTIME/syntax/vim.vim` never sourced. See `:au BufRead *.vim`. Use this 1343 | instead: 1344 | 1345 | ```vim 1346 | autocmd VimEnter * nested edit $MYVIMRC 1347 | ``` 1348 | 1349 | Help: `:h autocmd-nested` 1350 | 1351 | ## Clipboard 1352 | 1353 | Required [features](#what-kind-of-vim-am-i-running): `+clipboard` and optionally 1354 | `+xterm_clipboard` if you want to use the `'clipboard'` option on a Unix system 1355 | with a Vim that doesn't have GUI support. 1356 | 1357 | Help: 1358 | 1359 | ``` 1360 | :h 'clipboard' 1361 | :h gui-clipboard 1362 | :h gui-selections 1363 | ``` 1364 | 1365 | Also see: [Bracketed paste (or why do I have to set 'paste' all the 1366 | time?)](#bracketed-paste-or-why-do-i-have-to-set-paste-all-the-time) 1367 | 1368 | ### Clipboard usage (Windows, OSX) 1369 | 1370 | Windows comes with a 1371 | [clipboard](https://msdn.microsoft.com/en-us/library/windows/desktop/ms649012(v=vs.85).aspx) 1372 | and OSX comes with a 1373 | [pasteboard](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/PasteboardGuide106/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008100-SW1). 1374 | 1375 | Both work like most users would expect them to work. You copy selected text with 1376 | `ctrl+c`/`cmd+c` and paste them in another application with `ctrl+v`/`cmd+v`. 1377 | 1378 | Note that copied text is actually transferred to the clipboard, so you can close 1379 | the application you copied from before pasting in another application without 1380 | problems. 1381 | 1382 | Whenever this happens, the clipboard register `*` gets filled with the 1383 | selection. From Vim use `"*y` and `"*p` to yank and paste from the clipboard 1384 | respectively. 1385 | 1386 | If you don't even want to specify the `*` register all the time, put this in 1387 | your vimrc: 1388 | 1389 | ```vim 1390 | set clipboard=unnamed 1391 | ``` 1392 | 1393 | Usually all yank/delete/put operations fill the `"` register, now the `*` 1394 | register is used for the same operations, therefore simply `y` and `p` will be 1395 | enough. 1396 | 1397 | Let me repeat: Using the option above means that every yank/paste, even when 1398 | only used in the same Vim window, will alter the clipboard. Decide for yourself 1399 | if this is useful or not. 1400 | 1401 | If you're even too lazy to type `y`, you can send every visual selection to the 1402 | clipboard by using these settings: 1403 | 1404 | ```vim 1405 | set clipboard=unnamed,autoselect 1406 | set guioptions+=a 1407 | ``` 1408 | 1409 | Help: 1410 | 1411 | ``` 1412 | :h clipboard-unnamed 1413 | :h autoselect 1414 | :h 'go_a' 1415 | ``` 1416 | 1417 | ### Clipboard usage (Linux, BSD, ...) 1418 | 1419 | If your OS uses [X](http://www.x.org/wiki), things work a bit different. X 1420 | implements the [X Window System 1421 | Protocol](http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html) which 1422 | happens to be at major version 11 since 1987, hence X is also often called X11. 1423 | 1424 | Prior, in X10, [cut 1425 | buffers](http://www.x.org/releases/X11R7.7/doc/xorg-docs/icccm/icccm.html#Peer_to_Peer_Communication_by_Means_of_Cut_Buffers) 1426 | were introduced that kind of worked like a _clipboard_ as in copied text was 1427 | actually held by X and it was accessible by all ofter applications. This 1428 | mechanism still exists in X, but its use is deprecated now and most software 1429 | doesn't use it anymore. 1430 | 1431 | Nowadays data is transferred between applications by the means of 1432 | [selections](http://www.x.org/releases/X11R7.7/doc/xorg-docs/icccm/icccm.html#Peer_to_Peer_Communication_by_Means_of_Selections). 1433 | From the 3 _selection atoms_ defined, only 2 are used in practice: PRIMARY and 1434 | CLIPBOARD. 1435 | 1436 | Selections work roughly like this: 1437 | 1438 | ``` 1439 | Program A: 1440 | Program A: assert ownership of CLIPBOARD 1441 | Program B: 1442 | Program B: note that ownership of CLIPBOARD is hold by Program A 1443 | Program B: request data from Program A 1444 | Program A: respond to request and send data to Program B 1445 | Program B: receives data from Program A and inserts it into the window 1446 | ``` 1447 | 1448 | | Selection | When used? | How to paste? | How to access from Vim? | 1449 | |-----------|------------|---------------|-------------------------| 1450 | | PRIMARY | Selecting text | `middle-click`, `shift+insert` | `*` register | 1451 | | CLIPBOARD | Selecting text and `ctrl+c` | `ctrl+v` | `+` register | 1452 | 1453 | **NOTE**: Selections (no, not even the CLIPBOARD selection) are never kept in 1454 | the X server! Thus, you lose the data copied with `ctrl+c` when the application 1455 | closes. 1456 | 1457 | Use `"*p` to paste the PRIMARY selection or `"+y1G` to yank the entire file to 1458 | the CLIPBOARD selection. 1459 | 1460 | If you happen to access one of the two registers all the time, consider using: 1461 | 1462 | ```vim 1463 | set clipboard^=unnamed " * register 1464 | " or 1465 | set clipboard^=unnamedplus " + register 1466 | ``` 1467 | 1468 | (The `^=` is used to prepend to the default value, `:h :set^=`.) 1469 | 1470 | This will make all yank/delete/put operations use either `*` or `+` instead of 1471 | the unnamed register `"`. Afterwards you can simply use `y` or `p` for accessing 1472 | your chosen X selection. 1473 | 1474 | Help: 1475 | 1476 | ```vim 1477 | :h clipboard-unnamed 1478 | :h clipboard-unnamedplus 1479 | ``` 1480 | 1481 | ## Restore cursor position when opening file 1482 | 1483 | Without this, you will always be at line 1 when opening a file. With this, you 1484 | will be at the position where you left off. 1485 | 1486 | Put this in your vimrc: 1487 | 1488 | ```vim 1489 | autocmd BufReadPost * 1490 | \ if line("'\"") > 1 && line("'\"") <= line("$") | 1491 | \ exe "normal! g`\"" | 1492 | \ endif 1493 | ``` 1494 | 1495 | This simply does `` g`" `` (jump to position where you left off without changing 1496 | jumplist) if that position still exists (the file might have fewer lines since 1497 | it was altered by another program). 1498 | 1499 | This requires the use of a viminfo file: `:h viminfo-'`. 1500 | 1501 | ## Handling backup, swap, undo, and viminfo files 1502 | 1503 | Depending on the options, Vim creates up to 4 kinds of working files. 1504 | 1505 | **Backup files**: 1506 | 1507 | You can tell Vim to keep a backup of the original file before writing to it. By 1508 | default, Vim keeps a backup but immediately removes it when writing to the file 1509 | was successful (`:set writebackup`). If you always want the latest backup file 1510 | to persist, `:set backup`. Or you disable backups altogether, `:set nobackup 1511 | nowritebackup`. 1512 | 1513 | Let's see what I added last to my vimrc.. 1514 | 1515 | ``` 1516 | $ diff ~/.vim/vimrc ~/.vim/files/backup/vimrc-vimbackup 1517 | 390d389 1518 | < command! -bar -nargs=* -complete=help H helpgrep 1519 | ``` 1520 | 1521 | Help: `:h backup` 1522 | 1523 | **Swap files**: 1524 | 1525 | You came up with an idea for the best scifi novel ever. After being in the flow 1526 | for hours and writing several thousands of words.. power outage! That's the 1527 | moment you realize that the last time you saved 1528 | `~/wicked_alien_invaders_from_outer_space.txt` was.. well, you never did. 1529 | 1530 | But not all hope is lost! When editing a file, Vim creates a swap file that 1531 | contains unsaved changes. Try it for yourself, open any file and get the current 1532 | swap file by using `:swapname`. You can also disable swap files by putting `:set 1533 | noswapfile` in your vimrc. 1534 | 1535 | By default, the swap file is created in the same directory as the edited file 1536 | and called something like `.file.swp`, updated either all 200 characters or when 1537 | you haven't typed anything for 4 seconds, and deleted when you stop editing the 1538 | file. You can change these numbers with `:h 'updatecount'` and `:h 1539 | 'updatetime'`. 1540 | 1541 | Due to the power outage, the swap file was never deleted. If you do `vim 1542 | ~/wicked_alien_invaders_from_outer_space.txt`, Vim will prompt you to recover 1543 | the file. 1544 | 1545 | Help: `:h swap-file` and `:h usr_11` 1546 | 1547 | **Undo files**: 1548 | 1549 | The [undo tree](#undo-tree) is kept in memory and will be lost when Vim quits. 1550 | If you want it to persist, `:set undofile`. This will save the undo file for 1551 | `~/foo.c` in `~/foo.c.un~`. 1552 | 1553 | Help: `:h 'undofile'` and `:h undo-persistence` 1554 | 1555 | **Viminfo file**: 1556 | 1557 | When backup, swap, and undo files are all about text state, viminfo files are 1558 | used for saving everything else that would otherwise be lost when quitting Vim. 1559 | The viminfo file keeps histories (command line, search, input), registers, 1560 | marks, buffer list, global variables etc. 1561 | 1562 | By default, the viminfo is written to `~/.viminfo`. 1563 | 1564 | Help: `:h viminfo` and `:h 'viminfo'` 1565 | 1566 | --- 1567 | 1568 | If you're anything like me, you prefer keeping all these files in the same 1569 | place, e.g. `~/.vim/files`: 1570 | 1571 | ``` 1572 | set backup 1573 | set backupdir =$HOME/.vim/files/backup/ 1574 | set backupext =-vimbackup 1575 | set backupskip = 1576 | set directory =$HOME/.vim/files/swap// 1577 | set updatecount =100 1578 | set undofile 1579 | set undodir =$HOME/.vim/files/undo/ 1580 | set viminfo ='100,n$HOME/.vim/files/info/viminfo 1581 | ``` 1582 | 1583 | The directory `~/.vim/files` has to be created beforehand, otherwise Vim will 1584 | spew errors. If you often work on new hosts, you might want to automate it: 1585 | 1586 | ```vim 1587 | if exists('*mkdir') && !isdirectory($HOME.'/.vim/files') 1588 | call mkdir($HOME.'/.vim/files') 1589 | endif 1590 | ``` 1591 | 1592 | NOTE: If you edit a file on a multi-user system and Vim prompts you that a swap 1593 | file already exists, it probably means that someone else is editing the file at 1594 | the moment. You lose this "feature" when you save your swap files in the home 1595 | directory. 1596 | 1597 | ## Editing remote files 1598 | 1599 | Vim comes with the netrw plugin that enables editing remote files. Actually it 1600 | transfers the remote file to a local temporary file via scp, opens a buffer 1601 | using that file, and writes the changes back to the remote file on saving. 1602 | 1603 | This is extremely useful if you want to use your local configuration opposed to 1604 | ssh'ing into a server and use whatever the admins want you to use. 1605 | 1606 | ``` 1607 | :e scp://bram@awesome.site.com/.vimrc 1608 | ``` 1609 | 1610 | If you have a `~/.ssh/config` set up already, this gets used automatically: 1611 | 1612 | ``` 1613 | Host awesome 1614 | HostName awesome.site.com 1615 | Port 1234 1616 | User bram 1617 | ``` 1618 | 1619 | Assuming the above content in `~/.ssh/config`, this works just as well: 1620 | 1621 | ``` 1622 | :e scp://awesome/.vimrc 1623 | ``` 1624 | 1625 | Similar can be done with a `~/.netrc`, see `:h netrw-netrc`. 1626 | 1627 | Make sure to read `:h netrw-ssh-hack` and `:h g:netrw_ssh_cmd`. 1628 | 1629 | --- 1630 | 1631 | Another possibility is using [sshfs](https://wiki.archlinux.org/index.php/Sshfs) 1632 | which uses [FUSE](https://en.wikipedia.org/wiki/Filesystem_in_Userspace) to 1633 | mount a remote filesystem into your local filesystem. 1634 | 1635 | ## Managing plugins 1636 | 1637 | [Pathogen](https://github.com/tpope/vim-pathogen) was the first popular tool for 1638 | managing plugins. Actually it just adjusts the _runtimepath_ (`:h 'rtp'`) to 1639 | include all the things put under a certain directory. You have to clone the 1640 | repositories of the plugins there yourself. 1641 | 1642 | Real plugin managers expose commands that help you to install and update plugins 1643 | from within Vim. Hereinafter is a list of commonly used plugin managers: 1644 | 1645 | - [dein](https://github.com/Shougo/dein.vim) 1646 | - [plug](https://github.com/junegunn/vim-plug) 1647 | - [vim-addon-manager](https://github.com/MarcWeber/vim-addon-manager) 1648 | - [vundle](https://github.com/VundleVim/Vundle.vim) 1649 | 1650 | ## Block insert 1651 | 1652 | This is a technique to insert the same text on multiple consecutive lines at the 1653 | same time. See this 1654 | [demo](https://raw.githubusercontent.com/mhinz/vim-galore/master/contents/images/content-block_insert.gif). 1655 | 1656 | Switch to visual block mode with ``. Afterwards go down for a few lines. 1657 | Hit `I` or `A` and start entering your text. 1658 | 1659 | It might be a bit confusing at first, but text is always entered for the current 1660 | line and only after finishing the current insertion, the same text will be 1661 | applied to all other lines of the prior visual selection. 1662 | 1663 | So a simple example is `3jItext`. 1664 | 1665 | If you have lines of different length and want to append the same text right 1666 | after the end of each line, do this: `3j$Atext`. 1667 | 1668 | Sometime you need to place the cursor somewhere after the end of the current 1669 | line. You can't do that by default, but you can set the `virtualedit` option: 1670 | 1671 | ```vim 1672 | set virtualedit=all 1673 | ``` 1674 | 1675 | Afterwards `$10l` or `90|` work even after the end of the line. 1676 | 1677 | See `:h blockwise-examples` for more info. It might seem complicated at first, 1678 | but quickly becomes second nature. 1679 | 1680 | If you want to get real fancy, have a look at 1681 | [multiple-cursors](https://github.com/terryma/vim-multiple-cursors). 1682 | 1683 | ## Running external programs and using filters 1684 | 1685 | Disclaimer: Vim is single-threaded, so running an external program in the 1686 | foreground will block everything else. Sure, you can use one of Vim's 1687 | programming interfaces, e.g. Lua, and use its thread support, but during that 1688 | time the Vim process is blocked nevertheless. Neovim fixed that by adding a 1689 | proper job API. 1690 | 1691 | (Apparently Bram is thinking about adding job control to Vim as well. If you 1692 | have a very recent version, see `:helpgrep startjob`.) 1693 | 1694 | Use `:!` to start a job. If you want to list the files in the current working 1695 | directory, use `:!ls`. Use `|` for piping in the shell as usual, e.g. `:!ls -1 | 1696 | sort | tail -n5`. 1697 | 1698 | Without a range, the output of `:!` will be shown in a scrollable window. On the 1699 | other hand, if a range is given, these lines will be 1700 | [filtered](https://en.wikipedia.org/wiki/Filter_(software)). This means they 1701 | will be piped to the 1702 | [stdin](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_.28stdin.29) 1703 | of the filter program and after processing be replaced by the 1704 | [stdout](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_.28stdout.29) 1705 | of the filter. E.g. for prepending numbers to the next 5 lines, use this: 1706 | 1707 | :.,+4!nl -ba -w1 -s' ' 1708 | 1709 | Since manually adding the range is quite burdensome, Vim also provides some 1710 | helpers for convenience. As always with ranges, you can also select lines in 1711 | visual mode and then hit `:`. There's also an operator `!` that takes a motion. 1712 | E.g. `!ip!sort` will sort the lines of the current paragraph. 1713 | 1714 | A good use case for filtering is the [Go programming 1715 | language](https://golang.org). The indentation is pretty opinionated, it even 1716 | comes with a filter called `gofmt` for indenting Go source code properly. So 1717 | plugins for Go often provide helper commands called `:Fmt` that basically do 1718 | `:%!gofmt`, so they indent all lines in the file. 1719 | 1720 | People often use `:r !prog` to put the output of prog below the current line, 1721 | which is fine for scripts, but when doing it on the fly, I find it easier to use 1722 | `!!ls` instead, which replaces the current line. 1723 | 1724 | :h filter 1725 | :h :read! 1726 | 1727 | ## Cscope 1728 | 1729 | [Cscope](http://cscope.sourceforge.net/) does more things than 1730 | [ctags](http://ctags.sourceforge.net/), but only supports C (and C++ and Java to 1731 | some extent). 1732 | 1733 | Whereas a tags file only knows where a symbol was defined, a cscope database 1734 | knows much more about your data: 1735 | 1736 | - Where is this symbol defined? 1737 | - Where is this symbol used? 1738 | - What is this global symbol's definition? 1739 | - Where did this variable get its value? 1740 | - Where is this function in the source files? 1741 | - What functions call this function? 1742 | - What functions are called by this function? 1743 | - Where does the message "out of space" come from? 1744 | - Where is this source file in the directory structure? 1745 | - What files include this header file? 1746 | 1747 | ### 1. Build the database 1748 | 1749 | Do this in the root of your project: 1750 | 1751 | ```sh 1752 | $ cscope -bqR 1753 | ``` 1754 | 1755 | This will create 3 files: `cscope{,.in,.po}.out` in the current working 1756 | directory. Think of them as your database. 1757 | 1758 | Unfortunately `cscope` only analyzes `*.[c|h|y|l]` files by default. If you want 1759 | to use cscope for a Java project instead, do this: 1760 | 1761 | ```sh 1762 | $ find . -name "*.java" > cscope.files 1763 | $ cscope -bq 1764 | ``` 1765 | 1766 | ### 2. Add the database 1767 | 1768 | Open a connection to your freshly built database: 1769 | 1770 | ```vim 1771 | :cs add cscope.out 1772 | ``` 1773 | 1774 | Verify that the connection was made: 1775 | 1776 | ```vim 1777 | :cs show 1778 | ``` 1779 | 1780 | (Yes, you can add multiple connections.) 1781 | 1782 | ### 3. Query the database 1783 | 1784 | ```vim 1785 | :cs find 1786 | ``` 1787 | 1788 | E.g. `:cs find d foo` will list all functions that are called by `foo(...)`. 1789 | 1790 | | Kind | Explanation | 1791 | |------|-------------| 1792 | | s | **s**ymbol: find all references to the token | 1793 | | g | **g**lobal: find global definition(s) of the token | 1794 | | c | **c**alls: find all calls to the function | 1795 | | t | **t**ext: find all instances of the text | 1796 | | e | **e**grep: egrep search for the word | 1797 | | f | **f**ile: open the filename | 1798 | | i | **i**ncludes: find files that include the filename | 1799 | | d | **d**epends: find functions called by this function | 1800 | 1801 | I suggest some convenience mappings e.g.: 1802 | 1803 | ```vim 1804 | nnoremap cs :cscope find s =expand('') 1805 | nnoremap cg :cscope find g =expand('') 1806 | nnoremap cc :cscope find c =expand('') 1807 | nnoremap ct :cscope find t =expand('') 1808 | nnoremap ce :cscope find e =expand('') 1809 | nnoremap cf :cscope find f =expand('') 1810 | nnoremap ci :cscope find i ^=expand('')$ 1811 | nnoremap cd :cscope find d =expand('') 1812 | ``` 1813 | 1814 | So, when `:tag` (or ``) jumps to a definition from the tags file, `:cstag` 1815 | does the same, but also takes connected cscope databases into account. The 1816 | option `'cscopetag'` makes `:tag` act like `:cstag` automatically. This is very 1817 | convenient if you already have tag-related mappings. 1818 | 1819 | Help: `:h cscope` 1820 | 1821 | ## MatchIt 1822 | 1823 | Since Vim is written in C, a lot of features assume C-like syntax. By default, 1824 | if your cursor is on `{` or `#endif`, you can use `%` to jump to the 1825 | corresponding `}` or `#ifdef` respectively. 1826 | 1827 | Vim comes bundled with a plugin called matchit.vim which is not enabled by 1828 | default. It makes `%` also cycle through HTML tags, if/else/endif constructs in 1829 | VimL etc. and introduces a few new commands. 1830 | 1831 | #### Installation for Vim 8 1832 | 1833 | ```vim 1834 | " vimrc 1835 | packadd! matchit 1836 | ``` 1837 | 1838 | #### Installation for Vim 7 and older 1839 | 1840 | ```vim 1841 | " vimrc 1842 | runtime macros/matchit.vim 1843 | ``` 1844 | 1845 | Since the documentation of matchit is pretty extensive, I suggest also doing the 1846 | following once: 1847 | 1848 | ```vim 1849 | :!mkdir -p ~/.vim/doc 1850 | :!cp $VIMRUNTIME/macros/matchit.txt ~/.vim/doc 1851 | :helptags ~/.vim/doc 1852 | ``` 1853 | 1854 | #### Small intro 1855 | 1856 | The plugin is ready to use now. See `:h matchit-intro` for the supported 1857 | commands and `:h matchit-languages` for the supported languages. 1858 | 1859 | That said, it's easy to define your own matching pairs: 1860 | 1861 | ```vim 1862 | autocmd FileType python let b:match_words = '\:\:\' 1863 | ``` 1864 | 1865 | Afterwards you can cycle through these 3 statements in any Python file by using 1866 | `%` (forward) or `g%` (backward). 1867 | 1868 | Help: 1869 | 1870 | ``` 1871 | :h matchit-install 1872 | :h matchit 1873 | :h b:match_words 1874 | ``` 1875 | 1876 | # Tips 1877 | 1878 | ## Saner behavior of n and N 1879 | 1880 | The direction of `n` and `N` depends on whether `/` or `?` was used for 1881 | searching forward or backward respectively. This is pretty confusing to me. 1882 | 1883 | If you want `n` to always search forward and `N` backward, use this: 1884 | 1885 | ```vim 1886 | nnoremap n 'Nn'[v:searchforward] 1887 | nnoremap N 'nN'[v:searchforward] 1888 | ``` 1889 | 1890 | ## Saner command-line history 1891 | 1892 | If you're anything like me, you're used to going to next and previous items via 1893 | `` and `` respectively. By default, this also works in the 1894 | command-line and recalls older or more recent command-lines from history. 1895 | 1896 | So far, so good. But `` and `` are even smarter! They recall the 1897 | command-line whose beginning matches the current command-line. E.g. `:echo ` 1898 | may change to `:echo "Vim rocks!"`. 1899 | 1900 | Of course, I don't want you to reach to the arrow keys, just map it instead: 1901 | 1902 | ```vim 1903 | cnoremap 1904 | cnoremap 1905 | ``` 1906 | 1907 | I depend on this behaviour several times a day. 1908 | 1909 | ## Saner CTRL-L 1910 | 1911 | By default, `` clears and redraws the screen (like `:redraw!`). The 1912 | following mapping does the same, plus de-highlighting the matches found via `/`, 1913 | `?` etc., plus fixing syntax highlighting (sometimes Vim loses highlighting due 1914 | to complex highlighting rules), plus force updating the syntax highlighting in 1915 | diff mode: 1916 | 1917 | ```vim 1918 | nnoremap l :nohlsearch:diffupdate:syntax sync fromstart 1919 | ``` 1920 | 1921 | ## Disable audible and visual bells 1922 | 1923 | ```vim 1924 | set noerrorbells 1925 | set novisualbell 1926 | set t_vb= 1927 | ``` 1928 | 1929 | See [Vim Wiki: Disable beeping](http://vim.wikia.com/wiki/Disable_beeping). 1930 | 1931 | ## Quickly move current line 1932 | 1933 | Sometimes I need a quick way to move the current line above or below: 1934 | 1935 | ```vim 1936 | nnoremap [e :execute 'move -1-'. v:count1 1937 | nnoremap ]e :execute 'move +'. v:count1 1938 | ``` 1939 | 1940 | These mappings also take a count, so `2]e` moves the current line 2 lines below. 1941 | 1942 | ## Quickly add empty lines 1943 | 1944 | ```vim 1945 | nnoremap [ :put! =repeat(nr2char(10), v:count1)'[ 1946 | nnoremap ] :put =repeat(nr2char(10), v:count1) 1947 | ``` 1948 | 1949 | Now `5[` inserts 5 blank lines above the current line. 1950 | 1951 | ## Quickly edit your macros 1952 | 1953 | This is a real gem! The mapping takes a register (or `*` by default) and opens 1954 | it in the cmdline-window. Hit `` when you're done editing for setting the 1955 | register. 1956 | 1957 | I often use this to correct typos I did while recording a macro. 1958 | 1959 | ```vim 1960 | nnoremap m :='let @'. v:register .' = '. string(getreg(v:register)) 1961 | ``` 1962 | 1963 | Use it like this `m` or `"qm`. 1964 | 1965 | Notice the use of `` to make sure that the `` is inserted 1966 | literally. See `:h c_^R^R`. 1967 | 1968 | ## Quickly jump to header or source file 1969 | 1970 | This technique can probably be applied to many filetypes. It sets _file marks_ 1971 | (see `:h marks`) when leaving a source or header file, so you can quickly jump 1972 | back to the last accessed one by using `'C` or `'H` (see `:h 'A`). 1973 | 1974 | ```vim 1975 | autocmd BufLeave *.{c,cpp} mark C 1976 | autocmd BufLeave *.h mark H 1977 | ``` 1978 | 1979 | **NOTE**: The info is saved in the viminfo file, so make sure that `:set 1980 | viminfo?` includes `:h viminfo-'`. 1981 | 1982 | ## Quickly change font size in GUI 1983 | 1984 | I think this was taken from tpope's config: 1985 | 1986 | ```vim 1987 | command! Bigger :let &guifont = substitute(&guifont, '\d\+$', '\=submatch(0)+1', '') 1988 | command! Smaller :let &guifont = substitute(&guifont, '\d\+$', '\=submatch(0)-1', '') 1989 | ``` 1990 | 1991 | ## Change cursor style dependent on mode 1992 | 1993 | I like to use a block cursor in normal mode, i-beam cursor in insert mode, and 1994 | underline cursor in replace mode. 1995 | 1996 | ```vim 1997 | if empty($TMUX) 1998 | let &t_SI = "\]50;CursorShape=1\x7" 1999 | let &t_EI = "\]50;CursorShape=0\x7" 2000 | let &t_SR = "\]50;CursorShape=2\x7" 2001 | else 2002 | let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\" 2003 | let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\" 2004 | let &t_SR = "\Ptmux;\\]50;CursorShape=2\x7\\\" 2005 | endif 2006 | ``` 2007 | 2008 | This simply tells Vim to print a certain sequence of characters ([escape 2009 | sequence](https://en.wikipedia.org/wiki/Escape_sequence)) when entering/leaving 2010 | insert mode. The underlying terminal, or programs like 2011 | [tmux](https://tmux.github.io) that sit between Vim and the terminal, will 2012 | process and evaluate it. 2013 | 2014 | There's one drawback though: there are many terminal emulator implementations 2015 | and not all use the same sequences for doing the same things. The sequences used 2016 | above might not work with your implementation. Your implementation might not 2017 | even support different cursor styles. Check the documentation. 2018 | 2019 | The example above works with iTerm2. 2020 | 2021 | ## Don't lose selection when shifting sidewards 2022 | 2023 | If you select one or more lines, you can use `<` and `>` for shifting them 2024 | sidewards. Unfortunately you immediately lose the selection afterwards. 2025 | 2026 | You can use `gv` to reselect the last selection (see `:h gv`), thus you can work 2027 | around it like this: 2028 | 2029 | ```vim 2030 | xnoremap < >gv 2032 | ``` 2033 | 2034 | Now you can use `>>>>>` on your visual selection without any problems. 2035 | 2036 | **NOTE**: The same can be achieved using `.`, which repeats the last change. 2037 | 2038 | ## Reload a file on saving 2039 | 2040 | Using [autocmds](#autocmds) you can do anything on saving a file, e.g. sourcing 2041 | it in case of a dotfile or running a linter to check for syntactical errors in 2042 | your source code. 2043 | 2044 | ```vim 2045 | autocmd BufWritePost $MYVIMRC source $MYVIMRC 2046 | autocmd BufWritePost ~/.Xdefaults call system('xrdb ~/.Xdefaults') 2047 | ``` 2048 | 2049 | ## Smarter cursorline 2050 | 2051 | I love the cursorline, but I only want to use it in the current window and not 2052 | when being in insert mode: 2053 | 2054 | ```vim 2055 | autocmd InsertLeave,WinEnter * set cursorline 2056 | autocmd InsertEnter,WinLeave * set nocursorline 2057 | ``` 2058 | 2059 | ## Faster keyword completion 2060 | 2061 | The keyword completion (``/``) tries completing whatever is listed in 2062 | the `'complete'` option. By default, this also includes tags (which can be 2063 | annoying) and scanning all included files (which can be very slow). If you can 2064 | live without these things, disable them: 2065 | 2066 | ```vim 2067 | set complete-=i " disable scanning included files 2068 | set complete-=t " disable searching tags 2069 | ``` 2070 | 2071 | ## Cosmetic changes to colorschemes 2072 | 2073 | Always use a dark gray statusline, no matter what colorscheme is chosen: 2074 | 2075 | ```vim 2076 | autocmd ColorScheme * highlight StatusLine ctermbg=darkgray cterm=NONE guibg=darkgray gui=NONE 2077 | ``` 2078 | 2079 | The same, but only for the "lucius" colorscheme (check `:echo 2080 | color_name` which should be set by all valid colorschemes): 2081 | 2082 | ```vim 2083 | autocmd ColorScheme lucius highlight StatusLine ctermbg=darkgray cterm=NONE guibg=darkgray gui=NONE 2084 | ``` 2085 | 2086 | # Commands 2087 | 2088 | Useful commands that are good to know. Use `:h :` to learn more 2089 | about them, e.g. `:h :global`. 2090 | 2091 | ## :global and :vglobal 2092 | 2093 | Execute a command on all matching lines. E.g. `:global /regexp/ print` will use 2094 | `:print` on all lines that contain "regexp". 2095 | 2096 | Fun fact: You probably all know good old grep, the filter program written by Ken 2097 | Thompson. What does it do? It prints all lines matching a certain regular 2098 | expression! Now guess the short form of `:global /regexp/ print`? That's right! 2099 | It's `:g/re/p`. Ken Thompson was inspired by vi's `:global` when he wrote grep. 2100 | 2101 | Despite its name, `:global` only acts on all lines by default, but it also takes 2102 | a range. Assume you want use `:delete` on all lines from the current line to the 2103 | next blank line (matched by the regular expression `^$`) that contain "foo": 2104 | 2105 | ```vim 2106 | :,/^$/g/foo/d 2107 | ``` 2108 | 2109 | For executing commands on all lines that do _not_ match a given pattern, use 2110 | `:global!` or its alias `:vglobal` (think _inVerse_) instead. 2111 | 2112 | ## :normal and :execute 2113 | 2114 | These commands are commonly used in Vim scripts. 2115 | 2116 | With `:normal` you can do normal mode mappings from the command-line. E.g. 2117 | `:normal! 4j` will make the cursor go down 4 lines (without using any custom 2118 | mapping for "j" due to the "!"). 2119 | 2120 | Mind that `:normal` also takes a count, so `:%norm! Iabc` would prepend "abc" to 2121 | every line. 2122 | 2123 | With `:execute` you can mix commands with expressions. Assume you edit a C 2124 | source file and want to switch to its header file: 2125 | 2126 | ```vim 2127 | :execute 'edit' fnamemodify(expand('%'), ':r') . '.h' 2128 | ``` 2129 | 2130 | Both commands are often used together. Assume you want to make the cursor go 2131 | down "n" lines: 2132 | 2133 | ```vim 2134 | :let n = 4 2135 | :execute 'normal!' n . 'j' 2136 | ``` 2137 | 2138 | ## :redir 2139 | 2140 | Many commands print messages and `:redir` allows to redirect that output. You 2141 | can redirect to files, [registers](#registers) or variables. 2142 | 2143 | ```vim 2144 | :redir => neatvar 2145 | :reg 2146 | :redir END 2147 | :echo neatvar 2148 | :" For fun let's also put it onto the current buffer. 2149 | :put =nicevar 2150 | ``` 2151 | 2152 | Help: `:h :redir` 2153 | 2154 | # Debugging 2155 | 2156 | ## General tips 2157 | 2158 | If you encounter a strange behaviour, try reproducing it like this: 2159 | 2160 | ``` 2161 | vim -u NONE -N 2162 | ``` 2163 | 2164 | This will start Vim without vimrc (thus default settings) and in nocompatible 2165 | mode (which makes it use Vim defaults instead of vi defaults). (See `:h 2166 | --noplugin` for other combinations of what to load at start.) 2167 | 2168 | If you can still reproduce it now, it's most likely a bug in Vim itself! Report 2169 | it to the [vim_dev](https://groups.google.com/forum/#!forum/vim_dev) mailing 2170 | list. Most of the time the issue won't be resolved at this time and you'll have 2171 | to further investigate. 2172 | 2173 | Plugins often introduce new/changed/faulty behaviour. E.g. if it happens on 2174 | saving, check `:verb au BufWritePost` to get a list of potential culprits. 2175 | 2176 | If you're using a plugin manager, comment them out until you find the culprit. 2177 | 2178 | Issue is still not resolved? If it's not a plugin, it must be your other 2179 | settings, so maybe your options or autocmds etc. 2180 | 2181 | Time to use binary search. Repeatedly split the search space in two until you 2182 | find the culprit line. Due to the nature of binary division, it won't take many 2183 | steps. 2184 | 2185 | In practice, it works like this: Put the `:finish` command in the middle of your 2186 | vimrc. Vim will skip everything after it. If it still happens, the problem is in 2187 | the active upper half. Move the `:finish` to the middle of _that_ half. 2188 | Otherwise, the issue is in the inactive lower half. Move the `:finish` to the 2189 | middle of _that_ half. And so on. 2190 | 2191 | ## Verbosity 2192 | 2193 | Another useful way for observing what Vim is currently doing is increasing the 2194 | verbosity level. Currently Vim supports 9 different levels. See `:h 'verbose'` 2195 | for the full list. 2196 | 2197 | ```vim 2198 | :e /tmp/foo 2199 | :set verbose=2 2200 | :w 2201 | :set verbose=0 2202 | ``` 2203 | 2204 | This would show all the files that get sourced, e.g. the undo file or various 2205 | plugins that act on saving. 2206 | 2207 | If you only want increase verbosity for a single command, there's also 2208 | `:verbose`, which simply gets put in front of any other command. It takes the 2209 | verbosity level as count and defaults to 1: 2210 | 2211 | ```vim 2212 | :verb set verbose 2213 | " verbose=1 2214 | :10verb set verbose 2215 | " verbose=10 2216 | ``` 2217 | 2218 | It's very often used with its default verbosity level 1 to show where an option 2219 | was set last: 2220 | 2221 | ```vim 2222 | :verb set ai? 2223 | " Last set from ~/.vim/vimrc 2224 | ``` 2225 | 2226 | Naturally, the higher the verbosity level the more overwhelming the output. But 2227 | fear no more, you can simply redirect the output to a file: 2228 | 2229 | ```vim 2230 | :set verbosefile=/tmp/foo | 15verbose echo "foo" | vsplit /tmp/foo 2231 | ``` 2232 | 2233 | You can also enable verbosity at starting time, with the `-V` option. It 2234 | defaults to verbosity level 10. E.g. `vim -V5`. 2235 | 2236 | ## Profiling startup time 2237 | 2238 | Vim startup feels slow? Time to crunch some numbers: 2239 | 2240 | ``` 2241 | vim --startuptime /tmp/startup.log +q && vim /tmp/startup.log 2242 | ``` 2243 | 2244 | The first column is the most important as it shows the elapsed absolute time. If 2245 | there is a big jump in time between two lines, the second line is either a very 2246 | big file or a file with faulty VimL code that is worth investigating. 2247 | 2248 | ## Profiling at runtime 2249 | 2250 | Required [feature](#what-kind-of-vim-am-i-running): `+profile` 2251 | 2252 | Vim provides a built-in capability for profiling at runtime and is a great way 2253 | to find slow code in your environment. 2254 | 2255 | The `:profile` command takes a bunch of sub-commands for specifying what to 2256 | profile. 2257 | 2258 | If you want to profile _everything_, do this: 2259 | 2260 | ``` 2261 | :profile start /tmp/profile.log 2262 | :profile file * 2263 | :profile func * 2264 | 2265 | 2266 | ``` 2267 | 2268 | Vim keeps the profiling information in memory and only writes it out to the 2269 | logfile on exit. (Neovim has fixed this using `:profile dump`). 2270 | 2271 | Have a look at `/tmp/profile.log`. All code that was executed during profiling 2272 | will be shown. Every line, how often it was executed and how much time it took. 2273 | 2274 | Most of the time that will be plugin code the user isn't familiar with, but if 2275 | you're investigating a certain issue, jump to the bottom of the log. Here are 2276 | two different sections `FUNCTIONS SORTED ON TOTAL TIME` and `FUNCTIONS SORTED ON 2277 | SELF TIME` that are worth gold. At a quick glance you can see, if a certain 2278 | function is taking too long. 2279 | 2280 | ## Debugging Vim scripts 2281 | 2282 | If you ever used a command-line debugger before, `:debug` will quickly feel 2283 | familiar. 2284 | 2285 | Simply prepend `:debug` to any other command and you'll be put into debug mode. 2286 | That is, the execution will stop at the first line about to be executed and that 2287 | line will be displayed. 2288 | 2289 | See `:h >cont` and below for the 6 available debugger commands and note that, 2290 | like in gdb and similar debuggers, you can also use their short forms: `c`, `q`, 2291 | `n`, `s`, `i`, and `f`. 2292 | 2293 | Apart from that those, you're free to use any Vim command, e.g. `:echo myvar`, 2294 | which gets executed in the context of the current position in the code. 2295 | 2296 | You basically get a 2297 | [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) by 2298 | simply using `:debug 1`. 2299 | 2300 | It would be a pain if you had to single-step through every single line, so of 2301 | course we can define breakpoints, too. (Breakpoints are called breakpoints, 2302 | because the execution stops when they're hit, thus you can simply skip code 2303 | you're not interested in.) See `:h :breakadd`, `:h :breakdel`, and `:h 2304 | :breaklist` for further details. 2305 | 2306 | Let's assume you want to know what code is run every time you save a file: 2307 | 2308 | ```vim 2309 | :au BufWritePost 2310 | " signify BufWritePost 2311 | " * call sy#start() 2312 | :breakadd func *start 2313 | :w 2314 | " Breakpoint in "sy#start" line 1 2315 | " Entering Debug mode. Type "cont" to continue. 2316 | " function sy#start 2317 | " line 1: if g:signify_locked 2318 | >s 2319 | " function sy#start 2320 | " line 3: endif 2321 | > 2322 | " function sy#start 2323 | " line 5: let sy_path = resolve(expand('%:p')) 2324 | >q 2325 | :breakdel * 2326 | ``` 2327 | 2328 | As you can see, using `` will repeat the previous debugger command, `s` in 2329 | this case. 2330 | 2331 | `:debug` can be used in combination with the [verbose](#verbosity) option. 2332 | 2333 | ## Debugging syntax files 2334 | 2335 | Syntax files are often the cause for slowdowns due to wrong and/or complex 2336 | regular expressions. If the `+profile` [feature](#what-kind-of-vim-am-i-running) 2337 | is compiled in, Vim provides the super useful `:syntime` command. 2338 | 2339 | ```vim 2340 | :syntime on 2341 | " hit a few times to redraw the window which causes the syntax rules to get applied again 2342 | :syntime off 2343 | :syntime report 2344 | ``` 2345 | 2346 | The output contains important metrics. E.g. you can see which regexp takes too 2347 | long and should be optimized or which regexps are used all the time but never 2348 | even match. 2349 | 2350 | See `:h :syntime`. 2351 | 2352 | # Miscellaneous 2353 | 2354 | ## Additional resources 2355 | 2356 | | Resource | Description | 2357 | |----------|-------------| 2358 | | [Seven habits of effective text editing](http://www.moolenaar.net/habits.html) | By Bram Moolenaar, the author of Vim. | 2359 | | [Seven habits of effective text editing 2.0 (PDF)](http://www.moolenaar.net/habits_2007.pdf) | See above. | 2360 | | [IBM DeveloperWorks: Scripting the Vim editor](http://www.ibm.com/developerworks/views/linux/libraryview.jsp?sort_order=asc&sort_by=Title&search_by=scripting+the+vim+editor) | Five-part series on Vim scripting. | 2361 | | [Learn Vimscript the Hard Way](http://learnvimscriptthehardway.stevelosh.com) | Develop a Vim plugin from scratch. | 2362 | | [Practical Vim (2nd Edition)](http://www.amazon.com/Practical-Vim-Edit-Speed-Thought/dp/1680501275/) | Hands down the best book about Vim. | 2363 | | [Vimcasts.org](http://vimcasts.org/episodes/archive) | Vim screencasts. | 2364 | | [Why, oh WHY, do those #?@! nutheads use vi?](http://www.viemu.com/a-why-vi-vim.html) | Common misconceptions explained. | 2365 | | [Your problem with Vim is that you don't grok vi](http://stackoverflow.com/a/1220118) | Concise, informative and correct. A real gem. | 2366 | 2367 | ## Vim distributions 2368 | 2369 | Vim distributions are bundles of custom settings and plugins for Vim. 2370 | 2371 | More advanced users know how to configure their editor anyway, so distributions 2372 | are mostly targeted at beginners. If you think about that, it's quite 2373 | paradoxical though: Making it easier by adding even more things to learn about? 2374 | 2375 | I know that many people don't want to spend hours and hours on customizing an 2376 | editor (and actually you never stop customizing your vimrc when you finally got 2377 | hooked), but eventually you only get efficient in Vim when you take the time to 2378 | learn it properly. 2379 | 2380 | Repeat after me: "A programmer should know their tools." 2381 | 2382 | Anyway, if you know what you're doing, you might draw some inspiration from 2383 | looking at a few distributions: 2384 | 2385 | - [cream](http://cream.sourceforge.net) 2386 | - [janus](https://github.com/carlhuda/janus.git) 2387 | - [spacevim](https://github.com/SpaceVim/SpaceVim) 2388 | - [spf13](https://github.com/spf13/spf13-vim) 2389 | 2390 | ## Standard plugins 2391 | 2392 | Surprising to many people, Vim comes with a handful of plugins on its own that 2393 | all get loaded by default. Check `:scriptnames` after starting Vim to see all 2394 | sourced files. 2395 | 2396 | Most of them will never get used, so disable them as you see fit. They will 2397 | still be shown as sourced, but only the first lines actually get read before Vim 2398 | bails out. No further code (mappings, commands, logic) will be processed. 2399 | 2400 | | Plugin | Disable it using.. | Help | 2401 | |------------|-------------------------------------|------| 2402 | | 2html | `let g:loaded_2html_plugin = 1` | `:h 2html` | 2403 | | getscript | `let g:loaded_getscriptPlugin = 1` | `:h pi_getscript` | 2404 | | gzip | `let g:loaded_gzip = 1` | `:h pi_gzip` | 2405 | | logipat | `let g:loaded_logipat = 1` | `:h pi_logipat` | 2406 | | matchparen | `let g:loaded_matchparen = 1` | `:h pi_paren` | 2407 | | netrw | `let g:loaded_netrwPlugin = 1` | `:h pi_netrw` | 2408 | | rrhelper | `let g:loaded_rrhelper = 1` | `:e $VIMRUNTIME/plugin/rrhelper.vim` | 2409 | | spellfile | `let g:loaded_spellfile_plugin = 1` | `:h spellfile.vim` | 2410 | | tar | `let g:loaded_tarPlugin = 1` | `:h pi_tar` | 2411 | | vimball | `let g:loaded_vimballPlugin = 1` | `:h pi_vimball` | 2412 | | zip | `let g:loaded_zipPlugin = 1` | `:h pi_zip` | 2413 | 2414 | ## Map CapsLock to Control 2415 | 2416 | CapsLock belongs to the most useless keys on your keyboard, but it's much easier 2417 | to reach than the Control key, since it lies on your [home 2418 | row](https://raw.githubusercontent.com/mhinz/vim-galore/master/contents/images/content-homerow.png). 2419 | Mapping CapsLock to Control is a great way to prevent or at least reduce 2420 | [RSI](https://de.wikipedia.org/wiki/Repetitive-Strain-Injury-Syndrom) if you 2421 | program a lot. 2422 | 2423 | Attention: When you get used to it, you can't live without it anymore. 2424 | 2425 | **OSX**: 2426 | 2427 | `System Preferences -> Keyboard -> Keyboard Tab -> Modifier Keys`. Change 2428 | "CapsLock" to "Control". 2429 | 2430 | **Linux**: 2431 | 2432 | To change the keys in X, put this in your `~/.xmodmap`: 2433 | 2434 | remove Lock = Caps_Lock 2435 | keysym Caps_Lock = Control_L 2436 | add Control = Control_L 2437 | 2438 | Afterwards source it via `$ xmodmap ~/.xmodmap`. 2439 | 2440 | An alternative would be using [caps2esc](https://github.com/oblitum/caps2esc) or 2441 | [xcape](https://github.com/alols/xcape). 2442 | 2443 | **Windows**: 2444 | 2445 | See [superuser.com: Map Caps-Lock to Control in Windows 2446 | 8.1](http://superuser.com/questions/764782/map-caps-lock-to-control-in-windows-8-1). 2447 | 2448 | ## Easter eggs 2449 | 2450 | | Command | Message | 2451 | |-----------|---------| 2452 | | `:Ni!` | `Do you demand a shrubbery?` | 2453 | | `:h 'sm'` | `NOTE: Use of the short form is rated PG.` | 2454 | | `:h 42` | `What is the meaning of life, the universe and everything? Douglas Adams, the only person who knew what this question really was about is now dead, unfortunately. So now you might wonder what the meaning of death is...` | 2455 | | `:h UserGettingBored` | `When the user presses the same key 42 times. Just kidding! :-)` | 2456 | | `:h bar` | `Ceci n'est pas une pipe.` | 2457 | | `:h holy-grail` | `You found it, Arthur!` | 2458 | | `:h map-modes` | `:nunmap can also be used outside of a monastery.` | 2459 | | `:help!` | `E478: Don't panic!` (Glitch? When used in a help buffer (`buftype=help`) this works like `:h help.txt` instead.) | 2460 | | `:smile` | Try it out yourself. ;-) Added in 7.4.1005. | 2461 | 2462 | ## Standard plugins 2463 | 2464 | ## Why hjkl for navigation? 2465 | 2466 | When [Bill Joy](https://en.wikipedia.org/wiki/Bill_Joy) created 2467 | [vi](https://en.wikipedia.org/wiki/Vi), a predecessor of Vim, he did it on a 2468 | [ADM-3A](https://en.wikipedia.org/wiki/ADM-3A) which had no extra cursor buttons 2469 | but used, you might already guessed it, hjkl instead. 2470 | 2471 | Keyboard layout: [click](https://raw.githubusercontent.com/mhinz/vim-galore/master/contents/images/content-adm-3a-layout.jpg) 2472 | 2473 | This also shows why `~` is used to denote the home directory on Unix systems. 2474 | 2475 | # Common problems 2476 | 2477 | ## Editing small files is slow 2478 | 2479 | There are two things which can have a huge impact on performance: 2480 | 2481 | 1. Complex **regular expressions**. Particular the Ruby syntax file caused 2482 | people to have slowdowns in the past. (Also see [Debugging syntax files](#debugging-syntax-files).) 2483 | 2. **Screen redraws**. Some features force all lines to redraw. 2484 | 2485 | | Typical culprit | Why? | Solution? | 2486 | |-----------------|------|-----------| 2487 | | `:set cursorline` | Causes all lines to redraw. | `:set nocursorline` | 2488 | | `:set cursorcolumn` | Causes all lines to redraw. | `:set nocursorcolumn` | 2489 | | `:set relativenumber` | Causes all lines to redraw. | `:set norelativenumber` | 2490 | | `:set foldmethod=syntax` | If the syntax file is slow already, this makes it even worse. | `:set foldmethod=manual`, `:set foldmethod=marker` or [FastFold](https://github.com/Konfekt/FastFold) | 2491 | | `:set synmaxcol=3000` | Due to internal representation, Vim has problems with long lines in general. Highlights columns till column 3000. | `:set synmaxcol=200` | 2492 | | matchparen.vim | Loaded by default. Uses regular expressions to find the accompanying parenthesis. | Disable plugin: `:h matchparen` | 2493 | 2494 | **NOTE**: You only need to do this if you experience actual performance 2495 | drawbacks. In most cases using the things mentioned above is absolutely fine. 2496 | 2497 | ## Editing huge files is slow 2498 | 2499 | The biggest issue with big files is, that Vim reads the whole file at once. This 2500 | is done due to how buffers are represented internally. 2501 | ([Discussion on vim_dev@](https://groups.google.com/forum/#!topic/vim_dev/oY3i8rqYGD4/discussion)) 2502 | 2503 | If you only want to read, `tail hugefile | vim -` is a good workaround. 2504 | 2505 | If you can live without syntax, settings and plugins for the moment: 2506 | 2507 | ``` 2508 | $ vim -u NONE -N 2509 | ``` 2510 | 2511 | This should make navigation quite a lot faster, especially since no expensive 2512 | regular expressions for syntax highlighting are used. You should also tell Vim 2513 | not to use swapfiles and viminfo files to avoid long delays on writing: 2514 | 2515 | ``` 2516 | $ vim -n -u NONE -i NONE -N 2517 | ``` 2518 | 2519 | Putting it in a nutshell, try to avoid using Vim when intending to write really 2520 | huge files. :\ 2521 | 2522 | ## Bracketed paste (or why do I have to set 'paste' all the time?) 2523 | 2524 | Bracketed paste mode allows terminal emulators to distinguish between typed text 2525 | and pasted text. 2526 | 2527 | Did you ever tried pasting code into Vim and afterwards everything seemed messed 2528 | up? 2529 | 2530 | This only happens if you paste via `cmd+v`, `shift-insert`, `middle-click` etc. 2531 | because then you're just throwing text at the terminal emulator. Vim doesn't 2532 | know that you just pasted the text, it thinks you're an extremely fast typist. 2533 | Accordingly, it tries to indent the lines and fails. 2534 | 2535 | Obviously this is not an issue, if you paste using Vim's registers, e.g. `"+p`, 2536 | because then Vim knows that you're actually pasting. 2537 | 2538 | To workaround this, you have to `:set paste`, so it gets pasted as-is. See `:h 2539 | 'paste'` and `:h 'pastetoggle'`. 2540 | 2541 | If you're fed up with toggling `'paste'` all the time, have a look at this fine 2542 | plugin that does it for you: 2543 | [bracketed-paste](https://github.com/ConradIrwin/vim-bracketed-paste). 2544 | 2545 | Additional read from the same author as the plugin: 2546 | [here](http://cirw.in/blog/bracketed-paste). 2547 | 2548 | **Neovim**: Neovim tries to make all of this much more seamless and sets 2549 | bracketed paste mode automatically if the terminal emulator supports it. 2550 | 2551 | ## Delays when using escape key in terminal 2552 | 2553 | If you live in the command-line, you probably use a so-called _terminal 2554 | emulator_ like xterm, gnome-terminal, iTerm2, etc. (opposed to a real 2555 | [terminal](https://en.wikipedia.org/wiki/Computer_terminal)). 2556 | 2557 | Like their ancestors, terminal emulators use [escape 2558 | sequences](https://en.wikipedia.org/wiki/Escape_sequence) (or _control 2559 | sequences_) to control things like moving the cursor, changing text colors, etc. 2560 | They're simply strings of ASCII characters starting with an escape character 2561 | (displayed in [caret notation](https://en.wikipedia.org/wiki/Caret_notation) as 2562 | `^[`). When such a string arrives, the terminal emulator looks up the 2563 | accompanying action in the [terminfo](https://en.wikipedia.org/wiki/Terminfo) 2564 | database. 2565 | 2566 | To make the problem clearer, I'll explain mapping timeouts first. They always 2567 | happen when there's ambiguity between mappings: 2568 | 2569 | ```vim 2570 | :nnoremap ,a :echo 'foo' 2571 | :nnoremap ,ab :echo 'bar' 2572 | ``` 2573 | 2574 | Both mappings work as expected, but when typing `,a`, there will be a delay of 1 2575 | second, because Vim waits whether the user keys in another `b` or not. 2576 | 2577 | Escape sequences pose the same problem: 2578 | 2579 | - `` is used a lot for returning to normal mode or quitting an action. 2580 | - Cursor keys are encoded using escape sequences. 2581 | - Vim expects Alt (also called _Meta key_) to send a proper 8-bit 2582 | encoding with the high bit set, but many terminal emulators don't support it 2583 | (or don't enable it by default) and send an escape sequence instead. 2584 | 2585 | You can test the above like this: `vim -u NONE -N` and type `i` and 2586 | you'll see a sequence inserted that starts with `^[` which denotes the escape 2587 | character. 2588 | 2589 | Putting it in a nutshell, Vim has a hard time distinguishing between a typed 2590 | `` character and a proper escape sequence. 2591 | 2592 | By default, Vim uses `:set timeout timeoutlen=1000`, so it delays on ambiguity 2593 | of mappings _and_ key codes by 1 second. This is a sane value for mappings, but 2594 | you can define the key code timeout on its own which is the most common 2595 | workaround for this entire issue: 2596 | 2597 | ```vim 2598 | set timeout " for mappings 2599 | set timeoutlen=1000 " default value 2600 | set ttimeout " for key codes 2601 | set ttimeoutlen=10 " unnoticeable small value 2602 | ``` 2603 | 2604 | Under `:h ttimeout` you find a small table showing the relationship between 2605 | these options. 2606 | 2607 | If you're using tmux between Vim and your terminal emulator, also put this in 2608 | your `~/.tmux.conf`: 2609 | 2610 | ```tmux 2611 | set -sg escape-time 0 2612 | ``` 2613 | 2614 | ## Function search undo 2615 | 2616 | - A search pattern in a command (`/`, `:substitute`, ...) changes the "last used 2617 | search pattern". (It's saved in the `/` register; print it with `:echo @/`). 2618 | - A simple text change can be redone with `.`. (It's saved in the `.` register; 2619 | print it with `:echo @.`). 2620 | 2621 | Both things are _not_ the case, if you do them from a function, though! Thus you 2622 | can't easily highlight words from a function or redo the text changes made by 2623 | it. 2624 | 2625 | Help: `:h function-search-undo` 2626 | 2627 | # Technical quirks 2628 | 2629 | ## Newline used for NUL 2630 | 2631 | NUL characters (`\0`) in a file, are stored as newline (`\n`) in memory and 2632 | displayed in a buffer as `^@`. 2633 | 2634 | See `man 7 ascii` and `:h NL-used-for-Nul` for more information. 2635 | 2636 | # List of colorschemes 2637 | 2638 | Here's a list of commonly used colorschemes: 2639 | 2640 | - [acme-colors](https://github.com/plan9-for-vimspace/acme-colors) 2641 | - [base16](https://github.com/chriskempson/base16-vim) 2642 | - [gotham](https://github.com/whatyouhide/vim-gotham) 2643 | - [gruvbox](https://github.com/morhetz/gruvbox) 2644 | - [janah](https://github.com/mhinz/vim-janah) 2645 | - [jellybeans](https://github.com/nanotech/jellybeans.vim) 2646 | - [lucius](https://github.com/jonathanfilip/vim-lucius) 2647 | - [molokai](https://github.com/tomasr/molokai) 2648 | - [railscasts](https://github.com/jpo/vim-railscasts-theme) 2649 | - [seoul256](https://github.com/junegunn/seoul256.vim) 2650 | - [solarized](https://github.com/altercation/vim-colors-solarized) (or a lighter variant: [flattened](https://github.com/romainl/flattened)) 2651 | - [tomorrow](https://github.com/chriskempson/vim-tomorrow-theme) 2652 | - [vividchalk](https://github.com/tpope/vim-vividchalk) 2653 | - [yowish](https://github.com/kabbamine/yowish.vim) 2654 | - [zenburn](https://github.com/jnurmine/Zenburn) 2655 | 2656 | -------------------------------------------------------------------------------- /static/images/badge-awesome.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /static/images/content-adm-3a-layout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsrdg/vim-galore/a82fa9c455572b7c158d524ee15f10d13da6bf89/static/images/content-adm-3a-layout.jpg -------------------------------------------------------------------------------- /static/images/content-block_insert.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsrdg/vim-galore/a82fa9c455572b7c158d524ee15f10d13da6bf89/static/images/content-block_insert.gif -------------------------------------------------------------------------------- /static/images/content-homerow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsrdg/vim-galore/a82fa9c455572b7c158d524ee15f10d13da6bf89/static/images/content-homerow.png -------------------------------------------------------------------------------- /static/images/logo-vim-galore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsrdg/vim-galore/a82fa9c455572b7c158d524ee15f10d13da6bf89/static/images/logo-vim-galore.png -------------------------------------------------------------------------------- /static/minimal-vimrc.vim: -------------------------------------------------------------------------------- 1 | " 2 | " A (not so) minimal vimrc. 3 | " 4 | 5 | " You want Vim, not vi. When Vim finds a vimrc, 'nocompatible' is set anyway. 6 | " We set it explicitely to make our position clear! 7 | set nocompatible 8 | 9 | filetype plugin indent on " Load plugins according to detected filetype. 10 | syntax on " Enable syntax highlighting. 11 | 12 | set autoindent " Indent according to previous line. 13 | set expandtab " Use spaces instead of tabs. 14 | set softtabstop =4 " Tab key indents by 4 spaces. 15 | set shiftwidth =4 " >> indents by 4 spaces. 16 | set shiftround " >> indents to next multiple of 'shiftwidth'. 17 | 18 | set backspace =indent,eol,start " Make backspace work as you would expect. 19 | set hidden " Switch between buffers without having to save first. 20 | set laststatus =2 " Always show statusline. 21 | set display =lastline " Show as much as possible of the last line. 22 | 23 | set showmode " Show current mode in command-line. 24 | set showcmd " Show already typed keys when more are expected. 25 | 26 | set incsearch " Highlight while searching with / or ?. 27 | set hlsearch " Keep matches highlighted. 28 | 29 | set ttyfast " Faster redrawing. 30 | set lazyredraw " Only redraw when necessary. 31 | 32 | set splitbelow " Open new windows below the current window. 33 | set splitright " Open new windows right of the current window. 34 | 35 | set cursorline " Find the current line quickly. 36 | set wrapscan " Searches wrap around end-of-file. 37 | set report =0 " Always report changed lines. 38 | set synmaxcol =200 " Only highlight the first 200 columns. 39 | 40 | set list " Show non-printable characters. 41 | if has('multi_byte') && &encoding ==# 'utf-8' 42 | let &listchars = 'tab:▸ ,extends:❯,precedes:❮,nbsp:±' 43 | else 44 | let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.' 45 | endif 46 | 47 | " The fish shell is not very compatible to other shells and unexpectedly 48 | " breaks things that use 'shell'. 49 | if &shell =~# 'fish$' 50 | set shell=/bin/bash 51 | endif 52 | 53 | " Put all temporary files under the same directory. 54 | " https://github.com/mhinz/vim-galore#handling-backup-swap-undo-and-viminfo-files 55 | set backup 56 | set backupdir =$HOME/.vim/files/backup/ 57 | set backupext =-vimbackup 58 | set backupskip = 59 | set directory =$HOME/.vim/files/swap// 60 | set updatecount =100 61 | set undofile 62 | set undodir =$HOME/.vim/files/undo/ 63 | set viminfo ='100,n$HOME/.vim/files/info/viminfo 64 | -------------------------------------------------------------------------------- /static/plugins.md: -------------------------------------------------------------------------------- 1 | ## List of plugins 2 | 3 | #### [By topic](#by-topic-1) 4 | 5 | - [Alignment](#alignment) 6 | - [Building and linting](#building-and-linting) 7 | - [Code completion](#code-completion) 8 | - [Cycle](#cycle) 9 | - [Commenters](#commenters) 10 | - [Delimiter](#delimiter) 11 | - [Fuzzy finders](#fuzzy-finders) 12 | - [Grep tools](#grep-tools) 13 | - [Indent](#indent) 14 | - [Navigation](#navigation) 15 | - [Snippets](#snippets) 16 | - [Statusline](#statusline) 17 | - [Surround](#surround) 18 | - [Taking notes](#taking-notes) 19 | - [Text objects](#text-objects) 20 | - [Tmux](#tmux) 21 | - [Undo history](#undo-history) 22 | - [Version control](#version-control) 23 | - [Writing](#writing) 24 | - [Misc](#misc) 25 | 26 | #### [By filetype](#by-filetype-1) 27 | 28 | - [C and C++](#c-and-c) 29 | - [Clojure](#clojure) 30 | - [Go](#go) 31 | - [HTML](#html) 32 | - [Java](#java) 33 | - [Javascript](#javascript) 34 | - [Lua](#lua) 35 | - [Python](#python) 36 | - [TeX](#tex) 37 | - [VimL](#viml) 38 | 39 | ## By topic 40 | 41 | #### Alignment 42 | 43 | - [easy-align](https://github.com/junegunn/vim-easy-align) 44 | - [tabular](https://github.com/godlygeek/tabular) 45 | 46 | #### Building and linting 47 | 48 | - [ale](https://github.com/w0rp/ale) 49 | - [neomake](https://github.com/neomake/neomake) 50 | - [syntastic](https://github.com/scrooloose/syntastic) 51 | 52 | #### Code completion 53 | 54 | - [completor](https://github.com/maralla/completor.vim) 55 | - [deoplete](https://github.com/Shougo/deoplete.nvim) 56 | - [neocomplete](https://github.com/Shougo/neocomplete.vim) 57 | - [supertab](https://github.com/ervandew/supertab) 58 | - [vimcompletesme](https://github.com/ajh17/VimCompletesMe) 59 | - [youcompleteme](https://github.com/Valloric/YouCompleteMe) 60 | - [µcomplete](https://github.com/lifepillar/vim-mucomplete) 61 | 62 | #### Cycle 63 | 64 | - [speeddating](https://github.com/tpope/vim-speeddating) 65 | - [switch](https://github.com/AndrewRadev/switch.vim) 66 | 67 | #### Commenters 68 | 69 | - [commentary](https://github.com/tpope/vim-commentary) 70 | - [nerdcommenter](https://github.com/scrooloose/nerdcommenter) 71 | - [tcomment](https://github.com/tomtom/tcomment_vim) 72 | 73 | #### Delimiter 74 | 75 | - [auto-pairs](https://github.com/jiangmiao/auto-pairs) 76 | - [delimitmate](https://github.com/Raimondi/delimitMate) 77 | - [endwise](https://github.com/tpope/vim-endwise) 78 | 79 | #### Fuzzy finders 80 | 81 | - [command-t](https://github.com/wincent/Command-T) (_requires +ruby_) 82 | - [ctrlp](https://github.com/ctrlpvim/ctrlp.vim.git) 83 | - [denite](https://github.com/Shougo/denite.nvim) (_requires +python3_) 84 | - [fzf](https://github.com/junegunn/fzf) 85 | - [unite](https://github.com/Shougo/unite.vim) 86 | 87 | #### Grep tools 88 | 89 | - [ctrlsf](https://github.com/dyng/ctrlsf.vim) 90 | - [ferret](https://github.com/wincent/ferret) 91 | - [grepper](https://github.com/mhinz/vim-grepper) 92 | 93 | #### Indent 94 | 95 | - [indent-guides](https://github.com/nathanaelkane/vim-indent-guides) 96 | - [indentline](https://github.com/Yggdroot/indentLine) 97 | 98 | #### Navigation 99 | 100 | - [dirvish](https://github.com/justinmk/vim-dirvish) 101 | - [easymotion](https://github.com/easymotion/vim-easymotion) 102 | - [nerdtree](https://github.com/scrooloose/nerdtree) 103 | - [sneak](https://github.com/justinmk/vim-sneak) 104 | - [tagbar](https://github.com/majutsushi/tagbar) 105 | - [vimfiler](https://github.com/Shougo/vimfiler.vim) (_depends on other plugins_) 106 | - [vinegar](https://github.com/tpope/vim-vinegar) 107 | 108 | Also see [fuzzy finders](#fuzzy-finders). 109 | 110 | #### Snippets 111 | 112 | - [neosnippet](https://github.com/Shougo/neosnippet.vim) (_depends on other plugins_) 113 | - [snipmate](https://github.com/garbas/vim-snipmate) (_depends on other plugins_) 114 | - [ultisnips](https://github.com/SirVer/ultisnips) 115 | - [xptemplate](https://github.com/drmingdrmer/xptemplate) 116 | 117 | #### Statusline 118 | 119 | - [airline](https://github.com/vim-airline/vim-airline) 120 | - [flagship](https://github.com/tpope/vim-flagship) 121 | - [lightline](https://github.com/itchyny/lightline.vim) 122 | - [powerline](https://github.com/powerline/powerline) 123 | 124 | #### Surround 125 | 126 | - [operator-surround](https://github.com/rhysd/vim-operator-surround) 127 | - [sandwich](https://github.com/machakann/vim-sandwich) 128 | - [surround](https://github.com/tpope/vim-surround) 129 | 130 | #### Taking notes 131 | 132 | - [dotoo](https://github.com/dhruvasagar/vim-dotoo) 133 | - [journal](https://github.com/junegunn/vim-journal) 134 | - [notes](https://github.com/xolox/vim-notes) 135 | - [orgmode](https://github.com/jceb/vim-orgmode) 136 | - [pad](https://github.com/fmoralesc/vim-pad) 137 | - [vimwiki](https://github.com/vimwiki/vimwiki) 138 | 139 | #### Text objects 140 | 141 | - [exchange](https://github.com/tommcdo/vim-exchange) 142 | - [targets](https://github.com/wellle/targets.vim) 143 | - [textobj-user](https://github.com/kana/vim-textobj-user) 144 | 145 | #### Tmux 146 | 147 | - [dispatch](https://github.com/tpope/vim-dispatch) 148 | - [tmux-complete](https://github.com/wellle/tmux-complete.vim) 149 | - [tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) 150 | - [vitality](https://github.com/sjl/vitality.vim) 151 | 152 | #### Undo history 153 | 154 | - [gundo](https://github.com/sjl/gundo.vim) 155 | - [undotree](https://github.com/mbbill/undotree) 156 | 157 | #### Version control 158 | 159 | - [agit](https://github.com/cohama/agit.vim) 160 | - [committia](rhysd/committia.vim) 161 | - [fugitive](https://github.com/tpope/vim-fugitive) 162 | - [gist-vim](https://github.com/mattn/gist-vim) 163 | - [gitgutter](https://github.com/airblade/vim-gitgutter) 164 | - [github-dashboard](https://github.com/junegunn/vim-github-dashboard) 165 | - [github-issues](https://github.com/jaxbot/github-issues.vim) 166 | - [gitv](https://github.com/gregsexton/gitv) 167 | - [gv](https://github.com/junegunn/gv.vim) 168 | - [lawrencium](https://bitbucket.org/ludovicchabant/vim-lawrencium) 169 | - [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) 170 | - [signify](https://github.com/mhinz/vim-signify) 171 | - [vimagit](https://github.com/jreybert/vimagit) 172 | 173 | #### Writing 174 | 175 | - [grammarous](https://github.com/rhysd/vim-grammarous) 176 | - [online-thesaurus](https://github.com/beloglazov/vim-online-thesaurus) 177 | 178 | #### Misc 179 | 180 | - [bracketed-paste](https://github.com/ConradIrwin/vim-bracketed-paste) 181 | - [calendar](https://github.com/itchyny/calendar.vim) 182 | - [covim](https://github.com/FredKSchott/CoVim) 183 | - [devicons](https://github.com/ryanoasis/vim-devicons) 184 | - [diminactive](https://github.com/blueyed/vim-diminactive) 185 | - [fastfold](https://github.com/Konfekt/FastFold) 186 | - [fixkey](https://github.com/drmikehenry/vim-fixkey) 187 | - [gnupg](https://github.com/jamessan/vim-gnupg) 188 | - [goyo](https://github.com/junegunn/goyo.vim) 189 | - [hackernews](https://github.com/ryanss/vim-hackernews) 190 | - [indentline](https://github.com/Yggdroot/indentLine) 191 | - [move](https://github.com/matze/vim-move) 192 | - [multiple-cursors](https://github.com/terryma/vim-multiple-cursors) 193 | - [nrrwrgn](https://github.com/chrisbra/NrrwRgn) 194 | - [projectionist](https://github.com/tpope/vim-projectionist) 195 | - [rsi](https://github.com/tpope/vim-rsi) 196 | - [sideways](https://github.com/AndrewRadev/sideways.vim) 197 | - [splitjoin](https://github.com/AndrewRadev/splitjoin.vim) 198 | - [startify](https://github.com/mhinz/vim-startify) 199 | - [targets](https://github.com/wellle/targets.vim) 200 | - [unicode.vim](https://github.com/chrisbra/unicode.vim) 201 | - [unimpaired](https://github.com/tpope/vim-unimpaired) 202 | 203 | ## By filetype 204 | 205 | #### C and C++ 206 | 207 | - [a](https://github.com/vim-scripts/a.vim) 208 | - [clang_complete](https://github.com/Rip-Rip/clang_complete) 209 | - [color_coded](https://github.com/jeaye/color_coded.git) 210 | - [lh-cpp](https://github.com/LucHermitte/lh-cpp) 211 | 212 | #### Clojure 213 | 214 | - [clojure-highlight](https://github.com/guns/vim-clojure-highlight) 215 | - [fireplace](https://github.com/tpope/vim-fireplace) 216 | - [paredit](https://github.com/kovisoft/paredit) 217 | - [rainbow_parentheses](https://github.com/junegunn/rainbow_parentheses.vim) 218 | - [salve](https://github.com/tpope/vim-salve) 219 | - [sexp-mappings-for-regular-people](https://github.com/tpope/vim-sexp-mappings-for-regular-people) 220 | - [sexp](https://github.com/guns/vim-sexp) 221 | 222 | #### HTML 223 | 224 | - [emmet](https://github.com/mattn/emmet-vim) 225 | - [html5](https://github.com/othree/html5.vim) 226 | 227 | #### Go 228 | 229 | [go](https://github.com/fatih/vim-go) 230 | 231 | #### Java 232 | 233 | - [javacomplete2](https://github.com/artur-shaik/vim-javacomplete2) 234 | 235 | #### Javascript 236 | 237 | - [es.next.syntax](https://github.com/othree/es.next.syntax.vim) 238 | - [esformatter](https://github.com/millermedeiros/vim-esformatter) 239 | - [javascript-libraries-syntax](https://github.com/othree/javascript-libraries-syntax.vim) 240 | - [javascript-syntax](https://github.com/jelera/vim-javascript-syntax) 241 | - [javascript](https://github.com/pangloss/vim-javascript) 242 | - [node-vim-debugger](https://github.com/sidorares/node-vim-debugger) 243 | - [node](https://github.com/moll/vim-node) 244 | - [tern_for_vim](https://github.com/ternjs/tern_for_vim) 245 | - [yajs](https://github.com/othree/yajs.vim) 246 | 247 | #### Lua 248 | 249 | - [lua-ftplugin](https://github.com/xolox/vim-lua-ftplugin) 250 | - [lua-inspect](https://github.com/xolox/vim-lua-inspect) 251 | 252 | #### Python 253 | 254 | - [braceless](https://github.com/tweekmonster/braceless.vim) 255 | - [flake8](https://github.com/nvie/vim-flake8) 256 | - [impsort](https://github.com/tweekmonster/impsort.vim) 257 | - [jedi](https://github.com/davidhalter/jedi-vim) 258 | - [python-mode](https://github.com/klen/python-mode) 259 | 260 | #### TeX 261 | 262 | - [vimtex](https://github.com/lervag/vimtex) 263 | 264 | #### VimL 265 | 266 | - [scriptease](https://github.com/tpope/vim-scriptease) 267 | --------------------------------------------------------------------------------