1
0
mirror of https://github.com/amix/vimrc synced 2025-07-07 08:45:00 +08:00

Added and updated some plugins

Added: vim-ruby, typescript-vim, vim-javascript
Updated: rust-vim
This commit is contained in:
Amir Salihefendic
2019-11-16 18:43:18 +01:00
parent ff0ede6b30
commit 97e3db7fe9
108 changed files with 12408 additions and 869 deletions

View File

View File

@ -0,0 +1,34 @@
# This is brought as reference, to be able to reproduce a new image
FROM alonid/vim-testbed:10
RUN install_vim -tag v7.4.052 -name vim74-trusty -build \
-tag v8.0.1850 -name vim80 -build \
-tag v8.1.0105 -name vim81 -build \
-tag neovim:v0.1.7 -build \
-tag neovim:v0.2.2 -build
ENV PACKAGES="\
bash \
git \
python \
python2-pip \
curl \
"
RUN dnf install -y $PACKAGES
RUN pip install vim-vint==0.3.19
RUN export HOME=/rust ; mkdir $HOME ; curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN chown vimtest.vimtest -R /rust
RUN (dnf remove -y gcc \*-devel ; \
dnf install -y gpm msgpack libvterm libtermkey unibilium ) || true
RUN dnf clean all
RUN echo "export PATH=~/.cargo/bin:$PATH" >> ~/.bashrc
RUN git clone https://github.com/da-x/vader.vim vader && \
cd vader && git checkout v2017-12-26

View File

@ -0,0 +1,24 @@
Given rust (Some Rust code):
fn main() {
println!("Hello World\n")
}
Execute (RustInfo - call it to see that it works):
redir => m
silent RustInfo
redir END
Log m
Execute (RustEmitAsm - see that we actually get assembly output):
silent! w test.rs
silent! e! test.rs
redir => m
silent! RustEmitAsm
redir END
AssertEqual 'asm', &filetype
normal! ggVGy:q<CR>
AssertEqual 1,(@" =~# '\V.section')
bd
call delete('test.rs')
# TODO: a lot more tests

View File

@ -0,0 +1,247 @@
Given rust:
fn main() {
let a = 2;
println!("Hello World\n")
}
Do:
vip=
Expect rust (very basic indentation result):
fn main() {
let a = 2;
println!("Hello World\n")
}
############################################
# Issue #195
Given rust:
fn main() {
let paths: Vec<_> = ({
fs::read_dir("test_data")
.unwrap()
.cloned()
})
.collect();
println!("Hello World\n");
}
Do:
/collect\<cr>
ostatement();\<ESC>\<ESC>
Expect rust (issue #195):
fn main() {
let paths: Vec<_> = ({
fs::read_dir("test_data")
.unwrap()
.cloned()
})
.collect();
statement();
println!("Hello World\n");
}
############################################
# Issue #189
Given rust:
impl X for {
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
where
K: Borrow<Q>,
Q: Ord + ?Sized,
{
self.inner.get(key).map(Entry::new)
}
}
Do:
vip=
Expect rust (issue #189):
impl X for {
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
where
K: Borrow<Q>,
Q: Ord + ?Sized,
{
self.inner.get(key).map(Entry::new)
}
}
############################################
# Issue #189b
Given rust:
impl X for {
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
where
K: Borrow<Q>,
Q: Ord + ?Sized
{
self.inner.get(key).map(Entry::new)
}
}
Do:
vip=
Expect rust (issue #189b):
impl X for {
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
where
K: Borrow<Q>,
Q: Ord + ?Sized
{
self.inner.get(key).map(Entry::new)
}
}
############################################
# Issue #189c
Given rust:
impl X for {
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
where K: Borrow<Q>, Q: Ord + ?Sized
{
self.inner.get(key).map(Entry::new)
}
}
Do:
vip=
Expect rust (issue #189b):
impl X for {
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
where K: Borrow<Q>, Q: Ord + ?Sized
{
self.inner.get(key).map(Entry::new)
}
}
############################################
# Issue #149
Given rust:
fn test() {
let t = "a
wah";
}
Do:
/wah\<cr>
i#\<ESC>\<ESC>
/;\<cr>o
statement();\<ESC>\<ESC>
# Disabled
# Expect rust (issue #149):
fn test() {
let t = "a
#wah";
statement();
}
############################################
# Issue #77
Given rust:
fn test() {
}
Do:
of(x, y,\<CR>z);\<CR>
f((x, y),\<CR>z);\<CR>
# Disabled
# Expect rust (issue #77):
fn test() {
f(x, y,
z);
f((x, y),
z);
}
############################################
# Issue #44
Given rust:
fn main() {
a
let philosophers = vec![
Philosopher::new("Judith Butler"),
Philosopher::new("Gilles Deleuze"),
Philosopher::new("Karl Marx"),
Philosopher::new("Emma Goldman"),
Philosopher::new("Michel Foucault"),
];
}
Do:
/let\<CR>
vip=
# Disabled
# Expect rust (issue #44):
fn main() {
a
let philosophers = vec![
Philosopher::new("Judith Butler"),
Philosopher::new("Gilles Deleuze"),
Philosopher::new("Karl Marx"),
Philosopher::new("Emma Goldman"),
Philosopher::new("Michel Foucault"),
];
}
############################################
# Issue #5
Given rust:
fn f() {
if x &&
y {
}
}
Do:
vip=
Expect rust (issue #5):
fn f() {
if x &&
y {
}
}
############################################
Given rust:
fn f() {
let mut state = State::new(
backend,
header.clone(),
).expect("Something");
}
Do:
vip=
Expect rust (Trailing comma in call):
fn f() {
let mut state = State::new(
backend,
header.clone(),
).expect("Something");
}

View File

@ -0,0 +1,105 @@
#!/usr/bin/env python
import os
import sys
REPO = "alonid/vim-testbed"
TAG = "10-rust.vim"
IMAGE = "%s:%s" % (REPO, TAG)
class Error(Exception):
pass
def system(cmd, capture=False, ok_fail=False):
if capture:
f = os.popen(cmd)
d = f.read()
return d
res = os.system(cmd)
if res != 0:
if ok_fail:
return res
raise Error("Error executing: %s" % (cmd, ))
return 0
def root():
return os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def prep():
d = os.path.join(root(), "test")
for i in [".cargo", ".rustup", ".multirust"]:
l = os.path.join(d, i)
if not os.path.lexists(l):
os.symlink("/rust/" + i, l)
l = os.path.join(root(), "test/.vimrc")
if not os.path.lexists(l):
os.symlink("vimrc", l)
if not os.path.exists(os.path.join(d, ".profile")):
f = open(os.path.join(d, ".profile"), "w")
f.write('export PATH="$HOME/.cargo/bin:$PATH"\n')
f.close()
def docker_run(cmd, interactive=False, ok_fail=False):
prep()
d = root()
params = "-v %s:/testplugin -v %s/test:/home/vimtest" % (d, d)
params += " -e HOME=/home/vimtest"
if not interactive:
params += " -a stderr"
params += " -e VADER_OUTPUT_FILE=/dev/stderr"
params += " -u %s" % (os.getuid(), )
params += " -w /testplugin"
if interactive:
interactive_str = "-it"
else:
interactive_str = ""
return system("docker run %s --rm %s %s %s" % (interactive_str, params, IMAGE, cmd),
ok_fail=ok_fail)
def image_exists():
r = system("docker images -q %s" % (IMAGE, ), capture=True)
return len(r.strip().splitlines()) >= 1
def tests_on_docker():
res = docker_run("bash -lc 'python /home/vimtest/run-tests inside-docker'", ok_fail=True)
if res == 0:
print "Tests OK"
else:
print "Tests Failed"
sys.exit(1)
def inside_docker():
res = system("/vim-build/bin/vim80 --not-a-term '+Vader! test/*.vader'", ok_fail=True)
if res != 0:
sys.exit(1)
def run_with_vimrc(vimrc):
res = system("vim -u %s --not-a-term '+Vader! test/*.vader'" % (vimrc, ), ok_fail=True)
if res != 0:
sys.exit(1)
def main():
if sys.argv[1:] == ["inside-docker"]:
inside_docker()
return
if sys.argv[1:2] == ["run-with-vimrc"]:
run_with_vimrc(sys.argv[2])
return
if not image_exists():
print "Need to take image from remote"
system("docker pull %s" % (IMAGE, ))
if "-i" in sys.argv[1:]:
docker_run("bash -l", interactive=True)
return
tests_on_docker()
if __name__ == "__main__":
main()

View File

@ -0,0 +1,30 @@
" vint: -ProhibitSetNoCompatible
"
set nocompatible
filetype off
" This script is currently designed to be run from within Docker, the
" following paths are intrinsic to the container:
source /rtp.vim
" Paths need prepending (instead of what is originally done
" in vim-testbed) in order to supersede the rust.vim that is
" supplied with Vim.
exec 'set runtimepath=/vader,/testplugin,' . &runtimepath
cd /testplugin
filetype plugin indent on
syntax on
set nocompatible
set tabstop=8
set softtabstop=4
set shiftwidth=4
set expandtab
set backspace=2
set nofoldenable
set foldmethod=syntax
set foldlevelstart=10
set foldnestmax=10
set ttimeoutlen=0