Skip to content

Commit

Permalink
Added and updated some plugins
Browse files Browse the repository at this point in the history
Added: vim-ruby, typescript-vim, vim-javascript
Updated: rust-vim
  • Loading branch information
amix committed Nov 16, 2019
1 parent ff0ede6 commit 97e3db7
Show file tree
Hide file tree
Showing 108 changed files with 12,437 additions and 898 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ I recommend reading the docs of these plugins to understand them better. Each pl
* [vim-markdown](https://github.com/tpope/vim-markdown)
* [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx
* [vim-go](https://github.com/fatih/vim-go)
* [vim-ruby](https://github.com/vim-ruby/vim-ruby)
* [typescript-vim](https://github.com/leafgarland/typescript-vim)
* [vim-javascript](https://github.com/pangloss/vim-javascript)


## How to include your own stuff?
Expand Down
7 changes: 7 additions & 0 deletions sources_non_forked/rust.vim/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sudo: required
services:
- docker
language: generic
script: |
cd test && ./run-tests
10 changes: 10 additions & 0 deletions sources_non_forked/rust.vim/.vintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmdargs:
# Checking more strictly
severity: style_problem

policies:
# Disable a violation
ProhibitUnnecessaryDoubleQuote:
enabled: false
ProhibitImplicitScopeVariable:
enabled: false
27 changes: 27 additions & 0 deletions sources_non_forked/rust.vim/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Hi, and thanks for reporting an issue with rust.vim.
Details about your environment will help us assist you.
Please edit this template!
-->

* rust.vim version: <!-- Describe if you use a Vim plugin manager, and you
can use it to tell which version of rust.vim you are running. -->

Steps to reproduce:

<!-- It's best to try to reproduce the issue with the master version of
rust.vim. The issue may already be fixed! -->
_?_

Expected vs. actual behavior:

_?_

Paste debugging info from the Rust Vim plugin via _one_ of the following
commands: `:RustInfo`, `:RustInfoToClipboard`, or `:RustInfoToFile <filename>`.

_?_
66 changes: 39 additions & 27 deletions sources_non_forked/rust.vim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,47 @@
## Description

This is a Vim plugin that provides [Rust][r] file detection, syntax highlighting, formatting,
[Syntastic][syn] integration, and more.
[Syntastic][syn] integration, and more. It requires Vim 8 or higher for full functionality.
Some things may not work on earlier versions.

## Installation

### Using [Vundle][v]
Use one of the following package managers:

1. Add `Plugin 'rust-lang/rust.vim'` to `~/.vimrc`
2. `:PluginInstall` or `$ vim +PluginInstall +qall`

*Note:* Vundle will not automatically detect Rust files properly if `filetype
* [Vim8 packages][vim8pack]:
* `git clone https://github.com/rust-lang/rust.vim ~/.vim/pack/plugins/start/rust.vim`
* [Vundle][v]:
* Add `Plugin 'rust-lang/rust.vim'` to `~/.vimrc`
* `:PluginInstall` or `$ vim +PluginInstall +qall`
* *Note:* Vundle will not automatically detect Rust files properly if `filetype
on` is executed before Vundle. Please check the [quickstart][vqs] for more
details.

### Using [Pathogen][p]

```shell
git clone --depth=1 https://github.com/rust-lang/rust.vim.git ~/.vim/bundle/rust.vim
```

### Using [NeoBundle][nb]

1. Add `NeoBundle 'rust-lang/rust.vim'` to `~/.vimrc`
2. Re-open vim or execute `:source ~/.vimrc`

### Using [vim-plug][vp]

1. Add `Plug 'rust-lang/rust.vim'` to `~/.vimrc`
2. `:PlugInstall` or `$ vim +PlugInstall +qall`
details. Errors such as `Not an editor command: RustFmt` may occur if Vundle
is misconfigured with this plugin.
* [Pathogen][p]:
* `git clone --depth=1 https://github.com/rust-lang/rust.vim.git ~/.vim/bundle/rust.vim`
* [vim-plug][vp]:
* Add `Plug 'rust-lang/rust.vim'` to `~/.vimrc`
* `:PlugInstall` or `$ vim +PlugInstall +qall`
* [dein.vim][d]:
* Add `call dein#add('rust-lang/rust.vim')` to `~/.vimrc`
* `:call dein#install()`
* [NeoBundle][nb]:
* Add `NeoBundle 'rust-lang/rust.vim'` to `~/.vimrc`
* Re-open vim or execute `:source ~/.vimrc`

## Features

### Error checking with [Syntastic][syn]

`rust.vim` automatically registers `rustc` as a syntax checker
with [Syntastic][syn]. Check Syntastic's documentation for
information on how to customize its behaviour.
`rust.vim` automatically registers `cargo` as a syntax checker with
[Syntastic][syn], if nothing else is specified. See `:help rust-syntastic`
for more details.

### Source browsing with [Tagbar][tgbr]

The installation of Tagbar along with [Universal Ctags][uctags] is recommended
for a good Tagbar experience. For other kinds of setups, `rust.vim` tries to
configure Tagbar to some degree.

### Formatting with [rustfmt][rfmt]

Expand Down Expand Up @@ -68,7 +73,10 @@ If you set g:rust_clip_command RustPlay will copy the url to the clipboard.

let g:rust_clip_command = 'xclip -selection clipboard'

[rfmt]: https://crates.io/crates/rustfmt/
### Running a test under cursor

In cargo project, the `:RustTest` command will run a test under the cursor.
This is useful when your project is bigger and running all tests take longer time.

## Help

Expand All @@ -91,7 +99,11 @@ LICENSE-MIT for details.
[p]: https://github.com/tpope/vim-pathogen
[nb]: https://github.com/Shougo/neobundle.vim
[vp]: https://github.com/junegunn/vim-plug
[d]: https://github.com/Shougo/dein.vim
[rfmt]: https://github.com/rust-lang-nursery/rustfmt
[syn]: https://github.com/scrooloose/syntastic
[tgbr]: https://github.com/majutsushi/tagbar
[uctags]: https://ctags.io
[wav]: https://github.com/mattn/webapi-vim
[pp]: https://play.rust-lang.org/
[vim8pack]: http://vimhelp.appspot.com/repeat.txt.html#packages
23 changes: 15 additions & 8 deletions sources_non_forked/rust.vim/after/syntax/rust.vim
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
if !exists('g:rust_conceal') || g:rust_conceal == 0 || !has('conceal') || &enc != 'utf-8'
finish
scriptencoding utf-8

if !get(g:, 'rust_conceal', 0) || !has('conceal') || &encoding !=# 'utf-8'
finish
endif

" For those who don't want to see `::`...
if exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
syn match rustNiceOperator "::" conceal cchar=
if get(g:, 'rust_conceal_mod_path', 0)
syn match rustNiceOperator "::" conceal cchar=
endif

syn match rustRightArrowHead contained ">" conceal cchar= 
Expand All @@ -18,17 +20,22 @@ syn match rustNiceOperator "=>" contains=rustFatRightArrowHead,rustFatRightArrow
syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar=

" For those who don't want to see `pub`...
if exists('g:rust_conceal_pub') && g:rust_conceal_pub != 0
if get(g:, 'rust_conceal_pub', 0)
syn match rustPublicSigil contained "pu" conceal cchar=
syn match rustPublicRest contained "b" conceal cchar= 
syn match rustNiceOperator "pub " contains=rustPublicSigil,rustPublicRest
endif

hi link rustNiceOperator Operator

if !(exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0)
if !get(g:, 'rust_conceal_mod_path', 0)
hi! link Conceal Operator

" And keep it after a colorscheme change
au ColorScheme <buffer> hi! link Conceal Operator
augroup rust.vim.after
autocmd!
" And keep it after a colorscheme change
autocmd ColorScheme <buffer> hi! link Conceal Operator
augroup END
endif

" vim: set et sw=4 sts=4 ts=8:
142 changes: 86 additions & 56 deletions sources_non_forked/rust.vim/autoload/cargo.vim
Original file line number Diff line number Diff line change
@@ -1,85 +1,115 @@
function! cargo#Load()
" Utility call to get this script loaded, for debugging
endfunction

function! cargo#cmd(args)
silent! clear
if !a:args
execute "!" . "cargo ". a:args
execute "! cargo" a:args
endfunction

function! s:nearest_cargo(...) abort
" If the second argument is not specified, the first argument determines
" whether we will start from the current directory or the directory of the
" current buffer, otherwise, we start with the provided path on the
" second argument.

let l:is_getcwd = get(a:, 1, 0)
if l:is_getcwd
let l:starting_path = get(a:, 2, getcwd())
else
echom "Missing arguments"
let l:starting_path = get(a:, 2, expand('%:p:h'))
endif

return findfile('Cargo.toml', l:starting_path . ';')
endfunction

function! cargo#build(args)
silent! clear
if !a:args
execute "!" . "cargo build " . a:args
else
execute "!" . "cargo build"
function! cargo#nearestCargo(is_getcwd) abort
return s:nearest_cargo(a:is_getcwd)
endfunction

function! cargo#nearestWorkspaceCargo(is_getcwd) abort
let l:nearest = s:nearest_cargo(a:is_getcwd)
while l:nearest !=# ''
for l:line in readfile(l:nearest, '', 0x100)
if l:line =~# '\V[workspace]'
return l:nearest
endif
endfor
let l:next = fnamemodify(l:nearest, ':p:h:h')
let l:nearest = s:nearest_cargo(0, l:next)
endwhile
return ''
endfunction

function! cargo#nearestRootCargo(is_getcwd) abort
" Try to find a workspace Cargo.toml, and if not found, take the nearest
" regular Cargo.toml
let l:workspace_cargo = cargo#nearestWorkspaceCargo(a:is_getcwd)
if l:workspace_cargo !=# ''
return l:workspace_cargo
endif
silent! clear
execute "!" . "cargo build"
return s:nearest_cargo(a:is_getcwd)
endfunction


function! cargo#build(args)
call cargo#cmd("build " . a:args)
endfunction

function! cargo#clean(args)
silent! clear
if !a:args
execute "!" . "cargo clean " . a:args
else
execute "!" . "cargo clean"
endif
silent! clear
execute "!" . "cargo clean"
call cargo#cmd("clean " . a:args)
endfunction

function! cargo#doc(args)
silent! clear
if !a:args
execute "!" . "cargo doc " . a:args
else
execute "!" . "cargo doc"
endif
call cargo#cmd("doc " . a:args)
endfunction

function! cargo#new(args)
silent! clear
if !a:args
execute "!cargo new " . a:args
:cd `=a:args`
else
echom "Missing arguments"
endif
call cargo#cmd("new " . a:args)
cd `=a:args`
endfunction

function! cargo#init(args)
silent! clear
if !a:args
execute "!" . "cargo init " . a:args
else
execute "!" . "cargo init"
endif
call cargo#cmd("init " . a:args)
endfunction

function! cargo#run(args)
silent! clear
if !a:args
execute "!" . "cargo run " . a:args
else
execute "!" . "cargo run"
endif
call cargo#cmd("run " . a:args)
endfunction

function! cargo#test(args)
silent! clear
if !a:args
execute "!" . "cargo test " . a:args
else
execute "!" . "cargo test"
endif
call cargo#cmd("test " . a:args)
endfunction

function! cargo#bench(args)
silent! clear
if !a:args
execute "!" . "cargo bench " . a:args
else
execute "!" . "cargo bench"
call cargo#cmd("bench " . a:args)
endfunction

function! cargo#runtarget(args)
let l:filename = expand('%:p')
let l:read_manifest = system('cargo read-manifest')
let l:metadata = json_decode(l:read_manifest)
let l:targets = get(l:metadata, 'targets', [])
let l:did_run = 0
for l:target in l:targets
let l:src_path = get(l:target, 'src_path', '')
let l:kinds = get(l:target, 'kind', [])
let l:name = get(l:target, 'name', '')
if l:src_path == l:filename
if index(l:kinds, 'example') != -1
let l:did_run = 1
call cargo#run("--example " . shellescape(l:name) . " " . a:args)
return
elseif index(l:kinds, 'bin') != -1
let l:did_run = 1
call cargo#run("--bin " . shellescape(l:name) . " " . a:args)
return
endif
endif
endfor
if l:did_run != 1
call cargo#run(a:args)
return
endif
endfunction

" vim: set et sw=4 sts=4 ts=8:
26 changes: 26 additions & 0 deletions sources_non_forked/rust.vim/autoload/cargo/quickfix.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function! cargo#quickfix#CmdPre() abort
if &filetype ==# 'rust' && get(b:, 'current_compiler', '') ==# 'cargo'
" Preserve the current directory, and 'lcd' to the nearest Cargo file.
let b:rust_compiler_cargo_qf_has_lcd = haslocaldir()
let b:rust_compiler_cargo_qf_prev_cd = getcwd()
let b:rust_compiler_cargo_qf_prev_cd_saved = 1
let l:nearest = fnamemodify(cargo#nearestRootCargo(0), ':h')
execute 'lchdir! '.l:nearest
else
let b:rust_compiler_cargo_qf_prev_cd_saved = 0
endif
endfunction

function! cargo#quickfix#CmdPost() abort
if exists("b:rust_compiler_cargo_qf_prev_cd_saved") && b:rust_compiler_cargo_qf_prev_cd_saved
" Restore the current directory.
if b:rust_compiler_cargo_qf_has_lcd
execute 'lchdir! '.b:rust_compiler_cargo_qf_prev_cd
else
execute 'chdir! '.b:rust_compiler_cargo_qf_prev_cd
endif
let b:rust_compiler_cargo_qf_prev_cd_saved = 0
endif
endfunction

" vim: set et sw=4 sts=4 ts=8:
Loading

0 comments on commit 97e3db7

Please sign in to comment.