├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── _assets └── syntastic_foodcritic.png ├── after └── plugin │ └── settings │ ├── rspec.vim │ └── tabular.vim ├── doc └── mirror_pond.txt ├── ftdetect └── template.vim ├── ftplugin ├── gitrebase.vim ├── json.vim ├── markdown.vim ├── ps1.vim ├── ruby.vim ├── vim.vim └── vimwiki.vim ├── gvimrc ├── install.sh ├── plugin └── settings │ ├── airline.vim │ ├── bbye.vim │ ├── ctrlp.vim │ ├── fugitive.vim │ ├── functions.vim │ ├── keymappings.vim │ ├── markdown.vim │ ├── netrw.vim │ ├── signify.vim │ ├── startify.vim │ ├── supertab.vim │ ├── syntastic.vim │ ├── terminal.vim │ └── tmux.vim └── vimrc /.gitignore: -------------------------------------------------------------------------------- 1 | bundle/ 2 | .netrwhist 3 | undo/ 4 | sessions/ 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Mirror Pond 2 | Copyright 2012-2013 Doug Ireton 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mirror Pond 2 | An opinionated Vim distribution for Ruby and Chef development. Mirror Pond tries 3 | to adhere closely to the spirit and "grammar" of Vim, while extending it to 4 | better support Ruby and Chef development through judicious use of plugins. 5 | 6 | ## Name 7 | Mirror Pond is named after my favorite beer - [Deschutes Mirror Pond Pale 8 | Ale](http://www.deschutesbrewery.com/brew/mirror-pond-pale-ale). 9 | 10 | It seemed appropriate to combine two of my favorite things - beer and Vim. 11 | 12 | ## Features 13 | ### Chef 14 | 1. `gf` on any `include_recipe` to jump to the included recipe. 15 | You can even jump to the `default` recipe, e.g. `gf` on `include_recipe 16 | 'git'` will jump to the `default.rb` recipe in the `git` cookbook. 17 | 18 | 2. If you have [Foodcritic](http://acrmp.github.io/foodcritic/) installed, Vim 19 | will display Foodcritic errors inline via [Syntastic](https://github.com/scrooloose/syntastic). 20 | 21 | ![Syntastic Foodcritic errors](_assets/syntastic_foodcritic.png "Syntastic 22 | Foodcritic errors") 23 | 24 | ### Ruby 25 | 1. If you have [Rubocop](https://github.com/bbatsov/rubocop) installed, Vim will display Rubocop errors inline via 26 | Syntastic. 27 | 28 | 2. Surround variable with "#{ * }" using Tim Pope's Surround plugin. 29 | 30 | 3. Surround text in Erb templates, "<% * -%>" and "<%= * %>" using Tim Pope's Surround plugin. 31 | 32 | 4. Insert Ruby hash rocket, `=>` via ``. 33 | 34 | ## Installation 35 | ### First time install for Mac OS X or Linux 36 | 1. Clone this repository: 37 | 38 | ```sh 39 | $ git clone https://github.com/dougireton/mirror_pond.git ~/.vim 40 | ``` 41 | 42 | 2. Chmod the install.sh script: 43 | 44 | ```sh 45 | $ chmod u+x ~/.vim/install.sh 46 | ``` 47 | 48 | 3. Run the install.sh script 49 | 50 | ```sh 51 | $ ~/.vim/install.sh 52 | ``` 53 | 54 | 4. Now you are ready to run Vim. 55 | 56 | ### First time install for Windows 57 | 1. Clone this repository: 58 | 59 | ```bat 60 | c:\> git clone https://github.com/dougireton/mirror_pond.git $HOME\.vim 61 | ``` 62 | 63 | 2. If you are using Vim < 7.4, you will need to create symlinks 64 | to .vimrc and .gvimrc: 65 | 66 | ```bat 67 | c:\> mklink $HOME\_vimrc $HOME\.vim\vimrc 68 | c:\> mklink $HOME\_gvimrc $HOME\.vim\gvimrc 69 | ``` 70 | 71 | 3. Make the .vim/bundle directory: 72 | ```bat 73 | c:\> mkdir $HOME\.vim\bundle 74 | ``` 75 | 76 | 4. Setup [Vundle]: 77 | 78 | ```bat 79 | c:\> git clone https://github.com/gmarik/vundle.git $HOME\.vim\bundle\vundle 80 | ``` 81 | 82 | 5. Install configured bundles: 83 | 84 | Launch `vim`, run `:BundleInstall` 85 | (or `vim +BundleInstall +qall` for CLI lovers) 86 | -------------------------------------------------------------------------------- /_assets/syntastic_foodcritic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dougireton/mirror_pond/2677f2e69c71bc251264be129e8b6859dad90ccb/_assets/syntastic_foodcritic.png -------------------------------------------------------------------------------- /after/plugin/settings/rspec.vim: -------------------------------------------------------------------------------- 1 | " https://github.com/thoughtbot/vim-rspec 2 | nnoremap rf :call RunCurrentSpecFile() 3 | nnoremap rs :call RunNearestSpec() 4 | nnoremap rl :call RunLastSpec() 5 | nnoremap ra :call RunAllSpecs() 6 | 7 | " Run rspec tests via Tim Pope's Dispatch plugin if it's loaded 8 | if exists("g:loaded_dispatch") 9 | let g:rspec_command = "Dispatch bundle exec rspec {spec}" 10 | endif 11 | -------------------------------------------------------------------------------- /after/plugin/settings/tabular.vim: -------------------------------------------------------------------------------- 1 | if !exists(':Tabularize') 2 | finish "quit here 3 | endif 4 | 5 | "align on first = 6 | nnoremap a= :Tabularize /^[^=]*\zs= 7 | vnoremap a= :Tabularize /^[^=]*\zs= 8 | 9 | "align on first : 10 | nnoremap a: :Tabularize /^[^:]*:\zs/l0c1 11 | vnoremap a: :Tabularize /^[^:]*:\zs/l0c1 12 | 13 | " align on Ruby hash rocket 14 | nnoremap a> :Tabularize /=> 15 | vnoremap a> :Tabularize /=> 16 | 17 | " align on first comma 18 | nnoremap a, :Tabularize /,\zs 19 | vnoremap a, :Tabularize /,\zs 20 | -------------------------------------------------------------------------------- /doc/mirror_pond.txt: -------------------------------------------------------------------------------- 1 | *mirror_pond.txt* An opinionated Vim distribution tailored for Ruby and Chef 2 | 3 | Author: Doug Ireton 4 | License: Apache 2.0 5 | 6 | =============================================================================== 7 | CONTENTS *mirror_pond-contents* 8 | 9 | 1. Introduction |mirror_pond| 10 | 2. Basic Mappings |mirror_pond-basic-mappings| 11 | 3. Fugitive Mappings |mirror_pond-fugitive-mappings| 12 | 4. Tabular Mappings |mirror_pond-tabular-mappings| 13 | 5. Netrw Mappings |mirror_pond-netrw-mappings| 14 | 6. Ctrl-P Mappings |mirror_pond-ctrlp-mappings| 15 | 7. RSpec Mappings |mirror_pond-rspec-mappings| 16 | 8. Filetype Plugin Mappings |mirror_pond-filetype-mappings| 17 | 9. Gitrebase Mappings |mirror_pond-gitrebase-mappings| 18 | 10. Ruby Mappings |mirror_pond-ruby-mappings| 19 | 20 | =============================================================================== 21 | 1. Introduction *mirror_pond* 22 | 23 | mirror_pond is an opinionated Vim distribution tailored for Ruby and Chef 24 | development. 25 | 26 | 27 | =============================================================================== 28 | 2. Basic Mappings *mirror_pond-basic-mappings* 29 | 30 | *mirror_pond-i_kj* 31 | kj Exit to Normal mode 32 | 33 | *mirror_pond-Y* 34 | Y Yank from cursor pos to EOL. 35 | 36 | *mirror_pond-* 37 | [count] In Normal mode, move cursor left [count] windows. With 38 | no count, moves one window. 39 | 40 | *mirror_pond-* 41 | [count] In Normal mode, move cursor down [count] windows. With 42 | no count, moves one window. 43 | 44 | *mirror_pond-* 45 | [count] In Normal mode, move cursor up [count] windows. With 46 | no count, moves one window. 47 | 48 | *mirror_pond-* 49 | [count] In Normal mode, move cursor right [count] windows. With 50 | no count, moves one window. 51 | 52 | *mirror_pond-quickfix* 53 | qc In Normal mode, close the |quickfix-window|. 54 | qo In Normal mode, open the |quickfix-window| if there 55 | are errors. 56 | 57 | *mirror_pond-&* 58 | & Repeat the last :substitute command and preserve flags 59 | 60 | *mirror_pond-'* 61 | ' jump to mark's line/col position, instead of just the 62 | beginning of the line. 63 | 64 | *mirror_pond-dw* 65 | dw Delete trailing whitespace in buffer 66 | 67 | *mirror_pond-e* 68 | e Re-indent entire buffer 69 | 70 | *mirror_pond-a* 71 | a Switch to alternate file. See CTRL-^ for more 72 | details. 73 | 74 | 75 | *mirror_pond-c_,c_* 76 | 77 | In command mode, use ^p and ^n to navigate and filter 78 | command-line history 79 | 80 | *mirror_pond-c_%%* 81 | %% In command mode, paste fully-qualified path of current 82 | %file into the command window 83 | 84 | *mirror_pond-c_w!!* 85 | w!! In command mode, Write current file using sudo. *nix 86 | systems only. 87 | 88 | ============================================================================== 89 | FUGITIVE MAPPINGS *mirror_pond-fugitive-mappings* 90 | 91 | Normal Mode:~ 92 | ------------ 93 | gs :Gstatus 94 | gc :Gcommit 95 | gl :Glog 96 | gw :Gwrite 97 | gd :Gdiff 98 | 99 | ============================================================================== 100 | TABULAR MAPPINGS *mirror_pond-tabular-mappings* 101 | 102 | Normal and Visual Mode:~ 103 | ----------------------- 104 | The following mappings are defined for both Normal and Visual modes. 105 | 106 | a= Align contiguous lines on first '=' 107 | a: Align contiguous lines on first ':' 108 | a> Align contiguous lines on '=>' (Ruby's hash rocket) 109 | a, Align contiguous lines on first ',' 110 | 111 | ============================================================================== 112 | NETRW MAPPINGS *mirror_pond-netrw-mappings* 113 | 114 | Normal Mode:~ 115 | ------------ 116 | d NetrwReturn: return to Netrw window 117 | 118 | ============================================================================== 119 | CTRL-P MAPPINGS *mirror_pond-ctrlp-mappings* 120 | 121 | Normal Mode:~ 122 | ------------ 123 | cb Launch Ctrl-P in buffer mode 124 | cm Launch Ctrl-P in Most-Recently Used mode 125 | 126 | ============================================================================== 127 | RSPEC MAPPINGS *mirror_pond-rspec-mappings* 128 | 129 | Normal Mode:~ 130 | ------------ 131 | rf Run all specs in the current file 132 | rs Run nearest spec 133 | rl Run last-run spec 134 | ra Run all specs 135 | 136 | 137 | ============================================================================== 138 | FILETYPE PLUGIN MAPPINGS *mirror_pond-filetype-mappings* 139 | 140 | The following mappings are local to the filetype. For example the Ruby 141 | mappings are active only in Ruby files. 142 | 143 | ============================================================================== 144 | GITREBASE MAPPINGS *mirror_pond-gitrebase-mappings* 145 | 146 | These mappings are defined for interactive git rebase and require the Fugitive 147 | plugin. 148 | 149 | Normal Mode:~ 150 | ------------ 151 | P Pick 152 | S Squash 153 | E Edit 154 | R Reword 155 | F Fixup 156 | 157 | ============================================================================== 158 | RUBY MAPPINGS *mirror_pond-ruby-mappings* 159 | 160 | Insert Mode:~ 161 | ------------ 162 | Insert ' => ' (Ruby hashrocket) 163 | 164 | =============================================================================== 165 | vim:ft=help:tw=78:et:ts=2:sw=2:sts=2:norl 166 | -------------------------------------------------------------------------------- /ftdetect/template.vim: -------------------------------------------------------------------------------- 1 | " *.template files are Amazon AWS CloudFormation templates 2 | au BufRead,BufNewFile *.template setfiletype json 3 | -------------------------------------------------------------------------------- /ftplugin/gitrebase.vim: -------------------------------------------------------------------------------- 1 | " ftplugin/gitrebase 2 | " Copyright 2013 Doug Ireton 3 | 4 | " Licensed under the Apache License, Version 2.0 (the "License"); 5 | " you may not use this file except in compliance with the License. 6 | " You may obtain a copy of the License at 7 | 8 | " http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | " Unless required by applicable law or agreed to in writing, software 11 | " distributed under the License is distributed on an "AS IS" BASIS, 12 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | " See the License for the specific language governing permissions and 14 | " limitations under the License. 15 | 16 | nnoremap P :Pick 17 | nnoremap S :Squash 18 | nnoremap E :Edit 19 | nnoremap R :Reword 20 | nnoremap F :Fixup 21 | 22 | -------------------------------------------------------------------------------- /ftplugin/json.vim: -------------------------------------------------------------------------------- 1 | " ftplugin/json 2 | " Copyright 2013 Doug Ireton 3 | 4 | " Licensed under the Apache License, Version 2.0 (the "License"); 5 | " you may not use this file except in compliance with the License. 6 | " You may obtain a copy of the License at 7 | 8 | " http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | " Unless required by applicable law or agreed to in writing, software 11 | " distributed under the License is distributed on an "AS IS" BASIS, 12 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | " See the License for the specific language governing permissions and 14 | " limitations under the License. 15 | 16 | " pretty print JSON buffer 17 | if executable('python') 18 | setlocal equalprg=python\ -m\ json.tool 19 | endif 20 | -------------------------------------------------------------------------------- /ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | " ftplugin/markdown 2 | " Copyright 2013 Doug Ireton 3 | 4 | " Licensed under the Apache License, Version 2.0 (the "License"); 5 | " you may not use this file except in compliance with the License. 6 | " You may obtain a copy of the License at 7 | 8 | " http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | " Unless required by applicable law or agreed to in writing, software 11 | " distributed under the License is distributed on an "AS IS" BASIS, 12 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | " See the License for the specific language governing permissions and 14 | " limitations under the License. 15 | 16 | " wrap lines at 80 17 | setlocal textwidth=80 18 | 19 | " override tabs for Markdown files. 20 | " To produce a code block in Markdown, simply indent every line of the 21 | " block by at least 4 spaces or 1 tab. 22 | setlocal tabstop=4 23 | setlocal softtabstop=4 24 | 25 | " Enable spellchecking for Markdown 26 | setlocal spell 27 | -------------------------------------------------------------------------------- /ftplugin/ps1.vim: -------------------------------------------------------------------------------- 1 | " ftplugin/ps1 2 | " Copyright 2013 Doug Ireton 3 | 4 | " Licensed under the Apache License, Version 2.0 (the "License"); 5 | " you may not use this file except in compliance with the License. 6 | " You may obtain a copy of the License at 7 | 8 | " http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | " Unless required by applicable law or agreed to in writing, software 11 | " distributed under the License is distributed on an "AS IS" BASIS, 12 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | " See the License for the specific language governing permissions and 14 | " limitations under the License. 15 | 16 | " specify 4-space indent for PowerShell files 17 | setlocal expandtab 18 | setlocal tabstop=4 shiftwidth=4 softtabstop=4 19 | -------------------------------------------------------------------------------- /ftplugin/ruby.vim: -------------------------------------------------------------------------------- 1 | " Copyright 2013 Doug Ireton 2 | 3 | " Licensed under the Apache License, Version 2.0 (the "License"); 4 | " you may not use this file except in compliance with the License. 5 | " You may obtain a copy of the License at 6 | 7 | " http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | " Unless required by applicable law or agreed to in writing, software 10 | " distributed under the License is distributed on an "AS IS" BASIS, 11 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | " See the License for the specific language governing permissions and 13 | " limitations under the License. 14 | 15 | " Don't automatically comment the next/previous line after hitting 'o' or 'O' 16 | setlocal formatoptions-=o 17 | 18 | " highlight ruby whitespace errors 19 | let ruby_space_errors = 1 20 | let g:rubycomplete_buffer_loading = 1 21 | let g:rubycomplete_classes_in_global = 1 22 | 23 | " set the 'foldmethod' option to 'syntax' and allow folding of 24 | " classes, modules, methods, code blocks, heredocs and comments. 25 | let ruby_fold = 1 26 | 27 | " Gary Bernhardt's hashrocket 28 | inoremap => 29 | 30 | " Use v or # to get a variable interpolation (inside of a string)} 31 | " ysiw# Wrap the token under the cursor in #{} 32 | " v...s# Wrap the selection in #{} 33 | let b:surround_118 = "#{ \r }" " v 34 | let b:surround_35 = "#{ \r }" " # 35 | 36 | " Select text in an ERb file with visual mode and then press s- or s= 37 | " Or yss- to do entire line. 38 | let b:surround_45 = "<% \r -%>" " - 39 | let b:surround_61 = "<%= \r %>" " = 40 | 41 | " The compiler plugins contain instructions which allow Vim to run the 42 | " specified source file with an appropriate executable, parse any errors, and 43 | " jump to the corresponding error location if required. 44 | compiler ruby 45 | 46 | " From https://github.com/bbatsov/ruby-style-guide#comment-annotations 47 | inoreabbrev todo TODO: 48 | inoreabbrev fixme FIXME: 49 | inoreabbrev optimize OPTIMIZE: 50 | inoreabbrev hack HACK: 51 | inoreabbrev review REVIEW: 52 | -------------------------------------------------------------------------------- /ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | " ftplugin/vim 2 | " Copyright 2013 Doug Ireton 3 | 4 | " Licensed under the Apache License, Version 2.0 (the "License"); 5 | " you may not use this file except in compliance with the License. 6 | " You may obtain a copy of the License at 7 | 8 | " http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | " Unless required by applicable law or agreed to in writing, software 11 | " distributed under the License is distributed on an "AS IS" BASIS, 12 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | " See the License for the specific language governing permissions and 14 | " limitations under the License. 15 | 16 | " specify 2-space indent for Vim files 17 | setlocal expandtab 18 | setlocal tabstop=2 shiftwidth=2 softtabstop=2 19 | 20 | " 'K' on a Vim keyword brings up Vim help 21 | set keywordprg=":help" 22 | -------------------------------------------------------------------------------- /ftplugin/vimwiki.vim: -------------------------------------------------------------------------------- 1 | " ftplugin/vimwiki 2 | " Copyright 2013 Doug Ireton 3 | 4 | " Licensed under the Apache License, Version 2.0 (the "License"); 5 | " you may not use this file except in compliance with the License. 6 | " You may obtain a copy of the License at 7 | 8 | " http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | " Unless required by applicable law or agreed to in writing, software 11 | " distributed under the License is distributed on an "AS IS" BASIS, 12 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | " See the License for the specific language governing permissions and 14 | " limitations under the License. 15 | 16 | " Wrap lines at 80 col 17 | setlocal textwidth=80 18 | 19 | "Enable spellchecking 20 | setlocal spell 21 | -------------------------------------------------------------------------------- /gvimrc: -------------------------------------------------------------------------------- 1 | " Copyright 2013 Doug Ireton 2 | 3 | " Licensed under the Apache License, Version 2.0 (the "License"); 4 | " you may not use this file except in compliance with the License. 5 | " You may obtain a copy of the License at 6 | 7 | " http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | " Unless required by applicable law or agreed to in writing, software 10 | " distributed under the License is distributed on an "AS IS" BASIS, 11 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | " See the License for the specific language governing permissions and 13 | " limitations under the License. 14 | 15 | " maximize screen height. Set screen width to 84. 16 | set lines=99 columns=178 17 | " set fullscreen 18 | 19 | set guioptions-=T " Remove toolbar 20 | set guioptions-=t " Remove tear-off menus 21 | set guioptions+=c " Use :ex command-mode prompts instead of modal 22 | " dialogs 23 | 24 | if has("gui_macvim") 25 | " set guifont=Anonymous\ Pro:h14 26 | set guifont=Anonymous\ Pro\ for\ Powerline:h14 27 | set linespace=2 28 | elseif has("Win32") 29 | set guifont=Consolas:h11 30 | endif 31 | 32 | " Setting these in GVim/MacVim because terminals cannot distinguish between 33 | " and because curses sees them the same 34 | nnoremap 35 | nnoremap 36 | 37 | if has("autocmd") 38 | " Automatically resize viewport splits when resizing MacVim window 39 | autocmd VimResized * wincmd = 40 | endif 41 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | vim_dir="$HOME/.vim" 5 | 6 | if [ ! -d "$vim_dir" ]; then 7 | echo Please git clone mirror_pond to $vim_dir and run this script again... 8 | exit 1 9 | fi 10 | 11 | # Vim 7.4 looks for vimrc and gvimrc in the .vim directory, so only create 12 | # symlinks for Vim < 7.4 13 | vim_version=$(vim --version | grep -o 'Vi IMproved \d\.\d' | cut -d ' ' -f 3) 14 | if (( $( bc <<< "$vim_version < 7.4" ) )); then 15 | ln -s $vim_dir/vimrc ~/.vimrc 16 | ln -s $vim_dir/gvimrc ~/.gvimrc 17 | fi 18 | 19 | if [ "$(uname)" == "Darwin" ]; then 20 | home_library="$HOME/Library" 21 | 22 | cd $home_library 23 | echo Creating backup, swap, and undo dirs under $home_library/Vim/ 24 | mkdir -p Vim/backup 25 | mkdir -p Vim/swap 26 | mkdir -p Vim/undo 27 | fi 28 | 29 | cd $vim_dir 30 | mkdir $vim_dir/bundle 31 | git clone https://github.com/gmarik/vundle.git $vim_dir/bundle/vundle 32 | vim -c BundleInstall! -c "helptags doc" -c qall 33 | echo Thank you for installing Mirror Pond! 34 | -------------------------------------------------------------------------------- /plugin/settings/airline.vim: -------------------------------------------------------------------------------- 1 | if !exists('g:airline_symbols') 2 | let g:airline_symbols = {} 3 | endif 4 | 5 | " unicode symbols 6 | let g:airline_left_sep = '»' 7 | let g:airline_left_sep = '▶' 8 | let g:airline_right_sep = '«' 9 | let g:airline_right_sep = '◀' 10 | let g:airline_symbols.linenr = '␊' 11 | let g:airline_symbols.linenr = '␤' 12 | let g:airline_symbols.linenr = '¶' 13 | let g:airline_symbols.branch = '⎇' 14 | let g:airline_symbols.paste = 'ρ' 15 | let g:airline_symbols.paste = 'Þ' 16 | let g:airline_symbols.paste = '∥' 17 | let g:airline_symbols.whitespace = 'Ξ' 18 | 19 | " display open buffers in tabline 20 | let g:airline#extensions#tabline#enabled = 1 21 | -------------------------------------------------------------------------------- /plugin/settings/bbye.vim: -------------------------------------------------------------------------------- 1 | " '\bd' closes buffer without closing window 2 | nnoremap bd :Bdelete 3 | -------------------------------------------------------------------------------- /plugin/settings/ctrlp.vim: -------------------------------------------------------------------------------- 1 | " ignore .git dirs 2 | let g:ctrlp_custom_ignore = { 3 | \ 'dir': '\.git$' 4 | \ } 5 | 6 | " show dotfiles and dotdirs 7 | let g:ctrlp_show_hidden = 1 8 | 9 | " keymappings for Ctrl-P 10 | nnoremap cb :CtrlPBuffer 11 | nnoremap cm :CtrlPMRU 12 | 13 | " tags = ct 14 | nnoremap ct :CtrlPTag 15 | " directory = cd 16 | " line = cl 17 | " changes = cc 18 | 19 | " registers = cr 20 | " marks = c' 21 | -------------------------------------------------------------------------------- /plugin/settings/fugitive.vim: -------------------------------------------------------------------------------- 1 | " Fugitive key mappings 2 | nnoremap gs :Gstatus 3 | nnoremap gc :Gcommit 4 | nnoremap gl :Glog 5 | nnoremap gw :Gwrite 6 | nnoremap gd :Gdiff 7 | nnoremap gb :Git checkout -b 8 | nnoremap gp :Git push 9 | -------------------------------------------------------------------------------- /plugin/settings/functions.vim: -------------------------------------------------------------------------------- 1 | " from http://vimcasts.org/episodes/tidying-whitespace/ 2 | function! Preserve(command) 3 | " Preparation: save last search, and cursor position. 4 | let l:win_view = winsaveview() 5 | let l:last_search = getreg('/') 6 | 7 | " execute the command without adding to the changelist/jumplist: 8 | execute 'keepjumps ' . a:command 9 | 10 | " Clean up: restore previous search history, and cursor position 11 | call winrestview(l:win_view) 12 | call setreg('/', l:last_search) 13 | endfunction 14 | 15 | " Convenient command to see the difference between the current buffer and the 16 | " file it was loaded from, thus the changes you made. 17 | " Only define it when not defined already. 18 | if !exists(":DiffOrig") 19 | command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis 20 | \ | wincmd p | diffthis 21 | endif 22 | 23 | " http://dhruvasagar.com/2013/03/28/vim-better-foldtext 24 | function! NeatFoldText() "{{{2 25 | let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' ' 26 | let lines_count = v:foldend - v:foldstart + 1 27 | let lines_count_text = '| ' . printf("%10s", lines_count . ' lines') . ' |' 28 | let foldchar = matchstr(&fillchars, 'fold:\zs.') 29 | let foldtextstart = strpart('+' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) 30 | let foldtextend = lines_count_text . repeat(foldchar, 8) 31 | let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn 32 | return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend 33 | endfunction 34 | " }}}2 35 | -------------------------------------------------------------------------------- /plugin/settings/keymappings.vim: -------------------------------------------------------------------------------- 1 | " ---------------------------------------------------------------------------- 2 | " Key mappings 3 | " ---------------------------------------------------------------------------- 4 | 5 | if has("win32") || has("gui_win32") 6 | " Key mappings for Windows 7 | source $VIMRUNTIME/mswin.vim 8 | endif 9 | 10 | " exit to Normal mode with 'kj' 11 | inoremap kj 12 | 13 | " enable undo of i_CTRL-U 14 | " http://vim.wikia.com/wiki/Recover_from_accidental_Ctrl-U 15 | inoremap u 16 | 17 | " Make 'Y' yank from cursor pos to EOL. This 18 | " makes 'Y' consistent with 'D' which deletes 19 | " from cursor pos to EOL. 20 | nnoremap Y y$ 21 | 22 | " Visually select the text that was last 23 | " edited/pasted. From 24 | " http://vimcasts.org/episodes/bubbling-text/ 25 | nnoremap gV `[v`] 26 | 27 | if !exists("g:loaded_tmux_navigator") 28 | " Make it easier to switch between windows 29 | " From here: http://vimcasts.org/episodes/working-with-windows/ 30 | nnoremap h 31 | nnoremap j 32 | nnoremap k 33 | nnoremap l 34 | endif 35 | 36 | " Open and close the quickfix list 37 | nnoremap qc :cclose 38 | nnoremap qo :cwindow 39 | 40 | " Use ^p and ^n to navigate and filter command-line history 41 | " From Practical Vim by Drew Neil, Tip 34 42 | cnoremap 43 | cnoremap 44 | 45 | " repeat the last :substitute command and preserve flags 46 | " from Practical Vim by Drew Neil: 'Repeat the previous substitute command' 47 | nnoremap & :&& 48 | xnoremap & :&& 49 | 50 | " swap mark motion commands to jump to mark's line and col with right pinky 51 | " see http://items.sjbach.com/319/configuring-vim-right 52 | nnoremap ' ` 53 | nnoremap ` ' 54 | 55 | " paste fully-qualified path of current file into the command window 56 | " This is useful with ex commands like :write, :edit, etc. 57 | " From Practical Vim by Drew Neil, pg 94 58 | cnoremap %% getcmdtype() == ':' ? expand('%:h').'/' : '%%' 59 | 60 | " These functions depend on the Preserve function defined in 61 | " plugins/settings/functions.vim 62 | 63 | " Delete trailing whitespace 64 | nnoremap dw :call Preserve("%s/\\s\\+$//e") 65 | 66 | " Reindent entire file 67 | nnoremap e :call Preserve("normal! gg=G") 68 | 69 | " Quickly switch to alternate file 70 | nnoremap a 71 | 72 | " Write current file using sudo. If you forgot to 'sudo vim filename.txt', use 73 | " this command. 74 | " see 75 | " http://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work 76 | if has("unix") 77 | cnoremap w!! w !sudo tee > /dev/null % 78 | endif 79 | 80 | " Mirrors and reversals 81 | nno fr :set lz'aOma'':'a+1,.g/^/m 'akdd:set lz! 82 | vno fr :set lzOV'>:g/^/m '<' 83 | nmap fR V'a\fR 84 | vno fR c:set ri lz":norm! dd`<:set ri! lz! 85 | -------------------------------------------------------------------------------- /plugin/settings/markdown.vim: -------------------------------------------------------------------------------- 1 | let g:markdown_fenced_languages = ['ruby', 'html', 'javascript', 'css', 'erb=eruby.html', 'bash=sh'] 2 | -------------------------------------------------------------------------------- /plugin/settings/netrw.vim: -------------------------------------------------------------------------------- 1 | " vspilt files to the right window 2 | let g:netrw_altv = 1 3 | 4 | " split files to the bottom window 5 | " let g:netrw_alto = 1 6 | 7 | " Files and directories to hide 8 | let g:netrw_list_hide='.DS_Store,^\.git/$' 9 | 10 | " Default to tree listing 11 | let g:netrw_liststyle = 3 12 | 13 | " define shortcut to return to netrw window 14 | let g:netrw_retmap = 1 15 | nmap d NetrwReturn 16 | 17 | " vpslit when previewing files 18 | let g:netrw_preview = 1 19 | 20 | " 30% of window for netrw, 70% for file 21 | let g:netrw_winsize = 30 22 | 23 | " don't write error msgs to separate window 24 | let g:netrw_use_errorwindow = 0 25 | -------------------------------------------------------------------------------- /plugin/settings/signify.vim: -------------------------------------------------------------------------------- 1 | " This variable determines the VCS to check for and in what order. 2 | let g:signify_vcs_list = [ 'git' ] 3 | 4 | " Don't overwrite signs set by other plugins, e.g. Syntastic 5 | let g:signify_sign_overwrite = 0 6 | -------------------------------------------------------------------------------- /plugin/settings/startify.vim: -------------------------------------------------------------------------------- 1 | let g:startify_skiplist = ['.git/'] 2 | -------------------------------------------------------------------------------- /plugin/settings/supertab.vim: -------------------------------------------------------------------------------- 1 | let g:SuperTabDefaultCompletionType = "context" 2 | let g:SuperTabLongestEnhanced = 1 3 | let g:SuperTabLongestHighlight = 1 4 | -------------------------------------------------------------------------------- /plugin/settings/syntastic.vim: -------------------------------------------------------------------------------- 1 | " use Rubocop syntax checker for Ruby 2 | if executable('rubocop') 3 | let g:syntastic_ruby_checkers = ['mri', 'rubocop'] 4 | endif 5 | -------------------------------------------------------------------------------- /plugin/settings/terminal.vim: -------------------------------------------------------------------------------- 1 | " Settings for terminal Vim 2 | if !has("gui_running") 3 | set title " show Vim buffer info in window title 4 | set mouse=a " use the mouse in terminal Vim 5 | endif 6 | -------------------------------------------------------------------------------- /plugin/settings/tmux.vim: -------------------------------------------------------------------------------- 1 | if exists('$TMUX') 2 | nnoremap tt :!tmux split-window -v -p 15 3 | endif 4 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | " vim:fdm=marker 2 | " vimrc 3 | " ---------------------------------------------------------------------------- 4 | " License {{{1 5 | " ---------------------------------------------------------------------------- 6 | " Copyright 2013 Doug Ireton 7 | 8 | " Licensed under the Apache License, Version 2.0 (the "License"); 9 | " you may not use this file except in compliance with the License. 10 | " You may obtain a copy of the License at 11 | 12 | " http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | " Unless required by applicable law or agreed to in writing, software 15 | " distributed under the License is distributed on an "AS IS" BASIS, 16 | " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | " See the License for the specific language governing permissions and 18 | " limitations under the License. 19 | 20 | " ---------------------------------------------------------------------------- 21 | " Vim package manager {{{1 22 | " ---------------------------------------------------------------------------- 23 | " Setup {{{2 24 | 25 | if has('vim_starting') 26 | set nocompatible " Be iMproved 27 | 28 | " Required: 29 | set runtimepath+=~/.vim/bundle/neobundle.vim/ 30 | endif 31 | 32 | filetype off " Required for Vundle 33 | 34 | call neobundle#begin(expand('~/.vim/bundle/')) 35 | 36 | " Let NeoBundle manage NeoBundle 37 | NeoBundleFetch 'Shougo/neobundle.vim' 38 | 39 | " Several tpope plugins depend on this 40 | NeoBundle 'tpope/vim-projectionist' 41 | 42 | " Various editing plugins {{{2 43 | NeoBundle 'kana/vim-textobj-user' 44 | NeoBundle 'tpope/vim-repeat' 45 | NeoBundle 'tpope/vim-surround' 46 | NeoBundle 'tpope/vim-unimpaired' 47 | NeoBundle 'nelstrom/vim-visual-star-search' 48 | NeoBundle 'ZoomWin' 49 | NeoBundle 'ervandew/supertab' 50 | NeoBundle 'tpope/vim-endwise' 51 | NeoBundle 'godlygeek/tabular' 52 | NeoBundle 'HarnoRanaivo/vim-neatfoldtext' 53 | NeoBundle 'dougireton/vim-qargs' 54 | NeoBundle 'justinmk/vim-sneak' 55 | 56 | " Comment plugin {{{2 57 | NeoBundle 'tpope/vim-commentary' 58 | 59 | " File managers/explorers {{{2 60 | NeoBundle 'Shougo/unite.vim' 61 | 62 | " Shell/OS integration plugins {{{2 63 | NeoBundle 'tpope/vim-dispatch' 64 | 65 | if executable('ack') 66 | NeoBundle 'mileszs/ack.vim' 67 | endif 68 | 69 | if executable('ag') 70 | NeoBundle 'rking/ag.vim' 71 | endif 72 | 73 | NeoBundle 'mhinz/vim-startify' 74 | NeoBundle 'chrisbra/Recover.vim' 75 | 76 | " Tmux plugins {{{2 77 | if executable('tmux') 78 | NeoBundle 'christoomey/vim-tmux-navigator' 79 | NeoBundle 'sjl/vitality.vim' 80 | endif 81 | 82 | " Buffer plugins {{{2 83 | NeoBundle 'moll/vim-bbye' 84 | 85 | " Status bar plugins {{{2 86 | NeoBundle 'bling/vim-airline' 87 | 88 | " Colorschemes {{{2 89 | NeoBundle 'altercation/vim-colors-solarized' 90 | NeoBundle 'endel/vim-github-colorscheme' 91 | 92 | " Ruby plugins {{{2 93 | NeoBundle 'nelstrom/vim-textobj-rubyblock' 94 | NeoBundle 'thoughtbot/vim-rspec' 95 | NeoBundle 'tpope/vim-bundler' 96 | NeoBundle 'tpope/vim-rake' 97 | NeoBundle 'vim-ruby/vim-ruby' 98 | 99 | " Chef plugins {{{2 100 | NeoBundle 'dougireton/vim-chef' 101 | 102 | " JSON plugins {{{2 103 | NeoBundle 'elzr/vim-json' 104 | 105 | " Markdown plugins {{{2 106 | NeoBundle 'tpope/vim-markdown' 107 | 108 | " PowerShell plugins {{{2 109 | NeoBundle 'dougireton/vim-ps1' 110 | 111 | " Wiki {{{2 112 | NeoBundle 'vimwiki' 113 | 114 | " Syntax check on buffer save {{{2 115 | NeoBundle 'scrooloose/syntastic' 116 | 117 | " Source Control plugins {{{2 118 | NeoBundle 'tpope/vim-git' 119 | NeoBundle 'tpope/vim-fugitive' 120 | NeoBundle 'gregsexton/gitv' 121 | NeoBundle 'mhinz/vim-signify' 122 | 123 | call neobundle#end() 124 | 125 | " Filetype detection, plugins, indent, syntax {{{1 126 | if has('autocmd') 127 | filetype plugin indent on " Turn on Filetype detection, plugins, and 128 | " indent 129 | endif 130 | 131 | if has('syntax') && !exists('g:syntax_on') 132 | syntax enable " Turn on syntax highlighting 133 | endif 134 | 135 | " Builtin plugins {{{1 136 | " Load matchit.vim, but only if the user hasn't installed a newer version. 137 | if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' 138 | runtime! macros/matchit.vim 139 | endif 140 | 141 | " load the man plugin for a nice man viewer 142 | runtime! ftplugin/man.vim 143 | 144 | " ---------------------------------------------------------------------------- 145 | " Moving around, searching and patterns {{{1 146 | " ---------------------------------------------------------------------------- 147 | set nostartofline " keep cursor in same column for long-range motion cmds 148 | set incsearch " Highlight pattern matches as you type 149 | set ignorecase " ignore case when using a search pattern 150 | set smartcase " override 'ignorecase' when pattern has upper case 151 | " character 152 | 153 | " ---------------------------------------------------------------------------- 154 | " Tags {{{1 155 | " ---------------------------------------------------------------------------- 156 | 157 | " ---------------------------------------------------------------------------- 158 | " Displaying text {{{1 159 | " ---------------------------------------------------------------------------- 160 | set scrolloff=3 " number of screen lines to show around the cursor 161 | 162 | set linebreak " For lines longer than the window, wrap intelligently. 163 | " This doesn't insert hard line breaks. 164 | 165 | set showbreak=↪\ \ " string to put before wrapped screen lines 166 | 167 | set sidescrolloff=2 " min # of columns to keep left/right of cursor 168 | set display+=lastline " show last line, even if it doesn't fit in the window 169 | 170 | set cmdheight=2 " # of lines for the command window 171 | " cmdheight=2 helps avoid 'Press ENTER...' prompts 172 | 173 | " Define characters to show when you show formatting 174 | " stolen from https://github.com/tpope/vim-sensible 175 | if &listchars ==# 'eol:$' 176 | set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ 177 | if &termencoding ==# 'utf-8' || &encoding ==# 'utf-8' 178 | let &listchars = "tab:\u21e5 ,trail:\u2423,extends:\u21c9,precedes:\u21c7,nbsp:\u26ad" 179 | endif 180 | endif 181 | 182 | set number " show line numbers 183 | 184 | " ---------------------------------------------------------------------------- 185 | " Syntax, highlighting and spelling {{{1 186 | " ---------------------------------------------------------------------------- 187 | set background=dark 188 | 189 | " ignore colorscheme doesn't exist error if solarized isn't installed 190 | silent! colorscheme solarized 191 | 192 | if exists('+colorcolumn') 193 | set colorcolumn=80 " display a line in column 80 to show you 194 | " where to line break. 195 | endif 196 | 197 | " ---------------------------------------------------------------------------- 198 | " Multiple windows {{{1 199 | " ---------------------------------------------------------------------------- 200 | set laststatus=2 " Show a status line, even if there's only one 201 | " Vim window 202 | 203 | set hidden " allow switching away from current buffer w/o writing 204 | 205 | set switchbuf=usetab " Jump to the 1st open window which contains 206 | " specified buffer, even if the buffer is in 207 | " another tab. 208 | " TODO: Add 'split' if you want to split the 209 | " current window for a quickfix error window. 210 | 211 | set statusline= 212 | set statusline+=b%-1.3n\ > " buffer number 213 | set statusline+=\ %{fugitive#statusline()}: 214 | set statusline+=\ %F 215 | set statusline+=\ %M 216 | set statusline+=%R 217 | set statusline+=%#warningmsg# 218 | set statusline+=%{SyntasticStatuslineFlag()} 219 | set statusline+=%* 220 | set statusline+=%= 221 | set statusline+=\ %Y 222 | set statusline+=\ <\ %{&fenc} 223 | set statusline+=\ <\ %{&ff} 224 | set statusline+=\ <\ %p%% 225 | set statusline+=\ %l: 226 | set statusline+=%02.3c " cursor line/total lines 227 | 228 | set helpheight=30 " Set window height when opening Vim help windows 229 | 230 | " ---------------------------------------------------------------------------- 231 | " Multiple tab pages {{{1 232 | " ---------------------------------------------------------------------------- 233 | 234 | " ---------------------------------------------------------------------------- 235 | " Terminal {{{1 236 | " ---------------------------------------------------------------------------- 237 | set ttyfast " this is the 21st century, people 238 | 239 | " ---------------------------------------------------------------------------- 240 | " Using the mouse {{{1 241 | " ---------------------------------------------------------------------------- 242 | 243 | " ---------------------------------------------------------------------------- 244 | " GUI {{{1 245 | " Set these options in .gvimrc 246 | " See help for 'setting-guifont' for tips on how to set guifont on Mac vs Windows 247 | " ---------------------------------------------------------------------------- 248 | 249 | " ---------------------------------------------------------------------------- 250 | " Printing {{{1 251 | " ---------------------------------------------------------------------------- 252 | 253 | " ---------------------------------------------------------------------------- 254 | " Messages and info {{{1 255 | " ---------------------------------------------------------------------------- 256 | set showcmd " In the status bar, show incomplete commands 257 | " as they are typed 258 | 259 | set noshowmode " don't display the current mode (Insert, Visual, Replace) 260 | " in the status line. This info is already shown in the 261 | " Airline status bar. 262 | 263 | set ruler " Always display the current cursor position in 264 | " the Status Bar 265 | 266 | set confirm " Ask to save buffer instead of failing when executing 267 | " commands which close buffers 268 | 269 | " ---------------------------------------------------------------------------- 270 | " Selecting text {{{1 271 | " ---------------------------------------------------------------------------- 272 | 273 | set clipboard=unnamed " Yank to the system clipboard by default 274 | 275 | " ---------------------------------------------------------------------------- 276 | " Editing text {{{1 277 | " ---------------------------------------------------------------------------- 278 | set backspace=indent,eol,start "backspace over everything 279 | 280 | if v:version > 703 || v:version == 703 && has("patch541") 281 | set formatoptions+=j " delete comment char on second line when 282 | " joining two commented lines 283 | endif 284 | 285 | set showmatch " when inserting a bracket, briefly jump to its 286 | " match 287 | 288 | set nojoinspaces " Use only one space after '.' when joining 289 | " lines, instead of two 290 | 291 | set completeopt+=longest " better omni-complete menu 292 | 293 | set nrformats-=octal " don't treat numbers with leading zeros as octal 294 | " when incrementing/decrementing 295 | 296 | " ---------------------------------------------------------------------------- 297 | " Tabs and indenting {{{1 298 | " ---------------------------------------------------------------------------- 299 | set tabstop=2 " tab = 2 spaces 300 | set shiftwidth=2 " autoindent indents 2 spaces 301 | set smarttab " in front of line inserts 'shiftwidth' blanks 302 | set softtabstop=2 303 | set shiftround " round to 'shiftwidth' for "<<" and ">>" 304 | set expandtab 305 | 306 | " ---------------------------------------------------------------------------- 307 | " Folding {{{1 308 | " ---------------------------------------------------------------------------- 309 | if has('folding') 310 | set nofoldenable " When opening files, all folds open by default 311 | set foldtext=NeatFoldText() " Use a custom foldtext function 312 | endif 313 | 314 | " ---------------------------------------------------------------------------- 315 | " Diff mode {{{1 316 | " ---------------------------------------------------------------------------- 317 | set diffopt+=vertical " start diff mode with vertical splits by default 318 | 319 | " ---------------------------------------------------------------------------- 320 | " Mapping {{{1 321 | " ---------------------------------------------------------------------------- 322 | 323 | " ---------------------------------------------------------------------------- 324 | " Reading and writing files {{{1 325 | " ---------------------------------------------------------------------------- 326 | set autoread " Automatically re-read files changed outside 327 | " of Vim 328 | 329 | " ---------------------------------------------------------------------------- 330 | " The swap file {{{1 331 | " ---------------------------------------------------------------------------- 332 | 333 | " Set swap file, backup and undo directories to sensible locations 334 | " Taken from https://github.com/tpope/vim-sensible 335 | " The trailing double '//' on the filenames cause Vim to create undo, backup, 336 | " and swap filenames using the full path to the file, substituting '%' for 337 | " '/', e.g. '%Users%bob%foo.txt' 338 | let s:dir = has('win32') ? '$APPDATA/Vim' : match(system('uname'), "Darwin") > -1 ? '~/Library/Vim' : empty($XDG_DATA_HOME) ? '~/.local/share/vim' : '$XDG_DATA_HOME/vim' 339 | if isdirectory(expand(s:dir)) 340 | if &directory =~# '^\.,' 341 | let &directory = expand(s:dir) . '/swap//,' . &directory 342 | endif 343 | if &backupdir =~# '^\.,' 344 | let &backupdir = expand(s:dir) . '/backup//,' . &backupdir 345 | endif 346 | if exists('+undodir') && &undodir =~# '^\.\%(,\|$\)' 347 | let &undodir = expand(s:dir) . '/undo//,' . &undodir 348 | endif 349 | endif 350 | if exists('+undofile') 351 | set undofile 352 | endif 353 | 354 | " ---------------------------------------------------------------------------- 355 | " Command line editing {{{1 356 | " ---------------------------------------------------------------------------- 357 | set history=200 " Save more commands in history 358 | " See Practical Vim, by Drew Neil, pg 68 359 | 360 | set wildmode=list:longest,full 361 | 362 | " File tab completion ignores these file patterns 363 | " Mac files/dirs 364 | if match(system('uname'), "Darwin") > -1 365 | set wildignore+=.CFUserTextEncoding, 366 | \*/.Trash/*, 367 | \*/Applications/*, 368 | \*/Library/*, 369 | \*/Movies/*, 370 | \*/Music/*, 371 | \*/Pictures/*, 372 | \.DS_Store 373 | endif 374 | 375 | " ignore binary files 376 | set wildignore+=*.exe,*.png,*.jpg,*.gif,*.doc,*.mov,*.xls,*.msi 377 | " Vim files 378 | set wildignore+=*.sw?,*.bak,tags 379 | " Chef 380 | set wildignore+=*/.chef/checksums/* 381 | 382 | set wildmenu 383 | 384 | " Add guard around 'wildignorecase' to prevent terminal vim error 385 | if exists('&wildignorecase') 386 | set wildignorecase 387 | endif 388 | 389 | " ---------------------------------------------------------------------------- 390 | " Executing external commands {{{1 391 | " ---------------------------------------------------------------------------- 392 | 393 | if has("win32") || has("gui_win32") 394 | if executable("PowerShell") 395 | " Set PowerShell as the shell for running external ! commands 396 | " http://stackoverflow.com/questions/7605917/system-with-powershell-in-vim 397 | set shell=PowerShell 398 | set shellcmdflag=-ExecutionPolicy\ RemoteSigned\ -Command 399 | set shellquote=\" 400 | " shellxquote must be a literal space character. 401 | set shellxquote= 402 | endif 403 | endif 404 | 405 | " ---------------------------------------------------------------------------- 406 | " Running make and jumping to errors {{{1 407 | " ---------------------------------------------------------------------------- 408 | 409 | if executable('grep') 410 | set grepprg=grep\ --line-number\ -rIH\ --exclude-dir=tmp\ --exclude-dir=.git\ --exclude=tags\ $*\ /dev/null 411 | endif 412 | 413 | " ---------------------------------------------------------------------------- 414 | " Language specific {{{1 415 | " ---------------------------------------------------------------------------- 416 | 417 | " ---------------------------------------------------------------------------- 418 | " Multi-byte characters {{{1 419 | " ---------------------------------------------------------------------------- 420 | set encoding=utf-8 421 | 422 | " ---------------------------------------------------------------------------- 423 | " Various {{{1 424 | " ---------------------------------------------------------------------------- 425 | set gdefault " For :substitute, use the /g flag by default 426 | 427 | " Don't save global options. These should be set in vimrc 428 | " Idea from tpope/vim-sensible 429 | set sessionoptions-=options 430 | 431 | " ---------------------------------------------------------------------------- 432 | " Autocmds {{{1 433 | " ---------------------------------------------------------------------------- 434 | 435 | 436 | " When editing a file, always jump to the last known cursor position. 437 | " Don't do it for commit messages, when the position is invalid, or when 438 | " inside an event handler (happens when dropping a file on gvim). 439 | " From https://github.com/thoughtbot/dotfiles/blob/master/vimrc 440 | autocmd BufReadPost * 441 | \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | 442 | \ exe "normal g`\"" | 443 | \ endif 444 | 445 | " ---------------------------------------------------------------------------- 446 | " Allow overriding these settings {{{1 447 | " ---------------------------------------------------------------------------- 448 | if filereadable(expand("~/.vimrc.local")) 449 | source ~/.vimrc.local 450 | endif 451 | --------------------------------------------------------------------------------