Compare commits

..

2 Commits

Author SHA1 Message Date
Justin M. Keyes
baa5263b56 NVIM v0.4.1
FIXES:

2abdb89522 fix failed release: regenerate the *.mpack file
2019-09-15 17:11:39 -07:00
Justin M. Keyes
2abdb89522 fix failed release: regenerate the *.mpack file
Set NVIM_API_PRERELEASE=true to regenerate the *.mpack file, because it
was generated from an old binary accidentally, which caused the release
to fail:

    test/functional\api\version_spec.lua:133: Expected objects to be the same.
    Passed in:
    (table: 0x0c6175a8) {
      [method] = false
      [name] = 'nvim_get_context'
     *[parameters] = {
       *[1] = {
         *[1] = 'Dictionary'
          [2] = '' } }
      [return_type] = 'Dictionary'
      [since] = 6 }
    Expected:
    (table: 0x0c6cd2d0) {
      [method] = false
      [name] = 'nvim_get_context'
     *[parameters] = {
       *[1] = {
         *[1] = 'Array'
          [2] = '' } }
      [return_type] = 'Dictionary'
      [since] = 6 }
    stack traceback:
        test/functional\api\version_spec.lua:133: in function <test/functional\api\version_spec.lua:122>
2019-09-15 17:10:16 -07:00
1264 changed files with 67916 additions and 178201 deletions

View File

@@ -1,44 +0,0 @@
image: freebsd/12.x
packages:
- cmake
- gmake
- ninja
- libtool
- sha
- automake
- pkgconf
- unzip
- wget
- gettext
- python
- libffi
sources:
- https://github.com/neovim/neovim
environment:
SOURCEHUT: 1
LANG: en_US.UTF-8
CMAKE_EXTRA_FLAGS: -DCI_BUILD=ON -DMIN_LOG_LEVEL=3
tasks:
- build-deps: |
cd neovim
gmake deps
- build: |
cd neovim
gmake CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" nvim
- functionaltest: |
cd neovim
gmake functionaltest
- unittest: |
cd neovim
gmake unittest
# Unfortunately, oldtest is tanking hard on sourcehut's FreeBSD instance
# and not producing any logs as a result. So don't do this task for now.
# Ref: https://github.com/neovim/neovim/pull/11477#discussion_r352095005.
# - test-oldtest: |
# cd neovim
# gmake oldtest

View File

@@ -1,43 +1,41 @@
# sourcehut CI: https://builds.sr.ht/~jmk/neovim # sourcehut CI: https://builds.sr.ht/~jmk/neovim
image: openbsd/6.9 image: openbsd/6.5
packages: packages:
- autoconf-2.71 - autoconf-2.69p2
- automake-1.16.3 - automake-1.15.1
- cmake - cmake
- gettext-runtime-0.21p1 - gettext-0.19.8.1p3
- gettext-tools-0.21p1 - gettext-tools-0.19.8.1
- gmake - gmake
- libtool - libtool
- ninja-1.10.2p0 - ninja-1.8.2p0
- unzip-6.0p14 - unzip-6.0p11
sources: sources:
- https://github.com/neovim/neovim - https://github.com/neovim/neovim
environment:
SOURCEHUT: 1
LC_CTYPE: en_US.UTF-8
CMAKE_EXTRA_FLAGS: -DCI_BUILD=ON -DMIN_LOG_LEVEL=3
tasks: tasks:
- build-deps: |
export AUTOCONF_VERSION=2.71
export AUTOMAKE_VERSION=1.16
mkdir neovim/.deps
cd neovim/.deps
cmake -G Ninja ../third-party/
cmake --build . --config RelWithDebInfo
- build: | - build: |
mkdir neovim/build export AUTOCONF_VERSION=2.69
cd neovim/build export AUTOMAKE_VERSION=1.15
cmake -G Ninja $CMAKE_EXTRA_FLAGS ..
cmake --build . --config RelWithDebInfo
./bin/nvim --version
- functionaltest: |
cd neovim/build
cmake --build . --config RelWithDebInfo --target functionaltest
- oldtest: |
cd neovim cd neovim
mkdir .deps
cd .deps
cmake -G Ninja ../third-party/
cmake --build . --config Debug
cd ..
mkdir build
cd build
cmake -G Ninja -DMIN_LOG_LEVEL=3 ..
cmake --build . --config Debug
./bin/nvim --version
- test: |
export LC_CTYPE=en_US.UTF-8
# functional tests
cd neovim/build
# cmake --build . --config Debug --target functionaltest
# oldtests
cd ..
gmake oldtest gmake oldtest

View File

@@ -1,2 +0,0 @@
CompileFlags:
CompilationDatabase: build/ # Search build/ directory for compile_commands.json

6
.gitattributes vendored
View File

@@ -1,7 +1 @@
*.h linguist-language=C *.h linguist-language=C
src/nvim/testdir/test42.in diff
.github/ export-ignore
ci/ export-ignore
.travis.yml export-ignore
codecov.yml export-ignore
.builds/ export-ignore

3
.github/FUNDING.yml vendored
View File

@@ -1,2 +1 @@
github: neovim custom: https://salt.bountysource.com/teams/neovim
open_collective: neovim

View File

@@ -9,16 +9,11 @@ labels: bug
<!-- Before reporting: search existing issues and check the FAQ. --> <!-- Before reporting: search existing issues and check the FAQ. -->
- `nvim --version`: - `nvim --version`:
- `vim -u DEFAULTS` (version: ) behaves differently?
- Operating system/version: - Operating system/version:
- Terminal name/version: - Terminal name/version:
- `$TERM`: - `$TERM`:
<!--
If this report is about different behaviour between Nvim and Vim, make sure to
read `:h vim-differences` first. Otherwise remove the next line.
-->
[ ] `vim -u DEFAULTS` (version: ) behaves differently
### Steps to reproduce using `nvim -u NORC` ### Steps to reproduce using `nvim -u NORC`
``` ```

View File

@@ -1,58 +0,0 @@
---
name: Language server client bug report
about: Report a built-in lsp problem in Nvim
title: ''
labels: bug, lsp
---
<!--
Before reporting: search existing issues and check the FAQ. Usage questions
such as "How do I...?" or "Why isn't X language server/feature working?" belong
on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will
be closed.
-->
- `nvim --version`:
- language server name/version:
- Operating system/version:
<details>
<summary>nvim -c ":checkhealth nvim lspconfig"</summary>
<!-- Paste the results from `nvim -c ":checkhealth nvim lspconfig"` here. -->
</details>
<details>
<summary>lsp.log</summary>
<!--
Please paste the lsp log before and after the problem.
You can set log level like this.
`:lua vim.lsp.set_log_level("debug")`
You can find the location of the log with the following command.
`:lua print(vim.lsp.get_log_path())`
-->
</details>
### Steps to reproduce using nvim -u minimal_init.lua
<!--
Note, if the issue is with an autocompletion or other LSP plugin, please
report to the upstream tracker. Download the minmal config with
wget https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua
and modify it to include any specific commands or servers pertaining to your issues.
-->
```
nvim -u minimal_init.lua
```
### Actual behaviour
### Expected behaviour

49
.github/labeler.yml vendored
View File

@@ -1,49 +0,0 @@
"lsp":
- runtime/lua/vim/lsp.lua
- runtime/lua/vim/lsp/*
"lua":
- runtime/lua/**/*
- src/nvim/lua
"tui":
- src/nvim/tui/tui.*
"treesitter":
- src/nvim/lua/treesitter.*
- runtime/lua/vim/treesitter.lua
- runtime/lua/vim/treesitter/*
"dependencies":
- third-party/**/*
"topic: spell":
- src/nvim/spell*
"topic: :terminal":
- src/nvim/terminal.*
"topic: column":
- src/nvim/mark.h
- src/nvim/mark.c
- src/nvim/sign*
"topic: folds":
- src/nvim/fold*
"topic: mouse":
- src/nvim/mouse*
"topic: documentation":
- runtime/doc/*
"topic: clipboard":
- runtime/autoload/provider/clipboard.vim
"topic: diff":
- src/nvim/diff.*
"topic: build":
- CMakeLists.txt
- "**/CMakeLists.txt"
- "**/*.cmake"

View File

@@ -1,51 +0,0 @@
name: Autogenerate API docs
on:
push:
paths:
- 'src/nvim/api/*.[ch]'
- 'src/nvim/**.lua'
- 'runtime/lua/**.lua'
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
regen-api-docs:
runs-on: ubuntu-20.04
permissions:
contents: write
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y doxygen python3 python3-msgpack luajit
- name: Setup git config
run: |
git config --global user.name 'marvim'
git config --global user.email 'marvim@users.noreply.github.com'
- run: printf 'DOC_BRANCH=marvim/api-doc-update/%s\n' ${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
- name: Generate docs
id: docs
run: |
git checkout -b ${DOC_BRANCH}
python3 scripts/gen_vimdoc.py
printf '::set-output name=UPDATED_DOCS::%s\n' $([ -z "$(git diff)" ]; echo $?)
- name: Automatic PR
if: ${{ steps.docs.outputs.UPDATED_DOCS != 0 }}
run: |
git add -u
git commit -m 'docs: regenerate'
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${DOC_BRANCH}
gh pr create --fill --base ${GITHUB_REF#refs/heads/} --head ${DOC_BRANCH} || true

View File

@@ -1,116 +0,0 @@
name: CI
on:
push:
branches: '**'
pull_request:
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
jobs:
unixish:
name: ${{ matrix.os }} ${{ matrix.flavor }} (cc=${{ matrix.cc }})
strategy:
fail-fast: false
matrix:
include:
- flavor: asan
cc: clang-12
runner: ubuntu-20.04
os: linux
- flavor: lint
cc: gcc
runner: ubuntu-20.04
os: linux
- flavor: tsan
cc: clang-12
runner: ubuntu-20.04
os: linux
- cc: clang
runner: macos-10.15
os: osx
- flavor: functionaltest-lua
cc: gcc
runner: ubuntu-20.04
os: linux
runs-on: ${{ matrix.runner }}
if: github.event.pull_request.draft == false
env:
CC: ${{ matrix.cc }}
CI_OS_NAME: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup commom environment variables
run: ./.github/workflows/env.sh ${{ matrix.flavor }}
- name: Install apt packages
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential ccache cmake cpanminus cscope gcc-multilib gdb gettext gperf language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip
- name: Install new clang
if: matrix.flavor == 'asan' || matrix.flavor == 'tsan'
run: |
wget https://apt.llvm.org/llvm.sh
chmod a+x llvm.sh
sudo ./llvm.sh 12
rm llvm.sh
- name: Install brew packages
if: matrix.os == 'osx'
run: |
# Workaround brew issues
rm -f /usr/local/bin/2to3
brew update >/dev/null
brew upgrade
brew install automake ccache perl cpanminus ninja
- name: Setup interpreter packages
run: |
./ci/before_install.sh
./ci/install.sh
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
${{ env.CACHE_NVIM_DEPS_DIR }}
~/.ccache
key: ${{ runner.os }}-${{ matrix.flavor }}-${{ matrix.cc }}-${{ hashFiles('cmake/*', 'third-party/**', '**/CMakeLists.txt') }}-${{ github.base_ref }}
- name: Build third-party
run: ./ci/before_script.sh
- name: Build and test
run: ./ci/script.sh
- name: Cache dependencies
if: ${{ success() }}
run: ./ci/before_cache.sh
windows:
runs-on: windows-2016
if: github.event.pull_request.draft == false
env:
DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }}
DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }}
strategy:
fail-fast: false
matrix:
config: [ MINGW_64-gcov, MINGW_32, MSVC_64, MSVC_32 ]
name: windows (${{ matrix.config }})
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ${{ env.DEPS_BUILD_DIR }}
key: ${{ matrix.config }}-${{ hashFiles('third-party\**') }}
- name: Run CI
run: powershell ci\build.ps1
env:
CONFIGURATION: ${{ matrix.config }}

View File

@@ -1,44 +0,0 @@
name: Coverity
on:
schedule:
- cron: '0 10 * * 1' # Run every Monday at 00:10
workflow_dispatch:
jobs:
scan:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential cmake gettext gperf libtool-bin locales ninja-build pkg-config unzip
- name: Download Coverity
run: |
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=neovim%2Fneovim" -O coverity_tool.tgz
mkdir cov-scan
tar ax -f coverity_tool.tgz --strip-components=1 -C cov-scan
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
- name: Build dependencies
run: make deps
- name: Build/scan neovim
run: |
env PATH=$(pwd)/cov-scan/bin:$PATH cov-build --dir cov-int make
- name: Submit results
run: |
tar zcf cov-scan.tgz cov-int
curl --form token=$TOKEN \
--form email=$EMAIL \
--form file=@cov-scan.tgz \
--form version="$(git rev-parse HEAD)" \
--form description="Weekly GHA scan" \
'https://scan.coverity.com/builds?project=neovim%2Fneovim'
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}

View File

@@ -1,65 +0,0 @@
#!/bin/bash
set -e -u
FLAVOR=${1:-}
cat <<EOF >> "$GITHUB_PATH"
$HOME/.local/bin
EOF
cat <<EOF >> "$GITHUB_ENV"
CACHE_ENABLE=true
CI_TARGET=tests
CI_BUILD_DIR=$GITHUB_WORKSPACE
BUILD_DIR=$GITHUB_WORKSPACE/build
DEPS_BUILD_DIR=$HOME/nvim-deps
INSTALL_PREFIX=$HOME/nvim-install
LOG_DIR=$GITHUB_WORKSPACE/build/log
NVIM_LOG_FILE=$GITHUB_WORKSPACE/build/.nvimlog
VALGRIND_LOG=$GITHUB_WORKSPACE/build/log/valgrind-%p.log
CACHE_NVIM_DEPS_DIR=$HOME/.cache/nvim-deps
CACHE_MARKER=$HOME/.cache/nvim-deps/.ci_cache_marker
CCACHE_BASEDIR=$GITHUB_WORKSPACE
CCACHE_COMPRESS=1
CCACHE_SLOPPINESS=time_macros,file_macro
CCACHE_DIR=$HOME/.ccache
EOF
DEPS_CMAKE_FLAGS=-DUSE_BUNDLED_GPERF=OFF
FUNCTIONALTEST=functionaltest
BUILD_FLAGS="CMAKE_FLAGS=-DCI_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=$HOME/nvim-install -DBUSTED_OUTPUT_TYPE=nvim -DDEPS_PREFIX=$HOME/nvim-deps/usr -DMIN_LOG_LEVEL=3"
case "$FLAVOR" in
asan)
BUILD_FLAGS="$BUILD_FLAGS -DPREFER_LUA=ON"
cat <<EOF >> "$GITHUB_ENV"
CLANG_SANITIZER=ASAN_UBSAN
SYMBOLIZER=asan_symbolize-12
ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:log_path=$GITHUB_WORKSPACE/build/log/asan
UBSAN_OPTIONS=print_stacktrace=1 log_path=$GITHUB_WORKSPACE/build/log/ubsan
EOF
;;
tsan)
cat <<EOF >> "$GITHUB_ENV"
TSAN_OPTIONS=log_path=$GITHUB_WORKSPACE/build/log/tsan
EOF
;;
lint)
cat <<EOF >> "$GITHUB_ENV"
CI_TARGET=lint
EOF
;;
functionaltest-lua)
BUILD_FLAGS="$BUILD_FLAGS -DPREFER_LUA=ON"
FUNCTIONALTEST=functionaltest-lua
DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF"
;;
*)
;;
esac
cat <<EOF >> "$GITHUB_ENV"
$BUILD_FLAGS
DEPS_CMAKE_FLAGS=$DEPS_CMAKE_FLAGS
FUNCTIONALTEST=$FUNCTIONALTEST
EOF

View File

@@ -1,13 +0,0 @@
name: "Pull Request Labeler"
on:
- pull_request_target
jobs:
triage:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

View File

@@ -1,258 +0,0 @@
name: Release
on:
schedule:
- cron: '5 5 * * *'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
# Build on the oldest supported images, so we have broader compatibility
# Upgrade to gcc-11 to prevent it from using its builtins (#14150)
jobs:
linux:
runs-on: ubuntu-18.04
outputs:
version: ${{ steps.build.outputs.version }}
release: ${{ steps.build.outputs.release }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential cmake gcc-11 gettext gperf libtool-bin locales ninja-build pkg-config unzip
- name: Build release
id: build
run: |
CC=gcc-11 make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH="
printf '::set-output name=version::%s\n' "$(./build/bin/nvim --version | head -n 3 | sed -z 's/\n/%0A/g')"
printf '::set-output name=release::%s\n' "$(./build/bin/nvim --version | head -n 1)"
make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-linux64" install
cd "$GITHUB_WORKSPACE/build/release"
tar cfz nvim-linux64.tar.gz nvim-linux64
- uses: actions/upload-artifact@v2
with:
name: nvim-linux64
path: build/release/nvim-linux64.tar.gz
retention-days: 1
appimage:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential cmake gcc-11 gettext gperf libtool-bin locales ninja-build pkg-config unzip
- if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
run: CC=gcc-11 make appimage-latest
- if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
run: CC=gcc-11 make appimage-nightly
- uses: actions/upload-artifact@v2
with:
name: appimage
path: build/bin/nvim.appimage
retention-days: 1
- uses: actions/upload-artifact@v2
with:
name: appimage
path: build/bin/nvim.appimage.zsync
retention-days: 1
macOS:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install brew packages
run: |
rm -f /usr/local/bin/2to3
brew update >/dev/null
brew upgrade
brew install automake ninja
- name: Build release
run: |
make CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11"
make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-osx64" install
- name: Create package
run: |
cd "$GITHUB_WORKSPACE/build/release"
mkdir -p nvim-osx64/libs
libs=($(otool -L nvim-osx64/bin/nvim | sed 1d | sed -E -e 's|^[[:space:]]*||' -e 's| .*||'))
echo "libs:"
for lib in "${libs[@]}"; do
if echo "$lib" | grep -q -E 'libSystem|CoreFoundation' 2>/dev/null; then
echo " [skipped] $lib"
else
echo " $lib"
relname="libs/${lib##*/}"
cp -L "$lib" "nvim-osx64/$relname"
install_name_tool -change "$lib" "@executable_path/../$relname" nvim-osx64/bin/nvim
fi
done
tar cfz nvim-macos.tar.gz nvim-osx64
- uses: actions/upload-artifact@v2
with:
name: nvim-macos
path: build/release/nvim-macos.tar.gz
retention-days: 1
windows:
runs-on: windows-2016
env:
DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }}
DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }}
strategy:
matrix:
include:
- config: MSVC_64
archive: nvim-win64
- config: MSVC_32
archive: nvim-win32
name: windows (${{ matrix.config }})
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: powershell ci\build.ps1 -NoTests
env:
CONFIGURATION: ${{ matrix.config }}
- run: move build\Neovim.zip build\${{ matrix.archive }}.zip
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.archive }}
path: build/${{ matrix.archive }}.zip
retention-days: 1
publish:
needs: [linux, appimage, macOS, windows]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@v2
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly'
run: echo 'SUBJECT=Nvim development (prerelease) build' >> $GITHUB_ENV
- if: env.TAG_NAME != 'nightly'
run: echo 'SUBJECT=Nvim release build' >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly'
uses: dev-drprasad/delete-tag-and-release@v0.1.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
delete_release: true
tag_name: nightly
# `sha256sum` outputs <sha> <path>, so we cd into each dir to drop the
# containing folder from the output.
- name: Generate Linux64 SHA256 checksums
run: |
cd ./nvim-linux64
sha256sum nvim-linux64.tar.gz > nvim-linux64.tar.gz.sha256sum
echo "SHA_LINUX_64=$(cat nvim-linux64.tar.gz.sha256sum)" >> $GITHUB_ENV
- name: Generate App Image SHA256 checksums
run: |
cd ./appimage
sha256sum nvim.appimage > nvim.appimage.sha256sum
echo "SHA_APP_IMAGE=$(cat nvim.appimage.sha256sum)" >> $GITHUB_ENV
- name: Generate App Image Zsync SHA256 checksums
run: |
cd ./appimage
sha256sum nvim.appimage.zsync > nvim.appimage.zsync.sha256sum
echo "SHA_APP_IMAGE_ZSYNC=$(cat nvim.appimage.zsync.sha256sum)" >> $GITHUB_ENV
- name: Generate macOS SHA256 checksums
run: |
cd ./nvim-macos
sha256sum nvim-macos.tar.gz > nvim-macos.tar.gz.sha256sum
echo "SHA_MACOS=$(cat nvim-macos.tar.gz.sha256sum)" >> $GITHUB_ENV
- name: Generate Win32 SHA256 checksums
run: |
cd ./nvim-win32
sha256sum nvim-win32.zip > nvim-win32.zip.sha256sum
echo "SHA_WIN_32=$(cat nvim-win32.zip.sha256sum)" >> $GITHUB_ENV
- name: Generate Win64 SHA256 checksums
run: |
cd ./nvim-win64
sha256sum nvim-win64.zip > nvim-win64.zip.sha256sum
echo "SHA_WIN_64=$(cat nvim-win64.zip.sha256sum)" >> $GITHUB_ENV
- uses: meeDamian/github-release@2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.TAG_NAME }}
name: ${{ needs.linux.outputs.release }}
prerelease: ${{ env.TAG_NAME == 'nightly' }}
commitish: ${{ github.sha }}
gzip: false
allow_override: ${{ env.TAG_NAME == 'nightly' }}
files: |
nvim-macos.tar.gz:./nvim-macos/nvim-macos.tar.gz
nvim-macos.tar.gz.sha256sum:./nvim-macos/nvim-macos.tar.gz.sha256sum
nvim-linux64.tar.gz:./nvim-linux64/nvim-linux64.tar.gz
nvim-linux64.tar.gz.sha256sum:./nvim-linux64/nvim-linux64.tar.gz.sha256sum
nvim.appimage:./appimage/nvim.appimage
nvim.appimage.sha256sum:./appimage/nvim.appimage.sha256sum
nvim.appimage.zsync:./appimage/nvim.appimage.zsync
nvim.appimage.zsync.sha256sum:./appimage/nvim.appimage.zsync.sha256sum
nvim-win32.zip:./nvim-win32/nvim-win32.zip
nvim-win32.zip.sha256sum:./nvim-win32/nvim-win32.zip.sha256sum
nvim-win64.zip:./nvim-win64/nvim-win64.zip
nvim-win64.zip.sha256sum:./nvim-win64/nvim-win64.zip.sha256sum
body: |
${{ env.SUBJECT }}
```
${{ needs.linux.outputs.version }}```
## Install
### Windows
1. Extract **nvim-win64.zip** (or **nvim-win32.zip**)
2. Run `nvim-qt.exe`
### macOS
1. Download **nvim-macos.tar.gz**
2. Extract: `tar xzvf nvim-macos.tar.gz`
3. Run `./nvim-osx64/bin/nvim`
### Linux (x64)
1. Download **nvim.appimage**
2. Run `chmod u+x nvim.appimage && ./nvim.appimage`
- If your system does not have FUSE you can [extract the appimage](https://github.com/AppImage/AppImageKit/wiki/FUSE#type-2-appimage):
```
./nvim.appimage --appimage-extract
./squashfs-root/usr/bin/nvim
```
### Other
- Install by [package manager](https://github.com/neovim/neovim/wiki/Installing-Neovim)
## SHA256 Checksums
```
${{ env.SHA_LINUX_64 }}
${{ env.SHA_APP_IMAGE }}
${{ env.SHA_APP_IMAGE_ZSYNC }}
${{ env.SHA_MACOS }}
${{ env.SHA_WIN_64 }}
${{ env.SHA_WIN_32 }}
```

View File

@@ -1,52 +0,0 @@
name: vim-patches
on:
schedule:
- cron: '3 3 * * *'
jobs:
update-vim-patches:
runs-on: ubuntu-20.04
permissions:
contents: write
pull-requests: write
env:
VIM_SOURCE_DIR: ${{ format('{0}/vim-src', github.workspace) }}
VERSION_BRANCH: marvim/ci-version-update
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v2
with:
repository: vim/vim
path: ${{ env.VIM_SOURCE_DIR }}
fetch-depth: 0
- run: |
gh release download -R neovim/neovim -p nvim.appimage
chmod a+x nvim.appimage
mkdir -p $HOME/.local/bin
mv nvim.appimage $HOME/.local/bin/nvim
printf '%s\n' "$HOME/.local/bin" >> $GITHUB_PATH
- name: Setup git config
run: |
git config --global user.name 'marvim'
git config --global user.email 'marvim@users.noreply.github.com'
- name: Update src/version.c
id: update-version
run: |
git checkout -b ${VERSION_BRANCH}
nvim -i NONE -u NONE --headless +'luafile scripts/vimpatch.lua' +q
printf '::set-output name=NEW_PATCHES::%s\n' $([ -z "$(git diff)" ]; echo $?)
- name: Automatic PR
if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }}
run: |
git add -u
git commit -m 'version.c: update [skip ci]'
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH}
gh pr create --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true

31
.gitignore vendored
View File

@@ -1,20 +1,16 @@
# Tools # Tools
/venv/ .ropeproject/
compile_commands.json compile_commands.json
# Visual Studio
# IDEs
/.vs/ /.vs/
/.vscode/
/.idea/
# Build/deps dir # Build/deps dir
/build/ /build/
/cmake-build-debug/
/dist/
/.deps/ /.deps/
/tmp/ /tmp/
/.clangd/
/.cache/clangd/
.DS_Store
*.mo *.mo
.*.sw? .*.sw?
*~ *~
@@ -22,6 +18,8 @@ compile_commands.json
*.o *.o
*.so *.so
tags
/src/nvim/po/vim.pot /src/nvim/po/vim.pot
/src/nvim/po/*.ck /src/nvim/po/*.ck
@@ -29,14 +27,13 @@ compile_commands.json
/.nvimlog /.nvimlog
# Generated by scripts/vim-patch.sh # Generated by scripts/vim-patch.sh
/.vim-src /.vim-src/
*.rej
# Generated by old (Vim) tests. # Generated by old (Vim) tests.
/src/nvim/testdir/del /src/nvim/testdir/del
/src/nvim/testdir/test*.out /src/nvim/testdir/test*.out
/src/nvim/testdir/test*.res /src/nvim/testdir/test*.res
/src/nvim/testdir/test*.log /src/nvim/testdir/test.log
/src/nvim/testdir/messages /src/nvim/testdir/messages
/src/nvim/testdir/viminfo /src/nvim/testdir/viminfo
/src/nvim/testdir/test.ok /src/nvim/testdir/test.ok
@@ -45,7 +42,6 @@ compile_commands.json
/src/nvim/testdir/valgrind.* /src/nvim/testdir/valgrind.*
/src/nvim/testdir/.gdbinit /src/nvim/testdir/.gdbinit
/runtime/indent/testdir/*.out /runtime/indent/testdir/*.out
+runtime/indent/testdir/*.fail
# Generated by src/nvim/testdir/runnvim.sh. # Generated by src/nvim/testdir/runnvim.sh.
/src/nvim/testdir/*.tlog /src/nvim/testdir/*.tlog
@@ -58,15 +54,10 @@ compile_commands.json
# local make targets # local make targets
local.mk local.mk
# Generated from :help docs # runtime/doc
tags
/runtime/doc/*.html /runtime/doc/*.html
/runtime/doc/tags.ref /runtime/doc/tags.ref
/runtime/doc/errors.log /runtime/doc/errors.log
# Generated by gen_vimdoc.py: # CLion
/runtime/doc/*.mpack /.idea/
/tmp-*-doc
# vim patches
/vim-*.patch

View File

@@ -1,14 +1,7 @@
-- vim: ft=lua tw=80 -- vim: ft=lua tw=80
stds.nvim = {
read_globals = { "jit" }
}
std = "lua51+nvim"
-- Ignore W211 (unused variable) with preload files. -- Ignore W211 (unused variable) with preload files.
files["**/preload.lua"] = {ignore = { "211" }} files["**/preload.lua"] = {ignore = { "211" }}
-- Allow vim module to modify itself, but only here.
files["src/nvim/lua/vim.lua"] = {ignore = { "122/vim" }}
-- Don't report unused self arguments of methods. -- Don't report unused self arguments of methods.
self = false self = false

22
.luacov
View File

@@ -1,22 +0,0 @@
-- Configuration file for LuaCov
local source = require("lfs").currentdir()
local function pesc(s)
assert(type(s) == 'string', s)
return s:gsub('[%(%)%.%%%+%-%*%?%[%]%^%$]', '%%%1')
end
return {
include = {
-- Absolute paths (starting with source dir, not hidden (i.e. .deps)).
pesc(source) .. "[/\\][^.].+",
-- Relative (non-hidden) paths.
'^[^/\\.]',
},
modules = {
['vim'] = 'runtime/lua/vim/shared.lua'
},
}
-- vim: ft=lua tw=80 sw=2 et

View File

@@ -1,23 +1,9 @@
dist: bionic dist: xenial
language: c language: c
env: env:
global: global:
# Encrypted environment variables, see
# http://docs.travis-ci.com/user/encryption-keys/
#
# SNAP_SECRET_KEY: generated by:
# travis encrypt SNAP_SECRET_KEY=xx --add
# https://github.com/neovim/neovim/pull/11428
# snapcraft key expires after 1 year. Steps to refresh it:
# 1. snapcraft enable-ci travis --refresh
# 2. mv .snapcraft/travis_snapcraft.cfg ci/snap/travis_snapcraft.cfg
# 3. Copy after_success command to ci/snap/deploy.sh from .travis.yml
# 4. Undo changes to .travis.yml
- secure: hd0qn2u8ABbJg5Bx4pBRcUQbKYFmcSHoecyHIPTCnGJT+NI41Bvm/IkN/N5DhBF+LbD3Q2nmR/dzI5H/dqS7RxMFvEx1DuFLendFHHX3MYf0AuKpXYY3gwgMTmqx8p/v6srlU7RBGWNGzHCWqksAem+EIWCe3I7WvfdKo1/DV/Y=
- PATH="$HOME/.local/bin:$PATH"
# Set "false" to force rebuild of third-party dependencies. # Set "false" to force rebuild of third-party dependencies.
- CACHE_ENABLE=true - CACHE_ENABLE=true
# Build directory for Neovim. # Build directory for Neovim.
@@ -31,13 +17,17 @@ env:
# Nvim log file. # Nvim log file.
- NVIM_LOG_FILE="$BUILD_DIR/.nvimlog" - NVIM_LOG_FILE="$BUILD_DIR/.nvimlog"
# Default CMake flags. # Default CMake flags.
- CMAKE_FLAGS="-DCI_BUILD=ON - CMAKE_FLAGS="-DTRAVIS_CI_BUILD=ON
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX
-DBUSTED_OUTPUT_TYPE=nvim -DBUSTED_OUTPUT_TYPE=nvim
-DDEPS_PREFIX=$DEPS_BUILD_DIR/usr -DDEPS_PREFIX=$DEPS_BUILD_DIR/usr
-DMIN_LOG_LEVEL=3" -DMIN_LOG_LEVEL=3"
- DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_GPERF=OFF" - DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_GPERF=OFF"
# Additional CMake flags for 32-bit builds.
- CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32
-DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib
-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
# Environment variables for Clang sanitizers. # Environment variables for Clang sanitizers.
- ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan" - ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan"
- TSAN_OPTIONS="log_path=$LOG_DIR/tsan" - TSAN_OPTIONS="log_path=$LOG_DIR/tsan"
@@ -46,7 +36,7 @@ env:
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log" - VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
- CACHE_NVIM_DEPS_DIR="$HOME/.cache/nvim-deps" - CACHE_NVIM_DEPS_DIR="$HOME/.cache/nvim-deps"
# If this file exists, the cache is valid (compile was successful). # If this file exists, the cache is valid (compile was successful).
- CACHE_MARKER="$CACHE_NVIM_DEPS_DIR/.ci_cache_marker" - CACHE_MARKER="$CACHE_NVIM_DEPS_DIR/.travis_cache_marker"
# default target name for functional tests # default target name for functional tests
- FUNCTIONALTEST=functionaltest - FUNCTIONALTEST=functionaltest
- CI_TARGET=tests - CI_TARGET=tests
@@ -54,7 +44,8 @@ env:
- CCACHE_COMPRESS=1 - CCACHE_COMPRESS=1
- CCACHE_SLOPPINESS=time_macros,file_macro - CCACHE_SLOPPINESS=time_macros,file_macro
- CCACHE_BASEDIR="$TRAVIS_BUILD_DIR" - CCACHE_BASEDIR="$TRAVIS_BUILD_DIR"
- CI_OS_NAME="$TRAVIS_OS_NAME" # Default since 3.3, but Travis (Xenial) has 3.2.4; required with newer gcc/clang.
- CCACHE_CPP2=1
anchors: anchors:
envs: &common-job-env envs: &common-job-env
@@ -71,12 +62,12 @@ addons:
- build-essential - build-essential
- clang - clang
- cmake - cmake
- cpanminus
- cscope - cscope
- gcc-multilib - gcc-multilib
- gdb - gdb
- gperf - gperf
- language-pack-tr - language-pack-tr
- libc6-dev-i386
- libtool-bin - libtool-bin
- locales - locales
- ninja-build - ninja-build
@@ -85,17 +76,22 @@ addons:
- valgrind - valgrind
- xclip - xclip
homebrew: homebrew:
update: true update: false
casks:
- powershell
packages: packages:
- ccache - ccache
- cpanminus
- ninja - ninja
- perl
jobs: jobs:
include: include:
- stage: baseline
name: clang-asan
os: linux
compiler: clang
# Use Lua so that ASAN can test our embedded Lua support. 8fec4d53d0f6
env:
- CLANG_SANITIZER=ASAN_UBSAN
- CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
- *common-job-env
- name: gcc-coverage (gcc 9) - name: gcc-coverage (gcc 9)
os: linux os: linux
compiler: gcc-9 compiler: gcc-9
@@ -103,19 +99,28 @@ jobs:
- GCOV=gcov-9 - GCOV=gcov-9
- CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON" - CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
- GCOV_ERROR_FILE="/tmp/libgcov-errors.log" - GCOV_ERROR_FILE="/tmp/libgcov-errors.log"
- USE_LUACOV=1
- BUSTED_ARGS="--coverage"
- *common-job-env - *common-job-env
addons: addons:
snaps:
- name: powershell
confinement: classic
apt: apt:
sources: sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test' - sourceline: 'ppa:ubuntu-toolchain-r/test'
packages: packages:
- *common-apt-packages - *common-apt-packages
- gcc-9 - gcc-9
- if: branch = master AND commit_message !~ /\[skip.lint\]/
name: lint
os: linux
env:
- CI_TARGET=lint
- *common-job-env
- stage: second stage
name: "macOS: clang"
os: osx
compiler: clang
osx_image: xcode10.2 # macOS 10.14
env:
- *common-job-env
- name: gcc-functionaltest-lua - name: gcc-functionaltest-lua
os: linux os: linux
compiler: gcc compiler: gcc
@@ -131,69 +136,15 @@ jobs:
compiler: gcc compiler: gcc
env: env:
- BUILD_32BIT=ON - BUILD_32BIT=ON
- CMAKE_FLAGS="$CMAKE_FLAGS -m32 -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
- DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -m32 -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
# Minimum required CMake. # Minimum required CMake.
- CMAKE_URL=https://cmake.org/files/v2.8/cmake-2.8.12-Linux-i386.sh - CMAKE_URL=https://cmake.org/files/v2.8/cmake-2.8.12-Linux-i386.sh
- *common-job-env - *common-job-env
- name: big-endian - name: clang-tsan
os: linux os: linux
arch: s390x compiler: clang
compiler: gcc
env: env:
- FUNCTIONALTEST=functionaltest-lua - CLANG_SANITIZER=TSAN
- CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
- DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF"
- *common-job-env - *common-job-env
addons:
apt:
packages:
- *common-apt-packages
- gettext
- python-pip
- python3-pip
- python-setuptools
- python3-setuptools
- python-dev
- python3-dev
- if: type != pull_request
name: snap
os: linux
env:
- LC_ALL: C.UTF-8
- LANG: C.UTF-8
- SNAPCRAFT_ENABLE_SILENT_REPORT: y
- SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y
- SNAPCRAFT_BUILD_ENVIRONMENT: lxd
addons:
snaps:
- name: snapcraft
channel: stable
classic: true
- name: http
- name: transfer
- name: lxd
channel: stable
# Override default before_install, before_cache.
before_install: /bin/true
before_cache: /bin/true
install: ci/snap/install.sh
before_script: echo "Building snap..."
script: ci/snap/script.sh
after_success: ci/snap/after_success.sh
deploy:
skip_cleanup: true
provider: script
script: ci/snap/deploy.sh
on:
branch: master
allow_failures:
- env:
- LC_ALL: C.UTF-8
- LANG: C.UTF-8
- SNAPCRAFT_ENABLE_SILENT_REPORT: y
- SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y
- SNAPCRAFT_BUILD_ENVIRONMENT: lxd
fast_finish: true fast_finish: true
before_install: ci/before_install.sh before_install: ci/before_install.sh

View File

@@ -6,13 +6,6 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
project(nvim C) project(nvim C)
if(POLICY CMP0065)
cmake_policy(SET CMP0065 NEW)
endif()
if(POLICY CMP0060)
cmake_policy(SET CMP0060 NEW)
endif()
# Point CMake at any custom modules we may ship # Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@@ -23,23 +16,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Prefer our bundled versions of dependencies. # Prefer our bundled versions of dependencies.
if(DEFINED ENV{DEPS_BUILD_DIR}) if(DEFINED ENV{DEPS_BUILD_DIR})
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
# pkg-config 29.2 has a bug on OpenBSD which causes it to drop any paths that
# *contain* system include paths. To avoid this, we prefix what would be
# "/usr/include" as "/_usr/include".
# This check is also performed in the third-party/CMakeLists.txt and in the
# else clause following here.
# https://github.com/neovim/neovim/pull/14745#issuecomment-860201794
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/_usr" CACHE PATH "Path prefix for finding dependencies")
else()
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
endif()
else() else()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/_usr" CACHE PATH "Path prefix for finding dependencies")
else()
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
endif()
# When running from within CLion or Visual Studio, # When running from within CLion or Visual Studio,
# build bundled dependencies automatically. # build bundled dependencies automatically.
if(NOT EXISTS ${DEPS_PREFIX} if(NOT EXISTS ${DEPS_PREFIX}
@@ -97,8 +76,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
endif() endif()
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Ignore case when comparing filenames on Windows and Mac.
set(CASE_INSENSITIVE_FILENAME TRUE)
# Enable fixing case-insensitive filenames for Windows and Mac. # Enable fixing case-insensitive filenames for Windows and Mac.
set(USE_FNAME_CASE TRUE) set(USE_FNAME_CASE TRUE)
endif() endif()
@@ -136,32 +113,47 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
# If not in a git repo (e.g., a tarball) these tokens define the complete # If not in a git repo (e.g., a tarball) these tokens define the complete
# version string, else they are combined with the result of `git describe`. # version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0) set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 5) set(NVIM_VERSION_MINOR 4)
set(NVIM_VERSION_PATCH 0) set(NVIM_VERSION_PATCH 1)
set(NVIM_VERSION_PRERELEASE "") # for package maintainers set(NVIM_VERSION_PRERELEASE "") # for package maintainers
# API level # API level
set(NVIM_API_LEVEL 7) # Bump this after any API change. set(NVIM_API_LEVEL 6) # Bump this after any API change.
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change. set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
set(NVIM_API_PRERELEASE false) set(NVIM_API_PRERELEASE false)
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
if(NVIM_VERSION_COMMIT) # is a git repo
git_describe(NVIM_VERSION_MEDIUM)
# `git describe` annotates the most recent tagged release; for pre-release
# builds we must replace that with the unreleased version.
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+"
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}"
NVIM_VERSION_MEDIUM
${NVIM_VERSION_MEDIUM})
endif()
set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}") set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
# NVIM_VERSION_CFLAGS set further below. # NVIM_VERSION_CFLAGS set further below.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Minimize logging for release-type builds.
if(NOT CMAKE_C_FLAGS_RELEASE MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DMIN_LOG_LEVEL=3")
endif()
if(NOT CMAKE_C_FLAGS_MINSIZEREL MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DMIN_LOG_LEVEL=3")
endif()
if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DMIN_LOG_LEVEL=3")
endif()
# Log level (MIN_LOG_LEVEL in log.h) # Log level (MIN_LOG_LEVEL in log.h)
if("${MIN_LOG_LEVEL}" MATCHES "^$") if("${MIN_LOG_LEVEL}" MATCHES "^$")
# Minimize logging for release-type builds. message(STATUS "MIN_LOG_LEVEL not specified, default is 1 (INFO)")
if(CMAKE_BUILD_TYPE STREQUAL "Release"
OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"
OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
message(STATUS "MIN_LOG_LEVEL not specified, default is 3 (ERROR) for release builds")
set(MIN_LOG_LEVEL 3)
else()
message(STATUS "MIN_LOG_LEVEL not specified, default is 1 (INFO)")
set(MIN_LOG_LEVEL 1)
endif()
else() else()
if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$") if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$")
message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL}) message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL})
@@ -283,8 +275,8 @@ else()
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion
-Wmissing-prototypes) -Wmissing-prototypes)
check_c_compiler_flag(-Wimplicit-fallthrough HAVE_WIMPLICIT_FALLTHROUGH_FLAG) check_c_compiler_flag(-Wimplicit-fallthrough HAS_WIMPLICIT_FALLTHROUGH_FLAG)
if(HAVE_WIMPLICIT_FALLTHROUGH_FLAG) if(HAS_WIMPLICIT_FALLTHROUGH_FLAG)
add_compile_options(-Wimplicit-fallthrough) add_compile_options(-Wimplicit-fallthrough)
endif() endif()
@@ -317,18 +309,11 @@ if(UNIX)
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
add_compile_options(-fstack-protector-strong) add_compile_options(-fstack-protector-strong)
link_libraries(-fstack-protector-strong)
elseif(HAS_FSTACK_PROTECTOR_FLAG) elseif(HAS_FSTACK_PROTECTOR_FLAG)
add_compile_options(-fstack-protector --param ssp-buffer-size=4) add_compile_options(-fstack-protector --param ssp-buffer-size=4)
link_libraries(-fstack-protector --param ssp-buffer-size=4)
endif() endif()
endif() endif()
check_c_compiler_flag(-fno-common HAVE_FNO_COMMON)
if (HAVE_FNO_COMMON)
add_compile_options(-fno-common)
endif()
check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG) check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG)
if(HAS_DIAG_COLOR_FLAG) if(HAS_DIAG_COLOR_FLAG)
if(CMAKE_GENERATOR MATCHES "Ninja") if(CMAKE_GENERATOR MATCHES "Ninja")
@@ -338,10 +323,10 @@ if(HAS_DIAG_COLOR_FLAG)
endif() endif()
endif() endif()
option(CI_BUILD "CI, extra flags will be set" OFF) option(TRAVIS_CI_BUILD "Travis/QuickBuild CI, extra flags will be set" OFF)
if(CI_BUILD) if(TRAVIS_CI_BUILD)
message(STATUS "CI build enabled") message(STATUS "Travis/QuickBuild CI build enabled")
add_compile_options(-Werror) add_compile_options(-Werror)
if(DEFINED ENV{BUILD_32BIT}) if(DEFINED ENV{BUILD_32BIT})
# Get some test coverage for unsigned char # Get some test coverage for unsigned char
@@ -368,8 +353,8 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_definitions(-D_GNU_SOURCE) add_definitions(-D_GNU_SOURCE)
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT PREFER_LUA AND LUAJIT_VERSION LESS "2.1.0-beta3") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
# Required for luajit < 2.1.0-beta3. # Required for luajit.
set(CMAKE_EXE_LINKER_FLAGS set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000") "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
set(CMAKE_SHARED_LINKER_FLAGS set(CMAKE_SHARED_LINKER_FLAGS
@@ -390,25 +375,6 @@ include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
find_package(LibLUV 1.30.0 REQUIRED) find_package(LibLUV 1.30.0 REQUIRED)
include_directories(SYSTEM ${LIBLUV_INCLUDE_DIRS}) include_directories(SYSTEM ${LIBLUV_INCLUDE_DIRS})
find_package(TreeSitter REQUIRED)
include_directories(SYSTEM ${TreeSitter_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_INCLUDES "${TreeSitter_INCLUDE_DIRS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${TreeSitter_LIBRARIES}")
check_c_source_compiles("
#include <tree_sitter/api.h>
int
main(void)
{
TSQueryCursor *cursor = ts_query_cursor_new();
ts_query_cursor_set_match_limit(cursor, 32);
return 0;
}
" TS_HAS_SET_MATCH_LIMIT)
if(TS_HAS_SET_MATCH_LIMIT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_MATCH_LIMIT")
endif()
# Note: The test lib requires LuaJIT; it will be skipped if LuaJIT is missing. # Note: The test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF) option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
@@ -488,17 +454,17 @@ if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MA
message(FATAL_ERROR "Sanitizers are only supported for Clang") message(FATAL_ERROR "Sanitizers are only supported for Clang")
endif() endif()
if(ENABLE_LIBICONV)
find_package(Iconv REQUIRED)
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
endif()
if(ENABLE_LIBINTL) if(ENABLE_LIBINTL)
# LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464 # LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464
find_package(LibIntl REQUIRED) find_package(LibIntl REQUIRED)
include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS}) include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
endif() endif()
if(ENABLE_LIBICONV)
find_package(Iconv REQUIRED)
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
endif()
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD # Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
# explicitly to indicate a strong preference for pthread. # explicitly to indicate a strong preference for pthread.
set(CMAKE_THREAD_PREFER_PTHREAD ON) set(CMAKE_THREAD_PREFER_PTHREAD ON)
@@ -520,19 +486,18 @@ include(LuaHelpers)
set(LUA_DEPENDENCIES lpeg mpack bit) set(LUA_DEPENDENCIES lpeg mpack bit)
if(NOT LUA_PRG) if(NOT LUA_PRG)
foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua) foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua)
unset(_CHECK_LUA_PRG CACHE) # If LUA_PRG is set find_program() will not search
unset(LUA_PRG CACHE)
unset(LUA_PRG_WORKS) unset(LUA_PRG_WORKS)
find_program(_CHECK_LUA_PRG ${CURRENT_LUA_PRG}) find_program(LUA_PRG ${CURRENT_LUA_PRG})
if(_CHECK_LUA_PRG) if(LUA_PRG)
check_lua_deps(${_CHECK_LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS) check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
if(LUA_PRG_WORKS) if(LUA_PRG_WORKS)
set(LUA_PRG "${_CHECK_LUA_PRG}" CACHE FILEPATH "Path to a program.")
break() break()
endif() endif()
endif() endif()
endforeach() endforeach()
unset(_CHECK_LUA_PRG CACHE)
else() else()
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS) check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
endif() endif()
@@ -595,7 +560,10 @@ if(BUSTED_PRG)
endif() endif()
set(UNITTEST_PREREQS nvim-test unittest-headers) set(UNITTEST_PREREQS nvim-test unittest-headers)
set(FUNCTIONALTEST_PREREQS nvim printenv-test printargs-test shell-test streams-test tty-test ${GENERATED_HELP_TAGS}) set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test streams-test ${GENERATED_HELP_TAGS})
if(NOT WIN32)
list(APPEND FUNCTIONALTEST_PREREQS tty-test)
endif()
set(BENCHMARK_PREREQS nvim tty-test) set(BENCHMARK_PREREQS nvim tty-test)
# Useful for automated build systems, if they want to manually run the tests. # Useful for automated build systems, if they want to manually run the tests.
@@ -691,7 +659,7 @@ endif()
if(LUACHECK_PRG) if(LUACHECK_PRG)
add_custom_target(lualint add_custom_target(lualint
COMMAND ${LUACHECK_PRG} -q runtime/ src/ test/ --exclude-files test/functional/fixtures/lua/syntax_error.lua COMMAND ${LUACHECK_PRG} -q runtime/ src/ test/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
else() else()
add_custom_target(lualint false add_custom_target(lualint false
@@ -709,14 +677,3 @@ set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_NSIS_MODIFY_PATH ON) set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
include(CPack) include(CPack)
#add uninstall target
if(NOT TARGET uninstall)
configure_file(
"cmake/UninstallHelper.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/UninstallHelper.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/UninstallHelper.cmake)
endif()

View File

@@ -8,7 +8,7 @@ If you want to help but don't know where to start, here are some
low-risk/isolated tasks: low-risk/isolated tasks:
- [Merge a Vim patch]. - [Merge a Vim patch].
- Try a [good first issue](../../labels/good%20first%20issue) or [complexity:low] issue. - Try a [complexity:low] issue.
- Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or - Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or
[Coverity](#coverity). [Coverity](#coverity).
@@ -20,7 +20,6 @@ Reporting problems
- Update Neovim to the latest version to see if your problem persists. - Update Neovim to the latest version to see if your problem persists.
- Disable plugins incrementally, to narrow down the cause of the issue. - Disable plugins incrementally, to narrow down the cause of the issue.
- When reporting a crash, [include a stacktrace](https://github.com/neovim/neovim/wiki/FAQ#backtrace-linux). - When reporting a crash, [include a stacktrace](https://github.com/neovim/neovim/wiki/FAQ#backtrace-linux).
- Use [ASAN/UBSAN](#clang-sanitizers-asan-and-ubsan) to get detailed errors for segfaults and undefined behavior.
- [Bisect][git-bisect] to the cause of a regression, if you are able. This is _extremely_ helpful. - [Bisect][git-bisect] to the cause of a regression, if you are able. This is _extremely_ helpful.
- Check `$NVIM_LOG_FILE`, if it exists. - Check `$NVIM_LOG_FILE`, if it exists.
- Include `cmake --system-information` for build-related issues. - Include `cmake --system-information` for build-related issues.
@@ -37,7 +36,6 @@ Developer guidelines
make distclean make distclean
make # Nvim build system uses ninja automatically, if available. make # Nvim build system uses ninja automatically, if available.
``` ```
- [Improve documentation][wiki-contribute-help]
Pull requests (PRs) Pull requests (PRs)
--------------------- ---------------------
@@ -67,39 +65,27 @@ Pull requests (PRs)
Pull requests have three stages: `[WIP]` (Work In Progress), `[RFC]` (Request Pull requests have three stages: `[WIP]` (Work In Progress), `[RFC]` (Request
For Comment) and `[RDY]` (Ready). For Comment) and `[RDY]` (Ready).
1. `[RFC]` is assumed by default, **do not** put "RFC" in the PR title (it adds - `[RFC]` is assumed by default, i.e. you are requesting a review.
noise to merge commit messages). - Add `[WIP]` to the PR title if you are _not_ requesting feedback and the work
2. Add `[WIP]` to the PR title if you are _not_ requesting feedback and the work is still in flux.
is still in flux. - Add `[RDY]` if you are _done_ and only waiting on merge.
3. Add `[RDY]` to the PR title if you are _done_ and only waiting on merge.
### Commit messages ### Commit messages
Follow the [convential commits guidelines][conventional_commits] to *make reviews easier* and to make Follow [commit message hygiene][hygiene] to *make reviews easier* and to make
the VCS/git logs more valuable. The general structure of a commit message is as follows: the VCS/git logs more valuable.
``` - Try to keep the first line under 72 characters.
<type>([optional scope]): <description> - **Prefix the commit subject with a _scope_:** `doc:`, `test:`, `foo.c:`,
[optional body]
[optional footer(s)]
```
- **Prefix the commit subject with a _type_:** `doc:`, `test:`
`runtime:`, ... `runtime:`, ...
- Subject line for commits with only style/lint changes can be a single - Subject line for commits with only style/lint changes can be a single
word: `style` or `lint`. word: `style` or `lint`.
- **Add the optional scope following <type> if possible:** `(lsp)`, `(treesitter)`, `(multigrid)`, ...
- Try to keep the first line under 72 characters.
- A blank line must separate the subject from the description. - A blank line must separate the subject from the description.
- Breaking changes must be indicated at the very beginning of the footer or body section of a commit. A breaking change must consist of the uppercase text BREAKING CHANGE, followed by a colon, a space, and a description of what has changed about the API.
- Check your commit message for spelling and grammatical mistakes.
- Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug." - Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug."
### Automated builds (CI) ### Automated builds (CI)
Each pull request must pass the automated builds on [Travis CI], [sourcehut] Each pull request must pass the automated builds on [Travis CI], [QuickBuild]
and [AppVeyor]. and [AppVeyor].
- CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings - CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings
@@ -114,19 +100,14 @@ and [AppVeyor].
- The [lint](#lint) build checks modified lines _and their immediate - The [lint](#lint) build checks modified lines _and their immediate
neighbors_, to encourage incrementally updating the legacy style to meet our neighbors_, to encourage incrementally updating the legacy style to meet our
[style](#style). (See [#3174][3174] for background.) [style](#style). (See [#3174][3174] for background.)
- CI for freebsd and openbsd runs on [sourcehut]. - [How to investigate QuickBuild failures](https://github.com/neovim/neovim/pull/4718#issuecomment-217631350)
- To get a backtrace on freebsd (after connecting via ssh): - QuickBuild uses this invocation:
```sh ```
sudo pkg install tmux # If you want tmux. mkdir -p build/${params.get("buildType")} \
lldb build/bin/nvim -c nvim.core && cd build/${params.get("buildType")} \
&& cmake -G "Unix Makefiles" -DBUSTED_OUTPUT_TYPE=TAP -DCMAKE_BUILD_TYPE=${params.get("buildType")}
# To get a full backtrace: -DTRAVIS_CI_BUILD=ON ../.. && ${node.getAttribute("make", "make")}
# 1. Rebuild with debug info. VERBOSE=1 nvim unittest-prereqs functionaltest-prereqs
rm -rf nvim.core build
gmake CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCI_BUILD=ON -DMIN_LOG_LEVEL=3" nvim
# 2. Run the failing test to generate a new core file.
TEST_FILE=test/functional/foo.lua gmake functionaltest
lldb build/bin/nvim -c nvim.core
``` ```
### Clang scan-build ### Clang scan-build
@@ -173,20 +154,7 @@ master build. To view the defects, just request access; you will be approved.
``` ```
git log --oneline --no-merges --grep coverity git log --oneline --no-merges --grep coverity
``` ```
### Clang sanitizers (ASAN and UBSAN)
ASAN/UBSAN can be used to detect memory errors and other common forms of undefined behavior at runtime in debug builds.
To build neovim with sanitizers enabled, use
```
rm -rf build && CMAKE_EXTRA_FLAGS="-DCMAKE_C_COMPILER=clang -DCLANG_ASAN_UBSAN=1" make
```
When running neovim, use
```
UBSAN_OPTIONS=print_stacktrace=1 ASAN_OPTIONS=log_path=/tmp/nvim_asan nvim args...
```
If neovim exits unexpectedly, check `/tmp/nvim_asan.{PID}` (or your preferred `log_path`) for log files with error messages.
Coding Coding
------ ------
@@ -247,7 +215,7 @@ as context, use the `-W` argument as well.
[github-issues]: https://github.com/neovim/neovim/issues [github-issues]: https://github.com/neovim/neovim/issues
[1820]: https://github.com/neovim/neovim/pull/1820 [1820]: https://github.com/neovim/neovim/pull/1820
[hub]: https://hub.github.com/ [hub]: https://hub.github.com/
[conventional_commits]: https://www.conventionalcommits.org [hygiene]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[style-guide]: http://neovim.io/develop/style-guide.xml [style-guide]: http://neovim.io/develop/style-guide.xml
[ASan]: http://clang.llvm.org/docs/AddressSanitizer.html [ASan]: http://clang.llvm.org/docs/AddressSanitizer.html
[run-tests]: https://github.com/neovim/neovim/blob/master/test/README.md#running-tests [run-tests]: https://github.com/neovim/neovim/blob/master/test/README.md#running-tests
@@ -255,10 +223,9 @@ as context, use the `-W` argument as well.
[review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist [review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist
[3174]: https://github.com/neovim/neovim/issues/3174 [3174]: https://github.com/neovim/neovim/issues/3174
[Travis CI]: https://travis-ci.org/neovim/neovim [Travis CI]: https://travis-ci.org/neovim/neovim
[sourcehut]: https://builds.sr.ht/~jmk [QuickBuild]: http://neovim-qb.szakmeister.net/dashboard
[AppVeyor]: https://ci.appveyor.com/project/neovim/neovim [AppVeyor]: https://ci.appveyor.com/project/neovim/neovim
[Merge a Vim patch]: https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim [Merge a Vim patch]: https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim
[Clang report]: https://neovim.io/doc/reports/clang/ [Clang report]: https://neovim.io/doc/reports/clang/
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow [complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
[master error list]: https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.json [master error list]: https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.json
[wiki-contribute-help]: https://github.com/neovim/neovim/wiki/contribute-%3Ahelp

View File

@@ -58,15 +58,11 @@ endif
BUILD_CMD = $(BUILD_TOOL) BUILD_CMD = $(BUILD_TOOL)
# Only need to handle Ninja here. Make will inherit the VERBOSE variable, and the -j and -n flags. ifneq ($(VERBOSE),)
ifeq ($(BUILD_TYPE),Ninja) # Only need to handle Ninja here. Make will inherit the VERBOSE variable.
ifneq ($(VERBOSE),) ifeq ($(BUILD_TYPE),Ninja)
BUILD_CMD += -v BUILD_CMD += -v
endif endif
BUILD_CMD += $(shell printf '%s' '$(MAKEFLAGS)' | grep -o -- '-j[0-9]\+')
ifeq (n,$(findstring n,$(firstword -$(MAKEFLAGS))))
BUILD_CMD += -n
endif
endif endif
DEPS_CMAKE_FLAGS ?= DEPS_CMAKE_FLAGS ?=
@@ -123,13 +119,8 @@ oldtest: | nvim build/runtime/doc/tags
ifeq ($(strip $(TEST_FILE)),) ifeq ($(strip $(TEST_FILE)),)
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES) +$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES)
else else
@# Handle TEST_FILE=test_foo{,.res,.vim}. +$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES)
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" SCRIPTS= $(MAKEOVERRIDES) $(patsubst %.vim,%,$(patsubst %.res,%,$(TEST_FILE)))
endif endif
# Build oldtest by specifying the relative .vim filename.
.PHONY: phony_force
src/nvim/testdir/%.vim: phony_force
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" SCRIPTS= $(MAKEOVERRIDES) $(patsubst src/nvim/testdir/%.vim,%,$@)
build/runtime/doc/tags helptags: | nvim build/runtime/doc/tags helptags: | nvim
+$(BUILD_CMD) -C build runtime/doc/tags +$(BUILD_CMD) -C build runtime/doc/tags
@@ -147,14 +138,6 @@ functionaltest-lua: | nvim
lualint: | build/.ran-cmake deps lualint: | build/.ran-cmake deps
$(BUILD_CMD) -C build lualint $(BUILD_CMD) -C build lualint
shlint:
@shellcheck --version | head -n 2
shellcheck scripts/vim-patch.sh
_opt_shlint:
@command -v shellcheck && { $(MAKE) shlint; exit $$?; } \
|| echo "SKIP: shlint (shellcheck not found)"
pylint: pylint:
flake8 contrib/ scripts/ src/ test/ flake8 contrib/ scripts/ src/ test/
@@ -175,7 +158,6 @@ clean:
+test -d build && $(BUILD_CMD) -C build clean || true +test -d build && $(BUILD_CMD) -C build clean || true
$(MAKE) -C src/nvim/testdir clean $(MAKE) -C src/nvim/testdir clean
$(MAKE) -C runtime/doc clean $(MAKE) -C runtime/doc clean
$(MAKE) -C runtime/indent clean
distclean: distclean:
rm -rf $(DEPS_BUILD_DIR) build rm -rf $(DEPS_BUILD_DIR) build
@@ -205,16 +187,16 @@ appimage:
appimage-%: appimage-%:
bash scripts/genappimage.sh $* bash scripts/genappimage.sh $*
lint: check-single-includes clint lualint _opt_pylint _opt_shlint lint: check-single-includes clint lualint _opt_pylint
# Generic pattern rules, allowing for `make build/bin/nvim` etc. # Generic pattern rules, allowing for `make build/bin/nvim` etc.
# Does not work with "Unix Makefiles". # Does not work with "Unix Makefiles".
ifeq ($(BUILD_TYPE),Ninja) ifeq ($(BUILD_TYPE),Ninja)
build/%: phony_force build/%:
$(BUILD_CMD) -C build $(patsubst build/%,%,$@) $(BUILD_CMD) -C build $(patsubst build/%,%,$@)
$(DEPS_BUILD_DIR)/%: phony_force $(DEPS_BUILD_DIR)/%:
$(BUILD_CMD) -C $(DEPS_BUILD_DIR) $(patsubst $(DEPS_BUILD_DIR)/%,%,$@) $(BUILD_CMD) -C $(DEPS_BUILD_DIR) $(patsubst $(DEPS_BUILD_DIR)/%,%,$@)
endif endif
.PHONY: test lualint pylint shlint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage checkprefix .PHONY: test lualint pylint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage checkprefix

View File

@@ -1,10 +1,12 @@
[![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-300x87.png)](https://neovim.io) [![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-300x87.png)](https://neovim.io)
[Documentation](https://neovim.io/doc/general/) | [Wiki](https://github.com/neovim/neovim/wiki) |
[Chat](https://gitter.im/neovim/neovim) | [Documentation](https://neovim.io/doc) |
[Chat/Discussion](https://gitter.im/neovim/neovim) |
[Twitter](https://twitter.com/Neovim) [Twitter](https://twitter.com/Neovim)
[![GitHub CI](https://github.com/neovim/neovim/workflows/CI/badge.svg)](https://github.com/neovim/neovim/actions?query=workflow%3A%22CI%22) [![Travis build status](https://travis-ci.org/neovim/neovim.svg?branch=master)](https://travis-ci.org/neovim/neovim)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/urdqjrik5u521fac/branch/master?svg=true)](https://ci.appveyor.com/project/neovim/neovim/branch/master)
[![Codecov coverage](https://img.shields.io/codecov/c/github/neovim/neovim.svg)](https://codecov.io/gh/neovim/neovim) [![Codecov coverage](https://img.shields.io/codecov/c/github/neovim/neovim.svg)](https://codecov.io/gh/neovim/neovim)
[![Coverity Scan analysis](https://scan.coverity.com/projects/2227/badge.svg)](https://scan.coverity.com/projects/2227) [![Coverity Scan analysis](https://scan.coverity.com/projects/2227/badge.svg)](https://scan.coverity.com/projects/2227)
[![Clang analysis](https://neovim.io/doc/reports/clang/badge.svg)](https://neovim.io/doc/reports/clang) [![Clang analysis](https://neovim.io/doc/reports/clang/badge.svg)](https://neovim.io/doc/reports/clang)
@@ -13,7 +15,6 @@
[![Packages](https://repology.org/badge/tiny-repos/neovim.svg)](https://repology.org/metapackage/neovim) [![Packages](https://repology.org/badge/tiny-repos/neovim.svg)](https://repology.org/metapackage/neovim)
[![Debian CI](https://badges.debian.net/badges/debian/testing/neovim/version.svg)](https://buildd.debian.org/neovim) [![Debian CI](https://badges.debian.net/badges/debian/testing/neovim/version.svg)](https://buildd.debian.org/neovim)
[![Downloads](https://img.shields.io/github/downloads/neovim/neovim/total.svg?maxAge=2592001)](https://github.com/neovim/neovim/releases/) [![Downloads](https://img.shields.io/github/downloads/neovim/neovim/total.svg?maxAge=2592001)](https://github.com/neovim/neovim/releases/)
[![nvim](https://snapcraft.io//nvim/badge.svg)](https://snapcraft.io/nvim)
Neovim is a project that seeks to aggressively refactor Vim in order to: Neovim is a project that seeks to aggressively refactor Vim in order to:
@@ -46,16 +47,13 @@ Install from package
Pre-built packages for Windows, macOS, and Linux are found on the Pre-built packages for Windows, macOS, and Linux are found on the
[Releases](https://github.com/neovim/neovim/releases/) page. [Releases](https://github.com/neovim/neovim/releases/) page.
[Managed packages] are in [Homebrew], [Debian], [Ubuntu], [Fedora], [Arch Linux], [Managed packages] are in Homebrew, [Debian], [Ubuntu], [Fedora], [Arch Linux],
[Gentoo], and more! [Gentoo], and more!
Install from source Install from source
------------------- -------------------
See the [Building Neovim](https://github.com/neovim/neovim/wiki/Building-Neovim) wiki page for details.
The build is CMake-based, but a Makefile is provided as a convenience. The build is CMake-based, but a Makefile is provided as a convenience.
After installing the dependencies, run the following command.
make CMAKE_BUILD_TYPE=RelWithDebInfo make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install sudo make install
@@ -65,12 +63,29 @@ To install to a non-default location:
make CMAKE_INSTALL_PREFIX=/full/path/ make CMAKE_INSTALL_PREFIX=/full/path/
make install make install
To skip bundled (`third-party/*`) dependencies:
1. Install the dependencies using a package manager.
```
sudo apt install gperf luajit luarocks libuv1-dev libluajit-5.1-dev libunibilium-dev libmsgpack-dev libtermkey-dev libvterm-dev
sudo luarocks build mpack
sudo luarocks build lpeg
sudo luarocks build inspect
```
2. Build with `USE_BUNDLED=OFF`:
```
make CMAKE_BUILD_TYPE=RelWithDebInfo USE_BUNDLED=OFF
sudo make install
```
To inspect the build, these CMake features are useful: To inspect the build, these CMake features are useful:
- `cmake --build build --target help` lists all build targets. - `cmake --build build --target help` lists all build targets.
- `build/CMakeCache.txt` (or `cmake -LAH build/`) contains the resolved values of all CMake variables. - `build/CMakeCache.txt` (or `cmake -LAH build/`) contains the resolved values of all CMake variables.
- `build/compile_commands.json` shows the full compiler invocations for each translation unit. - `build/compile_commands.json` shows the full compiler invocations for each translation unit.
See the [Building Neovim](https://github.com/neovim/neovim/wiki/Building-Neovim) wiki page for details.
Transitioning from Vim Transitioning from Vim
-------------------- --------------------
@@ -98,9 +113,17 @@ Project layout
License License
------- -------
Neovim contributions since [b17d96][license-commit] are licensed under the Neovim is licensed under the terms of the Apache 2.0 license, except for
Apache 2.0 license, except for contributions copied from Vim (identified by the parts that were contributed under the Vim license.
`vim-patch` token). See LICENSE for details.
- Contributions committed before [b17d96][license-commit] remain under the Vim
license.
- Contributions committed after [b17d96][license-commit] are licensed under
Apache 2.0 unless those contributions were copied from Vim (identified in
the commit logs by the `vim-patch` token).
See `LICENSE` for details.
Vim is Charityware. You can use and copy it as much as you like, but you are Vim is Charityware. You can use and copy it as much as you like, but you are
encouraged to make a donation for needy children in Uganda. Please see the encouraged to make a donation for needy children in Uganda. Please see the
@@ -123,6 +146,5 @@ Apache 2.0 license, except for contributions copied from Vim (identified by the
[Fedora]: https://apps.fedoraproject.org/packages/neovim [Fedora]: https://apps.fedoraproject.org/packages/neovim
[Arch Linux]: https://www.archlinux.org/packages/?q=neovim [Arch Linux]: https://www.archlinux.org/packages/?q=neovim
[Gentoo]: https://packages.gentoo.org/packages/app-editors/neovim [Gentoo]: https://packages.gentoo.org/packages/app-editors/neovim
[Homebrew]: https://formulae.brew.sh/formula/neovim
<!-- vim: set tw=80: --> <!-- vim: set tw=80: -->

45
appveyor.yml Normal file
View File

@@ -0,0 +1,45 @@
version: '{build}'
environment:
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: "-t7z -m0=lzma -mx=9"
DEPS_BUILD_DIR: "C:/projects/nvim-deps"
DEPS_PREFIX: "C:/projects/nvim-deps/usr"
# Silence/redirect errors due to missing locking support (via libgcov).
GCOV_ERROR_FILE: "$(TEMP)/libgcov-errors.log"
image: Visual Studio 2017
configuration:
- MINGW_64-gcov
- MINGW_32
- MSVC_64
- MSVC_32
init:
- ps: |
# Pull requests: skip some build configurations to save time.
if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -and $env:CONFIGURATION -match '^(MSVC_64|MINGW_32)$') {
$env:APPVEYOR_CACHE_SKIP_SAVE = "true"
Exit-AppVeyorBuild
}
# RDP
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
matrix:
fast_finish: true
install: []
before_build:
- ps: Install-Product node 8
build_script:
- powershell ci\build.ps1
after_build:
- ps: |
if (Test-Path $env:GCOV_ERROR_FILE) {
Get-Content $env:GCOV_ERROR_FILE -Head 10
Get-Content $env:GCOV_ERROR_FILE -Tail 10
} else {
write-host "no GCOV_ERROR_FILE"
}
cache:
- C:\projects\nvim-deps -> third-party\**
artifacts:
- path: build/Neovim.zip
- path: build/bin/nvim.exe
branches:
only:
- master

View File

@@ -3,6 +3,10 @@
set -e set -e
set -o pipefail set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
echo 'Python info:' echo 'Python info:'
( (
set -x set -x
@@ -22,7 +26,7 @@ if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then
echo 'Setting Python versions via pyenv' echo 'Setting Python versions via pyenv'
# Prefer Python 2 over 3 (more conservative). # Prefer Python 2 over 3 (more conservative).
pyenv global 2.7:3.8 pyenv global 2.7.15:3.7
echo 'Updated Python info:' echo 'Updated Python info:'
( (
@@ -43,11 +47,12 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then
fi fi
source ~/.nvm/nvm.sh source ~/.nvm/nvm.sh
nvm install 10 nvm install --lts
nvm use --lts
if [[ -n "$CMAKE_URL" ]]; then if [[ -n "$CMAKE_URL" ]]; then
echo "Installing custom CMake: $CMAKE_URL" echo "Installing custom CMake: $CMAKE_URL"
curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL" curl --retry 5 --silent --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
mkdir -p "$HOME/.local/bin" /opt/cmake-custom mkdir -p "$HOME/.local/bin" /opt/cmake-custom
bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake" ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"

View File

@@ -3,15 +3,13 @@
set -e set -e
set -o pipefail set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh" source "${CI_DIR}/common/build.sh"
# Enable ipv6 on Travis. ref: a39c8b7ce30d
if test -n "${TRAVIS_OS_NAME}" && ! test "${TRAVIS_OS_NAME}" = osx ; then
echo "before_script.sh: enable ipv6"
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
fi
# Test some of the configuration variables. # Test some of the configuration variables.
if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then
echo "\$GCOV: '${GCOV}' is not executable." echo "\$GCOV: '${GCOV}' is not executable."
@@ -37,10 +35,5 @@ fi
# Compile dependencies. # Compile dependencies.
build_deps build_deps
# Install cluacov for Lua coverage.
if [[ "$USE_LUACOV" == 1 ]]; then
"${DEPS_BUILD_DIR}/usr/bin/luarocks" install cluacov
fi
rm -rf "${LOG_DIR}" rm -rf "${LOG_DIR}"
mkdir -p "${LOG_DIR}" mkdir -p "${LOG_DIR}"

View File

@@ -1,11 +1,10 @@
param([switch]$NoTests) $ErrorActionPreference = 'stop'
Set-StrictMode -Version Latest Set-PSDebug -Strict -Trace 1
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$isPullRequest = ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -ne $null)
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$' $env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
$compiler = $Matches.compiler $compiler = $Matches.compiler
$compileOption = if ($Matches -contains 'option') {$Matches.option} else {''} $compileOption = $Matches.option
$bits = $Matches.bits $bits = $Matches.bits
$cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'}); $cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
$buildDir = [System.IO.Path]::GetFullPath("$(pwd)") $buildDir = [System.IO.Path]::GetFullPath("$(pwd)")
@@ -24,15 +23,11 @@ $uploadToCodeCov = $false
function exitIfFailed() { function exitIfFailed() {
if ($LastExitCode -ne 0) { if ($LastExitCode -ne 0) {
Set-PSDebug -Off
exit $LastExitCode exit $LastExitCode
} }
} }
if (-not $NoTests) {
node --version
npm.cmd --version
}
if (-Not (Test-Path -PathType container $env:DEPS_BUILD_DIR)) { if (-Not (Test-Path -PathType container $env:DEPS_BUILD_DIR)) {
write-host "cache dir not found: $($env:DEPS_BUILD_DIR)" write-host "cache dir not found: $($env:DEPS_BUILD_DIR)"
mkdir $env:DEPS_BUILD_DIR mkdir $env:DEPS_BUILD_DIR
@@ -51,17 +46,13 @@ if ($compiler -eq 'MINGW') {
$nvimCmakeVars['USE_GCOV'] = 'ON' $nvimCmakeVars['USE_GCOV'] = 'ON'
$uploadToCodecov = $true $uploadToCodecov = $true
$env:GCOV = "C:\msys64\mingw$bits\bin\gcov" $env:GCOV = "C:\msys64\mingw$bits\bin\gcov"
# Setup/build Lua coverage.
$env:USE_LUACOV = 1
$env:BUSTED_ARGS = "--coverage"
} }
# These are native MinGW builds, but they use the toolchain inside # These are native MinGW builds, but they use the toolchain inside
# MSYS2, this allows using all the dependencies and tools available # MSYS2, this allows using all the dependencies and tools available
# in MSYS2, but we cannot build inside the MSYS2 shell. # in MSYS2, but we cannot build inside the MSYS2 shell.
$cmakeGenerator = 'Ninja' $cmakeGenerator = 'Ninja'
$cmakeGeneratorArgs = '-v' $cmakeGeneratorArgs = '-v'
$mingwPackages = @('ninja', 'cmake', 'diffutils').ForEach({ $mingwPackages = @('ninja', 'cmake', 'perl', 'diffutils').ForEach({
"mingw-w64-$arch-$_" "mingw-w64-$arch-$_"
}) })
@@ -85,33 +76,23 @@ elseif ($compiler -eq 'MSVC') {
} }
} }
if (-not $NoTests) { # Setup python (use AppVeyor system python)
# Setup python (use AppVeyor system python) C:\Python27\python.exe -m pip install pynvim ; exitIfFailed
C:\Python35\python.exe -m pip install pynvim ; exitIfFailed
# Disambiguate python3
move c:\Python35\python.exe c:\Python35\python3.exe
$env:PATH = "C:\Python35;C:\Python27;$env:PATH"
# Sanity check
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed
# Disambiguate python3, if needed $env:PATH = "C:\Ruby24\bin;$env:PATH"
if (-not (Test-Path -Path C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe) ) { gem.cmd install neovim
move C:\hostedtoolcache\windows\Python\3.5.4\x64\python.exe C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe Get-Command -CommandType Application neovim-ruby-host.bat
}
$env:PATH = "C:\hostedtoolcache\windows\Python\2.7.18\x64;C:\hostedtoolcache\windows\Python\3.5.4\x64;$env:PATH"
python -m pip install pynvim ; exitIfFailed npm.cmd install -g neovim
python3 -m pip install pynvim ; exitIfFailed Get-Command -CommandType Application neovim-node-host.cmd
# Sanity check npm.cmd link neovim
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed
gem.cmd install --pre neovim
Get-Command -CommandType Application neovim-ruby-host.bat
npm.cmd install -g neovim
Get-Command -CommandType Application neovim-node-host.cmd
npm.cmd link neovim
}
if ($compiler -eq 'MSVC') {
# Required for LuaRocks (https://github.com/luarocks/luarocks/issues/1039#issuecomment-507296940).
$env:VCINSTALLDIR = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/"
}
function convertToCmakeArgs($vars) { function convertToCmakeArgs($vars) {
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" } return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
@@ -132,42 +113,37 @@ cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
# Ensure that the "win32" feature is set. # Ensure that the "win32" feature is set.
.\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed .\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
if ($env:USE_LUACOV -eq 1) { # Functional tests
& $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov # The $LastExitCode from MSBuild can't be trusted
} $failed = $false
# Temporarily turn off tracing to reduce log file output
if (-not $NoTests) { Set-PSDebug -Off
# Functional tests cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
# The $LastExitCode from MSBuild can't be trusted foreach { $failed = $failed -or
$failed = $false $_ -match 'functional tests failed with error'; $_ }
if ($failed) {
# Run only this test file:
# $env:TEST_FILE = "test\functional\foo.lua"
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
foreach { $failed = $failed -or
$_ -match 'functional tests failed with error'; $_ }
if ($uploadToCodecov) { if ($uploadToCodecov) {
if ($env:USE_LUACOV -eq 1) {
& $env:DEPS_PREFIX\bin\luacov.bat
}
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
} }
if ($failed) { exit $LastExitCode
exit $LastExitCode }
} Set-PSDebug -Strict -Trace 1
# Old tests
# Add MSYS to path, required for e.g. `find` used in test scripts.
# But would break functionaltests, where its `more` would be used then.
$OldPath = $env:PATH
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed
$env:PATH = $OldPath
if ($uploadToCodecov) { if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
} }
# Old tests
# Add MSYS to path, required for e.g. `find` used in test scripts.
# But would break functionaltests, where its `more` would be used then.
$OldPath = $env:PATH
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed
$env:PATH = $OldPath
if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
} }
# Build artifacts # Build artifacts

View File

@@ -1,5 +1,5 @@
_stat() { _stat() {
if test "${CI_OS_NAME}" = osx ; then if test "${TRAVIS_OS_NAME}" = osx ; then
stat -f %Sm "${@}" stat -f %Sm "${@}"
else else
stat -c %y "${@}" stat -c %y "${@}"
@@ -18,6 +18,9 @@ build_make() {
} }
build_deps() { build_deps() {
if test "${BUILD_32BIT}" = ON ; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
fi
if test "${FUNCTIONALTEST}" = "functionaltest-lua" \ if test "${FUNCTIONALTEST}" = "functionaltest-lua" \
|| test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then || test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON" DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
@@ -29,7 +32,7 @@ build_deps() {
if test "${CACHE_ENABLE}" = "false" ; then if test "${CACHE_ENABLE}" = "false" ; then
export CCACHE_RECACHE=1 export CCACHE_RECACHE=1
elif test -f "${CACHE_MARKER}" ; then elif test -f "${CACHE_MARKER}" ; then
echo "Using third-party dependencies from cache (last update: $(_stat "${CACHE_MARKER}"))." echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))."
cp -a "${CACHE_NVIM_DEPS_DIR}"/. "${DEPS_BUILD_DIR}" cp -a "${CACHE_NVIM_DEPS_DIR}"/. "${DEPS_BUILD_DIR}"
fi fi
@@ -37,24 +40,27 @@ build_deps() {
# update CMake configuration and update to newer deps versions. # update CMake configuration and update to newer deps versions.
cd "${DEPS_BUILD_DIR}" cd "${DEPS_BUILD_DIR}"
echo "Configuring with '${DEPS_CMAKE_FLAGS}'." echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/third-party/" CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/"
if ! top_make; then if ! top_make; then
exit 1 exit 1
fi fi
cd "${CI_BUILD_DIR}" cd "${TRAVIS_BUILD_DIR}"
} }
prepare_build() { prepare_build() {
if test -n "${CLANG_SANITIZER}" ; then if test -n "${CLANG_SANITIZER}" ; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON" CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
fi fi
if test "${BUILD_32BIT}" = ON ; then
CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
fi
mkdir -p "${BUILD_DIR}" mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}" cd "${BUILD_DIR}"
echo "Configuring with '${CMAKE_FLAGS} $@'." echo "Configuring with '${CMAKE_FLAGS} $@'."
cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}" cmake -G Ninja ${CMAKE_FLAGS} "$@" "${TRAVIS_BUILD_DIR}"
} }
build_nvim() { build_nvim() {
@@ -84,5 +90,14 @@ build_nvim() {
fi fi
check_sanitizer "${LOG_DIR}" check_sanitizer "${LOG_DIR}"
cd "${CI_BUILD_DIR}" cd "${TRAVIS_BUILD_DIR}"
}
macos_rvm_dance() {
# neovim-ruby gem requires a ruby newer than the macOS default.
source ~/.rvm/scripts/rvm
rvm get stable --auto-dotfiles
rvm reload
rvm use 2.2.5
rvm use
} }

View File

@@ -43,14 +43,3 @@ fi
# Cleanup always, especially collected data. # Cleanup always, especially collected data.
find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l
rm -f coverage.xml rm -f coverage.xml
# Upload Lua coverage (generated manually on AppVeyor/Windows).
if [ "$USE_LUACOV" = 1 ] && [ "$1" != "oldtest" ]; then
if [ -x "${DEPS_BUILD_DIR}/usr/bin/luacov" ]; then
"${DEPS_BUILD_DIR}/usr/bin/luacov"
fi
if ! "$codecov_sh" -f luacov.report.out -X gcov -X fix -Z -F "lua,${codecov_flags}"; then
echo "codecov upload failed."
fi
rm luacov.stats.out
fi

View File

@@ -13,33 +13,16 @@ FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors"
ANSI_CLEAR="\033[0K" ANSI_CLEAR="\033[0K"
if test "$TRAVIS" = "true"; then travis_fold() {
ci_fold() { local action="$1"
local action="$1" local name="$2"
local name="$2" name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')" name="$(echo -n "$name" | sed 's/-$//')"
name="$(echo -n "$name" | sed 's/-$//')" echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}" }
}
elif test "$GITHUB_ACTIONS" = "true"; then if test "$TRAVIS" != "true" ; then
ci_fold() { travis_fold() {
local action="$1"
local name="$2"
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
name="$(echo -n "$name" | sed 's/-$//')"
case "$action" in
start)
echo "::group::${name}"
;;
end)
echo "::endgroup::"
;;
*)
:;;
esac
}
else
ci_fold() {
return 0 return 0
} }
fi fi
@@ -50,7 +33,7 @@ enter_suite() {
rm -f "${END_MARKER}" rm -f "${END_MARKER}"
local suite_name="$1" local suite_name="$1"
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name" export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name"
ci_fold start "${NVIM_TEST_CURRENT_SUITE}" travis_fold start "${NVIM_TEST_CURRENT_SUITE}"
set -x set -x
} }
@@ -60,7 +43,7 @@ exit_suite() {
echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:" echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:"
echo "${FAIL_SUMMARY}" echo "${FAIL_SUMMARY}"
else else
ci_fold end "${NVIM_TEST_CURRENT_SUITE}" travis_fold end "${NVIM_TEST_CURRENT_SUITE}"
fi fi
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}" export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}"
if test "$1" != "--continue" ; then if test "$1" != "--continue" ; then

View File

@@ -15,7 +15,7 @@ print_core() {
return 0 return 0
fi fi
echo "======= Core file $core =======" echo "======= Core file $core ======="
if test "${CI_OS_NAME}" = osx ; then if test "${TRAVIS_OS_NAME}" = osx ; then
lldb -Q -o "bt all" -f "${app}" -c "${core}" lldb -Q -o "bt all" -f "${app}" -c "${core}"
else else
gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}" gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}"
@@ -30,11 +30,11 @@ check_core_dumps() {
fi fi
local app="${1:-${BUILD_DIR}/bin/nvim}" local app="${1:-${BUILD_DIR}/bin/nvim}"
local cores local cores
if test "${CI_OS_NAME}" = osx ; then if test "${TRAVIS_OS_NAME}" = osx ; then
cores="$(find /cores/ -type f -print)" cores="$(find /cores/ -type f -print)"
local _sudo='sudo' local _sudo='sudo'
else else
cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)" cores="$(find ./ -type f -name 'core.*' -print)"
local _sudo= local _sudo=
fi fi
@@ -82,7 +82,7 @@ valgrind_check() {
check_sanitizer() { check_sanitizer() {
if test -n "${CLANG_SANITIZER}"; then if test -n "${CLANG_SANITIZER}"; then
check_logs "${1}" "*san.*" | ${SYMBOLIZER:-cat} check_logs "${1}" "*san.*"
fi fi
} }

View File

@@ -4,7 +4,7 @@ set -e
set -o pipefail set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then if [[ "${CI_TARGET}" == lint ]]; then
python3 -m pip -q install --user --upgrade flake8 python -m pip -q install --user --upgrade flake8
exit exit
fi fi
@@ -14,20 +14,13 @@ fi
# Use default CC to avoid compilation problems when installing Python modules. # Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python 3." echo "Install neovim module for Python 3."
CC=cc python3 -m pip -q install --user --upgrade pynvim CC=cc python3 -m pip -q install --upgrade pynvim
if python2 -m pip -c True 2>&1; then echo "Install neovim module for Python 2."
echo "Install neovim module for Python 2." CC=cc python2 -m pip -q install --upgrade pynvim
CC=cc python2 -m pip -q install --user --upgrade pynvim
fi
echo "Install neovim RubyGem." echo "Install neovim RubyGem."
gem install --no-document --bindir "$HOME/.local/bin" --user-install --pre neovim gem install --no-document --version ">= 0.8.0" neovim
echo "Install neovim npm package" echo "Install neovim npm package"
source ~/.nvm/nvm.sh
nvm use 10
npm install -g neovim npm install -g neovim
npm link neovim npm link neovim
sudo cpanm -n Neovim::Ext || cat "$HOME/.cpanm/build.log"
perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'

View File

@@ -20,10 +20,6 @@ enter_suite 'pylint'
run_test 'make pylint' pylint run_test 'make pylint' pylint
exit_suite --continue exit_suite --continue
enter_suite 'shlint'
run_test 'make shlint' shlint
exit_suite --continue
enter_suite single-includes enter_suite single-includes
CLICOLOR_FORCE=1 run_test_wd \ CLICOLOR_FORCE=1 run_test_wd \
--allow-hang \ --allow-hang \

View File

@@ -17,10 +17,6 @@ build_nvim
exit_suite --continue exit_suite --continue
source ~/.nvm/nvm.sh
nvm use 10
enter_suite tests enter_suite tests
if test "$CLANG_SANITIZER" != "TSAN" ; then if test "$CLANG_SANITIZER" != "TSAN" ; then

View File

@@ -1,194 +0,0 @@
{
"ref": "refs/heads/master",
"before": "66b136c43c12df3dcf8f19ff48f206ad2e4f43fc",
"after": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
"repository": {
"id": 292861950,
"node_id": "MDEwOlJlcG9zaXRvcnkyOTI4NjE5NTA=",
"name": "neovim-snap",
"full_name": "hurricanehrndz/neovim-snap",
"private": false,
"owner": {
"name": "hurricanehrndz",
"email": "hurricanehrndz@users.noreply.github.com",
"login": "hurricanehrndz",
"id": 5804237,
"node_id": "MDQ6VXNlcjU4MDQyMzc=",
"avatar_url": "https://avatars0.githubusercontent.com/u/5804237?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hurricanehrndz",
"html_url": "https://github.com/hurricanehrndz",
"followers_url": "https://api.github.com/users/hurricanehrndz/followers",
"following_url": "https://api.github.com/users/hurricanehrndz/following{/other_user}",
"gists_url": "https://api.github.com/users/hurricanehrndz/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hurricanehrndz/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hurricanehrndz/subscriptions",
"organizations_url": "https://api.github.com/users/hurricanehrndz/orgs",
"repos_url": "https://api.github.com/users/hurricanehrndz/repos",
"events_url": "https://api.github.com/users/hurricanehrndz/events{/privacy}",
"received_events_url": "https://api.github.com/users/hurricanehrndz/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/hurricanehrndz/neovim-snap",
"description": "snap build for neovim",
"fork": false,
"url": "https://github.com/hurricanehrndz/neovim-snap",
"forks_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/forks",
"keys_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/teams",
"hooks_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/hooks",
"issue_events_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues/events{/number}",
"events_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/events",
"assignees_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/assignees{/user}",
"branches_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/branches{/branch}",
"tags_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/tags",
"blobs_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/statuses/{sha}",
"languages_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/languages",
"stargazers_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/stargazers",
"contributors_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/contributors",
"subscribers_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/subscribers",
"subscription_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/subscription",
"commits_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/contents/{+path}",
"compare_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/merges",
"archive_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/downloads",
"issues_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues{/number}",
"pulls_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/pulls{/number}",
"milestones_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/milestones{/number}",
"notifications_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/labels{/name}",
"releases_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/releases{/id}",
"deployments_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/deployments",
"created_at": 1599227980,
"updated_at": "2020-09-04T14:02:38Z",
"pushed_at": 1599228352,
"git_url": "git://github.com/hurricanehrndz/neovim-snap.git",
"ssh_url": "git@github.com:hurricanehrndz/neovim-snap.git",
"clone_url": "https://github.com/hurricanehrndz/neovim-snap.git",
"svn_url": "https://github.com/hurricanehrndz/neovim-snap",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "MDc6TGljZW5zZTEz"
},
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master",
"stargazers": 0,
"master_branch": "master"
},
"pusher": {
"name": "hurricanehrndz",
"email": "hurricanehrndz@users.noreply.github.com"
},
"sender": {
"login": "hurricanehrndz",
"id": 5804237,
"node_id": "MDQ6VXNlcjU4MDQyMzc=",
"avatar_url": "https://avatars0.githubusercontent.com/u/5804237?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hurricanehrndz",
"html_url": "https://github.com/hurricanehrndz",
"followers_url": "https://api.github.com/users/hurricanehrndz/followers",
"following_url": "https://api.github.com/users/hurricanehrndz/following{/other_user}",
"gists_url": "https://api.github.com/users/hurricanehrndz/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hurricanehrndz/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hurricanehrndz/subscriptions",
"organizations_url": "https://api.github.com/users/hurricanehrndz/orgs",
"repos_url": "https://api.github.com/users/hurricanehrndz/repos",
"events_url": "https://api.github.com/users/hurricanehrndz/events{/privacy}",
"received_events_url": "https://api.github.com/users/hurricanehrndz/received_events",
"type": "User",
"site_admin": false
},
"created": false,
"deleted": false,
"forced": false,
"base_ref": null,
"compare": "https://github.com/hurricanehrndz/neovim-snap/compare/66b136c43c12...1bf69c32217c",
"commits": [
{
"id": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
"tree_id": "62ea83a2349be8c930c45fdc199f71b08bf5927e",
"distinct": true,
"message": "Build of latest tag",
"timestamp": "2020-09-04T14:05:40Z",
"url": "https://github.com/hurricanehrndz/neovim-snap/commit/1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
"author": {
"name": "Carlos Hernandez",
"email": "carlos@techbyte.ca",
"username": "hurricanehrndz"
},
"committer": {
"name": "Carlos Hernandez",
"email": "carlos@techbyte.ca",
"username": "hurricanehrndz"
},
"added": [
],
"removed": [
],
"modified": [
"snap/snapcraft.yaml"
]
}
],
"head_commit": {
"id": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
"tree_id": "62ea83a2349be8c930c45fdc199f71b08bf5927e",
"distinct": true,
"message": "Build of latest tag",
"timestamp": "2020-09-04T14:05:40Z",
"url": "https://github.com/hurricanehrndz/neovim-snap/commit/1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
"author": {
"name": "Carlos Hernandez",
"email": "carlos@techbyte.ca",
"username": "hurricanehrndz"
},
"committer": {
"name": "Carlos Hernandez",
"email": "carlos@techbyte.ca",
"username": "hurricanehrndz"
},
"added": [
],
"removed": [
],
"modified": [
"snap/snapcraft.yaml"
]
}
}

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
RESULT_SNAP=$(find ./ -name "*.snap")
sudo snap install "$RESULT_SNAP" --dangerous --classic
/snap/bin/nvim --version
SHA256=$(sha256sum "$RESULT_SNAP")
echo "SHA256: ${SHA256} ."

View File

@@ -1,39 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
SNAP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WEBHOOK_PAYLOAD="$(cat "${SNAP_DIR}/.snapcraft_payload")"
PAYLOAD_SIG="${SECRET_SNAP_SIG}"
snap_realease_needed() {
last_committed_tag="$(git tag -l --sort=refname|head -1)"
last_snap_release="$(snap info nvim | awk '$1 == "latest/edge:" { print $2 }' | perl -lpe 's/v\d.\d.\d-//g')"
git fetch -f --tags
git checkout "${last_committed_tag}" 2> /dev/null
last_git_release="$(git describe --first-parent 2> /dev/null | perl -lpe 's/v\d.\d.\d-//g')"
if [[ -z "$(echo $last_snap_release | perl -ne "print if /${last_git_release}.*/")" ]]; then
return 0
fi
return 1
}
trigger_snapcraft_webhook() {
[[ -n "${PAYLOAD_SIG}" ]] || exit
echo "Triggering new snap relase via webhook..."
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Hub-Signature: sha1=${PAYLOAD_SIG}" \
--data "${WEBHOOK_PAYLOAD}" \
https://snapcraft.io/nvim/webhook/notify
}
if $(snap_realease_needed); then
echo "New snap release required"
trigger_snapcraft_webhook
fi

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
sudo apt update
sudo usermod -aG lxd $USER
sudo /snap/bin/lxd.migrate -yes
sudo /snap/bin/lxd waitready
sudo /snap/bin/lxd init --auto

View File

@@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
mkdir -p "$CI_BUILD_DIR/snaps-cache"
sg lxd -c snapcraft

Binary file not shown.

View File

@@ -38,9 +38,6 @@ endif()
if (LibIntl_LIBRARY) if (LibIntl_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}") list(APPEND CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
endif() endif()
if (MSVC)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
endif()
check_c_source_compiles(" check_c_source_compiles("
#include <libintl.h> #include <libintl.h>
@@ -51,9 +48,6 @@ int main(int argc, char** argv) {
bind_textdomain_codeset(\"foo\", \"bar\"); bind_textdomain_codeset(\"foo\", \"bar\");
textdomain(\"foo\"); textdomain(\"foo\");
}" HAVE_WORKING_LIBINTL) }" HAVE_WORKING_LIBINTL)
if (MSVC)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
endif()
if (LibIntl_INCLUDE_DIR) if (LibIntl_INCLUDE_DIR)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}") list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
endif() endif()

View File

@@ -42,7 +42,7 @@ unset(_lua_append_versions)
# this is a function only to have all the variables inside go away automatically # this is a function only to have all the variables inside go away automatically
function(_lua_set_version_vars) function(_lua_set_version_vars)
set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0) set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
if (Lua_FIND_VERSION_EXACT) if (Lua_FIND_VERSION_EXACT)
if (Lua_FIND_VERSION_COUNT GREATER 1) if (Lua_FIND_VERSION_COUNT GREATER 1)

View File

@@ -1,11 +0,0 @@
# - Try to find tree-sitter
# Once done, this will define
#
# TreeSitter_FOUND - system has tree-sitter
# TreeSitter_INCLUDE_DIRS - the tree-sitter include directories
# TreeSitter_LIBRARIES - link these to use tree-sitter
include(LibFindMacros)
libfind_pkg_detect(TreeSitter tree-sitter FIND_PATH tree_sitter/api.h FIND_LIBRARY tree-sitter)
libfind_process(TreeSitter)

View File

@@ -3,13 +3,6 @@ function(get_compile_flags _compile_flags)
set(compile_flags "<CMAKE_C_COMPILER> <CFLAGS> <BUILD_TYPE_CFLAGS> <COMPILE_OPTIONS><COMPILE_DEFINITIONS> <INCLUDES>") set(compile_flags "<CMAKE_C_COMPILER> <CFLAGS> <BUILD_TYPE_CFLAGS> <COMPILE_OPTIONS><COMPILE_DEFINITIONS> <INCLUDES>")
# Get C compiler. # Get C compiler.
if(CMAKE_C_COMPILER_ARG1)
string(REPLACE
"<CMAKE_C_COMPILER>"
"<CMAKE_C_COMPILER> ${CMAKE_C_COMPILER_ARG1}"
compile_flags
"${compile_flags}")
endif()
string(REPLACE string(REPLACE
"<CMAKE_C_COMPILER>" "<CMAKE_C_COMPILER>"
"${CMAKE_C_COMPILER}" "${CMAKE_C_COMPILER}"

View File

@@ -0,0 +1,180 @@
# https://github.com/rpavlik/cmake-modules
#
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_dir _gitdir)
# check FORCED_GIT_DIR first
if(FORCED_GIT_DIR)
set(${_gitdir} ${FORCED_GIT_DIR} PARENT_SCOPE)
return()
endif()
# check GIT_DIR in environment
set(GIT_DIR $ENV{GIT_DIR})
if(NOT GIT_DIR)
set(GIT_PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(GIT_DIR ${GIT_PARENT_DIR}/.git)
endif()
# .git dir not found, search parent directories
while(NOT EXISTS ${GIT_DIR})
set(GIT_PREVIOUS_PARENT ${GIT_PARENT_DIR})
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
return()
endif()
set(GIT_DIR ${GIT_PARENT_DIR}/.git)
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(${_gitdir} ${GIT_DIR} PARENT_SCOPE)
endfunction()
function(get_git_head_revision _refspecvar _hashvar)
get_git_dir(GIT_DIR)
if(NOT GIT_DIR)
return()
endif()
set(GIT_DATA ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data)
if(NOT EXISTS ${GIT_DATA})
file(MAKE_DIRECTORY ${GIT_DATA})
endif()
if(NOT EXISTS ${GIT_DIR}/HEAD)
return()
endif()
set(HEAD_FILE ${GIT_DATA}/HEAD)
configure_file(${GIT_DIR}/HEAD ${HEAD_FILE} COPYONLY)
configure_file(${_gitdescmoddir}/GetGitRevisionDescription.cmake.in
${GIT_DATA}/grabRef.cmake
@ONLY)
include(${GIT_DATA}/grabRef.cmake)
set(${_refspecvar} ${HEAD_REF} PARENT_SCOPE)
set(${_hashvar} ${HEAD_HASH} PARENT_SCOPE)
endfunction()
function(git_describe _var)
get_git_dir(GIT_DIR)
if(NOT GIT_DIR)
return()
endif()
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
get_git_head_revision(refspec hash)
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND
${GIT_EXECUTABLE}
describe
${hash}
${ARGN}
WORKING_DIRECTORY
${GIT_DIR}
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} ${out} PARENT_SCOPE)
endfunction()
function(git_timestamp _var)
get_git_dir(GIT_DIR)
if(NOT GIT_DIR)
return()
endif()
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
return()
endif()
get_git_head_revision(refspec hash)
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format="%ci" ${hash} ${ARGN}
WORKING_DIRECTORY ${GIT_DIR}
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
string(REGEX REPLACE "[-\" :]" "" out ${out})
string(SUBSTRING ${out} 0 12 out)
else()
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} ${out} PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} ${out} PARENT_SCOPE)
endfunction()

View File

@@ -0,0 +1,38 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
set(HEAD_HASH "${HEAD_REF}")
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View File

@@ -1,21 +0,0 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif()
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
endforeach()

View File

@@ -12,7 +12,7 @@ check_type_size("size_t" SIZEOF_SIZE_T)
check_type_size("long long" SIZEOF_LONG_LONG) check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size("void *" SIZEOF_VOID_PTR) check_type_size("void *" SIZEOF_VOID_PTR)
if (CMAKE_HOST_SYSTEM_VERSION MATCHES ".*-(Microsoft|microsoft-standard)") if (CMAKE_HOST_SYSTEM_VERSION MATCHES ".*-Microsoft")
# Windows Subsystem for Linux # Windows Subsystem for Linux
set(HAVE_WSL 1) set(HAVE_WSL 1)
endif() endif()
@@ -32,7 +32,6 @@ endif()
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H) check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(termios.h HAVE_TERMIOS_H) check_include_files(termios.h HAVE_TERMIOS_H)
check_include_files(sys/uio.h HAVE_SYS_UIO_H) check_include_files(sys/uio.h HAVE_SYS_UIO_H)
check_include_files(sys/sdt.h HAVE_SYS_SDT_H)
# Functions # Functions
check_function_exists(fseeko HAVE_FSEEKO) check_function_exists(fseeko HAVE_FSEEKO)
@@ -52,7 +51,6 @@ check_function_exists(setsid HAVE_SETSID)
check_function_exists(sigaction HAVE_SIGACTION) check_function_exists(sigaction HAVE_SIGACTION)
check_function_exists(strcasecmp HAVE_STRCASECMP) check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(strncasecmp HAVE_STRNCASECMP) check_function_exists(strncasecmp HAVE_STRNCASECMP)
check_function_exists(strptime HAVE_STRPTIME)
# Symbols # Symbols
check_symbol_exists(FD_CLOEXEC "fcntl.h" HAVE_FD_CLOEXEC) check_symbol_exists(FD_CLOEXEC "fcntl.h" HAVE_FD_CLOEXEC)

View File

@@ -33,15 +33,12 @@
#cmakedefine HAVE_STRCASECMP #cmakedefine HAVE_STRCASECMP
#cmakedefine HAVE_STRINGS_H #cmakedefine HAVE_STRINGS_H
#cmakedefine HAVE_STRNCASECMP #cmakedefine HAVE_STRNCASECMP
#cmakedefine HAVE_STRPTIME
#cmakedefine HAVE_SYS_SDT_H
#cmakedefine HAVE_SYS_UTSNAME_H #cmakedefine HAVE_SYS_UTSNAME_H
#cmakedefine HAVE_SYS_WAIT_H #cmakedefine HAVE_SYS_WAIT_H
#cmakedefine HAVE_TERMIOS_H #cmakedefine HAVE_TERMIOS_H
#cmakedefine HAVE_WORKING_LIBINTL #cmakedefine HAVE_WORKING_LIBINTL
#cmakedefine HAVE_WSL #cmakedefine HAVE_WSL
#cmakedefine UNIX #cmakedefine UNIX
#cmakedefine CASE_INSENSITIVE_FILENAME
#cmakedefine USE_FNAME_CASE #cmakedefine USE_FNAME_CASE
#cmakedefine HAVE_SYS_UIO_H #cmakedefine HAVE_SYS_UIO_H
#ifdef HAVE_SYS_UIO_H #ifdef HAVE_SYS_UIO_H
@@ -63,6 +60,5 @@
#cmakedefine HAVE_EXECINFO_BACKTRACE #cmakedefine HAVE_EXECINFO_BACKTRACE
#cmakedefine HAVE_BUILTIN_ADD_OVERFLOW #cmakedefine HAVE_BUILTIN_ADD_OVERFLOW
#cmakedefine HAVE_WIMPLICIT_FALLTHROUGH_FLAG
#endif // AUTO_CONFIG_H #endif // AUTO_CONFIG_H

View File

@@ -3,6 +3,5 @@
#include "${PROJECT_SOURCE_DIR}/src/nvim/vim.h" #include "${PROJECT_SOURCE_DIR}/src/nvim/vim.h"
char *default_vim_dir = "${CMAKE_INSTALL_FULL_DATAROOTDIR}/nvim"; char *default_vim_dir = "${CMAKE_INSTALL_FULL_DATAROOTDIR}/nvim";
char *default_vimruntime_dir = ""; char *default_vimruntime_dir = "";
char *default_lib_dir = "${CMAKE_INSTALL_FULL_LIBDIR}/nvim";
char_u *compiled_user = (char_u *)"${USERNAME}"; char_u *compiled_user = (char_u *)"${USERNAME}";
char_u *compiled_sys = (char_u *)"${HOSTNAME}"; char_u *compiled_sys = (char_u *)"${HOSTNAME}";

View File

@@ -5,11 +5,7 @@
#define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@ #define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@
#define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@ #define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@
#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@" #define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@"
#cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@" #cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@"
#ifndef NVIM_VERSION_MEDIUM
# include "auto/versiondef_git.h"
#endif
#define NVIM_API_LEVEL @NVIM_API_LEVEL@ #define NVIM_API_LEVEL @NVIM_API_LEVEL@
#define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ #define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@

43
contrib/flake.lock generated
View File

@@ -1,43 +0,0 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1610051610,
"narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1613226215,
"narHash": "sha256-3rA5cGIrBHD6yeKhNhsF7/t461ww25oJY8KyBb0IhjU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ff96a0fa5635770390b184ae74debea75c3fd534",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -1,112 +0,0 @@
{
description = "Neovim flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
{
overlay = final: prev:
let
pkgs = nixpkgs.legacyPackages.${prev.system};
in
rec {
neovim = pkgs.neovim-unwrapped.overrideAttrs (oa: {
version = "master";
src = ../.;
buildInputs = oa.buildInputs ++ ([
pkgs.tree-sitter
]);
cmakeFlags = oa.cmakeFlags ++ [
"-DUSE_BUNDLED=OFF"
];
});
# a development binary to help debug issues
neovim-debug = let
stdenv = pkgs.stdenvAdapters.keepDebugInfo (if pkgs.stdenv.isLinux then pkgs.llvmPackages_latest.stdenv else pkgs.stdenv);
in
pkgs.enableDebugging ((neovim.override {
lua = pkgs.enableDebugging pkgs.luajit;
inherit stdenv;
}).overrideAttrs (oa: {
cmakeBuildType = "Debug";
cmakeFlags = oa.cmakeFlags ++ [
"-DMIN_LOG_LEVEL=0"
];
disallowedReferences = [];
}));
# for neovim developers, builds a slow binary
# huge closure size but aims at covering all scripts
# brings development tools as well
neovim-developer =
let
lib = nixpkgs.lib;
pythonEnv = pkgs.python3.withPackages(ps: [
ps.msgpack
ps.flake8 # for 'make pylint'
]);
luacheck = pkgs.luaPackages.luacheck;
in
(neovim-debug.override ({ doCheck = pkgs.stdenv.isLinux; })).overrideAttrs (oa: {
cmakeFlags = oa.cmakeFlags ++ [
"-DLUACHECK_PRG=${luacheck}/bin/luacheck"
"-DMIN_LOG_LEVEL=0"
"-DENABLE_LTO=OFF"
"-DUSE_BUNDLED=OFF"
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
# https://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports
"-DCLANG_ASAN_UBSAN=ON"
];
nativeBuildInputs = oa.nativeBuildInputs ++ (with pkgs; [
pythonEnv
include-what-you-use # for scripts/check-includes.py
jq # jq for scripts/vim-patch.sh -r
shellcheck # for `make shlint`
doxygen # for script/gen_vimdoc.py
clang-tools # for clangd to find the correct headers
]);
shellHook = oa.shellHook + ''
export NVIM_PYTHON_LOG_LEVEL=DEBUG
export NVIM_LOG_FILE=/tmp/nvim.log
export ASAN_OPTIONS="log_path=./test.log:abort_on_error=1"
export UBSAN_OPTIONS=print_stacktrace=1
'';
});
};
} //
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
overlays = [ self.overlay ];
inherit system;
};
in
rec {
packages = with pkgs; {
inherit neovim neovim-debug neovim-developer;
};
defaultPackage = pkgs.neovim;
apps = {
nvim = flake-utils.lib.mkApp { drv = pkgs.neovim; name = "nvim"; };
nvim-debug = flake-utils.lib.mkApp { drv = pkgs.neovim-debug; name = "nvim"; };
};
defaultApp = apps.nvim;
devShell = pkgs.neovim-developer;
});
}

View File

@@ -25,12 +25,6 @@
# #
# CMAKE_BUILD_TYPE := Debug # CMAKE_BUILD_TYPE := Debug
# With non-Debug builds interprocedural optimization (IPO) (which includes
# link-time optimization (LTO)) is enabled by default, which causes the link
# step to take a significant amout of time, which is relevant when building
# often. You can disable it explicitly:
# CMAKE_EXTRA_FLAGS += -DENABLE_LTO=OFF
# Log levels: 0 (DEBUG), 1 (INFO), 2 (WARNING), 3 (ERROR) # Log levels: 0 (DEBUG), 1 (INFO), 2 (WARNING), 3 (ERROR)
# Default is 1 (INFO) unless CMAKE_BUILD_TYPE is Release or RelWithDebInfo. # Default is 1 (INFO) unless CMAKE_BUILD_TYPE is Release or RelWithDebInfo.
# CMAKE_EXTRA_FLAGS += -DMIN_LOG_LEVEL=1 # CMAKE_EXTRA_FLAGS += -DMIN_LOG_LEVEL=1
@@ -48,7 +42,6 @@
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LUAROCKS=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LUAROCKS=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_MSGPACK=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_MSGPACK=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UNIBILIUM=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UNIBILIUM=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UTF8PROC=OFF
# #
# Or disable all bundled dependencies at once. # Or disable all bundled dependencies at once.
# #

View File

@@ -113,6 +113,9 @@ associated with a file.
To overwrite a file, add an exclamation mark to the relevant Ex command, such as To overwrite a file, add an exclamation mark to the relevant Ex command, such as
.Ic :w! . .Ic :w! .
.Ic ":help 'readonly'" .Ic ":help 'readonly'"
.It Fl Z
Restricted mode.
Disable commands that make use of an external shell.
.It Fl m .It Fl m
Resets the 'write' option, to disable file modifications. Resets the 'write' option, to disable file modifications.
Writing to a file is disabled, but buffers can still be modified. Writing to a file is disabled, but buffers can still be modified.
@@ -327,7 +330,7 @@ Print version information and exit.
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Bl -tag -width Fl .Bl -tag -width Fl
.It Ev NVIM_LOG_FILE .It Ev NVIM_LOG_FILE
Low-level log file, usually found at ~/.cache/nvim/log. Low-level log file, usually found at ~/.local/share/nvim/log.
:help $NVIM_LOG_FILE :help $NVIM_LOG_FILE
.It Ev VIM .It Ev VIM
Used to locate user files, such as init.vim. Used to locate user files, such as init.vim.
@@ -375,7 +378,7 @@ See also
System-global System-global
.Nm .Nm
configuration file. configuration file.
.It Pa $VIM .It Pa /usr/local/share/nvim
System-global System-global
.Nm .Nm
runtime directory. runtime directory.

View File

@@ -111,7 +111,7 @@ if(NOT APPLE)
install_helper( install_helper(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/nvim.png FILES ${CMAKE_CURRENT_SOURCE_DIR}/nvim.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps)
endif() endif()
file(GLOB_RECURSE RUNTIME_PROGRAMS file(GLOB_RECURSE RUNTIME_PROGRAMS

View File

@@ -1,13 +1,13 @@
" Vim completion script " Vim completion script
" Language: C " Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Nov 14 " Last Change: 2018 Aug 20
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo&vim set cpo&vim
" This function is used for the 'omnifunc' option. " This function is used for the 'omnifunc' option.
func ccomplete#Complete(findstart, base) function! ccomplete#Complete(findstart, base)
if a:findstart if a:findstart
" Locate the start of the item, including ".", "->" and "[...]". " Locate the start of the item, including ".", "->" and "[...]".
let line = getline('.') let line = getline('.')
@@ -244,7 +244,7 @@ func ccomplete#Complete(findstart, base)
return map(res, 's:Tagline2item(v:val, brackets)') return map(res, 's:Tagline2item(v:val, brackets)')
endfunc endfunc
func s:GetAddition(line, match, memarg, bracket) function! s:GetAddition(line, match, memarg, bracket)
" Guess if the item is an array. " Guess if the item is an array.
if a:bracket && match(a:line, a:match . '\s*\[') > 0 if a:bracket && match(a:line, a:match . '\s*\[') > 0
return '[' return '['
@@ -260,13 +260,13 @@ func s:GetAddition(line, match, memarg, bracket)
endif endif
endif endif
return '' return ''
endfunc endfunction
" Turn the tag info "val" into an item for completion. " Turn the tag info "val" into an item for completion.
" "val" is is an item in the list returned by taglist(). " "val" is is an item in the list returned by taglist().
" If it is a variable we may add "." or "->". Don't do it for other types, " If it is a variable we may add "." or "->". Don't do it for other types,
" such as a typedef, by not including the info that s:GetAddition() uses. " such as a typedef, by not including the info that s:GetAddition() uses.
func s:Tag2item(val) function! s:Tag2item(val)
let res = {'match': a:val['name']} let res = {'match': a:val['name']}
let res['extra'] = s:Tagcmd2extra(a:val['cmd'], a:val['name'], a:val['filename']) let res['extra'] = s:Tagcmd2extra(a:val['cmd'], a:val['name'], a:val['filename'])
@@ -289,10 +289,10 @@ func s:Tag2item(val)
endif endif
return res return res
endfunc endfunction
" Use all the items in dictionary for the "info" entry. " Use all the items in dictionary for the "info" entry.
func s:Dict2info(dict) function! s:Dict2info(dict)
let info = '' let info = ''
for k in sort(keys(a:dict)) for k in sort(keys(a:dict))
let info .= k . repeat(' ', 10 - len(k)) let info .= k . repeat(' ', 10 - len(k))
@@ -307,7 +307,7 @@ func s:Dict2info(dict)
endfunc endfunc
" Parse a tag line and return a dictionary with items like taglist() " Parse a tag line and return a dictionary with items like taglist()
func s:ParseTagline(line) function! s:ParseTagline(line)
let l = split(a:line, "\t") let l = split(a:line, "\t")
let d = {} let d = {}
if len(l) >= 3 if len(l) >= 3
@@ -334,12 +334,12 @@ func s:ParseTagline(line)
endif endif
return d return d
endfunc endfunction
" Turn a match item "val" into an item for completion. " Turn a match item "val" into an item for completion.
" "val['match']" is the matching item. " "val['match']" is the matching item.
" "val['tagline']" is the tagline in which the last part was found. " "val['tagline']" is the tagline in which the last part was found.
func s:Tagline2item(val, brackets) function! s:Tagline2item(val, brackets)
let line = a:val['tagline'] let line = a:val['tagline']
let add = s:GetAddition(line, a:val['match'], [a:val], a:brackets == '') let add = s:GetAddition(line, a:val['match'], [a:val], a:brackets == '')
let res = {'word': a:val['match'] . a:brackets . add } let res = {'word': a:val['match'] . a:brackets . add }
@@ -377,10 +377,10 @@ func s:Tagline2item(val, brackets)
let res['menu'] = s:Tagcmd2extra(s, a:val['match'], matchstr(line, '[^\t]*\t\zs[^\t]*\ze\t')) let res['menu'] = s:Tagcmd2extra(s, a:val['match'], matchstr(line, '[^\t]*\t\zs[^\t]*\ze\t'))
endif endif
return res return res
endfunc endfunction
" Turn a command from a tag line to something that is useful in the menu " Turn a command from a tag line to something that is useful in the menu
func s:Tagcmd2extra(cmd, name, fname) function! s:Tagcmd2extra(cmd, name, fname)
if a:cmd =~ '^/^' if a:cmd =~ '^/^'
" The command is a search command, useful to see what it is. " The command is a search command, useful to see what it is.
let x = matchstr(a:cmd, '^/^\s*\zs.*\ze$/') let x = matchstr(a:cmd, '^/^\s*\zs.*\ze$/')
@@ -395,13 +395,13 @@ func s:Tagcmd2extra(cmd, name, fname)
let x = a:cmd . ' - ' . a:fname let x = a:cmd . ' - ' . a:fname
endif endif
return x return x
endfunc endfunction
" Find composing type in "lead" and match items[0] with it. " Find composing type in "lead" and match items[0] with it.
" Repeat this recursively for items[1], if it's there. " Repeat this recursively for items[1], if it's there.
" When resolving typedefs "depth" is used to avoid infinite recursion. " When resolving typedefs "depth" is used to avoid infinite recursion.
" Return the list of matches. " Return the list of matches.
func s:Nextitem(lead, items, depth, all) function! s:Nextitem(lead, items, depth, all)
" Use the text up to the variable name and split it in tokens. " Use the text up to the variable name and split it in tokens.
let tokens = split(a:lead, '\s\+\|\<') let tokens = split(a:lead, '\s\+\|\<')
@@ -485,7 +485,7 @@ func s:Nextitem(lead, items, depth, all)
endfor endfor
return res return res
endfunc endfunction
" Search for members of structure "typename" in tags files. " Search for members of structure "typename" in tags files.
@@ -493,7 +493,7 @@ endfunc
" Each match is a dictionary with "match" and "tagline" entries. " Each match is a dictionary with "match" and "tagline" entries.
" When "all" is non-zero find all, otherwise just return 1 if there is any " When "all" is non-zero find all, otherwise just return 1 if there is any
" member. " member.
func s:StructMembers(typename, items, all) function! s:StructMembers(typename, items, all)
" Todo: What about local structures? " Todo: What about local structures?
let fnames = join(map(tagfiles(), 'escape(v:val, " \\#%")')) let fnames = join(map(tagfiles(), 'escape(v:val, " \\#%")'))
if fnames == '' if fnames == ''
@@ -586,12 +586,12 @@ func s:StructMembers(typename, items, all)
" Failed to find anything. " Failed to find anything.
return [] return []
endfunc endfunction
" For matching members, find matches for following items. " For matching members, find matches for following items.
" When "all" is non-zero find all, otherwise just return 1 if there is any " When "all" is non-zero find all, otherwise just return 1 if there is any
" member. " member.
func s:SearchMembers(matches, items, all) function! s:SearchMembers(matches, items, all)
let res = [] let res = []
for i in range(len(a:matches)) for i in range(len(a:matches))
let typename = '' let typename = ''
@@ -635,5 +635,3 @@ endfunc
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save
" vim: noet sw=2 sts=2

File diff suppressed because one or more lines are too long

View File

@@ -25,7 +25,7 @@ function decada#Unit_Name () dict " {{{1
" Convert filename into acs unit: " Convert filename into acs unit:
" 1: remove the file extenstion. " 1: remove the file extenstion.
" 2: replace all double '_' or '-' with an dot (which denotes a separate) " 2: replace all double '_' or '-' with an dot (which denotes a separate)
" 3: remove a trailing '_' (which denotes a specification) " 3: remove a trailing '_' (wich denotes a specification)
return substitute (substitute (expand ("%:t:r"), '__\|-', ".", "g"), '_$', "", '') return substitute (substitute (expand ("%:t:r"), '__\|-', ".", "g"), '_$', "", '')
endfunction decada#Unit_Name " }}}1 endfunction decada#Unit_Name " }}}1

View File

@@ -1,7 +1,7 @@
" Vim functions for file type detection " Vim functions for file type detection
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Aug 17 " Last Change: 2019 Mar 08
" These functions are moved here from runtime/filetype.vim to make startup " These functions are moved here from runtime/filetype.vim to make startup
" faster. " faster.
@@ -172,17 +172,6 @@ func dist#ft#FTent()
setf dtd setf dtd
endfunc endfunc
func dist#ft#ExCheck()
let lines = getline(1, min([line("$"), 100]))
if exists('g:filetype_euphoria')
exe 'setf ' . g:filetype_euphoria
elseif match(lines, '^--\|^ifdef\>\|^include\>') > -1
setf euphoria3
else
setf elixir
endif
endfunc
func dist#ft#EuphoriaCheck() func dist#ft#EuphoriaCheck()
if exists('g:filetype_euphoria') if exists('g:filetype_euphoria')
exe 'setf ' . g:filetype_euphoria exe 'setf ' . g:filetype_euphoria
@@ -309,7 +298,7 @@ endfunc
func dist#ft#FTmms() func dist#ft#FTmms()
let n = 1 let n = 1
while n < 20 while n < 10
let line = getline(n) let line = getline(n)
if line =~ '^\s*\(%\|//\)' || line =~ '^\*' if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
setf mmix setf mmix
@@ -336,7 +325,7 @@ endfunc
func dist#ft#FTmm() func dist#ft#FTmm()
let n = 1 let n = 1
while n < 20 while n < 10
let line = getline(n) let line = getline(n)
if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)' if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)'
setf objcpp setf objcpp
@@ -373,10 +362,6 @@ func dist#ft#FTinc()
setf aspvbs setf aspvbs
elseif lines =~ "<?" elseif lines =~ "<?"
setf php setf php
" Pascal supports // comments but they're vary rarely used for file
" headers so assume POV-Ray
elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? s:ft_pascal_keywords
setf pascal
else else
call dist#ft#FTasmsyntax() call dist#ft#FTasmsyntax()
if exists("b:asmsyntax") if exists("b:asmsyntax")
@@ -423,9 +408,6 @@ func dist#ft#FTprogress_asm()
setf progress setf progress
endfunc endfunc
let s:ft_pascal_comments = '^\s*\%({\|(\*\|//\)'
let s:ft_pascal_keywords = '^\s*\%(program\|unit\|library\|uses\|begin\|procedure\|function\|const\|type\|var\)\>'
func dist#ft#FTprogress_pascal() func dist#ft#FTprogress_pascal()
if exists("g:filetype_p") if exists("g:filetype_p")
exe "setf " . g:filetype_p exe "setf " . g:filetype_p
@@ -437,7 +419,8 @@ func dist#ft#FTprogress_pascal()
let lnum = 1 let lnum = 1
while lnum <= 10 && lnum < line('$') while lnum <= 10 && lnum < line('$')
let line = getline(lnum) let line = getline(lnum)
if line =~ s:ft_pascal_comments || line =~? s:ft_pascal_keywords if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>'
\ || line =~ '^\s*{' || line =~ '^\s*(\*'
setf pascal setf pascal
return return
elseif line !~ '^\s*$' || line =~ '^/\*' elseif line !~ '^\s*$' || line =~ '^/\*'
@@ -450,19 +433,6 @@ func dist#ft#FTprogress_pascal()
setf progress setf progress
endfunc endfunc
func dist#ft#FTpp()
if exists("g:filetype_pp")
exe "setf " . g:filetype_pp
else
let line = getline(nextnonblank(1))
if line =~ s:ft_pascal_comments || line =~? s:ft_pascal_keywords
setf pascal
else
setf puppet
endif
endif
endfunc
func dist#ft#FTr() func dist#ft#FTr()
let max = line("$") > 50 ? 50 : line("$") let max = line("$") > 50 ? 50 : line("$")
@@ -605,7 +575,7 @@ endfunc
let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*' let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*'
func dist#ft#FTRules() func dist#ft#FTRules()
let path = expand('<amatch>:p') let path = expand('<amatch>:p')
if path =~ '/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|\%(usr/\)\=lib/udev/\%(rules\.d/\)\=.*\.rules\)$' if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/udev/\%(rules\.d/\)\=.*\.rules\)$'
setf udevrules setf udevrules
return return
endif endif

View File

@@ -2,7 +2,7 @@
" Language: Haskell " Language: Haskell
" Maintainer: Daniel Campoverde <alx@sillybytes.net> " Maintainer: Daniel Campoverde <alx@sillybytes.net>
" URL: https://github.com/alx741/haskellcomplete.vim " URL: https://github.com/alx741/haskellcomplete.vim
" Last Change: 2019 May 14 " Last Change: 2018 Aug 26
" Usage: setlocal omnifunc=haskellcomplete#Complete " Usage: setlocal omnifunc=haskellcomplete#Complete
@@ -63,7 +63,6 @@ function! haskellcomplete#Complete(findstart, base)
call add(l:matches, extension) call add(l:matches, extension)
endif endif
endfor endfor
let b:completingLangExtension = 0
return l:matches return l:matches
endif endif
@@ -79,7 +78,6 @@ function! haskellcomplete#Complete(findstart, base)
call add(l:matches, flag) call add(l:matches, flag)
endif endif
endfor endfor
let b:completingOptionsGHC = 0
return l:matches return l:matches
endif endif
@@ -95,7 +93,6 @@ function! haskellcomplete#Complete(findstart, base)
call add(l:matches, module) call add(l:matches, module)
endif endif
endfor endfor
let b:completingModule = 0
return l:matches return l:matches
endif endif

View File

@@ -41,27 +41,10 @@ function! s:check_config() abort
\ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ]) \ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ])
endif endif
let writeable = v:true let shadafile = (empty(&shadafile) || &shadafile ==# 'NONE') ? stdpath('data').'/shada/main.shada' : &shadafile
let shadafile = empty(&shada) ? &shada : substitute(matchstr( if !empty(shadafile) && (!filereadable(shadafile) || !filewritable(shadafile))
\ split(&shada, ',')[-1], '^n.\+'), '^n', '', '')
let shadafile = empty(&shadafile) ? empty(shadafile) ?
\ stdpath('data').'/shada/main.shada' : expand(shadafile)
\ : &shadafile ==# 'NONE' ? '' : &shadafile
if !empty(shadafile) && empty(glob(shadafile))
" Since this may be the first time neovim has been run, we will try to
" create a shada file
try
wshada
catch /.*/
let writeable = v:false
endtry
endif
if !writeable || (!empty(shadafile) &&
\ (!filereadable(shadafile) || !filewritable(shadafile)))
let ok = v:false let ok = v:false
call health#report_error('shada file is not '. call health#report_error('shada file is not '.(filereadable(shadafile) ? 'writeable' : 'readable').":\n".shadafile)
\ ((!writeable || filereadable(shadafile)) ?
\ 'writeable' : 'readable').":\n".shadafile)
endif endif
if ok if ok
@@ -146,25 +129,6 @@ function! s:check_performance() abort
endif endif
endfunction endfunction
function! s:get_tmux_option(option) abort
let cmd = 'tmux show-option -qvg '.a:option " try global scope
let out = system(cmd)
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
return 'error'
elseif empty(val)
let cmd = 'tmux show-option -qvgs '.a:option " try session scope
let out = system(cmd)
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
return 'error'
endif
endif
return val
endfunction
function! s:check_tmux() abort function! s:check_tmux() abort
if empty($TMUX) || !executable('tmux') if empty($TMUX) || !executable('tmux')
return return
@@ -172,31 +136,20 @@ function! s:check_tmux() abort
call health#report_start('tmux') call health#report_start('tmux')
" check escape-time " check escape-time
let suggestions = ["set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10", let suggestions = ["Set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10",
\ s:suggest_faq] \ s:suggest_faq]
let tmux_esc_time = s:get_tmux_option('escape-time') let cmd = 'tmux show-option -qvgs escape-time'
if tmux_esc_time !=# 'error' let out = system(cmd)
if empty(tmux_esc_time) let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g')
call health#report_error('`escape-time` is not set', suggestions) if v:shell_error
elseif tmux_esc_time > 300 call health#report_error('command failed: '.cmd."\n".out)
call health#report_error( elseif empty(tmux_esc_time)
\ '`escape-time` ('.tmux_esc_time.') is higher than 300ms', suggestions) call health#report_error('escape-time is not set', suggestions)
else elseif tmux_esc_time > 300
call health#report_ok('escape-time: '.tmux_esc_time) call health#report_error(
endif \ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions)
endif else
call health#report_ok('escape-time: '.tmux_esc_time.'ms')
" check focus-events
let suggestions = ["(tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:\nset-option -g focus-events on"]
let tmux_focus_events = s:get_tmux_option('focus-events')
call health#report_info('Checking stuff')
if tmux_focus_events !=# 'error'
if empty(tmux_focus_events) || tmux_focus_events !=# 'on'
call health#report_warn(
\ "`focus-events` is not enabled. |'autoread'| may not work.", suggestions)
else
call health#report_ok('focus-events: '.tmux_focus_events)
endif
endif endif
" check default-terminal and $TERM " check default-terminal and $TERM
@@ -247,16 +200,12 @@ function! s:check_terminal() abort
let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*') let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*')
if v:shell_error if v:shell_error
\ && (!has('win32')
\ || empty(matchstr(out,
\ 'infocmp: couldn''t open terminfo file .\+'
\ ..'\%(conemu\|vtpcon\|win32con\)')))
call health#report_error('command failed: '.cmd."\n".out) call health#report_error('command failed: '.cmd."\n".out)
else else
call health#report_info('key_backspace (kbs) terminfo entry: ' call health#report_info('key_backspace (kbs) terminfo entry: '
\ .(empty(kbs_entry) ? '? (not found)' : kbs_entry)) \ .(empty(kbs_entry) ? '? (not found)' : kbs_entry))
call health#report_info('key_dc (kdch1) terminfo entry: ' call health#report_info('key_dc (kdch1) terminfo entry: '
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry)) \ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
endif endif
for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY'] for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY']
if exists('$'.env_var) if exists('$'.env_var)

View File

@@ -38,10 +38,9 @@ endfunction
" Handler for s:system() function. " Handler for s:system() function.
function! s:system_handler(jobid, data, event) dict abort function! s:system_handler(jobid, data, event) dict abort
if a:event ==# 'stderr' if a:event ==# 'stderr'
if self.add_stderr_to_output let self.stderr .= join(a:data, '')
if !self.ignore_stderr
let self.output .= join(a:data, '') let self.output .= join(a:data, '')
else
let self.stderr .= join(a:data, '')
endif endif
elseif a:event ==# 'stdout' elseif a:event ==# 'stdout'
let self.output .= join(a:data, '') let self.output .= join(a:data, '')
@@ -65,7 +64,7 @@ function! s:system(cmd, ...) abort
let stdin = a:0 ? a:1 : '' let stdin = a:0 ? a:1 : ''
let ignore_error = a:0 > 2 ? a:3 : 0 let ignore_error = a:0 > 2 ? a:3 : 0
let opts = { let opts = {
\ 'add_stderr_to_output': a:0 > 1 ? a:2 : 0, \ 'ignore_stderr': a:0 > 1 ? a:2 : 0,
\ 'output': '', \ 'output': '',
\ 'stderr': '', \ 'stderr': '',
\ 'on_stdout': function('s:system_handler'), \ 'on_stdout': function('s:system_handler'),
@@ -90,15 +89,8 @@ function! s:system(cmd, ...) abort
call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd))) call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd)))
call jobstop(jobid) call jobstop(jobid)
elseif s:shell_error != 0 && !ignore_error elseif s:shell_error != 0 && !ignore_error
let emsg = printf("Command error (job=%d, exit code %d): `%s` (in %s)", call health#report_error(printf("Command error (job=%d, exit code %d): `%s` (in %s)\nOutput: %s\nStderr: %s",
\ jobid, s:shell_error, s:shellify(a:cmd), string(getcwd())) \ jobid, s:shell_error, s:shellify(a:cmd), string(getcwd()), opts.output, opts.stderr))
if !empty(opts.output)
let emsg .= "\noutput: " . opts.output
end
if !empty(opts.stderr)
let emsg .= "\nstderr: " . opts.stderr
end
call health#report_error(emsg)
endif endif
return opts.output return opts.output
@@ -163,7 +155,7 @@ function! s:check_clipboard() abort
endif endif
endfunction endfunction
" Get the latest Nvim Python client (pynvim) version from PyPI. " Get the latest Neovim Python client (pynvim) version from PyPI.
function! s:latest_pypi_version() abort function! s:latest_pypi_version() abort
let pypi_version = 'unable to get pypi response' let pypi_version = 'unable to get pypi response'
let pypi_response = s:download('https://pypi.python.org/pypi/pynvim/json') let pypi_response = s:download('https://pypi.python.org/pypi/pynvim/json')
@@ -180,7 +172,7 @@ endfunction
" Get version information using the specified interpreter. The interpreter is " Get version information using the specified interpreter. The interpreter is
" used directly in case breaking changes were introduced since the last time " used directly in case breaking changes were introduced since the last time
" Nvim's Python client was updated. " Neovim's Python client was updated.
" "
" Returns: [ " Returns: [
" {python executable version}, " {python executable version},
@@ -202,8 +194,7 @@ function! s:version_info(python) abort
let nvim_path = s:trim(s:system([ let nvim_path = s:trim(s:system([
\ a:python, '-c', \ a:python, '-c',
\ 'import sys; ' . \ 'import sys; sys.path.remove(""); ' .
\ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' .
\ 'import neovim; print(neovim.__file__)'])) \ 'import neovim; print(neovim.__file__)']))
if s:shell_error || empty(nvim_path) if s:shell_error || empty(nvim_path)
return [python_version, 'unable to load neovim Python module', pypi_version, return [python_version, 'unable to load neovim Python module', pypi_version,
@@ -224,7 +215,7 @@ function! s:version_info(python) abort
\ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'], \ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'],
\ '', 1, 1) \ '', 1, 1)
if empty(nvim_version) if empty(nvim_version)
let nvim_version = 'unable to find pynvim module version' let nvim_version = 'unable to find neovim Python module version'
let base = fnamemodify(nvim_path, ':h') let base = fnamemodify(nvim_path, ':h')
let metas = glob(base.'-*/METADATA', 1, 1) let metas = glob(base.'-*/METADATA', 1, 1)
\ + glob(base.'-*/PKG-INFO', 1, 1) \ + glob(base.'-*/PKG-INFO', 1, 1)
@@ -266,22 +257,6 @@ function! s:check_bin(bin) abort
return 1 return 1
endfunction endfunction
" Check "loaded" var for given a:provider.
" Returns 1 if the caller should return (skip checks).
function! s:disabled_via_loaded_var(provider) abort
let loaded_var = 'g:loaded_'.a:provider.'_provider'
if exists(loaded_var) && !exists('*provider#'.a:provider.'#Call')
let v = eval(loaded_var)
if 0 is v
call health#report_info('Disabled ('.loaded_var.'='.v.').')
return 1
else
call health#report_info('Disabled ('.loaded_var.'='.v.'). This might be due to some previous error.')
endif
endif
return 0
endfunction
function! s:check_python(version) abort function! s:check_python(version) abort
call health#report_start('Python ' . a:version . ' provider (optional)') call health#report_start('Python ' . a:version . ' provider (optional)')
@@ -289,10 +264,11 @@ function! s:check_python(version) abort
let python_exe = '' let python_exe = ''
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : '' let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
let host_prog_var = pyname.'_host_prog' let host_prog_var = pyname.'_host_prog'
let loaded_var = 'g:loaded_'.pyname.'_provider'
let python_multiple = [] let python_multiple = []
if s:disabled_via_loaded_var(pyname) if exists(loaded_var) && !exists('*provider#'.pyname.'#Call')
return call health#report_info('Disabled ('.loaded_var.'='.eval(loaded_var).'). This might be due to some previous error.')
endif endif
let [pyenv, pyenv_root] = s:check_for_pyenv() let [pyenv, pyenv_root] = s:check_for_pyenv()
@@ -310,7 +286,7 @@ function! s:check_python(version) abort
let python_exe = pyname let python_exe = pyname
endif endif
" No Python executable could `import neovim`, or host_prog_var was used. " No Python executable could `import neovim`.
if !empty(pythonx_errors) if !empty(pythonx_errors)
call health#report_error('Python provider error:', pythonx_errors) call health#report_error('Python provider error:', pythonx_errors)
@@ -363,7 +339,7 @@ function! s:check_python(version) abort
\ && !empty(pyenv_root) && resolve(python_exe) !~# '^'.pyenv_root.'/' \ && !empty(pyenv_root) && resolve(python_exe) !~# '^'.pyenv_root.'/'
call health#report_warn('pyenv is not set up optimally.', [ call health#report_warn('pyenv is not set up optimally.', [
\ printf('Create a virtualenv specifically ' \ printf('Create a virtualenv specifically '
\ . 'for Nvim using pyenv, and set `g:%s`. This will avoid ' \ . 'for Neovim using pyenv, and set `g:%s`. This will avoid '
\ . 'the need to install the pynvim module in each ' \ . 'the need to install the pynvim module in each '
\ . 'version/virtualenv.', host_prog_var) \ . 'version/virtualenv.', host_prog_var)
\ ]) \ ])
@@ -377,7 +353,7 @@ function! s:check_python(version) abort
if resolve(python_exe) !~# '^'.venv_root.'/' if resolve(python_exe) !~# '^'.venv_root.'/'
call health#report_warn('Your virtualenv is not set up optimally.', [ call health#report_warn('Your virtualenv is not set up optimally.', [
\ printf('Create a virtualenv specifically ' \ printf('Create a virtualenv specifically '
\ . 'for Nvim and use `g:%s`. This will avoid ' \ . 'for Neovim and use `g:%s`. This will avoid '
\ . 'the need to install the pynvim module in each ' \ . 'the need to install the pynvim module in each '
\ . 'virtualenv.', host_prog_var) \ . 'virtualenv.', host_prog_var)
\ ]) \ ])
@@ -392,6 +368,18 @@ function! s:check_python(version) abort
let python_exe = '' let python_exe = ''
endif endif
" Check if $VIRTUAL_ENV is valid.
if exists('$VIRTUAL_ENV') && !empty(python_exe)
if $VIRTUAL_ENV ==# matchstr(python_exe, '^\V'.$VIRTUAL_ENV)
call health#report_info('$VIRTUAL_ENV matches executable')
else
call health#report_warn(
\ '$VIRTUAL_ENV exists but appears to be inactive. '
\ . 'This could lead to unexpected results.',
\ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654' ])
endif
endif
" Diagnostic output " Diagnostic output
call health#report_info('Executable: ' . (empty(python_exe) ? 'Not found' : python_exe)) call health#report_info('Executable: ' . (empty(python_exe) ? 'Not found' : python_exe))
if len(python_multiple) if len(python_multiple)
@@ -400,6 +388,8 @@ function! s:check_python(version) abort
endfor endfor
endif endif
let pip = 'pip' . (a:version == 2 ? '' : '3')
if empty(python_exe) if empty(python_exe)
" No Python executable can import 'neovim'. Check if any Python executable " No Python executable can import 'neovim'. Check if any Python executable
" can import 'pynvim'. If so, that Python failed to import 'neovim' as " can import 'pynvim'. If so, that Python failed to import 'neovim' as
@@ -411,9 +401,9 @@ function! s:check_python(version) abort
\ 'Detected pip upgrade failure: Python executable can import "pynvim" but ' \ 'Detected pip upgrade failure: Python executable can import "pynvim" but '
\ . 'not "neovim": '. pynvim_exe, \ . 'not "neovim": '. pynvim_exe,
\ "Use that Python version to reinstall \"pynvim\" and optionally \"neovim\".\n" \ "Use that Python version to reinstall \"pynvim\" and optionally \"neovim\".\n"
\ . pynvim_exe ." -m pip uninstall pynvim neovim\n" \ . pip ." uninstall pynvim neovim\n"
\ . pynvim_exe ." -m pip install pynvim\n" \ . pip ." install pynvim\n"
\ . pynvim_exe ." -m pip install neovim # only if needed by third-party software") \ . pip ." install neovim # only if needed by third-party software")
endif endif
else else
let [pyversion, current, latest, status] = s:version_info(python_exe) let [pyversion, current, latest, status] = s:version_info(python_exe)
@@ -423,6 +413,10 @@ function! s:check_python(version) abort
\ ' This could lead to confusing error messages.') \ ' This could lead to confusing error messages.')
endif endif
if a:version == 3 && str2float(pyversion) < 3.3
call health#report_warn('Python 3.3+ is recommended.')
endif
call health#report_info('Python version: ' . pyversion) call health#report_info('Python version: ' . pyversion)
if s:is_bad_response(status) if s:is_bad_response(status)
@@ -434,7 +428,7 @@ function! s:check_python(version) abort
if s:is_bad_response(current) if s:is_bad_response(current)
call health#report_error( call health#report_error(
\ "pynvim is not installed.\nError: ".current, \ "pynvim is not installed.\nError: ".current,
\ ['Run in shell: '. python_exe .' -m pip install pynvim']) \ ['Run in shell: '. pip .' install pynvim'])
endif endif
if s:is_bad_response(latest) if s:is_bad_response(latest)
@@ -479,83 +473,12 @@ function! s:check_for_pyenv() abort
return [pyenv_path, pyenv_root] return [pyenv_path, pyenv_root]
endfunction endfunction
" Resolves Python executable path by invoking and checking `sys.executable`.
function! s:python_exepath(invocation) abort
return s:normalize_path(system(fnameescape(a:invocation)
\ . ' -c "import sys; sys.stdout.write(sys.executable)"'))
endfunction
" Checks that $VIRTUAL_ENV Python executables are found at front of $PATH in
" Nvim and subshells.
function! s:check_virtualenv() abort
call health#report_start('Python virtualenv')
if !exists('$VIRTUAL_ENV')
call health#report_ok('no $VIRTUAL_ENV')
return
endif
let errors = []
" Keep hints as dict keys in order to discard duplicates.
let hints = {}
" The virtualenv should contain some Python executables, and those
" executables should be first both on Nvim's $PATH and the $PATH of
" subshells launched from Nvim.
let bin_dir = has('win32') ? '/Scripts' : '/bin'
let venv_bins = glob($VIRTUAL_ENV . bin_dir . '/python*', v:true, v:true)
" XXX: Remove irrelevant executables found in bin/.
let venv_bins = filter(venv_bins, 'v:val !~# "python-config"')
if len(venv_bins)
for venv_bin in venv_bins
let venv_bin = s:normalize_path(venv_bin)
let py_bin_basename = fnamemodify(venv_bin, ':t')
let nvim_py_bin = s:python_exepath(exepath(py_bin_basename))
let subshell_py_bin = s:python_exepath(py_bin_basename)
if venv_bin !=# nvim_py_bin
call add(errors, '$PATH yields this '.py_bin_basename.' executable: '.nvim_py_bin)
let hint = '$PATH ambiguities arise if the virtualenv is not '
\.'properly activated prior to launching Nvim. Close Nvim, activate the virtualenv, '
\.'check that invoking Python from the command line launches the correct one, '
\.'then relaunch Nvim.'
let hints[hint] = v:true
endif
if venv_bin !=# subshell_py_bin
call add(errors, '$PATH in subshells yields this '
\.py_bin_basename . ' executable: '.subshell_py_bin)
let hint = '$PATH ambiguities in subshells typically are '
\.'caused by your shell config overriding the $PATH previously set by the '
\.'virtualenv. Either prevent them from doing so, or use this workaround: '
\.'https://vi.stackexchange.com/a/7654'
let hints[hint] = v:true
endif
endfor
else
call add(errors, 'no Python executables found in the virtualenv '.bin_dir.' directory.')
endif
let msg = '$VIRTUAL_ENV is set to: '.$VIRTUAL_ENV
if len(errors)
if len(venv_bins)
let msg .= "\nAnd its ".bin_dir.' directory contains: '
\.join(map(venv_bins, "fnamemodify(v:val, ':t')"), ', ')
endif
let conj = "\nBut "
for error in errors
let msg .= conj.error
let conj = "\nAnd "
endfor
let msg .= "\nSo invoking Python may lead to unexpected results."
call health#report_warn(msg, keys(hints))
else
call health#report_info(msg)
call health#report_info('Python version: '
\.system('python -c "import platform, sys; sys.stdout.write(platform.python_version())"'))
call health#report_ok('$VIRTUAL_ENV provides :!python.')
endif
endfunction
function! s:check_ruby() abort function! s:check_ruby() abort
call health#report_start('Ruby provider (optional)') call health#report_start('Ruby provider (optional)')
if s:disabled_via_loaded_var('ruby') let loaded_var = 'g:loaded_ruby_provider'
if exists(loaded_var) && !exists('*provider#ruby#Call')
call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
return return
endif endif
@@ -567,7 +490,7 @@ function! s:check_ruby() abort
endif endif
call health#report_info('Ruby: '. s:system('ruby -v')) call health#report_info('Ruby: '. s:system('ruby -v'))
let [host, err] = provider#ruby#Detect() let host = provider#ruby#Detect()
if empty(host) if empty(host)
call health#report_warn('`neovim-ruby-host` not found.', call health#report_warn('`neovim-ruby-host` not found.',
\ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.', \ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.',
@@ -578,7 +501,7 @@ function! s:check_ruby() abort
endif endif
call health#report_info('Host: '. host) call health#report_info('Host: '. host)
let latest_gem_cmd = has('win32') ? 'cmd /c gem list -ra "^^neovim$"' : 'gem list -ra ^neovim$' let latest_gem_cmd = has('win32') ? 'cmd /c gem list -ra ^^neovim$' : 'gem list -ra ^neovim$'
let latest_gem = s:system(split(latest_gem_cmd)) let latest_gem = s:system(split(latest_gem_cmd))
if s:shell_error || empty(latest_gem) if s:shell_error || empty(latest_gem)
call health#report_error('Failed to run: '. latest_gem_cmd, call health#report_error('Failed to run: '. latest_gem_cmd,
@@ -586,7 +509,7 @@ function! s:check_ruby() abort
\ 'Are you behind a firewall or proxy?']) \ 'Are you behind a firewall or proxy?'])
return return
endif endif
let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 0, 'not found') let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 1, 'not found')
let current_gem_cmd = host .' --version' let current_gem_cmd = host .' --version'
let current_gem = s:system(current_gem_cmd) let current_gem = s:system(current_gem_cmd)
@@ -609,7 +532,9 @@ endfunction
function! s:check_node() abort function! s:check_node() abort
call health#report_start('Node.js provider (optional)') call health#report_start('Node.js provider (optional)')
if s:disabled_via_loaded_var('node') let loaded_var = 'g:loaded_node_provider'
if exists(loaded_var) && !exists('*provider#node#Call')
call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
return return
endif endif
@@ -621,8 +546,8 @@ function! s:check_node() abort
endif endif
let node_v = get(split(s:system('node -v'), "\n"), 0, '') let node_v = get(split(s:system('node -v'), "\n"), 0, '')
call health#report_info('Node.js: '. node_v) call health#report_info('Node.js: '. node_v)
if s:shell_error || s:version_cmp(node_v[1:], '6.0.0') < 0 if !s:shell_error && s:version_cmp(node_v[1:], '6.0.0') < 0
call health#report_warn('Nvim node.js host does not support '.node_v) call health#report_warn('Neovim node.js host does not support '.node_v)
" Skip further checks, they are nonsense if nodejs is too old. " Skip further checks, they are nonsense if nodejs is too old.
return return
endif endif
@@ -630,14 +555,14 @@ function! s:check_node() abort
call health#report_warn('node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.') call health#report_warn('node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.')
endif endif
let [host, err] = provider#node#Detect() let host = provider#node#Detect()
if empty(host) if empty(host)
call health#report_warn('Missing "neovim" npm (or yarn) package.', call health#report_warn('Missing "neovim" npm (or yarn) package.',
\ ['Run in shell: npm install -g neovim', \ ['Run in shell: npm install -g neovim',
\ 'Run in shell (if you use yarn): yarn global add neovim']) \ 'Run in shell (if you use yarn): yarn global add neovim'])
return return
endif endif
call health#report_info('Nvim node.js host: '. host) call health#report_info('Neovim node.js host: '. host)
let manager = executable('npm') ? 'npm' : 'yarn' let manager = executable('npm') ? 'npm' : 'yarn'
let latest_npm_cmd = has('win32') ? let latest_npm_cmd = has('win32') ?
@@ -650,12 +575,14 @@ function! s:check_node() abort
\ 'Are you behind a firewall or proxy?']) \ 'Are you behind a firewall or proxy?'])
return return
endif endif
try if !empty(latest_npm)
let pkg_data = json_decode(latest_npm) try
catch /E474/ let pkg_data = json_decode(latest_npm)
return 'error: '.latest_npm catch /E474/
endtry return 'error: '.latest_npm
let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse') endtry
let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse')
endif
let current_npm_cmd = ['node', host, '--version'] let current_npm_cmd = ['node', host, '--version']
let current_npm = s:system(current_npm_cmd) let current_npm = s:system(current_npm_cmd)
@@ -676,85 +603,10 @@ function! s:check_node() abort
endif endif
endfunction endfunction
function! s:check_perl() abort
call health#report_start('Perl provider (optional)')
if s:disabled_via_loaded_var('perl')
return
endif
let [perl_exec, perl_errors] = provider#perl#Detect()
if empty(perl_exec)
if !empty(perl_errors)
call health#report_error('perl provider error:', perl_errors)
else
call health#report_warn('No usable perl executable found')
endif
return
endif
call health#report_info('perl executable: '. perl_exec)
" we cannot use cpanm that is on the path, as it may not be for the perl
" set with g:perl_host_prog
call s:system([perl_exec, '-W', '-MApp::cpanminus', '-e', ''])
if s:shell_error
return [perl_exec, '"App::cpanminus" module is not installed']
endif
let latest_cpan_cmd = [perl_exec,
\ '-MApp::cpanminus::fatscript', '-e',
\ 'my $app = App::cpanminus::script->new;
\ $app->parse_options ("--info", "-q", "Neovim::Ext");
\ exit $app->doit']
let latest_cpan = s:system(latest_cpan_cmd)
if s:shell_error || empty(latest_cpan)
call health#report_error('Failed to run: '. latest_cpan_cmd,
\ ["Make sure you're connected to the internet.",
\ 'Are you behind a firewall or proxy?'])
return
elseif latest_cpan[0] ==# '!'
let cpanm_errs = split(latest_cpan, '!')
if cpanm_errs[0] =~# "Can't write to "
call health#report_warn(cpanm_errs[0], cpanm_errs[1:-2])
" Last line is the package info
let latest_cpan = cpanm_errs[-1]
else
call health#report_error('Unknown warning from command: ' . latest_cpan_cmd, cpanm_errs)
return
endif
endif
let latest_cpan = matchstr(latest_cpan, '\(\.\?\d\)\+')
if empty(latest_cpan)
call health#report_error('Cannot parse version number from cpanm output: ' . latest_cpan)
return
endif
let current_cpan_cmd = [perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION']
let current_cpan = s:system(current_cpan_cmd)
if s:shell_error
call health#report_error('Failed to run: '. string(current_cpan_cmd),
\ ['Report this issue with the output of: ', string(current_cpan_cmd)])
return
endif
if s:version_cmp(current_cpan, latest_cpan) == -1
call health#report_warn(
\ printf('Module "Neovim::Ext" is out-of-date. Installed: %s, latest: %s',
\ current_cpan, latest_cpan),
\ ['Run in shell: cpanm -n Neovim::Ext'])
else
call health#report_ok('Latest "Neovim::Ext" cpan module is installed: '. current_cpan)
endif
endfunction
function! health#provider#check() abort function! health#provider#check() abort
call s:check_clipboard() call s:check_clipboard()
call s:check_python(2) call s:check_python(2)
call s:check_python(3) call s:check_python(3)
call s:check_virtualenv()
call s:check_ruby() call s:check_ruby()
call s:check_node() call s:check_node()
call s:check_perl()
endfunction endfunction

View File

@@ -1,5 +0,0 @@
function! health#treesitter#check() abort
call health#report_start('Checking treesitter configuration')
lua require 'vim.treesitter.health'.check_health()
endfunction

View File

@@ -1,7 +1,7 @@
" Vim completion script " Vim completion script
" Language: HTML and XHTML " Language: HTML and XHTML
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" Last Change: 2019 Sep 27 " Last Change: 2014 Jun 20
" Distinguish between HTML versions. " Distinguish between HTML versions.
" To use with other HTML versions add another "elseif" condition to match " To use with other HTML versions add another "elseif" condition to match
@@ -245,8 +245,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
" If context contains white space it is attribute. " If context contains white space it is attribute.
" It can be also value of attribute. " It can be also value of attribute.
" We have to get first word to offer proper completions " We have to get first word to offer proper completions
if context =~ '^\s*$' if context == ''
" empty or whitespace line
let tag = '' let tag = ''
else else
let tag = split(context)[0] let tag = split(context)[0]

View File

@@ -1,9 +1,7 @@
" Vim completion script " Vim completion script
" Language: Java Script " Language: Java Script
" Maintainer: Jay Sitter (jay@jaysitter.com) " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" URL: https://github.com/jsit/javascriptcomplete.vim/ " Last Change: 2017 Mar 04
" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" Last Change: 2020 Jul 30
function! javascriptcomplete#CompleteJS(findstart, base) function! javascriptcomplete#CompleteJS(findstart, base)
if a:findstart if a:findstart
@@ -156,30 +154,12 @@ function! javascriptcomplete#CompleteJS(findstart, base)
\ 'text', 'vLink'] \ 'text', 'vLink']
let bodys = bodyprop let bodys = bodyprop
" Document - document. " Document - document.
let docuprop = ['anchors', 'body', 'characterSet', 'doctype', let docuprop = ['anchors', 'applets', 'childNodes', 'embeds', 'forms', 'images', 'links', 'stylesheets',
\ 'documentElement', 'documentURI', 'embeds', 'fonts', 'forms', \ 'body', 'cookie', 'documentElement', 'domain', 'lastModified', 'referrer', 'title', 'URL']
\ 'head', 'hidden', 'images', 'implementation', 'lastStyleSheetSet', let documeth = ['close', 'createAttribute', 'createElement', 'createTextNode', 'focus', 'getElementById',
\ 'links', 'plugins', 'preferredStyleSheetSet', 'scripts', \ 'getElementsByName', 'getElementsByTagName', 'open', 'write', 'writeln',
\ 'scrollingElement', 'selectedStyleSheetSet', 'styleSheetSets', \ 'onClick', 'onDblClick', 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp',
\ 'timeline', 'visibilityState', 'cookie', 'defaultView', \ 'onMouseDown', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onResize']
\ 'designMode', 'dir', 'domain', 'lastModified', 'location',
\ 'readyState', 'referrer', 'title', 'URL', 'activeElement',
\ 'fullscreenElement', 'styleSheets']
let documeth = ['adoptNode', 'close', 'createAttribute',
\ 'createAttributeNS', 'createCDATASection', 'createComment',
\ 'createDocumentFragment', 'createElement', 'createElementNS',
\ 'createEvent', 'createExpression', 'createNSResolver',
\ 'createNodeIterator', 'createProcessingInstruction', 'createRange',
\ 'createTextNode', 'createTouchList', 'createTreeWalker',
\ 'enableStyleSheetsForSet', 'evaluate', 'focus', 'getElementById',
\ 'getElementById', 'getElementsByClassName', 'getElementsByName',
\ 'getElementsByTagName', 'getElementsByTagNameNS',
\ 'hasStorageAccess', 'importNode', 'onClick', 'onDblClick',
\ 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onMouseDown',
\ 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp',
\ 'onResize', 'open', 'querySelector', 'querySelectorAll',
\ 'requestStorageAccess', 'write', 'writeln']
call map(documeth, 'v:val."("') call map(documeth, 'v:val."("')
let docuxprop = ['attributes', 'childNodes', 'doctype', 'documentElement', 'firstChild', let docuxprop = ['attributes', 'childNodes', 'doctype', 'documentElement', 'firstChild',
\ 'implementation', 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', \ 'implementation', 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType',
@@ -388,11 +368,9 @@ function! javascriptcomplete#CompleteJS(findstart, base)
let xdomelemprop = ['attributes', 'childNodes', 'firstChild', 'lastChild', let xdomelemprop = ['attributes', 'childNodes', 'firstChild', 'lastChild',
\ 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue', \ 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue',
\ 'ownerDocument', 'parentNode', 'prefix', 'previousSibling', 'tagName'] \ 'ownerDocument', 'parentNode', 'prefix', 'previousSibling', 'tagName']
let xdomelemmeth = ['appendChild', 'addEventListener', 'cloneNode', let xdomelemmeth = ['appendChild', 'cloneNode', 'getAttribute', 'getAttributeNode',
\ 'dispatchEvent', 'getAttribute', 'getAttributeNode', \ 'getElementsByTagName', 'hasChildNodes', 'insertBefore', 'normalize',
\ 'getElementsByTagName', 'hasChildNodes', 'insertBefore', \ 'removeAttribute', 'removeAttributeNode', 'removeChild', 'replaceChild',
\ 'normalize', 'removeAttribute', 'removeAttributeNode',
\ 'removeChild', 'removeEventListener', 'replaceChild',
\ 'setAttribute', 'setAttributeNode'] \ 'setAttribute', 'setAttributeNode']
call map(xdomelemmeth, 'v:val."("') call map(xdomelemmeth, 'v:val."("')
let xdomelems = xdomelemprop + xdomelemmeth let xdomelems = xdomelemprop + xdomelemmeth

View File

@@ -1,4 +1,4 @@
" Maintainer: Anmol Sethi <hi@nhooyr.io> " Maintainer: Anmol Sethi <anmol@aubble.com>
if exists('s:loaded_man') if exists('s:loaded_man')
finish finish
@@ -7,18 +7,32 @@ let s:loaded_man = 1
let s:find_arg = '-w' let s:find_arg = '-w'
let s:localfile_arg = v:true " Always use -l if possible. #6683 let s:localfile_arg = v:true " Always use -l if possible. #6683
let s:section_arg = '-S' let s:section_arg = '-s'
function! man#init() abort function! s:init_section_flag()
call system(['env', 'MANPAGER=cat', 'man', s:section_arg, '1', 'man'])
if v:shell_error
let s:section_arg = '-S'
endif
endfunction
function! s:init() abort
call s:init_section_flag()
" TODO(nhooyr): Does `man -l` on SunOS list searched directories?
try try
if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
let s:find_arg = '-l'
endif
" Check for -l support. " Check for -l support.
call s:get_page(s:get_path('', 'man')) call s:get_page(s:get_path('', 'man'))
catch /E145:/
" Ignore the error in restricted mode
catch /command error .*/ catch /command error .*/
let s:localfile_arg = v:false let s:localfile_arg = v:false
endtry endtry
endfunction endfunction
function! man#open_page(count, mods, ...) abort function! man#open_page(count, count1, mods, ...) abort
if a:0 > 2 if a:0 > 2
call s:error('too many arguments') call s:error('too many arguments')
return return
@@ -38,38 +52,51 @@ function! man#open_page(count, mods, ...) abort
let ref = a:2.'('.a:1.')' let ref = a:2.'('.a:1.')'
endif endif
try try
let [sect, name] = s:extract_sect_and_name_ref(ref) let [sect, name] = man#extract_sect_and_name_ref(ref)
if a:count >= 0 if a:count ==# a:count1
" v:count defaults to 0 which is a valid section, and v:count1 defaults to
" 1, also a valid section. If they are equal, count explicitly set.
let sect = string(a:count) let sect = string(a:count)
endif endif
let path = s:verify_exists(sect, name) let [sect, name, path] = s:verify_exists(sect, name)
let [sect, name] = s:extract_sect_and_name_path(path)
catch catch
call s:error(v:exception) call s:error(v:exception)
return return
endtry endtry
let [l:buf, l:save_tfu] = [bufnr(), &tagfunc] call s:push_tag()
let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')')
try try
setlocal tagfunc=man#goto_tag set eventignore+=BufReadCmd
let l:target = l:name . '(' . l:sect . ')'
if a:mods !~# 'tab' && s:find_man() if a:mods !~# 'tab' && s:find_man()
execute 'silent keepalt tag' l:target execute 'silent keepalt edit' fnameescape(bufname)
else else
execute 'silent keepalt' a:mods 'stag' l:target execute 'silent keepalt' a:mods 'split' fnameescape(bufname)
endif endif
finally finally
call setbufvar(l:buf, '&tagfunc', l:save_tfu) set eventignore-=BufReadCmd
endtry
try
let page = s:get_page(path)
catch
if a:mods =~# 'tab' || !s:find_man()
" a new window was opened
close
endif
call s:error(v:exception)
return
endtry endtry
let b:man_sect = sect let b:man_sect = sect
call s:put_page(page)
endfunction endfunction
function! man#read_page(ref) abort function! man#read_page(ref) abort
try try
let [sect, name] = s:extract_sect_and_name_ref(a:ref) let [sect, name] = man#extract_sect_and_name_ref(a:ref)
let path = s:verify_exists(sect, name) let [sect, name, path] = s:verify_exists(sect, name)
let [sect, name] = s:extract_sect_and_name_path(path)
let page = s:get_page(path) let page = s:get_page(path)
catch catch
call s:error(v:exception) call s:error(v:exception)
@@ -125,7 +152,7 @@ function! s:get_page(path) abort
" Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065). " Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065).
" Soft-wrap: ftplugin/man.vim sets wrap/breakindent/…. " Soft-wrap: ftplugin/man.vim sets wrap/breakindent/….
" Hard-wrap: driven by `man`. " Hard-wrap: driven by `man`.
let manwidth = !get(g:, 'man_hardwrap', 1) ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH) let manwidth = !get(g:,'man_hardwrap') ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH)
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db). " Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
" http://comments.gmane.org/gmane.editors.vim.devel/29085 " http://comments.gmane.org/gmane.editors.vim.devel/29085
" Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces. " Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.
@@ -136,7 +163,6 @@ endfunction
function! s:put_page(page) abort function! s:put_page(page) abort
setlocal modifiable setlocal modifiable
setlocal noreadonly setlocal noreadonly
setlocal noswapfile
silent keepjumps %delete _ silent keepjumps %delete _
silent put =a:page silent put =a:page
while getline(1) =~# '^\s*$' while getline(1) =~# '^\s*$'
@@ -178,7 +204,7 @@ endfunction
" attempt to extract the name and sect out of 'name(sect)' " attempt to extract the name and sect out of 'name(sect)'
" otherwise just return the largest string of valid characters in ref " otherwise just return the largest string of valid characters in ref
function! s:extract_sect_and_name_ref(ref) abort function! man#extract_sect_and_name_ref(ref) abort
if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled. if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled.
throw 'manpage name cannot start with ''-''' throw 'manpage name cannot start with ''-'''
endif endif
@@ -188,7 +214,7 @@ function! s:extract_sect_and_name_ref(ref) abort
if empty(name) if empty(name)
throw 'manpage reference cannot contain only parentheses' throw 'manpage reference cannot contain only parentheses'
endif endif
return ['', name] return [get(b:, 'man_default_sects', ''), name]
endif endif
let left = split(ref, '(') let left = split(ref, '(')
" see ':Man 3X curses' on why tolower. " see ':Man 3X curses' on why tolower.
@@ -211,62 +237,42 @@ function! s:get_path(sect, name) abort
return substitute(get(split(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])), 0, ''), '\n\+$', '', '') return substitute(get(split(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])), 0, ''), '\n\+$', '', '')
endfunction endfunction
" s:verify_exists attempts to find the path to a manpage
" based on the passed section and name.
"
" 1. If the passed section is empty, b:man_default_sects is used.
" 2. If manpage could not be found with the given sect and name,
" then another attempt is made with b:man_default_sects.
" 3. If it still could not be found, then we try again without a section.
" 4. If still not found but $MANSECT is set, then we try again with $MANSECT
" unset.
"
" This function is careful to avoid duplicating a search if a previous
" step has already done it. i.e if we use b:man_default_sects in step 1,
" then we don't do it again in step 2.
function! s:verify_exists(sect, name) abort function! s:verify_exists(sect, name) abort
let sect = a:sect
if empty(sect)
let sect = get(b:, 'man_default_sects', '')
endif
try try
return s:get_path(sect, a:name) let path = s:get_path(a:sect, a:name)
catch /^command error (/ catch /^command error (/
try
let path = s:get_path(get(b:, 'man_default_sects', ''), a:name)
catch /^command error (/
let path = s:get_path('', a:name)
endtry
endtry endtry
" Extract the section from the path, because sometimes the actual section is
if !empty(get(b:, 'man_default_sects', '')) && sect !=# b:man_default_sects " more specific than what we provided to `man` (try `:Man 3 App::CLI`).
try " Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we
return s:get_path(b:man_default_sects, a:name) " still want the name of the buffer to be 'printf'.
catch /^command error (/ return s:extract_sect_and_name_path(path) + [path]
endtry
endif
if !empty(sect)
try
return s:get_path('', a:name)
catch /^command error (/
endtry
endif
if !empty($MANSECT)
try
let MANSECT = $MANSECT
call setenv('MANSECT', v:null)
return s:get_path('', a:name)
catch /^command error (/
finally
call setenv('MANSECT', MANSECT)
endtry
endif
throw 'no manual entry for ' . a:name
endfunction endfunction
" Extracts the name/section from the 'path/name.sect', because sometimes the actual section is let s:tag_stack = []
" more specific than what we provided to `man` (try `:Man 3 App::CLI`).
" Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we function! s:push_tag() abort
" still want the name of the buffer to be 'printf'. let s:tag_stack += [{
\ 'buf': bufnr('%'),
\ 'lnum': line('.'),
\ 'col': col('.'),
\ }]
endfunction
function! man#pop_tag() abort
if !empty(s:tag_stack)
let tag = remove(s:tag_stack, -1)
execute 'silent' tag['buf'].'buffer'
call cursor(tag['lnum'], tag['col'])
endif
endfunction
" extracts the name and sect out of 'path/name.sect'
function! s:extract_sect_and_name_path(path) abort function! s:extract_sect_and_name_path(path) abort
let tail = fnamemodify(a:path, ':t') let tail = fnamemodify(a:path, ':t')
if a:path =~# '\.\%([glx]z\|bz2\|lzma\|Z\)$' " valid extensions if a:path =~# '\.\%([glx]z\|bz2\|lzma\|Z\)$' " valid extensions
@@ -278,16 +284,20 @@ function! s:extract_sect_and_name_path(path) abort
endfunction endfunction
function! s:find_man() abort function! s:find_man() abort
let l:win = 1 if &filetype ==# 'man'
while l:win <= winnr('$') return 1
let l:buf = winbufnr(l:win) elseif winnr('$') ==# 1
if getbufvar(l:buf, '&filetype', '') ==# 'man' return 0
execute l:win.'wincmd w' endif
let thiswin = winnr()
while 1
wincmd w
if &filetype ==# 'man'
return 1 return 1
elseif thiswin ==# winnr()
return 0
endif endif
let l:win += 1
endwhile endwhile
return 0
endfunction endfunction
function! s:error(msg) abort function! s:error(msg) abort
@@ -297,7 +307,7 @@ function! s:error(msg) abort
echohl None echohl None
endfunction endfunction
" see s:extract_sect_and_name_ref on why tolower(sect) " see man#extract_sect_and_name_ref on why tolower(sect)
function! man#complete(arg_lead, cmd_line, cursor_pos) abort function! man#complete(arg_lead, cmd_line, cursor_pos) abort
let args = split(a:cmd_line) let args = split(a:cmd_line)
let cmd_offset = index(args, 'Man') let cmd_offset = index(args, 'Man')
@@ -350,35 +360,14 @@ function! man#complete(arg_lead, cmd_line, cursor_pos) abort
return s:complete(sect, sect, name) return s:complete(sect, sect, name)
endfunction endfunction
function! s:get_paths(sect, name, do_fallback) abort function! s:complete(sect, psect, name) abort
" callers must try-catch this, as some `man` implementations don't support `s:find_arg`
try try
let mandirs = join(split(s:system(['man', s:find_arg]), ':\|\n'), ',') let mandirs = join(split(s:system(['man', s:find_arg]), ':\|\n'), ',')
let paths = globpath(mandirs, 'man?/'.a:name.'*.'.a:sect.'*', 0, 1)
try
" Prioritize the result from verify_exists as it obeys b:man_default_sects.
let first = s:verify_exists(a:sect, a:name)
let paths = filter(paths, 'v:val !=# first')
let paths = [first] + paths
catch
endtry
return paths
catch catch
if !a:do_fallback call s:error(v:exception)
throw v:exception return
endif
" Fallback to a single path, with the page we're trying to find.
try
return [s:verify_exists(a:sect, a:name)]
catch
return []
endtry
endtry endtry
endfunction let pages = globpath(mandirs,'man?/'.a:name.'*.'.a:sect.'*', 0, 1)
function! s:complete(sect, psect, name) abort
let pages = s:get_paths(a:sect, a:name, v:false)
" We remove duplicates in case the same manpage in different languages was found. " We remove duplicates in case the same manpage in different languages was found.
return uniq(sort(map(pages, 's:format_candidate(v:val, a:psect)'), 'i')) return uniq(sort(map(pages, 's:format_candidate(v:val, a:psect)'), 'i'))
endfunction endfunction
@@ -398,10 +387,6 @@ function! s:format_candidate(path, psect) abort
endfunction endfunction
function! man#init_pager() abort function! man#init_pager() abort
" https://github.com/neovim/neovim/issues/6828
let og_modifiable = &modifiable
setlocal modifiable
if getline(1) =~# '^\s*$' if getline(1) =~# '^\s*$'
silent keepjumps 1delete _ silent keepjumps 1delete _
else else
@@ -412,43 +397,13 @@ function! man#init_pager() abort
" know the correct casing, cf. `man glDrawArraysInstanced`). " know the correct casing, cf. `man glDrawArraysInstanced`).
let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g') let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g')
try try
let b:man_sect = s:extract_sect_and_name_ref(ref)[0] let b:man_sect = man#extract_sect_and_name_ref(ref)[0]
catch catch
let b:man_sect = '' let b:man_sect = ''
endtry endtry
if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95. if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95.
execute 'silent file man://'.tolower(fnameescape(ref)) execute 'silent file man://'.tolower(fnameescape(ref))
endif endif
let &l:modifiable = og_modifiable
endfunction endfunction
function! man#goto_tag(pattern, flags, info) abort call s:init()
let [l:sect, l:name] = s:extract_sect_and_name_ref(a:pattern)
let l:paths = s:get_paths(l:sect, l:name, v:true)
let l:structured = []
for l:path in l:paths
let [l:sect, l:name] = s:extract_sect_and_name_path(l:path)
let l:structured += [{
\ 'name': l:name,
\ 'title': l:name . '(' . l:sect . ')'
\ }]
endfor
if &cscopetag
" return only a single entry so we work well with :cstag (#11675)
let l:structured = l:structured[:0]
endif
return map(l:structured, {
\ _, entry -> {
\ 'name': entry.name,
\ 'filename': 'man://' . entry.title,
\ 'cmd': '1'
\ }
\ })
endfunction
call man#init()

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
" netrwFileHandlers: contains various extension-based file handlers for " netrwFileHandlers: contains various extension-based file handlers for
" netrw's browsers' x command ("eXecute launcher") " netrw's browsers' x command ("eXecute launcher")
" Author: Charles E. Campbell " Author: Charles E. Campbell
" Date: Sep 18, 2020 " Date: May 03, 2013
" Version: 11 " Version: 11b ASTRO-ONLY
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 " Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
@@ -20,7 +20,7 @@
if exists("g:loaded_netrwFileHandlers") || &cp if exists("g:loaded_netrwFileHandlers") || &cp
finish finish
endif endif
let g:loaded_netrwFileHandlers= "v11" let g:loaded_netrwFileHandlers= "v11b"
if v:version < 702 if v:version < 702
echohl WarningMsg echohl WarningMsg
echo "***warning*** this version of netrwFileHandlers needs vim 7.2" echo "***warning*** this version of netrwFileHandlers needs vim 7.2"

View File

@@ -1,6 +1,6 @@
" netrwSettings.vim: makes netrw settings simpler " netrwSettings.vim: makes netrw settings simpler
" Date: Nov 09, 2016 " Date: Nov 09, 2016
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> " Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
" Version: 16 " Version: 16
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,

View File

@@ -18,5 +18,61 @@
" holder be liable for any damages resulting from the use " holder be liable for any damages resulting from the use
" of this software. " of this software.
function! netrw_gitignore#Hide(...) function! netrw_gitignore#Hide(...)
return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '') let additional_files = a:000
let default_files = ['.gitignore', '.git/info/exclude']
" get existing global/system gitignore files
let global_gitignore = expand(substitute(system("git config --global core.excludesfile"), '\n', '', 'g'))
if global_gitignore !=# ''
let default_files = add(default_files, global_gitignore)
endif
let system_gitignore = expand(substitute(system("git config --system core.excludesfile"), '\n', '', 'g'))
if system_gitignore !=# ''
let default_files = add(default_files, system_gitignore)
endif
" append additional files if given as function arguments
if additional_files !=# []
let files = extend(default_files, additional_files)
else
let files = default_files
endif
" keep only existing/readable files
let gitignore_files = []
for file in files
if filereadable(file)
let gitignore_files = add(gitignore_files, file)
endif
endfor
" get contents of gitignore patterns from those files
let gitignore_lines = []
for file in gitignore_files
for line in readfile(file)
" filter empty lines and comments
if line !~# '^#' && line !~# '^$'
let gitignore_lines = add(gitignore_lines, line)
endif
endfor
endfor
" convert gitignore patterns to Netrw/Vim regex patterns
let escaped_lines = []
for line in gitignore_lines
let escaped = line
let escaped = substitute(escaped, '\*\*', '*', 'g')
let escaped = substitute(escaped, '\.', '\\.', 'g')
let escaped = substitute(escaped, '\$', '\\$', 'g')
let escaped = substitute(escaped, '*', '.*', 'g')
" correction: dot, dollar and asterisks chars shouldn't be escaped when
" within regex matching groups.
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\.', '\.', 'g')
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\$', '\$', 'g')
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\.\*', '*', 'g')
let escaped_lines = add(escaped_lines, escaped)
endfor
return join(escaped_lines, ',')
endfunction endfunction

View File

@@ -3,11 +3,8 @@
" Start the provider and perform a 'poll' request " Start the provider and perform a 'poll' request
" "
" Returns a valid channel on success " Returns a valid channel on success
function! provider#Poll(argv, orig_name, log_env, ...) abort function! provider#Poll(argv, orig_name, log_env) abort
let job = {'rpc': v:true, 'stderr_buffered': v:true} let job = {'rpc': v:true, 'stderr_buffered': v:true}
if a:0
let job = extend(job, a:1)
endif
try try
let channel_id = jobstart(a:argv, job) let channel_id = jobstart(a:argv, job)
if channel_id > 0 && rpcrequest(channel_id, 'poll') ==# 'ok' if channel_id > 0 && rpcrequest(channel_id, 'poll') ==# 'ok'

View File

@@ -35,7 +35,8 @@ endfunction
let s:selections = { '*': s:selection, '+': copy(s:selection) } let s:selections = { '*': s:selection, '+': copy(s:selection) }
function! s:try_cmd(cmd, ...) abort function! s:try_cmd(cmd, ...) abort
let out = systemlist(a:cmd, (a:0 ? a:1 : ['']), 1) let argv = split(a:cmd, " ")
let out = systemlist(argv, (a:0 ? a:1 : ['']), 1)
if v:shell_error if v:shell_error
if !exists('s:did_error_try_cmd') if !exists('s:did_error_try_cmd')
echohl WarningMsg echohl WarningMsg
@@ -54,10 +55,6 @@ function! s:cmd_ok(cmd) abort
return v:shell_error == 0 return v:shell_error == 0
endfunction endfunction
function! s:split_cmd(cmd) abort
return (type(a:cmd) == v:t_string) ? split(a:cmd, " ") : a:cmd
endfunction
let s:cache_enabled = 1 let s:cache_enabled = 1
let s:err = '' let s:err = ''
@@ -74,73 +71,56 @@ function! provider#clipboard#Executable() abort
return '' return ''
endif endif
let s:copy = {} let s:copy = get(g:clipboard, 'copy', { '+': v:null, '*': v:null })
let s:copy['+'] = s:split_cmd(get(g:clipboard.copy, '+', v:null)) let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null })
let s:copy['*'] = s:split_cmd(get(g:clipboard.copy, '*', v:null))
let s:paste = {}
let s:paste['+'] = s:split_cmd(get(g:clipboard.paste, '+', v:null))
let s:paste['*'] = s:split_cmd(get(g:clipboard.paste, '*', v:null))
let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0) let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0)
return get(g:clipboard, 'name', 'g:clipboard') return get(g:clipboard, 'name', 'g:clipboard')
elseif has('mac') elseif has('mac')
let s:copy['+'] = ['pbcopy'] let s:copy['+'] = 'pbcopy'
let s:paste['+'] = ['pbpaste'] let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+'] let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+'] let s:paste['*'] = s:paste['+']
let s:cache_enabled = 0 let s:cache_enabled = 0
return 'pbcopy' return 'pbcopy'
elseif !empty($WAYLAND_DISPLAY) && executable('wl-copy') && executable('wl-paste') elseif exists('$WAYLAND_DISPLAY') && executable('wl-copy') && executable('wl-paste')
let s:copy['+'] = ['wl-copy', '--foreground', '--type', 'text/plain'] let s:copy['+'] = 'wl-copy --foreground --type text/plain'
let s:paste['+'] = ['wl-paste', '--no-newline'] let s:paste['+'] = 'wl-paste --no-newline'
let s:copy['*'] = ['wl-copy', '--foreground', '--primary', '--type', 'text/plain'] let s:copy['*'] = 'wl-copy --foreground --primary --type text/plain'
let s:paste['*'] = ['wl-paste', '--no-newline', '--primary'] let s:paste['*'] = 'wl-paste --no-newline --primary'
return 'wl-copy' return 'wl-copy'
elseif !empty($DISPLAY) && executable('xclip') elseif exists('$DISPLAY') && executable('xclip')
let s:copy['+'] = ['xclip', '-quiet', '-i', '-selection', 'clipboard'] let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
let s:paste['+'] = ['xclip', '-o', '-selection', 'clipboard'] let s:paste['+'] = 'xclip -o -selection clipboard'
let s:copy['*'] = ['xclip', '-quiet', '-i', '-selection', 'primary'] let s:copy['*'] = 'xclip -quiet -i -selection primary'
let s:paste['*'] = ['xclip', '-o', '-selection', 'primary'] let s:paste['*'] = 'xclip -o -selection primary'
return 'xclip' return 'xclip'
elseif !empty($DISPLAY) && executable('xsel') && s:cmd_ok('xsel -o -b') elseif exists('$DISPLAY') && executable('xsel') && s:cmd_ok('xsel -o -b')
let s:copy['+'] = ['xsel', '--nodetach', '-i', '-b'] let s:copy['+'] = 'xsel --nodetach -i -b'
let s:paste['+'] = ['xsel', '-o', '-b'] let s:paste['+'] = 'xsel -o -b'
let s:copy['*'] = ['xsel', '--nodetach', '-i', '-p'] let s:copy['*'] = 'xsel --nodetach -i -p'
let s:paste['*'] = ['xsel', '-o', '-p'] let s:paste['*'] = 'xsel -o -p'
return 'xsel' return 'xsel'
elseif executable('lemonade') elseif executable('lemonade')
let s:copy['+'] = ['lemonade', 'copy'] let s:copy['+'] = 'lemonade copy'
let s:paste['+'] = ['lemonade', 'paste'] let s:paste['+'] = 'lemonade paste'
let s:copy['*'] = ['lemonade', 'copy'] let s:copy['*'] = 'lemonade copy'
let s:paste['*'] = ['lemonade', 'paste'] let s:paste['*'] = 'lemonade paste'
return 'lemonade' return 'lemonade'
elseif executable('doitclient') elseif executable('doitclient')
let s:copy['+'] = ['doitclient', 'wclip'] let s:copy['+'] = 'doitclient wclip'
let s:paste['+'] = ['doitclient', 'wclip', '-r'] let s:paste['+'] = 'doitclient wclip -r'
let s:copy['*'] = s:copy['+'] let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+'] let s:paste['*'] = s:paste['+']
return 'doitclient' return 'doitclient'
elseif executable('win32yank.exe') elseif executable('win32yank.exe')
if has('wsl') && getftype(exepath('win32yank.exe')) == 'link' let s:copy['+'] = 'win32yank.exe -i --crlf'
let win32yank = resolve(exepath('win32yank.exe')) let s:paste['+'] = 'win32yank.exe -o --lf'
else
let win32yank = 'win32yank.exe'
endif
let s:copy['+'] = [win32yank, '-i', '--crlf']
let s:paste['+'] = [win32yank, '-o', '--lf']
let s:copy['*'] = s:copy['+'] let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+'] let s:paste['*'] = s:paste['+']
return 'win32yank' return 'win32yank'
elseif executable('termux-clipboard-set') elseif exists('$TMUX') && executable('tmux')
let s:copy['+'] = ['termux-clipboard-set'] let s:copy['+'] = 'tmux load-buffer -'
let s:paste['+'] = ['termux-clipboard-get'] let s:paste['+'] = 'tmux save-buffer -'
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'termux-clipboard'
elseif !empty($TMUX) && executable('tmux')
let s:copy['+'] = ['tmux', 'load-buffer', '-']
let s:paste['+'] = ['tmux', 'save-buffer', '-']
let s:copy['*'] = s:copy['+'] let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+'] let s:paste['*'] = s:paste['+']
return 'tmux' return 'tmux'
@@ -156,14 +136,7 @@ function! s:clipboard.get(reg) abort
elseif s:selections[a:reg].owner > 0 elseif s:selections[a:reg].owner > 0
return s:selections[a:reg].data return s:selections[a:reg].data
end end
return s:try_cmd(s:paste[a:reg])
let clipboard_data = s:try_cmd(s:paste[a:reg])
if match(&clipboard, '\v(unnamed|unnamedplus)') >= 0 && get(s:selections[a:reg].data, 0, []) == clipboard_data
" When system clipboard return is same as our cache return the cache
" as it contains regtype information
return s:selections[a:reg].data
end
return clipboard_data
endfunction endfunction
function! s:clipboard.set(lines, regtype, reg) abort function! s:clipboard.set(lines, regtype, reg) abort
@@ -182,9 +155,6 @@ function! s:clipboard.set(lines, regtype, reg) abort
if s:cache_enabled == 0 if s:cache_enabled == 0
call s:try_cmd(s:copy[a:reg], a:lines) call s:try_cmd(s:copy[a:reg], a:lines)
"Cache it anyway we can compare it later to get regtype of the yank
let s:selections[a:reg] = copy(s:selection)
let s:selections[a:reg].data = [a:lines, a:regtype]
return 0 return 0
end end
@@ -194,17 +164,14 @@ function! s:clipboard.set(lines, regtype, reg) abort
let s:selections[a:reg] = copy(s:selection) let s:selections[a:reg] = copy(s:selection)
let selection = s:selections[a:reg] let selection = s:selections[a:reg]
let selection.data = [a:lines, a:regtype] let selection.data = [a:lines, a:regtype]
let selection.argv = s:copy[a:reg] let argv = split(s:copy[a:reg], " ")
let selection.argv = argv
let selection.detach = s:cache_enabled let selection.detach = s:cache_enabled
let selection.cwd = "/" let selection.cwd = "/"
let jobid = jobstart(selection.argv, selection) let jobid = jobstart(argv, selection)
if jobid > 0 if jobid > 0
call jobsend(jobid, a:lines) call jobsend(jobid, a:lines)
call jobclose(jobid, 'stdin') call jobclose(jobid, 'stdin')
" xclip does not close stdout when receiving input via stdin
if selection.argv[0] ==# 'xclip'
call jobclose(jobid, 'stdout')
endif
let selection.owner = jobid let selection.owner = jobid
let ret = 1 let ret = 1
else else

View File

@@ -48,15 +48,11 @@ function! provider#node#can_inspect() abort
endfunction endfunction
function! provider#node#Detect() abort function! provider#node#Detect() abort
let minver = [6, 0]
if exists('g:node_host_prog') if exists('g:node_host_prog')
return [expand(g:node_host_prog, v:true), ''] return expand(g:node_host_prog)
endif endif
if !executable('node') if !s:is_minimum_version(v:null, 6, 0)
return ['', 'node not found (or not executable)'] return ''
endif
if !s:is_minimum_version(v:null, minver[0], minver[1])
return ['', printf('node version %s.%s not found', minver[0], minver[1])]
endif endif
let npm_opts = {} let npm_opts = {}
@@ -76,7 +72,7 @@ function! provider#node#Detect() abort
if has('unix') if has('unix')
let yarn_default_path = $HOME . '/.config/yarn/global/' . yarn_opts.entry_point let yarn_default_path = $HOME . '/.config/yarn/global/' . yarn_opts.entry_point
if filereadable(yarn_default_path) if filereadable(yarn_default_path)
return [yarn_default_path, ''] return yarn_default_path
endif endif
endif endif
let yarn_opts.job_id = jobstart('yarn global dir', yarn_opts) let yarn_opts.job_id = jobstart('yarn global dir', yarn_opts)
@@ -86,18 +82,18 @@ function! provider#node#Detect() abort
if !empty(npm_opts) if !empty(npm_opts)
let result = jobwait([npm_opts.job_id]) let result = jobwait([npm_opts.job_id])
if result[0] == 0 && npm_opts.result != '' if result[0] == 0 && npm_opts.result != ''
return [npm_opts.result, ''] return npm_opts.result
endif endif
endif endif
if !empty(yarn_opts) if !empty(yarn_opts)
let result = jobwait([yarn_opts.job_id]) let result = jobwait([yarn_opts.job_id])
if result[0] == 0 && yarn_opts.result != '' if result[0] == 0 && yarn_opts.result != ''
return [yarn_opts.result, ''] return yarn_opts.result
endif endif
endif endif
return ['', 'failed to detect node'] return ''
endfunction endfunction
function! provider#node#Prog() abort function! provider#node#Prog() abort
@@ -143,7 +139,7 @@ endfunction
let s:err = '' let s:err = ''
let [s:prog, s:_] = provider#node#Detect() let s:prog = provider#node#Detect()
let g:loaded_node_provider = empty(s:prog) ? 1 : 2 let g:loaded_node_provider = empty(s:prog) ? 1 : 2
if g:loaded_node_provider != 2 if g:loaded_node_provider != 2

View File

@@ -1,83 +0,0 @@
if exists('s:loaded_perl_provider')
finish
endif
let s:loaded_perl_provider = 1
function! provider#perl#Detect() abort
" use g:perl_host_prog if set or check if perl is on the path
let prog = exepath(get(g:, 'perl_host_prog', 'perl'))
if empty(prog)
return ['', '']
endif
" if perl is available, make sure we have 5.22+
call system([prog, '-e', 'use v5.22'])
if v:shell_error
return ['', 'Perl version is too old, 5.22+ required']
endif
" if perl is available, make sure the required module is available
call system([prog, '-W', '-MNeovim::Ext', '-e', ''])
if v:shell_error
return ['', '"Neovim::Ext" cpan module is not installed']
endif
return [prog, '']
endfunction
function! provider#perl#Prog() abort
return s:prog
endfunction
function! provider#perl#Require(host) abort
if s:err != ''
echoerr s:err
return
endif
let prog = provider#perl#Prog()
let args = [s:prog, '-e', 'use Neovim::Ext; start_host();']
" Collect registered perl plugins into args
let perl_plugins = remote#host#PluginsForHost(a:host.name)
for plugin in perl_plugins
call add(args, plugin.path)
endfor
return provider#Poll(args, a:host.orig_name, '$NVIM_PERL_LOG_FILE')
endfunction
function! provider#perl#Call(method, args) abort
if s:err != ''
echoerr s:err
return
endif
if !exists('s:host')
try
let s:host = remote#host#Require('legacy-perl-provider')
catch
let s:err = v:exception
echohl WarningMsg
echomsg v:exception
echohl None
return
endtry
endif
return call('rpcrequest', insert(insert(a:args, 'perl_'.a:method), s:host))
endfunction
let [s:prog, s:err] = provider#perl#Detect()
let g:loaded_perl_provider = empty(s:prog) ? 1 : 2
if g:loaded_perl_provider != 2
let s:err = 'Cannot find perl or the required perl module'
endif
" The perl provider plugin will run in a separate instance of the perl
" host.
call remote#host#RegisterClone('legacy-perl-provider', 'perl')
call remote#host#RegisterPlugin('legacy-perl-provider', 'ScriptHost.pm', [])

View File

@@ -10,8 +10,7 @@ function! provider#pythonx#Require(host) abort
" Python host arguments " Python host arguments
let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog()) let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog())
let args = [prog, '-c', 'import sys; sys.path = list(filter(lambda x: x != "", sys.path)); import neovim; neovim.start_host()'] let args = [prog, '-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()']
" Collect registered Python plugins into args " Collect registered Python plugins into args
let python_plugins = remote#host#PluginsForHost(a:host.name) let python_plugins = remote#host#PluginsForHost(a:host.name)
@@ -19,18 +18,18 @@ function! provider#pythonx#Require(host) abort
call add(args, plugin.path) call add(args, plugin.path)
endfor endfor
return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE', {'overlapped': v:true}) return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE')
endfunction endfunction
function! s:get_python_executable_from_host_var(major_version) abort function! s:get_python_executable_from_host_var(major_version) abort
return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : '').'_host_prog', ''), v:true) return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : '').'_host_prog', ''))
endfunction endfunction
function! s:get_python_candidates(major_version) abort function! s:get_python_candidates(major_version) abort
return { return {
\ 2: ['python2', 'python2.7', 'python2.6', 'python'], \ 2: ['python2', 'python2.7', 'python2.6', 'python'],
\ 3: ['python3', 'python3.10', 'python3.9', 'python3.8', 'python3.7', \ 3: ['python3', 'python3.7', 'python3.6', 'python3.5', 'python3.4', 'python3.3',
\ 'python3.6', 'python'] \ 'python']
\ }[a:major_version] \ }[a:major_version]
endfunction endfunction
@@ -44,7 +43,7 @@ function! provider#pythonx#DetectByModule(module, major_version) abort
let python_exe = s:get_python_executable_from_host_var(a:major_version) let python_exe = s:get_python_executable_from_host_var(a:major_version)
if !empty(python_exe) if !empty(python_exe)
return [exepath(expand(python_exe, v:true)), ''] return [python_exe, '']
endif endif
let candidates = s:get_python_candidates(a:major_version) let candidates = s:get_python_candidates(a:major_version)
@@ -67,7 +66,7 @@ endfunction
function! s:import_module(prog, module) abort function! s:import_module(prog, module) abort
let prog_version = system([a:prog, '-c' , printf( let prog_version = system([a:prog, '-c' , printf(
\ 'import sys; ' . \ 'import sys; ' .
\ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' . \ 'sys.path.remove(""); ' .
\ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' . \ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' .
\ 'import pkgutil; ' . \ 'import pkgutil; ' .
\ 'exit(2*int(pkgutil.get_loader("%s") is None))', \ 'exit(2*int(pkgutil.get_loader("%s") is None))',

View File

@@ -5,8 +5,7 @@ endif
let g:loaded_ruby_provider = 1 let g:loaded_ruby_provider = 1
function! provider#ruby#Detect() abort function! provider#ruby#Detect() abort
let e = empty(s:prog) ? 'missing ruby or ruby-host' : '' return s:prog
return [s:prog, e]
endfunction endfunction
function! provider#ruby#Prog() abort function! provider#ruby#Prog() abort
@@ -46,7 +45,7 @@ endfunction
function! s:detect() function! s:detect()
if exists("g:ruby_host_prog") if exists("g:ruby_host_prog")
return expand(g:ruby_host_prog, v:true) return expand(g:ruby_host_prog)
elseif has('win32') elseif has('win32')
return exepath('neovim-ruby-host.bat') return exepath('neovim-ruby-host.bat')
else else

View File

@@ -1,8 +1,7 @@
"python3complete.vim - Omni Completion for python "python3complete.vim - Omni Completion for python
" Maintainer: <vacancy> " Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
" Previous Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
" Version: 0.9 " Version: 0.9
" Last Updated: 2020 Oct 9 " Last Updated: 18 Jun 2009 (small fix 2015 Sep 14 from Debian)
" "
" Roland Puntaier: this file contains adaptations for python3 and is parallel to pythoncomplete.vim " Roland Puntaier: this file contains adaptations for python3 and is parallel to pythoncomplete.vim
" "
@@ -84,7 +83,7 @@ function! python3complete#Complete(findstart, base)
break break
endif endif
endwhile endwhile
execute "py3 vimpy3complete('" . escape(cword, "'") . "', '" . escape(a:base, "'") . "')" execute "py3 vimpy3complete('" . cword . "', '" . a:base . "')"
return g:python3complete_completions return g:python3complete_completions
endif endif
endfunction endfunction

View File

@@ -1,8 +1,7 @@
"pythoncomplete.vim - Omni Completion for python "pythoncomplete.vim - Omni Completion for python
" Maintainer: <vacancy> " Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
" Previous Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
" Version: 0.9 " Version: 0.9
" Last Updated: 2020 Oct 9 " Last Updated: 18 Jun 2009
" "
" Changes " Changes
" TODO: " TODO:
@@ -82,7 +81,7 @@ function! pythoncomplete#Complete(findstart, base)
break break
endif endif
endwhile endwhile
execute "python vimcomplete('" . escape(cword, "'") . "', '" . escape(a:base, "'") . "')" execute "python vimcomplete('" . cword . "', '" . a:base . "')"
return g:pythoncomplete_completions return g:pythoncomplete_completions
endif endif
endfunction endfunction

View File

@@ -24,7 +24,7 @@ function! remote#define#CommandOnHost(host, method, sync, name, opts)
endif endif
if has_key(a:opts, 'nargs') if has_key(a:opts, 'nargs')
call add(forward_args, ' " . <q-args> . "') call add(forward_args, ' <args>')
endif endif
exe s:GetCommandPrefix(a:name, a:opts) exe s:GetCommandPrefix(a:name, a:opts)

View File

@@ -203,7 +203,3 @@ call remote#host#Register('ruby', '*.rb',
" nodejs " nodejs
call remote#host#Register('node', '*', call remote#host#Register('node', '*',
\ function('provider#node#Require')) \ function('provider#node#Require'))
" perl
call remote#host#Register('perl', '*',
\ function('provider#perl#Require'))

View File

@@ -3,7 +3,7 @@
" Maintainer: Mark Guzman <segfault@hasno.info> " Maintainer: Mark Guzman <segfault@hasno.info>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 Feb 25 " Last Change: 2019 Jan 06
" ---------------------------------------------------------------------------- " ----------------------------------------------------------------------------
" "
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
@@ -53,23 +53,6 @@ if !exists("g:rubycomplete_include_objectspace")
endif endif
" }}} configuration failsafe initialization " }}} configuration failsafe initialization
" {{{ regex patterns
" Regex that defines the start-match for the 'end' keyword.
let s:end_start_regex =
\ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' .
\ '\|\%(\K\k*[!?]\?\s\+\)\=def\):\@!\>' .
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
" Regex that defines the middle-match for the 'end' keyword.
let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|elsif\):\@!\>'
" Regex that defines the end-match for the 'end' keyword.
let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>'
" }}} regex patterns
" {{{ vim-side support functions " {{{ vim-side support functions
let s:rubycomplete_debug = 0 let s:rubycomplete_debug = 0
@@ -120,7 +103,7 @@ function! s:GetBufferRubyEntity( name, type, ... )
endif endif
let curpos = getpos(".") let curpos = getpos(".")
let [enum,ecol] = searchpairpos( s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'W' ) let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'W' )
call cursor(lastpos[1], lastpos[2]) call cursor(lastpos[1], lastpos[2])
if lnum > enum if lnum > enum
@@ -145,28 +128,19 @@ function! s:IsPosInClassDef(pos)
return ret return ret
endfunction endfunction
function! s:IsInComment(pos)
let stack = synstack(a:pos[0], a:pos[1])
if !empty(stack)
return synIDattr(stack[0], 'name') =~ 'ruby\%(.*Comment\|Documentation\)'
else
return 0
endif
endfunction
function! s:GetRubyVarType(v) function! s:GetRubyVarType(v)
let stopline = 1 let stopline = 1
let vtp = '' let vtp = ''
let curpos = getpos('.') let pos = getpos('.')
let sstr = '^\s*#\s*@var\s*'.escape(a:v, '*').'\>\s\+[^ \t]\+\s*$' let sstr = '^\s*#\s*@var\s*'.escape(a:v, '*').'\>\s\+[^ \t]\+\s*$'
let [lnum,lcol] = searchpos(sstr,'nb',stopline) let [lnum,lcol] = searchpos(sstr,'nb',stopline)
if lnum != 0 && lcol != 0 if lnum != 0 && lcol != 0
call setpos('.',curpos) call setpos('.',pos)
let str = getline(lnum) let str = getline(lnum)
let vtp = substitute(str,sstr,'\1','') let vtp = substitute(str,sstr,'\1','')
return vtp return vtp
endif endif
call setpos('.',curpos) call setpos('.',pos)
let ctors = '\(now\|new\|open\|get_instance' let ctors = '\(now\|new\|open\|get_instance'
if exists('g:rubycomplete_rails') && g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1 if exists('g:rubycomplete_rails') && g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1
let ctors = ctors.'\|find\|create' let ctors = ctors.'\|find\|create'
@@ -176,13 +150,9 @@ function! s:GetRubyVarType(v)
let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)' let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)'
let sstr = ''.escape(a:v, '*').'\>\s*[+\-*/]*'.fstr let sstr = ''.escape(a:v, '*').'\>\s*[+\-*/]*'.fstr
let pos = searchpos(sstr,'bW') let [lnum,lcol] = searchpos(sstr,'nb',stopline)
while pos != [0,0] && s:IsInComment(pos) if lnum != 0 && lcol != 0
let pos = searchpos(sstr,'bW') let str = matchstr(getline(lnum),fstr,lcol)
endwhile
if pos != [0,0]
let [lnum, col] = pos
let str = matchstr(getline(lnum),fstr,col)
let str = substitute(str,'^=\s*','','') let str = substitute(str,'^=\s*','','')
call setpos('.',pos) call setpos('.',pos)
@@ -204,7 +174,7 @@ function! s:GetRubyVarType(v)
end end
return '' return ''
endif endif
call setpos('.',curpos) call setpos('.',pos)
return '' return ''
endfunction endfunction
@@ -701,10 +671,11 @@ class VimRubyCompletion
methods.delete_if { |c| c.match( /'/ ) } methods.delete_if { |c| c.match( /'/ ) }
end end
when /^::([A-Z][^:\.\(]*)?$/ # Absolute Constant or class methods when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods
dprint "const or cls" dprint "const or cls"
receiver = $1 receiver = $1
methods = Object.constants.collect{ |c| c.to_s }.grep(/^#{receiver}/) methods = Object.constants
methods.grep(/^#{receiver}/).collect{|e| "::" + e}
when /^(((::)?[A-Z][^:.\(]*)+?)::?([^:.]*)$/ # Constant or class methods when /^(((::)?[A-Z][^:.\(]*)+?)::?([^:.]*)$/ # Constant or class methods
receiver = $1 receiver = $1
@@ -713,13 +684,13 @@ class VimRubyCompletion
load_buffer_class( receiver ) load_buffer_class( receiver )
load_buffer_module( receiver ) load_buffer_module( receiver )
begin begin
constants = eval("#{receiver}.constants").collect{ |c| c.to_s }.grep(/^#{message}/) classes = eval("#{receiver}.constants")
methods = eval("#{receiver}.methods").collect{ |m| m.to_s }.grep(/^#{message}/) #methods = eval("#{receiver}.methods")
rescue Exception rescue Exception
dprint "exception: %s" % $! dprint "exception: %s" % $!
constants = []
methods = [] methods = []
end end
methods.grep(/^#{message}/).collect{|e| receiver + "::" + e}
when /^(:[^:.]+)\.([^.]*)$/ # Symbol when /^(:[^:.]+)\.([^.]*)$/ # Symbol
dprint "symbol" dprint "symbol"

View File

@@ -1,21 +1,18 @@
" Vim script to download a missing spell file " Vim script to download a missing spell file
if !exists('g:spellfile_URL') if !exists('g:spellfile_URL')
" Always use https:// because it's secure. The certificate is for nluug.nl, " Prefer using http:// when netrw should be able to use it, since
" thus we can't use the alias ftp.vim.org here. " more firewalls let this through.
let g:spellfile_URL = 'https://ftp.nluug.nl/pub/vim/runtime/spell' if executable("curl") || executable("wget") || executable("fetch")
let g:spellfile_URL = 'http://ftp.vim.org/pub/vim/runtime/spell'
else
let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/runtime/spell'
endif
endif endif
let s:spellfile_URL = '' " Start with nothing so that s:donedict is reset. let s:spellfile_URL = '' " Start with nothing so that s:donedict is reset.
" This function is used for the spellfile plugin. " This function is used for the spellfile plugin.
function! spellfile#LoadFile(lang) function! spellfile#LoadFile(lang)
" Check for sandbox/modeline. #11359
try
:!
catch /\<E12\>/
throw 'Cannot download spellfile in sandbox/modeline. Try ":set spell" from the cmdline.'
endtry
" If the netrw plugin isn't loaded we silently skip everything. " If the netrw plugin isn't loaded we silently skip everything.
if !exists(":Nread") if !exists(":Nread")
if &verbose if &verbose

View File

@@ -1,20 +1,12 @@
" Vim completion script " Vim completion script
" Language: All languages, uses existing syntax highlighting rules " Language: All languages, uses existing syntax highlighting rules
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Version: 15.0 " Version: 13.0
" Last Change: 2021 Apr 27 " Last Change: 2019 Aug 08
" Usage: For detailed help, ":help ft-syntax-omni" " Usage: For detailed help, ":help ft-syntax-omni"
" History " History
" "
" Version 15.0
" - SyntaxComplete ignored all buffer specific overrides, always used global
" https://github.com/vim/vim/issues/8153
"
" Version 14.0
" - Fixed issue with single quotes and is_keyword
" https://github.com/vim/vim/issues/7463
"
" Version 13.0 " Version 13.0
" - Extended the option omni_syntax_group_include_{filetype} " - Extended the option omni_syntax_group_include_{filetype}
" to accept a comma separated list of regex's rather than " to accept a comma separated list of regex's rather than
@@ -46,7 +38,7 @@
" let g:omni_syntax_use_single_byte = 1 " let g:omni_syntax_use_single_byte = 1
" - This by default will only allow single byte ASCII " - This by default will only allow single byte ASCII
" characters to be added and an additional check to ensure " characters to be added and an additional check to ensure
" the character is printable (see documentation for isprint). " the charater is printable (see documentation for isprint).
" "
" Version 9.0 " Version 9.0
" - Add the check for cpo. " - Add the check for cpo.
@@ -94,7 +86,7 @@ endif
if exists('g:loaded_syntax_completion') if exists('g:loaded_syntax_completion')
finish finish
endif endif
let g:loaded_syntax_completion = 150 let g:loaded_syntax_completion = 130
" Turn on support for line continuations when creating the script " Turn on support for line continuations when creating the script
let s:cpo_save = &cpo let s:cpo_save = &cpo
@@ -149,10 +141,14 @@ let s:prepended = ''
" This function is used for the 'omnifunc' option. " This function is used for the 'omnifunc' option.
function! syntaxcomplete#Complete(findstart, base) function! syntaxcomplete#Complete(findstart, base)
" Allow user to override ignorecase per buffer " Only display items in the completion window that are at least
let l:omni_syntax_ignorecase = g:omni_syntax_ignorecase " this many characters in length
if exists('b:omni_syntax_ignorecase') if !exists('b:omni_syntax_ignorecase')
let l:omni_syntax_ignorecase = b:omni_syntax_ignorecase if exists('g:omni_syntax_ignorecase')
let b:omni_syntax_ignorecase = g:omni_syntax_ignorecase
else
let b:omni_syntax_ignorecase = &ignorecase
endif
endif endif
if a:findstart if a:findstart
@@ -183,7 +179,7 @@ function! syntaxcomplete#Complete(findstart, base)
endif endif
" let base = s:prepended . a:base " let base = s:prepended . a:base
let base = substitute(s:prepended, "'", "''", 'g') let base = s:prepended
let filetype = substitute(&filetype, '\.', '_', 'g') let filetype = substitute(&filetype, '\.', '_', 'g')
let list_idx = index(s:cache_name, filetype, 0, &ignorecase) let list_idx = index(s:cache_name, filetype, 0, &ignorecase)
@@ -199,13 +195,13 @@ function! syntaxcomplete#Complete(findstart, base)
if base != '' if base != ''
" let compstr = join(compl_list, ' ') " let compstr = join(compl_list, ' ')
" let expr = (l:omni_syntax_ignorecase==0?'\C':'').'\<\%('.base.'\)\@!\w\+\s*' " let expr = (b:omni_syntax_ignorecase==0?'\C':'').'\<\%('.base.'\)\@!\w\+\s*'
" let compstr = substitute(compstr, expr, '', 'g') " let compstr = substitute(compstr, expr, '', 'g')
" let compl_list = split(compstr, '\s\+') " let compl_list = split(compstr, '\s\+')
" Filter the list based on the first few characters the user " Filter the list based on the first few characters the user
" entered " entered
let expr = 'v:val '.(l:omni_syntax_ignorecase==1?'=~?':'=~#')." '^".escape(base, '\\/.*$^~[]').".*'" let expr = 'v:val '.(g:omni_syntax_ignorecase==1?'=~?':'=~#')." '^".escape(base, '\\/.*$^~[]').".*'"
let compl_list = filter(deepcopy(compl_list), expr) let compl_list = filter(deepcopy(compl_list), expr)
endif endif
@@ -226,26 +222,6 @@ function! syntaxcomplete#OmniSyntaxList(...)
endif endif
endfunc endfunc
function! syntaxcomplete#OmniSyntaxClearCache()
let s:cache_name = []
let s:cache_list = []
endfunction
" To retrieve all syntax items regardless of syntax group:
" echo OmniSyntaxList( [] )
"
" To retrieve only the syntax items for the sqlOperator syntax group:
" echo OmniSyntaxList( ['sqlOperator'] )
"
" To retrieve all syntax items for both the sqlOperator and sqlType groups:
" echo OmniSyntaxList( ['sqlOperator', 'sqlType'] )
"
" A regular expression can also be used:
" echo OmniSyntaxList( ['sql\w\+'] )
"
" From within a plugin, you would typically assign the output to a List: >
" let myKeywords = []
" let myKeywords = OmniSyntaxList( ['sqlKeyword'] )
function! OmniSyntaxList(...) function! OmniSyntaxList(...)
let list_parms = [] let list_parms = []
if a:0 > 0 if a:0 > 0
@@ -263,25 +239,37 @@ function! OmniSyntaxList(...)
" let use_dictionary = a:1 " let use_dictionary = a:1
" endif " endif
" Only display items in the completion window that are at least
" this many characters in length
if !exists('b:omni_syntax_use_iskeyword')
if exists('g:omni_syntax_use_iskeyword')
let b:omni_syntax_use_iskeyword = g:omni_syntax_use_iskeyword
else
let b:omni_syntax_use_iskeyword = 1
endif
endif
" Only display items in the completion window that are at least
" this many characters in length
if !exists('b:omni_syntax_minimum_length')
if exists('g:omni_syntax_minimum_length')
let b:omni_syntax_minimum_length = g:omni_syntax_minimum_length
else
let b:omni_syntax_minimum_length = 0
endif
endif
let saveL = @l let saveL = @l
let filetype = substitute(&filetype, '\.', '_', 'g') let filetype = substitute(&filetype, '\.', '_', 'g')
if empty(list_parms) if empty(list_parms)
" Allow user to override per buffer
if exists('g:omni_syntax_group_include_'.filetype)
let l:omni_syntax_group_include_{filetype} = g:omni_syntax_group_include_{filetype}
endif
if exists('b:omni_syntax_group_include_'.filetype)
let l:omni_syntax_group_include_{filetype} = b:omni_syntax_group_include_{filetype}
endif
" Default the include group to include the requested syntax group " Default the include group to include the requested syntax group
let syntax_group_include_{filetype} = '' let syntax_group_include_{filetype} = ''
" Check if there are any overrides specified for this filetype " Check if there are any overrides specified for this filetype
if exists('l:omni_syntax_group_include_'.filetype) if exists('g:omni_syntax_group_include_'.filetype)
let syntax_group_include_{filetype} = let syntax_group_include_{filetype} =
\ substitute( l:omni_syntax_group_include_{filetype},'\s\+','','g') \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g')
let list_parms = split(l:omni_syntax_group_include_{filetype}, ',') let list_parms = split(g:omni_syntax_group_include_{filetype}, ',')
if syntax_group_include_{filetype} =~ '\w' if syntax_group_include_{filetype} =~ '\w'
let syntax_group_include_{filetype} = let syntax_group_include_{filetype} =
\ substitute( syntax_group_include_{filetype}, \ substitute( syntax_group_include_{filetype},
@@ -336,20 +324,11 @@ function! OmniSyntaxList(...)
else else
" Default the exclude group to nothing " Default the exclude group to nothing
let syntax_group_exclude_{filetype} = '' let syntax_group_exclude_{filetype} = ''
" Allow user to override per buffer
if exists('g:omni_syntax_group_exclude_'.filetype)
let l:omni_syntax_group_exclude_{filetype} = g:omni_syntax_group_exclude_{filetype}
endif
if exists('b:omni_syntax_group_exclude_'.filetype)
let l:omni_syntax_group_exclude_{filetype} = b:omni_syntax_group_exclude_{filetype}
endif
" Check if there are any overrides specified for this filetype " Check if there are any overrides specified for this filetype
if exists('l:omni_syntax_group_exclude_'.filetype) if exists('g:omni_syntax_group_exclude_'.filetype)
let syntax_group_exclude_{filetype} = let syntax_group_exclude_{filetype} =
\ substitute( l:omni_syntax_group_exclude_{filetype},'\s\+','','g') \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g')
let list_exclude_groups = split(l:omni_syntax_group_exclude_{filetype}, ',') let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',')
if syntax_group_exclude_{filetype} =~ '\w' if syntax_group_exclude_{filetype} =~ '\w'
let syntax_group_exclude_{filetype} = let syntax_group_exclude_{filetype} =
\ substitute( syntax_group_exclude_{filetype}, \ substitute( syntax_group_exclude_{filetype},
@@ -545,30 +524,6 @@ endfunction
function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
" Allow user to override iskeyword per buffer
let l:omni_syntax_use_iskeyword = g:omni_syntax_use_iskeyword
if exists('b:omni_syntax_use_iskeyword')
let l:omni_syntax_use_iskeyword = b:omni_syntax_use_iskeyword
endif
" Allow user to override iskeyword_numeric per buffer
let l:omni_syntax_use_iskeyword_numeric = g:omni_syntax_use_iskeyword_numeric
if exists('b:omni_syntax_use_iskeyword_numeric')
let l:omni_syntax_use_iskeyword_numeric = b:omni_syntax_use_iskeyword_numeric
endif
" Allow user to override iskeyword_numeric per buffer
let l:omni_syntax_use_single_byte = g:omni_syntax_use_single_byte
if exists('b:omni_syntax_use_single_byte')
let l:omni_syntax_use_single_byte = b:omni_syntax_use_single_byte
endif
" Allow user to override minimum_length per buffer
let l:omni_syntax_minimum_length = g:omni_syntax_minimum_length
if exists('b:omni_syntax_minimum_length')
let l:omni_syntax_minimum_length = b:omni_syntax_minimum_length
endif
let syn_list = "" let syn_list = ""
" From the full syntax listing, strip out the portion for the " From the full syntax listing, strip out the portion for the
@@ -687,23 +642,14 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
\ syn_list, '\%(^\|\n\)\@<=\s*\(@\w\+\)' \ syn_list, '\%(^\|\n\)\@<=\s*\(@\w\+\)'
\ , "", 'g' \ , "", 'g'
\ ) \ )
if l:omni_syntax_use_iskeyword == 0 if b:omni_syntax_use_iskeyword == 0
" There are a number of items which have non-word characters in " There are a number of items which have non-word characters in
" them, *'T_F1'*. vim.vim is one such file. " them, *'T_F1'*. vim.vim is one such file.
" This will replace non-word characters with spaces. " This will replace non-word characters with spaces.
" setlocal filetype=forth
" let g:omni_syntax_use_iskeyword = 1
" let g:omni_syntax_use_iskeyword_numeric = 1
" You will see entries like
" #>>
" (.local)
" These were found doing a grep in vim82\syntax
" grep iskeyword *
" forth.vim:setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
let syn_list = substitute( syn_list, '[^0-9A-Za-z_ ]', ' ', 'g' ) let syn_list = substitute( syn_list, '[^0-9A-Za-z_ ]', ' ', 'g' )
else else
if l:omni_syntax_use_iskeyword_numeric == 1 if g:omni_syntax_use_iskeyword_numeric == 1
" iskeyword can contain value like this " iskeyword can contain value like this
" 38,42,43,45,47-58,60-62,64-90,97-122,_,+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 " 38,42,43,45,47-58,60-62,64-90,97-122,_,+,-,*,/,%,<,=,>,:,$,?,!,@-@,94
" Numeric values convert to their ASCII equivalent using the " Numeric values convert to their ASCII equivalent using the
@@ -723,7 +669,7 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
" cycle through each character within the range " cycle through each character within the range
let [b:start, b:end] = split(item, '-') let [b:start, b:end] = split(item, '-')
for range_item in range( b:start, b:end ) for range_item in range( b:start, b:end )
if range_item <= 127 || l:omni_syntax_use_single_byte == 0 if range_item <= 127 || g:omni_syntax_use_single_byte == 0
if nr2char(range_item) =~ '\p' if nr2char(range_item) =~ '\p'
let accepted_chars = accepted_chars . nr2char(range_item) let accepted_chars = accepted_chars . nr2char(range_item)
endif endif
@@ -731,13 +677,13 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
endfor endfor
elseif item =~ '^\d\+$' elseif item =~ '^\d\+$'
" Only numeric, translate to a character " Only numeric, translate to a character
if item < 127 || l:omni_syntax_use_single_byte == 0 if item < 127 || g:omni_syntax_use_single_byte == 0
if nr2char(item) =~ '\p' if nr2char(item) =~ '\p'
let accepted_chars = accepted_chars . nr2char(item) let accepted_chars = accepted_chars . nr2char(item)
endif endif
endif endif
else else
if char2nr(item) < 127 || l:omni_syntax_use_single_byte == 0 if char2nr(item) < 127 || g:omni_syntax_use_single_byte == 0
if item =~ '\p' if item =~ '\p'
let accepted_chars = accepted_chars . item let accepted_chars = accepted_chars . item
endif endif
@@ -773,9 +719,9 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
endif endif
endif endif
if l:omni_syntax_minimum_length > 0 if b:omni_syntax_minimum_length > 0
" If the user specified a minimum length, enforce it " If the user specified a minimum length, enforce it
let syn_list = substitute(' '.syn_list.' ', ' \S\{,'.l:omni_syntax_minimum_length.'}\ze ', ' ', 'g') let syn_list = substitute(' '.syn_list.' ', ' \S\{,'.b:omni_syntax_minimum_length.'}\ze ', ' ', 'g')
endif endif
else else
let syn_list = '' let syn_list = ''
@@ -805,6 +751,5 @@ function! OmniSyntaxShowChars(spec)
endfor endfor
return join(map(result, 'nr2char(v:val)'), ', ') return join(map(result, 'nr2char(v:val)'), ', ')
endfunction endfunction
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save

View File

@@ -1,13 +1,13 @@
" tar.vim: Handles browsing tarfiles " tar.vim: Handles browsing tarfiles
" AUTOLOAD PORTION " AUTOLOAD PORTION
" Date: Jan 07, 2020 " Date: Apr 17, 2013
" Version: 32 " Version: 29
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" License: Vim License (see vim's :help license) " License: Vim License (see vim's :help license)
" "
" Contains many ideas from Michael Toren's <tar.vim> " Contains many ideas from Michael Toren's <tar.vim>
" "
" Copyright: Copyright (C) 2005-2017 Charles E. Campbell {{{1 " Copyright: Copyright (C) 2005-2011 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@@ -22,7 +22,7 @@
if &cp || exists("g:loaded_tar") if &cp || exists("g:loaded_tar")
finish finish
endif endif
let g:loaded_tar= "v32" let g:loaded_tar= "v29"
if v:version < 702 if v:version < 702
echohl WarningMsg echohl WarningMsg
echo "***warning*** this version of tar needs vim 7.2" echo "***warning*** this version of tar needs vim 7.2"
@@ -48,9 +48,6 @@ endif
if !exists("g:tar_writeoptions") if !exists("g:tar_writeoptions")
let g:tar_writeoptions= "uf" let g:tar_writeoptions= "uf"
endif endif
if !exists("g:tar_delfile")
let g:tar_delfile="--delete -f"
endif
if !exists("g:netrw_cygwin") if !exists("g:netrw_cygwin")
if has("win32") || has("win95") || has("win64") || has("win16") if has("win32") || has("win95") || has("win64") || has("win16")
if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$' if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
@@ -112,7 +109,6 @@ fun! tar#Browse(tarfile)
" sanity checks " sanity checks
if !executable(g:tar_cmd) if !executable(g:tar_cmd)
redraw! redraw!
" call Decho('***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system')
echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system' echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
let &report= repkeep let &report= repkeep
" call Dret("tar#Browse") " call Dret("tar#Browse")
@@ -123,7 +119,6 @@ fun! tar#Browse(tarfile)
if a:tarfile !~# '^\a\+://' if a:tarfile !~# '^\a\+://'
" if it's an url, don't complain, let url-handlers such as vim do its thing " if it's an url, don't complain, let url-handlers such as vim do its thing
redraw! redraw!
" call Decho("***error*** (tar#Browse) File not readable<".a:tarfile.">")
echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None
endif endif
let &report= repkeep let &report= repkeep
@@ -157,29 +152,12 @@ fun! tar#Browse(tarfile)
" assuming cygwin " assuming cygwin
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif endif
let curlast= line("$") let curlast= line("$")
if tarfile =~# '\.\(gz\|tgz\)$'
if tarfile =~# '\.\(gz\)$' let gzip_command = s:get_gzip_command(tarfile)
" call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' || tarfile =~# '\.\(tzs\)$'
if has("unix") && executable("file")
let filekind= system("file ".shellescape(tarfile,1)) =~ "bzip2"
else
let filekind= ""
endif
if filekind =~ "bzip2"
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif filekind =~ "XZ"
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif filekind =~ "Zstandard"
exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
else
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
endif
elseif tarfile =~# '\.lrp' elseif tarfile =~# '\.lrp'
" call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ") " call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
@@ -192,8 +170,6 @@ fun! tar#Browse(tarfile)
elseif tarfile =~# '\.\(xz\|txz\)$' elseif tarfile =~# '\.\(xz\|txz\)$'
" call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.\(zst\|tzs\)$'
exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
else else
if tarfile =~ '^\s*-' if tarfile =~ '^\s*-'
" A file name starting with a dash is taken as an option. Prepend ./ to avoid that. " A file name starting with a dash is taken as an option. Prepend ./ to avoid that.
@@ -208,7 +184,7 @@ fun! tar#Browse(tarfile)
" call Dret("tar#Browse : a:tarfile<".a:tarfile.">") " call Dret("tar#Browse : a:tarfile<".a:tarfile.">")
return return
endif endif
if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~# '\c\%(warning\|error\|inappropriate\|unrecognized\)') if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)')
redraw! redraw!
echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None
keepj sil! %d keepj sil! %d
@@ -221,13 +197,8 @@ fun! tar#Browse(tarfile)
return return
endif endif
" set up maps supported for tar
setlocal noma nomod ro setlocal noma nomod ro
noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr> noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
noremap <silent> <buffer> x :call tar#Extract()<cr>
if &mouse != ""
noremap <silent> <buffer> <leftmouse> <leftmouse>:call <SID>TarBrowseSelect()<cr>
endif
let &report= repkeep let &report= repkeep
" call Dret("tar#Browse : b:tarfile<".b:tarfile.">") " call Dret("tar#Browse : b:tarfile<".b:tarfile.">")
@@ -264,8 +235,7 @@ fun! s:TarBrowseSelect()
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif endif
" open a new window (tar#Read will read a file into it) new
noswapfile new
if !exists("g:tar_nomax") || g:tar_nomax == 0 if !exists("g:tar_nomax") || g:tar_nomax == 0
wincmd _ wincmd _
endif endif
@@ -297,7 +267,7 @@ fun! tar#Read(fname,mode)
if fname =~ '\.bz2$' && executable("bzcat") if fname =~ '\.bz2$' && executable("bzcat")
let decmp= "|bzcat" let decmp= "|bzcat"
let doro = 1 let doro = 1
elseif fname =~ '\.t\=gz$' && executable("zcat") elseif fname =~ '\.gz$' && executable("zcat")
let decmp= "|zcat" let decmp= "|zcat"
let doro = 1 let doro = 1
elseif fname =~ '\.lzma$' && executable("lzcat") elseif fname =~ '\.lzma$' && executable("lzcat")
@@ -306,9 +276,6 @@ fun! tar#Read(fname,mode)
elseif fname =~ '\.xz$' && executable("xzcat") elseif fname =~ '\.xz$' && executable("xzcat")
let decmp= "|xzcat" let decmp= "|xzcat"
let doro = 1 let doro = 1
elseif fname =~ '\.zst$' && executable("zstdcat")
let decmp= "|zstdcat"
let doro = 1
else else
let decmp="" let decmp=""
let doro = 0 let doro = 0
@@ -324,31 +291,20 @@ fun! tar#Read(fname,mode)
endif endif
if tarfile =~# '\.bz2$' if tarfile =~# '\.bz2$'
" call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.\(gz\)$' elseif tarfile =~# '\.\(gz\|tgz\)$'
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp let gzip_command = s:get_gzip_command(tarfile)
" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1))
elseif tarfile =~# '\(\.tgz\|\.tbz\|\.txz\)' exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
if has("unix") && executable("file")
let filekind= system("file ".shellescape(tarfile,1))
else
let filekind= ""
endif
if filekind =~ "bzip2"
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif filekind =~ "XZ"
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif filekind =~ "Zstandard"
exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
else
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
endif
elseif tarfile =~# '\.lrp$' elseif tarfile =~# '\.lrp$'
" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.lzma$' elseif tarfile =~# '\.lzma$'
" call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.\(xz\|txz\)$' elseif tarfile =~# '\.\(xz\|txz\)$'
" call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
else else
if tarfile =~ '^\s*-' if tarfile =~ '^\s*-'
@@ -392,14 +348,13 @@ fun! tar#Write(fname)
" sanity checks " sanity checks
if !executable(g:tar_cmd) if !executable(g:tar_cmd)
redraw! redraw!
" call Decho('***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system') echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
let &report= repkeep let &report= repkeep
" call Dret("tar#Write") " call Dret("tar#Write")
return return
endif endif
if !exists("*mkdir") if !exists("*mkdir")
redraw! redraw!
" call Decho("***error*** (tar#Write) sorry, mkdir() doesn't work on your system")
echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None
let &report= repkeep let &report= repkeep
" call Dret("tar#Write") " call Dret("tar#Write")
@@ -420,7 +375,6 @@ fun! tar#Write(fname)
exe "cd ".fnameescape(tmpdir) exe "cd ".fnameescape(tmpdir)
catch /^Vim\%((\a\+)\)\=:E344/ catch /^Vim\%((\a\+)\)\=:E344/
redraw! redraw!
" call Decho("***error*** (tar#Write) cannot cd to temporary directory")
echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None
let &report= repkeep let &report= repkeep
" call Dret("tar#Write") " call Dret("tar#Write")
@@ -439,6 +393,8 @@ fun! tar#Write(fname)
let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','') let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','')
let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','') let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','')
let gzip_command = s:get_gzip_command(tarfile)
" handle compressed archives " handle compressed archives
if tarfile =~# '\.bz2' if tarfile =~# '\.bz2'
call system("bzip2 -d -- ".shellescape(tarfile,0)) call system("bzip2 -d -- ".shellescape(tarfile,0))
@@ -446,12 +402,12 @@ fun! tar#Write(fname)
let compress= "bzip2 -- ".shellescape(tarfile,0) let compress= "bzip2 -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">") " call Decho("compress<".compress.">")
elseif tarfile =~# '\.gz' elseif tarfile =~# '\.gz'
call system("gzip -d -- ".shellescape(tarfile,0)) call system(gzip_command . " -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.gz','','e') let tarfile = substitute(tarfile,'\.gz','','e')
let compress= "gzip -- ".shellescape(tarfile,0) let compress= "gzip -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">") " call Decho("compress<".compress.">")
elseif tarfile =~# '\.tgz' elseif tarfile =~# '\.tgz'
call system("gzip -d -- ".shellescape(tarfile,0)) call system(gzip_command . " -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.tgz','.tar','e') let tarfile = substitute(tarfile,'\.tgz','.tar','e')
let compress= "gzip -- ".shellescape(tarfile,0) let compress= "gzip -- ".shellescape(tarfile,0)
let tgz = 1 let tgz = 1
@@ -461,10 +417,6 @@ fun! tar#Write(fname)
let tarfile = substitute(tarfile,'\.xz','','e') let tarfile = substitute(tarfile,'\.xz','','e')
let compress= "xz -- ".shellescape(tarfile,0) let compress= "xz -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">") " call Decho("compress<".compress.">")
elseif tarfile =~# '\.zst'
call system("zstd --decompress -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.zst','','e')
let compress= "zstd -- ".shellescape(tarfile,0)
elseif tarfile =~# '\.lzma' elseif tarfile =~# '\.lzma'
call system("lzma -d -- ".shellescape(tarfile,0)) call system("lzma -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.lzma','','e') let tarfile = substitute(tarfile,'\.lzma','','e')
@@ -475,7 +427,6 @@ fun! tar#Write(fname)
if v:shell_error != 0 if v:shell_error != 0
redraw! redraw!
" call Decho("***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname)
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
else else
@@ -508,11 +459,10 @@ fun! tar#Write(fname)
endif endif
" delete old file from tarfile " delete old file from tarfile
" call Decho("system(".g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")") " call Decho("system(".g:tar_cmd." --delete -f ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")")
call system(g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) call system(g:tar_cmd." --delete -f ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
if v:shell_error != 0 if v:shell_error != 0
redraw! redraw!
" call Decho("***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname))
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
else else
@@ -521,7 +471,6 @@ fun! tar#Write(fname)
call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
if v:shell_error != 0 if v:shell_error != 0
redraw! redraw!
" call Decho("***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname))
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
elseif exists("compress") elseif exists("compress")
" call Decho("call system(".compress.")") " call Decho("call system(".compress.")")
@@ -537,11 +486,11 @@ fun! tar#Write(fname)
if s:tblfile_{winnr()} =~ '^\a\+://' if s:tblfile_{winnr()} =~ '^\a\+://'
" call Decho("handle writing <".tarfile."> across network to <".s:tblfile_{winnr()}.">") " call Decho("handle writing <".tarfile."> across network to <".s:tblfile_{winnr()}.">")
let tblfile= s:tblfile_{winnr()} let tblfile= s:tblfile_{winnr()}
1split|noswapfile enew 1split|enew
let binkeep= &l:binary let binkeep= &l:binary
let eikeep = &ei let eikeep = &ei
set binary ei=all set binary ei=all
exe "noswapfile e! ".fnameescape(tarfile) exe "e! ".fnameescape(tarfile)
call netrw#NetWrite(tblfile) call netrw#NetWrite(tblfile)
let &ei = eikeep let &ei = eikeep
let &l:binary = binkeep let &l:binary = binkeep
@@ -575,7 +524,7 @@ fun! tar#Diff(userfname,fname)
" sets up b:tardiff_otherbuf variables so each buffer knows about the other (for closing purposes) " sets up b:tardiff_otherbuf variables so each buffer knows about the other (for closing purposes)
diffthis diffthis
wincmd v wincmd v
exe "noswapfile e ".fnameescape(fname) exe "e ".fnameescape(fname)
diffthis diffthis
else else
redraw! redraw!
@@ -584,141 +533,6 @@ fun! tar#Diff(userfname,fname)
" call Dret("tar#Diff") " call Dret("tar#Diff")
endfun endfun
" ---------------------------------------------------------------------
" tar#Extract: extract a file from a (possibly compressed) tar archive {{{2
fun! tar#Extract()
" call Dfunc("tar#Extract()")
let repkeep= &report
set report=10
let fname= getline(".")
" call Decho("fname<".fname.">")
if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-'
redraw!
echohl WarningMsg | echo '***warning*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"'
" call Dret('tar#BrowseSelect : rejecting tarfile member<'.fname.'> because of embedded "-"')
return
endif
" sanity check
if fname =~ '^"'
let &report= repkeep
" call Dret("TarBrowseSelect")
return
endif
let tarball = expand("%")
" call Decho("tarball<".tarball.">")
let tarbase = substitute(tarball,'\..*$','','')
" call Decho("tarbase<".tarbase.">")
let extractcmd= netrw#WinPath(g:tar_extractcmd)
if filereadable(tarbase.".tar")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".tar ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd." ".tarbase.".tar ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
elseif filereadable(tarbase.".tgz")
let extractcmd= substitute(extractcmd,"-","-z","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tgz ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".tgz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tgz ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd."t ".tarbase.".tgz ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
elseif filereadable(tarbase.".tar.gz")
let extractcmd= substitute(extractcmd,"-","-z","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.gz ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".tar.gz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.gz ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd." ".tarbase.".tar.gz ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
elseif filereadable(tarbase.".tbz")
let extractcmd= substitute(extractcmd,"-","-j","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tbz ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".tbz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tbz ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd."j ".tarbase.".tbz ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
elseif filereadable(tarbase.".tar.bz2")
let extractcmd= substitute(extractcmd,"-","-j","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.bz2 ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".tar.bz2 ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tar.bz2 ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd."j ".tarbase.".tar.bz2 ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
elseif filereadable(tarbase.".txz")
let extractcmd= substitute(extractcmd,"-","-J","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".txz ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd." ".tarbase.".txz ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
elseif filereadable(tarbase.".tar.xz")
let extractcmd= substitute(extractcmd,"-","-J","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
elseif filereadable(tarbase.".tzs")
let extractcmd= substitute(extractcmd,"-","--zstd","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tzs ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
elseif filereadable(tarbase.".tar.zst")
let extractcmd= substitute(extractcmd,"-","--zstd","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname).")")
call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
endif
" restore option
let &report= repkeep
" call Dret("tar#Extract")
endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" s:Rmdir: {{{2 " s:Rmdir: {{{2
fun! s:Rmdir(fname) fun! s:Rmdir(fname)
@@ -773,7 +587,10 @@ fun! tar#Vimuntar(...)
" if necessary, decompress the tarball; then, extract it " if necessary, decompress the tarball; then, extract it
if tartail =~ '\.tgz' if tartail =~ '\.tgz'
if executable("gunzip") let gzip_command = s:get_gzip_command(tarfile)
if executable(gzip_command)
silent exe "!" . gzip_command . " -d ".shellescape(tartail)
elseif executable("gunzip")
silent exe "!gunzip ".shellescape(tartail) silent exe "!gunzip ".shellescape(tartail)
elseif executable("gzip") elseif executable("gzip")
silent exe "!gzip -d ".shellescape(tartail) silent exe "!gzip -d ".shellescape(tartail)
@@ -811,6 +628,28 @@ fun! tar#Vimuntar(...)
" call Dret("tar#Vimuntar") " call Dret("tar#Vimuntar")
endfun endfun
func s:get_gzip_command(file)
" Try using the "file" command to get the actual compression type, since
" there is no standard way for the naming: ".tgz", ".tbz", ".txz", etc.
" If the "file" command doesn't work fall back to just using the file name.
if a:file =~# 'z$'
let filetype = system('file ' . a:file)
if filetype =~ 'bzip2 compressed' && executable('bzip2')
return 'bzip2'
endif
if filetype =~ 'XZ compressed' && executable('xz')
return 'xz'
endif
endif
if a:file =~# 'bz2$'
return 'bzip2'
endif
if a:file =~# 'xz$'
return 'xz'
endif
return 'gzip'
endfunc
" ===================================================================== " =====================================================================
" Modelines And Restoration: {{{1 " Modelines And Restoration: {{{1
let &cpo= s:keepcpo let &cpo= s:keepcpo

View File

@@ -1,6 +1,6 @@
" Vim autoload file for the tohtml plugin. " Vim autoload file for the tohtml plugin.
" Maintainer: Ben Fritz <fritzophrenic@gmail.com> " Maintainer: Ben Fritz <fritzophrenic@gmail.com>
" Last Change: 2019 Aug 16 " Last Change: 2018 Nov 11
" "
" Additional contributors: " Additional contributors:
" "
@@ -364,7 +364,6 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
let body_line = '' let body_line = ''
let html = [] let html = []
let s:html5 = 0
if s:settings.use_xhtml if s:settings.use_xhtml
call add(html, xml_line) call add(html, xml_line)
endif endif
@@ -372,9 +371,8 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
call add(html, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">") call add(html, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
call add(html, '<html xmlns="http://www.w3.org/1999/xhtml">') call add(html, '<html xmlns="http://www.w3.org/1999/xhtml">')
elseif s:settings.use_css && !s:settings.no_pre elseif s:settings.use_css && !s:settings.no_pre
call add(html, "<!DOCTYPE html>") call add(html, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">")
call add(html, '<html>') call add(html, '<html>')
let s:html5 = 1
else else
call add(html, '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"') call add(html, '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"')
call add(html, ' "http://www.w3.org/TR/html4/loose.dtd">') call add(html, ' "http://www.w3.org/TR/html4/loose.dtd">')
@@ -385,11 +383,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
" include encoding as close to the top as possible, but only if not already " include encoding as close to the top as possible, but only if not already
" contained in XML information " contained in XML information
if s:settings.encoding != "" && !s:settings.use_xhtml if s:settings.encoding != "" && !s:settings.use_xhtml
if s:html5 call add(html, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:settings.encoding . '"' . tag_close)
call add(html, '<meta charset="' . s:settings.encoding . '"' . tag_close)
else
call add(html, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . s:settings.encoding . '"' . tag_close)
endif
endif endif
call add(html, '<title>diff</title>') call add(html, '<title>diff</title>')
@@ -398,7 +392,6 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
call add(html, '<meta name="settings" content="'. call add(html, '<meta name="settings" content="'.
\ join(filter(keys(s:settings),'s:settings[v:val]'),','). \ join(filter(keys(s:settings),'s:settings[v:val]'),',').
\ ',prevent_copy='.s:settings.prevent_copy. \ ',prevent_copy='.s:settings.prevent_copy.
\ ',use_input_for_pc='.s:settings.use_input_for_pc.
\ '"'.tag_close) \ '"'.tag_close)
call add(html, '<meta name="colorscheme" content="'. call add(html, '<meta name="colorscheme" content="'.
\ (exists('g:colors_name') \ (exists('g:colors_name')
@@ -407,8 +400,16 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
call add(html, '</head>') call add(html, '</head>')
let body_line_num = len(html) let body_line_num = len(html)
call add(html, '<body'.(s:settings.line_ids ? ' onload="JumpToLine();"' : '').'>') if !empty(s:settings.prevent_copy)
call add(html, "<table ".(s:settings.use_css? "" : "border='1' width='100%' ")."id='vimCodeElement".s:settings.id_suffix."'>") call add(html, "<body onload='FixCharWidth();".(s:settings.line_ids ? " JumpToLine();" : "")."'>")
call add(html, "<!-- hidden divs used by javascript to get the width of a char -->")
call add(html, "<div id='oneCharWidth'>0</div>")
call add(html, "<div id='oneInputWidth'><input size='1' value='0'".tag_close."</div>")
call add(html, "<div id='oneEmWidth' style='width: 1em;'></div>")
else
call add(html, '<body'.(s:settings.line_ids ? ' onload="JumpToLine();"' : '').'>')
endif
call add(html, "<table border='1' width='100%' id='vimCodeElement".s:settings.id_suffix."'>")
call add(html, '<tr>') call add(html, '<tr>')
for buf in a:win_list for buf in a:win_list
@@ -442,7 +443,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
" Grab the style information. Some of this will be duplicated so only insert " Grab the style information. Some of this will be duplicated so only insert
" it if it's not already there. {{{ " it if it's not already there. {{{
1 1
let style_start = search('^<style\( type="text/css"\)\?>') let style_start = search('^<style type="text/css">')
1 1
let style_end = search('^</style>') let style_end = search('^</style>')
if style_start > 0 && style_end > 0 if style_start > 0 && style_end > 0
@@ -480,7 +481,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
" TODO: restore using grabbed lines if undolevel is 1? " TODO: restore using grabbed lines if undolevel is 1?
normal! 2u normal! 2u
if s:settings.use_css if s:settings.use_css
call add(html, '<td><div>') call add(html, '<td valign="top"><div>')
elseif s:settings.use_xhtml elseif s:settings.use_xhtml
call add(html, '<td nowrap="nowrap" valign="top"><div>') call add(html, '<td nowrap="nowrap" valign="top"><div>')
else else
@@ -514,13 +515,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
let name = substitute(name, '\d*\.x\?html$', '', '') . i . '.' . fnamemodify(copy(name), ":t:e") let name = substitute(name, '\d*\.x\?html$', '', '') . i . '.' . fnamemodify(copy(name), ":t:e")
let i += 1 let i += 1
endwhile endwhile
let s:ei_sav = &eventignore
set eventignore+=FileType
exe "topleft new " . name exe "topleft new " . name
let &eventignore=s:ei_sav
unlet s:ei_sav
setlocal modifiable setlocal modifiable
" just in case some user autocmd creates content in the new buffer, make sure " just in case some user autocmd creates content in the new buffer, make sure
@@ -549,7 +544,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
" add required javascript in reverse order so we can just call append again " add required javascript in reverse order so we can just call append again
" and again without adjusting {{{ " and again without adjusting {{{
let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids || !empty(s:settings.prevent_copy)
" insert script closing tag if needed " insert script closing tag if needed
if s:uses_script if s:uses_script
@@ -560,6 +555,31 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
\ ]) \ ])
endif endif
" insert script which corrects the size of small input elements in
" prevent_copy mode. See 2html.vim for details on why this is needed and how
" it works.
if !empty(s:settings.prevent_copy)
call append(style_start, [
\ '',
\ '/* simulate a "ch" unit by asking the browser how big a zero character is */',
\ 'function FixCharWidth() {',
\ ' /* get the hidden element which gives the width of a single character */',
\ ' var goodWidth = document.getElementById("oneCharWidth").clientWidth;',
\ ' /* get all input elements, we''ll filter on class later */',
\ ' var inputTags = document.getElementsByTagName("input");',
\ ' var ratio = 5;',
\ ' var inputWidth = document.getElementById("oneInputWidth").clientWidth;',
\ ' var emWidth = document.getElementById("oneEmWidth").clientWidth;',
\ ' if (inputWidth > goodWidth) {',
\ ' while (ratio < 100*goodWidth/emWidth && ratio < 100) {',
\ ' ratio += 5;',
\ ' }',
\ ' document.getElementById("vimCodeElement'.s:settings.id_suffix.'").className = "em"+ratio;',
\ ' }',
\ '}'
\ ])
endif
" insert javascript to get IDs from line numbers, and to open a fold before " insert javascript to get IDs from line numbers, and to open a fold before
" jumping to any lines contained therein " jumping to any lines contained therein
if s:settings.line_ids if s:settings.line_ids
@@ -639,9 +659,10 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
endif endif
if s:uses_script if s:uses_script
" insert script tag if needed " insert script tag; javascript is always needed for the line number
" normalization for URL hashes
call append(style_start, [ call append(style_start, [
\ "<script" . (s:html5 ? "" : " type='text/javascript'") . ">", \ "<script type='text/javascript'>",
\ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"]) \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
endif endif
@@ -652,13 +673,11 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
" is pretty useless for really long lines. {{{ " is pretty useless for really long lines. {{{
if s:settings.use_css if s:settings.use_css
call append(style_start, call append(style_start,
\ ['<style' . (s:html5 ? '' : 'type="text/css"') . '>']+ \ ['<style type="text/css">']+
\ style+ \ style+
\ [ s:settings.use_xhtml ? '' : '<!--', \ [ s:settings.use_xhtml ? '' : '<!--',
\ 'table { table-layout: fixed; }', \ 'table { table-layout: fixed; }',
\ 'html, body, table, tbody { width: 100%; margin: 0; padding: 0; }', \ 'html, body, table, tbody { width: 100%; margin: 0; padding: 0; }',
\ 'table, td, th { border: 1px solid; }',
\ 'td { vertical-align: top; }',
\ 'th, td { width: '.printf("%.1f",100.0/len(a:win_list)).'%; }', \ 'th, td { width: '.printf("%.1f",100.0/len(a:win_list)).'%; }',
\ 'td div { overflow: auto; }', \ 'td div { overflow: auto; }',
\ s:settings.use_xhtml ? '' : '-->', \ s:settings.use_xhtml ? '' : '-->',
@@ -701,22 +720,21 @@ func! tohtml#GetUserSettings() "{{{
endif endif
" get current option settings with appropriate defaults {{{ " get current option settings with appropriate defaults {{{
call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") ) call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") )
call tohtml#GetOption(user_settings, 'diff_one_file', 0 ) call tohtml#GetOption(user_settings, 'diff_one_file', 0 )
call tohtml#GetOption(user_settings, 'number_lines', &number ) call tohtml#GetOption(user_settings, 'number_lines', &number )
call tohtml#GetOption(user_settings, 'pre_wrap', &wrap ) call tohtml#GetOption(user_settings, 'pre_wrap', &wrap )
call tohtml#GetOption(user_settings, 'use_css', 1 ) call tohtml#GetOption(user_settings, 'use_css', 1 )
call tohtml#GetOption(user_settings, 'ignore_conceal', 0 ) call tohtml#GetOption(user_settings, 'ignore_conceal', 0 )
call tohtml#GetOption(user_settings, 'ignore_folding', 0 ) call tohtml#GetOption(user_settings, 'ignore_folding', 0 )
call tohtml#GetOption(user_settings, 'dynamic_folds', 0 ) call tohtml#GetOption(user_settings, 'dynamic_folds', 0 )
call tohtml#GetOption(user_settings, 'no_foldcolumn', user_settings.ignore_folding) call tohtml#GetOption(user_settings, 'no_foldcolumn', user_settings.ignore_folding)
call tohtml#GetOption(user_settings, 'hover_unfold', 0 ) call tohtml#GetOption(user_settings, 'hover_unfold', 0 )
call tohtml#GetOption(user_settings, 'no_pre', 0 ) call tohtml#GetOption(user_settings, 'no_pre', 0 )
call tohtml#GetOption(user_settings, 'no_invalid', 0 ) call tohtml#GetOption(user_settings, 'no_invalid', 0 )
call tohtml#GetOption(user_settings, 'whole_filler', 0 ) call tohtml#GetOption(user_settings, 'whole_filler', 0 )
call tohtml#GetOption(user_settings, 'use_xhtml', 0 ) call tohtml#GetOption(user_settings, 'use_xhtml', 0 )
call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines ) call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines )
call tohtml#GetOption(user_settings, 'use_input_for_pc', 'fallback')
" }}} " }}}
" override those settings that need it {{{ " override those settings that need it {{{
@@ -850,16 +868,6 @@ func! tohtml#GetUserSettings() "{{{
let user_settings.no_invalid = 0 let user_settings.no_invalid = 0
endif endif
" enforce valid values for use_input_for_pc
if user_settings.use_input_for_pc !~# 'fallback\|none\|all'
let user_settings.use_input_for_pc = 'fallback'
echohl WarningMsg
echomsg '2html: "' . g:html_use_input_for_pc . '" is not valid for g:html_use_input_for_pc'
echomsg '2html: defaulting to "' . user_settings.use_input_for_pc . '"'
echohl None
sleep 3
endif
if exists('g:html_id_expr') if exists('g:html_id_expr')
let user_settings.id_suffix = eval(g:html_id_expr) let user_settings.id_suffix = eval(g:html_id_expr)
if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$' if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$'

View File

@@ -104,10 +104,6 @@ function! tutor#CheckLine(line)
if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect') if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect')
let bufn = bufnr('%') let bufn = bufnr('%')
let ctext = getline(a:line) let ctext = getline(a:line)
let signs = sign_getplaced('.', {'lnum': a:line})[0].signs
if !empty(signs)
call sign_unplace('', {'id': signs[0].id})
endif
if b:tutor_metadata['expect'][string(a:line)] == -1 || ctext ==# b:tutor_metadata['expect'][string(a:line)] if b:tutor_metadata['expect'][string(a:line)] == -1 || ctext ==# b:tutor_metadata['expect'][string(a:line)]
exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorok buffer=".bufn exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorok buffer=".bufn
else else
@@ -124,12 +120,6 @@ function! s:Locale()
let l:lang = v:lang let l:lang = v:lang
elseif $LC_ALL =~ '\a\a' elseif $LC_ALL =~ '\a\a'
let l:lang = $LC_ALL let l:lang = $LC_ALL
elseif $LC_MESSAGES =~ '\a\a' || $LC_MESSAGES ==# "C"
" LC_MESSAGES=C can be used to explicitly ask for English messages while
" keeping LANG non-English; don't set l:lang then.
if $LC_MESSAGES =~ '\a\a'
let l:lang = $LC_MESSAGES
endif
elseif $LANG =~ '\a\a' elseif $LANG =~ '\a\a'
let l:lang = $LANG let l:lang = $LANG
else else

View File

@@ -1,6 +1,6 @@
" Vim plugin for formatting XML " Vim plugin for formatting XML
" Last Change: 2020 Jan 06 " Last Change: Thu, 07 Dec 2018
" Version: 0.3 " Version: 0.1
" Author: Christian Brabandt <cb@256bit.org> " Author: Christian Brabandt <cb@256bit.org>
" Repository: https://github.com/chrisbra/vim-xml-ftplugin " Repository: https://github.com/chrisbra/vim-xml-ftplugin
" License: VIM License " License: VIM License
@@ -15,92 +15,51 @@ let s:keepcpo = &cpo
set cpo&vim set cpo&vim
" Main function: Format the input {{{1 " Main function: Format the input {{{1
func! xmlformat#Format() abort func! xmlformat#Format()
" only allow reformatting through the gq command " only allow reformatting through the gq command
" (e.g. Vim is in normal mode) " (e.g. Vim is in normal mode)
if mode() != 'n' if mode() != 'n'
" do not fall back to internal formatting " do not fall back to internal formatting
return 0 return 0
endif endif
let count_orig = v:count
let sw = shiftwidth() let sw = shiftwidth()
let prev = prevnonblank(v:lnum-1) let prev = prevnonblank(v:lnum-1)
let s:indent = indent(prev)/sw let s:indent = indent(prev)/sw
let result = [] let result = []
let lastitem = prev ? getline(prev) : '' let lastitem = prev ? getline(prev) : ''
let is_xml_decl = 0 let is_xml_decl = 0
" go through every line, but don't join all content together and join it " split on `<`, but don't split on very first opening <
" back. We might lose empty lines for item in split(join(getline(v:lnum, (v:lnum + v:count - 1))), '.\@<=[>]\zs')
let list = getline(v:lnum, (v:lnum + count_orig - 1)) if s:EndTag(item)
let current = 0 let s:indent = s:DecreaseIndent()
for line in list call add(result, s:Indent(item))
" Keep empty input lines? elseif s:EmptyTag(lastitem)
if empty(line) call add(result, s:Indent(item))
call add(result, '') elseif s:StartTag(lastitem) && s:IsTag(item)
continue let s:indent += 1
elseif line !~# '<[/]\?[^>]*>' call add(result, s:Indent(item))
let nextmatch = match(list, '<[/]\?[^>]*>', current) else
if nextmatch > -1 if !s:IsTag(item)
let line .= ' '. join(list[(current + 1):(nextmatch-1)], " ") " Simply split on '<'
call remove(list, current+1, nextmatch-1) let t=split(item, '.<\@=\zs')
let s:indent+=1
call add(result, s:Indent(t[0]))
let s:indent = s:DecreaseIndent()
call add(result, s:Indent(t[1]))
else
call add(result, s:Indent(item))
endif endif
endif endif
" split on `>`, but don't split on very first opening < let lastitem = item
" this means, items can be like ['<tag>', 'tag content</tag>'] endfor
for item in split(line, '.\@<=[>]\zs')
if s:EndTag(item)
call s:DecreaseIndent()
call add(result, s:Indent(item))
elseif s:EmptyTag(lastitem)
call add(result, s:Indent(item))
elseif s:StartTag(lastitem) && s:IsTag(item)
let s:indent += 1
call add(result, s:Indent(item))
else
if !s:IsTag(item)
" Simply split on '<', if there is one,
" but reformat according to &textwidth
let t=split(item, '.<\@=\zs')
" if the content fits well within a single line, add it there if !empty(result)
" so that the output looks like this: exe v:lnum. ",". (v:lnum + v:count - 1). 'd'
"
" <foobar>1</foobar>
if s:TagContent(lastitem) is# s:TagContent(t[1]) && strlen(result[-1]) + strlen(item) <= s:Textwidth()
let result[-1] .= item
let lastitem = t[1]
continue
endif
" t should only contain 2 items, but just be safe here
if s:IsTag(lastitem)
let s:indent+=1
endif
let result+=s:FormatContent([t[0]])
if s:EndTag(t[1])
call s:DecreaseIndent()
endif
"for y in t[1:]
let result+=s:FormatContent(t[1:])
"endfor
else
call add(result, s:Indent(item))
endif
endif
let lastitem = item
endfor
let current += 1
endfor
if !empty(result)
let lastprevline = getline(v:lnum + count_orig)
let delete_lastline = v:lnum + count_orig - 1 == line('$')
exe v:lnum. ",". (v:lnum + count_orig - 1). 'd'
call append(v:lnum - 1, result) call append(v:lnum - 1, result)
" Might need to remove the last line, if it became empty because of the " Might need to remove the last line, if it became empty because of the
" append() call " append() call
let last = v:lnum + len(result) let last = v:lnum + len(result)
" do not use empty(), it returns true for `empty(0)` if getline(last) is ''
if getline(last) is '' && lastprevline is '' && delete_lastline
exe last. 'd' exe last. 'd'
endif endif
endif endif
@@ -109,15 +68,15 @@ func! xmlformat#Format() abort
return 0 return 0
endfunc endfunc
" Check if given tag is XML Declaration header {{{1 " Check if given tag is XML Declaration header {{{1
func! s:IsXMLDecl(tag) abort func! s:IsXMLDecl(tag)
return a:tag =~? '^\s*<?xml\s\?\%(version="[^"]*"\)\?\s\?\%(encoding="[^"]*"\)\? ?>\s*$' return a:tag =~? '^\s*<?xml\s\?\%(version="[^"]*"\)\?\s\?\%(encoding="[^"]*"\)\? ?>\s*$'
endfunc endfunc
" Return tag indented by current level {{{1 " Return tag indented by current level {{{1
func! s:Indent(item) abort func! s:Indent(item)
return repeat(' ', shiftwidth()*s:indent). s:Trim(a:item) return repeat(' ', shiftwidth()*s:indent). s:Trim(a:item)
endfu endfu
" Return item trimmed from leading whitespace {{{1 " Return item trimmed from leading whitespace {{{1
func! s:Trim(item) abort func! s:Trim(item)
if exists('*trim') if exists('*trim')
return trim(a:item) return trim(a:item)
else else
@@ -125,77 +84,30 @@ func! s:Trim(item) abort
endif endif
endfunc endfunc
" Check if tag is a new opening tag <tag> {{{1 " Check if tag is a new opening tag <tag> {{{1
func! s:StartTag(tag) abort func! s:StartTag(tag)
let is_comment = s:IsComment(a:tag) let is_comment = s:IsComment(a:tag)
return a:tag =~? '^\s*<[^/?]' && !is_comment return a:tag =~? '^\s*<[^/?]' && !is_comment
endfunc endfunc
" Check if tag is a Comment start {{{1 func! s:IsComment(tag)
func! s:IsComment(tag) abort
return a:tag =~? '<!--' return a:tag =~? '<!--'
endfunc endfunc
" Remove one level of indentation {{{1 " Remove one level of indentation {{{1
func! s:DecreaseIndent() abort func! s:DecreaseIndent()
let s:indent = (s:indent > 0 ? s:indent - 1 : 0) return (s:indent > 0 ? s:indent - 1 : 0)
endfunc endfunc
" Check if tag is a closing tag </tag> {{{1 " Check if tag is a closing tag </tag> {{{1
func! s:EndTag(tag) abort func! s:EndTag(tag)
return a:tag =~? '^\s*</' return a:tag =~? '^\s*</'
endfunc endfunc
" Check that the tag is actually a tag and not {{{1 " Check that the tag is actually a tag and not {{{1
" something like "foobar</foobar>" " something like "foobar</foobar>"
func! s:IsTag(tag) abort func! s:IsTag(tag)
return s:Trim(a:tag)[0] == '<' return s:Trim(a:tag)[0] == '<'
endfunc endfunc
" Check if tag is empty <tag/> {{{1 " Check if tag is empty <tag/> {{{1
func! s:EmptyTag(tag) abort func! s:EmptyTag(tag)
return a:tag =~ '/>\s*$' return a:tag =~ '/>\s*$'
endfunc endfunc
func! s:TagContent(tag) abort "{{{1
" Return content of a tag
return substitute(a:tag, '^\s*<[/]\?\([^>]*\)>\s*$', '\1', '')
endfunc
func! s:Textwidth() abort "{{{1
" return textwidth (or 80 if not set)
return &textwidth == 0 ? 80 : &textwidth
endfunc
" Format input line according to textwidth {{{1
func! s:FormatContent(list) abort
let result=[]
let limit = s:Textwidth()
let column=0
let idx = -1
let add_indent = 0
let cnt = 0
for item in a:list
for word in split(item, '\s\+\S\+\zs')
if match(word, '^\s\+$') > -1
" skip empty words
continue
endif
let column += strdisplaywidth(word, column)
if match(word, "^\\s*\n\\+\\s*$") > -1
call add(result, '')
let idx += 1
let column = 0
let add_indent = 1
elseif column > limit || cnt == 0
let add = s:Indent(s:Trim(word))
call add(result, add)
let column = strdisplaywidth(add)
let idx += 1
else
if add_indent
let result[idx] = s:Indent(s:Trim(word))
else
let result[idx] .= ' '. s:Trim(word)
endif
let add_indent = 0
endif
let cnt += 1
endfor
endfor
return result
endfunc
" Restoration And Modelines: {{{1 " Restoration And Modelines: {{{1
let &cpo= s:keepcpo let &cpo= s:keepcpo
unlet s:keepcpo unlet s:keepcpo

View File

@@ -1,10 +1,10 @@
" zip.vim: Handles browsing zipfiles " zip.vim: Handles browsing zipfiles
" AUTOLOAD PORTION " AUTOLOAD PORTION
" Date: Jan 07, 2020 " Date: Sep 13, 2016
" Version: 31 " Version: 28
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" License: Vim License (see vim's :help license) " License: Vim License (see vim's :help license)
" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 " Copyright: Copyright (C) 2005-2013 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@@ -20,7 +20,7 @@
if &cp || exists("g:loaded_zip") if &cp || exists("g:loaded_zip")
finish finish
endif endif
let g:loaded_zip= "v31" let g:loaded_zip= "v28"
if v:version < 702 if v:version < 702
echohl WarningMsg echohl WarningMsg
echo "***warning*** this version of zip needs vim 7.2 or later" echo "***warning*** this version of zip needs vim 7.2 or later"
@@ -65,10 +65,10 @@ endif
" zip#Browse: {{{2 " zip#Browse: {{{2
fun! zip#Browse(zipfile) fun! zip#Browse(zipfile)
" call Dfunc("zip#Browse(zipfile<".a:zipfile.">)") " call Dfunc("zip#Browse(zipfile<".a:zipfile.">)")
" sanity check: insure that the zipfile has "PK" as its first two letters " sanity check: ensure that the zipfile has "PK" as its first two letters
" (zipped files have a leading PK as a "magic cookie") " (zipped files have a leading PK as a "magic cookie")
if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK' if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK'
exe "noswapfile noautocmd noswapfile e ".fnameescape(a:zipfile) exe "noautocmd e ".fnameescape(a:zipfile)
" call Dret("zip#Browse : not a zipfile<".a:zipfile.">") " call Dret("zip#Browse : not a zipfile<".a:zipfile.">")
return return
" else " Decho " else " Decho
@@ -141,11 +141,8 @@ fun! zip#Browse(zipfile)
" Maps associated with zip plugin " Maps associated with zip plugin
setlocal noma nomod ro setlocal noma nomod ro
noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr> noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr>
noremap <silent> <buffer> x :call zip#Extract()<cr> noremap <silent> <buffer> x :call zip#Extract()<cr>
if &mouse != ""
noremap <silent> <buffer> <leftmouse> <leftmouse>:call <SID>ZipBrowseSelect()<cr>
endif
let &report= repkeep let &report= repkeep
" call Dret("zip#Browse") " call Dret("zip#Browse")
@@ -178,17 +175,17 @@ fun! s:ZipBrowseSelect()
" get zipfile to the new-window " get zipfile to the new-window
let zipfile = b:zipfile let zipfile = b:zipfile
let curfile = expand("%") let curfile= expand("%")
" call Decho("zipfile<".zipfile.">") " call Decho("zipfile<".zipfile.">")
" call Decho("curfile<".curfile.">") " call Decho("curfile<".curfile.">")
noswapfile new new
if !exists("g:zip_nomax") || g:zip_nomax == 0 if !exists("g:zip_nomax") || g:zip_nomax == 0
wincmd _ wincmd _
endif endif
let s:zipfile_{winnr()}= curfile let s:zipfile_{winnr()}= curfile
" call Decho("exe e ".fnameescape("zipfile:".zipfile.'::'.fname)) " call Decho("exe e ".fnameescape("zipfile:".zipfile.'::'.fname))
exe "noswapfile e ".fnameescape("zipfile:".zipfile.'::'.fname) exe "e ".fnameescape("zipfile:".zipfile.'::'.fname)
filetype detect filetype detect
let &report= repkeep let &report= repkeep
@@ -342,7 +339,7 @@ fun! zip#Write(fname)
let binkeep= &binary let binkeep= &binary
let eikeep = &ei let eikeep = &ei
set binary ei=all set binary ei=all
exe "noswapfile e! ".fnameescape(zipfile) exe "e! ".fnameescape(zipfile)
call netrw#NetWrite(netzipfile) call netrw#NetWrite(netzipfile)
let &ei = eikeep let &ei = eikeep
let &binary = binkeep let &binary = binkeep

View File

@@ -67,7 +67,7 @@ You can use ":highlight" to find out the current colors. Exception: the
ctermfg and ctermbg values are numbers, which are only valid for the current ctermfg and ctermbg values are numbers, which are only valid for the current
terminal. Use the color names instead. See ":help cterm-colors". terminal. Use the color names instead. See ":help cterm-colors".
The default color settings can be found in the source file src/highlight.c. The default color settings can be found in the source file src/syntax.c.
Search for "highlight_init". Search for "highlight_init".
If you think you have a color scheme that is good enough to be used by others, If you think you have a color scheme that is good enough to be used by others,

View File

@@ -1,7 +1,7 @@
" Vim compiler file " Vim compiler file
" Compiler: Checkstyle " Compiler: Checkstyle
" Maintainer: Doug Kearns <dougkearns@gmail.com> " Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2020 Aug 2 " Last Change: 2013 Jun 26
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -12,18 +12,8 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args> command -nargs=* CompilerSet setlocal <args>
endif endif
let s:cpo_save = &cpo CompilerSet makeprg=java\ com.puppycrawl.tools.checkstyle.Main\ -f\ plain
set cpo&vim
" CompilerSet makeprg=java\ com.puppycrawl.tools.checkstyle.Main\ -f\ plain\ -c\ /sun_checks.xml " sample error: WebTable.java:282: '+=' is not preceded with whitespace.
" CompilerSet makeprg=java\ -jar\ checkstyle-X.XX-all.jar\ -f\ plain\ -c\ /sun_checks.xml " WebTable.java:201:1: '{' should be on the previous line.
CompilerSet errorformat=%f:%l:%v:\ %m,%f:%l:\ %m,%-G%.%#
CompilerSet makeprg=checkstyle\ -f\ plain
CompilerSet errorformat=[%tRROR]\ %f:%l:%v:\ %m,
\[%tARN]\ %f:%l:%v:\ %m,
\[%tRROR]\ %f:%l:\ %m,
\[%tARN]\ %f:%l:\ %m,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,26 +0,0 @@
" Vim compiler file
" Compiler: Critical Mass Modula-3 Compiler
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2021 Apr 08
if exists("current_compiler")
finish
endif
let current_compiler = "cm3"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
" TODO: better handling of Quake errors
CompilerSet makeprg=cm3
CompilerSet errorformat=%D---\ building\ in\ %f\ ---,
\%W\"%f\"\\,\ line\ %l:\ warning:\ %m,
\%E\"%f\"\\,\ line\ %l:\ %m,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,26 +0,0 @@
" Vim compiler file
" Compiler: Dart VM
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 May 08
if exists("current_compiler")
finish
endif
let current_compiler = "dart"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=dart
CompilerSet errorformat=%E%f:%l:%c:\ Error:\ %m,
\%CTry\ %.%#,
\%Z\ %#^%\\+,
\%C%.%#,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,28 +0,0 @@
" Vim compiler file
" Compiler: Dart to JavaScript Compiler
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 May 08
if exists("current_compiler")
finish
endif
let current_compiler = "dart2js"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=dart2js
CompilerSet errorformat=%E%f:%l:%c:,
\%-GError:\ Compilation\ failed.,
\%CError:\ %m,
\%Z\ %#^%\\+,
\%C%.%#,
\%trror:\ %m,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,28 +0,0 @@
" Vim compiler file
" Compiler: Dart to Native Compiler
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 May 08
if exists("current_compiler")
finish
endif
let current_compiler = "dart2native"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=dart2native
CompilerSet errorformat=%E%f:%l:%c:\ Error:\ %m,
\%CTry\ %.%#,
\%Z\ %#^%\\+,
\%Z%$,
\%C%.%#,
\%E%f:\ %trror:\ %m,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,23 +0,0 @@
" Vim compiler file
" Compiler: Dart Analyzer
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 May 08
if exists("current_compiler")
finish
endif
let current_compiler = "dartanalyzer"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=dartanalyzer\ --format\ machine
CompilerSet errorformat=%t%\\w%\\+\|%\\w%\\+\|%\\w%\\+\|%f\|%l\|%c\|%\\d%\\+\|%m,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,28 +0,0 @@
" Vim compiler file
" Compiler: Dart Development Compiler
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 May 08
if exists("current_compiler")
finish
endif
let current_compiler = "dartdevc"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=dartdevc
CompilerSet errorformat=%E%f:%l:%c:\ Error:\ %m,
\%CTry\ %.%#,
\%Z\ %#^%\\+,
\%Z%$,
\%C%.%#,
\%E%f:\ %trror:\ %m,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,26 +0,0 @@
" Vim compiler file
" Compiler: Dart Documentation Generator
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 May 08
if exists("current_compiler")
finish
endif
let current_compiler = "dartdoc"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=dartdoc
CompilerSet errorformat=\ \ %tarning:\ %m,
\\ \ %trror:\ %m,
\%+EGeneration\ failed:\ %m,
\%+ISuccess!\ Docs\ generated\ into\ %f,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,25 +0,0 @@
" Vim compiler file
" Compiler: Dart Formatter
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 May 08
if exists("current_compiler")
finish
endif
let current_compiler = "dartfmt"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=dartfmt
CompilerSet errorformat=%Eline\ %l\\,\ column\ %c\ of\ %f:\ %m,
\%Z\ %\\{3}│\ %\\+^%\\+,
\%C%.%#,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,16 +0,0 @@
" Vim compiler file
" Compiler: ESLint for JavaScript
" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
" Last Change: 2020 August 20
if exists("current_compiler")
finish
endif
let current_compiler = "eslint"
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=npx\ eslint\ --format\ compact
CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m,%-G%.%#

Some files were not shown because too many files have changed in this diff Show More