Skip to content

Commit 37bedf8

Browse files
cxw42xuhdev
authored andcommitted
Replace Python core with pure-Vimscript core ("vimcore") (#119)
* Added support for Vimscript core - Added "vim_core" mode. - Use the Vimscript core as the default if it is installed and the user has not specified a different core. - Also, for robustness, accept core modes case-insensitively. - Added VimScript core to documentation * Copied in editorconfig-core-vimscript Per @xuhdev in editorconfig/editorconfig#383 (comment) From cxw42/editorconfig-core-vimscript@4495efd Removed caching code, which is not yet used, per @xuhdev in #119 (comment) * Remove support for all cores but vimscript - Remove the Python core from this plugin - Remove all plugin code related to modes other than vim_core - Update the documentation and README accordingly Note on tests: All tests now pass with `bundle _1.15.4_ exec rake`. Thanks to #119 (comment) for the suggestion on how to make this work. * Add commands to enable/disable plugin :EditorConfigEnable, :EditorConfigDisable * Moved plugin tests from tests/ to tests/plugin/ - This makes room for adding core tests. - Also, renamed and updated plugin_tests submodule * Added core_tests submodule and scripts Scripts are modified from cxw42/editorconfig-core-vimscript@5d85d10 Windows-specific files have CRLF line endings; other files have LF line endings. * Core tests in Travis; added Appveyor - Added the core tests to the existing Travis configuration - Added Appveyor configuration to permit testing on Windows. The configuration is modified from cxw42/editorconfig-core-vimscript@5d85d10 - Updated the README to include both badges. For now, they point to cxw42/editorconfig-vim; that will need to be updated when this branch is merged. * Updated license and documentation Also, fixed typo in Appveyor configuration.
1 parent 68f8136 commit 37bedf8

63 files changed

Lines changed: 2413 additions & 3191 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.appveyor.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# appveyor.yml for editorconfig-vim. Currently only tests the core.
2+
# Modified from https://github.com/ppalaga/ec4j/commit/1c849658fb189cd95bc41af95acd43b4f0d75a48
3+
#
4+
# Copyright (c) 2017--2019 Angelo Zerr and other contributors as
5+
# indicated by the @author tags.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
# @author Chris White (cxw42) - Adapted to editorconfig-vim
20+
21+
# === When to build ===
22+
# See https://www.appveyor.com/docs/how-to/filtering-commits/
23+
24+
skip_commits:
25+
message: /\[minor\]/
26+
files:
27+
- '**/*.md'
28+
29+
# === Build matrix ===
30+
31+
# Win is default; Ubuntu is override. See
32+
# https://www.appveyor.com/blog/2018/04/25/specialized-build-matrix-configuration-in-appveyor/
33+
image:
34+
- Visual Studio 2013
35+
- Ubuntu1604
36+
37+
# === How to build ===
38+
39+
cache:
40+
- C:\vim -> .appveyor.yml, tests\fetch-vim.bat
41+
42+
environment:
43+
VIM_EXE: C:\vim\vim\vim80\vim.exe
44+
45+
for:
46+
# Don't run the Windows build if the commit message includes "[ci-linux]"
47+
-
48+
matrix:
49+
only:
50+
- image: Visual Studio 2013
51+
skip_commits:
52+
message: /\[ci-linux\]/
53+
54+
# Platform-specific configuration for Ubuntu
55+
-
56+
matrix:
57+
only:
58+
- image: Ubuntu1604
59+
# $APPVEYOR_BUILD_FOLDER isn't expanded in the environment section
60+
# here, so I can't set $VIM_EXE the way I want to. Instead,
61+
# I set $VIM_EXE in the sh-specific install steps below.
62+
environment:
63+
VIM_EXE: UNDEFINED
64+
cache:
65+
- $APPVEYOR_BUILD_FOLDER/vim -> .appveyor.yml, tests/fetch-vim.sh
66+
67+
# Plus, don't run Ubuntu if the commit message includes [ci-win]
68+
skip_commits:
69+
message: /\[ci-win\]/
70+
71+
install:
72+
# Ubuntu-specific setup. These carry forward to the build_script.
73+
- sh: export VIM_EXE="$APPVEYOR_BUILD_FOLDER/vim/bin/vim"
74+
- sh: export PATH="$PATH":$APPVEYOR_BUILD_FOLDER/vim/bin
75+
- sh: echo "$VIM_EXE , $PATH"
76+
77+
# Cross-platform - test the core
78+
- cmake --version
79+
- git submodule update --init --recursive
80+
- cmd: tests\fetch-vim
81+
- sh: tests/fetch-vim.sh
82+
83+
build_script:
84+
# Build the core tests
85+
- cd tests
86+
- cd core
87+
- mkdir build
88+
- cd build
89+
- cmake ..
90+
91+
# Note on multicore testing:
92+
# Two cores are available per https://help.appveyor.com/discussions/questions/11179-how-many-cores-and-threads-can-be-used-in-free-appveyor-build .
93+
# However, using -j2 seems to make each job take much longer.
94+
95+
test_script:
96+
# Run the core tests
97+
- ctest . --output-on-failure
98+
99+
# CTestCustom specifies skipping UTF-8 tests on Windows.
100+
- cmd: echo "Reminder - did not try UTF-8"
101+
- sh: echo "Reminder - tried UTF-8"
102+
103+
on_failure:
104+
- echo "failed"
105+
- cmd: type tests\core\build\Testing\Temporary\LastTest.log
106+
- sh: cat tests/core/build/Testing/Temporary/LastTest.log
107+

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ max_line_length = 120
2222
[*.yml]
2323
indent_style = space
2424
indent_size = 2
25+
26+
[*.{bat,vbs,ps1}]
27+
end_of_line = CRLF

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
tags
2+
tests/**/build
3+
tests/**/.bundle

.gitmodules

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
[submodule "tests/spec/plugin_tests"]
2-
path = tests/spec/plugin_tests
1+
[submodule "plugin_tests"]
2+
path = tests/plugin/spec/plugin_tests
33
url = https://github.com/editorconfig/editorconfig-plugin-tests.git
4+
[submodule "core_tests"]
5+
path = tests/core/tests
6+
url = https://github.com/editorconfig/editorconfig-core-test.git

.travis.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
language: ruby
2-
3-
rvm:
4-
- 2.2.4
5-
6-
gemfile: tests/Gemfile
1+
matrix:
2+
include:
3+
- name: "plugin"
4+
env: TEST_WHICH=plugin
5+
language: ruby
6+
rvm:
7+
- 2.2.4
8+
gemfile: tests/plugin/Gemfile
9+
- name: "core"
10+
env: TEST_WHICH=core
711

812
addons:
913
apt:
@@ -15,7 +19,7 @@ before_script:
1519
- "sh -e /etc/init.d/xvfb start"
1620

1721
script:
18-
bundle exec rspec tests/spec/editorconfig_spec.rb
22+
./tests/travis-test.sh
1923

2024
notifications:
2125
email:

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Contributors to the EditorConfig Vim Plugin:
33
Hong Xu
44
Trey Hunner
55
Kent Frazier
6+
Chris White

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Unless otherwise stated, all files are distributed under the Simplified BSD
22
license included below.
33

4-
Copyright (c) 2011-2012 EditorConfig Team
4+
Copyright (c) 2011-2019 EditorConfig Team
55
All rights reserved.
66

77
Redistribution and use in source and binary forms, with or without

LICENSE.PSF

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Some code in editorconfig-vim is derived from code licensed under the
2+
PSF license. The following is the text of that license, retrieved 2019-05-05
3+
from https://docs.python.org/2.6/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python
4+
5+
PSF LICENSE AGREEMENT FOR PYTHON 2.6.9
6+
7+
1. This LICENSE AGREEMENT is between the Python Software Foundation
8+
(``PSF''), and the Individual or Organization (``Licensee'') accessing and
9+
otherwise using Python 2.6.9 software in source or binary form and its
10+
associated documentation.
11+
12+
2. Subject to the terms and conditions of this License Agreement, PSF
13+
hereby grants Licensee a nonexclusive, royalty-free, world-wide
14+
license to reproduce, analyze, test, perform and/or display publicly,
15+
prepare derivative works, distribute, and otherwise use Python 2.6.9
16+
alone or in any derivative version, provided, however, that PSF's
17+
License Agreement and PSF's notice of copyright, i.e., ``Copyright (c)
18+
2001-2010 Python Software Foundation; All Rights Reserved'' are
19+
retained in Python 2.6.9 alone or in any derivative version prepared
20+
by Licensee.
21+
22+
3. In the event Licensee prepares a derivative work that is based on
23+
or incorporates Python 2.6.9 or any part thereof, and wants to make
24+
the derivative work available to others as provided herein, then
25+
Licensee hereby agrees to include in any such work a brief summary of
26+
the changes made to Python 2.6.9.
27+
28+
4. PSF is making Python 2.6.9 available to Licensee on an ``AS IS''
29+
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
30+
BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY
31+
REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
32+
PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.6.9 WILL NOT INFRINGE
33+
ANY THIRD PARTY RIGHTS.
34+
35+
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
36+
2.6.9 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
37+
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.6.9,
38+
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
39+
40+
6. This License Agreement will automatically terminate upon a material
41+
breach of its terms and conditions.
42+
43+
7. Nothing in this License Agreement shall be deemed to create any
44+
relationship of agency, partnership, or joint venture between PSF and
45+
Licensee. This License Agreement does not grant permission to use PSF
46+
trademarks or trade name in a trademark sense to endorse or promote
47+
products or services of Licensee, or any third party.
48+
49+
8. By copying, installing or otherwise using Python 2.6.9, Licensee
50+
agrees to be bound by the terms and conditions of this License
51+
Agreement.
52+
53+
# vi: set ft=:

README.md

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
# EditorConfig Vim Plugin
22

3-
[![Build Status](https://travis-ci.org/editorconfig/editorconfig-vim.svg?branch=master)](https://travis-ci.org/editorconfig/editorconfig-vim)
3+
[![Travis Build Status](https://img.shields.io/travis/cxw42/editorconfig-vim.svg?logo=travis)](https://travis-ci.org/editorconfig/editorconfig-vim)
4+
[![Appveyor Build Status](https://img.shields.io/appveyor/ci/cxw42/editorconfig-vim.svg?logo=appveyor)](https://ci.appveyor.com/project/cxw42/editorconfig-vim)
45

5-
This is an [EditorConfig][] plugin for Vim. This plugin could be found on both
6+
This is an [EditorConfig][] plugin for Vim. This plugin can be found on both
67
[GitHub][] and [Vim online][].
78

89
## Installation
910

10-
If your Vim is not compiled with `+python` or `+python3` feature (You can verify
11-
if the `+python` or `+python3` feature is included by running `:ver`. Most Linux
12-
distributions and with the official Windows binary have the `+python` and
13-
`+python3` feature enabled), please first download the [EditorConfig core][] and
14-
follow the instructions in the README and INSTALL files to install it. This
15-
plugin would NOT work if neither `+python`/`+python3` nor EditorConfig core is
16-
available.
17-
1811
To install this plugin, you can use one of the following ways:
1912

2013
- Download the [archive][] and extract it into your Vim runtime directory
@@ -35,6 +28,12 @@ OR
3528

3629
Then remember to call `:PluginInstall`.
3730

31+
### No external editorconfig core library is required
32+
33+
Previous versions of this plugin also required a Python "core".
34+
The core included the code to parse `.editorconfig` files.
35+
This plugin **includes** the core, so you don't need to download the
36+
core separately.
3837

3938
## Supported properties
4039

@@ -61,39 +60,31 @@ need to execute `:helptags ALL` so that Vim is aware of editorconfig.txt.
6160
To ensure that this plugin works well with [Tim Pope's fugitive][], use the
6261
following patterns array:
6362

64-
> let g:EditorConfig_exclude_patterns = ['fugitive://.\*']
63+
let g:EditorConfig_exclude_patterns = ['fugitive://.\*']
6564

6665
If you wanted to avoid loading EditorConfig for any remote files over ssh:
6766

68-
> let g:EditorConfig_exclude_patterns = ['scp://.\*']
67+
let g:EditorConfig_exclude_patterns = ['scp://.\*']
6968

7069
Of course these two items could be combined into the following:
7170

72-
> let g:EditorConfig_exclude_patterns = ['fugitive://.\*', 'scp://.\*']
71+
let g:EditorConfig_exclude_patterns = ['fugitive://.\*', 'scp://.\*']
7372

7473
#### Disable rules
7574

7675
You might want to override some project-specific EditorConfig rules in global
77-
or local vimrc in some cases, e.g., to resolve conflicts of trailing whitespace
76+
or local vimrc in some cases, e.g., to resolve conflicts of trailing whitespace
7877
trimming and buffer autosaving.
7978

80-
> let g:EditorConfig_disable_rules = ['trim_trailing_whitespace']
79+
let g:EditorConfig_disable_rules = ['trim_trailing_whitespace']
8180

8281
You are able to disable any supported EditorConfig properties.
8382

84-
#### Exec Path
85-
86-
The file path to the EditorConfig core executable. You could set this value in
87-
your |vimrc| like this:
88-
89-
> let g:EditorConfig_exec_path = 'Path to your EditorConfig Core executable'
90-
9183
## Bugs and Feature Requests
9284

9385
Feel free to submit bugs, feature requests, and other issues to the
9486
[issue tracker][]. Be sure you have read the [contribution guideline][]!
9587

96-
[EditorConfig core]: https://github.com/editorconfig/editorconfig-core
9788
[EditorConfig]: http://editorconfig.org
9889
[GitHub]: https://github.com/editorconfig/editorconfig-vim
9990
[PreserveNoEOL]: http://www.vim.org/scripts/script.php?script_id=4550

autoload/editorconfig.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
" Copyright (c) 2011-2012 EditorConfig Team
1+
" autoload/editorconfig.vim: EditorConfig native Vimscript plugin
2+
" Copyright (c) 2011-2019 EditorConfig Team
23
" All rights reserved.
34
"
45
" Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)