├── CHANGELOG ├── LICENSE ├── README.md └── plugin └── cargo.vim /CHANGELOG: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.0.2 4 | 5 | * Add CargoClean, CargoDoc, CargoNew, and CargoUpdate 6 | * Set compiler and makeprg to cargo and change default command to make 7 | 8 | ## 0.0.1 9 | 10 | * Allow running dispatch implictly, removing the dependency. This makes it possible 11 | to run any dispatcher or cargo variant you like. 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Timon Vonk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vim Cargo 2 | 3 | Simple vim command bindings to quickly run cargo stuff from vim. 4 | 5 | ## Commands Available, mapping with their Cargo equivalant: 6 | 7 | * CargoBench 8 | * CargoBuild 9 | * CargoClean 10 | * CargoDoc 11 | * CargoNew 12 | * CargoRun 13 | * CargoTest 14 | * CargoUpdate 15 | 16 | ## Installation 17 | 18 | It's recommended to use a plugin manager to manage your vim plugins. A few examples: 19 | 20 | ### Vundle 21 | 22 | Plugin 'timonv/vim-cargo' 23 | 24 | ### Plug 25 | 26 | Plug 'timonv/vim-cargo' 27 | 28 | 29 | ### NeoBundle 30 | 31 | NeoBundle 'timonv/vim-cargo' 32 | 33 | ## Usage 34 | 35 | Simply run one of the commands. By default it just delegates to cargo. 36 | 37 | You can overwrite g:cargo_command to, for instance, support dispatch: 38 | 39 | ``` 40 | let g:cargo_command = "Dispatch cargo {cmd}" 41 | ``` 42 | 43 | ## Contribute 44 | 45 | * Fork 46 | * Code 47 | * Test 48 | * Pull-request 49 | -------------------------------------------------------------------------------- /plugin/cargo.vim: -------------------------------------------------------------------------------- 1 | if exists('g:vim_cargo') 2 | finish 3 | endif 4 | let vim_cargo=1 5 | 6 | autocmd BufRead,BufNewFile Cargo.toml,Cargo.lock,*.rs compiler cargo 7 | autocmd BufRead,BufNewFile Cargo.toml,Cargo.lock,*.rs setlocal makeprg=cargo 8 | 9 | if !exists('g:cargo_command') 10 | let g:cargo_command = "make {cmd}" 11 | endif 12 | 13 | com! -nargs=* CargoBench call cargo#run('bench ' . ) 14 | com! -nargs=* CargoBuild call cargo#run('build ' . ) 15 | com! -nargs=* CargoCheck call cargo#run('check ' . ) 16 | com! -nargs=* CargoClean call cargo#run('clean ' . ) 17 | com! -nargs=* CargoDoc call cargo#run('doc ' . ) 18 | com! -nargs=* CargoRun call cargo#run('run ' . ) 19 | com! -nargs=* CargoTest call cargo#run('test ' . ) 20 | com! -nargs=* CargoUpdate call cargo#run('update ' . ) 21 | com! -complete=file -nargs=+ CargoNew call cargo#run('new ' . ) 22 | 23 | func! cargo#run(cmd) 24 | let s:cargo_command = substitute(g:cargo_command, "{cmd}", a:cmd, 'g') 25 | execute s:cargo_command 26 | endf 27 | --------------------------------------------------------------------------------