diff --git a/.clang-tidy b/.clang-tidy index 6776d86d215c9b..28115ae0b18140 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -14,6 +14,7 @@ Checks: > section for it, -bugprone-assignment-in-if-condition, -bugprone-implicit-widening-of-multiplication-result, + -bugprone-multi-level-implicit-pointer-conversion, -bugprone-not-null-terminated-result, -bugprone-suspicious-memory-comparison, -bugprone-switch-missing-default-case, @@ -32,7 +33,9 @@ Checks: > -hicpp-signed-bitwise, -misc-unused-parameters, -modernize-macro-to-enum, + -readability-avoid-nested-conditional-operator, -readability-else-after-return, + -readability-enum-initial-value, -readability-function-size, -readability-isolate-declaration, @@ -40,6 +43,7 @@ Checks: > -altera-*, Checks related to OpenCL programming for FPGAs. Not relevant, -android-*, -bugprone-easily-swappable-parameters, + -bugprone-inc-dec-in-conditions, -bugprone-swapped-arguments, -clang-analyzer-*, Already covered by the cmake target "clang-analyzer", -cppcoreguidelines-avoid-non-const-global-variables, @@ -53,6 +57,7 @@ Checks: > -readability-function-cognitive-complexity, -readability-identifier-length, -readability-magic-numbers, + -readability-math-missing-parentheses, -readability-redundant-declaration, Conflicts with our header generation scripts, -readability-suspicious-call-argument, @@ -62,9 +67,13 @@ Checks: > -cert-dcl51-cpp, -cert-exp42-c, -cert-flp37-c, + -cert-int09-c, -cert-msc24-c, -cert-msc33-c, -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-macro-to-enum, + -google-readability-braces-around-statements, -google-readability-function-size, + -hicpp-braces-around-statements, -hicpp-function-size, -llvm-else-after-return, diff --git a/.editorconfig b/.editorconfig index 07993e25b945b4..0d54d6cb33a27a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,6 +13,6 @@ max_line_length = 100 [*.py] indent_size = 4 -[{Makefile,**/Makefile,runtime/doc/*.txt}] +[{Makefile,**/Makefile,*.mk,runtime/doc/*.txt}] indent_style = tab indent_size = 8 diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 578a776b325cd8..8cbd3d4ef5f31f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,6 @@ name: Bug Report -description: Report a problem in Neovim -labels: [bug] +description: Report a problem in Nvim +type: 'bug' body: - type: markdown @@ -43,7 +43,7 @@ body: - type: input attributes: - label: "Neovim version (nvim -v)" + label: "Nvim version (nvim -v)" placeholder: "0.6.0 commit db1b0ee3b30f" validations: required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index f25732f90d1b0e..a7d569514b0f9d 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: Question - url: https://vi.stackexchange.com/ - about: Ask questions about configuration and usage of Neovim + url: https://github.com/neovim/neovim/discussions + about: Ask about configuration and usage of Nvim diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 711d70c589b88d..f7cf5980b35382 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,6 +1,6 @@ name: Feature request -description: Request an enhancement for Neovim -labels: [enhancement] +description: Request an enhancement for Nvim +type: 'enhancement' body: - type: markdown diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml index 0e2111923d79f3..a186a1ee98c50b 100644 --- a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml @@ -1,6 +1,8 @@ name: Language server (LSP) client bug -description: Report an issue with Neovim LSP -labels: [bug, lsp] +description: Report an issue with Nvim LSP +title: "LSP: " +type: bug +labels: [lsp] body: - type: markdown @@ -59,7 +61,7 @@ body: - type: input attributes: - label: "Neovim version (nvim -v)" + label: "Nvim version (nvim -v)" placeholder: "0.6.0 commit db1b0ee3b30f" validations: required: true diff --git a/.github/scripts/close_unresponsive.js b/.github/scripts/close_unresponsive.js index b16c19b6536b16..5fd231423c1f21 100644 --- a/.github/scripts/close_unresponsive.js +++ b/.github/scripts/close_unresponsive.js @@ -26,7 +26,7 @@ module.exports = async ({ github, context }) => { repo: repo, issue_number: number, }, - (response) => response.data.filter(labeledEvent) + (response) => response.data.filter(labeledEvent), ); const latest_response_label = events[events.length - 1]; diff --git a/.github/scripts/install_deps.sh b/.github/scripts/install_deps.sh index 66f418eb10bc76..2aec8ea5538b3b 100755 --- a/.github/scripts/install_deps.sh +++ b/.github/scripts/install_deps.sh @@ -16,9 +16,9 @@ if [[ $os == Linux ]]; then if [[ $CC == clang ]]; then DEFAULT_CLANG_VERSION=$(echo | clang -dM -E - | grep __clang_major | awk '{print $3}') - CLANG_VERSION=18 + CLANG_VERSION=19 if ((DEFAULT_CLANG_VERSION >= CLANG_VERSION)); then - echo "Default clang version is $DEFAULT_CLANG_VERSION, which equal or larger than wanted version $CLANG_VERSION. Aborting!" + echo "Default clang version is $DEFAULT_CLANG_VERSION, which is equal or larger than wanted version $CLANG_VERSION. Aborting!" exit 1 fi @@ -30,10 +30,10 @@ if [[ $os == Linux ]]; then fi if [[ -n $TEST ]]; then - sudo apt-get install -y locales-all cpanminus attr libattr1-dev gdb fswatch + sudo apt-get install -y locales-all cpanminus attr libattr1-dev gdb inotify-tools # Use default CC to avoid compilation problems when installing Python modules - CC=cc python3 -m pip -q install --user --upgrade pynvim + CC=cc python3 -m pip -q install --user --upgrade --break-system-packages pynvim fi elif [[ $os == Darwin ]]; then brew update --quiet diff --git a/.github/scripts/labeler_configuration.yml b/.github/scripts/labeler_configuration.yml index 3db8444fde2b18..cf3b8f802b3577 100644 --- a/.github/scripts/labeler_configuration.yml +++ b/.github/scripts/labeler_configuration.yml @@ -1,71 +1,91 @@ -lsp: +build: - changed-files: - - any-glob-to-any-file: [ runtime/lua/vim/lsp.lua, runtime/lua/vim/lsp/* ] + - any-glob-to-any-file: [ CMakeLists.txt, "**/CMakeLists.txt", "**/Makefile", "**/*.cmake", cmake.deps/**/* ] -tui: +checkhealth: - changed-files: - - any-glob-to-any-file: [ src/nvim/tui/tui.* ] + - any-glob-to-any-file: [ "**/health.lua" ] -treesitter: +ci: - changed-files: - - any-glob-to-any-file: [ src/nvim/lua/treesitter.*, runtime/lua/vim/treesitter.lua, runtime/lua/vim/treesitter/*, runtime/queries/**/* ] + - any-glob-to-any-file: [ .github/actions/**, .github/workflows/**, .github/scripts/** ] + +clipboard: + - changed-files: + - any-glob-to-any-file: [ runtime/autoload/provider/clipboard.vim ] + +column: + - changed-files: + - any-glob-to-any-file: [ src/nvim/sign* ] + +comment: + - changed-files: + - any-glob-to-any-file: [ runtime/lua/vim/_comment.lua ] + +defaults: + - changed-files: + - any-glob-to-any-file: [ runtime/lua/vim/_defaults.lua ] diagnostic: - changed-files: - any-glob-to-any-file: [ runtime/lua/vim/diagnostic.lua ] -dependencies: +diff: - changed-files: - - any-glob-to-any-file: [ cmake.deps/**/* ] + - any-glob-to-any-file: [ src/nvim/diff.* ] -spell: +documentation: - changed-files: - - any-glob-to-any-file: [ src/nvim/spell* ] + - any-glob-to-all-files: [ runtime/doc/*, "**/*.md" ] -terminal: +editorconfig: - changed-files: - - any-glob-to-any-file: [ src/nvim/terminal.* ] + - any-glob-to-any-file: [ .editorconfig, runtime/lua/editorconfig.lua, runtime/plugin/editorconfig.lua ] -column: +filetype: - changed-files: - - any-glob-to-any-file: [ src/nvim/sign* ] + - any-glob-to-any-file: [ runtime/lua/vim/filetype.lua, runtime/lua/vim/filetype/detect.lua ] + +filesystem: + - changed-files: + - any-glob-to-any-file: [ runtime/lua/vim/fs.lua ] folds: - changed-files: - any-glob-to-any-file: [ src/nvim/fold* ] +lsp: + - changed-files: + - any-glob-to-any-file: [ runtime/lua/vim/lsp.lua, runtime/lua/vim/lsp/* ] + mouse: - changed-files: - any-glob-to-any-file: [ src/nvim/mouse* ] -documentation: +netrw: - changed-files: - - any-glob-to-all-files: [ runtime/doc/*, "**/*.md" ] + - any-glob-to-any-file: [ runtime/autoload/netrw.vim, runtime/plugin/netrwPlugin.vim ] -clipboard: +snippet: - changed-files: - - any-glob-to-any-file: [ runtime/autoload/provider/clipboard.vim ] + - any-glob-to-any-file: [ runtime/lua/vim/snippet.lua ] -diff: +spell: - changed-files: - - any-glob-to-any-file: [ src/nvim/diff.* ] + - any-glob-to-any-file: [ src/nvim/spell* ] -build: +terminal: - changed-files: - - any-glob-to-any-file: [ CMakeLists.txt, "**/CMakeLists.txt", "**/Makefile", "**/*.cmake" ] + - any-glob-to-any-file: [ src/nvim/terminal.* ] test: - changed-files: - any-glob-to-all-files: [test/**/*] -ci: - - changed-files: - - any-glob-to-any-file: [ .github/actions/**, .github/workflows/**, .github/scripts/** ] - -filetype: +treesitter: - changed-files: - - any-glob-to-any-file: [ runtime/lua/vim/filetype.lua, runtime/lua/vim/filetype/detect.lua ] + - any-glob-to-any-file: [ src/nvim/lua/treesitter.*, runtime/lua/vim/treesitter.lua, runtime/lua/vim/treesitter/*, runtime/queries/**/* ] -platform:nix: +tui: - changed-files: - - any-glob-to-any-file: [ contrib/flake.lock, contrib/flake.nix ] + - any-glob-to-any-file: [ src/nvim/tui/tui.* ] diff --git a/.github/scripts/reviewers_add.js b/.github/scripts/reviewers_add.js index d8319ea56bf726..73e1ece5160ada 100644 --- a/.github/scripts/reviewers_add.js +++ b/.github/scripts/reviewers_add.js @@ -23,12 +23,12 @@ module.exports = async ({ github, context }) => { reviewers.add("lewis6991"); } - if (labels.includes("defaults")) { - reviewers.add("gpanders"); + if (labels.includes("comment")) { + reviewers.add("echasnovski"); } - if (labels.includes("dependencies")) { - reviewers.add("jamessan"); + if (labels.includes("defaults")) { + reviewers.add("gpanders"); } if (labels.includes("diagnostic")) { @@ -39,28 +39,28 @@ module.exports = async ({ github, context }) => { reviewers.add("lewis6991"); } - if (labels.includes("distribution")) { - reviewers.add("jamessan"); - } - - if (labels.includes("documentation")) { - reviewers.add("clason"); + if (labels.includes("editorconfig")) { + reviewers.add("gpanders"); } - if (labels.includes("extmarks")) { + if (labels.includes("marks")) { reviewers.add("bfredl"); } if (labels.includes("filetype")) { reviewers.add("clason"); - reviewers.add("gpanders"); - reviewers.add("smjonas"); + } + + if (labels.includes("inccommand")) { + reviewers.add("famiu"); } if (labels.includes("lsp")) { - reviewers.add("folke"); reviewers.add("MariaSolOs"); - reviewers.add("mfussenegger"); + } + + if (labels.includes("netrw")) { + reviewers.add("justinmk"); } if (labels.includes("options")) { @@ -76,18 +76,19 @@ module.exports = async ({ github, context }) => { reviewers.add("justinmk"); } - if (labels.includes("statusline")) { - reviewers.add("famiu"); + if (labels.includes("snippet")) { + reviewers.add("MariaSolOs"); } - if (labels.includes("test")) { - reviewers.add("justinmk"); + if (labels.includes("statusline")) { + reviewers.add("famiu"); } if (labels.includes("treesitter")) { reviewers.add("bfredl"); reviewers.add("clason"); reviewers.add("lewis6991"); + reviewers.add("wookayin"); } if (labels.includes("tui")) { @@ -99,7 +100,6 @@ module.exports = async ({ github, context }) => { } if (labels.includes("vim-patch")) { - reviewers.add("seandewar"); reviewers.add("zeertzjq"); } diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 88cddcded43c97..25a52c4757d197 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -12,11 +12,35 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Create backport PRs - uses: korthout/backport-action@v2 + + - uses: actions/create-github-app-token@v1 + id: app-token with: - # https://github.com/korthout/backport-action/pull/399 - experimental: > - { - "detect_merge_method": true - } + app-id: ${{ vars.BACKPORT_APP }} + private-key: ${{ secrets.BACKPORT_KEY }} + + - name: Create backport PR + id: backport + uses: korthout/backport-action@v3 + with: + pull_title: "${pull_title}" + label_pattern: "^ci:backport ([^ ]+)$" + github_token: ${{ steps.app-token.outputs.token }} + + - name: Create failed backport label + if: ${{ steps.backport.outputs.was_successful == 'false' }} + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['needs:backport'] + }) + + - name: Enable automerge + if: ${{ steps.backport.outputs.was_successful == 'true' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh pr merge --rebase --auto ${{ steps.backport.outputs.created_pull_numbers }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81e8ceefd73e40..3211216c85ae95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,13 +21,28 @@ env: INSTALL_PREFIX: ${{ github.workspace }}/nvim-install jobs: + wasmtime: + strategy: + fail-fast: false + matrix: + test: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.test }} + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - run: | + cmake -S cmake.deps --preset ci -D ENABLE_WASMTIME=ON + cmake --build .deps + cmake --preset ci -D ENABLE_WASMTIME=ON + cmake --build build + old-cmake: name: Test oldest supported cmake - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest timeout-minutes: 15 env: - CMAKE_URL: 'https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.sh' - CMAKE_VERSION: '3.13.0' + CMAKE_URL: 'https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.sh' + CMAKE_VERSION: '3.16.0' steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup @@ -56,7 +71,7 @@ jobs: use-existing-src: name: Test USE_EXISTING_SRC_DIR=ON builds with no network access - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup @@ -74,7 +89,9 @@ jobs: for d in *; do (cd "$d"; rm -rf ./autom4te.cache; make clean || true; make distclean || true); done - name: Re-build bundled dependencies with no network access - run: unshare --map-root-user --net make deps DEPS_CMAKE_FLAGS=-DUSE_EXISTING_SRC_DIR=ON + run: | + sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0 + unshare --map-root-user --net make deps DEPS_CMAKE_FLAGS=-DUSE_EXISTING_SRC_DIR=ON - name: Build run: make CMAKE_FLAGS="-D CI_BUILD=ON" diff --git a/.github/workflows/build_dummy.yml b/.github/workflows/build_dummy.yml new file mode 100644 index 00000000000000..b499ba7fa235c7 --- /dev/null +++ b/.github/workflows/build_dummy.yml @@ -0,0 +1,33 @@ +name: build_dummy +on: + pull_request: + branches: + - 'master' + - 'release-[0-9]+.[0-9]+' + # This needs to be an exact complement of `paths` in the build.yml workflow. + # This is required to bypass required checks since a required job is always + # needed to run. + paths-ignore: + - '**.cmake' + - '**/CMakeLists.txt' + - '**/CMakePresets.json' + - 'cmake.*/**' + - '.github/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + old-cmake: + name: Test oldest supported cmake + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - run: echo "success" + + use-existing-src: + name: Test USE_EXISTING_SRC_DIR=ON builds with no network access + runs-on: ubuntu-latest + steps: + - run: echo "success" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c91f2945fb008c..f1324043826b5d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,13 +2,6 @@ name: docs on: pull_request: types: [opened, synchronize, reopened, ready_for_review] - paths: - - 'src/nvim/api/*.[ch]' - - 'src/nvim/eval.lua' - - 'runtime/lua/**.lua' - - 'runtime/doc/**' - - 'scripts/gen_vimdoc.py' - - 'scripts/gen_help_html.lua' jobs: docs: runs-on: ubuntu-latest diff --git a/.github/workflows/labeler_pr.yml b/.github/workflows/labeler_pr.yml index 8fd93bfb6d0a77..5d402c3c03a6f4 100644 --- a/.github/workflows/labeler_pr.yml +++ b/.github/workflows/labeler_pr.yml @@ -33,8 +33,25 @@ jobs: - name: "Extract if the PR is a breaking change and add it as label" run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true - request-reviewer: + target-release: needs: ["changed-files", "type-scope"] + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - if: startsWith(github.base_ref, 'release') + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['target:release'] + }) + + request-reviewer: + needs: ["changed-files", "type-scope", "target-release"] permissions: pull-requests: write uses: ./.github/workflows/reviewers_add.yml diff --git a/.github/workflows/lintcommit.yml b/.github/workflows/lintcommit.yml index 3d140532cd1835..49dc7f3e663bf5 100644 --- a/.github/workflows/lintcommit.yml +++ b/.github/workflows/lintcommit.yml @@ -1,4 +1,4 @@ -name: "lintcommit" +name: lintcommit on: pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/.github/workflows/lintcommit_dummy.yml b/.github/workflows/lintcommit_dummy.yml new file mode 100644 index 00000000000000..e4a0c4af2d3eeb --- /dev/null +++ b/.github/workflows/lintcommit_dummy.yml @@ -0,0 +1,16 @@ +# Dummy workflow of lintcommit.yml. lintcommit is a required check, but it's +# only designed to work on master. Since required checks are always required to +# run, we can essentially "skip" the lintcommit on release branches with this +# dummy check that automatically passes. +name: lintcommit_dummy +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: + - 'release-[0-9]+.[0-9]+' +jobs: + lint-commits: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + steps: + - run: echo "success" diff --git a/.github/workflows/news.yml b/.github/workflows/news.yml index 8d21b86e8ee6d4..ca078761972fb4 100644 --- a/.github/workflows/news.yml +++ b/.github/workflows/news.yml @@ -19,15 +19,15 @@ jobs: message=$(git log -n1 --pretty=format:%s $commit) type="$(echo "$message" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" breaking="$(echo "$message" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" - if [[ "$type" == "feat" ]] || [[ "$breaking" == "breaking-change" ]]; then + if [[ "$type" == "feat" ]] || [[ "$type" == "perf" ]] || [[ "$breaking" == "breaking-change" ]]; then ! git diff HEAD~${{ github.event.pull_request.commits }}..HEAD --quiet runtime/doc/news.txt || { echo " - Pull request includes a new feature or a breaking change, but - news.txt hasn't been updated yet. This is just a reminder - that news.txt may need to be updated. You can ignore this CI - failure if you think the change won't be of interest to - users." + Pull request includes a new feature, performance improvement + or a breaking change, but news.txt hasn't been updated yet. + This is just a reminder that news.txt may need to be updated. + You can ignore this CI failure if you think the change won't + be of interest to users." exit 1 } fi diff --git a/.github/workflows/notes.md b/.github/workflows/notes.md index f67a0986878da9..25f4a5fb3226ed 100644 --- a/.github/workflows/notes.md +++ b/.github/workflows/notes.md @@ -18,6 +18,8 @@ ${NVIM_VERSION} 2. Run the MSI 3. Run `nvim.exe` on your CLI of choice +Note: On Windows "Server" you may need to [install vcruntime140.dll](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170). + ### macOS (x86_64) 1. Download **nvim-macos-x86_64.tar.gz** @@ -34,11 +36,10 @@ ${NVIM_VERSION} ### Linux (x64) -Minimum glibc version to run these releases is 2.31. People requiring releases -that work on older glibc versions can find them at -https://github.com/neovim/neovim-releases. +glibc 2.31 or newer is required. Or you may try the (unsupported) [builds for older glibc](https://github.com/neovim/neovim-releases). #### AppImage + 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): diff --git a/.github/workflows/optional.yml b/.github/workflows/optional.yml index 742d51377f3a64..540daccc567e2c 100644 --- a/.github/workflows/optional.yml +++ b/.github/workflows/optional.yml @@ -11,7 +11,7 @@ concurrency: env: INSTALL_PREFIX: ${{ github.workspace }}/nvim-install # Double test timeout since it's running via qemu - TEST_TIMEOUT: 2400 + TEST_TIMEOUT: 3600 # TEST_FILE: test/functional/shada # TEST_FILTER: foo @@ -23,7 +23,7 @@ jobs: matrix: test: [functionaltest, oldtest] runs-on: ubuntu-latest - timeout-minutes: 60 + timeout-minutes: 90 steps: - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - uses: docker://multiarch/ubuntu-core:s390x-focal @@ -34,7 +34,7 @@ jobs: bash -c " apt-get -y update && - DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake curl gettext ninja-build locales-all cpanminus git attr libattr1-dev && + time DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake curl gettext ninja-build locales-all cpanminus git attr libattr1-dev xdg-utils && useradd --create-home qemuci && chown -R qemuci. . && runuser -u qemuci -- git clone --depth=1 https://github.com/neovim/neovim.git && diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6abdd588bafa13..de90a077ff1ffd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -81,9 +81,9 @@ jobs: strategy: fail-fast: false matrix: - runner: [ macos-12, macos-14 ] + runner: [ macos-13, macos-14 ] include: - - runner: macos-12 + - runner: macos-13 arch: x86_64 - runner: macos-14 arch: arm64 diff --git a/.github/workflows/reviewers_add.yml b/.github/workflows/reviewers_add.yml index b116bca29b1ad6..90b473c754e87d 100644 --- a/.github/workflows/reviewers_add.yml +++ b/.github/workflows/reviewers_add.yml @@ -5,7 +5,7 @@ on: workflow_call: jobs: request-reviewer: - if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false + if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false && !endsWith(github.actor, '[bot]') runs-on: ubuntu-latest permissions: pull-requests: write diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d0ee18ab7363d6..c7802d2210a58a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,8 +8,6 @@ on: branches: - 'master' - 'release-[0-9]+.[0-9]+' - paths-ignore: - - 'contrib/**' workflow_dispatch: concurrency: @@ -30,7 +28,7 @@ env: jobs: lint: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 env: CC: clang @@ -80,7 +78,7 @@ jobs: run: cmake --build build --target lintc-uncrustify clang-analyzer: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 20 env: CC: clang @@ -95,18 +93,23 @@ jobs: - run: cmake --build build --target clang-analyzer posix: - name: ${{ matrix.build.runner }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }} + name: ${{ matrix.build.os }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }} strategy: fail-fast: false matrix: + # The `os` field is not needed to differentiate between the different + # matrix builds. It is needed to not change the required checks (which + # uses jobs names) each time we bump the runner version. It may be + # possible to remove if we e.g. start using `-latest` runner versions + # or if github introduces a wildcard for required checks in the future. build: [ - { runner: ubuntu-22.04, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON }, - { runner: ubuntu-22.04, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON }, - { runner: ubuntu-22.04, cc: gcc }, - { runner: macos-12, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER }, - { runner: macos-14, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER }, - { runner: ubuntu-22.04, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON }, + { runner: ubuntu-24.04, os: ubuntu, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON }, + { runner: ubuntu-24.04, os: ubuntu, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON }, + { runner: ubuntu-24.04, os: ubuntu, flavor: release, cc: gcc, flags: -D CMAKE_BUILD_TYPE=Release }, + { runner: macos-13, os: macos, flavor: intel, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER }, + { runner: macos-15, os: macos, flavor: arm, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER }, + { runner: ubuntu-24.04, os: ubuntu, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON }, ] test: [unittest, functionaltest, oldtest] exclude: @@ -142,6 +145,10 @@ jobs: sudo cpanm -n Neovim::Ext || cat "$HOME/.cpanm/build.log" perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION' + - name: Remove .git directory + if: ${{ matrix.build.os == 'ubuntu' }} + run: cmake -E rm -rf -- .git + - name: Build third-party deps run: | cmake -S cmake.deps --preset ci -D CMAKE_BUILD_TYPE=Debug ${{ matrix.build.deps_flags }} @@ -152,9 +159,15 @@ jobs: cmake --preset ci -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX ${{ matrix.build.flags }} cmake --build build - - name: ${{ matrix.test }} + - if: ${{ matrix.test == 'oldtest' }} + name: ${{ matrix.test }} + timeout-minutes: 20 + run: make -C test/old/testdir NVIM_PRG=$(realpath build)/bin/nvim + + - if: ${{ matrix.test != 'oldtest' }} + name: ${{ matrix.test }} timeout-minutes: 20 - run: make ${{ matrix.test }} + run: cmake --build build --target ${{ matrix.test }} - name: Install run: | @@ -191,7 +204,7 @@ jobs: uses: ./.github/workflows/test_windows.yml # This job tests the following things: - # - Check if Release, MinSizeRel and RelWithDebInfo compiles correctly. + # - Check if MinSizeRel and RelWithDebInfo compiles correctly. # - Test the above build types with the GCC compiler specifically. # Empirically the difference in warning levels between GCC and other # compilers is particularly big. @@ -199,7 +212,7 @@ jobs: # single-config generators so it's nice to have a small sanity check for # multi-config. build-types: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 env: CC: gcc @@ -215,9 +228,6 @@ jobs: - name: Configure run: cmake --preset ci -G "Ninja Multi-Config" - - name: Release - run: cmake --build build --config Release - - name: RelWithDebInfo run: cmake --build build --config RelWithDebInfo @@ -225,7 +235,7 @@ jobs: run: cmake --build build --config MinSizeRel with-external-deps: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 10 env: CC: gcc @@ -238,8 +248,6 @@ jobs: sudo add-apt-repository ppa:neovim-ppa/stable sudo apt-get install -y \ libluajit-5.1-dev \ - libmsgpack-dev \ - libtermkey-dev \ libunibilium-dev \ libuv1-dev \ lua-filesystem \ @@ -247,7 +255,6 @@ jobs: luajit \ lua-luv-dev # libtree-sitter-dev \ - # libvterm-dev # Remove comments from packages once we start using these external # dependencies. diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index d92993a08c3084..db7ad93f55ef9c 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -60,6 +60,7 @@ jobs: uses: msys2/setup-msys2@v2 with: update: true + install: unzip pacboy: >- make:p gcc:p diffutils:p release: false diff --git a/.github/workflows/vim_patches.yml b/.github/workflows/vim_patches.yml index 711ddae8154608..5154565def4815 100644 --- a/.github/workflows/vim_patches.yml +++ b/.github/workflows/vim_patches.yml @@ -43,13 +43,13 @@ jobs: id: update-version run: | git checkout -b ${VERSION_BRANCH} - nvim -V1 -es -i NONE +'luafile scripts/vimpatch.lua' +q + nvim -l scripts/vimpatch.lua printf 'NEW_PATCHES=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT - name: Automatic PR if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }} run: | git add -u - git commit -m 'version.c: update [skip ci]' + git commit -m 'docs: update version.c' git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH} gh pr create --draft --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true diff --git a/.gitignore b/.gitignore index f1661e1f00e561..98ec98ea7269ea 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ compile_commands.json /test/old/testdir/messages /test/old/testdir/starttime /test/old/testdir/viminfo +/test/old/testdir/opt_test.vim /test/old/testdir/test.ok /test/old/testdir/*.failed /test/old/testdir/X* diff --git a/.luacheckrc b/.luacheckrc index d54c61e9e70ae7..4d4d656b4b4c51 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -42,6 +42,7 @@ globals = { } exclude_files = { + 'test/_meta.lua', 'test/functional/fixtures/lua/syntax_error.lua', 'runtime/lua/vim/treesitter/_meta.lua', 'runtime/lua/vim/_meta/vimfn.lua', diff --git a/.mailmap b/.mailmap index ffef9f280b4a7b..55bc59fd756999 100644 --- a/.mailmap +++ b/.mailmap @@ -8,19 +8,17 @@ Anmol Sethi BK1603 Shreyansh Chouhan Billy Su Billy SU Billy Vong -bfredl Carlos Hernandez Chris Kipp ckipp01 Christian Clason Cédric Barreteau <> Dan Aloni Daniel Hahler -dundargoc <33953936+dundargoc@users.noreply.github.com> -dundargoc Dundar Goc Eisuke Kawashima E Kawashima ElPiloto Luis Piloto Eliseo Martínez Eliseo Martínez Fabian Viöl Fabian +Famiu Haque Florian Walch Gabriel Cruz Gaelan Steele Gaelan @@ -38,6 +36,7 @@ J Phani Mahesh Jack Bracewell Jack Bracewell Jacques Germishuys +Jaehwang Jung Jaehwang Jerry Jung Jakub Łuczyński James McCoy Jan Edmund Lazo @@ -57,6 +56,8 @@ Kwon-Young Choi Kwon-Young Lewis Russell Lucas Hoffmann Lucas Hoffmann +Luuk van Baal <31730729+luukvbaal@users.noreply.github.com> +Luuk van Baal luukvbaal Marco Hinz Marvim the Paranoid Android marvim Mateusz Czapliński Mateusz Czaplinski @@ -111,14 +112,20 @@ Yorick Peterse ZyX ZyX Nikolai Aleksandrovich Pavlov aph Ashley Hewson +bfredl butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com> We're Yet chemzqm Qiming zhao chentau Tony Chen dedmass Carlo Abelli +dundargoc <33953936+dundargoc@users.noreply.github.com> +dundargoc Dundar Goc equal-l2 francisco souza <108725+fsouza@users.noreply.github.com> glacambre glacambre Ghjuvan Lacambre +glepnir Raphael +glepnir Raphael +glepnir Raphael ii14 <59243201+ii14@users.noreply.github.com> jdrouhard kuuote <36663503+kuuote@users.noreply.github.com> diff --git a/BUILD.md b/BUILD.md index 621a615948cbe1..7ded17138ae5aa 100644 --- a/BUILD.md +++ b/BUILD.md @@ -5,14 +5,15 @@ 1. Install [build prerequisites](#build-prerequisites) on your system 2. `git clone https://github.com/neovim/neovim` -3. `cd neovim && make CMAKE_BUILD_TYPE=RelWithDebInfo` +3. `cd neovim` - If you want the **stable release**, also run `git checkout stable`. +4. `make CMAKE_BUILD_TYPE=RelWithDebInfo` - If you want to install to a custom location, set `CMAKE_INSTALL_PREFIX`. See also [INSTALL.md](./INSTALL.md#install-from-source). - On BSD, use `gmake` instead of `make`. - To build on Windows, see the [Building on Windows](#building-on-windows) section. _MSVC (Visual Studio) is recommended._ -4. `sudo make install` +5. `sudo make install` - Default install location is `/usr/local` - - On Debian/Ubuntu, instead of installing files directly with `sudo make install`, you can run `cd build && cpack -G DEB && sudo dpkg -i nvim-linux64.deb` to build DEB-package and install it. This should help ensuring the clean removal of installed files. + - On Debian/Ubuntu, instead of `sudo make install`, you can try `cd build && cpack -G DEB && sudo dpkg -i nvim-linux64.deb` to build DEB-package and install it. This helps ensure clean removal of installed files. Note: This is an unsupported, "best-effort" feature of the Nvim build. **Notes**: - From the repository's root directory, running `make` will download and build all the needed dependencies and put the `nvim` executable in `build/bin`. @@ -84,7 +85,7 @@ make deps - Right-click _CMakeLists.txt → Delete Cache_. - Right-click _CMakeLists.txt → Generate Cache_. - If you see an "access violation" from `ntdll`, you can ignore it and continue. -4. If you set an error like `msgpackc.dll not found`, try the `nvim.exe (Install)` target. Then switch back to `nvim.exe (bin\nvim.exe)`. +4. If you see an error like `uv.dll not found`, try the `nvim.exe (Install)` target. Then switch back to `nvim.exe (bin\nvim.exe)`. ### Windows / MSVC PowerShell @@ -131,12 +132,13 @@ https://github.com/cascent/neovim-cygwin was built on Cygwin 2.9.0. Newer `libuv 1. From the MSYS2 shell, install these packages: ``` pacman -S \ - mingw-w64-x86_64-{gcc,cmake,make,ninja,diffutils} + mingw-w64-ucrt-x86_64-gcc \ + mingw-w64-x86_64-{cmake,make,ninja,diffutils} ``` 2. From the Windows Command Prompt (`cmd.exe`), set up the `PATH` and build. ```cmd - set PATH=c:\msys64\mingw64\bin;c:\msys64\usr\bin;%PATH% + set PATH=c:\msys64\ucrt64\bin;c:\msys64\usr\bin;%PATH% ``` 3. You have two options: - Build using `cmake` and `Ninja` generator: @@ -240,7 +242,7 @@ cmake --build build ### How to build without "bundled" dependencies 1. Manually install the dependencies: - - libuv libluv libvterm luajit lua-lpeg lua-mpack msgpack-c tree-sitter tree-sitter-bash tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-python tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium + - libuv libluv libutf8proc luajit lua-lpeg tree-sitter tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium 2. Run CMake: ```sh cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo @@ -248,7 +250,7 @@ cmake --build build ``` If all the dependencies are not available in the package, you can use only some of the bundled dependencies as follows (example of using `ninja`): ```sh - cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_BUNDLED=OFF -DUSE_BUNDLED_LIBVTERM=ON -DUSE_BUNDLED_TS=ON + cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_BUNDLED=OFF -DUSE_BUNDLED_TS=ON cmake --build .deps cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo cmake --build build @@ -260,8 +262,8 @@ cmake --build build #### Debian 10 (Buster) example: ```sh -sudo apt install luajit libluajit-5.1-dev lua-mpack lua-lpeg libunibilium-dev libmsgpack-dev -cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_BUNDLED=OFF -DUSE_BUNDLED_LIBUV=ON -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_LIBVTERM=ON -DUSE_BUNDLED_TS=ON +sudo apt install luajit libluajit-5.1-dev lua-lpeg libunibilium-dev +cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_BUNDLED=OFF -DUSE_BUNDLED_LIBUV=ON -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_TS=ON -DUSE_BUNDLED_UTF8PROC=ON cmake --build .deps cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo cmake --build build @@ -275,7 +277,7 @@ cmake --build build ``` - Example of using a package with some dependencies: ``` - make BUNDLED_CMAKE_FLAG="-DUSE_BUNDLED=OFF -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_TS=ON -DUSE_BUNDLED_LIBVTERM=ON -DUSE_BUNDLED_LIBUV=ON" + make BUNDLED_CMAKE_FLAG="-DUSE_BUNDLED=OFF -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_TS=ON -DUSE_BUNDLED_LIBUV=ON" ``` ## Build prerequisites @@ -283,21 +285,22 @@ cmake --build build General requirements (see [#1469](https://github.com/neovim/neovim/issues/1469#issuecomment-63058312)): - Clang or GCC version 4.9+ -- CMake version 3.13+, built with TLS/SSL support - - Optional: Get the latest CMake from an [installer](https://github.com/Kitware/CMake/releases) or the [Python package](https://pypi.org/project/cmake/) (`pip install cmake`) +- CMake version 3.16+, built with TLS/SSL support + - Optional: Get the latest CMake from https://cmake.org/download/ + - Provides a shell script which works on most Linux systems. After running it, ensure the resulting `cmake` binary is in your $PATH so the the Nvim build will find it. Platform-specific requirements are listed below. ### Ubuntu / Debian ```sh -sudo apt-get install ninja-build gettext cmake unzip curl build-essential +sudo apt-get install ninja-build gettext cmake curl build-essential ``` ### RHEL / Fedora ``` -sudo dnf -y install ninja-build cmake gcc make unzip gettext curl glibc-gconv-extra +sudo dnf -y install ninja-build cmake gcc make gettext curl glibc-gconv-extra ``` ### openSUSE @@ -309,13 +312,13 @@ sudo zypper install ninja cmake gcc-c++ gettext-tools curl ### Arch Linux ``` -sudo pacman -S base-devel cmake unzip ninja curl +sudo pacman -S base-devel cmake ninja curl ``` ### Alpine Linux ``` -apk add build-base cmake coreutils curl unzip gettext-tiny-dev +apk add build-base cmake coreutils curl gettext-tiny-dev ``` ### Void Linux @@ -365,18 +368,21 @@ and replacing `neovim-unwrapped` with `neovim-dev`: nix-shell '' -A neovim-dev ``` -Neovim contains a Nix flake in the `contrib` folder, with 3 packages: +A flake for Neovim is hosted at [nix-community/neovim-nightly-overlay](https://github.com/nix-community/neovim-nightly-overlay/), with 3 packages: - `neovim` to run the nightly - `neovim-debug` to run the package with debug symbols - `neovim-developer` to get all the tools to develop on `neovim` -Thus you can run Neovim nightly with `nix run github:neovim/neovim?dir=contrib`. -Similarly to develop on Neovim: `nix develop github:neovim/neovim?dir=contrib#neovim-developer`. +Thus you can run Neovim nightly with `nix run github:nix-community/neovim-nightly-overlay`. +Similarly to develop on Neovim: `nix run github:nix-community/neovim-nightly-overlay#neovim-developer`. + +To use a specific version of Neovim, you can pass `--override-input neovim-src .` to use your current directory, +or a specific SHA1 like `--override-input neovim-src github:neovim/neovim/89dc8f8f4e754e70cbe1624f030fb61bded41bc2`. ### FreeBSD ``` -sudo pkg install cmake gmake sha unzip wget gettext curl +sudo pkg install cmake gmake sha wget gettext curl ``` If you get an error regarding a `sha256sum` mismatch, where the actual SHA-256 hash is `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`, then this is your issue (that's the `sha256sum` of an empty file). @@ -384,7 +390,7 @@ If you get an error regarding a `sha256sum` mismatch, where the actual SHA-256 h ### OpenBSD ```sh -doas pkg_add gmake cmake unzip curl gettext-tools +doas pkg_add gmake cmake curl gettext-tools ``` Build can sometimes fail when using the top level `Makefile`, apparently due to some third-party component (see [#2445-comment](https://github.com/neovim/neovim/issues/2445#issuecomment-108124236)). The following instructions use CMake: diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ac1bd8b2b049e..b9ceb05abab655 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,13 @@ # CMAKE REFERENCE -# intro: https://codingnest.com/basic-cmake/ -# best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1 -# pitfalls: https://izzys.casa/2019/02/everything-you-never-wanted-to-know-about-cmake/ +# - intro: https://codingnest.com/basic-cmake/ +# - best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1 +# - pitfalls: https://izzys.casa/2019/02/everything-you-never-wanted-to-know-about-cmake/ +# - troubleshooting: +# - variable_watch https://cmake.org/cmake/help/latest/command/variable_watch.html +# - verbose output: cmake --build build --verbose # Version should match the tested CMAKE_URL in .github/workflows/build.yml. -cmake_minimum_required(VERSION 3.13) - -# Can be removed once minimum version is at least 3.15 -if(POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) -endif() +cmake_minimum_required(VERSION 3.16) project(nvim C) @@ -37,22 +35,21 @@ include(InstallHelpers) include(PreventInTreeBuilds) include(Util) +#------------------------------------------------------------------------------- +# User settings +#------------------------------------------------------------------------------- + +set(DEPS_IGNORE_SHA FALSE) + #------------------------------------------------------------------------------- # Variables #------------------------------------------------------------------------------- set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack) set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches) +set(VTERM_TEST_FILE ${PROJECT_BINARY_DIR}/test/vterm_test_output) file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt) -set_directory_properties(PROPERTIES - EP_PREFIX "${DEPS_BUILD_DIR}") - -find_program(CCACHE_PRG ccache) -if(CCACHE_PRG) - set(CMAKE_C_COMPILER_LAUNCHER ${CMAKE_COMMAND} -E env CCACHE_SLOPPINESS=pch_defines,time_macros ${CCACHE_PRG}) -endif() - if(NOT CI_BUILD) set(CMAKE_INSTALL_MESSAGE NEVER) endif() @@ -115,10 +112,8 @@ if(APPLE) endif() if(WIN32 OR APPLE) - # Ignore case when comparing filenames on Windows and Mac. + # Handle case-insensitive filenames for Windows and Mac. set(CASE_INSENSITIVE_FILENAME TRUE) - # Enable fixing case-insensitive filenames for Windows and Mac. - set(USE_FNAME_CASE TRUE) endif() if (MINGW) @@ -130,34 +125,30 @@ else() option(ENABLE_LTO "enable link time optimization" ON) endif() option(ENABLE_LIBINTL "enable libintl" ON) +option(ENABLE_WASMTIME "enable wasmtime" OFF) message(STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}") set_default_buildtype(Debug) get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(NOT isMultiConfig) - # Unlike build dependencies in cmake.deps, we assume we want dev dependencies - # such as Uncrustify to always be built with Release. + # Unlike build dependencies in cmake.deps, we want dev dependencies such as + # Uncrustify to always be built with Release. list(APPEND DEPS_CMAKE_ARGS -D CMAKE_BUILD_TYPE=Release) endif() # 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`. set(NVIM_VERSION_MAJOR 0) -set(NVIM_VERSION_MINOR 10) +set(NVIM_VERSION_MINOR 11) set(NVIM_VERSION_PATCH 0) set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers # API level -set(NVIM_API_LEVEL 12) # Bump this after any API change. +set(NVIM_API_LEVEL 13) # Bump this after any API/stdlib change. set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change. set(NVIM_API_PRERELEASE true) -# Build-type: RelWithDebInfo -# /Og means something different in MSVC -if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -Og -g") -endif() # We _want_ assertions in RelWithDebInfo build-type. if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG) string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") @@ -167,6 +158,7 @@ endif() option(ENABLE_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF) option(ENABLE_MSAN "Enable Clang memory sanitizer for nvim binary." OFF) +# TSAN exists to test Luv threads. option(ENABLE_TSAN "Enable Clang thread sanitizer for nvim binary." OFF) if((ENABLE_ASAN_UBSAN AND ENABLE_MSAN) @@ -190,6 +182,7 @@ if(NOT PREFER_LUA) find_program(LUA_PRG NAMES luajit) endif() find_program(LUA_PRG NAMES lua5.1 lua5.2 lua) +mark_as_advanced(LUA_PRG) if(NOT LUA_PRG) message(FATAL_ERROR "Failed to find a Lua 5.1-compatible interpreter") endif() @@ -203,6 +196,7 @@ message(STATUS "Using Lua interpreter: ${LUA_PRG}") if(NOT LUA_GEN_PRG) set(LUA_GEN_PRG "${LUA_PRG}" CACHE FILEPATH "Path to the lua used for code generation.") endif() +mark_as_advanced(LUA_GEN_PRG) message(STATUS "Using Lua interpreter for code generation: ${LUA_GEN_PRG}") option(COMPILE_LUA "Pre-compile Lua sources into bytecode (for sources that are included in the binary)" ON) @@ -222,6 +216,7 @@ if(COMPILE_LUA AND NOT WIN32) endif() endif() endif() +mark_as_advanced(LUAC_PRG) if(LUAC_PRG) message(STATUS "Using Lua compiler: ${LUAC_PRG}") endif() @@ -232,7 +227,9 @@ if(CI_LINT) set(LINT_REQUIRED "REQUIRED") endif() find_program(SHELLCHECK_PRG shellcheck ${LINT_REQUIRED}) +mark_as_advanced(SHELLCHECK_PRG) find_program(STYLUA_PRG stylua ${LINT_REQUIRED}) +mark_as_advanced(STYLUA_PRG) set(STYLUA_DIRS runtime scripts src test contrib) @@ -243,7 +240,7 @@ add_glob_target( GLOB_DIRS runtime scripts src test GLOB_PAT *.lua TOUCH_STRATEGY PER_DIR) -add_dependencies(lintlua-luacheck lua-dev-deps) +add_dependencies(lintlua-luacheck lua_dev_deps) add_glob_target( TARGET lintlua-stylua @@ -269,7 +266,7 @@ add_custom_target(lintcommit add_dependencies(lintcommit nvim_bin) add_custom_target(lint) -add_dependencies(lint lintc lintlua lintsh lintcommit lintdoc) +add_dependencies(lint lintc lintlua lintsh) # Format add_glob_target( @@ -302,26 +299,25 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(cmake.packaging) endif() +get_externalproject_options(uncrustify ${DEPS_IGNORE_SHA}) ExternalProject_Add(uncrustify - URL https://github.com/uncrustify/uncrustify/archive/uncrustify-0.78.1.tar.gz - URL_HASH SHA256=ecaf4c0adca14c36dfffa30bc28e69865115ecd602c90eb16a8cddccb41caad2 DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/uncrustify CMAKE_ARGS ${DEPS_CMAKE_ARGS} + -D CMAKE_RUNTIME_OUTPUT_DIRECTORY=${DEPS_BIN_DIR} EXCLUDE_FROM_ALL TRUE - DOWNLOAD_NO_PROGRESS TRUE) + ${EXTERNALPROJECT_OPTIONS}) option(USE_BUNDLED_BUSTED "Use bundled busted" ON) if(USE_BUNDLED_BUSTED) - ExternalProject_Add(lua-dev-deps - URL https://github.com/neovim/deps/raw/5a1f71cceb24990a0b15fd9a472a5f549f019248/opt/lua-dev-deps.tar.gz - URL_HASH SHA256=27db2495f5eddc7fc191701ec9b291486853530c6125609d3197d03481e8d5a2 - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua-dev-deps + get_externalproject_options(lua_dev_deps ${DEPS_IGNORE_SHA}) + ExternalProject_Add(lua_dev_deps + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua_dev_deps SOURCE_DIR ${DEPS_SHARE_DIR} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" EXCLUDE_FROM_ALL TRUE - DOWNLOAD_NO_PROGRESS TRUE) + ${EXTERNALPROJECT_OPTIONS}) else() - add_custom_target(lua-dev-deps) + add_custom_target(lua_dev_deps) endif() diff --git a/CMakePresets.json b/CMakePresets.json index 1d214d78016e38..b47f509d5fb006 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -10,7 +10,7 @@ { "name": "default", "displayName": "RelWithDebInfo", - "description": "Enables optimizations (-Og or -O2) with debug information", + "description": "Enables optimizations with debug information", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" }, @@ -19,7 +19,7 @@ { "name": "debug", "displayName": "Debug", - "description": "Disables optimizations (-O0), enables debug information", + "description": "No optimizations, enables debug information", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }, @@ -28,7 +28,7 @@ { "name": "release", "displayName": "Release", - "description": "Same as RelWithDebInfo, but disables debug information", + "description": "Optimized for performance, disables debug information", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88d2a990296269..324cb3e13acfe3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,8 @@ low-risk/isolated tasks: - Fix bugs found by [Coverity](#coverity). - [Merge a Vim patch] (requires strong familiarity with Vim) - NOTE: read the above link before sending improvements to "runtime files" (anything in `runtime/`). - - Vimscript and documentation files are (mostly) maintained by [Vim](https://github.com/vim/vim), not Nvim. + - Vimscript and documentation files are (mostly) maintained by [Vim], not Nvim. + - Nvim's [filetype detection](https://github.com/neovim/neovim/blob/master/runtime/lua/vim/filetype.lua) behavior matches Vim, so changes to filetype detection should be submitted to [Vim] first. - Lua files are maintained by Nvim. Reporting problems @@ -41,10 +42,10 @@ Developer guidelines make distclean make # Nvim build system uses ninja automatically, if available. ``` -- Install `ccache` for faster rebuilds of Nvim. Nvim will use it automatically - if it's found. To disable caching use: +- Install `ccache` or `sccache` for faster rebuilds of Nvim. Nvim will use one + of these automatically if it's found. To disable caching use: ```bash - CCACHE_DISABLE=true make + cmake -B build -D CACHE_PRG=OFF ``` Pull requests (PRs) @@ -82,38 +83,36 @@ a comment. ### Commit messages Follow the [conventional commits guidelines][conventional_commits] to *make reviews easier* and to make -the VCS/git logs more valuable. The general structure of a commit message is: - -``` -([optional scope]): - -[optional body] - -[optional footer(s)] -``` +the VCS/git logs more valuable (try `make lintcommit`). The structure of a commit message is: + + type(scope): subject + + Problem: + ... + + Solution: + ... + +- Commit message **subject** (you can **ignore this for "fixup" commits** or any commits you expect to be squashed): + - Prefix with a [_type_](https://github.com/commitizen/conventional-commit-types/blob/master/index.json): + - `build ci docs feat fix perf refactor revert test vim-patch` + - Append an optional `(scope)` such as `(lsp)`, `(treesitter)`, `(float)`, … + - Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug." + - Keep it short (under 72 characters). +- Commit message **body** (detail): + - Concisely describe the Problem/Solution in the commit **body**. [Describing the problem](https://lamport.azurewebsites.net/pubs/state-the-problem.pdf) + _independently of the solution_ often leads to a better understanding for you, reviewers, and future readers. + ``` + Problem: + + Solution: + ``` +- Indicate breaking API changes with "!" after the type, and a "BREAKING CHANGE" footer. Example: + ``` + refactor(provider)!: drop support for Python 2 -- Prefix the commit subject with one of these [_types_](https://github.com/commitizen/conventional-commit-types/blob/master/index.json): - - `build`, `ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `test`, `vim-patch` - - You can **ignore this for "fixup" commits** or any commits you expect to be squashed. -- Append optional scope to _type_ such as `(lsp)`, `(treesitter)`, `(float)`, … -- _Description_ shouldn't start with a capital letter or end in a period. -- Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug." -- Try to keep the first line under 72 characters. -- A blank line must follow the subject. -- Breaking API changes must be indicated by - 1. "!" after the type/scope, and - 2. a "BREAKING CHANGE" footer describing the change. - Example: - ``` - refactor(provider)!: drop support for Python 2 - - BREAKING CHANGE: refactor to use Python 3 features since Python 2 is no longer supported. - ``` - -### News - -High level release notes are maintained in [news.txt](runtime/doc/news.txt). A PR is not required to add a news item -but is generally recommended. + BREAKING CHANGE: refactor to use Python 3 features since Python 2 is no longer supported. + ``` ### Automated builds (CI) @@ -319,9 +318,8 @@ check from cmake. Alternatively, you may point the URL as a local path where the repository is. This is convenient when bisecting a problem in a dependency with `git bisect`. -This requires running `make distclean` the first time once to remove traces of -the previous build. Hash checking is always skipped in this case regardless of -`DEPS_IGNORE_SHA`. +This may require running `make distclean` between each build. Hash checking is +always skipped in this case regardless of `DEPS_IGNORE_SHA`. ```bash LUAJIT_URL /home/user/luajit @@ -350,6 +348,7 @@ as context, use the `-W` argument as well. [Cirrus CI]: https://cirrus-ci.com/github/neovim/neovim [Clang report]: https://neovim.io/doc/reports/clang/ [GitHub Actions]: https://github.com/neovim/neovim/actions +[Vim]: https://github.com/vim/vim [clangd]: https://clangd.llvm.org [Merge a Vim patch]: https://neovim.io/doc/user/dev_vimpatch.html [complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow diff --git a/INSTALL.md b/INSTALL.md index 0e7208a78216db..807922e2e3557c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -15,7 +15,8 @@ Install from download Downloads are available on the [Releases](https://github.com/neovim/neovim/releases) page. * Latest [stable release](https://github.com/neovim/neovim/releases/latest) - * [macOS](https://github.com/neovim/neovim/releases/latest/download/nvim-macos.tar.gz) + * [macOS x86](https://github.com/neovim/neovim/releases/latest/download/nvim-macos-x86_64.tar.gz) + * [macOS arm](https://github.com/neovim/neovim/releases/latest/download/nvim-macos-arm64.tar.gz) * [Linux](https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz) * [Windows](https://github.com/neovim/neovim/releases/latest/download/nvim-win64.msi) * Latest [development prerelease](https://github.com/neovim/neovim/releases/nightly) @@ -36,7 +37,7 @@ Windows 8+ is required. Windows 7 or older is not supported. ### [Chocolatey](https://chocolatey.org) -- **Release (v0.7):** `choco install neovim` (use -y for automatically skipping confirmation messages) +- **Latest Release:** `choco install neovim` (use -y for automatically skipping confirmation messages) - **Development (pre-release):** `choco install neovim --pre` ### [Scoop](https://scoop.sh/) @@ -54,12 +55,12 @@ Several Neovim GUIs are available from scoop (extras): [scoop.sh/#/apps?q=neovim 1. Choose a package (**nvim-winXX.zip**) from the [releases page](https://github.com/neovim/neovim/releases). 2. Unzip the package. Any location is fine, administrator privileges are _not_ required. - `$VIMRUNTIME` will be set to that location automatically. -3. Double-click `nvim-qt.exe`. +3. Run `nvim.exe` from a terminal. **Optional** steps: - Add the `bin` folder (e.g. `C:\Program Files\nvim\bin`) to your PATH. - - This makes it easy to run `nvim` and `nvim-qt` from anywhere. + - This makes it easy to run `nvim` from anywhere. - If `:set spell` does not work, create the `C:/Users/foo/AppData/Local/nvim/site/spell` folder. You can then copy your spell files over (for English, located [here](https://github.com/vim/vim/blob/master/runtime/spell/en.utf-8.spl) and @@ -111,7 +112,7 @@ sudo rm -rf /opt/nvim sudo tar -C /opt -xzf nvim-linux64.tar.gz ``` -After this step add this to `~/.bashrc`: +Then add this to your shell config (`~/.bashrc`, `~/.zshrc`, ...): export PATH="$PATH:/opt/nvim-linux64/bin" @@ -128,7 +129,7 @@ To expose nvim globally: mkdir -p /opt/nvim mv nvim.appimage /opt/nvim/nvim -And the following line to `~/.bashrc`: +And the following line to your shell config (`~/.bashrc`, `~/.zshrc`, ...): export PATH="$PATH:/opt/nvim/" @@ -203,7 +204,7 @@ You can also get nightly builds of git master from the [Copr automated build sys dnf copr enable agriffis/neovim-nightly dnf install -y neovim python3-neovim -See the [blog post](https://arongriffis.com/2019/03/02/neovim-nightly-builds) for information on how these are built. +See the [blog post](https://arongriffis.com/2019-03-02-neovim-nightly-builds) for information on how these are built. ### Flatpak @@ -301,7 +302,7 @@ Neovim nightly and stable are available on the [snap store](https://snapcraft.io **Stable Builds** ```sh -sudo snap install --beta nvim --classic +sudo snap install nvim --classic ``` **Nightly Builds** diff --git a/MAINTAIN.md b/MAINTAIN.md index 09f3efbed254d4..eb58664ed2113e 100644 --- a/MAINTAIN.md +++ b/MAINTAIN.md @@ -22,7 +22,7 @@ In practice we haven't found a way to forecast more precisely than "next" and * Next feature-release (1.x.0) The forecasting problem might be solved with an explicit priority system (like -Bram's todo.txt). Meanwhile the Neovim priority system is defined by: +Vim's todo.txt). Meanwhile the Neovim priority system is defined by: * PRs nearing completion. * Issue labels. E.g. the `has:plan` label increases the ticket's priority merely @@ -50,15 +50,14 @@ has a major bug: 1. Fix the bug on `master`. 2. Cherry-pick the fix to `release-x.y`. 3. Cut a release from `release-x.y`. - * Run `./scripts/release.sh` - * Update (force-push) the remote `stable` tag. + * Run `./scripts/release.sh` (requires [git cliff](https://github.com/orhun/git-cliff)) * The [CI job](https://github.com/neovim/neovim/blob/3d45706478cd030c3ee05b4f336164bb96138095/.github/workflows/release.yml#L11-L13) - will update the release assets and force-push to the `stable` tag. + will update the release assets and [force-push to the "stable" tag](https://github.com/neovim/neovim/blob/cdd87222c86c5b2274a13d36f23de0637462e317/.github/workflows/release.yml#L229). ### Release automation -Neovim automation includes a [backport bot](https://github.com/zeebe-io/backport-action). -Trigger the action by labeling a PR with `backport release-X.Y`. See `.github/workflows/backport.yml`. +Neovim automation includes a [backport bot](https://github.com/korthout/backport-action). +Trigger the action by labeling a PR with `ci:backport release-x.y`. See `.github/workflows/backport.yml`. Deprecating and removing features --------------------------------- @@ -72,39 +71,39 @@ inform users of the change. When a (non-experimental) feature is slated to be removed it should: 1. Be _soft_ deprecated in the _next_ release - - Use of the deprecated feature will still work. - - This means deprecating via documentation and annotation (`@deprecated`). - - Include a note in `news.txt` under `DEPRECATIONS`. - - For Lua features, use `vim.deprecate()`. The specified version is the - current minor version + 2. For example, if the current version is - `v0.10.0-dev-1957+gd676746c33` then use `0.12`. - - For Vimscript features, use `v:lua.vim.deprecate()`. Use the same version - as described for Lua features. + - Use of the deprecated feature will still work. + - This means deprecating via documentation and annotation (`@deprecated`). + - Include a note in `deprecated.txt`. + - For Lua features, use `vim.deprecate()`. The specified version is the + current minor version + 2. For example, if the current version is + `v0.10.0-dev-1957+gd676746c33` then use `0.12`. + - For Vimscript features, use `v:lua.vim.deprecate()`. Use the same version + as described for Lua features. + - `vim.deprecate(…, 'x.y.z')` where major version `x` is greater than the + current Nvim major version, is always treated as _soft_ deprecation. 2. Be _hard_ deprecated in a following a release in which it was soft deprecated. - - Use of the deprecated feature will still work but should issue a warning. - - Features implemented in C will need bespoke implementations to communicate - to users that the feature is deprecated. + - Use of the deprecated feature will still work but should issue a warning. + - Features implemented in C will need bespoke implementations to communicate + to users that the feature is deprecated. 3. Be removed in a release following the release in which it was hard deprecated - - Usually this will be the next release, but it may be a later release if a - longer deprecation cycle is desired - - If possible, keep the feature as a stub (e.g. function API) and issue an error - when it is accessed. + - Usually this will be the next release, but it may be a later release if + a longer deprecation cycle is desired + - If possible, keep the feature as a stub (e.g. function API) and issue an + error when it is accessed. Example: -``` - Deprecation Removal - ┆ ┆ ┆ - ┆ Soft ┆ Hard ┆ - ┆ Deprecation ┆ Deprecation ┆ - ┆ Period ┆ Period ┆ - ──────────────────────────────────────────────────────────── -Version: 0.10 0.11 0.12 - ──────────────────────────────────────────────────────────── - Old code Old code Old code - + + - New code New code New code -``` + Deprecation Removal + ┆ ┆ ┆ + ┆ Soft ┆ Hard ┆ + ┆ Deprecation ┆ Deprecation ┆ + ┆ Period ┆ Period ┆ + ──────────────────────────────────────────────────────────── + Version: 0.10 0.11 0.12 + ──────────────────────────────────────────────────────────── + Old code Old code Old code + + + + New code New code New code Feature removals which may benefit from community input or further discussion should also have a tracking issue (which should be linked to in the release @@ -132,12 +131,10 @@ Some can be auto-bumped by `scripts/bump_deps.lua`. * [gettext](https://ftp.gnu.org/pub/gnu/gettext/) * [libiconv](https://ftp.gnu.org/pub/gnu/libiconv) * [libuv](https://github.com/libuv/libuv) -* [libvterm](http://www.leonerd.org.uk/code/libvterm/) - * Downloading from the original source is unreliable, so we use our [mirror](https://github.com/neovim/libvterm) instead. * [lua-compat](https://github.com/keplerproject/lua-compat-5.3) * [tree-sitter](https://github.com/tree-sitter/tree-sitter) * [unibilium](https://github.com/neovim/unibilium) - * The original project [was abandoned](https://github.com/neovim/neovim/issues/10302), so the [neovim/unibilium](https://github.com/neovim/unibilium) fork is considered "upstream" and is maintained on the `master` branch. + * The original project [was abandoned](https://github.com/neovim/neovim/issues/10302), so the [neovim/unibilium](https://github.com/neovim/unibilium) fork is considered "upstream" and is maintained on the `master` branch. * [treesitter parsers](https://github.com/neovim/neovim/blob/7e97c773e3ba78fcddbb2a0b9b0d572c8210c83e/cmake.deps/deps.txt#L47-L62) ### Vendored dependencies @@ -146,6 +143,8 @@ These dependencies are "vendored" (inlined), we must update the sources manually * `src/mpack/`: [libmpack](https://github.com/libmpack/libmpack) * send improvements upstream! +* `src/mpack/lmpack.c`: [libmpack-lua](https://github.com/libmpack/libmpack-lua) + * send improvements upstream! * `src/xdiff/`: [xdiff](https://github.com/git/git/tree/master/xdiff) * `src/cjson/`: [lua-cjson](https://github.com/openresty/lua-cjson) * `src/klib/`: [Klib](https://github.com/attractivechaos/klib) @@ -163,14 +162,18 @@ These dependencies are "vendored" (inlined), we must update the sources manually * Needs to be updated when LPeg is updated. * `src/bit.c`: only for PUC lua: port of `require'bit'` from luajit https://bitop.luajit.org/ * `runtime/lua/coxpcall.lua`: coxpcall (only needed for PUC lua, builtin to luajit) -* `src/termkey`: [libtermkey](https://github.com/neovim/libtermkey) -Non-technical dependencies +Other dependencies -------------------------- * GitHub users: * https://github.com/marvim * https://github.com/nvim-winget +* Org secrets/tokens: + * `CODECOV_TOKEN` + * `BACKPORT_KEY` +* Org/repo variables: + * `BACKPORT_APP` * Domain names (held in https://namecheap.com): * neovim.org * neovim.io @@ -186,10 +189,10 @@ Refactoring Refactoring Vim structurally and aesthetically is an important goal of Neovim. But there are some modules that should not be changed significantly, because -they are maintained Vim, at present. Until someone takes "ownership" of these -modules, the cost of any significant changes (including style or structural -changes that re-arrange the code) to these modules outweighs the benefit. The -modules are: +they are maintained by Vim, at present. Until someone takes "ownership" of +these modules, the cost of any significant changes (including style or +structural changes that re-arrange the code) to these modules outweighs the +benefit. The modules are: - `regexp.c` - `indent_c.c` @@ -208,18 +211,16 @@ https://github.com/neovim/neovim-backup * Avoid macOS if an Ubuntu or a Windows runner can be used instead. This is because macOS runners have [tighter restrictions on the number of concurrent jobs](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits). - * Runner versions: * For special-purpose jobs where the runner version doesn't really matter, prefer `-latest` tags so we don't need to manually bump the versions. An example of a special-purpose workflow is `labeler_pr.yml`. - * For our testing jobs, which are in `test.yml` and `build.yml`, prefer to - use the latest stable (i.e. non-beta) version explicitly. Avoid using the - `-latest` tags here as it makes it difficult to determine from an - unrelated PR if a failure is due to the PR itself or due to GitHub bumping - the `-latest` tag without our knowledge. There's also a high risk that - automatically bumping the CI versions will fail due to manual work being - required from experience. + * For our testing job `test.yml`, prefer to use the latest version + explicitly. Avoid using the `-latest` tags here as it makes it difficult + to determine from an unrelated PR if a failure is due to the PR itself or + due to GitHub bumping the `-latest` tag without our knowledge. There's + also a high risk that automatically bumping the CI versions will fail due + to manual work being required from experience. * For our release job, which is `release.yml`, prefer to use the oldest stable (i.e. non-deprecated) versions available. The reason is that we're trying to produce images that work in the broadest number of environments, @@ -229,7 +230,7 @@ https://github.com/neovim/neovim-backup Some github labels are used to trigger certain jobs: -* `backport release-x.y` - backport to release branch +* `ci:backport release-x.y` - backport to branch `release-x.y` * `ci:s390x` - enable s390x CI * `ci:skip-news` - skip news.yml workflows * `ci:windows-asan` - test windows with ASAN enabled diff --git a/Makefile b/Makefile index c44be8f8c78a34..9154cd8782562a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,25 @@ +ifeq ($(OS),Windows_NT) + SHELL := powershell.exe + .SHELLFLAGS := -NoProfile -NoLogo + MKDIR := @$$null = new-item -itemtype directory -force + TOUCH := @$$null = new-item -force + RM := remove-item -force + CMAKE := cmake + CMAKE_GENERATOR := Ninja + define rmdir + if (Test-Path $1) { remove-item -recurse $1 } + endef +else + MKDIR := mkdir -p + TOUCH := touch + RM := rm -rf + CMAKE := $(shell (command -v cmake3 || command -v cmake || echo cmake)) + CMAKE_GENERATOR ?= "$(shell (command -v ninja > /dev/null 2>&1 && echo "Ninja") || echo "Unix Makefiles")" + define rmdir + rm -rf $1 + endef +endif + MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) MAKEFILE_DIR := $(dir $(MAKEFILE_PATH)) @@ -9,7 +31,6 @@ filter-true = $(strip $(filter-out 1 on ON true TRUE,$1)) all: nvim -CMAKE ?= $(shell (command -v cmake3 || echo cmake)) CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) # Extra CMake flags which extend the default set CMAKE_EXTRA_FLAGS ?= @@ -37,21 +58,11 @@ else checkprefix: ; endif -CMAKE_GENERATOR ?= $(shell (command -v ninja > /dev/null 2>&1 && echo "Ninja") || \ - echo "Unix Makefiles") -DEPS_BUILD_DIR ?= .deps +DEPS_BUILD_DIR ?= ".deps" ifneq (1,$(words [$(DEPS_BUILD_DIR)])) $(error DEPS_BUILD_DIR must not contain whitespace) endif -ifeq (,$(BUILD_TOOL)) - ifeq (Ninja,$(CMAKE_GENERATOR)) - BUILD_TOOL = ninja - else - BUILD_TOOL = $(MAKE) - endif -endif - DEPS_CMAKE_FLAGS ?= USE_BUNDLED ?= @@ -61,7 +72,7 @@ endif ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS))) BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON - $(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || rm build/.ran-*) + $(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || $(RM) build/.ran-*) endif # For use where we want to make sure only a single job is run. This does issue @@ -69,34 +80,33 @@ endif SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE) nvim: build/.ran-cmake deps - $(BUILD_TOOL) -C build + $(CMAKE) --build build libnvim: build/.ran-cmake deps - $(BUILD_TOOL) -C build libnvim + $(CMAKE) --build build --target libnvim cmake: - touch CMakeLists.txt + $(TOUCH) CMakeLists.txt $(MAKE) build/.ran-cmake build/.ran-cmake: | deps - $(CMAKE) -B build -G '$(CMAKE_GENERATOR)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(MAKEFILE_DIR) - touch $@ + $(CMAKE) -B build -G $(CMAKE_GENERATOR) $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(MAKEFILE_DIR) + $(TOUCH) $@ deps: | build/.ran-deps-cmake ifeq ($(call filter-true,$(USE_BUNDLED)),) - $(BUILD_TOOL) -C $(DEPS_BUILD_DIR) + $(CMAKE) --build $(DEPS_BUILD_DIR) endif ifeq ($(call filter-true,$(USE_BUNDLED)),) $(DEPS_BUILD_DIR): - mkdir -p "$@" + $(MKDIR) $@ build/.ran-deps-cmake:: $(DEPS_BUILD_DIR) - $(CMAKE) -S $(MAKEFILE_DIR)/cmake.deps -B $(DEPS_BUILD_DIR) -G '$(CMAKE_GENERATOR)' \ - $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) $(DEPS_CMAKE_FLAGS) + $(CMAKE) -S $(MAKEFILE_DIR)/cmake.deps -B $(DEPS_BUILD_DIR) -G $(CMAKE_GENERATOR) $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) $(DEPS_CMAKE_FLAGS) endif build/.ran-deps-cmake:: - mkdir -p build - touch $@ + $(MKDIR) build + $(TOUCH) "$@" # TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag. oldtest: | nvim @@ -113,7 +123,7 @@ test/old/testdir/%.vim: phony_force nvim $(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst test/old/testdir/%.vim,%,$@) functionaltest-lua: | nvim - $(BUILD_TOOL) -C build functionaltest + $(CMAKE) --build build --target functionaltest FORMAT=formatc formatlua format LINT=lintlua lintsh lintc clang-analyzer lintcommit lintdoc lint @@ -123,6 +133,9 @@ generated-sources benchmark $(FORMAT) $(LINT) $(TEST) doc: | build/.ran-cmake test: $(TEST) +# iwyu-fix-includes can be downloaded from +# https://github.com/include-what-you-use/include-what-you-use/blob/master/fix_includes.py. +# Create a iwyu-fix-includes shell script in your $PATH that invokes the python script. iwyu: build/.ran-cmake $(CMAKE) --preset iwyu $(CMAKE) --build build > build/iwyu.log @@ -135,16 +148,19 @@ iwyu: build/.ran-cmake $(CMAKE) --build build clean: - test -d build && $(BUILD_TOOL) -C build clean || true +ifneq ($(wildcard build),) + $(CMAKE) --build build --target clean +endif $(MAKE) -C test/old/testdir clean $(MAKE) -C runtime/indent clean distclean: - rm -rf $(DEPS_BUILD_DIR) build + $(call rmdir, $(DEPS_BUILD_DIR)) + $(call rmdir, build) $(MAKE) clean install: checkprefix nvim - $(BUILD_TOOL) -C build install + $(CMAKE) --install build appimage: bash scripts/genappimage.sh @@ -155,14 +171,4 @@ appimage: appimage-%: bash scripts/genappimage.sh $* -# Generic pattern rules, allowing for `make build/bin/nvim` etc. -# Does not work with "Unix Makefiles". -ifeq ($(CMAKE_GENERATOR),Ninja) -build/%: phony_force - $(BUILD_TOOL) -C build $(patsubst build/%,%,$@) - -$(DEPS_BUILD_DIR)/%: phony_force - $(BUILD_TOOL) -C $(DEPS_BUILD_DIR) $(patsubst $(DEPS_BUILD_DIR)/%,%,$@) -endif - .PHONY: test clean distclean nvim libnvim cmake deps install appimage checkprefix benchmark $(FORMAT) $(LINT) $(TEST) diff --git a/README.md b/README.md index 23fc8cdda43ade..8feb7918886d54 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Features - [API access](https://github.com/neovim/neovim/wiki/Related-projects#api-clients) from any language including C/C++, C#, Clojure, D, Elixir, Go, Haskell, Java/Kotlin, JavaScript/Node.js, Julia, Lisp, Lua, Perl, Python, Racket, Ruby, Rust -- Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/nvim_terminal_emulator.html) +- Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/terminal.html) - Asynchronous [job control](https://github.com/neovim/neovim/pull/2247) - [Shared data (shada)](https://github.com/neovim/neovim/pull/2506) among multiple editor instances - [XDG base directories](https://github.com/neovim/neovim/pull/3470) support diff --git a/cmake.config/CMakeLists.txt b/cmake.config/CMakeLists.txt index d30c522aa24b00..aac8c4c27bb37d 100644 --- a/cmake.config/CMakeLists.txt +++ b/cmake.config/CMakeLists.txt @@ -173,9 +173,7 @@ function(append_target_expression) ${ARGN}) set(TARGET_EXPRESSION "$") - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.15) - set(TARGET_EXPRESSION "$") - endif() + set(TARGET_EXPRESSION "$") set(TARGET_EXPRESSION "${ARG_PREFIX}$") set(VERSION_STRING "${VERSION_STRING} ${TARGET_EXPRESSION} " PARENT_SCOPE) @@ -194,6 +192,6 @@ file(GENERATE INPUT "${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef.h.gen") configure_file ( - "${PROJECT_SOURCE_DIR}/cmake.config/pathdef.c.in" - "${PROJECT_BINARY_DIR}/cmake.config/auto/pathdef.c" + "${PROJECT_SOURCE_DIR}/cmake.config/pathdef.h.in" + "${PROJECT_BINARY_DIR}/cmake.config/auto/pathdef.h" ESCAPE_QUOTES) diff --git a/cmake.config/config.h.in b/cmake.config/config.h.in index af4e13fc11e61d..833218abf9a4cb 100644 --- a/cmake.config/config.h.in +++ b/cmake.config/config.h.in @@ -34,7 +34,6 @@ #cmakedefine HAVE_WORKING_LIBINTL #cmakedefine UNIX #cmakedefine CASE_INSENSITIVE_FILENAME -#cmakedefine USE_FNAME_CASE #cmakedefine HAVE_SYS_UIO_H #ifdef HAVE_SYS_UIO_H #cmakedefine HAVE_READV @@ -53,3 +52,5 @@ #cmakedefine HAVE_BUILTIN_ADD_OVERFLOW #cmakedefine HAVE_WIMPLICIT_FALLTHROUGH_FLAG #cmakedefine HAVE_BITSCANFORWARD64 + +#define VTERM_TEST_FILE "@VTERM_TEST_FILE@" diff --git a/cmake.config/pathdef.c.in b/cmake.config/pathdef.h.in similarity index 75% rename from cmake.config/pathdef.c.in rename to cmake.config/pathdef.h.in index 773fa1d5924935..bc09549fb7ca34 100644 --- a/cmake.config/pathdef.c.in +++ b/cmake.config/pathdef.h.in @@ -1,4 +1,3 @@ -#include "${PROJECT_SOURCE_DIR}/src/nvim/vim_defs.h" char *default_vim_dir = "${CMAKE_INSTALL_FULL_DATAROOTDIR}/nvim"; char *default_vimruntime_dir = ""; char *default_lib_dir = "${CMAKE_INSTALL_FULL_LIBDIR}/nvim"; diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt index 4853a1ab14c05c..394c50a3b5bcb2 100644 --- a/cmake.deps/CMakeLists.txt +++ b/cmake.deps/CMakeLists.txt @@ -1,5 +1,5 @@ # This is not meant to be included by the top-level. -cmake_minimum_required (VERSION 3.13) +cmake_minimum_required(VERSION 3.16) project(NVIM_DEPS C) if(POLICY CMP0135) @@ -27,16 +27,16 @@ set(DEPS_IGNORE_SHA FALSE) option(USE_BUNDLED "Use bundled dependencies." ON) option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED}) -option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED}) option(USE_BUNDLED_LPEG "Use the bundled lpeg." ${USE_BUNDLED}) # PUC Lua is only used for tests, unless explicitly requested. option(USE_BUNDLED_LUA "Use the bundled version of lua." OFF) option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED}) option(USE_BUNDLED_LUV "Use the bundled version of luv." ${USE_BUNDLED}) -option(USE_BUNDLED_MSGPACK "Use the bundled msgpack." ${USE_BUNDLED}) option(USE_BUNDLED_TS "Use the bundled treesitter runtime." ${USE_BUNDLED}) option(USE_BUNDLED_TS_PARSERS "Use the bundled treesitter parsers." ${USE_BUNDLED}) option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED}) +option(USE_BUNDLED_UTF8PROC "Use the bundled utf8proc library." ${USE_BUNDLED}) + if(USE_BUNDLED AND MSVC) option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." ON) option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." ON) @@ -45,6 +45,19 @@ else() option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." OFF) endif() +option(ENABLE_WASMTIME "Use treesitter with wasmtime support." OFF) +if(ENABLE_WASMTIME) + if(USE_BUNDLED) + option(USE_BUNDLED_WASMTIME "Use the bundled wasmtime." ON) + else() + option(USE_BUNDLED_WASMTIME "Use the bundled wasmtime." OFF) + endif() +endif() +if(NOT ENABLE_WASMTIME AND USE_BUNDLED_WASMTIME) + message(FATAL_ERROR "ENABLE_WASMTIME is set to OFF while USE_BUNDLED_WASMTIME is set to ON.\ + You need set ENABLE_WASMTIME to ON if you want to use wasmtime.") +endif() + option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF) set_default_buildtype(Release) @@ -74,25 +87,6 @@ if(APPLE) message(STATUS "Using deployment target ${CMAKE_OSX_DEPLOYMENT_TARGET}") endif() -set_directory_properties(PROPERTIES - EP_PREFIX "${DEPS_BUILD_DIR}" - CMAKE_CONFIGURE_DEPENDS deps.txt) - -file(READ deps.txt DEPENDENCIES) -STRING(REGEX REPLACE "\n" ";" DEPENDENCIES "${DEPENDENCIES}") -foreach(dep ${DEPENDENCIES}) - STRING(REGEX REPLACE " " ";" dep "${dep}") - list(GET dep 0 name) - list(GET dep 1 value) - if(NOT ${name}) - # _URL variables must NOT be set when USE_EXISTING_SRC_DIR is set, - # otherwise ExternalProject will try to re-download the sources. - if(NOT USE_EXISTING_SRC_DIR) - set(${name} ${value}) - endif() - endif() -endforeach() - if(USE_BUNDLED_LUAJIT) set(LUA_ENGINE LuaJit) elseif(USE_BUNDLED_LUA) @@ -115,18 +109,10 @@ if(USE_BUNDLED_UNIBILIUM) include(BuildUnibilium) endif() -if(USE_BUNDLED_LIBVTERM) - include(BuildLibvterm) -endif() - if(USE_BUNDLED_LIBUV) include(BuildLibuv) endif() -if(USE_BUNDLED_MSGPACK) - include(BuildMsgpack) -endif() - if(USE_BUNDLED_LUAJIT) include(BuildLuajit) endif() @@ -155,10 +141,18 @@ if(USE_BUNDLED_TS_PARSERS) include(BuildTreesitterParsers) endif() +if(USE_BUNDLED_WASMTIME) + include(BuildWasmtime) +endif() + if(USE_BUNDLED_TS) include(BuildTreesitter) endif() +if(USE_BUNDLED_UTF8PROC) + include(BuildUTF8proc) +endif() + if(WIN32) include(GetBinaryDeps) diff --git a/cmake.deps/CMakePresets.json b/cmake.deps/CMakePresets.json index f399dad2179b9d..fdec38372c1958 100644 --- a/cmake.deps/CMakePresets.json +++ b/cmake.deps/CMakePresets.json @@ -16,8 +16,9 @@ "description": "Build neovim with external deps on ubuntu", "cacheVariables": { "USE_BUNDLED":"OFF", - "USE_BUNDLED_LIBVTERM":"ON", - "USE_BUNDLED_TS":"ON" + "USE_BUNDLED_TS":"ON", + "USE_BUNDLED_UTF8PROC":"ON", + "ENABLE_WASMTIME":"OFF" }, "inherits": ["base"] } diff --git a/cmake.deps/cmake/BuildLibvterm.cmake b/cmake.deps/cmake/BuildLibvterm.cmake deleted file mode 100644 index 3415d8debe863f..00000000000000 --- a/cmake.deps/cmake/BuildLibvterm.cmake +++ /dev/null @@ -1,8 +0,0 @@ -get_externalproject_options(libvterm ${DEPS_IGNORE_SHA}) -ExternalProject_Add(libvterm - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libvterm - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibvtermCMakeLists.txt - ${DEPS_BUILD_DIR}/src/libvterm/CMakeLists.txt - CMAKE_ARGS ${DEPS_CMAKE_ARGS} - ${EXTERNALPROJECT_OPTIONS}) diff --git a/cmake.deps/cmake/BuildMsgpack.cmake b/cmake.deps/cmake/BuildMsgpack.cmake deleted file mode 100644 index 8f82dab1406a57..00000000000000 --- a/cmake.deps/cmake/BuildMsgpack.cmake +++ /dev/null @@ -1,7 +0,0 @@ -get_externalproject_options(msgpack ${DEPS_IGNORE_SHA}) -ExternalProject_Add(msgpack - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/msgpack - CMAKE_ARGS ${DEPS_CMAKE_ARGS} - -D MSGPACK_BUILD_TESTS=OFF - -D MSGPACK_BUILD_EXAMPLES=OFF - ${EXTERNALPROJECT_OPTIONS}) diff --git a/cmake.deps/cmake/BuildTreesitter.cmake b/cmake.deps/cmake/BuildTreesitter.cmake index 7eb98163b90fd5..f5962c80374734 100644 --- a/cmake.deps/cmake/BuildTreesitter.cmake +++ b/cmake.deps/cmake/BuildTreesitter.cmake @@ -1,8 +1,14 @@ +if(ENABLE_WASMTIME) + set(TREESITTER_ARGS -D TREE_SITTER_FEATURE_WASM=ON) +endif() + get_externalproject_options(treesitter ${DEPS_IGNORE_SHA}) ExternalProject_Add(treesitter DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/treesitter - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TreesitterCMakeLists.txt - ${DEPS_BUILD_DIR}/src/treesitter/CMakeLists.txt - CMAKE_ARGS ${DEPS_CMAKE_ARGS} + SOURCE_SUBDIR lib + CMAKE_ARGS ${DEPS_CMAKE_ARGS} ${TREESITTER_ARGS} ${EXTERNALPROJECT_OPTIONS}) + +if(USE_BUNDLED_WASMTIME) + add_dependencies(treesitter wasmtime) +endif() diff --git a/cmake.deps/cmake/BuildTreesitterParsers.cmake b/cmake.deps/cmake/BuildTreesitterParsers.cmake index 837d075d20f635..060447e6fe8dd2 100644 --- a/cmake.deps/cmake/BuildTreesitterParsers.cmake +++ b/cmake.deps/cmake/BuildTreesitterParsers.cmake @@ -28,7 +28,7 @@ function(BuildTSParser) ${EXTERNALPROJECT_OPTIONS}) endfunction() -foreach(lang c lua vim vimdoc query python bash) +foreach(lang c lua vim vimdoc query) BuildTSParser(LANG ${lang}) endforeach() BuildTSParser(LANG markdown CMAKE_FILE MarkdownParserCMakeLists.txt) diff --git a/cmake.deps/cmake/BuildUTF8proc.cmake b/cmake.deps/cmake/BuildUTF8proc.cmake new file mode 100644 index 00000000000000..9445e615f034cb --- /dev/null +++ b/cmake.deps/cmake/BuildUTF8proc.cmake @@ -0,0 +1,5 @@ +get_externalproject_options(utf8proc ${DEPS_IGNORE_SHA}) +ExternalProject_Add(utf8proc + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/utf8proc + CMAKE_ARGS ${DEPS_CMAKE_ARGS} + ${EXTERNALPROJECT_OPTIONS}) diff --git a/cmake.deps/cmake/BuildWasmtime.cmake b/cmake.deps/cmake/BuildWasmtime.cmake new file mode 100644 index 00000000000000..d3c51ebdc78dba --- /dev/null +++ b/cmake.deps/cmake/BuildWasmtime.cmake @@ -0,0 +1,11 @@ +# wasmtime is a chungus -- optimize _extra hard_ to keep nvim svelte +get_externalproject_options(wasmtime ${DEPS_IGNORE_SHA}) +ExternalProject_Add(wasmtime + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/wasmtime + SOURCE_SUBDIR crates/c-api + CMAKE_ARGS ${DEPS_CMAKE_ARGS} + -D WASMTIME_FASTEST_RUNTIME=ON # build with full LTO + -D WASMTIME_DISABLE_ALL_FEATURES=ON # don't need all that crap... + -D WASMTIME_FEATURE_CRANELIFT=ON # ...except this one (compiles wasm to platform code) + USES_TERMINAL_BUILD TRUE + ${EXTERNALPROJECT_OPTIONS}) diff --git a/cmake.deps/cmake/GettextCMakeLists.txt b/cmake.deps/cmake/GettextCMakeLists.txt index 16fce4485ffaaa..b86f3c6a5231dc 100644 --- a/cmake.deps/cmake/GettextCMakeLists.txt +++ b/cmake.deps/cmake/GettextCMakeLists.txt @@ -1,9 +1,4 @@ -cmake_minimum_required(VERSION 3.13) - -# Can be removed once minimum version is at least 3.15 -if(POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) -endif() +cmake_minimum_required(VERSION 3.16) project(gettext C) add_compile_options(-w) @@ -20,15 +15,20 @@ string(REPLACE "#undef HAVE_LONG_LONG_INT" "#define HAVE_LONG_LONG_INT 1" CONFIG string(REPLACE "#undef HAVE_ICONV_H" "#define HAVE_ICONV_H 1" CONFIG_CONTENT ${CONFIG_CONTENT}) string(REPLACE "#undef HAVE_ICONV" "#define HAVE_ICONV 1" CONFIG_CONTENT ${CONFIG_CONTENT}) string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" CONFIG_CONTENT ${CONFIG_CONTENT}) -string(REPLACE "#undef uintmax_t" " - #if _WIN64 - # define intmax_t long long - # define uintmax_t unsigned long long - #elif _WIN32 - # define intmax_t long - # define uintmax_t unsigned long - #endif" - CONFIG_CONTENT ${CONFIG_CONTENT}) +if(MSVC) + string(REPLACE "#undef HAVE_STDINT_H_WITH_UINTMAX" "#define HAVE_STDINT_H_WITH_UINTMAX 1" CONFIG_CONTENT ${CONFIG_CONTENT}) + string(REPLACE "#undef HAVE_STDINT_H" "#define HAVE_STDINT_H 1" CONFIG_CONTENT ${CONFIG_CONTENT}) +else() + string(REPLACE "#undef uintmax_t" " + #if _WIN64 + # define intmax_t long long + # define uintmax_t unsigned long long + #elif _WIN32 + # define intmax_t long + # define uintmax_t unsigned long + #endif" + CONFIG_CONTENT ${CONFIG_CONTENT}) + endif() file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/config.h ${CONFIG_CONTENT}) set(HAVE_NEWLOCALE 0) diff --git a/cmake.deps/cmake/LibiconvCMakeLists.txt b/cmake.deps/cmake/LibiconvCMakeLists.txt index 220e3e07cb3621..91813148839cef 100644 --- a/cmake.deps/cmake/LibiconvCMakeLists.txt +++ b/cmake.deps/cmake/LibiconvCMakeLists.txt @@ -1,8 +1,4 @@ -cmake_minimum_required(VERSION 3.13) -# Can be removed once minimum version is at least 3.15 -if(POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) -endif() +cmake_minimum_required(VERSION 3.16) project(libiconv C) add_compile_options(-w) diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt deleted file mode 100644 index 41c79a915f94fb..00000000000000 --- a/cmake.deps/cmake/LibvtermCMakeLists.txt +++ /dev/null @@ -1,85 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -# Can be removed once minimum version is at least 3.15 -if(POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) -endif() -project(libvterm C) - -add_compile_options(-w) - -include(GNUInstallDirs) - -set(DECDRAWING [[ - static const struct StaticTableEncoding encoding_DECdrawing = { - { .decode = &decode_table }, - { - [0x60] = 0x25C6, - [0x61] = 0x2592, - [0x62] = 0x2409, - [0x63] = 0x240C, - [0x64] = 0x240D, - [0x65] = 0x240A, - [0x66] = 0x00B0, - [0x67] = 0x00B1, - [0x68] = 0x2424, - [0x69] = 0x240B, - [0x6a] = 0x2518, - [0x6b] = 0x2510, - [0x6c] = 0x250C, - [0x6d] = 0x2514, - [0x6e] = 0x253C, - [0x6f] = 0x23BA, - [0x70] = 0x23BB, - [0x71] = 0x2500, - [0x72] = 0x23BC, - [0x73] = 0x23BD, - [0x74] = 0x251C, - [0x75] = 0x2524, - [0x76] = 0x2534, - [0x77] = 0x252C, - [0x78] = 0x2502, - [0x79] = 0x2A7D, - [0x7a] = 0x2A7E, - [0x7b] = 0x03C0, - [0x7c] = 0x2260, - [0x7d] = 0x00A3, - [0x7e] = 0x00B7, - } - }; -]] -) - -set(UK [[ - static const struct StaticTableEncoding encoding_uk = { - { .decode = &decode_table }, - { - [0x23] = 0x00a3, - } - }; -]] -) - -file(WRITE src/encoding/DECdrawing.inc "${DECDRAWING}") -file(WRITE src/encoding/uk.inc "${UK}") - -include_directories(${CMAKE_SOURCE_DIR}/include) -include_directories(${CMAKE_BINARY_DIR}) - -file(GLOB VTERM_SOURCES ${CMAKE_SOURCE_DIR}/src/*.c) -add_library(vterm ${VTERM_SOURCES}) -install(TARGETS vterm ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -install(FILES include/vterm.h include/vterm_keycodes.h - DESTINATION include) - -if(NOT WIN32) - file(GLOB BIN_SOURCES ${CMAKE_SOURCE_DIR}/bin/*.c) - foreach(EXE_C ${BIN_SOURCES}) - get_filename_component(target_name ${EXE_C} NAME_WE) - add_executable(${target_name} ${EXE_C}) - target_link_libraries(${target_name} vterm) - install(TARGETS ${target_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endforeach() -endif() - -# vim: set ft=cmake: diff --git a/cmake.deps/cmake/LpegCMakeLists.txt b/cmake.deps/cmake/LpegCMakeLists.txt index 4dcf3a1b777608..ac1da8c062e8d3 100644 --- a/cmake.deps/cmake/LpegCMakeLists.txt +++ b/cmake.deps/cmake/LpegCMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.16) project (lpeg C) include(GNUInstallDirs) diff --git a/cmake.deps/cmake/MarkdownParserCMakeLists.txt b/cmake.deps/cmake/MarkdownParserCMakeLists.txt index 8ee149e774aaa6..504acb74a59fb2 100644 --- a/cmake.deps/cmake/MarkdownParserCMakeLists.txt +++ b/cmake.deps/cmake/MarkdownParserCMakeLists.txt @@ -1,8 +1,4 @@ -cmake_minimum_required(VERSION 3.13) -# Can be removed once minimum version is at least 3.15 -if(POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) -endif() +cmake_minimum_required(VERSION 3.16) project(${PARSERLANG} C) add_compile_options(-w) diff --git a/cmake.deps/cmake/TreesitterCMakeLists.txt b/cmake.deps/cmake/TreesitterCMakeLists.txt deleted file mode 100644 index f1e0d4e5750e78..00000000000000 --- a/cmake.deps/cmake/TreesitterCMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -# Can be removed once minimum version is at least 3.15 -if(POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) -endif() -project(treesitter C) - -add_compile_options(-w) - -add_library(tree-sitter lib/src/lib.c) -target_include_directories(tree-sitter - PRIVATE lib/src lib/include) - -install(FILES - lib/include/tree_sitter/api.h - DESTINATION include/tree_sitter) - -include(GNUInstallDirs) -install(TARGETS tree-sitter DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -# vim: set ft=cmake: diff --git a/cmake.deps/cmake/TreesitterParserCMakeLists.txt b/cmake.deps/cmake/TreesitterParserCMakeLists.txt index c71a0a8f9b4e03..08b942a0ffa143 100644 --- a/cmake.deps/cmake/TreesitterParserCMakeLists.txt +++ b/cmake.deps/cmake/TreesitterParserCMakeLists.txt @@ -1,8 +1,4 @@ -cmake_minimum_required(VERSION 3.13) -# Can be removed once minimum version is at least 3.15 -if(POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) -endif() +cmake_minimum_required(VERSION 3.16) project(parser C) add_compile_options(-w) diff --git a/cmake.deps/deps.txt b/cmake.deps/deps.txt index db69624751fd35..b7a9812676e226 100644 --- a/cmake.deps/deps.txt +++ b/cmake.deps/deps.txt @@ -1,20 +1,14 @@ -LIBUV_URL https://github.com/libuv/libuv/archive/v1.48.0.tar.gz -LIBUV_SHA256 8c253adb0f800926a6cbd1c6576abae0bc8eb86a4f891049b72f9e5b7dc58f33 +LIBUV_URL https://github.com/libuv/libuv/archive/v1.50.0.tar.gz +LIBUV_SHA256 b1ec56444ee3f1e10c8bd3eed16ba47016ed0b94fe42137435aaf2e0bd574579 -MSGPACK_URL https://github.com/msgpack/msgpack-c/archive/c-6.0.1.tar.gz -MSGPACK_SHA256 58d5fe49d0ee2b374d60a61aabf8028b2c92004e6f11bff04e74b639fc8ad541 - -LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/75e92777988017fe47c5eb290998021bbf972d1f.tar.gz -LUAJIT_SHA256 0f69288190024d732c67645e40ed5b137d67aa950fedf0f44a9ad0f3dba6d5d2 +LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/a4f56a459a588ae768801074b46ba0adcfb49eb1.tar.gz +LUAJIT_SHA256 b4120332a4191db9c9da2d81f9f11f0d4504fc4cff2dea0f642d3d8f1fcebd0e LUA_URL https://www.lua.org/ftp/lua-5.1.5.tar.gz LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333 -UNIBILIUM_URL https://github.com/neovim/unibilium/archive/d72c3598e7ac5d1ebf86ee268b8b4ed95c0fa628.tar.gz -UNIBILIUM_SHA256 9c4747c862ab5e3076dcf8fa8f0ea7a6b50f20ec5905618b9536655596797487 - -LIBVTERM_URL https://github.com/neovim/libvterm/archive/v0.3.3.tar.gz -LIBVTERM_SHA256 0babe3ab42c354925dadede90d352f054aa9c4ae6842ea803a20c9741e172e56 +UNIBILIUM_URL https://github.com/neovim/unibilium/archive/v2.1.2.tar.gz +UNIBILIUM_SHA256 370ecb07fbbc20d91d1b350c55f1c806b06bf86797e164081ccc977fc9b3af7a LUV_URL https://github.com/luvit/luv/releases/download/1.48.0-2/luv-1.48.0-2.tar.gz LUV_SHA256 2c3a1ddfebb4f6550293a40ee789f7122e97647eede51511f57203de48c03b7a @@ -41,21 +35,28 @@ GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c LIBICONV_URL https://github.com/neovim/deps/raw/b9bf36eb31f27e8136d907da38fa23518927737e/opt/libiconv-1.17.tar.gz LIBICONV_SHA256 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313 -TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.21.0.tar.gz -TREESITTER_C_SHA256 6f0f5d1b71cf8ffd8a37fb638c6022fa1245bd630150b538547d52128ce0ea7e -TREESITTER_LUA_URL https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.1.0.tar.gz -TREESITTER_LUA_SHA256 230cfcbfa74ed1f7b8149e9a1f34c2efc4c589a71fe0f5dc8560622f8020d722 +UTF8PROC_URL https://github.com/JuliaStrings/utf8proc/archive/v2.10.0.tar.gz +UTF8PROC_SHA256 6f4f1b639daa6dca9f80bc5db1233e9cbaa31a67790887106160b33ef743f136 + +TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.23.2.tar.gz +TREESITTER_C_SHA256 d8b9c1b2ffb6a42caf9bc76e07c52507d4e60b17175ed9beb0e779be8db1200c +TREESITTER_LUA_URL https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.2.0.tar.gz +TREESITTER_LUA_SHA256 6c41227cd0a59047b19d31f0031d4d901f08bfd78d6fc7f55c89e5b8374c794e TREESITTER_VIM_URL https://github.com/neovim/tree-sitter-vim/archive/v0.4.0.tar.gz TREESITTER_VIM_SHA256 9f856f8b4a10ab43348550fa2d3cb2846ae3d8e60f45887200549c051c66f9d5 -TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.5.1.tar.gz -TREESITTER_VIMDOC_SHA256 063645096504b21603585507c41c6d8718ff3c11b2150c5bfc31e8f3ee9afea3 -TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.2.0.tar.gz -TREESITTER_QUERY_SHA256 5a0ee26c4af94adb9ab850a518613f75e7040354f5b049a5b85457ebf579ae8b -TREESITTER_PYTHON_URL https://github.com/tree-sitter/tree-sitter-python/archive/v0.21.0.tar.gz -TREESITTER_PYTHON_SHA256 720304a603271fa89e4430a14d6a81a023d6d7d1171b1533e49c0ab44f1e1c13 -TREESITTER_BASH_URL https://github.com/tree-sitter/tree-sitter-bash/archive/v0.21.0.tar.gz -TREESITTER_BASH_SHA256 f0515efda839cfede851adb24ac154227fbc0dfb60c6c11595ecfa9087d43ceb -TREESITTER_MARKDOWN_URL https://github.com/MDeiml/tree-sitter-markdown/archive/v0.2.3.tar.gz -TREESITTER_MARKDOWN_SHA256 4909d6023643f1afc3ab219585d4035b7403f3a17849782ab803c5f73c8a31d5 -TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.22.5.tar.gz -TREESITTER_SHA256 6bc22ca7e0f81d77773462d922cf40b44bfd090d92abac75cb37dbae516c2417 +TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v3.0.0.tar.gz +TREESITTER_VIMDOC_SHA256 a639bf92bf57bfa1cdc90ca16af27bfaf26a9779064776dd4be34c1ef1453f6c +TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.4.0.tar.gz +TREESITTER_QUERY_SHA256 d3a423ab66dc62b2969625e280116678a8a22582b5ff087795222108db2f6a6e +TREESITTER_MARKDOWN_URL https://github.com/tree-sitter-grammars/tree-sitter-markdown/archive/v0.3.2.tar.gz +TREESITTER_MARKDOWN_SHA256 5dac48a6d971eb545aab665d59a18180d21963afc781bbf40f9077c06cb82ae5 +TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.24.7.tar.gz +TREESITTER_SHA256 7cbc13c974d6abe978cafc9da12d1e79e07e365c42af75e43ec1b5cdc03ed447 + +WASMTIME_URL https://github.com/bytecodealliance/wasmtime/archive/v25.0.3.tar.gz +WASMTIME_SHA256 17850ca356fce6ea8bcd3847692b3233588ddf32ff31fcccac67ad06bcac0a3a + +UNCRUSTIFY_URL https://github.com/uncrustify/uncrustify/archive/uncrustify-0.80.1.tar.gz +UNCRUSTIFY_SHA256 0e2616ec2f78e12816388c513f7060072ff7942b42f1175eb28b24cb75aaec48 +LUA_DEV_DEPS_URL https://github.com/neovim/deps/raw/06ef2b58b0876f8de1a3f5a710473dcd7afff251/opt/lua-dev-deps.tar.gz +LUA_DEV_DEPS_SHA256 49f8399e453103064a23c65534f266f3067cda716b6502f016bfafeed5799354 diff --git a/cmake.packaging/CMakeLists.txt b/cmake.packaging/CMakeLists.txt index 645215ec9244c5..8c158c39dc88d8 100644 --- a/cmake.packaging/CMakeLists.txt +++ b/cmake.packaging/CMakeLists.txt @@ -38,6 +38,11 @@ if(WIN32) # Create start menu and desktop shortcuts set(CPACK_WIX_PROGRAM_MENU_FOLDER "${CPACK_PACKAGE_NAME}") set(CPACK_PACKAGE_EXECUTABLES "nvim" "Neovim") + set(CPACK_WIX_INSTALL_SCOPE "perMachine") + + set(CPACK_WIX_UI_REF "WixUI_CustomInstallDir") + list(APPEND CPACK_WIX_EXTRA_SOURCES ${CMAKE_CURRENT_LIST_DIR}/WixUI_CustomInstallDir.wxs) + list(APPEND CPACK_WIX_EXTRA_SOURCES ${CMAKE_CURRENT_LIST_DIR}/CustomInstallDirDlg.wxs) # We use a wix patch to add further options to the installer. # See: https://cmake.org/cmake/help/v3.7/module/CPackWIX.html#variable:CPACK_WIX_PATCH_FILE diff --git a/cmake.packaging/CustomInstallDirDlg.wxs b/cmake.packaging/CustomInstallDirDlg.wxs new file mode 100644 index 00000000000000..73864cec0bb162 --- /dev/null +++ b/cmake.packaging/CustomInstallDirDlg.wxs @@ -0,0 +1,41 @@ + + + + + + + + + + + + 1 + + + + + + + + + + Note: besides its installation folder, [ProductName] stores configuration, data, and logs in standard locations. These can be further configured by the $NVIM_APPNAME environment variable. Also, the "base" (root) directories conform to the XDG Base Directory Specification. For more information see: + + + https://neovim.io/doc/user/starting.html#standard-path]]> + + + https://neovim.io/doc/user/starting.html#base-directories]]> + + + https://neovim.io/doc/user/starting.html#$NVIM_APPNAME]]> + + + Install [ProductName] to: + + + + + + + diff --git a/cmake.packaging/WixPatch.xml b/cmake.packaging/WixPatch.xml index 1196f4f335e887..89c47753ce163d 100644 --- a/cmake.packaging/WixPatch.xml +++ b/cmake.packaging/WixPatch.xml @@ -6,7 +6,7 @@ Name='PATH' Action='set' Permanent='no' - System='no' + System='yes' Part='last' Value='[INSTALL_ROOT]bin' /> diff --git a/cmake.packaging/WixUI_CustomInstallDir.wxs b/cmake.packaging/WixUI_CustomInstallDir.wxs new file mode 100644 index 00000000000000..80157587714b6b --- /dev/null +++ b/cmake.packaging/WixUI_CustomInstallDir.wxs @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + "1"]]> + + 1 + + NOT Installed + Installed AND PATCH + + 1 + LicenseAccepted = "1" + + 1 + 1 + NOT WIXUI_DONTVALIDATEPATH + "1"]]> + WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1" + 1 + 1 + + NOT Installed + Installed AND NOT PATCH + Installed AND PATCH + + 1 + + 1 + 1 + 1 + + + + + + + diff --git a/cmake/Deps.cmake b/cmake/Deps.cmake index 7a098415d7687d..5902ca6970222e 100644 --- a/cmake/Deps.cmake +++ b/cmake/Deps.cmake @@ -18,9 +18,17 @@ if(APPLE) list(APPEND DEPS_CMAKE_ARGS -D CMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK}) endif() +find_program(CACHE_PRG NAMES ccache sccache) +mark_as_advanced(CACHE_PRG) +if(CACHE_PRG) + set(CMAKE_C_COMPILER_LAUNCHER ${CMAKE_COMMAND} -E env CCACHE_SLOPPINESS=pch_defines,time_macros ${CACHE_PRG}) + list(APPEND DEPS_CMAKE_CACHE_ARGS -DCMAKE_C_COMPILER_LAUNCHER:STRING=${CMAKE_C_COMPILER_LAUNCHER}) +endif() + # MAKE_PRG if(UNIX) find_program(MAKE_PRG NAMES gmake make) + mark_as_advanced(MAKE_PRG) if(NOT MAKE_PRG) message(FATAL_ERROR "GNU Make is required to build the dependencies.") else() @@ -47,23 +55,43 @@ if(CMAKE_OSX_SYSROOT) set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}") endif() +get_filename_component(rootdir ${PROJECT_SOURCE_DIR} NAME) +if(${rootdir} MATCHES "cmake.deps") + set(depsfile ${PROJECT_SOURCE_DIR}/deps.txt) +else() + set(depsfile ${PROJECT_SOURCE_DIR}/cmake.deps/deps.txt) +endif() + +set_directory_properties(PROPERTIES + EP_PREFIX "${DEPS_BUILD_DIR}" + CMAKE_CONFIGURE_DEPENDS ${depsfile}) + +file(READ ${depsfile} DEPENDENCIES) +STRING(REGEX REPLACE "\n" ";" DEPENDENCIES "${DEPENDENCIES}") +foreach(dep ${DEPENDENCIES}) + STRING(REGEX REPLACE " " ";" dep "${dep}") + list(GET dep 0 name) + list(GET dep 1 value) + if(NOT ${name}) + # _URL variables must NOT be set when USE_EXISTING_SRC_DIR is set, + # otherwise ExternalProject will try to re-download the sources. + if(NOT USE_EXISTING_SRC_DIR) + set(${name} ${value}) + endif() + endif() +endforeach() + function(get_externalproject_options name DEPS_IGNORE_SHA) string(TOUPPER ${name} name_allcaps) set(url ${${name_allcaps}_URL}) - set(EXTERNALPROJECT_OPTIONS DOWNLOAD_NO_PROGRESS TRUE) + set(EXTERNALPROJECT_OPTIONS + DOWNLOAD_NO_PROGRESS TRUE + EXTERNALPROJECT_OPTIONS URL ${${name_allcaps}_URL} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) - if(EXISTS ${url}) - list(APPEND EXTERNALPROJECT_OPTIONS - GIT_REPOSITORY ${${name_allcaps}_URL}) - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18) - list(APPEND EXTERNALPROJECT_OPTIONS GIT_REMOTE_UPDATE_STRATEGY CHECKOUT) - endif() - else() - list(APPEND EXTERNALPROJECT_OPTIONS URL ${${name_allcaps}_URL}) - if(NOT ${DEPS_IGNORE_SHA}) - list(APPEND EXTERNALPROJECT_OPTIONS URL_HASH SHA256=${${name_allcaps}_SHA256}) - endif() + if(NOT ${DEPS_IGNORE_SHA}) + list(APPEND EXTERNALPROJECT_OPTIONS URL_HASH SHA256=${${name_allcaps}_SHA256}) endif() set(EXTERNALPROJECT_OPTIONS ${EXTERNALPROJECT_OPTIONS} PARENT_SCOPE) diff --git a/cmake/FindLibvterm.cmake b/cmake/FindLibvterm.cmake deleted file mode 100644 index 68c2646d4774a9..00000000000000 --- a/cmake/FindLibvterm.cmake +++ /dev/null @@ -1,31 +0,0 @@ -find_path2(LIBVTERM_INCLUDE_DIR vterm.h) -find_library2(LIBVTERM_LIBRARY vterm) - -if(LIBVTERM_INCLUDE_DIR AND EXISTS "${LIBVTERM_INCLUDE_DIR}/vterm.h") - file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MAJOR REGEX "#define VTERM_VERSION_MAJOR") - string(REGEX MATCH "[0-9]+" VTERM_VERSION_MAJOR ${VTERM_VERSION_MAJOR}) - - file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MINOR REGEX "#define VTERM_VERSION_MINOR") - string(REGEX MATCH "[0-9]+" VTERM_VERSION_MINOR ${VTERM_VERSION_MINOR}) - - file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_PATCH REGEX "#define VTERM_VERSION_PATCH") - - # The following is needed to give a coherent error for versions 0.3.2 and - # smaller. - if(VTERM_VERSION_PATCH) - string(REGEX MATCH "[0-9]+" VTERM_VERSION_PATCH ${VTERM_VERSION_PATCH}) - string(PREPEND VTERM_VERSION_PATCH ".") - endif() - - set(VTERM_VERSION ${VTERM_VERSION_MAJOR}.${VTERM_VERSION_MINOR}${VTERM_VERSION_PATCH}) -endif() - -find_package_handle_standard_args(Libvterm - REQUIRED_VARS LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY - VERSION_VAR VTERM_VERSION) - -add_library(libvterm INTERFACE) -target_include_directories(libvterm SYSTEM BEFORE INTERFACE ${LIBVTERM_INCLUDE_DIR}) -target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY}) - -mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY) diff --git a/cmake/FindLpeg.cmake b/cmake/FindLpeg.cmake index 3d0ff5929dd5ed..7657bdac9e8ba3 100644 --- a/cmake/FindLpeg.cmake +++ b/cmake/FindLpeg.cmake @@ -1,4 +1,13 @@ -find_library2(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a lpeg${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) +find_library2(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a lpeg.so lpeg${CMAKE_SHARED_LIBRARY_SUFFIX} PATH_SUFFIXES lua/5.1) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND LPEG_LIBRARY MATCHES ".so$") + execute_process( + COMMAND otool -hv "${LPEG_LIBRARY}" + OUTPUT_VARIABLE LPEG_HEADER + ) + if(LPEG_HEADER MATCHES ".* BUNDLE .*") + message(FATAL_ERROR "lpeg library found at ${LPEG_LIBRARY} but built as a bundle rather than a dylib, please rebuild with `-dynamiclib` rather than `-bundle`") + endif() +endif() find_package_handle_standard_args(Lpeg DEFAULT_MSG LPEG_LIBRARY) mark_as_advanced(LPEG_LIBRARY) diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake deleted file mode 100644 index 9ef18122ab063b..00000000000000 --- a/cmake/FindMsgpack.cmake +++ /dev/null @@ -1,24 +0,0 @@ -find_path2(MSGPACK_INCLUDE_DIR msgpack/version_master.h) - -if(MSGPACK_INCLUDE_DIR) - file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h) - string(REGEX REPLACE ".*MSGPACK_VERSION_MAJOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MAJOR "${msgpack_version_h}") - string(REGEX REPLACE ".*MSGPACK_VERSION_MINOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MINOR "${msgpack_version_h}") - string(REGEX REPLACE ".*MSGPACK_VERSION_REVISION +([0-9]+).*" "\\1" MSGPACK_VERSION_REVISION "${msgpack_version_h}") - set(MSGPACK_VERSION_STRING "${MSGPACK_VERSION_MAJOR}.${MSGPACK_VERSION_MINOR}.${MSGPACK_VERSION_REVISION}") -else() - set(MSGPACK_VERSION_STRING) -endif() - -find_library2(MSGPACK_LIBRARY NAMES msgpackc msgpack msgpackc_import msgpack-c - NAMES_PER_DIR) - -mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) - -find_package_handle_standard_args(Msgpack - REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR - VERSION_VAR MSGPACK_VERSION_STRING) - -add_library(msgpack INTERFACE) -target_include_directories(msgpack SYSTEM BEFORE INTERFACE ${MSGPACK_INCLUDE_DIR}) -target_link_libraries(msgpack INTERFACE ${MSGPACK_LIBRARY}) diff --git a/cmake/FindUTF8proc.cmake b/cmake/FindUTF8proc.cmake new file mode 100644 index 00000000000000..2183f35d34da58 --- /dev/null +++ b/cmake/FindUTF8proc.cmake @@ -0,0 +1,12 @@ +find_path2(UTF8PROC_INCLUDE_DIR utf8proc.h) +find_library2(UTF8PROC_LIBRARY NAMES utf8proc utf8proc_static) +find_package_handle_standard_args(UTF8proc DEFAULT_MSG + UTF8PROC_LIBRARY UTF8PROC_INCLUDE_DIR) +mark_as_advanced(UTF8PROC_LIBRARY UTF8PROC_INCLUDE_DIR) + +add_library(utf8proc INTERFACE) +target_include_directories(utf8proc SYSTEM BEFORE INTERFACE ${UTF8PROC_INCLUDE_DIR}) +target_link_libraries(utf8proc INTERFACE ${UTF8PROC_LIBRARY}) + +#TODO(dundargoc): this is a hack that should ideally be hardcoded into the utf8proc project via configure_command +target_compile_definitions(utf8proc INTERFACE "UTF8PROC_STATIC") diff --git a/cmake/FindWasmtime.cmake b/cmake/FindWasmtime.cmake new file mode 100644 index 00000000000000..e6315748b48b8c --- /dev/null +++ b/cmake/FindWasmtime.cmake @@ -0,0 +1,22 @@ +find_path2(WASMTIME_INCLUDE_DIR wasmtime.h) +find_library2(WASMTIME_LIBRARY wasmtime) + +if(WASMTIME_INCLUDE_DIR AND EXISTS "${WASMTIME_INCLUDE_DIR}/wasmtime.h") + file(STRINGS ${WASMTIME_INCLUDE_DIR}/wasmtime.h WASMTIME_VERSION REGEX "#define WASMTIME_VERSION") + string(REGEX MATCH "[0-9]+\.[0-9]\.[0-9]" WASMTIME_VERSION ${WASMTIME_VERSION}) +endif() + +find_package_handle_standard_args(Wasmtime + REQUIRED_VARS WASMTIME_INCLUDE_DIR WASMTIME_LIBRARY + VERSION_VAR WASMTIME_VERSION) + +add_library(wasmtime INTERFACE) +target_include_directories(wasmtime SYSTEM BEFORE INTERFACE ${WASMTIME_INCLUDE_DIR}) +target_link_libraries(wasmtime INTERFACE ${WASMTIME_LIBRARY}) + +if(MSVC) + target_compile_options(wasmtime INTERFACE -DWASM_API_EXTERN= -DWASI_API_EXTERN=) + target_link_libraries(wasmtime INTERFACE ws2_32 advapi32 userenv ntdll shell32 ole32 bcrypt) +endif() + +mark_as_advanced(WASMTIME_INCLUDE_DIR WASMTIME_LIBRARY) diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake index c862c88acff240..add83bc9cb4038 100644 --- a/cmake/RunTests.cmake +++ b/cmake/RunTests.cmake @@ -4,6 +4,7 @@ set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime) set(ENV{NVIM_RPLUGIN_MANIFEST} ${BUILD_DIR}/Xtest_rplugin_manifest) set(ENV{XDG_CONFIG_HOME} ${BUILD_DIR}/Xtest_xdg/config) set(ENV{XDG_DATA_HOME} ${BUILD_DIR}/Xtest_xdg/share) +set(ENV{XDG_STATE_HOME} ${BUILD_DIR}/Xtest_xdg/state) unset(ENV{XDG_DATA_DIRS}) unset(ENV{NVIM}) # Clear $NVIM in case tests are running from Nvim. #11009 diff --git a/cmake/Util.cmake b/cmake/Util.cmake index f09de786686e8f..8ca39e5f9413db 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -61,6 +61,7 @@ function(add_glob_target) if(NOT ARG_COMMAND) add_custom_target(${ARG_TARGET}) add_custom_command(TARGET ${ARG_TARGET} + POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found") return() endif() @@ -175,8 +176,7 @@ function(add_target) add_custom_target(${target} DEPENDS ${touch_file}) endfunction() -# Set default build type to BUILD_TYPE. Also limit the list of allowable build -# types to the ones defined in variable allowableBuildTypes. +# Set default build type to BUILD_TYPE. # # The correct way to specify build type (for example Release) for # single-configuration generators (Make and Ninja) is to run @@ -193,28 +193,24 @@ endfunction() # Passing CMAKE_BUILD_TYPE for multi-config generators will not only not be # used, but also generate a warning for the user. function(set_default_buildtype BUILD_TYPE) - set(allowableBuildTypes Debug Release MinSizeRel RelWithDebInfo) - if(NOT BUILD_TYPE IN_LIST allowableBuildTypes) - message(FATAL_ERROR "Invalid build type: ${BUILD_TYPE}") - endif() + set(defaultBuildTypes Debug Release MinSizeRel RelWithDebInfo) get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(isMultiConfig) - # Multi-config generators use the first element in CMAKE_CONFIGURATION_TYPES as the default build type - list(INSERT allowableBuildTypes 0 ${BUILD_TYPE}) - list(REMOVE_DUPLICATES allowableBuildTypes) - set(CMAKE_CONFIGURATION_TYPES ${allowableBuildTypes} PARENT_SCOPE) + # Multi-config generators use the first element in + # CMAKE_CONFIGURATION_TYPES as the default build type + list(INSERT defaultBuildTypes 0 ${BUILD_TYPE}) + list(REMOVE_DUPLICATES defaultBuildTypes) + set(CMAKE_CONFIGURATION_TYPES ${defaultBuildTypes} PARENT_SCOPE) if(CMAKE_BUILD_TYPE) message(WARNING "CMAKE_BUILD_TYPE specified which is ignored on \ multi-configuration generators. Defaulting to ${BUILD_TYPE} build type.") endif() else() - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowableBuildTypes}") + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${defaultBuildTypes}") if(NOT CMAKE_BUILD_TYPE) message(STATUS "CMAKE_BUILD_TYPE not specified, default is '${BUILD_TYPE}'") set(CMAKE_BUILD_TYPE ${BUILD_TYPE} CACHE STRING "Choose the type of build" FORCE) - elseif(NOT CMAKE_BUILD_TYPE IN_LIST allowableBuildTypes) - message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}") else() message(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") endif() diff --git a/contrib/flake.lock b/contrib/flake.lock deleted file mode 100644 index 8679977e327fde..00000000000000 --- a/contrib/flake.lock +++ /dev/null @@ -1,61 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1713248628, - "narHash": "sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U+ISA=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "5672bc9dbf9d88246ddab5ac454e82318d094bb8", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/contrib/flake.nix b/contrib/flake.nix deleted file mode 100644 index d5fc5169dbc26f..00000000000000 --- a/contrib/flake.nix +++ /dev/null @@ -1,164 +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 }: - let - inherit (builtins) - elemAt - foldl' - mapAttrs - match - readFile - ; - inherit (nixpkgs.lib) - const - flip - pipe - remove - splitString - toLower - ; - in - { - overlay = final: prev: { - - neovim = (final.neovim-unwrapped.override { - treesitter-parsers = pipe ../cmake.deps/deps.txt [ - readFile - (splitString "\n") - (map (match "TREESITTER_([A-Z_]+)_(URL|SHA256)[[:space:]]+([^[:space:]]+)[[:space:]]*")) - (remove null) - (flip foldl' { } - (acc: matches: - let - lang = toLower (elemAt matches 0); - type = toLower (elemAt matches 1); - value = elemAt matches 2; - in - acc // { - ${lang} = acc.${lang} or { } // { - ${type} = value; - }; - })) - (mapAttrs (const final.fetchurl)) - (self: self // { - markdown = final.stdenv.mkDerivation { - inherit (self.markdown) name; - src = self.markdown; - installPhase = '' - mv tree-sitter-markdown $out - ''; - }; - }) - ]; - }).overrideAttrs (oa: rec { - version = self.shortRev or "dirty"; - src = ../.; - preConfigure = oa.preConfigure or "" + '' - sed -i cmake.config/versiondef.h.in -e 's/@NVIM_VERSION_PRERELEASE@/-dev-${version}/' - ''; - nativeBuildInputs = oa.nativeBuildInputs ++ [ - final.libiconv - ]; - }); - - # a development binary to help debug issues - neovim-debug = let - stdenv = if final.stdenv.isLinux then - final.llvmPackages_latest.stdenv - else - final.stdenv; - in (final.neovim.override { - lua = final.luajit; - inherit stdenv; - }).overrideAttrs (oa: { - - dontStrip = true; - NIX_CFLAGS_COMPILE = " -ggdb -Og"; - - cmakeBuildType = "Debug"; - - disallowedReferences = [ ]; - }); - - # for neovim developers, beware of the slow binary - neovim-developer = let inherit (final.luaPackages) luacheck; - in final.neovim-debug.overrideAttrs (oa: { - cmakeFlags = oa.cmakeFlags ++ [ - "-DLUACHECK_PRG=${luacheck}/bin/luacheck" - "-DENABLE_LTO=OFF" - ] ++ final.lib.optionals final.stdenv.isLinux [ - # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags - # https://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports - "-DENABLE_ASAN_UBSAN=ON" - ]; - doCheck = final.stdenv.isLinux; - }); - }; - } // flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { - overlays = [ self.overlay ]; - inherit system; - }; - - lua = pkgs.lua5_1; - - pythonEnv = pkgs.python3.withPackages (ps: [ - ps.msgpack - ]); - in { - packages = with pkgs; { - default = neovim; - inherit neovim neovim-debug neovim-developer; - }; - - checks = { - shlint = pkgs.runCommand "shlint" { - nativeBuildInputs = [ pkgs.shellcheck ]; - preferLocalBuild = true; - } "make -C ${./..} shlint > $out"; - }; - - # kept for backwards-compatibility - defaultPackage = pkgs.neovim; - - devShells = { - default = pkgs.neovim-developer.overrideAttrs (oa: { - - buildInputs = with pkgs; - oa.buildInputs ++ [ - lua.pkgs.luacheck - sumneko-lua-language-server - pythonEnv - include-what-you-use # for scripts/check-includes.py - jq # jq for scripts/vim-patch.sh -r - shellcheck # for `make shlint` - ]; - - nativeBuildInputs = with pkgs; - oa.nativeBuildInputs ++ [ - 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_SYMBOLIZER_PATH=${pkgs.llvm_18}/bin/llvm-symbolizer - - # ASAN_OPTIONS=detect_leaks=1 - export ASAN_OPTIONS="log_path=./test.log:abort_on_error=1" - - # for treesitter functionaltests - mkdir -p runtime/parser - cp -f ${pkgs.vimPlugins.nvim-treesitter.builtGrammars.c}/parser runtime/parser/c.so - ''; - }); - }; - }); -} diff --git a/contrib/gdb/neovim_gdb.vim b/contrib/gdb/neovim_gdb.vim index d61e7bc0cc658f..e0be6cb8037cd0 100644 --- a/contrib/gdb/neovim_gdb.vim +++ b/contrib/gdb/neovim_gdb.vim @@ -167,13 +167,15 @@ function! s:Spawn(server_cmd, client_cmd, server_addr, reconnect) if type(a:server_cmd) == type('') " spawn gdbserver in a vertical split let server = s:GdbServer.new(gdb) - vsp | enew | let gdb._server_id = termopen(a:server_cmd, server) + server.term = v:true + vsp | enew | let gdb._server_id = jobstart(a:server_cmd, server) let gdb._jump_window = 2 let gdb._server_buf = bufnr('%') endif " go to the bottom window and spawn gdb client wincmd j - enew | let gdb._client_id = termopen(a:client_cmd, gdb) + gdb.term = v:true + enew | let gdb._client_id = jobstart(a:client_cmd, gdb) let gdb._client_buf = bufnr('%') tnoremap :GdbContinuei tnoremap :GdbNexti diff --git a/contrib/local.mk.example b/contrib/local.mk.example index 58474a37506ed8..f3024a147c6704 100644 --- a/contrib/local.mk.example +++ b/contrib/local.mk.example @@ -14,7 +14,7 @@ # # - Debug: Disables optimizations (-O0), enables debug information. # -# - RelWithDebInfo: Enables optimizations (-Og or -O2) with debug information. +# - RelWithDebInfo: Enables optimizations (-O2) with debug information. # # - MinSizeRel: Enables all -O2 optimization that do not typically # increase code size, and performs further optimizations @@ -45,13 +45,12 @@ # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_GETTEXT=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBICONV=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBUV=OFF -# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBVTERM=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LUAJIT=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LUV=OFF -# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_MSGPACK=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_TS=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_TS_PARSERS=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UNIBILIUM=OFF +# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UTF8PROC=OFF # # Or disable all bundled dependencies at once. # diff --git a/contrib/minimal.lua b/contrib/minimal.lua index 2391e12f68f1cb..cb4b7f8673f4db 100644 --- a/contrib/minimal.lua +++ b/contrib/minimal.lua @@ -2,7 +2,8 @@ for name, url in pairs { -- ADD PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE, e.g: - -- some_plugin = 'https://github.com/author/plugin.nvim' + -- 'https://github.com/author1/plugin1', + -- 'https://github.com/author2/plugin2', } do local install_path = vim.fn.fnamemodify('nvim_issue/' .. name, ':p') if vim.fn.isdirectory(install_path) == 0 then diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index c171fab9e9e83e..9f108b4df4209a 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -118,4 +118,4 @@ foreach(D ${RUNTIME_DIRS}) endforeach() # only foo.sh script in runtime/ -install_helper(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/macros/less.sh DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/macros/) +install_helper(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/less.sh DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/scripts/) diff --git a/runtime/autoload/README.txt b/runtime/autoload/README.txt index 3b18d3dde5a281..bca86a2a4c85f7 100644 --- a/runtime/autoload/README.txt +++ b/runtime/autoload/README.txt @@ -7,7 +7,7 @@ gzip.vim for editing compressed files netrw*.vim browsing (remote) directories and editing remote files tar.vim browsing tar files zip.vim browsing zip files -paste.vim common code for mswin.vim, menu.vim and macmap.vim +paste.vim common code for mswin.vim and menu.vim spellfile.vim downloading of a missing spell file Omni completion files: diff --git a/runtime/autoload/dist/vim.vim b/runtime/autoload/dist/vim.vim index 021244c93b3fa5..bb858c57323579 100644 --- a/runtime/autoload/dist/vim.vim +++ b/runtime/autoload/dist/vim.vim @@ -18,6 +18,9 @@ endif if !has('vim9script') function dist#vim#IsSafeExecutable(filetype, executable) let cwd = getcwd() + if empty(exepath(a:executable)) + return v:false + endif return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) && \ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd \ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 && diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim index 26b1cda0349ba3..a6fbe2c336ef7a 100644 --- a/runtime/autoload/gzip.vim +++ b/runtime/autoload/gzip.vim @@ -1,6 +1,6 @@ " Vim autoload file for editing compressed files. " Maintainer: The Vim Project -" Last Change: 2023 Aug 10 +" Last Change: 2024 Nov 25 " Former Maintainer: Bram Moolenaar " These functions are used by the gzip plugin. @@ -148,6 +148,9 @@ fun gzip#read(cmd) else let fname = escape(expand("%:r"), " \t\n*?[{`$\\%#'\"|!<") endif + if filereadable(undofile(expand("%"))) + exe "sil rundo " . fnameescape(undofile(expand("%"))) + endif if &verbose >= 8 execute "doau BufReadPost " . fname else diff --git a/runtime/autoload/hare.vim b/runtime/autoload/hare.vim new file mode 100644 index 00000000000000..c4581fccf9af84 --- /dev/null +++ b/runtime/autoload/hare.vim @@ -0,0 +1,26 @@ +" Vim autoload file. +" Language: Hare +" Maintainer: Amelia Clarke +" Last Updated: 2024-05-10 +" Upstream: https://git.sr.ht/~sircmpwn/hare.vim + +" Attempt to find the directory for a given Hare module. +function hare#FindModule(str) + let path = substitute(trim(a:str, ':', 2), '::', '/', 'g') + let dir = finddir(path) + while !empty(path) && empty(dir) + let path = substitute(path, '/\?\h\w*$', '', '') + let dir = finddir(path) + endwhile + return dir +endfunction + +" Return the value of HAREPATH if it exists. Otherwise use a reasonable default. +function hare#GetPath() + if empty($HAREPATH) + return '/usr/src/hare/stdlib,/usr/src/hare/third-party' + endif + return substitute($HAREPATH, ':', ',', 'g') +endfunction + +" vim: et sts=2 sw=2 ts=8 diff --git a/runtime/autoload/hcl.vim b/runtime/autoload/hcl.vim new file mode 100644 index 00000000000000..2215fc8f27105f --- /dev/null +++ b/runtime/autoload/hcl.vim @@ -0,0 +1,40 @@ +" Language: HCL +" Maintainer: Gregory Anders +" Last Change: 2024-09-03 +" Based on: https://github.com/hashivim/vim-terraform + +function! hcl#indentexpr(lnum) + " Beginning of the file should have no indent + if a:lnum == 0 + return 0 + endif + + " Usual case is to continue at the same indent as the previous non-blank line. + let prevlnum = prevnonblank(a:lnum-1) + let thisindent = indent(prevlnum) + + " If that previous line is a non-comment ending in [ { (, increase the + " indent level. + let prevline = getline(prevlnum) + if prevline !~# '^\s*\(#\|//\)' && prevline =~# '[\[{\(]\s*$' + let thisindent += &shiftwidth + endif + + " If the current line ends a block, decrease the indent level. + let thisline = getline(a:lnum) + if thisline =~# '^\s*[\)}\]]' + let thisindent -= &shiftwidth + endif + + " If the previous line starts a block comment /*, increase by one + if prevline =~# '/\*' + let thisindent += 1 + endif + + " If the previous line ends a block comment */, decrease by one + if prevline =~# '\*/' + let thisindent -= 1 + endif + + return thisindent +endfunction diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim deleted file mode 100644 index a7dbedab087eb1..00000000000000 --- a/runtime/autoload/health.vim +++ /dev/null @@ -1,40 +0,0 @@ -function! s:deprecate(type) abort - let deprecate = v:lua.vim.deprecate('health#report_' . a:type, 'vim.health.' . a:type, '0.11') - redraw | echo 'Running healthchecks...' - if deprecate isnot v:null - call v:lua.vim.health.warn(deprecate) - endif -endfunction - -function! health#report_start(name) abort - call v:lua.vim.health.start(a:name) - call s:deprecate('start') -endfunction - -function! health#report_info(msg) abort - call v:lua.vim.health.info(a:msg) - call s:deprecate('info') -endfunction - -function! health#report_ok(msg) abort - call v:lua.vim.health.ok(a:msg) - call s:deprecate('ok') -endfunction - -function! health#report_warn(msg, ...) abort - if a:0 > 0 - call v:lua.vim.health.warn(a:msg, a:1) - else - call v:lua.vim.health.warn(a:msg) - endif - call s:deprecate('warn') -endfunction - -function! health#report_error(msg, ...) abort - if a:0 > 0 - call v:lua.vim.health.error(a:msg, a:1) - else - call v:lua.vim.health.error(a:msg) - endif - call s:deprecate('error') -endfunction diff --git a/runtime/autoload/javaformat.vim b/runtime/autoload/javaformat.vim new file mode 100644 index 00000000000000..4d7d32cf193e7a --- /dev/null +++ b/runtime/autoload/javaformat.vim @@ -0,0 +1,92 @@ +" Vim formatting plugin file +" Language: Java +" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com> +" Repository: https://github.com/zzzyxwvut/java-vim.git +" Last Change: 2024 Sep 26 + +" Documented in ":help ft-java-plugin". +if &cp || exists("g:loaded_javaformat") || exists("g:java_ignore_javadoc") || exists("g:java_ignore_markdown") + finish +endif + +let g:loaded_javaformat = 1 + +"""" STRIVE TO REMAIN COMPATIBLE FOR AT LEAST VIM 7.0. + +function! javaformat#RemoveCommonMarkdownWhitespace() abort + if mode() != 'n' + return 0 + endif + + let pattern = '\(^\s*///\)\(\s*\)\(.*\)' + + " E121 for v:numbermax before v8.2.2388. + " E15 for expr-<< before v8.2.5003. + let common = 0x7fffffff + let comments = [] + + for n in range(v:lnum, (v:lnum + v:count - 1)) + let parts = matchlist(getline(n), pattern) + let whitespace = get(parts, 2, '') + let nonwhitespace = get(parts, 3, '') + + if !empty(whitespace) + let common = min([common, strlen(whitespace)]) + elseif !empty(nonwhitespace) || empty(parts) + " No whitespace prefix or not a Markdown comment. + return 0 + endif + + call add(comments, [whitespace, parts[1], nonwhitespace]) + endfor + + let cursor = v:lnum + + for line in comments + call setline(cursor, join(line[1 :], strpart(line[0], common))) + let cursor += 1 + endfor + + return 0 +endfunction + +" See ":help vim9-mix". +if !has("vim9script") + finish +endif + +def! g:javaformat#RemoveCommonMarkdownWhitespace(): number + if mode() != 'n' + return 0 + endif + + const pattern: string = '\(^\s*///\)\(\s*\)\(.*\)' + var common: number = v:numbermax + var comments: list> = [] + + for n in range(v:lnum, (v:lnum + v:count - 1)) + const parts: list = matchlist(getline(n), pattern) + const whitespace: string = get(parts, 2, '') + const nonwhitespace: string = get(parts, 3, '') + + if !empty(whitespace) + common = min([common, strlen(whitespace)]) + elseif !empty(nonwhitespace) || empty(parts) + # No whitespace prefix or not a Markdown comment. + return 0 + endif + + add(comments, [whitespace, parts[1], nonwhitespace]) + endfor + + var cursor: number = v:lnum + + for line in comments + setline(cursor, join(line[1 :], strpart(line[0], common))) + cursor += 1 + endfor + + return 0 +enddef + +" vim: fdm=syntax sw=4 ts=8 noet sta diff --git a/runtime/autoload/msgpack.vim b/runtime/autoload/msgpack.vim index 18dcd1e6a649a9..fb438def4fd0e2 100644 --- a/runtime/autoload/msgpack.vim +++ b/runtime/autoload/msgpack.vim @@ -361,7 +361,7 @@ endfunction let s:MSGPACK_STANDARD_TYPES = { \type(0): 'integer', \type(0.0): 'float', - \type(''): 'binary', + \type(''): 'string', \type([]): 'array', \type({}): 'map', \type(v:true): 'boolean', @@ -412,9 +412,15 @@ endfunction "" " Dump |msgpack-special-dict| that represents a string. If any additional " parameter is given then it dumps binary string. -function s:msgpack_dump_string(v, ...) abort - let ret = [a:0 ? '"' : '="'] - for v in a:v._VAL +function s:msgpack_dump_string(v) abort + if type(a:v) == type({}) + let val = a:v + else + let val = {'_VAL': split(a:v, "\n", 1)} + end + + let ret = ['"'] + for v in val._VAL call add( \ret, \substitute( @@ -426,16 +432,6 @@ function s:msgpack_dump_string(v, ...) abort return join(ret, '') endfunction -"" -" Dump binary string. -function s:msgpack_dump_binary(v) abort - if type(a:v) == type({}) - return s:msgpack_dump_string(a:v, 1) - else - return s:msgpack_dump_string({'_VAL': split(a:v, "\n", 1)}, 1) - endif -endfunction - "" " Dump array value. function s:msgpack_dump_array(v) abort @@ -449,7 +445,7 @@ function s:msgpack_dump_map(v) abort let ret = ['{'] if msgpack#special_type(a:v) is 0 for [k, v] in items(a:v) - let ret += [s:msgpack_dump_string({'_VAL': split(k, "\n", 1)}), + let ret += [s:msgpack_dump_string({'_VAL': split(k, "\n")}), \': ', \msgpack#string(v), \', '] @@ -479,7 +475,7 @@ endfunction " Dump extension value. function s:msgpack_dump_ext(v) abort return printf('+(%i)%s', a:v._VAL[0], - \s:msgpack_dump_string({'_VAL': a:v._VAL[1]}, 1)) + \s:msgpack_dump_string({'_VAL': a:v._VAL[1]})) endfunction "" @@ -619,9 +615,7 @@ function msgpack#eval(s, special_objs) abort throw '"-invalid:Invalid string: ' . s endif call add(expr, '{''_TYPE'': v:msgpack_types.') - if empty(match[1]) - call add(expr, 'binary') - elseif match[1] is# '=' + if empty(match[1]) || match[1] is# '=' call add(expr, 'string') else call add(expr, 'ext') @@ -772,7 +766,7 @@ function msgpack#equal(a, b) let a = aspecial is 0 ? a:a : a:a._VAL let b = bspecial is 0 ? a:b : a:b._VAL return msgpack#equal(a, b) - elseif atype is# 'binary' + elseif atype is# 'string' let a = (aspecial is 0 ? split(a:a, "\n", 1) : a:a._VAL) let b = (bspecial is 0 ? split(a:b, "\n", 1) : a:b._VAL) return a ==# b @@ -787,13 +781,17 @@ function msgpack#equal(a, b) " Non-special mapping cannot have non-string keys return 0 endif - if (empty(k._VAL) - \|| k._VAL ==# [""] - \|| !empty(filter(copy(k._VAL), 'stridx(v:val, "\n") != -1'))) - " Non-special mapping cannot have zero byte in key or an empty key - return 0 + if type(k) == type({}) + if (empty(k._VAL) + \|| k._VAL ==# [""] + \|| !empty(filter(copy(k._VAL), 'stridx(v:val, "\n") != -1'))) + " Non-special mapping cannot have zero byte in key or an empty key + return 0 + endif + let kstr = join(k._VAL, "\n") + else + let kstr = k endif - let kstr = join(k._VAL, "\n") if !has_key(akeys, kstr) " Protects from both missing and duplicate keys return 0 diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim deleted file mode 100644 index f4e46c1a99857a..00000000000000 --- a/runtime/autoload/netrw.vim +++ /dev/null @@ -1,12777 +0,0 @@ -" netrw.vim: Handles file transfer and remote directory listing across -" AUTOLOAD SECTION -" Maintainer: This runtime file is looking for a new maintainer. -" Date: May 03, 2023 -" Version: 173a -" Last Change: -" 2023 Nov 21 by Vim Project: ignore wildignore when expanding $COMSPEC (v173a) -" 2023 Nov 22 by Vim Project: fix handling of very long filename on longlist style (v173a) -" 2024 Feb 19 by Vim Project: (announce adoption) -" 2024 Feb 29 by Vim Project: handle symlinks in tree mode correctly -" 2024 Apr 03 by Vim Project: detect filetypes for remote edited files -" Former Maintainer: Charles E Campbell -" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided -" *as is* and come with no warranty of any kind, either -" expressed or implied. By using this plugin, you agree that -" in no event will the copyright holder be liable for any damages -" resulting from the use of this software. -" -" Note: the code here was started in 1999 under a much earlier version of vim. The directory browsing -" code was written using vim v6, which did not have Lists (Lists were first offered with vim-v7). -" -"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() -" -" But be doers of the Word, and not only hearers, deluding your own selves {{{1 -" (James 1:22 RSV) -" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -" Load Once: {{{1 -if &cp || exists("g:loaded_netrw") - finish -endif - -" Check that vim has patches that netrw requires. -" Patches needed for v7.4: 1557, and 213. -" (netrw will benefit from vim's having patch#656, too) -let s:needspatches=[1557,213] -if exists("s:needspatches") - for ptch in s:needspatches - if v:version < 704 || (v:version == 704 && !has("patch".ptch)) - if !exists("s:needpatch{ptch}") - unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch#".ptch - endif - let s:needpatch{ptch}= 1 - finish - endif - endfor -endif - -let g:loaded_netrw = "v173" -if !exists("s:NOTE") - let s:NOTE = 0 - let s:WARNING = 1 - let s:ERROR = 2 -endif - -let s:keepcpo= &cpo -setl cpo&vim -"DechoFuncName 1 -"DechoRemOn -"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw,'~'.expand("")) - -" ====================== -" Netrw Variables: {{{1 -" ====================== - -" --------------------------------------------------------------------- -" netrw#ErrorMsg: {{{2 -" 0=note = s:NOTE -" 1=warning = s:WARNING -" 2=error = s:ERROR -" Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) -" netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) -" (this function can optionally take a list of messages) -" Dec 2, 2019 : max errnum currently is 106 -fun! netrw#ErrorMsg(level,msg,errnum) -" call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) - - if a:level < g:netrw_errorlvl -" call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g:netrw_errorlvl=".g:netrw_errorlvl) - return - endif - - if a:level == 1 - let level= "**warning** (netrw) " - elseif a:level == 2 - let level= "**error** (netrw) " - else - let level= "**note** (netrw) " - endif -" call Decho("level=".level,'~'.expand("")) - - if g:netrw_use_errorwindow == 2 && (v:version > 802 || (v:version == 802 && has("patch486"))) - " use popup window - if type(a:msg) == 3 - let msg = [level]+a:msg - else - let msg= level.a:msg - endif - let s:popuperr_id = popup_atcursor(msg,{}) - let s:popuperr_text= "" - elseif g:netrw_use_errorwindow - " (default) netrw creates a one-line window to show error/warning - " messages (reliably displayed) - - " record current window number - let s:winBeforeErr= winnr() -" call Decho("s:winBeforeErr=".s:winBeforeErr,'~'.expand("")) - - " getting messages out reliably is just plain difficult! - " This attempt splits the current window, creating a one line window. - if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 -" call Decho("write to NetrwMessage buffer",'~'.expand("")) - exe bufwinnr("NetrwMessage")."wincmd w" -" call Decho("setl ma noro",'~'.expand("")) - setl ma noro - if type(a:msg) == 3 - for msg in a:msg - NetrwKeepj call setline(line("$")+1,level.msg) - endfor - else - NetrwKeepj call setline(line("$")+1,level.a:msg) - endif - NetrwKeepj $ - else -" call Decho("create a NetrwMessage buffer window",'~'.expand("")) - bo 1split - sil! call s:NetrwEnew() - sil! NetrwKeepj call s:NetrwOptionsSafe(1) - setl bt=nofile - NetrwKeepj file NetrwMessage -" call Decho("setl ma noro",'~'.expand("")) - setl ma noro - if type(a:msg) == 3 - for msg in a:msg - NetrwKeepj call setline(line("$")+1,level.msg) - endfor - else - NetrwKeepj call setline(line("$"),level.a:msg) - endif - NetrwKeepj $ - endif -" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr(),'~'.expand("")) - if &fo !~ '[ta]' - syn clear - syn match netrwMesgNote "^\*\*note\*\*" - syn match netrwMesgWarning "^\*\*warning\*\*" - syn match netrwMesgError "^\*\*error\*\*" - hi link netrwMesgWarning WarningMsg - hi link netrwMesgError Error - endif -" call Decho("setl noma ro bh=wipe",'~'.expand("")) - setl ro nomod noma bh=wipe - - else - " (optional) netrw will show messages using echomsg. Even if the - " message doesn't appear, at least it'll be recallable via :messages -" redraw! - if a:level == s:WARNING - echohl WarningMsg - elseif a:level == s:ERROR - echohl Error - endif - - if type(a:msg) == 3 - for msg in a:msg - unsilent echomsg level.msg - endfor - else - unsilent echomsg level.a:msg - endif - -" call Decho("echomsg ***netrw*** ".a:msg,'~'.expand("")) - echohl None - endif - -" call Dret("netrw#ErrorMsg") -endfun - -" --------------------------------------------------------------------- -" s:NetrwInit: initializes variables if they haven't been defined {{{2 -" Loosely, varname = value. -fun s:NetrwInit(varname,value) -" call Decho("varname<".a:varname."> value=".a:value,'~'.expand("")) - if !exists(a:varname) - if type(a:value) == 0 - exe "let ".a:varname."=".a:value - elseif type(a:value) == 1 && a:value =~ '^[{[]' - exe "let ".a:varname."=".a:value - elseif type(a:value) == 1 - exe "let ".a:varname."="."'".a:value."'" - else - exe "let ".a:varname."=".a:value - endif - endif -endfun - -" --------------------------------------------------------------------- -" Netrw Constants: {{{2 -call s:NetrwInit("g:netrw_dirhistcnt",0) -if !exists("s:LONGLIST") - call s:NetrwInit("s:THINLIST",0) - call s:NetrwInit("s:LONGLIST",1) - call s:NetrwInit("s:WIDELIST",2) - call s:NetrwInit("s:TREELIST",3) - call s:NetrwInit("s:MAXLIST" ,4) -endif - -" --------------------------------------------------------------------- -" Default option values: {{{2 -let g:netrw_localcopycmdopt = "" -let g:netrw_localcopydircmdopt = "" -let g:netrw_localmkdiropt = "" -let g:netrw_localmovecmdopt = "" - -" --------------------------------------------------------------------- -" Default values for netrw's global protocol variables {{{2 -if !exists("g:netrw_use_errorwindow") - let g:netrw_use_errorwindow = 0 -endif - -if !exists("g:netrw_dav_cmd") - if executable("cadaver") - let g:netrw_dav_cmd = "cadaver" - elseif executable("curl") - let g:netrw_dav_cmd = "curl" - else - let g:netrw_dav_cmd = "" - endif -endif -if !exists("g:netrw_fetch_cmd") - if executable("fetch") - let g:netrw_fetch_cmd = "fetch -o" - else - let g:netrw_fetch_cmd = "" - endif -endif -if !exists("g:netrw_file_cmd") - if executable("elinks") - call s:NetrwInit("g:netrw_file_cmd","elinks") - elseif executable("links") - call s:NetrwInit("g:netrw_file_cmd","links") - endif -endif -if !exists("g:netrw_ftp_cmd") - let g:netrw_ftp_cmd = "ftp" -endif -let s:netrw_ftp_cmd= g:netrw_ftp_cmd -if !exists("g:netrw_ftp_options") - let g:netrw_ftp_options= "-i -n" -endif -if !exists("g:netrw_http_cmd") - if executable("wget") - let g:netrw_http_cmd = "wget" - call s:NetrwInit("g:netrw_http_xcmd","-q -O") - elseif executable("curl") - let g:netrw_http_cmd = "curl" - call s:NetrwInit("g:netrw_http_xcmd","-L -o") - elseif executable("elinks") - let g:netrw_http_cmd = "elinks" - call s:NetrwInit("g:netrw_http_xcmd","-source >") - elseif executable("fetch") - let g:netrw_http_cmd = "fetch" - call s:NetrwInit("g:netrw_http_xcmd","-o") - elseif executable("links") - let g:netrw_http_cmd = "links" - call s:NetrwInit("g:netrw_http_xcmd","-http.extra-header ".shellescape("Accept-Encoding: identity", 1)." -source >") - else - let g:netrw_http_cmd = "" - endif -endif -call s:NetrwInit("g:netrw_http_put_cmd","curl -T") -call s:NetrwInit("g:netrw_keepj","keepj") -call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") -call s:NetrwInit("g:netrw_rsync_cmd", "rsync") -call s:NetrwInit("g:netrw_rsync_sep", "/") -if !exists("g:netrw_scp_cmd") - if executable("scp") - call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") - elseif executable("pscp") - if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable('c:\private.ppk') - call s:NetrwInit("g:netrw_scp_cmd", 'pscp -i c:\private.ppk') - else - call s:NetrwInit("g:netrw_scp_cmd", 'pscp -q') - endif - else - call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") - endif -endif - -call s:NetrwInit("g:netrw_sftp_cmd" , "sftp") -call s:NetrwInit("g:netrw_ssh_cmd" , "ssh") - -if (has("win32") || has("win95") || has("win64") || has("win16")) - \ && exists("g:netrw_use_nt_rcp") - \ && g:netrw_use_nt_rcp - \ && executable( $SystemRoot .'/system32/rcp.exe') - let s:netrw_has_nt_rcp = 1 - let s:netrw_rcpmode = '-b' -else - let s:netrw_has_nt_rcp = 0 - let s:netrw_rcpmode = '' -endif - -" --------------------------------------------------------------------- -" Default values for netrw's global variables {{{2 -" Cygwin Detection ------- {{{3 -if !exists("g:netrw_cygwin") - if has("win32") || has("win95") || has("win64") || has("win16") - if has("win32unix") && &shell =~ '\%(\\|\\)\%(\.exe\)\=$' - let g:netrw_cygwin= 1 - else - let g:netrw_cygwin= 0 - endif - else - let g:netrw_cygwin= 0 - endif -endif -" Default values - a-c ---------- {{{3 -call s:NetrwInit("g:netrw_alto" , &sb) -call s:NetrwInit("g:netrw_altv" , &spr) -call s:NetrwInit("g:netrw_banner" , 1) -call s:NetrwInit("g:netrw_browse_split", 0) -call s:NetrwInit("g:netrw_bufsettings" , "noma nomod nonu nobl nowrap ro nornu") -call s:NetrwInit("g:netrw_chgwin" , -1) -call s:NetrwInit("g:netrw_clipboard" , 1) -call s:NetrwInit("g:netrw_compress" , "gzip") -call s:NetrwInit("g:netrw_ctags" , "ctags") -if exists("g:netrw_cursorline") && !exists("g:netrw_cursor") - call netrw#ErrorMsg(s:NOTE,'g:netrw_cursorline is deprecated; use g:netrw_cursor instead',77) - let g:netrw_cursor= g:netrw_cursorline -endif -call s:NetrwInit("g:netrw_cursor" , 2) -let s:netrw_usercul = &cursorline -let s:netrw_usercuc = &cursorcolumn -"call Decho("(netrw) COMBAK: cuc=".&l:cuc." cul=".&l:cul." initialization of s:netrw_cu[cl]") -call s:NetrwInit("g:netrw_cygdrive","/cygdrive") -" Default values - d-g ---------- {{{3 -call s:NetrwInit("s:didstarstar",0) -call s:NetrwInit("g:netrw_dirhistcnt" , 0) -call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }') -call s:NetrwInit("g:netrw_dirhistmax" , 10) -call s:NetrwInit("g:netrw_errorlvl" , s:NOTE) -call s:NetrwInit("g:netrw_fastbrowse" , 1) -call s:NetrwInit("g:netrw_ftp_browse_reject", '^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$') -if !exists("g:netrw_ftp_list_cmd") - if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) - let g:netrw_ftp_list_cmd = "ls -lF" - let g:netrw_ftp_timelist_cmd = "ls -tlF" - let g:netrw_ftp_sizelist_cmd = "ls -slF" - else - let g:netrw_ftp_list_cmd = "dir" - let g:netrw_ftp_timelist_cmd = "dir" - let g:netrw_ftp_sizelist_cmd = "dir" - endif -endif -call s:NetrwInit("g:netrw_ftpmode",'binary') -" Default values - h-lh ---------- {{{3 -call s:NetrwInit("g:netrw_hide",1) -if !exists("g:netrw_ignorenetrc") - if &shell =~ '\c\<\%(cmd\|4nt\)\.exe$' - let g:netrw_ignorenetrc= 1 - else - let g:netrw_ignorenetrc= 0 - endif -endif -call s:NetrwInit("g:netrw_keepdir",1) -if !exists("g:netrw_list_cmd") - if g:netrw_scp_cmd =~ '^pscp' && executable("pscp") - if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk") - " provide a pscp-based listing command - let g:netrw_scp_cmd ="pscp -i C:\\private.ppk" - endif - if exists("g:netrw_list_cmd_options") - let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME: ".g:netrw_list_cmd_options - else - let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" - endif - elseif executable(g:netrw_ssh_cmd) - " provide a scp-based default listing command - if exists("g:netrw_list_cmd_options") - let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa ".g:netrw_list_cmd_options - else - let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" - endif - else -" call Decho(g:netrw_ssh_cmd." is not executable",'~'.expand("")) - let g:netrw_list_cmd= "" - endif -endif -call s:NetrwInit("g:netrw_list_hide","") -" Default values - lh-lz ---------- {{{3 -if exists("g:netrw_local_copycmd") - let g:netrw_localcopycmd= g:netrw_local_copycmd - call netrw#ErrorMsg(s:NOTE,"g:netrw_local_copycmd is deprecated in favor of g:netrw_localcopycmd",84) -endif -if !exists("g:netrw_localcmdshell") - let g:netrw_localcmdshell= "" -endif -if !exists("g:netrw_localcopycmd") - if has("win32") || has("win95") || has("win64") || has("win16") - if g:netrw_cygwin - let g:netrw_localcopycmd= "cp" - else - let g:netrw_localcopycmd = expand("$COMSPEC", v:true) - let g:netrw_localcopycmdopt= " /c copy" - endif - elseif has("unix") || has("macunix") - let g:netrw_localcopycmd= "cp" - else - let g:netrw_localcopycmd= "" - endif -endif -if !exists("g:netrw_localcopydircmd") - if has("win32") || has("win95") || has("win64") || has("win16") - if g:netrw_cygwin - let g:netrw_localcopydircmd = "cp" - let g:netrw_localcopydircmdopt= " -R" - else - let g:netrw_localcopydircmd = expand("$COMSPEC", v:true) - let g:netrw_localcopydircmdopt= " /c xcopy /e /c /h /i /k" - endif - elseif has("unix") - let g:netrw_localcopydircmd = "cp" - let g:netrw_localcopydircmdopt= " -R" - elseif has("macunix") - let g:netrw_localcopydircmd = "cp" - let g:netrw_localcopydircmdopt= " -R" - else - let g:netrw_localcopydircmd= "" - endif -endif -if exists("g:netrw_local_mkdir") - let g:netrw_localmkdir= g:netrw_local_mkdir - call netrw#ErrorMsg(s:NOTE,"g:netrw_local_mkdir is deprecated in favor of g:netrw_localmkdir",87) -endif -if has("win32") || has("win95") || has("win64") || has("win16") - if g:netrw_cygwin - call s:NetrwInit("g:netrw_localmkdir","mkdir") - else - let g:netrw_localmkdir = expand("$COMSPEC", v:true) - let g:netrw_localmkdiropt= " /c mkdir" - endif -else - call s:NetrwInit("g:netrw_localmkdir","mkdir") -endif -call s:NetrwInit("g:netrw_remote_mkdir","mkdir") -if exists("g:netrw_local_movecmd") - let g:netrw_localmovecmd= g:netrw_local_movecmd - call netrw#ErrorMsg(s:NOTE,"g:netrw_local_movecmd is deprecated in favor of g:netrw_localmovecmd",88) -endif -if !exists("g:netrw_localmovecmd") - if has("win32") || has("win95") || has("win64") || has("win16") - if g:netrw_cygwin - let g:netrw_localmovecmd= "mv" - else - let g:netrw_localmovecmd = expand("$COMSPEC", v:true) - let g:netrw_localmovecmdopt= " /c move" - endif - elseif has("unix") || has("macunix") - let g:netrw_localmovecmd= "mv" - else - let g:netrw_localmovecmd= "" - endif -endif -" following serves as an example for how to insert a version&patch specific test -"if v:version < 704 || (v:version == 704 && !has("patch1107")) -"endif -call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) -" sanity checks -if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST - let g:netrw_liststyle= s:THINLIST -endif -if g:netrw_liststyle == s:LONGLIST && g:netrw_scp_cmd !~ '^pscp' - let g:netrw_list_cmd= g:netrw_list_cmd." -l" -endif -" Default values - m-r ---------- {{{3 -call s:NetrwInit("g:netrw_markfileesc" , '*./[\~') -call s:NetrwInit("g:netrw_maxfilenamelen", 32) -call s:NetrwInit("g:netrw_menu" , 1) -call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir") -call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~# '[anh]')) -call s:NetrwInit("g:netrw_retmap" , 0) -if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) - call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") -elseif has("win32") || has("win95") || has("win64") || has("win16") - call s:NetrwInit("g:netrw_chgperm" , "cacls FILENAME /e /p PERM") -else - call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") -endif -call s:NetrwInit("g:netrw_preview" , 0) -call s:NetrwInit("g:netrw_scpport" , "-P") -call s:NetrwInit("g:netrw_servername" , "NETRWSERVER") -call s:NetrwInit("g:netrw_sshport" , "-p") -call s:NetrwInit("g:netrw_rename_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mv") -call s:NetrwInit("g:netrw_rm_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm") -call s:NetrwInit("g:netrw_rmdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir") -call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f ") -" Default values - q-s ---------- {{{3 -call s:NetrwInit("g:netrw_quickhelp",0) -let s:QuickHelp= ["-:go up dir D:delete R:rename s:sort-by x:special", - \ "(create new) %:file d:directory", - \ "(windows split&open) o:horz v:vert p:preview", - \ "i:style qf:file info O:obtain r:reverse", - \ "(marks) mf:mark file mt:set target mm:move mc:copy", - \ "(bookmarks) mb:make mB:delete qb:list gb:go to", - \ "(history) qb:list u:go up U:go down", - \ "(targets) mt:target Tb:use bookmark Th:use history"] -" g:netrw_sepchr: picking a character that doesn't appear in filenames that can be used to separate priority from filename -call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\" : "\") -if !exists("g:netrw_keepj") || g:netrw_keepj == "keepj" - call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ") -else - call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil " : " ") -endif -call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size -call s:NetrwInit("g:netrw_sort_options" , "") -call s:NetrwInit("g:netrw_sort_direction", "normal") " alternative: reverse (z y x ...) -if !exists("g:netrw_sort_sequence") - if has("unix") - let g:netrw_sort_sequence= '[\/]$,\,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' - else - let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' - endif -endif -call s:NetrwInit("g:netrw_special_syntax" , 0) -call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$') -call s:NetrwInit("g:netrw_suppress_gx_mesg", 1) -call s:NetrwInit("g:netrw_use_noswf" , 1) -call s:NetrwInit("g:netrw_sizestyle" ,"b") -" Default values - t-w ---------- {{{3 -call s:NetrwInit("g:netrw_timefmt","%c") -if !exists("g:netrw_xstrlen") - if exists("g:Align_xstrlen") - let g:netrw_xstrlen= g:Align_xstrlen - elseif exists("g:drawit_xstrlen") - let g:netrw_xstrlen= g:drawit_xstrlen - elseif &enc == "latin1" || !has("multi_byte") - let g:netrw_xstrlen= 0 - else - let g:netrw_xstrlen= 1 - endif -endif -call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") -call s:NetrwInit("g:netrw_win95ftp",1) -call s:NetrwInit("g:netrw_winsize",50) -call s:NetrwInit("g:netrw_wiw",1) -if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif -" --------------------------------------------------------------------- -" Default values for netrw's script variables: {{{2 -call s:NetrwInit("g:netrw_fname_escape",' ?&;%') -if has("win32") || has("win95") || has("win64") || has("win16") - call s:NetrwInit("g:netrw_glob_escape",'*?`{[]$') -else - call s:NetrwInit("g:netrw_glob_escape",'*[]?`{~$\') -endif -call s:NetrwInit("g:netrw_menu_escape",'.&? \') -call s:NetrwInit("g:netrw_tmpfile_escape",' &;') -call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\\"") -if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4') - let s:treedepthstring= "│ " -else - let s:treedepthstring= "| " -endif -call s:NetrwInit("s:netrw_posn",'{}') - -" BufEnter event ignored by decho when following variable is true -" Has a side effect that doau BufReadPost doesn't work, so -" files read by network transfer aren't appropriately highlighted. -"let g:decho_bufenter = 1 "Decho - -" ====================== -" Netrw Initialization: {{{1 -" ====================== -if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") -" call Decho("installed beval events",'~'.expand("")) - let &l:bexpr = "netrw#BalloonHelp()" -" call Decho("&l:bexpr<".&l:bexpr."> buf#".bufnr()) - au FileType netrw setl beval - au WinLeave * if &ft == "netrw" && exists("s:initbeval")|let &beval= s:initbeval|endif - au VimEnter * let s:initbeval= &beval -"else " Decho -" if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700","~".expand("")) | endif -" if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval","~".expand("")) | endif -" if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists","~".expand("")) | endif -" if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists","~".expand("")) | endif -" if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting","~".expand("")) | endif -" if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists","~".expand("")) | endif -endif -au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif - -if g:netrw_keepj =~# "keepj" - com! -nargs=* NetrwKeepj keepj -else - let g:netrw_keepj= "" - com! -nargs=* NetrwKeepj -endif - -" ============================== -" Netrw Utility Functions: {{{1 -" ============================== - -" --------------------------------------------------------------------- -" netrw#BalloonHelp: {{{2 -if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_on") && !exists("g:netrw_nobeval") -" call Decho("loading netrw#BalloonHelp()",'~'.expand("")) - fun! netrw#BalloonHelp() - if &ft != "netrw" - return "" - endif - if exists("s:popuperr_id") && popup_getpos(s:popuperr_id) != {} - " popup error window is still showing - " s:pouperr_id and s:popuperr_text are set up in netrw#ErrorMsg() - if exists("s:popuperr_text") && s:popuperr_text != "" && v:beval_text != s:popuperr_text - " text under mouse hasn't changed; only close window when it changes - call popup_close(s:popuperr_id) - unlet s:popuperr_text - else - let s:popuperr_text= v:beval_text - endif - let mesg= "" - elseif !exists("w:netrw_bannercnt") || v:beval_lnum >= w:netrw_bannercnt || (exists("g:netrw_nobeval") && g:netrw_nobeval) - let mesg= "" - elseif v:beval_text == "Netrw" || v:beval_text == "Directory" || v:beval_text == "Listing" - let mesg = "i: thin-long-wide-tree gh: quick hide/unhide of dot-files qf: quick file info %:open new file" - elseif getline(v:beval_lnum) =~ '^"\s*/' - let mesg = ": edit/enter o: edit/enter in horiz window t: edit/enter in new tab v:edit/enter in vert window" - elseif v:beval_text == "Sorted" || v:beval_text == "by" - let mesg = 's: sort by name, time, file size, extension r: reverse sorting order mt: mark target' - elseif v:beval_text == "Sort" || v:beval_text == "sequence" - let mesg = "S: edit sorting sequence" - elseif v:beval_text == "Hiding" || v:beval_text == "Showing" - let mesg = "a: hiding-showing-all ctrl-h: editing hiding list mh: hide/show by suffix" - elseif v:beval_text == "Quick" || v:beval_text == "Help" - let mesg = "Help: press " - elseif v:beval_text == "Copy/Move" || v:beval_text == "Tgt" - let mesg = "mt: mark target mc: copy marked file to target mm: move marked file to target" - else - let mesg= "" - endif - return mesg - endfun -"else " Decho -" if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -","~".expand(""))|endif -" if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval","~".expand("")) |endif -" if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled","~".expand("")) |endif -" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a","~".expand("")) |endif -" if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists","~".expand("")) |endif -endif - -" ------------------------------------------------------------------------ -" netrw#Explore: launch the local browser in the directory of the current file {{{2 -" indx: == -1: Nexplore -" == -2: Pexplore -" == +: this is overloaded: -" * If Nexplore/Pexplore is in use, then this refers to the -" indx'th item in the w:netrw_explore_list[] of items which -" matched the */pattern **/pattern *//pattern **//pattern -" * If Hexplore or Vexplore, then this will override -" g:netrw_winsize to specify the qty of rows or columns the -" newly split window should have. -" dosplit==0: the window will be split iff the current file has been modified and hidden not set -" dosplit==1: the window will be split before running the local browser -" style == 0: Explore style == 1: Explore! -" == 2: Hexplore style == 3: Hexplore! -" == 4: Vexplore style == 5: Vexplore! -" == 6: Texplore -fun! netrw#Explore(indx,dosplit,style,...) -" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")." ft=".&ft) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("")) - endif - - " record current file for Rexplore's benefit - if &ft != "netrw" - let w:netrw_rexfile= expand("%:p") - endif - - " record current directory - let curdir = simplify(b:netrw_curdir) - let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') - if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) - let curdir= substitute(curdir,'\','/','g') - endif -" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">",'~'.expand("")) - - " using completion, directories with spaces in their names (thanks, Bill Gates, for a truly dumb idea) - " will end up with backslashes here. Solution: strip off backslashes that precede white space and - " try Explore again. - if a:0 > 0 -" call Decho('considering retry: a:1<'.a:1.'>: '. - \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '. - \ ((filereadable(s:NetrwFile(a:1)))? 'is readable' : 'is not readable').', '. - \ ((isdirectory(s:NetrwFile(a:1))))? 'is a directory' : 'is not a directory', - \ '~'.expand("")) - if a:1 =~ "\\\s" && !filereadable(s:NetrwFile(a:1)) && !isdirectory(s:NetrwFile(a:1)) -" call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">",'~'.expand("")) - call netrw#Explore(a:indx,a:dosplit,a:style,substitute(a:1,'\\\(\s\)','\1','g')) -" call Dret("netrw#Explore : returning from retry") - return -" else " Decho -" call Decho("retry not needed",'~'.expand("")) - endif - endif - - " save registers - sil! let keepregslash= @/ - - " if dosplit - " -or- file has been modified AND file not hidden when abandoned - " -or- Texplore used - if a:dosplit || (&modified && &hidden == 0 && &bufhidden != "hide") || a:style == 6 -" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified",'~'.expand("")) - call s:SaveWinVars() - let winsz= g:netrw_winsize - if a:indx > 0 - let winsz= a:indx - endif - - if a:style == 0 " Explore, Sexplore -" call Decho("style=0: Explore or Sexplore",'~'.expand("")) - let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz - if winsz == 0|let winsz= ""|endif - exe "noswapfile ".winsz."wincmd s" -" call Decho("exe noswapfile ".winsz."wincmd s",'~'.expand("")) - - elseif a:style == 1 "Explore!, Sexplore! -" call Decho("style=1: Explore! or Sexplore!",'~'.expand("")) - let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz - if winsz == 0|let winsz= ""|endif - exe "keepalt noswapfile ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile ".winsz."wincmd v",'~'.expand("")) - - elseif a:style == 2 " Hexplore -" call Decho("style=2: Hexplore",'~'.expand("")) - let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz - if winsz == 0|let winsz= ""|endif - exe "keepalt noswapfile bel ".winsz."wincmd s" -" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s",'~'.expand("")) - - elseif a:style == 3 " Hexplore! -" call Decho("style=3: Hexplore!",'~'.expand("")) - let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz - if winsz == 0|let winsz= ""|endif - exe "keepalt noswapfile abo ".winsz."wincmd s" -" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s",'~'.expand("")) - - elseif a:style == 4 " Vexplore -" call Decho("style=4: Vexplore",'~'.expand("")) - let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz - if winsz == 0|let winsz= ""|endif - exe "keepalt noswapfile lefta ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v",'~'.expand("")) - - elseif a:style == 5 " Vexplore! -" call Decho("style=5: Vexplore!",'~'.expand("")) - let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz - if winsz == 0|let winsz= ""|endif - exe "keepalt noswapfile rightb ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v",'~'.expand("")) - - elseif a:style == 6 " Texplore - call s:SaveBufVars() -" call Decho("style = 6: Texplore",'~'.expand("")) - exe "keepalt tabnew ".fnameescape(curdir) -" call Decho("exe keepalt tabnew ".fnameescape(curdir),'~'.expand("")) - call s:RestoreBufVars() - endif - call s:RestoreWinVars() -" else " Decho -" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6",'~'.expand("")) - endif - NetrwKeepj norm! 0 - - if a:0 > 0 -" call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">",'~'.expand("")) - if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) -" call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin",'~'.expand("")) - let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) -" call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)",'~'.expand("")) - elseif a:1 == '.' -" call Decho("..case a:1<".a:1.">: matches .",'~'.expand("")) - let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd()) - if dirname !~ '/$' - let dirname= dirname."/" - endif -" call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")",'~'.expand("")) - elseif a:1 =~ '\$' -" call Decho("..case a:1<".a:1.">: matches ending $",'~'.expand("")) - let dirname= simplify(expand(a:1)) -" call Decho("..using user-specified dirname<".dirname."> with $env-var",'~'.expand("")) - elseif a:1 !~ '^\*\{1,2}/' && a:1 !~ '^\a\{3,}://' -" call Decho("..case a:1<".a:1.">: other, not pattern or filepattern",'~'.expand("")) - let dirname= simplify(a:1) -" call Decho("..using user-specified dirname<".dirname.">",'~'.expand("")) - else -" call Decho("..case a:1: pattern or filepattern",'~'.expand("")) - let dirname= a:1 - endif - else - " clear explore -" call Decho("case a:0=".a:0.": clearing Explore list",'~'.expand("")) - call s:NetrwClearExplore() -" call Dret("netrw#Explore : cleared list") - return - endif - -" call Decho("dirname<".dirname.">",'~'.expand("")) - if dirname =~ '\.\./\=$' - let dirname= simplify(fnamemodify(dirname,':p:h')) - elseif dirname =~ '\.\.' || dirname == '.' - let dirname= simplify(fnamemodify(dirname,':p')) - endif -" call Decho("dirname<".dirname."> (after simplify)",'~'.expand("")) - - if dirname =~ '^\*//' - " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("case starpat=1: Explore *//pattern",'~'.expand("")) - let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') - let starpat= 1 -" call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("")) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - - elseif dirname =~ '^\*\*//' - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("case starpat=2: Explore **//pattern",'~'.expand("")) - let pattern= substitute(dirname,'^\*\*//','','') - let starpat= 2 -" call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("")) - - elseif dirname =~ '/\*\*/' - " handle .../**/.../filepat -" call Decho("case starpat=4: Explore .../**/.../filepat",'~'.expand("")) - let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') - if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) - let b:netrw_curdir = prefixdir - else - let b:netrw_curdir= getcwd().'/'.prefixdir - endif - let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') - let starpat= 4 -" call Decho("..pwd<".getcwd()."> dirname<".dirname.">",'~'.expand("")) -" call Decho("..case Explore ../**/../filepat (starpat=".starpat.")",'~'.expand("")) - - elseif dirname =~ '^\*/' - " case starpat=3: Explore */filepat (search in current directory for filenames matching filepat) - let starpat= 3 -" call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")",'~'.expand("")) - - elseif dirname=~ '^\*\*/' - " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) - let starpat= 4 -" call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")",'~'.expand("")) - - else - let starpat= 0 -" call Decho("case starpat=0: default",'~'.expand("")) - endif - - if starpat == 0 && a:indx >= 0 - " [Explore Hexplore Vexplore Sexplore] [dirname] -" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore",'~'.expand("")) - if dirname == "" - let dirname= curfiledir -" call Decho("..empty dirname, using current file's directory<".dirname.">",'~'.expand("")) - endif - if dirname =~# '^scp://' || dirname =~ '^ftp://' - call netrw#Nread(2,dirname) - else - if dirname == "" - let dirname= getcwd() - elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin - " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo', - " depending on whether backslashes have been converted to forward slashes by earlier code). - if dirname !~ '^[a-zA-Z]:' && dirname !~ '^\\\\\w\+' && dirname !~ '^//\w\+' - let dirname= b:netrw_curdir."/".dirname - endif - elseif dirname !~ '^/' - let dirname= b:netrw_curdir."/".dirname - endif -" call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)",'~'.expand("")) - call netrw#LocalBrowseCheck(dirname) -" call Decho(" modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) - endif - if exists("w:netrw_bannercnt") - " done to handle P08-Ingelrest. :Explore will _Always_ go to the line just after the banner. - " If one wants to return the same place in the netrw window, use :Rex instead. - exe w:netrw_bannercnt - endif - -" call Decho("curdir<".curdir.">",'~'.expand("")) - " --------------------------------------------------------------------- - " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest -" if has("win32") || has("win95") || has("win64") || has("win16") -" NetrwKeepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') -" else -" NetrwKeepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') -" endif - " --------------------------------------------------------------------- - - " starpat=1: Explore *//pattern (current directory only search for files containing pattern) - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) - " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) - " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) - elseif a:indx <= 0 - " Nexplore, Pexplore, Explore: handle starpat -" call Decho("case a:indx<=0: Nexplore, Pexplore, , starpat=".starpat." a:indx=".a:indx,'~'.expand("")) - if !mapcheck("","n") && !mapcheck("","n") && exists("b:netrw_curdir") -" call Decho("..set up and maps",'~'.expand("")) - let s:didstarstar= 1 - nnoremap :Pexplore - nnoremap :Nexplore - endif - - if has("path_extra") -" call Decho("..starpat=".starpat.": has +path_extra",'~'.expand("")) - if !exists("w:netrw_explore_indx") - let w:netrw_explore_indx= 0 - endif - - let indx = a:indx -" call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]",'~'.expand("")) - - if indx == -1 - " Nexplore -" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("")) - if !exists("w:netrw_explore_list") " sanity check - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or improperly; see help for netrw-starstar",40) - sil! let @/ = keepregslash -" call Dret("netrw#Explore") - return - endif - let indx= w:netrw_explore_indx - if indx < 0 | let indx= 0 | endif - if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif - let curfile= w:netrw_explore_list[indx] -" call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("")) - while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] - let indx= indx + 1 -" call Decho("....indx=".indx." (Nexplore while loop)",'~'.expand("")) - endwhile - if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif -" call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("")) - - elseif indx == -2 - " Pexplore -" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("")) - if !exists("w:netrw_explore_list") " sanity check - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or improperly; see help for netrw-starstar",41) - sil! let @/ = keepregslash -" call Dret("netrw#Explore") - return - endif - let indx= w:netrw_explore_indx - if indx < 0 | let indx= 0 | endif - if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif - let curfile= w:netrw_explore_list[indx] -" call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("")) - while indx >= 0 && curfile == w:netrw_explore_list[indx] - let indx= indx - 1 -" call Decho("....indx=".indx." (Pexplore while loop)",'~'.expand("")) - endwhile - if indx < 0 | let indx= 0 | endif -" call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("")) - - else - " Explore -- initialize - " build list of files to Explore with Nexplore/Pexplore -" call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")",'~'.expand("")) - NetrwKeepj keepalt call s:NetrwClearExplore() - let w:netrw_explore_indx= 0 - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() - endif -" call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) - - " switch on starpat to build the w:netrw_explore_list of files - if starpat == 1 - " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls,'~'.expand("")) -" call Decho("....pattern<".pattern.">",'~'.expand("")) - try - exe "NetrwKeepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" - catch /^Vim\%((\a\+)\)\=:E480/ - keepalt call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) -" call Dret("netrw#Explore : unable to find pattern<".pattern.">") - return - endtry - let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)')) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - - elseif starpat == 2 - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)",'~'.expand("")) -" call Decho("....pattern<".pattern.">",'~'.expand("")) - try - exe "sil NetrwKeepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" - catch /^Vim\%((\a\+)\)\=:E480/ - keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - sil! let @/ = keepregslash -" call Dret("netrw#Explore : no files matched pattern") - return - endtry - let s:netrw_curdir = b:netrw_curdir - let w:netrw_explore_list = getqflist() - let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)')) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - - elseif starpat == 3 - " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls,'~'.expand("")) - let filepat= substitute(dirname,'^\*/','','') - let filepat= substitute(filepat,'^[%#<]','\\&','') -" call Decho("....b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) -" call Decho("....filepat<".filepat.">",'~'.expand("")) - let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) - if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif - - elseif starpat == 4 - " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls,'~'.expand("")) - let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n')) - if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif - endif " switch on starpat to build w:netrw_explore_list - - let w:netrw_explore_listlen = len(w:netrw_explore_list) -" call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">",'~'.expand("")) -" call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen,'~'.expand("")) - - if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') - keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) - sil! let @/ = keepregslash -" call Dret("netrw#Explore : no files matched") - return - endif - endif " if indx ... endif - - " NetrwStatusLine support - for exploring support - let w:netrw_explore_indx= indx -" call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen,'~'.expand("")) - - " wrap the indx around, but issue a note - if indx >= w:netrw_explore_listlen || indx < 0 -" call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")",'~'.expand("")) - let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 - let w:netrw_explore_indx= indx - keepalt NetrwKeepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) - endif - - exe "let dirfile= w:netrw_explore_list[".indx."]" -" call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">",'~'.expand("")) - let newdir= substitute(dirfile,'/[^/]*$','','e') -" call Decho("....newdir<".newdir.">",'~'.expand("")) - -" call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)",'~'.expand("")) - call netrw#LocalBrowseCheck(newdir) - if !exists("w:netrw_liststyle") - let w:netrw_liststyle= g:netrw_liststyle - endif - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST - keepalt NetrwKeepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") - else - keepalt NetrwKeepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") - endif - let w:netrw_explore_mtchcnt = indx + 1 - let w:netrw_explore_bufnr = bufnr("%") - let w:netrw_explore_line = line(".") - keepalt NetrwKeepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') -" call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line,'~'.expand("")) - - else -" call Decho("..your vim does not have +path_extra",'~'.expand("")) - if !exists("g:netrw_quiet") - keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) - endif - sil! let @/ = keepregslash -" call Dret("netrw#Explore : missing +path_extra") - return - endif - - else -" call Decho("..default case: Explore newdir<".dirname.">",'~'.expand("")) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' - sil! unlet w:netrw_treedict - sil! unlet w:netrw_treetop - endif - let newdir= dirname - if !exists("b:netrw_curdir") - NetrwKeepj call netrw#LocalBrowseCheck(getcwd()) - else - NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) - endif - endif - - " visual display of **/ **// */ Exploration files -" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist"),'~'.expand("")) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">",'~'.expand("")) - if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") -" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-"),'~'.expand("")) - if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir - " only update match list when current directory isn't the same as before -" call Decho("only update match list when current directory not the same as before",'~'.expand("")) - let s:explore_prvdir = b:netrw_curdir - let s:explore_match = "" - let dirlen = strlen(b:netrw_curdir) - if b:netrw_curdir !~ '/$' - let dirlen= dirlen + 1 - endif - let prvfname= "" - for fname in w:netrw_explore_list -" call Decho("fname<".fname.">",'~'.expand("")) - if fname =~ '^'.b:netrw_curdir - if s:explore_match == "" - let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' - else - let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' - endif - elseif fname !~ '^/' && fname != prvfname - if s:explore_match == "" - let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>' - else - let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>' - endif - endif - let prvfname= fname - endfor -" call Decho("explore_match<".s:explore_match.">",'~'.expand("")) - if has("syntax") && exists("g:syntax_on") && g:syntax_on - exe "2match netrwMarkFile /".s:explore_match."/" - endif - endif - echo "==Pexplore ==Nexplore" - else - 2match none - if exists("s:explore_match") | unlet s:explore_match | endif - if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif -" call Decho("cleared explore match list",'~'.expand("")) - endif - - " since Explore may be used to initialize netrw's browser, - " there's no danger of a late FocusGained event on initialization. - " Consequently, set s:netrw_events to 2. - let s:netrw_events= 2 - sil! let @/ = keepregslash -" call Dret("netrw#Explore : @/<".@/.">") -endfun - -" --------------------------------------------------------------------- -" netrw#Lexplore: toggle Explorer window, keeping it on the left of the current tab {{{2 -" Uses g:netrw_chgwin : specifies the window where Lexplore files are to be opened -" t:netrw_lexposn : winsaveview() output (used on Lexplore window) -" t:netrw_lexbufnr: the buffer number of the Lexplore buffer (internal to this function) -" s:lexplore_win : window number of Lexplore window (serves to indicate which window is a Lexplore window) -" w:lexplore_buf : buffer number of Lexplore window (serves to indicate which window is a Lexplore window) -fun! netrw#Lexplore(count,rightside,...) -" call Dfunc("netrw#Lexplore(count=".a:count." rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft) - let curwin= winnr() - - if a:0 > 0 && a:1 != "" - " if a netrw window is already on the left-side of the tab - " and a directory has been specified, explore with that - " directory. -" call Decho("case has input argument(s) (a:1<".a:1.">)") - let a1 = expand(a:1) -" call Decho("a:1<".a:1."> curwin#".curwin,'~'.expand("")) - exe "1wincmd w" - if &ft == "netrw" -" call Decho("exe Explore ".fnameescape(a:1),'~'.expand("")) - exe "Explore ".fnameescape(a1) - exe curwin."wincmd w" - let s:lexplore_win= curwin - let w:lexplore_buf= bufnr("%") - if exists("t:netrw_lexposn") -" call Decho("forgetting t:netrw_lexposn",'~'.expand("")) - unlet t:netrw_lexposn - endif -" call Dret("netrw#Lexplore") - return - endif - exe curwin."wincmd w" - else - let a1= "" -" call Decho("no input arguments") - endif - - if exists("t:netrw_lexbufnr") - " check if t:netrw_lexbufnr refers to a netrw window - let lexwinnr = bufwinnr(t:netrw_lexbufnr) -" call Decho("lexwinnr= bufwinnr(t:netrw_lexbufnr#".t:netrw_lexbufnr.")=".lexwinnr) - else - let lexwinnr= 0 -" call Decho("t:netrw_lexbufnr doesn't exist") - endif -" call Decho("lexwinnr=".lexwinnr,'~'.expand("")) - - if lexwinnr > 0 - " close down netrw explorer window -" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("")) - exe lexwinnr."wincmd w" - let g:netrw_winsize = -winwidth(0) - let t:netrw_lexposn = winsaveview() -" call Decho("saving posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("")) -" call Decho("saving t:netrw_lexposn",'~'.expand("")) - close - if lexwinnr < curwin - let curwin= curwin - 1 - endif - if lexwinnr != curwin - exe curwin."wincmd w" - endif - unlet t:netrw_lexbufnr -" call Decho("unlet t:netrw_lexbufnr") - - else - " open netrw explorer window -" call Decho("t:netrw_lexbufnr: open netrw explorer window",'~'.expand("")) - exe "1wincmd w" - let keep_altv = g:netrw_altv - let g:netrw_altv = 0 - if a:count != 0 - let netrw_winsize = g:netrw_winsize - let g:netrw_winsize = a:count - endif - let curfile= expand("%") -" call Decho("curfile<".curfile.">",'~'.expand("")) - exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new" -" call Decho("new buf#".bufnr("%")." win#".winnr()) - if a:0 > 0 && a1 != "" -" call Decho("case 1: Explore ".a1,'~'.expand("")) - call netrw#Explore(0,0,0,a1) - exe "Explore ".fnameescape(a1) - elseif curfile =~ '^\a\{3,}://' -" call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("")) - call netrw#Explore(0,0,0,substitute(curfile,'[^/\\]*$','','')) - else -" call Decho("case 3: Explore .",'~'.expand("")) - call netrw#Explore(0,0,0,".") - endif - if a:count != 0 - let g:netrw_winsize = netrw_winsize - endif - setlocal winfixwidth - let g:netrw_altv = keep_altv - let t:netrw_lexbufnr = bufnr("%") - " done to prevent build-up of hidden buffers due to quitting and re-invocation of :Lexplore. - " Since the intended use of :Lexplore is to have an always-present explorer window, the extra - " effort to prevent mis-use of :Lex is warranted. - set bh=wipe -" call Decho("let t:netrw_lexbufnr=".t:netrw_lexbufnr) -" call Decho("t:netrw_lexposn".(exists("t:netrw_lexposn")? string(t:netrw_lexposn) : " n/a")) - if exists("t:netrw_lexposn") -" call Decho("restoring to t:netrw_lexposn",'~'.expand("")) -" call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("")) - call winrestview(t:netrw_lexposn) - unlet t:netrw_lexposn - endif - endif - - " set up default window for editing via - if exists("g:netrw_chgwin") && g:netrw_chgwin == -1 - if a:rightside - let g:netrw_chgwin= 1 - else - let g:netrw_chgwin= 2 - endif -" call Decho("let g:netrw_chgwin=".g:netrw_chgwin) - endif - -" call Dret("netrw#Lexplore") -endfun - -" --------------------------------------------------------------------- -" netrw#Clean: remove netrw {{{2 -" supports :NetrwClean -- remove netrw from first directory on runtimepath -" :NetrwClean! -- remove netrw from all directories on runtimepath -fun! netrw#Clean(sys) -" call Dfunc("netrw#Clean(sys=".a:sys.")") - - if a:sys - let choice= confirm("Remove personal and system copies of netrw?","&Yes\n&No") - else - let choice= confirm("Remove personal copy of netrw?","&Yes\n&No") - endif -" call Decho("choice=".choice,'~'.expand("")) - let diddel= 0 - let diddir= "" - - if choice == 1 - for dir in split(&rtp,',') - if filereadable(dir."/plugin/netrwPlugin.vim") -" call Decho("removing netrw-related files from ".dir,'~'.expand("")) - if s:NetrwDelete(dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif - if s:NetrwDelete(dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif - if s:NetrwDelete(dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif - if s:NetrwDelete(dir."/autoload/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrw.vim",55) |endif - if s:NetrwDelete(dir."/syntax/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrw.vim",55) |endif - if s:NetrwDelete(dir."/syntax/netrwlist.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrwlist.vim",55) |endif - let diddir= dir - let diddel= diddel + 1 - if !a:sys|break|endif - endif - endfor - endif - - echohl WarningMsg - if diddel == 0 - echomsg "netrw is either not installed or not removable" - elseif diddel == 1 - echomsg "removed one copy of netrw from <".diddir.">" - else - echomsg "removed ".diddel." copies of netrw" - endif - echohl None - -" call Dret("netrw#Clean") -endfun - -" --------------------------------------------------------------------- -" netrw#MakeTgt: make a target out of the directory name provided {{{2 -fun! netrw#MakeTgt(dname) -" call Dfunc("netrw#MakeTgt(dname<".a:dname.">)") - " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let s:netrwmftgt_islocal= (a:dname !~ '^\a\{3,}://') -" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("")) - if s:netrwmftgt_islocal - let netrwmftgt= simplify(a:dname) - else - let netrwmftgt= a:dname - endif - if exists("s:netrwmftgt") && netrwmftgt == s:netrwmftgt - " re-selected target, so just clear it - unlet s:netrwmftgt s:netrwmftgt_islocal - else - let s:netrwmftgt= netrwmftgt - endif - if g:netrw_fastbrowse <= 1 - call s:NetrwRefresh((b:netrw_curdir !~ '\a\{3,}://'),b:netrw_curdir) - endif -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand(""))" - call winrestview(svpos) -" call Dret("netrw#MakeTgt") -endfun - -" --------------------------------------------------------------------- -" netrw#Obtain: {{{2 -" netrw#Obtain(islocal,fname[,tgtdirectory]) -" islocal=0 obtain from remote source -" =1 obtain from local source -" fname : a filename or a list of filenames -" tgtdir : optional place where files are to go (not present, uses getcwd()) -fun! netrw#Obtain(islocal,fname,...) -" call Dfunc("netrw#Obtain(islocal=".a:islocal." fname<".((type(a:fname) == 1)? a:fname : string(a:fname)).">) a:0=".a:0) - " NetrwStatusLine support - for obtaining support - - if type(a:fname) == 1 - let fnamelist= [ a:fname ] - elseif type(a:fname) == 3 - let fnamelist= a:fname - else - call netrw#ErrorMsg(s:ERROR,"attempting to use NetrwObtain on something not a filename or a list",62) -" call Dret("netrw#Obtain") - return - endif -" call Decho("fnamelist<".string(fnamelist).">",'~'.expand("")) - if a:0 > 0 - let tgtdir= a:1 - else - let tgtdir= getcwd() - endif -" call Decho("tgtdir<".tgtdir.">",'~'.expand("")) - - if exists("b:netrw_islocal") && b:netrw_islocal - " obtain a file from local b:netrw_curdir to (local) tgtdir -" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir,'~'.expand("")) - if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir - let topath= s:ComposePath(tgtdir,"") - if (has("win32") || has("win95") || has("win64") || has("win16")) - " transfer files one at time -" call Decho("transfer files one at a time",'~'.expand("")) - for fname in fnamelist -" call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("")) - call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) - if v:shell_error != 0 - call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) -" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) - return - endif - endfor - else - " transfer files with one command -" call Decho("transfer files with one command",'~'.expand("")) - let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)")) -" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("")) - call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".filelist." ".s:ShellEscape(topath)) - if v:shell_error != 0 - call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) -" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) - return - endif - endif - elseif !exists("b:netrw_curdir") - call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36) - else - call netrw#ErrorMsg(s:WARNING,"local browsing directory and current directory are identical",37) - endif - - else - " obtain files from remote b:netrw_curdir to local tgtdir -" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir,'~'.expand("")) - if type(a:fname) == 1 - call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) - endif - call s:NetrwMethod(b:netrw_curdir) - - if b:netrw_method == 4 - " obtain file using scp -" call Decho("obtain via scp (method#4)",'~'.expand("")) - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " ".g:netrw_scpport." ".g:netrw_port - else - let useport= "" - endif - if b:netrw_fname =~ '/' - let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','') - else - let path= "" - endif - let filelist= join(map(deepcopy(fnamelist),'escape(s:ShellEscape(g:netrw_machine.":".path.v:val,1)," ")')) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".filelist." ".s:ShellEscape(tgtdir,1)) - - elseif b:netrw_method == 2 - " obtain file using ftp + .netrc -" call Decho("obtain via ftp+.netrc (method #2)",'~'.expand("")) - call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() - let tmpbufnr= bufnr("%") - setl ff=unix - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - if exists("b:netrw_fname") && b:netrw_fname != "" - call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - for fname in fnamelist - call setline(line("$")+1,'get "'.fname.'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endfor - if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) - else - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) - endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' - let debugkeep= &debug - setl debug=msg - call netrw#ErrorMsg(s:ERROR,getline(1),4) - let &debug= debugkeep - endif - - elseif b:netrw_method == 3 - " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) -" call Decho("obtain via ftp+mipf (method #3)",'~'.expand("")) - call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() - let tmpbufnr= bufnr("%") - setl ff=unix - - if exists("g:netrw_port") && g:netrw_port != "" - NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$'),'~'.expand("")) - else - NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - if exists("g:netrw_uid") && g:netrw_uid != "" - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('$'),'~'.expand("")) - if exists("s:netrw_passwd") && s:netrw_passwd != "" - NetrwKeepj put ='\"'.s:netrw_passwd.'\"' - endif -" call Decho("filter input: ".getline('$'),'~'.expand("")) - elseif exists("s:netrw_passwd") - NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - endif - - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - if exists("b:netrw_fname") && b:netrw_fname != "" - NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - for fname in fnamelist - NetrwKeepj call setline(line("$")+1,'get "'.fname.'"') - endfor -" call Decho("filter input: ".getline('$'),'~'.expand("")) - - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password - " Note: using "_dd to delete to the black hole register; avoids messing up @@ - NetrwKeepj norm! 1G"_dd - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" -" call Decho("error<".getline(1).">",'~'.expand("")) - if !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),5) - endif - endif - - elseif b:netrw_method == 9 - " obtain file using sftp -" call Decho("obtain via sftp (method #9)",'~'.expand("")) - if a:fname =~ '/' - let localfile= substitute(a:fname,'^.*/','','') - else - let localfile= a:fname - endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1).s:ShellEscape(localfile)." ".s:ShellEscape(tgtdir)) - - elseif !exists("b:netrw_method") || b:netrw_method < 0 - " probably a badly formed url; protocol not recognized -" call Dret("netrw#Obtain : unsupported method") - return - - else - " protocol recognized but not supported for Obtain (yet?) - if !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"current protocol not supported for obtaining file",97) - endif -" call Dret("netrw#Obtain : current protocol not supported for obtaining file") - return - endif - - " restore status line - if type(a:fname) == 1 && exists("s:netrw_users_stl") - NetrwKeepj call s:SetupNetrwStatusLine(s:netrw_users_stl) - endif - - endif - - " cleanup - if exists("tmpbufnr") - if bufnr("%") != tmpbufnr - exe tmpbufnr."bw!" - else - q! - endif - endif - -" call Dret("netrw#Obtain") -endfun - -" --------------------------------------------------------------------- -" netrw#Nread: save position, call netrw#NetRead(), and restore position {{{2 -fun! netrw#Nread(mode,fname) -" call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)") - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - call netrw#NetRead(a:mode,a:fname) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - call winrestview(svpos) - - if exists("w:netrw_liststyle") && w:netrw_liststyle != s:TREELIST - if exists("w:netrw_bannercnt") - " start with cursor just after the banner - exe w:netrw_bannercnt - endif - endif -" call Dret("netrw#Nread") -endfun - -" ------------------------------------------------------------------------ -" s:NetrwOptionsSave: save options prior to setting to "netrw-buffer-standard" form {{{2 -" Options get restored by s:NetrwOptionsRestore() -" -" Option handling: -" * save user's options (s:NetrwOptionsSave) -" * set netrw-safe options (s:NetrwOptionsSafe) -" - change an option only when user option != safe option (s:netrwSetSafeSetting) -" * restore user's options (s:netrwOPtionsRestore) -" - restore a user option when != safe option (s:NetrwRestoreSetting) -" vt: (variable type) normally its either "w:" or "s:" -fun! s:NetrwOptionsSave(vt) -" call Dfunc("s:NetrwOptionsSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) -" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.expand("")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt." hid=".&hid,'~'.expand("")) -" call Decho("(s:NetrwOptionsSave) lines=".&lines) - - if !exists("{a:vt}netrw_optionsave") - let {a:vt}netrw_optionsave= 1 - else -" call Dret("s:NetrwOptionsSave : options already saved") - return - endif -" call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff,'~'.expand("")) - - " Save current settings and current directory -" call Decho("saving current settings and current directory",'~'.expand("")) - let s:yykeep = @@ - if exists("&l:acd")|let {a:vt}netrw_acdkeep = &l:acd|endif - let {a:vt}netrw_aikeep = &l:ai - let {a:vt}netrw_awkeep = &l:aw - let {a:vt}netrw_bhkeep = &l:bh - let {a:vt}netrw_blkeep = &l:bl - let {a:vt}netrw_btkeep = &l:bt - let {a:vt}netrw_bombkeep = &l:bomb - let {a:vt}netrw_cedit = &cedit - let {a:vt}netrw_cikeep = &l:ci - let {a:vt}netrw_cinkeep = &l:cin - let {a:vt}netrw_cinokeep = &l:cino - let {a:vt}netrw_comkeep = &l:com - let {a:vt}netrw_cpokeep = &l:cpo - let {a:vt}netrw_cuckeep = &l:cuc - let {a:vt}netrw_culkeep = &l:cul -" call Decho("(s:NetrwOptionsSave) COMBAK: cuc=".&l:cuc." cul=".&l:cul) - let {a:vt}netrw_diffkeep = &l:diff - let {a:vt}netrw_fenkeep = &l:fen - if !exists("g:netrw_ffkeep") || g:netrw_ffkeep - let {a:vt}netrw_ffkeep = &l:ff - endif - let {a:vt}netrw_fokeep = &l:fo " formatoptions - let {a:vt}netrw_gdkeep = &l:gd " gdefault - let {a:vt}netrw_gokeep = &go " guioptions - let {a:vt}netrw_hidkeep = &l:hidden - let {a:vt}netrw_imkeep = &l:im - let {a:vt}netrw_iskkeep = &l:isk - let {a:vt}netrw_lines = &lines - let {a:vt}netrw_lskeep = &l:ls - let {a:vt}netrw_makeep = &l:ma - let {a:vt}netrw_magickeep = &l:magic - let {a:vt}netrw_modkeep = &l:mod - let {a:vt}netrw_nukeep = &l:nu - let {a:vt}netrw_rnukeep = &l:rnu - let {a:vt}netrw_repkeep = &l:report - let {a:vt}netrw_rokeep = &l:ro - let {a:vt}netrw_selkeep = &l:sel - let {a:vt}netrw_spellkeep = &l:spell - if !g:netrw_use_noswf - let {a:vt}netrw_swfkeep = &l:swf - endif - let {a:vt}netrw_tskeep = &l:ts - let {a:vt}netrw_twkeep = &l:tw " textwidth - let {a:vt}netrw_wigkeep = &l:wig " wildignore - let {a:vt}netrw_wrapkeep = &l:wrap - let {a:vt}netrw_writekeep = &l:write - - " save a few selected netrw-related variables -" call Decho("saving a few selected netrw-related variables",'~'.expand("")) - if g:netrw_keepdir - let {a:vt}netrw_dirkeep = getcwd() -" call Decho("saving to ".a:vt."netrw_dirkeep<".{a:vt}netrw_dirkeep.">",'~'.expand("")) - endif - sil! let {a:vt}netrw_slashkeep= @/ - -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) -" call Dret("s:NetrwOptionsSave : tab#".tabpagenr()." win#".winnr()) -endfun - -" --------------------------------------------------------------------- -" s:NetrwOptionsSafe: sets options to help netrw do its job {{{2 -" Use s:NetrwSaveOptions() to save user settings -" Use s:NetrwOptionsRestore() to restore user settings -fun! s:NetrwOptionsSafe(islocal) -" call Dfunc("s:NetrwOptionsSafe(islocal=".a:islocal.") win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) -" call Decho("win#".winnr()."'s ft=".&ft,'~'.expand("")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) - if exists("+acd") | call s:NetrwSetSafeSetting("&l:acd",0)|endif - call s:NetrwSetSafeSetting("&l:ai",0) - call s:NetrwSetSafeSetting("&l:aw",0) - call s:NetrwSetSafeSetting("&l:bl",0) - call s:NetrwSetSafeSetting("&l:bomb",0) - if a:islocal - call s:NetrwSetSafeSetting("&l:bt","nofile") - else - call s:NetrwSetSafeSetting("&l:bt","acwrite") - endif - call s:NetrwSetSafeSetting("&l:ci",0) - call s:NetrwSetSafeSetting("&l:cin",0) - if g:netrw_fastbrowse > a:islocal - call s:NetrwSetSafeSetting("&l:bh","hide") - else - call s:NetrwSetSafeSetting("&l:bh","delete") - endif - call s:NetrwSetSafeSetting("&l:cino","") - call s:NetrwSetSafeSetting("&l:com","") - if &cpo =~ 'a' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'a','','g')) | endif - if &cpo =~ 'A' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'A','','g')) | endif - setl fo=nroql2 - if &go =~ 'a' | set go-=a | endif - if &go =~ 'A' | set go-=A | endif - if &go =~ 'P' | set go-=P | endif - call s:NetrwSetSafeSetting("&l:hid",0) - call s:NetrwSetSafeSetting("&l:im",0) - setl isk+=@ isk+=* isk+=/ - call s:NetrwSetSafeSetting("&l:magic",1) - if g:netrw_use_noswf - call s:NetrwSetSafeSetting("swf",0) - endif - call s:NetrwSetSafeSetting("&l:report",10000) - call s:NetrwSetSafeSetting("&l:sel","inclusive") - call s:NetrwSetSafeSetting("&l:spell",0) - call s:NetrwSetSafeSetting("&l:tw",0) - call s:NetrwSetSafeSetting("&l:wig","") - setl cedit& - - " set up cuc and cul based on g:netrw_cursor and listing style - " COMBAK -- cuc cul related - call s:NetrwCursor(0) - - " allow the user to override safe options -" call Decho("ft<".&ft."> ei=".&ei,'~'.expand("")) - if &ft == "netrw" -" call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("")) - keepalt NetrwKeepj doau FileType netrw - endif - -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">",'~'.expand("")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Dret("s:NetrwOptionsSafe") -endfun - -" --------------------------------------------------------------------- -" s:NetrwOptionsRestore: restore options (based on prior s:NetrwOptionsSave) {{{2 -fun! s:NetrwOptionsRestore(vt) -" call Dfunc("s:NetrwOptionsRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) -" call Decho("(s:NetrwOptionsRestore) lines=".&lines) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) - if !exists("{a:vt}netrw_optionsave") -" call Decho("case ".a:vt."netrw_optionsave : doesn't exist",'~'.expand("")) - - " filereadable() returns zero for remote files (e.g. scp://localhost//etc/fstab) - if filereadable(expand("%")) || expand("%") =~# '^\w\+://\f\+/' -" call Decho("..doing filetype detect anyway") - filetype detect -" call Decho("..settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) - else - setl ft=netrw - endif -" call Decho("..ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("s:NetrwOptionsRestore : ".a:vt."netrw_optionsave doesn't exist") - return - endif - unlet {a:vt}netrw_optionsave - - if exists("+acd") - if exists("{a:vt}netrw_acdkeep") -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) - let curdir = getcwd() - let &l:acd = {a:vt}netrw_acdkeep - unlet {a:vt}netrw_acdkeep - if &l:acd - call s:NetrwLcd(curdir) - endif - endif - endif -" call Decho("(s:NetrwOptionsRestore) #1 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_aikeep","&l:ai") - call s:NetrwRestoreSetting(a:vt."netrw_awkeep","&l:aw") - call s:NetrwRestoreSetting(a:vt."netrw_blkeep","&l:bl") - call s:NetrwRestoreSetting(a:vt."netrw_btkeep","&l:bt") - call s:NetrwRestoreSetting(a:vt."netrw_bombkeep","&l:bomb") -" call Decho("(s:NetrwOptionsRestore) #2 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_cedit","&cedit") - call s:NetrwRestoreSetting(a:vt."netrw_cikeep","&l:ci") - call s:NetrwRestoreSetting(a:vt."netrw_cinkeep","&l:cin") - call s:NetrwRestoreSetting(a:vt."netrw_cinokeep","&l:cino") - call s:NetrwRestoreSetting(a:vt."netrw_comkeep","&l:com") -" call Decho("(s:NetrwOptionsRestore) #3 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_cpokeep","&l:cpo") - call s:NetrwRestoreSetting(a:vt."netrw_diffkeep","&l:diff") - call s:NetrwRestoreSetting(a:vt."netrw_fenkeep","&l:fen") - if exists("g:netrw_ffkeep") && g:netrw_ffkeep - call s:NetrwRestoreSetting(a:vt."netrw_ffkeep")","&l:ff") - endif -" call Decho("(s:NetrwOptionsRestore) #4 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_fokeep" ,"&l:fo") - call s:NetrwRestoreSetting(a:vt."netrw_gdkeep" ,"&l:gd") - call s:NetrwRestoreSetting(a:vt."netrw_gokeep" ,"&go") - call s:NetrwRestoreSetting(a:vt."netrw_hidkeep" ,"&l:hidden") -" call Decho("(s:NetrwOptionsRestore) #5 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_imkeep" ,"&l:im") - call s:NetrwRestoreSetting(a:vt."netrw_iskkeep" ,"&l:isk") -" call Decho("(s:NetrwOptionsRestore) #6 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_lines" ,"&lines") -" call Decho("(s:NetrwOptionsRestore) #7 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_lskeep" ,"&l:ls") - call s:NetrwRestoreSetting(a:vt."netrw_makeep" ,"&l:ma") - call s:NetrwRestoreSetting(a:vt."netrw_magickeep","&l:magic") - call s:NetrwRestoreSetting(a:vt."netrw_modkeep" ,"&l:mod") - call s:NetrwRestoreSetting(a:vt."netrw_nukeep" ,"&l:nu") -" call Decho("(s:NetrwOptionsRestore) #8 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_rnukeep" ,"&l:rnu") - call s:NetrwRestoreSetting(a:vt."netrw_repkeep" ,"&l:report") - call s:NetrwRestoreSetting(a:vt."netrw_rokeep" ,"&l:ro") - call s:NetrwRestoreSetting(a:vt."netrw_selkeep" ,"&l:sel") -" call Decho("(s:NetrwOptionsRestore) #9 lines=".&lines) - call s:NetrwRestoreSetting(a:vt."netrw_spellkeep","&l:spell") - call s:NetrwRestoreSetting(a:vt."netrw_twkeep" ,"&l:tw") - call s:NetrwRestoreSetting(a:vt."netrw_wigkeep" ,"&l:wig") - call s:NetrwRestoreSetting(a:vt."netrw_wrapkeep" ,"&l:wrap") - call s:NetrwRestoreSetting(a:vt."netrw_writekeep","&l:write") -" call Decho("(s:NetrwOptionsRestore) #10 lines=".&lines) - call s:NetrwRestoreSetting("s:yykeep","@@") - " former problem: start with liststyle=0; press : result, following line resets l:ts. - " Fixed; in s:PerformListing, when w:netrw_liststyle is s:LONGLIST, will use a printf to pad filename with spaces - " rather than by appending a tab which previously was using "&ts" to set the desired spacing. (Sep 28, 2018) - call s:NetrwRestoreSetting(a:vt."netrw_tskeep","&l:ts") - - if exists("{a:vt}netrw_swfkeep") - if &directory == "" - " user hasn't specified a swapfile directory; - " netrw will temporarily set the swapfile directory - " to the current directory as returned by getcwd(). - let &l:directory= getcwd() - sil! let &l:swf = {a:vt}netrw_swfkeep - setl directory= - unlet {a:vt}netrw_swfkeep - elseif &l:swf != {a:vt}netrw_swfkeep - if !g:netrw_use_noswf - " following line causes a Press ENTER in windows -- can't seem to work around it!!! - sil! let &l:swf= {a:vt}netrw_swfkeep - endif - unlet {a:vt}netrw_swfkeep - endif - endif - if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir - let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') - if exists("{a:vt}netrw_dirkeep") - call s:NetrwLcd(dirkeep) - unlet {a:vt}netrw_dirkeep - endif - endif - call s:NetrwRestoreSetting(a:vt."netrw_slashkeep","@/") - -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("")) -" call Decho("ts=".&l:ts,'~'.expand("")) - " Moved the filetype detect here from NetrwGetFile() because remote files - " were having their filetype detect-generated settings overwritten by - " NetrwOptionRestore. - if &ft != "netrw" -" call Decho("before: filetype detect (ft=".&ft.")",'~'.expand("")) - filetype detect -" call Decho("after : filetype detect (ft=".&ft.")",'~'.expand("")) - endif -" call Decho("(s:NetrwOptionsRestore) lines=".&lines) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) -" call Dret("s:NetrwOptionsRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) -endfun - -" --------------------------------------------------------------------- -" s:NetrwSetSafeSetting: sets an option to a safe setting {{{2 -" but only when the options' value and the safe setting differ -" Doing this means that netrw will not come up as having changed a -" setting last when it really didn't actually change it. -" -" Called from s:NetrwOptionsSafe -" ex. call s:NetrwSetSafeSetting("&l:sel","inclusive") -fun! s:NetrwSetSafeSetting(setting,safesetting) -" call Dfunc("s:NetrwSetSafeSetting(setting<".a:setting."> safesetting<".a:safesetting.">)") - - if a:setting =~ '^&' -" call Decho("fyi: a:setting starts with &") - exe "let settingval= ".a:setting -" call Decho("fyi: settingval<".settingval.">") - - if settingval != a:safesetting -" call Decho("set setting<".a:setting."> to option value<".a:safesetting.">") - if type(a:safesetting) == 0 - exe "let ".a:setting."=".a:safesetting - elseif type(a:safesetting) == 1 - exe "let ".a:setting."= '".a:safesetting."'" - else - call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:setting." with a safesetting of type#".type(a:safesetting),105) - endif - endif - endif - -" call Dret("s:NetrwSetSafeSetting") -endfun - -" ------------------------------------------------------------------------ -" s:NetrwRestoreSetting: restores specified setting using associated keepvar, {{{2 -" but only if the setting value differs from the associated keepvar. -" Doing this means that netrw will not come up as having changed a -" setting last when it really didn't actually change it. -" -" Used by s:NetrwOptionsRestore() to restore each netrw-sensitive setting -" keepvars are set up by s:NetrwOptionsSave -fun! s:NetrwRestoreSetting(keepvar,setting) -""" call Dfunc("s:NetrwRestoreSetting(a:keepvar<".a:keepvar."> a:setting<".a:setting.">)") - - " typically called from s:NetrwOptionsRestore - " call s:NetrwRestoreSettings(keep-option-variable-name,'associated-option') - " ex. call s:NetrwRestoreSetting(a:vt."netrw_selkeep","&l:sel") - " Restores option (but only if different) from a:keepvar - if exists(a:keepvar) - exe "let keepvarval= ".a:keepvar - exe "let setting= ".a:setting - -"" call Decho("fyi: a:keepvar<".a:keepvar."> exists") -"" call Decho("fyi: keepvarval=".keepvarval) -"" call Decho("fyi: a:setting<".a:setting."> setting<".setting.">") - - if setting != keepvarval -"" call Decho("restore setting<".a:setting."> (currently=".setting.") to keepvarval<".keepvarval.">") - if type(a:setting) == 0 - exe "let ".a:setting."= ".keepvarval - elseif type(a:setting) == 1 - exe "let ".a:setting."= '".substitute(keepvarval,"'","''","g")."'" - else - call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:keepvar." with a setting of type#".type(a:setting),105) - endif - endif - - exe "unlet ".a:keepvar - endif - -"" call Dret("s:NetrwRestoreSetting") -endfun - -" --------------------------------------------------------------------- -" NetrwStatusLine: {{{2 -fun! NetrwStatusLine() - -" vvv NetrwStatusLine() debugging vvv -" let g:stlmsg="" -" if !exists("w:netrw_explore_bufnr") -" let g:stlmsg="!X" -" elseif w:netrw_explore_bufnr != bufnr("%") -" let g:stlmsg="explore_bufnr!=".bufnr("%") -" endif -" if !exists("w:netrw_explore_line") -" let g:stlmsg=" !X" -" elseif w:netrw_explore_line != line(".") -" let g:stlmsg=" explore_line!={line(.)<".line(".").">" -" endif -" if !exists("w:netrw_explore_list") -" let g:stlmsg=" !X" -" endif -" ^^^ NetrwStatusLine() debugging ^^^ - - if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") - " restore user's status line - let &l:stl = s:netrw_users_stl - let &laststatus = s:netrw_users_ls - if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif - if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif - return "" - else - return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen - endif -endfun - -" =============================== -" Netrw Transfer Functions: {{{1 -" =============================== - -" ------------------------------------------------------------------------ -" netrw#NetRead: responsible for reading a file over the net {{{2 -" mode: =0 read remote file and insert before current line -" =1 read remote file and insert after current line -" =2 replace with remote file -" =3 obtain file, but leave in temporary format -fun! netrw#NetRead(mode,...) -" call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw.((a:0 > 0)? " a:1<".a:1.">" : "")) - - " NetRead: save options {{{3 - call s:NetrwOptionsSave("w:") - call s:NetrwOptionsSafe(0) - call s:RestoreCursorline() - " NetrwSafeOptions sets a buffer up for a netrw listing, which includes buflisting off. - " However, this setting is not wanted for a remote editing session. The buffer should be "nofile", still. - setl bl -" call Decho("buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh,'~'.expand("")) - - " NetRead: interpret mode into a readcmd {{{3 - if a:mode == 0 " read remote file before current line - let readcmd = "0r" - elseif a:mode == 1 " read file after current line - let readcmd = "r" - elseif a:mode == 2 " replace with remote file - let readcmd = "%r" - elseif a:mode == 3 " skip read of file (leave as temporary) - let readcmd = "t" - else - exe a:mode - let readcmd = "r" - endif - let ichoice = (a:0 == 0)? 0 : 1 -" call Decho("readcmd<".readcmd."> ichoice=".ichoice,'~'.expand("")) - - " NetRead: get temporary filename {{{3 - let tmpfile= s:GetTempfile("") - if tmpfile == "" -" call Dret("netrw#NetRead : unable to get a tempfile!") - return - endif - - while ichoice <= a:0 - - " attempt to repeat with previous host-file-etc - if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("")) - let choice = b:netrw_lastfile - let ichoice= ichoice + 1 - - else - exe "let choice= a:" . ichoice -" call Decho("no lastfile: choice<" . choice . ">",'~'.expand("")) - - if match(choice,"?") == 0 - " give help - echomsg 'NetRead Usage:' - echomsg ':Nread machine:path uses rcp' - echomsg ':Nread "machine path" uses ftp with <.netrc>' - echomsg ':Nread "machine id password path" uses ftp' - echomsg ':Nread dav://machine[:port]/path uses cadaver' - echomsg ':Nread fetch://machine/path uses fetch' - echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' - echomsg ':Nread http://[user@]machine/path uses http wget' - echomsg ':Nread file:///path uses elinks' - echomsg ':Nread https://[user@]machine/path uses http wget' - echomsg ':Nread rcp://[user@]machine/path uses rcp' - echomsg ':Nread rsync://machine[:port]/path uses rsync' - echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp' - echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp' - sleep 4 - break - - elseif match(choice,'^"') != -1 - " Reconstruct Choice if choice starts with '"' -" call Decho("reconstructing choice",'~'.expand("")) - if match(choice,'"$') != -1 - " case "..." - let choice= strpart(choice,1,strlen(choice)-2) - else - " case "... ... ..." - let choice = strpart(choice,1,strlen(choice)-1) - let wholechoice = "" - - while match(choice,'"$') == -1 - let wholechoice = wholechoice . " " . choice - let ichoice = ichoice + 1 - if ichoice > a:0 - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) - endif -" call Dret("netrw#NetRead :2 getcwd<".getcwd().">") - return - endif - let choice= a:{ichoice} - endwhile - let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) - endif - endif - endif - -" call Decho("choice<" . choice . ">",'~'.expand("")) - let ichoice= ichoice + 1 - - " NetRead: Determine method of read (ftp, rcp, etc) {{{3 - call s:NetrwMethod(choice) - if !exists("b:netrw_method") || b:netrw_method < 0 -" call Dret("netrw#NetRead : unsupported method") - return - endif - let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix - - " Check whether or not NetrwBrowse() should be handling this request -" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">",'~'.expand("")) - if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://' -" call Decho("yes, choice matches '^.*[\/]$'",'~'.expand("")) - NetrwKeepj call s:NetrwBrowse(0,choice) -" call Dret("netrw#NetRead :3 getcwd<".getcwd().">") - return - endif - - " ============ - " NetRead: Perform Protocol-Based Read {{{3 - " =========================== - if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 - echo "(netrw) Processing your read request..." - endif - - "......................................... - " NetRead: (rcp) NetRead Method #1 {{{3 - if b:netrw_method == 1 " read with rcp -" call Decho("read via rcp (method #1)",'~'.expand("")) - " ER: nothing done with g:netrw_uid yet? - " ER: on Win2K" rcp machine[.user]:file tmpfile - " ER: when machine contains '.' adding .user is required (use $USERNAME) - " ER: the tmpfile is full path: rcp sees C:\... as host C - if s:netrw_has_nt_rcp == 1 - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_machine .'.'. g:netrw_uid - else - " Any way needed it machine contains a '.' - let uid_machine = g:netrw_machine .'.'. $USERNAME - endif - else - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_uid .'@'. g:netrw_machine - else - let uid_machine = g:netrw_machine - endif - endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3 - elseif b:netrw_method == 2 " read with ftp + <.netrc> -" call Decho("read via ftp+.netrc (method #2)",'~'.expand("")) - let netrw_fname= b:netrw_fname - NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() - let filtbuf= bufnr("%") - setl ff=unix - NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline(line("$")),'~'.expand("")) - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline(line("$")),'~'.expand("")) - endif - call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile) -" call Decho("filter input: ".getline(line("$")),'~'.expand("")) - if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) - else - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) - endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' - let debugkeep = &debug - setl debug=msg - NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),4) - let &debug = debugkeep - endif - call s:SaveBufVars() - keepj bd! - if bufname("%") == "" && getline("$") == "" && line('$') == 1 - " needed when one sources a file in a nolbl setting window via ftp - q! - endif - call s:RestoreBufVars() - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3 - elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname - " Construct execution string (four lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)",'~'.expand("")) - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() - let filtbuf= bufnr("%") - setl ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.'),'~'.expand("")) - else - NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.'),'~'.expand("")) - endif - - if exists("g:netrw_uid") && g:netrw_uid != "" - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('.'),'~'.expand("")) - if exists("s:netrw_passwd") - NetrwKeepj put ='\"'.s:netrw_passwd.'\"' - endif -" call Decho("filter input: ".getline('.'),'~'.expand("")) - elseif exists("s:netrw_passwd") - NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.'),'~'.expand("")) - endif - endif - - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('.'),'~'.expand("")) - endif - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.'),'~'.expand("")) - endif - NetrwKeepj put ='get \"'.netrw_fname.'\" '.tmpfile -" call Decho("filter input: ".getline('.'),'~'.expand("")) - - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password - NetrwKeepj norm! 1G"_dd - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" -" call Decho("error<".getline(1).">",'~'.expand("")) - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,getline(1),5) - endif - endif - call s:SaveBufVars()|keepj bd!|call s:RestoreBufVars() - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: (scp) NetRead Method #4 {{{3 - elseif b:netrw_method == 4 " read with scp -" call Decho("read via scp (method #4)",'~'.expand("")) - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " ".g:netrw_scpport." ".g:netrw_port - else - let useport= "" - endif - " 'C' in 'C:\path\to\file' is handled as hostname on windows. - " This is workaround to avoid mis-handle windows local-path: - if g:netrw_scp_cmd =~ '^scp' && (has("win32") || has("win95") || has("win64") || has("win16")) - let tmpfile_get = substitute(tr(tmpfile, '\', '/'), '^\(\a\):[/\\]\(.*\)$', '/\1/\2', '') - else - let tmpfile_get = tmpfile - endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".escape(s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1),' ')." ".s:ShellEscape(tmpfile_get,1)) - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: (http) NetRead Method #5 (wget) {{{3 - elseif b:netrw_method == 5 -" call Decho("read via http (method #5)",'~'.expand("")) - if g:netrw_http_cmd == "" - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6) - endif -" call Dret("netrw#NetRead :4 getcwd<".getcwd().">") - return - endif - - if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd") - " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch) -" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)",'~'.expand("")) - if exists("g:netrw_http_xcmd") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".s:ShellEscape(tmpfile,1)) - else - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) - endif - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - - else - " wget/curl/fetch plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) -" call Decho("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)",'~'.expand("")) - let netrw_html= substitute(b:netrw_fname,"#.*$","","") - let netrw_tag = substitute(b:netrw_fname,"^.*#","","") -" call Decho("netrw_html<".netrw_html.">",'~'.expand("")) -" call Decho("netrw_tag <".netrw_tag.">",'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) -" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/','~'.expand("")) - exe 'NetrwKeepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" - endif - let b:netrw_lastfile = choice -" call Decho("setl ro",'~'.expand("")) - setl ro nomod - - "......................................... - " NetRead: (dav) NetRead Method #6 {{{3 - elseif b:netrw_method == 6 -" call Decho("read via cadaver (method #6)",'~'.expand("")) - - if !executable(g:netrw_dav_cmd) - call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73) -" call Dret("netrw#NetRead : ".g:netrw_dav_cmd." not executable") - return - endif - if g:netrw_dav_cmd =~ "curl" - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_dav_cmd." ".s:ShellEscape("dav://".g:netrw_machine.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) - else - " Construct execution string (four lines) which will be passed through filter - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - new - setl ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port - else - NetrwKeepj put ='open '.g:netrw_machine - endif - if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" - NetrwKeepj put ='user '.g:netrw_uid.' '.s:netrw_passwd - endif - NetrwKeepj put ='get '.netrw_fname.' '.tmpfile - NetrwKeepj put ='quit' - - " perform cadaver operation: - NetrwKeepj norm! 1G"_dd - call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd) - keepj bd! - endif - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: (rsync) NetRead Method #7 {{{3 - elseif b:netrw_method == 7 -" call Decho("read via rsync (method #7)",'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.g:netrw_rsync_sep.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) - let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: (fetch) NetRead Method #8 {{{3 - " fetch://[user@]host[:http]/path - elseif b:netrw_method == 8 -" call Decho("read via fetch (method #8)",'~'.expand("")) - if g:netrw_fetch_cmd == "" - if !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) - endif -" call Dret("NetRead") - return - endif - if exists("g:netrw_option") && g:netrw_option =~ ":https\=" - let netrw_option= "http" - else - let netrw_option= "ftp" - endif -" call Decho("read via fetch for ".netrw_option,'~'.expand("")) - - if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != "" - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) - else - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) - endif - - let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) - let b:netrw_lastfile = choice -" call Decho("setl ro",'~'.expand("")) - setl ro nomod - - "......................................... - " NetRead: (sftp) NetRead Method #9 {{{3 - elseif b:netrw_method == 9 -" call Decho("read via sftp (method #9)",'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: (file) NetRead Method #10 {{{3 - elseif b:netrw_method == 10 && exists("g:netrw_file_cmd") -" " call Decho("read via ".b:netrw_file_cmd." (method #10)",'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_file_cmd." ".s:ShellEscape(b:netrw_fname,1)." ".tmpfile) - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: Complain {{{3 - else - call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8) - endif - endwhile - - " NetRead: cleanup {{{3 - if exists("b:netrw_method") -" call Decho("cleanup b:netrw_method and b:netrw_fname",'~'.expand("")) - unlet b:netrw_method - unlet b:netrw_fname - endif - if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz' -" call Decho("cleanup by deleting tmpfile<".tmpfile.">",'~'.expand("")) - NetrwKeepj call s:NetrwDelete(tmpfile) - endif - NetrwKeepj call s:NetrwOptionsRestore("w:") - -" call Dret("netrw#NetRead :5 getcwd<".getcwd().">") -endfun - -" ------------------------------------------------------------------------ -" netrw#NetWrite: responsible for writing a file over the net {{{2 -fun! netrw#NetWrite(...) range -" call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw) - - " NetWrite: option handling {{{3 - let mod= 0 - call s:NetrwOptionsSave("w:") - call s:NetrwOptionsSafe(0) - - " NetWrite: Get Temporary Filename {{{3 - let tmpfile= s:GetTempfile("") - if tmpfile == "" -" call Dret("netrw#NetWrite : unable to get a tempfile!") - return - endif - - if a:0 == 0 - let ichoice = 0 - else - let ichoice = 1 - endif - - let curbufname= expand("%") -" call Decho("curbufname<".curbufname.">",'~'.expand("")) - if &binary - " For binary writes, always write entire file. - " (line numbers don't really make sense for that). - " Also supports the writing of tar and zip files. -" call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("")) - exe "sil NetrwKeepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) - elseif g:netrw_cygwin - " write (selected portion of) file to temporary - let cygtmpfile= substitute(tmpfile,g:netrw_cygdrive.'/\(.\)','\1:','') -" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile),'~'.expand("")) - exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) - else - " write (selected portion of) file to temporary -" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("")) - exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) - endif - - if curbufname == "" - " when the file is [No Name], and one attempts to Nwrite it, the buffer takes - " on the temporary file's name. Deletion of the temporary file during - " cleanup then causes an error message. - 0file! - endif - - " NetWrite: while choice loop: {{{3 - while ichoice <= a:0 - - " Process arguments: {{{4 - " attempt to repeat with previous host-file-etc - if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("")) - let choice = b:netrw_lastfile - let ichoice= ichoice + 1 - else - exe "let choice= a:" . ichoice - - " Reconstruct Choice when choice starts with '"' - if match(choice,"?") == 0 - echomsg 'NetWrite Usage:"' - echomsg ':Nwrite machine:path uses rcp' - echomsg ':Nwrite "machine path" uses ftp with <.netrc>' - echomsg ':Nwrite "machine id password path" uses ftp' - echomsg ':Nwrite dav://[user@]machine/path uses cadaver' - echomsg ':Nwrite fetch://[user@]machine/path uses fetch' - echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)' - echomsg ':Nwrite rcp://machine/path uses rcp' - echomsg ':Nwrite rsync://[user@]machine/path uses rsync' - echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp' - echomsg ':Nwrite sftp://[user@]machine/path uses sftp' - sleep 4 - break - - elseif match(choice,"^\"") != -1 - if match(choice,"\"$") != -1 - " case "..." - let choice=strpart(choice,1,strlen(choice)-2) - else - " case "... ... ..." - let choice = strpart(choice,1,strlen(choice)-1) - let wholechoice = "" - - while match(choice,"\"$") == -1 - let wholechoice= wholechoice . " " . choice - let ichoice = ichoice + 1 - if choice > a:0 - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13) - endif -" call Dret("netrw#NetWrite") - return - endif - let choice= a:{ichoice} - endwhile - let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) - endif - endif - endif - let ichoice= ichoice + 1 -" call Decho("choice<" . choice . "> ichoice=".ichoice,'~'.expand("")) - - " Determine method of write (ftp, rcp, etc) {{{4 - NetrwKeepj call s:NetrwMethod(choice) - if !exists("b:netrw_method") || b:netrw_method < 0 -" call Dfunc("netrw#NetWrite : unsupported method") - return - endif - - " ============= - " NetWrite: Perform Protocol-Based Write {{{3 - " ============================ - if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 - echo "(netrw) Processing your write request..." -" call Decho("Processing your write request...",'~'.expand("")) - endif - - "......................................... - " NetWrite: (rcp) NetWrite Method #1 {{{3 - if b:netrw_method == 1 -" call Decho("write via rcp (method #1)",'~'.expand("")) - if s:netrw_has_nt_rcp == 1 - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_machine .'.'. g:netrw_uid - else - let uid_machine = g:netrw_machine .'.'. $USERNAME - endif - else - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_uid .'@'. g:netrw_machine - else - let uid_machine = g:netrw_machine - endif - endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)) - let b:netrw_lastfile = choice - - "......................................... - " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3 - elseif b:netrw_method == 2 -" call Decho("write via ftp+.netrc (method #2)",'~'.expand("")) - let netrw_fname = b:netrw_fname - - " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead - let bhkeep = &l:bh - let curbuf = bufnr("%") - setl bh=hide - keepj keepalt enew - -" call Decho("filter input window#".winnr(),'~'.expand("")) - setl ff=unix - NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$'),'~'.expand("")) - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$"),'~'.expand("")) - endif - NetrwKeepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') -" call Decho("filter input: ".getline("$"),'~'.expand("")) - if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) - else -" call Decho("filter input window#".winnr(),'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) - endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" - if !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),14) - endif - let mod=1 - endif - - " remove enew buffer (quietly) - let filtbuf= bufnr("%") - exe curbuf."b!" - let &l:bh = bhkeep - exe filtbuf."bw!" - - let b:netrw_lastfile = choice - - "......................................... - " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3 - elseif b:netrw_method == 3 - " Construct execution string (three or more lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)",'~'.expand("")) - let netrw_fname = b:netrw_fname - let bhkeep = &l:bh - - " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead - let curbuf = bufnr("%") - setl bh=hide - keepj keepalt enew - setl ff=unix - - if exists("g:netrw_port") && g:netrw_port != "" - NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.'),'~'.expand("")) - else - NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.'),'~'.expand("")) - endif - if exists("g:netrw_uid") && g:netrw_uid != "" - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('.'),'~'.expand("")) - if exists("s:netrw_passwd") && s:netrw_passwd != "" - NetrwKeepj put ='\"'.s:netrw_passwd.'\"' - endif -" call Decho("filter input: ".getline('.'),'~'.expand("")) - elseif exists("s:netrw_passwd") && s:netrw_passwd != "" - NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.'),'~'.expand("")) - endif - endif - NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$'),'~'.expand("")) - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$"),'~'.expand("")) - endif - NetrwKeepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' -" call Decho("filter input: ".getline('.'),'~'.expand("")) - " save choice/id/password for future use - let b:netrw_lastfile = choice - - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password - NetrwKeepj norm! 1G"_dd - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,getline(1),15) - endif - let mod=1 - endif - - " remove enew buffer (quietly) - let filtbuf= bufnr("%") - exe curbuf."b!" - let &l:bh= bhkeep - exe filtbuf."bw!" - - "......................................... - " NetWrite: (scp) NetWrite Method #4 {{{3 - elseif b:netrw_method == 4 -" call Decho("write via scp (method #4)",'~'.expand("")) - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port) - else - let useport= "" - endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) - let b:netrw_lastfile = choice - - "......................................... - " NetWrite: (http) NetWrite Method #5 {{{3 - elseif b:netrw_method == 5 -" call Decho("write via http (method #5)",'~'.expand("")) - let curl= substitute(g:netrw_http_put_cmd,'\s\+.*$',"","") - if executable(curl) - let url= g:netrw_choice - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(url,1) ) - elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd.">",16) - endif - - "......................................... - " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3 - elseif b:netrw_method == 6 -" call Decho("write via cadaver (method #6)",'~'.expand("")) - - " Construct execution string (four lines) which will be passed through filter - let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape) - let bhkeep = &l:bh - - " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead - let curbuf = bufnr("%") - setl bh=hide - keepj keepalt enew - - setl ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port - else - NetrwKeepj put ='open '.g:netrw_machine - endif - if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" - NetrwKeepj put ='user '.g:netrw_uid.' '.s:netrw_passwd - endif - NetrwKeepj put ='put '.tmpfile.' '.netrw_fname - - " perform cadaver operation: - NetrwKeepj norm! 1G"_dd - call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd) - - " remove enew buffer (quietly) - let filtbuf= bufnr("%") - exe curbuf."b!" - let &l:bh = bhkeep - exe filtbuf."bw!" - - let b:netrw_lastfile = choice - - "......................................... - " NetWrite: (rsync) NetWrite Method #7 {{{3 - elseif b:netrw_method == 7 -" call Decho("write via rsync (method #7)",'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.g:netrw_rsync_sep.b:netrw_fname,1)) - let b:netrw_lastfile = choice - - "......................................... - " NetWrite: (sftp) NetWrite Method #9 {{{3 - elseif b:netrw_method == 9 -" call Decho("write via sftp (method #9)",'~'.expand("")) - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_uid .'@'. g:netrw_machine - else - let uid_machine = g:netrw_machine - endif - - " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead - let bhkeep = &l:bh - let curbuf = bufnr("%") - setl bh=hide - keepj keepalt enew - - setl ff=unix - call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) -" call Decho("filter input: ".getline('.'),'~'.expand("")) - let sftpcmd= substitute(g:netrw_sftp_cmd,"%TEMPFILE%",escape(tmpfile,'\'),"g") - call s:NetrwExe(s:netrw_silentxfer."%!".sftpcmd.' '.s:ShellEscape(uid_machine,1)) - let filtbuf= bufnr("%") - exe curbuf."b!" - let &l:bh = bhkeep - exe filtbuf."bw!" - let b:netrw_lastfile = choice - - "......................................... - " NetWrite: Complain {{{3 - else - call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17) - let leavemod= 1 - endif - endwhile - - " NetWrite: Cleanup: {{{3 -" call Decho("cleanup",'~'.expand("")) - if s:FileReadable(tmpfile) -" call Decho("tmpfile<".tmpfile."> readable, will now delete it",'~'.expand("")) - call s:NetrwDelete(tmpfile) - endif - call s:NetrwOptionsRestore("w:") - - if a:firstline == 1 && a:lastline == line("$") - " restore modifiability; usually equivalent to set nomod - let &l:mod= mod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - elseif !exists("leavemod") - " indicate that the buffer has not been modified since last written -" call Decho("set nomod",'~'.expand("")) - setl nomod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - endif - -" call Dret("netrw#NetWrite") -endfun - -" --------------------------------------------------------------------- -" netrw#NetSource: source a remotely hosted vim script {{{2 -" uses NetRead to get a copy of the file into a temporarily file, -" then sources that file, -" then removes that file. -fun! netrw#NetSource(...) -" call Dfunc("netrw#NetSource() a:0=".a:0) - if a:0 > 0 && a:1 == '?' - " give help - echomsg 'NetSource Usage:' - echomsg ':Nsource dav://machine[:port]/path uses cadaver' - echomsg ':Nsource fetch://machine/path uses fetch' - echomsg ':Nsource ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' - echomsg ':Nsource http[s]://[user@]machine/path uses http wget' - echomsg ':Nsource rcp://[user@]machine/path uses rcp' - echomsg ':Nsource rsync://machine[:port]/path uses rsync' - echomsg ':Nsource scp://[user@]machine[[:#]port]/path uses scp' - echomsg ':Nsource sftp://[user@]machine[[:#]port]/path uses sftp' - sleep 4 - else - let i= 1 - while i <= a:0 - call netrw#NetRead(3,a:{i}) -" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">",'~'.expand("")) - if s:FileReadable(s:netrw_tmpfile) -" call Decho("exe so ".fnameescape(s:netrw_tmpfile),'~'.expand("")) - exe "so ".fnameescape(s:netrw_tmpfile) -" call Decho("delete(".s:netrw_tmpfile.")",'~'.expand("")) - if delete(s:netrw_tmpfile) - call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".s:netrw_tmpfile.">!",103) - endif - unlet s:netrw_tmpfile - else - call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48) - endif - let i= i + 1 - endwhile - endif -" call Dret("netrw#NetSource") -endfun - -" --------------------------------------------------------------------- -" netrw#SetTreetop: resets the tree top to the current directory/specified directory {{{2 -" (implements the :Ntree command) -fun! netrw#SetTreetop(iscmd,...) -" call Dfunc("netrw#SetTreetop(iscmd=".a:iscmd." ".((a:0 > 0)? a:1 : "").") a:0=".a:0) -" call Decho("w:netrw_treetop<".w:netrw_treetop.">") - - " iscmd==0: netrw#SetTreetop called using gn mapping - " iscmd==1: netrw#SetTreetop called using :Ntree from the command line -" call Decho("(iscmd=".a:iscmd.": called using :Ntree from command line",'~'.expand("")) - " clear out the current tree - if exists("w:netrw_treetop") -" call Decho("clearing out current tree",'~'.expand("")) - let inittreetop= w:netrw_treetop - unlet w:netrw_treetop - endif - if exists("w:netrw_treedict") -" call Decho("freeing w:netrw_treedict",'~'.expand("")) - unlet w:netrw_treedict - endif -" call Decho("inittreetop<".(exists("inittreetop")? inittreetop : "n/a").">") - - if (a:iscmd == 0 || a:1 == "") && exists("inittreetop") - let treedir = s:NetrwTreePath(inittreetop) -" call Decho("treedir<".treedir.">",'~'.expand("")) - else - if isdirectory(s:NetrwFile(a:1)) -" call Decho("a:1<".a:1."> is a directory",'~'.expand("")) - let treedir = a:1 - let s:netrw_treetop = treedir - elseif exists("b:netrw_curdir") && (isdirectory(s:NetrwFile(b:netrw_curdir."/".a:1)) || a:1 =~ '^\a\{3,}://') - let treedir = b:netrw_curdir."/".a:1 - let s:netrw_treetop = treedir -" call Decho("a:1<".a:1."> is NOT a directory, using treedir<".treedir.">",'~'.expand("")) - else - " normally the cursor is left in the message window. - " However, here this results in the directory being listed in the message window, which is not wanted. - let netrwbuf= bufnr("%") - call netrw#ErrorMsg(s:ERROR,"sorry, ".a:1." doesn't seem to be a directory!",95) - exe bufwinnr(netrwbuf)."wincmd w" - let treedir = "." - let s:netrw_treetop = getcwd() - endif - endif -" call Decho("treedir<".treedir.">",'~'.expand("")) - - " determine if treedir is remote or local - let islocal= expand("%") !~ '^\a\{3,}://' -" call Decho("islocal=".islocal,'~'.expand("")) - - " browse the resulting directory - if islocal - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(islocal,treedir)) - else - call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,treedir)) - endif - -" call Dret("netrw#SetTreetop") -endfun - -" =========================================== -" s:NetrwGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2 -" readcmd == %r : replace buffer with newly read file -" == 0r : read file at top of buffer -" == r : read file after current line -" == t : leave file in temporary form (ie. don't read into buffer) -fun! s:NetrwGetFile(readcmd, tfile, method) -" call Dfunc("NetrwGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)") - - " readcmd=='t': simply do nothing - if a:readcmd == 't' -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("NetrwGetFile : skip read of tfile<".a:tfile.">") - return - endif - - " get name of remote filename (ie. url and all) - let rfile= bufname("%") -" call Decho("rfile<".rfile.">",'~'.expand("")) - - if exists("*NetReadFixup") - " for the use of NetReadFixup (not otherwise used internally) - let line2= line("$") - endif - - if a:readcmd[0] == '%' - " get file into buffer -" call Decho("get file into buffer",'~'.expand("")) - - " rename the current buffer to the temp file (ie. tfile) - if g:netrw_cygwin - let tfile= substitute(a:tfile,g:netrw_cygdrive.'/\(.\)','\1:','') - else - let tfile= a:tfile - endif - call s:NetrwBufRename(tfile) - - " edit temporary file (ie. read the temporary file in) - if rfile =~ '\.zip$' -" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)",'~'.expand("")) - call zip#Browse(tfile) - elseif rfile =~ '\.tar$' -" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)",'~'.expand("")) - call tar#Browse(tfile) - elseif rfile =~ '\.tar\.gz$' -" call Decho("handling remote gzip-compressed tar file",'~'.expand("")) - call tar#Browse(tfile) - elseif rfile =~ '\.tar\.bz2$' -" call Decho("handling remote bz2-compressed tar file",'~'.expand("")) - call tar#Browse(tfile) - elseif rfile =~ '\.tar\.xz$' -" call Decho("handling remote xz-compressed tar file",'~'.expand("")) - call tar#Browse(tfile) - elseif rfile =~ '\.txz$' -" call Decho("handling remote xz-compressed tar file (.txz)",'~'.expand("")) - call tar#Browse(tfile) - else -" call Decho("edit temporary file",'~'.expand("")) - NetrwKeepj e! - endif - - " rename buffer back to remote filename - call s:NetrwBufRename(rfile) - - " Jan 19, 2022: COMBAK -- bram problem with https://github.com/vim/vim/pull/9554.diff filetype - " Detect filetype of local version of remote file. - " Note that isk must not include a "/" for scripts.vim - " to process this detection correctly. -" call Decho("detect filetype of local version of remote file<".rfile.">",'~'.expand("")) -" call Decho("..did_filetype()=".did_filetype()) -" setl ft= -" call Decho("..initial filetype<".&ft."> for buf#".bufnr()."<".bufname().">") - let iskkeep= &isk - setl isk-=/ - filetype detect -" call Decho("..local filetype<".&ft."> for buf#".bufnr()."<".bufname().">") - let &l:isk= iskkeep -" call Dredir("ls!","NetrwGetFile (renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">)") - let line1 = 1 - let line2 = line("$") - - elseif !&ma - " attempting to read a file after the current line in the file, but the buffer is not modifiable - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94) -" call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") - return - - elseif s:FileReadable(a:tfile) - " read file after current line -" call Decho("read file<".a:tfile."> after current line",'~'.expand("")) - let curline = line(".") - let lastline= line("$") -" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline,'~'.expand("")) - exe "NetrwKeepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) - let line1= curline + 1 - let line2= line("$") - lastline + 1 - - else - " not readable -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Decho("tfile<".a:tfile."> not readable",'~'.expand("")) - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) -" call Dret("NetrwGetFile : tfile<".a:tfile."> not readable") - return - endif - - " User-provided (ie. optional) fix-it-up command - if exists("*NetReadFixup") -" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")",'~'.expand("")) - NetrwKeepj call NetReadFixup(a:method, line1, line2) -" else " Decho -" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")",'~'.expand("")) - endif - - if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu - " update the Buffers menu - NetrwKeepj call s:UpdateBuffersMenu() - endif - -" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile),'~'.expand("")) - - " make sure file is being displayed -" redraw! - -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("NetrwGetFile") -endfun - -" ------------------------------------------------------------------------ -" s:NetrwMethod: determine method of transfer {{{2 -" Input: -" choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file] -" Output: -" b:netrw_method= 1: rcp -" 2: ftp + <.netrc> -" 3: ftp + machine, id, password, and [path]filename -" 4: scp -" 5: http[s] (wget) -" 6: dav -" 7: rsync -" 8: fetch -" 9: sftp -" 10: file -" g:netrw_machine= hostname -" b:netrw_fname = filename -" g:netrw_port = optional port number (for ftp) -" g:netrw_choice = copy of input url (choice) -fun! s:NetrwMethod(choice) -" call Dfunc("s:NetrwMethod(a:choice<".a:choice.">)") - - " sanity check: choice should have at least three slashes in it - if strlen(substitute(a:choice,'[^/]','','g')) < 3 - call netrw#ErrorMsg(s:ERROR,"not a netrw-style url; netrw uses protocol://[user@]hostname[:port]/[path])",78) - let b:netrw_method = -1 -" call Dret("s:NetrwMethod : incorrect url format<".a:choice.">") - return - endif - - " record current g:netrw_machine, if any - " curmachine used if protocol == ftp and no .netrc - if exists("g:netrw_machine") - let curmachine= g:netrw_machine -" call Decho("curmachine<".curmachine.">",'~'.expand("")) - else - let curmachine= "N O T A HOST" - endif - if exists("g:netrw_port") - let netrw_port= g:netrw_port - endif - - " insure that netrw_ftp_cmd starts off every method determination - " with the current g:netrw_ftp_cmd - let s:netrw_ftp_cmd= g:netrw_ftp_cmd - - " initialization - let b:netrw_method = 0 - let g:netrw_machine = "" - let b:netrw_fname = "" - let g:netrw_port = "" - let g:netrw_choice = a:choice - - " Patterns: - " mipf : a:machine a:id password filename Use ftp - " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid s:netrw_passwd - " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid s:netrw_passwd - " rcpurm : rcp://[user@]host/filename Use rcp - " rcphf : [user@]host:filename Use rcp - " scpurm : scp://[user@]host[[#:]port]/filename Use scp - " httpurm : http[s]://[user@]host/filename Use wget - " davurm : dav[s]://host[:port]/path Use cadaver/curl - " rsyncurm : rsync://host[:port]/path Use rsync - " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) - " sftpurm : sftp://[user@]host/filename Use scp - " fileurm : file://[user@]host/filename Use elinks or links - let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' - let mf = '^\(\S\+\)\s\+\(\S\+\)$' - let ftpurm = '^ftp://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' - let rcpurm = '^rcp://\%(\([^/]*\)@\)\=\([^/]\{-}\)/\(.*\)$' - let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' - let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$' - let httpurm = '^https\=://\([^/]\{-}\)\(/.*\)\=$' - let davurm = '^davs\=://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$' - let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' - let fetchurm = '^fetch://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' - let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' - let fileurm = '^file\=://\(.*\)$' - -" call Decho("determine method:",'~'.expand("")) - " Determine Method - " Method#1: rcp://user@hostname/...path-to-file {{{3 - if match(a:choice,rcpurm) == 0 -" call Decho("rcp://...",'~'.expand("")) - let b:netrw_method = 1 - let userid = substitute(a:choice,rcpurm,'\1',"") - let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") - let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"") - if userid != "" - let g:netrw_uid= userid - endif - - " Method#4: scp://user@hostname/...path-to-file {{{3 - elseif match(a:choice,scpurm) == 0 -" call Decho("scp://...",'~'.expand("")) - let b:netrw_method = 4 - let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") - let g:netrw_port = substitute(a:choice,scpurm,'\2',"") - let b:netrw_fname = substitute(a:choice,scpurm,'\3',"") - - " Method#5: http[s]://user@hostname/...path-to-file {{{3 - elseif match(a:choice,httpurm) == 0 -" call Decho("http[s]://...",'~'.expand("")) - let b:netrw_method = 5 - let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") - let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") - let b:netrw_http = (a:choice =~ '^https:')? "https" : "http" - - " Method#6: dav://hostname[:port]/..path-to-file.. {{{3 - elseif match(a:choice,davurm) == 0 -" call Decho("dav://...",'~'.expand("")) - let b:netrw_method= 6 - if a:choice =~ 'davs:' - let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") - else - let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"") - endif - let b:netrw_fname = substitute(a:choice,davurm,'\3',"") - - " Method#7: rsync://user@hostname/...path-to-file {{{3 - elseif match(a:choice,rsyncurm) == 0 -" call Decho("rsync://...",'~'.expand("")) - let b:netrw_method = 7 - let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") - let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") - - " Methods 2,3: ftp://[user@]hostname[[:#]port]/...path-to-file {{{3 - elseif match(a:choice,ftpurm) == 0 -" call Decho("ftp://...",'~'.expand("")) - let userid = substitute(a:choice,ftpurm,'\2',"") - let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") - let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") - let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") -" call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("")) - if userid != "" - let g:netrw_uid= userid - endif - - if curmachine != g:netrw_machine - if exists("s:netrw_hup[".g:netrw_machine."]") - call NetUserPass("ftp:".g:netrw_machine) - elseif exists("s:netrw_passwd") - " if there's a change in hostname, require password re-entry - unlet s:netrw_passwd - endif - if exists("netrw_port") - unlet netrw_port - endif - endif - - if exists("g:netrw_uid") && exists("s:netrw_passwd") - let b:netrw_method = 3 - else - let host= substitute(g:netrw_machine,'\..*$','','') - if exists("s:netrw_hup[host]") - call NetUserPass("ftp:".host) - - elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~# '-[sS]:' -" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("")) -" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">",'~'.expand("")) - if g:netrw_ftp_cmd =~# '-[sS]:\S*MACHINE\>' - let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\',g:netrw_machine,'') -" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("")) - endif - let b:netrw_method= 2 - elseif s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc -" call Decho("using <".expand("$HOME/.netrc")."> (readable)",'~'.expand("")) - let b:netrw_method= 2 - else - if !exists("g:netrw_uid") || g:netrw_uid == "" - call NetUserPass() - elseif !exists("s:netrw_passwd") || s:netrw_passwd == "" - call NetUserPass(g:netrw_uid) - " else just use current g:netrw_uid and s:netrw_passwd - endif - let b:netrw_method= 3 - endif - endif - - " Method#8: fetch {{{3 - elseif match(a:choice,fetchurm) == 0 -" call Decho("fetch://...",'~'.expand("")) - let b:netrw_method = 8 - let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") - let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") - let b:netrw_option = substitute(a:choice,fetchurm,'\4',"") - let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"") - - " Method#3: Issue an ftp : "machine id password [path/]filename" {{{3 - elseif match(a:choice,mipf) == 0 -" call Decho("(ftp) host id pass file",'~'.expand("")) - let b:netrw_method = 3 - let g:netrw_machine = substitute(a:choice,mipf,'\1',"") - let g:netrw_uid = substitute(a:choice,mipf,'\2',"") - let s:netrw_passwd = substitute(a:choice,mipf,'\3',"") - let b:netrw_fname = substitute(a:choice,mipf,'\4',"") - call NetUserPass(g:netrw_machine,g:netrw_uid,s:netrw_passwd) - - " Method#3: Issue an ftp: "hostname [path/]filename" {{{3 - elseif match(a:choice,mf) == 0 -" call Decho("(ftp) host file",'~'.expand("")) - if exists("g:netrw_uid") && exists("s:netrw_passwd") - let b:netrw_method = 3 - let g:netrw_machine = substitute(a:choice,mf,'\1',"") - let b:netrw_fname = substitute(a:choice,mf,'\2',"") - - elseif s:FileReadable(expand("$HOME/.netrc")) - let b:netrw_method = 2 - let g:netrw_machine = substitute(a:choice,mf,'\1',"") - let b:netrw_fname = substitute(a:choice,mf,'\2',"") - endif - - " Method#9: sftp://user@hostname/...path-to-file {{{3 - elseif match(a:choice,sftpurm) == 0 -" call Decho("sftp://...",'~'.expand("")) - let b:netrw_method = 9 - let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") - let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") - - " Method#1: Issue an rcp: hostname:filename" (this one should be last) {{{3 - elseif match(a:choice,rcphf) == 0 -" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">",'~'.expand("")) - let b:netrw_method = 1 - let userid = substitute(a:choice,rcphf,'\2',"") - let g:netrw_machine = substitute(a:choice,rcphf,'\3',"") - let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") -" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">",'~'.expand("")) -" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">",'~'.expand("")) -" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">",'~'.expand("")) -" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">",'~'.expand("")) - if userid != "" - let g:netrw_uid= userid - endif - - " Method#10: file://user@hostname/...path-to-file {{{3 - elseif match(a:choice,fileurm) == 0 && exists("g:netrw_file_cmd") -" call Decho("http[s]://...",'~'.expand("")) - let b:netrw_method = 10 - let b:netrw_fname = substitute(a:choice,fileurm,'\1',"") -" call Decho('\1<'.substitute(a:choice,fileurm,'\1',"").">",'~'.expand("")) - - " Cannot Determine Method {{{3 - else - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:WARNING,"cannot determine method (format: protocol://[user@]hostname[:port]/[path])",45) - endif - let b:netrw_method = -1 - endif - "}}}3 - - if g:netrw_port != "" - " remove any leading [:#] from port number - let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','') - elseif exists("netrw_port") - " retain port number as implicit for subsequent ftp operations - let g:netrw_port= netrw_port - endif - -" call Decho("a:choice <".a:choice.">",'~'.expand("")) -" call Decho("b:netrw_method <".b:netrw_method.">",'~'.expand("")) -" call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("")) -" call Decho("g:netrw_port <".g:netrw_port.">",'~'.expand("")) -" if exists("g:netrw_uid") "Decho -" call Decho("g:netrw_uid <".g:netrw_uid.">",'~'.expand("")) -" endif "Decho -" if exists("s:netrw_passwd") "Decho -" call Decho("s:netrw_passwd <".s:netrw_passwd.">",'~'.expand("")) -" endif "Decho -" call Decho("b:netrw_fname <".b:netrw_fname.">",'~'.expand("")) -" call Dret("s:NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) -endfun - -" ------------------------------------------------------------------------ -" NetReadFixup: this sort of function is typically written by the user {{{2 -" to handle extra junk that their system's ftp dumps -" into the transfer. This function is provided as an -" example and as a fix for a Windows 95 problem: in my -" experience, win95's ftp always dumped four blank lines -" at the end of the transfer. -if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp - fun! NetReadFixup(method, line1, line2) -" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") - - " sanity checks -- attempt to convert inputs to integers - let method = a:method + 0 - let line1 = a:line1 + 0 - let line2 = a:line2 + 0 - if type(method) != 0 || type(line1) != 0 || type(line2) != 0 || method < 0 || line1 <= 0 || line2 <= 0 -" call Dret("NetReadFixup") - return - endif - - if method == 3 " ftp (no <.netrc>) - let fourblanklines= line2 - 3 - if fourblanklines >= line1 - exe "sil NetrwKeepj ".fourblanklines.",".line2."g/^\s*$/d" - call histdel("/",-1) - endif - endif - -" call Dret("NetReadFixup") - endfun -endif - -" --------------------------------------------------------------------- -" NetUserPass: set username and password for subsequent ftp transfer {{{2 -" Usage: :call NetUserPass() -- will prompt for userid and password -" :call NetUserPass("uid") -- will prompt for password -" :call NetUserPass("uid","password") -- sets global userid and password -" :call NetUserPass("ftp:host") -- looks up userid and password using hup dictionary -" :call NetUserPass("host","uid","password") -- sets hup dictionary with host, userid, password -fun! NetUserPass(...) - -" call Dfunc("NetUserPass() a:0=".a:0) - - if !exists('s:netrw_hup') - let s:netrw_hup= {} - endif - - if a:0 == 0 - " case: no input arguments - - " change host and username if not previously entered; get new password - if !exists("g:netrw_machine") - let g:netrw_machine= input('Enter hostname: ') - endif - if !exists("g:netrw_uid") || g:netrw_uid == "" - " get username (user-id) via prompt - let g:netrw_uid= input('Enter username: ') - endif - " get password via prompting - let s:netrw_passwd= inputsecret("Enter Password: ") - - " set up hup database - let host = substitute(g:netrw_machine,'\..*$','','') - if !exists('s:netrw_hup[host]') - let s:netrw_hup[host]= {} - endif - let s:netrw_hup[host].uid = g:netrw_uid - let s:netrw_hup[host].passwd = s:netrw_passwd - - elseif a:0 == 1 - " case: one input argument - - if a:1 =~ '^ftp:' - " get host from ftp:... url - " access userid and password from hup (host-user-passwd) dictionary -" call Decho("case a:0=1: a:1<".a:1."> (get host from ftp:... url)",'~'.expand("")) - let host = substitute(a:1,'^ftp:','','') - let host = substitute(host,'\..*','','') - if exists("s:netrw_hup[host]") - let g:netrw_uid = s:netrw_hup[host].uid - let s:netrw_passwd = s:netrw_hup[host].passwd -" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("")) -" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("")) - else - let g:netrw_uid = input("Enter UserId: ") - let s:netrw_passwd = inputsecret("Enter Password: ") - endif - - else - " case: one input argument, not an url. Using it as a new user-id. -" call Decho("case a:0=1: a:1<".a:1."> (get host from input argument, not an url)",'~'.expand("")) - if exists("g:netrw_machine") - if g:netrw_machine =~ '[0-9.]\+' - let host= g:netrw_machine - else - let host= substitute(g:netrw_machine,'\..*$','','') - endif - else - let g:netrw_machine= input('Enter hostname: ') - endif - let g:netrw_uid = a:1 -" call Decho("set g:netrw_uid= <".g:netrw_uid.">",'~'.expand("")) - if exists("g:netrw_passwd") - " ask for password if one not previously entered - let s:netrw_passwd= g:netrw_passwd - else - let s:netrw_passwd = inputsecret("Enter Password: ") - endif - endif - -" call Decho("host<".host.">",'~'.expand("")) - if exists("host") - if !exists('s:netrw_hup[host]') - let s:netrw_hup[host]= {} - endif - let s:netrw_hup[host].uid = g:netrw_uid - let s:netrw_hup[host].passwd = s:netrw_passwd - endif - - elseif a:0 == 2 - let g:netrw_uid = a:1 - let s:netrw_passwd = a:2 - - elseif a:0 == 3 - " enter hostname, user-id, and password into the hup dictionary - let host = substitute(a:1,'^\a\+:','','') - let host = substitute(host,'\..*$','','') - if !exists('s:netrw_hup[host]') - let s:netrw_hup[host]= {} - endif - let s:netrw_hup[host].uid = a:2 - let s:netrw_hup[host].passwd = a:3 - let g:netrw_uid = s:netrw_hup[host].uid - let s:netrw_passwd = s:netrw_hup[host].passwd -" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("")) -" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("")) - endif - -" call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">") -endfun - -" ================================= -" Shared Browsing Support: {{{1 -" ================================= - -" --------------------------------------------------------------------- -" s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2 -fun! s:ExplorePatHls(pattern) -" call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)") - let repat= substitute(a:pattern,'^**/\{1,2}','','') -" call Decho("repat<".repat.">",'~'.expand("")) - let repat= escape(repat,'][.\') -" call Decho("repat<".repat.">",'~'.expand("")) - let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>' -" call Dret("s:ExplorePatHls repat<".repat.">") - return repat -endfun - -" --------------------------------------------------------------------- -" s:NetrwBookHistHandler: {{{2 -" 0: (user: ) bookmark current directory -" 1: (user: ) change to the bookmarked directory -" 2: (user: ) list bookmarks -" 3: (browsing) records current directory history -" 4: (user: ) go up (previous) directory, using history -" 5: (user: ) go down (next) directory, using history -" 6: (user: ) delete bookmark -fun! s:NetrwBookHistHandler(chg,curdir) -" call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhistcnt." histmax=".g:netrw_dirhistmax) - if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 -" " call Dret("s:NetrwBookHistHandler - suppressed due to g:netrw_dirhistmax") - return - endif - - let ykeep = @@ - let curbufnr = bufnr("%") - - if a:chg == 0 - " bookmark the current directory -" call Decho("(user: ) bookmark the current directory",'~'.expand("")) - if exists("s:netrwmarkfilelist_{curbufnr}") - call s:NetrwBookmark(0) - echo "bookmarked marked files" - else - call s:MakeBookmark(a:curdir) - echo "bookmarked the current directory" - endif - - try - call s:NetrwBookHistSave() - catch - endtry - - elseif a:chg == 1 - " change to the bookmarked directory -" call Decho("(user: <".v:count."gb>) change to the bookmarked directory",'~'.expand("")) - if exists("g:netrw_bookmarklist[v:count-1]") -" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("")) - exe "NetrwKeepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) - else - echomsg "Sorry, bookmark#".v:count." doesn't exist!" - endif - - elseif a:chg == 2 -" redraw! - let didwork= 0 - " list user's bookmarks -" call Decho("(user: ) list user's bookmarks",'~'.expand("")) - if exists("g:netrw_bookmarklist") -" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks','~'.expand("")) - let cnt= 1 - for bmd in g:netrw_bookmarklist -" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1],'~'.expand("")) - echo printf("Netrw Bookmark#%-2d: %s",cnt,g:netrw_bookmarklist[cnt-1]) - let didwork = 1 - let cnt = cnt + 1 - endfor - endif - - " list directory history - " Note: history is saved only when PerformListing is done; - " ie. when netrw can re-use a netrw buffer, the current directory is not saved in the history. - let cnt = g:netrw_dirhistcnt - let first = 1 - let histcnt = 0 - if g:netrw_dirhistmax > 0 - while ( first || cnt != g:netrw_dirhistcnt ) -" call Decho("first=".first." cnt=".cnt." dirhistcnt=".g:netrw_dirhistcnt,'~'.expand("")) - if exists("g:netrw_dirhist_{cnt}") -" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt},'~'.expand("")) - echo printf("Netrw History#%-2d: %s",histcnt,g:netrw_dirhist_{cnt}) - let didwork= 1 - endif - let histcnt = histcnt + 1 - let first = 0 - let cnt = ( cnt - 1 ) % g:netrw_dirhistmax - if cnt < 0 - let cnt= cnt + g:netrw_dirhistmax - endif - endwhile - else - let g:netrw_dirhistcnt= 0 - endif - if didwork - call inputsave()|call input("Press to continue")|call inputrestore() - endif - - elseif a:chg == 3 - " saves most recently visited directories (when they differ) -" call Decho("(browsing) record curdir history",'~'.expand("")) - if !exists("g:netrw_dirhistcnt") || !exists("g:netrw_dirhist_{g:netrw_dirhistcnt}") || g:netrw_dirhist_{g:netrw_dirhistcnt} != a:curdir - if g:netrw_dirhistmax > 0 - let g:netrw_dirhistcnt = ( g:netrw_dirhistcnt + 1 ) % g:netrw_dirhistmax - let g:netrw_dirhist_{g:netrw_dirhistcnt} = a:curdir - endif -" call Decho("save dirhist#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("")) - endif - - elseif a:chg == 4 - " u: change to the previous directory stored on the history list -" call Decho("(user: ) chg to prev dir from history",'~'.expand("")) - if g:netrw_dirhistmax > 0 - let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt - v:count1 ) % g:netrw_dirhistmax - if g:netrw_dirhistcnt < 0 - let g:netrw_dirhistcnt= g:netrw_dirhistcnt + g:netrw_dirhistmax - endif - else - let g:netrw_dirhistcnt= 0 - endif - if exists("g:netrw_dirhist_{g:netrw_dirhistcnt}") -" call Decho("changedir u#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("")) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") - setl ma noro -" call Decho("setl ma noro",'~'.expand("")) - sil! NetrwKeepj %d _ - setl nomod -" call Decho("setl nomod",'~'.expand("")) -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}),'~'.expand("")) - exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}) - else - if g:netrw_dirhistmax > 0 - let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt + v:count1 ) % g:netrw_dirhistmax - else - let g:netrw_dirhistcnt= 0 - endif - echo "Sorry, no predecessor directory exists yet" - endif - - elseif a:chg == 5 - " U: change to the subsequent directory stored on the history list -" call Decho("(user: ) chg to next dir from history",'~'.expand("")) - if g:netrw_dirhistmax > 0 - let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt + 1 ) % g:netrw_dirhistmax - if exists("g:netrw_dirhist_{g:netrw_dirhistcnt}") -" call Decho("changedir U#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("")) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") -" call Decho("setl ma noro",'~'.expand("")) - setl ma noro - sil! NetrwKeepj %d _ -" call Decho("removed all lines from buffer (%d)",'~'.expand("")) -" call Decho("setl nomod",'~'.expand("")) - setl nomod -" call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}),'~'.expand("")) - exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}) - else - let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt - 1 ) % g:netrw_dirhistmax - if g:netrw_dirhistcnt < 0 - let g:netrw_dirhistcnt= g:netrw_dirhistcnt + g:netrw_dirhistmax - endif - echo "Sorry, no successor directory exists yet" - endif - else - let g:netrw_dirhistcnt= 0 - echo "Sorry, no successor directory exists yet (g:netrw_dirhistmax is ".g:netrw_dirhistmax.")" - endif - - elseif a:chg == 6 -" call Decho("(user: ) delete bookmark'd directory",'~'.expand("")) - if exists("s:netrwmarkfilelist_{curbufnr}") - call s:NetrwBookmark(1) - echo "removed marked files from bookmarks" - else - " delete the v:count'th bookmark - let iremove = v:count - let dremove = g:netrw_bookmarklist[iremove - 1] -" call Decho("delete bookmark#".iremove."<".g:netrw_bookmarklist[iremove - 1].">",'~'.expand("")) - call s:MergeBookmarks() -" call Decho("remove g:netrw_bookmarklist[".(iremove-1)."]<".g:netrw_bookmarklist[(iremove-1)].">",'~'.expand("")) - NetrwKeepj call remove(g:netrw_bookmarklist,iremove-1) - echo "removed ".dremove." from g:netrw_bookmarklist" -" call Decho("g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("")) - endif -" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("")) - - try - call s:NetrwBookHistSave() - catch - endtry - endif - call s:NetrwBookmarkMenu() - call s:NetrwTgtMenu() - let @@= ykeep -" call Dret("s:NetrwBookHistHandler") -endfun - -" --------------------------------------------------------------------- -" s:NetrwBookHistRead: this function reads bookmarks and history {{{2 -" Will source the history file (.netrwhist) only if the g:netrw_disthistmax is > 0. -" Sister function: s:NetrwBookHistSave() -fun! s:NetrwBookHistRead() -" call Dfunc("s:NetrwBookHistRead()") - if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 -" call Dret("s:NetrwBookHistRead - nothing read (suppressed due to dirhistmax=".(exists("g:netrw_dirhistmax")? g:netrw_dirhistmax : "n/a").")") - return - endif - let ykeep= @@ - - " read bookmarks - if !exists("s:netrw_initbookhist") - let home = s:NetrwHome() - let savefile= home."/.netrwbook" - if filereadable(s:NetrwFile(savefile)) -" call Decho("sourcing .netrwbook",'~'.expand("")) - exe "keepalt NetrwKeepj so ".savefile - endif - - " read history - if g:netrw_dirhistmax > 0 - let savefile= home."/.netrwhist" - if filereadable(s:NetrwFile(savefile)) -" call Decho("sourcing .netrwhist",'~'.expand("")) - exe "keepalt NetrwKeepj so ".savefile - endif - let s:netrw_initbookhist= 1 - au VimLeave * call s:NetrwBookHistSave() - endif - endif - - let @@= ykeep -" call Decho("dirhistmax=".(exists("g:netrw_dirhistmax")? g:netrw_dirhistmax : "n/a"),'~'.expand("")) -" call Decho("dirhistcnt=".(exists("g:netrw_dirhistcnt")? g:netrw_dirhistcnt : "n/a"),'~'.expand("")) -" call Dret("s:NetrwBookHistRead") -endfun - -" --------------------------------------------------------------------- -" s:NetrwBookHistSave: this function saves bookmarks and history to files {{{2 -" Sister function: s:NetrwBookHistRead() -" I used to do this via viminfo but that appears to -" be unreliable for long-term storage -" If g:netrw_dirhistmax is <= 0, no history or bookmarks -" will be saved. -" (s:NetrwBookHistHandler(3,...) used to record history) -fun! s:NetrwBookHistSave() -" call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax." dirhistcnt=".g:netrw_dirhistcnt) - if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 -" call Dret("s:NetrwBookHistSave : nothing saved (dirhistmax=".g:netrw_dirhistmax.")") - return - endif - - let savefile= s:NetrwHome()."/.netrwhist" -" call Decho("savefile<".savefile.">",'~'.expand("")) - 1split - - " setting up a new buffer which will become .netrwhist - call s:NetrwEnew() -" call Decho("case g:netrw_use_noswf=".g:netrw_use_noswf.(exists("+acd")? " +acd" : " -acd"),'~'.expand("")) - if g:netrw_use_noswf - setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf - else - setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 - endif - setl nocin noai noci magic nospell nohid wig= noaw - setl ma noro write - if exists("+acd") | setl noacd | endif - sil! NetrwKeepj keepalt %d _ - - " rename enew'd file: .netrwhist -- no attempt to merge - " record dirhistmax and current dirhistcnt - " save history -" call Decho("saving history: dirhistmax=".g:netrw_dirhistmax." dirhistcnt=".g:netrw_dirhistcnt." lastline=".line("$"),'~'.expand("")) - sil! keepalt file .netrwhist - call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax) - call setline(2,"let g:netrw_dirhistcnt =".g:netrw_dirhistcnt) - if g:netrw_dirhistmax > 0 - let lastline = line("$") - let cnt = g:netrw_dirhistcnt - let first = 1 - while ( first || cnt != g:netrw_dirhistcnt ) - let lastline= lastline + 1 - if exists("g:netrw_dirhist_{cnt}") - call setline(lastline,'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'") -" call Decho("..".lastline.'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'",'~'.expand("")) - endif - let first = 0 - let cnt = ( cnt - 1 ) % g:netrw_dirhistmax - if cnt < 0 - let cnt= cnt + g:netrw_dirhistmax - endif - endwhile - exe "sil! w! ".savefile -" call Decho("exe sil! w! ".savefile,'~'.expand("")) - endif - - " save bookmarks - sil NetrwKeepj %d _ - if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] -" call Decho("saving bookmarks",'~'.expand("")) - " merge and write .netrwbook - let savefile= s:NetrwHome()."/.netrwbook" - - if filereadable(s:NetrwFile(savefile)) - let booklist= deepcopy(g:netrw_bookmarklist) - exe "sil NetrwKeepj keepalt so ".savefile - for bdm in booklist - if index(g:netrw_bookmarklist,bdm) == -1 - call add(g:netrw_bookmarklist,bdm) - endif - endfor - call sort(g:netrw_bookmarklist) - endif - - " construct and save .netrwbook - call setline(1,"let g:netrw_bookmarklist= ".string(g:netrw_bookmarklist)) - exe "sil! w! ".savefile -" call Decho("exe sil! w! ".savefile,'~'.expand("")) - endif - - " cleanup -- remove buffer used to construct history - let bgone= bufnr("%") - q! - exe "keepalt ".bgone."bwipe!" - -" call Dret("s:NetrwBookHistSave") -endfun - -" --------------------------------------------------------------------- -" s:NetrwBrowse: This function uses the command in g:netrw_list_cmd to provide a {{{2 -" list of the contents of a local or remote directory. It is assumed that the -" g:netrw_list_cmd has a string, USEPORT HOSTNAME, that needs to be substituted -" with the requested remote hostname first. -" Often called via: Explore/e dirname/etc -> netrw#LocalBrowseCheck() -> s:NetrwBrowse() -fun! s:NetrwBrowse(islocal,dirname) - if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif -" call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) -" call Decho("fyi: modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("")) -" call Decho("fyi: tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dredir("ls!","s:NetrwBrowse") - - " save alternate-file's filename if w:netrw_rexlocal doesn't exist - " This is useful when one edits a local file, then :e ., then :Rex - if a:islocal && !exists("w:netrw_rexfile") && bufname("#") != "" - let w:netrw_rexfile= bufname("#") -" call Decho("setting w:netrw_rexfile<".w:netrw_rexfile."> win#".winnr(),'~'.expand("")) - endif - - " s:NetrwBrowse : initialize history {{{3 - if !exists("s:netrw_initbookhist") - NetrwKeepj call s:NetrwBookHistRead() - endif - - " s:NetrwBrowse : simplify the dirname (especially for ".."s in dirnames) {{{3 - if a:dirname !~ '^\a\{3,}://' - let dirname= simplify(a:dirname) -" call Decho("simplified dirname<".dirname.">") - else - let dirname= a:dirname - endif - - " repoint t:netrw_lexbufnr if appropriate - if exists("t:netrw_lexbufnr") && bufnr("%") == t:netrw_lexbufnr -" call Decho("set repointlexbufnr to true!") - let repointlexbufnr= 1 - endif - - " s:NetrwBrowse : sanity checks: {{{3 - if exists("s:netrw_skipbrowse") - unlet s:netrw_skipbrowse -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">",'~'.expand("")) -" call Dret("s:NetrwBrowse : s:netrw_skipbrowse existed") - return - endif - if !exists("*shellescape") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) -" call Dret("s:NetrwBrowse : missing shellescape()") - return - endif - if !exists("*fnameescape") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70) -" call Dret("s:NetrwBrowse : missing fnameescape()") - return - endif - - " s:NetrwBrowse : save options: {{{3 - call s:NetrwOptionsSave("w:") - - " s:NetrwBrowse : re-instate any marked files {{{3 - if has("syntax") && exists("g:syntax_on") && g:syntax_on - if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("clearing marked files",'~'.expand("")) - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" - endif - endif - - if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep - " s:NetrwBrowse : set up "safe" options for local directory/file {{{3 -" call Decho("handle w:netrw_acdkeep:",'~'.expand("")) -" call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")",'~'.expand("")) - if s:NetrwLcd(dirname) -" call Dret("s:NetrwBrowse : lcd failure") - return - endif - " call s:NetrwOptionsSafe() " tst952 failed with this enabled. -" call Decho("getcwd<".getcwd().">",'~'.expand("")) - - elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' - " s:NetrwBrowse : remote regular file handler {{{3 -" call Decho("handle remote regular file: dirname<".dirname.">",'~'.expand("")) - if bufname(dirname) != "" -" call Decho("edit buf#".bufname(dirname)." in win#".winnr(),'~'.expand("")) - exe "NetrwKeepj b ".bufname(dirname) - else - " attempt transfer of remote regular file -" call Decho("attempt transfer as regular file<".dirname.">",'~'.expand("")) - - " remove any filetype indicator from end of dirname, except for the - " "this is a directory" indicator (/). - " There shouldn't be one of those here, anyway. - let path= substitute(dirname,'[*=@|]\r\=$','','e') -" call Decho("new path<".path.">",'~'.expand("")) - call s:RemotePathAnalysis(dirname) - - " s:NetrwBrowse : remote-read the requested file into current buffer {{{3 - call s:NetrwEnew(dirname) - call s:NetrwOptionsSafe(a:islocal) - setl ma noro -" call Decho("setl ma noro",'~'.expand("")) - let b:netrw_curdir = dirname - let url = s:method."://".((s:user == "")? "" : s:user."@").s:machine.(s:port ? ":".s:port : "")."/".s:path - call s:NetrwBufRename(url) - exe "sil! NetrwKeepj keepalt doau BufReadPre ".fnameescape(s:fname) - sil call netrw#NetRead(2,url) - " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error -" call Decho("url<".url.">",'~'.expand("")) -" call Decho("s:path<".s:path.">",'~'.expand("")) -" call Decho("s:fname<".s:fname.">",'~'.expand("")) - if s:path =~ '.bz2' - exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','','')) - elseif s:path =~ '.gz' - exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.gz$','','')) - elseif s:path =~ '.gz' - exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.txz$','','')) - else - exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(s:fname) - endif - endif - - " s:NetrwBrowse : save certain window-oriented variables into buffer-oriented variables {{{3 - call s:SetBufWinVars() - call s:NetrwOptionsRestore("w:") -" call Decho("setl ma nomod",'~'.expand("")) - setl ma nomod noro -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - -" call Dret("s:NetrwBrowse : file<".s:fname.">") - return - endif - - " use buffer-oriented WinVars if buffer variables exist but associated window variables don't {{{3 - call s:UseBufWinVars() - - " set up some variables {{{3 - let b:netrw_browser_active = 1 - let dirname = dirname - let s:last_sort_by = g:netrw_sort_by - - " set up menu {{{3 - NetrwKeepj call s:NetrwMenu(1) - - " get/set-up buffer {{{3 -" call Decho("saving position across a buffer refresh",'~'.expand("")) - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let reusing= s:NetrwGetBuffer(a:islocal,dirname) - - " maintain markfile highlighting - if has("syntax") && exists("g:syntax_on") && g:syntax_on - if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" " call Decho("bufnr(%)=".bufnr('%'),'~'.expand("")) -" " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("")) - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" - else -" " call Decho("2match none",'~'.expand("")) - 2match none - endif - endif - if reusing && line("$") > 1 - call s:NetrwOptionsRestore("w:") -" call Decho("setl noma nomod nowrap",'~'.expand("")) - setl noma nomod nowrap -" call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("s:NetrwBrowse : re-using not-cleared buffer") - return - endif - - " set b:netrw_curdir to the new directory name {{{3 -" call Decho("set b:netrw_curdir to the new directory name<".dirname."> (buf#".bufnr("%").")",'~'.expand("")) - let b:netrw_curdir= dirname - if b:netrw_curdir =~ '[/\\]$' - let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') - endif - if b:netrw_curdir =~ '\a:$' && (has("win32") || has("win95") || has("win64") || has("win16")) - let b:netrw_curdir= b:netrw_curdir."/" - endif - if b:netrw_curdir == '' - if has("amiga") - " On the Amiga, the empty string connotes the current directory - let b:netrw_curdir= getcwd() - else - " under unix, when the root directory is encountered, the result - " from the preceding substitute is an empty string. - let b:netrw_curdir= '/' - endif - endif - if !a:islocal && b:netrw_curdir !~ '/$' - let b:netrw_curdir= b:netrw_curdir.'/' - endif -" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) - - " ------------ - " (local only) {{{3 - " ------------ - if a:islocal -" call Decho("local only:",'~'.expand("")) - - " Set up ShellCmdPost handling. Append current buffer to browselist - call s:LocalFastBrowser() - - " handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3 - if !g:netrw_keepdir -" call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) -" call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"),'~'.expand("")) - if !exists("&l:acd") || !&l:acd - if s:NetrwLcd(b:netrw_curdir) -" call Dret("s:NetrwBrowse : lcd failure") - return - endif - endif - endif - - " -------------------------------- - " remote handling: {{{3 - " -------------------------------- - else -" call Decho("remote only:",'~'.expand("")) - - " analyze dirname and g:netrw_list_cmd {{{3 -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">",'~'.expand("")) - if dirname =~# "^NetrwTreeListing\>" - let dirname= b:netrw_curdir -" call Decho("(dirname was ) dirname<".dirname.">",'~'.expand("")) - elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") - let dirname= substitute(b:netrw_curdir,'\\','/','g') - if dirname !~ '/$' - let dirname= dirname.'/' - endif - let b:netrw_curdir = dirname -" call Decho("(liststyle is TREELIST) dirname<".dirname.">",'~'.expand("")) - else - let dirname = substitute(dirname,'\\','/','g') -" call Decho("(normal) dirname<".dirname.">",'~'.expand("")) - endif - - let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' - if dirname !~ dirpat - if !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) - endif - NetrwKeepj call s:NetrwOptionsRestore("w:") -" call Decho("setl noma nomod nowrap",'~'.expand("")) - setl noma nomod nowrap -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">") - return - endif - let b:netrw_curdir= dirname -" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)",'~'.expand("")) - endif " (additional remote handling) - - " ------------------------------- - " Perform Directory Listing: {{{3 - " ------------------------------- - NetrwKeepj call s:NetrwMaps(a:islocal) - NetrwKeepj call s:NetrwCommands(a:islocal) - NetrwKeepj call s:PerformListing(a:islocal) - - " restore option(s) - call s:NetrwOptionsRestore("w:") -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) - - " If there is a rexposn: restore position with rexposn - " Otherwise : set rexposn - if exists("s:rexposn_".bufnr("%")) -" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("")) - NetrwKeepj call winrestview(s:rexposn_{bufnr('%')}) - if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt - NetrwKeepj exe w:netrw_bannercnt - endif - else - NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir) - endif - if v:version >= 700 && has("balloon_eval") && &beval == 0 && &l:bexpr == "" && !exists("g:netrw_nobeval") - let &l:bexpr= "netrw#BalloonHelp()" -" call Decho("set up balloon help: l:bexpr=".&l:bexpr,'~'.expand("")) - setl beval - endif - - " repoint t:netrw_lexbufnr if appropriate - if exists("repointlexbufnr") - let t:netrw_lexbufnr= bufnr("%") -" call Decho("repoint t:netrw_lexbufnr to #".t:netrw_lexbufnr) - endif - - " restore position - if reusing -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - call winrestview(svpos) - endif - - " The s:LocalBrowseRefresh() function is called by an autocmd - " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow or medium speed). - " However, s:NetrwBrowse() causes the FocusGained event to fire the first time. -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("s:NetrwBrowse : did PerformListing ft<".&ft.">") - return -endfun - -" --------------------------------------------------------------------- -" s:NetrwFile: because of g:netrw_keepdir, isdirectory(), type(), etc may or {{{2 -" may not apply correctly; ie. netrw's idea of the current directory may -" differ from vim's. This function insures that netrw's idea of the current -" directory is used. -" Returns a path to the file specified by a:fname -fun! s:NetrwFile(fname) -" "" call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr()) -" "" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("")) -" "" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a'),'~'.expand("")) -" "" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a'),'~'.expand("")) -" "" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("")) - - " clean up any leading treedepthstring - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - let fname= substitute(a:fname,'^'.s:treedepthstring.'\+','','') -" "" call Decho("clean up any leading treedepthstring: fname<".fname.">",'~'.expand("")) - else - let fname= a:fname - endif - - if g:netrw_keepdir - " vim's idea of the current directory possibly may differ from netrw's - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() - endif - - if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) - if fname =~ '^\' || fname =~ '^\a:\' - " windows, but full path given - let ret= fname -" "" call Decho("windows+full path: isdirectory(".fname.")",'~'.expand("")) - else - " windows, relative path given - let ret= s:ComposePath(b:netrw_curdir,fname) -" "" call Decho("windows+rltv path: isdirectory(".fname.")",'~'.expand("")) - endif - - elseif fname =~ '^/' - " not windows, full path given - let ret= fname -" "" call Decho("unix+full path: isdirectory(".fname.")",'~'.expand("")) - else - " not windows, relative path given - let ret= s:ComposePath(b:netrw_curdir,fname) -" "" call Decho("unix+rltv path: isdirectory(".fname.")",'~'.expand("")) - endif - else - " vim and netrw agree on the current directory - let ret= fname -" "" call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("")) -" "" call Decho("vim directory: ".getcwd(),'~'.expand("")) -" "" call Decho("netrw directory: ".(exists("b:netrw_curdir")? b:netrw_curdir : 'n/a'),'~'.expand("")) - endif - -" "" call Dret("s:NetrwFile ".ret) - return ret -endfun - -" --------------------------------------------------------------------- -" s:NetrwFileInfo: supports qf (query for file information) {{{2 -fun! s:NetrwFileInfo(islocal,fname) -" call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">) b:netrw_curdir<".b:netrw_curdir.">") - let ykeep= @@ - if a:islocal - let lsopt= "-lsad" - if g:netrw_sizestyle =~# 'H' - let lsopt= "-lsadh" - elseif g:netrw_sizestyle =~# 'h' - let lsopt= "-lsadh --si" - endif -" call Decho("(s:NetrwFileInfo) lsopt<".lsopt.">") - if (has("unix") || has("macunix")) && executable("/bin/ls") - - if getline(".") == "../" - echo system("/bin/ls ".lsopt." ".s:ShellEscape("..")) -" call Decho("#1: echo system(/bin/ls -lsad ".s:ShellEscape(..).")",'~'.expand("")) - - elseif w:netrw_liststyle == s:TREELIST && getline(".") !~ '^'.s:treedepthstring - echo system("/bin/ls ".lsopt." ".s:ShellEscape(b:netrw_curdir)) -" call Decho("#2: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir).")",'~'.expand("")) - - elseif exists("b:netrw_curdir") - echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname))) -" call Decho("#3: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir.a:fname).")",'~'.expand("")) - - else -" call Decho('using ls '.a:fname." using cwd<".getcwd().">",'~'.expand("")) - echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:NetrwFile(a:fname))) -" call Decho("#5: echo system(/bin/ls -lsad ".s:ShellEscape(a:fname).")",'~'.expand("")) - endif - else - " use vim functions to return information about file below cursor -" call Decho("using vim functions to query for file info",'~'.expand("")) - if !isdirectory(s:NetrwFile(a:fname)) && !filereadable(s:NetrwFile(a:fname)) && a:fname =~ '[*@/]' - let fname= substitute(a:fname,".$","","") - else - let fname= a:fname - endif - let t = getftime(s:NetrwFile(fname)) - let sz = getfsize(s:NetrwFile(fname)) - if g:netrw_sizestyle =~# "[hH]" - let sz= s:NetrwHumanReadable(sz) - endif - echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname))) -" call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)),'~'.expand("")) - endif - else - echo "sorry, \"qf\" not supported yet for remote files" - endif - let @@= ykeep -" call Dret("s:NetrwFileInfo") -endfun - -" --------------------------------------------------------------------- -" s:NetrwFullPath: returns the full path to a directory and/or file {{{2 -fun! s:NetrwFullPath(filename) -" " call Dfunc("s:NetrwFullPath(filename<".a:filename.">)") - let filename= a:filename - if filename !~ '^/' - let filename= resolve(getcwd().'/'.filename) - endif - if filename != "/" && filename =~ '/$' - let filename= substitute(filename,'/$','','') - endif -" " call Dret("s:NetrwFullPath <".filename.">") - return filename -endfun - -" --------------------------------------------------------------------- -" s:NetrwGetBuffer: [get a new|find an old netrw] buffer for a netrw listing {{{2 -" returns 0=cleared buffer -" 1=re-used buffer (buffer not cleared) -" Nov 09, 2020: tst952 shows that when user does :set hidden that NetrwGetBuffer will come up with a [No Name] buffer (hid fix) -fun! s:NetrwGetBuffer(islocal,dirname) -" call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." hid=".&hid,'~'.expand("")) -" call Decho("netrwbuf dictionary=".(exists("s:netrwbuf")? string(s:netrwbuf) : 'n/a'),'~'.expand("")) -" call Dredir("ls!","s:NetrwGetBuffer") - let dirname= a:dirname - - " re-use buffer if possible {{{3 -" call Decho("--re-use a buffer if possible--",'~'.expand("")) - if !exists("s:netrwbuf") -" call Decho(" s:netrwbuf initialized to {}",'~'.expand("")) - let s:netrwbuf= {} - endif -" call Decho(" s:netrwbuf =".string(s:netrwbuf),'~'.expand("")) -" call Decho(" w:netrw_liststyle =".(exists("w:netrw_liststyle")? w:netrw_liststyle : "n/a"),'~'.expand("")) - - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - let bufnum = -1 - - if !empty(s:netrwbuf) && has_key(s:netrwbuf,s:NetrwFullPath(dirname)) - if has_key(s:netrwbuf,"NetrwTreeListing") - let bufnum= s:netrwbuf["NetrwTreeListing"] - else - let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)] - endif -" call Decho(" NetrwTreeListing: bufnum#".bufnum,'~'.expand("")) - if !bufexists(bufnum) - call remove(s:netrwbuf,"NetrwTreeListing"]) - let bufnum= -1 - endif - elseif bufnr("NetrwTreeListing") != -1 - let bufnum= bufnr("NetrwTreeListing") -" call Decho(" NetrwTreeListing".": bufnum#".bufnum,'~'.expand("")) - else -" call Decho(" did not find a NetrwTreeListing buffer",'~'.expand("")) - let bufnum= -1 - endif - - elseif has_key(s:netrwbuf,s:NetrwFullPath(dirname)) - let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)] -" call Decho(" lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnum,'~'.expand("")) - if !bufexists(bufnum) - call remove(s:netrwbuf,s:NetrwFullPath(dirname)) - let bufnum= -1 - endif - - else -" call Decho(" lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."] not a key",'~'.expand("")) - let bufnum= -1 - endif -" call Decho(" bufnum#".bufnum,'~'.expand("")) - - " highjack the current buffer - " IF the buffer already has the desired name - " AND it is empty - let curbuf = bufname("%") - if curbuf == '.' - let curbuf = getcwd() - endif -" call Dredir("ls!","NetrwGetFile (renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">)") -" call Decho("deciding if netrw may highjack the current buffer#".bufnr("%")."<".curbuf.">",'~'.expand("")) -" call Decho("..dirname<".dirname."> IF dirname == bufname",'~'.expand("")) -" call Decho("..curbuf<".curbuf.">",'~'.expand("")) -" call Decho("..line($)=".line("$")." AND this is 1",'~'.expand("")) -" call Decho("..getline(%)<".getline("%")."> AND this line is empty",'~'.expand("")) - if dirname == curbuf && line("$") == 1 && getline("%") == "" -" call Dret("s:NetrwGetBuffer 0 : highjacking buffer#".bufnr("%")) - return 0 - else " DEBUG -" call Decho("..did NOT highjack buffer",'~'.expand("")) - endif - " Aug 14, 2021: was thinking about looking for a [No Name] buffer here and using it, but that might cause problems - - " get enew buffer and name it -or- re-use buffer {{{3 - if bufnum < 0 " get enew buffer and name it -" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)",'~'.expand("")) - call s:NetrwEnew(dirname) -" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)",'~'.expand("")) - " name the buffer - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - " Got enew buffer; transform into a NetrwTreeListing -" call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --",'~'.expand("")) - let w:netrw_treebufnr = bufnr("%") - call s:NetrwBufRename("NetrwTreeListing") - if g:netrw_use_noswf - setl nobl bt=nofile noswf - else - setl nobl bt=nofile - endif - nnoremap [[ :sil call TreeListMove('[[') - nnoremap ]] :sil call TreeListMove(']]') - nnoremap [] :sil call TreeListMove('[]') - nnoremap ][ :sil call TreeListMove('][') -" call Decho(" tree listing bufnr=".w:netrw_treebufnr,'~'.expand("")) - else - call s:NetrwBufRename(dirname) - " enter the new buffer into the s:netrwbuf dictionary - let s:netrwbuf[s:NetrwFullPath(dirname)]= bufnr("%") -" call Decho("update netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnr("%"),'~'.expand("")) -" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("")) - endif -" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">",'~'.expand("")) - - else " Re-use the buffer -" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)",'~'.expand("")) - " ignore all events - let eikeep= &ei - setl ei=all - - if &ft == "netrw" -" call Decho("buffer type is netrw; not using keepalt with b ".bufnum) - exe "sil! NetrwKeepj noswapfile b ".bufnum -" call Dredir("ls!","one") - else -" call Decho("buffer type is not netrw; using keepalt with b ".bufnum) - call s:NetrwEditBuf(bufnum) -" call Dredir("ls!","two") - endif -" call Decho(" line($)=".line("$"),'~'.expand("")) - if bufname("%") == '.' - call s:NetrwBufRename(getcwd()) - endif - - " restore ei - let &ei= eikeep - - if line("$") <= 1 && getline(1) == "" - " empty buffer - NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it") - return 0 - - elseif g:netrw_fastbrowse == 0 || (a:islocal && g:netrw_fastbrowse == 1) -" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse." a:islocal=".a:islocal.": clear buffer",'~'.expand("")) - NetrwKeepj call s:NetrwListSettings(a:islocal) - sil NetrwKeepj %d _ -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but refreshing due to g:netrw_fastbrowse=".g:netrw_fastbrowse) - return 0 - - elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Decho("--re-use tree listing--",'~'.expand("")) -" call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("")) - setl ma - sil NetrwKeepj %d _ - NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") - return 0 - - else -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dret("s:NetrwGetBuffer 1") - return 1 - endif - endif - - " do netrw settings: make this buffer not-a-file, modifiable, not line-numbered, etc {{{3 - " fastbrowse Local Remote Hiding a buffer implies it may be re-used (fast) - " slow 0 D D Deleting a buffer implies it will not be re-used (slow) - " med 1 D H - " fast 2 H H -" call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--",'~'.expand("")) - let fname= expand("%") - NetrwKeepj call s:NetrwListSettings(a:islocal) - call s:NetrwBufRename(fname) - - " delete all lines from buffer {{{3 -" call Decho("--delete all lines from buffer--",'~'.expand("")) -" call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("")) - sil! keepalt NetrwKeepj %d _ - -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dret("s:NetrwGetBuffer 0") - return 0 -endfun - -" --------------------------------------------------------------------- -" s:NetrwGetcwd: get the current directory. {{{2 -" Change backslashes to forward slashes, if any. -" If doesc is true, escape certain troublesome characters -fun! s:NetrwGetcwd(doesc) -" call Dfunc("NetrwGetcwd(doesc=".a:doesc.")") - let curdir= substitute(getcwd(),'\\','/','ge') - if curdir !~ '[\/]$' - let curdir= curdir.'/' - endif - if a:doesc - let curdir= fnameescape(curdir) - endif -" call Dret("NetrwGetcwd <".curdir.">") - return curdir -endfun - -" --------------------------------------------------------------------- -" s:NetrwGetWord: it gets the directory/file named under the cursor {{{2 -fun! s:NetrwGetWord() -" call Dfunc("s:NetrwGetWord() liststyle=".s:ShowStyle()." virtcol=".virtcol(".")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) - let keepsol= &l:sol - setl nosol - - call s:UseBufWinVars() - - " insure that w:netrw_liststyle is set up - if !exists("w:netrw_liststyle") - if exists("g:netrw_liststyle") - let w:netrw_liststyle= g:netrw_liststyle - else - let w:netrw_liststyle= s:THINLIST - endif -" call Decho("w:netrw_liststyle=".w:netrw_liststyle,'~'.expand("")) - endif - - if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt - " Active Banner support -" call Decho("active banner handling",'~'.expand("")) - NetrwKeepj norm! 0 - let dirname= "./" - let curline= getline('.') - - if curline =~# '"\s*Sorted by\s' - NetrwKeepj norm! "_s - let s:netrw_skipbrowse= 1 - echo 'Pressing "s" also works' - - elseif curline =~# '"\s*Sort sequence:' - let s:netrw_skipbrowse= 1 - echo 'Press "S" to edit sorting sequence' - - elseif curline =~# '"\s*Quick Help:' - NetrwKeepj norm! ? - let s:netrw_skipbrowse= 1 - - elseif curline =~# '"\s*\%(Hiding\|Showing\):' - NetrwKeepj norm! a - let s:netrw_skipbrowse= 1 - echo 'Pressing "a" also works' - - elseif line("$") > w:netrw_bannercnt - exe 'sil NetrwKeepj '.w:netrw_bannercnt - endif - - elseif w:netrw_liststyle == s:THINLIST -" call Decho("thin column handling",'~'.expand("")) - NetrwKeepj norm! 0 - let dirname= substitute(getline('.'),'\t -->.*$','','') - - elseif w:netrw_liststyle == s:LONGLIST -" call Decho("long column handling",'~'.expand("")) - NetrwKeepj norm! 0 - let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') - - elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Decho("treelist handling",'~'.expand("")) - let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') - let dirname= substitute(dirname,'\t -->.*$','','') - - else -" call Decho("obtain word from wide listing",'~'.expand("")) - let dirname= getline('.') - - if !exists("b:netrw_cpf") - let b:netrw_cpf= 0 - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' - call histdel("/",-1) -" "call Decho("computed cpf=".b:netrw_cpf,'~'.expand("")) - endif - -" call Decho("buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) - let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf -" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt,'~'.expand("")) -" call Decho("1: dirname<".dirname.">",'~'.expand("")) - if filestart == 0 - NetrwKeepj norm! 0ma - else - call cursor(line("."),filestart+1) - NetrwKeepj norm! ma - endif - let rega= @a - let eofname= filestart + b:netrw_cpf + 1 - if eofname <= col("$") - call cursor(line("."),filestart+b:netrw_cpf+1) - NetrwKeepj norm! "ay`a - else - NetrwKeepj norm! "ay$ - endif - let dirname = @a - let @a = rega -" call Decho("2: dirname<".dirname.">",'~'.expand("")) - let dirname= substitute(dirname,'\s\+$','','e') -" call Decho("3: dirname<".dirname.">",'~'.expand("")) - endif - - " symlinks are indicated by a trailing "@". Remove it before further processing. - let dirname= substitute(dirname,"@$","","") - - " executables are indicated by a trailing "*". Remove it before further processing. - let dirname= substitute(dirname,"\*$","","") - - let &l:sol= keepsol - -" call Dret("s:NetrwGetWord <".dirname.">") - return dirname -endfun - -" --------------------------------------------------------------------- -" s:NetrwListSettings: make standard settings for making a netrw listing {{{2 -" g:netrw_bufsettings will be used after the listing is produced. -" Called by s:NetrwGetBuffer() -fun! s:NetrwListSettings(islocal) -" call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) - let fname= bufname("%") -" " call Decho("setl bt=nofile nobl ma nonu nowrap noro nornu",'~'.expand("")) - " nobl noma nomod nonu noma nowrap ro nornu (std g:netrw_bufsettings) - setl bt=nofile nobl ma nonu nowrap noro nornu - call s:NetrwBufRename(fname) - if g:netrw_use_noswf - setl noswf - endif -" call Dredir("ls!","s:NetrwListSettings") -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("")) - exe "setl ts=".(g:netrw_maxfilenamelen+1) - setl isk+=.,~,- - if g:netrw_fastbrowse > a:islocal - setl bh=hide - else - setl bh=delete - endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Dret("s:NetrwListSettings") -endfun - -" --------------------------------------------------------------------- -" s:NetrwListStyle: change list style (thin - long - wide - tree) {{{2 -" islocal=0: remote browsing -" =1: local browsing -fun! s:NetrwListStyle(islocal) -" call Dfunc("NetrwListStyle(islocal=".a:islocal.") w:netrw_liststyle=".w:netrw_liststyle) - - let ykeep = @@ - let fname = s:NetrwGetWord() - if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST -" call Decho("fname<".fname.">",'~'.expand("")) -" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("")) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("")) - - " repoint t:netrw_lexbufnr if appropriate - if exists("t:netrw_lexbufnr") && bufnr("%") == t:netrw_lexbufnr -" call Decho("set repointlexbufnr to true!") - let repointlexbufnr= 1 - endif - - if w:netrw_liststyle == s:THINLIST - " use one column listing -" call Decho("use one column list",'~'.expand("")) - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - - elseif w:netrw_liststyle == s:LONGLIST - " use long list -" call Decho("use long list",'~'.expand("")) - let g:netrw_list_cmd = g:netrw_list_cmd." -l" - - elseif w:netrw_liststyle == s:WIDELIST - " give wide list -" call Decho("use wide list",'~'.expand("")) - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - - elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Decho("use tree list",'~'.expand("")) - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - - else - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46) - let g:netrw_liststyle = s:THINLIST - let w:netrw_liststyle = g:netrw_liststyle - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - endif - setl ma noro -" call Decho("setl ma noro",'~'.expand("")) - - " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh -" call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("")) - sil! NetrwKeepj %d _ - " following prevents tree listing buffer from being marked "modified" -" call Decho("setl nomod",'~'.expand("")) - setl nomod -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - - " refresh the listing -" call Decho("refresh the listing",'~'.expand("")) - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call s:NetrwCursor(0) - - " repoint t:netrw_lexbufnr if appropriate - if exists("repointlexbufnr") - let t:netrw_lexbufnr= bufnr("%") -" call Decho("repoint t:netrw_lexbufnr to #".t:netrw_lexbufnr) - endif - - " restore position; keep cursor on the filename -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - let @@= ykeep - -" call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) -endfun - -" --------------------------------------------------------------------- -" s:NetrwBannerCtrl: toggles the display of the banner {{{2 -fun! s:NetrwBannerCtrl(islocal) -" call Dfunc("s:NetrwBannerCtrl(islocal=".a:islocal.") g:netrw_banner=".g:netrw_banner) - - let ykeep= @@ - " toggle the banner (enable/suppress) - let g:netrw_banner= !g:netrw_banner - - " refresh the listing - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - - " keep cursor on the filename - if g:netrw_banner && exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt - let fname= s:NetrwGetWord() - sil NetrwKeepj $ - let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') -" " call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'),'~'.expand("")) - if result <= 0 && exists("w:netrw_bannercnt") - exe "NetrwKeepj ".w:netrw_bannercnt - endif - endif - let @@= ykeep -" call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner) -endfun - -" --------------------------------------------------------------------- -" s:NetrwBookmark: supports :NetrwMB[!] [file]s {{{2 -" -" No bang: enters files/directories into Netrw's bookmark system -" No argument and in netrw buffer: -" if there are marked files: bookmark marked files -" otherwise : bookmark file/directory under cursor -" No argument and not in netrw buffer: bookmarks current open file -" Has arguments: globs them individually and bookmarks them -" -" With bang: deletes files/directories from Netrw's bookmark system -fun! s:NetrwBookmark(del,...) -" call Dfunc("s:NetrwBookmark(del=".a:del.",...) a:0=".a:0) - if a:0 == 0 - if &ft == "netrw" - let curbufnr = bufnr("%") - - if exists("s:netrwmarkfilelist_{curbufnr}") - " for every filename in the marked list -" call Decho("bookmark every filename in marked list",'~'.expand("")) - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let islocal= expand("%") !~ '^\a\{3,}://' - for fname in s:netrwmarkfilelist_{curbufnr} - if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif - endfor - let curdir = exists("b:netrw_curdir")? b:netrw_curdir : getcwd() - call s:NetrwUnmarkList(curbufnr,curdir) - NetrwKeepj call s:NetrwRefresh(islocal,s:NetrwBrowseChgDir(islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - else - let fname= s:NetrwGetWord() - if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif - endif - - else - " bookmark currently open file -" call Decho("bookmark currently open file",'~'.expand("")) - let fname= expand("%") - if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif - endif - - else - " bookmark specified files - " attempts to infer if working remote or local - " by deciding if the current file begins with an url - " Globbing cannot be done remotely. - let islocal= expand("%") !~ '^\a\{3,}://' -" call Decho("bookmark specified file".((a:0>1)? "s" : ""),'~'.expand("")) - let i = 1 - while i <= a:0 - if islocal - if v:version > 704 || (v:version == 704 && has("patch656")) - let mbfiles= glob(fnameescape(a:{i}),0,1,1) - else - let mbfiles= glob(fnameescape(a:{i}),0,1) - endif - else - let mbfiles= [a:{i}] - endif -" call Decho("mbfiles".string(mbfiles),'~'.expand("")) - for mbfile in mbfiles -" call Decho("mbfile<".mbfile.">",'~'.expand("")) - if a:del|call s:DeleteBookmark(mbfile)|else|call s:MakeBookmark(mbfile)|endif - endfor - let i= i + 1 - endwhile - endif - - " update the menu - call s:NetrwBookmarkMenu() - -" call Dret("s:NetrwBookmark") -endfun - -" --------------------------------------------------------------------- -" s:NetrwBookmarkMenu: Uses menu priorities {{{2 -" .2.[cnt] for bookmarks, and -" .3.[cnt] for history -" (see s:NetrwMenu()) -fun! s:NetrwBookmarkMenu() - if !exists("s:netrw_menucnt") - return - endif -" call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhistcnt." menucnt=".s:netrw_menucnt) - - " the following test assures that gvim is running, has menus available, and has menus enabled. - if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu - if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("")) - exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks' - exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete' - endif - if !exists("s:netrw_initbookhist") - call s:NetrwBookHistRead() - endif - - " show bookmarked places - if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 - let cnt= 1 - for bmd in g:netrw_bookmarklist -" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd,'~'.expand("")) - let bmd= escape(bmd,g:netrw_menu_escape) - - " show bookmarks for goto menu - exe 'sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmd.' :e '.bmd."\" - - " show bookmarks for deletion menu - exe 'sil! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.bmd.' '.cnt."mB" - let cnt= cnt + 1 - endfor - - endif - - " show directory browsing history - if g:netrw_dirhistmax > 0 - let cnt = g:netrw_dirhistcnt - let first = 1 - let histcnt = 0 - while ( first || cnt != g:netrw_dirhistcnt ) - let histcnt = histcnt + 1 - let priority = g:netrw_dirhistcnt + histcnt - if exists("g:netrw_dirhist_{cnt}") - let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape) -" call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir,'~'.expand("")) - exe 'sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\" - endif - let first = 0 - let cnt = ( cnt - 1 ) % g:netrw_dirhistmax - if cnt < 0 - let cnt= cnt + g:netrw_dirhistmax - endif - endwhile - endif - - endif -" call Dret("NetrwBookmarkMenu") -endfun - -" --------------------------------------------------------------------- -" s:NetrwBrowseChgDir: constructs a new directory based on the current {{{2 -" directory and a new directory name. Also, if the -" "new directory name" is actually a file, -" NetrwBrowseChgDir() edits the file. -fun! s:NetrwBrowseChgDir(islocal,newdir,...) -" call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." win#".winnr()." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">") -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) - - let ykeep= @@ - if !exists("b:netrw_curdir") - " Don't try to change-directory: this can happen, for example, when netrw#ErrorMsg has been called - " and the current window is the NetrwMessage window. - let @@= ykeep -" call Decho("b:netrw_curdir doesn't exist!",'~'.expand("")) -" call Decho("getcwd<".getcwd().">",'~'.expand("")) -" call Dredir("ls!","s:NetrwBrowseChgDir") -" call Dret("s:NetrwBrowseChgDir") - return - endif -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") - - " NetrwBrowseChgDir; save options and initialize {{{3 -" call Decho("saving options",'~'.expand("")) - call s:SavePosn(s:netrw_posn) - NetrwKeepj call s:NetrwOptionsSave("s:") - NetrwKeepj call s:NetrwOptionsSafe(a:islocal) - if (has("win32") || has("win95") || has("win64") || has("win16")) - let dirname = substitute(b:netrw_curdir,'\\','/','ge') - else - let dirname = b:netrw_curdir - endif - let newdir = a:newdir - let dolockout = 0 - let dorestore = 1 -" call Decho("win#".winnr(),'~'.expand("")) -" call Decho("dirname<".dirname.">",'~'.expand("")) -" call Decho("newdir<".newdir.">",'~'.expand("")) - - " ignore s when done in the banner -" call Decho('(s:NetrwBrowseChgDir) ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("")) - if g:netrw_banner -" call Decho("win#".winnr()." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("")) - if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt - if getline(".") =~# 'Quick Help' -" call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - let g:netrw_quickhelp= (g:netrw_quickhelp + 1)%len(s:QuickHelp) -" call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - setl ma noro nowrap - NetrwKeepj call setline(line('.'),'" Quick Help: :help '.s:QuickHelp[g:netrw_quickhelp]) - setl noma nomod nowrap - NetrwKeepj call s:NetrwOptionsRestore("s:") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - endif - endif -" else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner." (no banner)",'~'.expand("")) - endif - - " set up o/s-dependent directory recognition pattern - if has("amiga") - let dirpat= '[\/:]$' - else - let dirpat= '[\/]$' - endif -" call Decho("set up o/s-dependent directory recognition pattern: dirname<".dirname."> dirpat<".dirpat.">",'~'.expand("")) - - if dirname !~ dirpat - " apparently vim is "recognizing" that it is in a directory and - " is removing the trailing "/". Bad idea, so let's put it back. - let dirname= dirname.'/' -" call Decho("adjusting dirname<".dirname.'> (put trailing "/" back)','~'.expand("")) - endif - -" call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("")) - if newdir !~ dirpat && !(a:islocal && isdirectory(s:NetrwFile(s:ComposePath(dirname,newdir)))) - " ------------------------------ - " NetrwBrowseChgDir: edit a file {{{3 - " ------------------------------ -" call Decho('edit-a-file: case "handling a file": win#'.winnr().' newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("")) - - " save position for benefit of Rexplore - let s:rexposn_{bufnr("%")}= winsaveview() -" call Decho("edit-a-file: saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("")) -" call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("")) -" call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">",'~'.expand("")) - - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' -" call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">",'~'.expand("")) -" call Decho("edit-a-file: newdir<".newdir.">",'~'.expand("")) -" let newdir = s:NetrwTreePath(s:netrw_treetop) -" call Decho("edit-a-file: COMBAK why doesn't this recognize file1's directory???") - let dirname= s:NetrwTreeDir(a:islocal) - "COMBAK : not working for a symlink -- but what about a regular file? a directory? -" call Decho("COMBAK : not working for a symlink -- but what about a regular file? a directory?") - " Feb 17, 2019: following if-else-endif restored -- wasn't editing a file in tree mode - if dirname =~ '/$' - let dirname= dirname.newdir - else - let dirname= dirname."/".newdir - endif -" call Decho("edit-a-file: dirname<".dirname.">",'~'.expand("")) -" call Decho("edit-a-file: tree listing",'~'.expand("")) - elseif newdir =~ '^\(/\|\a:\)' -" call Decho("edit-a-file: handle an url or path starting with /: <".newdir.">",'~'.expand("")) - let dirname= newdir - else - let dirname= s:ComposePath(dirname,newdir) - endif -" call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")",'~'.expand("")) - " this lets netrw#BrowseX avoid the edit - if a:0 < 1 -" call Decho("edit-a-file: (a:0=".a:0."<1) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("")) - NetrwKeepj call s:NetrwOptionsRestore("s:") - let curdir= b:netrw_curdir - if !exists("s:didsplit") -" " call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr()." g:netrw_chgwin=".g:netrw_chgwin",'~'.expand("")) - if type(g:netrw_browse_split) == 3 - " open file in server - " Note that g:netrw_browse_split is a List: [servername,tabnr,winnr] -" call Decho("edit-a-file: open file in server",'~'.expand("")) - call s:NetrwServerEdit(a:islocal,dirname) -" call Dret("s:NetrwBrowseChgDir") - return - - elseif g:netrw_browse_split == 1 - " horizontally splitting the window first -" call Decho("edit-a-file: horizontally splitting window prior to edit",'~'.expand("")) - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize - exe "keepalt ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s" - if !&ea - keepalt wincmd _ - endif - call s:SetRexDir(a:islocal,curdir) - - elseif g:netrw_browse_split == 2 - " vertically splitting the window first -" call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("")) - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize - exe "keepalt ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s" - if !&ea - keepalt wincmd | - endif - call s:SetRexDir(a:islocal,curdir) - - elseif g:netrw_browse_split == 3 - " open file in new tab -" call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("")) - keepalt tabnew - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() - endif - call s:SetRexDir(a:islocal,curdir) - - elseif g:netrw_browse_split == 4 - " act like "P" (ie. open previous window) -" call Decho("edit-a-file: use previous window for edit",'~'.expand("")) - if s:NetrwPrevWinOpen(2) == 3 - let @@= ykeep -" call Dret("s:NetrwBrowseChgDir") - return - endif - call s:SetRexDir(a:islocal,curdir) - - else - " handling a file, didn't split, so remove menu -" call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("")) - call s:NetrwMenu(0) - " optional change to window - if g:netrw_chgwin >= 1 -" call Decho("edit-a-file: changing window to #".g:netrw_chgwin.": (due to g:netrw_chgwin)",'~'.expand("")) - if winnr("$")+1 == g:netrw_chgwin - " if g:netrw_chgwin is set to one more than the last window, then - " vertically split the last window to make that window available. - let curwin= winnr() - exe "NetrwKeepj keepalt ".winnr("$")."wincmd w" - vs - exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin - endif - exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" - endif - call s:SetRexDir(a:islocal,curdir) - endif - - endif - - " the point where netrw actually edits the (local) file - " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will - " use keepalt to support :e # to return to a directory listing - if !&mod - " if e the new file would fail due to &mod, then don't change any of the flags - let dolockout= 1 - endif - if a:islocal -" call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname),'~'.expand("")) - " some like c-^ to return to the last edited file - " others like c-^ to return to the netrw buffer - " Apr 30, 2020: used to have e! here. That can cause loss of a modified file, - " so emit error E37 instead. - call s:NetrwEditFile("e","",dirname) -" call Decho("edit-a-file: after e ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod,'~'.expand("")) - " COMBAK -- cuc cul related - call s:NetrwCursor(1) - if &hidden || &bufhidden == "hide" - " file came from vim's hidden storage. Don't "restore" options with it. - let dorestore= 0 - endif - else -" call Decho("edit-a-file: remote file: NetrwBrowse will edit it",'~'.expand("")) - endif - - " handle g:Netrw_funcref -- call external-to-netrw functions - " This code will handle g:Netrw_funcref as an individual function reference - " or as a list of function references. It will ignore anything that's not - " a function reference. See :help Funcref for information about function references. - if exists("g:Netrw_funcref") -" call Decho("edit-a-file: handle optional Funcrefs",'~'.expand("")) - if type(g:Netrw_funcref) == 2 -" call Decho("edit-a-file: handling a g:Netrw_funcref",'~'.expand("")) - NetrwKeepj call g:Netrw_funcref() - elseif type(g:Netrw_funcref) == 3 -" call Decho("edit-a-file: handling a list of g:Netrw_funcrefs",'~'.expand("")) - for Fncref in g:Netrw_funcref - if type(Fncref) == 2 - NetrwKeepj call Fncref() - endif - endfor - endif - endif - endif - - elseif newdir =~ '^/' - " ---------------------------------------------------- - " NetrwBrowseChgDir: just go to the new directory spec {{{3 - " ---------------------------------------------------- -" call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>','~'.expand("")) - let dirname = newdir - NetrwKeepj call s:SetRexDir(a:islocal,dirname) - NetrwKeepj call s:NetrwOptionsRestore("s:") - norm! m` - - elseif newdir == './' - " --------------------------------------------- - " NetrwBrowseChgDir: refresh the directory list {{{3 - " --------------------------------------------- -" call Decho('(s:NetrwBrowseChgDir)refresh-dirlist: case "refresh directory listing": newdir == "./"','~'.expand("")) - NetrwKeepj call s:SetRexDir(a:islocal,dirname) - norm! m` - - elseif newdir == '../' - " -------------------------------------- - " NetrwBrowseChgDir: go up one directory {{{3 - " -------------------------------------- -" call Decho('(s:NetrwBrowseChgDir)go-up: case "go up one directory": newdir == "../"','~'.expand("")) - - if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") - " force a refresh -" call Decho("go-up: clear buffer<".expand("%")."> with :%d",'~'.expand("")) -" call Decho("go-up: setl noro ma",'~'.expand("")) - setl noro ma - NetrwKeepj %d _ - endif - - if has("amiga") - " amiga -" call Decho('go-up: case "go up one directory": newdir == "../" and amiga','~'.expand("")) - if a:islocal - let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') - let dirname= substitute(dirname,'/$','','') - else - let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') - endif -" call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)",'~'.expand("")) - - elseif !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - " windows - if a:islocal - let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') - if dirname == "" - let dirname= '/' - endif - else - let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') - endif - if dirname =~ '^\a:$' - let dirname= dirname.'/' - endif -" call Decho("go-up: windows: dirname<".dirname."> (go up one dir)",'~'.expand("")) - - else - " unix or cygwin -" call Decho('(s:NetrwBrowseChgDir)go-up: case "go up one directory": newdir == "../" and unix or cygwin','~'.expand("")) - if a:islocal - let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') - if dirname == "" - let dirname= '/' - endif - else - let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') - endif -" call Decho("go-up: unix: dirname<".dirname."> (go up one dir)",'~'.expand("")) - endif - NetrwKeepj call s:SetRexDir(a:islocal,dirname) - norm! m` - - elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") - " -------------------------------------- - " NetrwBrowseChgDir: Handle Tree Listing {{{3 - " -------------------------------------- -" call Decho('(s:NetrwBrowseChgDir)tree-list: case liststyle is TREELIST and w:netrw_treedict exists','~'.expand("")) - " force a refresh (for TREELIST, NetrwTreeDir() will force the refresh) -" call Decho("tree-list: setl noro ma",'~'.expand("")) - setl noro ma - if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) -" call Decho("tree-list: clear buffer<".expand("%")."> with :%d (force refresh)",'~'.expand("")) - NetrwKeepj %d _ - endif - let treedir = s:NetrwTreeDir(a:islocal) -" call Decho("tree-list: treedir<".treedir.">",'~'.expand("")) - let s:treecurpos = winsaveview() - let haskey = 0 -" call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">",'~'.expand("")) - - " search treedict for tree dir as-is -" call Decho("tree-list: search treedict for tree dir as-is",'~'.expand("")) - if has_key(w:netrw_treedict,treedir) -" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("")) - let haskey= 1 - else -" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("")) - endif - - " search treedict for treedir with a [/@] appended -" call Decho("tree-list: search treedict for treedir with a [/@] appended",'~'.expand("")) - if !haskey && treedir !~ '[/@]$' - if has_key(w:netrw_treedict,treedir."/") - let treedir= treedir."/" -" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("")) - let haskey = 1 - else -" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'/> : not found','~'.expand("")) - endif - endif - - " search treedict for treedir with any trailing / elided -" call Decho("tree-list: search treedict for treedir with any trailing / elided",'~'.expand("")) - if !haskey && treedir =~ '/$' - let treedir= substitute(treedir,'/$','','') - if has_key(w:netrw_treedict,treedir) -" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("")) - let haskey = 1 - else -" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("")) - endif - endif - -" call Decho("haskey=".haskey,'~'.expand("")) - if haskey - " close tree listing for selected subdirectory -" call Decho("tree-list: closing selected subdirectory<".dirname.">",'~'.expand("")) - call remove(w:netrw_treedict,treedir) -" call Decho("tree-list: removed entry<".treedir."> from treedict",'~'.expand("")) -" call Decho("tree-list: yielding treedict<".string(w:netrw_treedict).">",'~'.expand("")) - let dirname= w:netrw_treetop - else - " go down one directory - let dirname= substitute(treedir,'/*$','/','') -" call Decho("tree-list: go down one dir: treedir<".treedir.">",'~'.expand("")) -" call Decho("tree-list: ... : dirname<".dirname.">",'~'.expand("")) - endif - NetrwKeepj call s:SetRexDir(a:islocal,dirname) -" call Decho("setting s:treeforceredraw to true",'~'.expand("")) - let s:treeforceredraw = 1 - - else - " ---------------------------------------- - " NetrwBrowseChgDir: Go down one directory {{{3 - " ---------------------------------------- - let dirname = s:ComposePath(dirname,newdir) -" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">",'~'.expand("")) - NetrwKeepj call s:SetRexDir(a:islocal,dirname) - norm! m` - endif - - " -------------------------------------- - " NetrwBrowseChgDir: Restore and Cleanup {{{3 - " -------------------------------------- - if dorestore - " dorestore is zero'd when a local file was hidden or bufhidden; - " in such a case, we want to keep whatever settings it may have. -" call Decho("doing option restore (dorestore=".dorestore.")",'~'.expand("")) - NetrwKeepj call s:NetrwOptionsRestore("s:") -" else " Decho -" call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("")) - endif - if dolockout && dorestore -" call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("")) - if filewritable(dirname) -" call Decho("restore: doing modification lockout settings: ma nomod noro",'~'.expand("")) -" call Decho("restore: setl ma nomod noro",'~'.expand("")) - setl ma noro nomod -" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - else -" call Decho("restore: doing modification lockout settings: ma nomod ro",'~'.expand("")) -" call Decho("restore: setl ma nomod noro",'~'.expand("")) - setl ma ro nomod -" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - endif - endif - call s:RestorePosn(s:netrw_posn) - let @@= ykeep - -" call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") - return dirname -endfun - -" --------------------------------------------------------------------- -" s:NetrwBrowseUpDir: implements the "-" mappings {{{2 -" for thin, long, and wide: cursor placed just after banner -" for tree, keeps cursor on current filename -fun! s:NetrwBrowseUpDir(islocal) -" call Dfunc("s:NetrwBrowseUpDir(islocal=".a:islocal.")") - if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt-1 - " this test needed because occasionally this function seems to be incorrectly called - " when multiple leftmouse clicks are taken when atop the one line help in the banner. - " I'm allowing the very bottom line to permit a "-" exit so that one may escape empty - " directories. -" call Dret("s:NetrwBrowseUpDir : cursor not in file area") - return - endif - - norm! 0 - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") -" call Decho("case: treestyle",'~'.expand("")) - let curline= getline(".") - let swwline= winline() - 1 - if exists("w:netrw_treetop") - let b:netrw_curdir= w:netrw_treetop - elseif exists("b:netrw_curdir") - let w:netrw_treetop= b:netrw_curdir - else - let w:netrw_treetop= getcwd() - let b:netrw_curdir = w:netrw_treetop - endif - let curfile = getline(".") - let curpath = s:NetrwTreePath(w:netrw_treetop) - if a:islocal - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) - else - call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) - endif -" call Decho("looking for curfile<^".s:treedepthstring.curfile.">",'~'.expand("")) -" call Decho("having curpath<".curpath.">",'~'.expand("")) - if w:netrw_treetop == '/' - keepj call search('^\M'.curfile,"w") - elseif curfile == '../' - keepj call search('^\M'.curfile,"wb") - else -" call Decho("search(^\\M".s:treedepthstring.curfile.") backwards")) - while 1 - keepj call search('^\M'.s:treedepthstring.curfile,"wb") - let treepath= s:NetrwTreePath(w:netrw_treetop) -" call Decho("..current treepath<".treepath.">",'~'.expand("")) - if treepath == curpath - break - endif - endwhile - endif - - else -" call Decho("case: not treestyle",'~'.expand("")) - call s:SavePosn(s:netrw_posn) - if exists("b:netrw_curdir") - let curdir= b:netrw_curdir - else - let curdir= expand(getcwd()) - endif - if a:islocal - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) - else - call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) - endif - call s:RestorePosn(s:netrw_posn) - let curdir= substitute(curdir,'^.*[\/]','','') - let curdir= '\<'. escape(curdir, '~'). '/' - call search(curdir,'wc') - endif -" call Dret("s:NetrwBrowseUpDir") -endfun - -" --------------------------------------------------------------------- -" netrw#BrowseX: (implements "x" and "gx") executes a special "viewer" script or program for the {{{2 -" given filename; typically this means given their extension. -" 0=local, 1=remote -fun! netrw#BrowseX(fname,remote) - let use_ctrlo= 1 -" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.") implements x and gx maps") - - if a:remote == 0 && isdirectory(a:fname) - " if its really just a local directory, then do a "gf" instead -" call Decho("remote≡0 and a:fname<".a:fname."> ".(isdirectory(a:fname)? "is a directory" : "is not a directory"),'~'.expand("")) -" call Decho("..appears to be a local directory; using e ".a:fname." instead",'~'.expand("")) - exe "e ".a:fname -" call Dret("netrw#BrowseX") - return - elseif a:remote == 1 && a:fname !~ '^https\=:' && a:fname =~ '/$' - " remote directory, not a webpage access, looks like an attempt to do a directory listing -" call Decho("remote≡1 and a:fname<".a:fname.">",'~'.expand("")) -" call Decho("..and fname ".((a:fname =~ '^https\=:')? 'matches' : 'does not match').'^https\=:','~'.expand("")) -" call Decho("..and fname ".((a:fname =~ '/$')? 'matches' : 'does not match').' /$','~'.expand("")) -" call Decho("..appears to be a remote directory listing request; using gf instead",'~'.expand("")) - norm! gf -" call Dret("netrw#BrowseX") - return - endif -" call Decho("not a local file nor a webpage request",'~'.expand("")) - - if exists("g:netrw_browsex_viewer") && exists("g:netrw_browsex_support_remote") && !g:netrw_browsex_support_remote - let remote = a:remote - else - let remote = 0 - endif - - let ykeep = @@ - let screenposn = winsaveview() -" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("")) - - " need to save and restore aw setting as gx can invoke this function from non-netrw buffers - let awkeep = &aw - set noaw - - " special core dump handler - if a:fname =~ '/core\(\.\d\+\)\=$' - if exists("g:Netrw_corehandler") - if type(g:Netrw_corehandler) == 2 - " g:Netrw_corehandler is a function reference (see :help Funcref) -" call Decho("g:Netrw_corehandler is a funcref",'~'.expand("")) - call g:Netrw_corehandler(s:NetrwFile(a:fname)) - elseif type(g:Netrw_corehandler) == 3 - " g:Netrw_corehandler is a List of function references (see :help Funcref) -" call Decho("g:Netrw_corehandler is a List",'~'.expand("")) - for Fncref in g:Netrw_corehandler - if type(Fncref) == 2 - call Fncref(a:fname) - endif - endfor - endif -" call Decho("restoring posn: screenposn<".string(screenposn).">,'~'.expand(""))" - call winrestview(screenposn) - let @@= ykeep - let &aw= awkeep -" call Dret("netrw#BrowseX : coredump handler invoked") - return - endif - endif - - " set up the filename - " (lower case the extension, make a local copy of a remote file) - let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e') - if has("win32") || has("win95") || has("win64") || has("win16") - let exten= substitute(exten,'^.*$','\L&\E','') - endif - if exten =~ "[\\/]" - let exten= "" - endif -" call Decho("exten<".exten.">",'~'.expand("")) - - if remote == 1 - " create a local copy -" call Decho("remote: remote=".remote.": create a local copy of <".a:fname.">",'~'.expand("")) - setl bh=delete - call netrw#NetRead(3,a:fname) - " attempt to rename tempfile - let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') - let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') -" call Decho("basename<".basename.">",'~'.expand("")) -" call Decho("newname <".newname.">",'~'.expand("")) - if s:netrw_tmpfile != newname && newname != "" - if rename(s:netrw_tmpfile,newname) == 0 - " renaming succeeded -" call Decho("renaming succeeded (tmpfile<".s:netrw_tmpfile."> to <".newname.">)") - let fname= newname - else - " renaming failed -" call Decho("renaming failed (tmpfile<".s:netrw_tmpfile."> to <".newname.">)") - let fname= s:netrw_tmpfile - endif - else - let fname= s:netrw_tmpfile - endif - else -" call Decho("local: remote=".remote.": handling local copy of <".a:fname.">",'~'.expand("")) - let fname= a:fname - " special ~ handler for local - if fname =~ '^\~' && expand("$HOME") != "" -" call Decho('invoking special ~ handler','~'.expand("")) - let fname= s:NetrwFile(substitute(fname,'^\~',expand("$HOME"),'')) - endif - endif -" call Decho("fname<".fname.">",'~'.expand("")) -" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("")) - - " set up redirection (avoids browser messages) - " by default, g:netrw_suppress_gx_mesg is true - if g:netrw_suppress_gx_mesg - if &srr =~ "%s" - if (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= substitute(&srr,"%s","nul","") - else - let redir= substitute(&srr,"%s","/dev/null","") - endif - elseif (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= &srr . "nul" - else - let redir= &srr . "/dev/null" - endif - else - let redir= "" - endif -" call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("")) - - " extract any viewing options. Assumes that they're set apart by spaces. - if exists("g:netrw_browsex_viewer") -" call Decho("extract any viewing options from g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) - if g:netrw_browsex_viewer =~ '\s' - let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') - let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " - let oviewer = '' - let cnt = 1 - while !executable(viewer) && viewer != oviewer - let viewer = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\1','') - let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." " - let cnt = cnt + 1 - let oviewer = viewer -" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("")) - endwhile - else - let viewer = g:netrw_browsex_viewer - let viewopt = "" - endif -" call Decho("viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("")) - endif - - " execute the file handler -" call Decho("execute the file handler (if any)",'~'.expand("")) - if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' -" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) - let ret= netrwFileHandlers#Invoke(exten,fname) - - elseif exists("g:netrw_browsex_viewer") && executable(viewer) -" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) - call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir) - let ret= v:shell_error - - elseif has("win32") || has("win64") -" call Decho("(netrw#BrowseX) win".(has("win32")? "32" : "64"),'~'.expand("")) - if executable("start") - call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) - elseif executable("rundll32") - call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) - else - call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) - endif - let ret= v:shell_error - - elseif has("win32unix") - let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g') -" call Decho("(netrw#BrowseX) cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("")) - if executable("start") -" call Decho("(netrw#BrowseX) win32unix+start",'~'.expand("")) - call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) - elseif executable("rundll32") -" call Decho("(netrw#BrowseX) win32unix+rundll32",'~'.expand("")) - call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) - elseif executable("cygstart") -" call Decho("(netrw#BrowseX) win32unix+cygstart",'~'.expand("")) - call s:NetrwExe('sil !cygstart '.s:ShellEscape(fname,1)) - else - call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) - endif - let ret= v:shell_error - - elseif has("unix") && $DESKTOP_SESSION == "mate" && executable("atril") -" call Decho("(netrw#BrowseX) unix and atril",'~'.expand("")) - if a:fname =~ '^https\=://' - " atril does not appear to understand how to handle html -- so use gvim to edit the document - let use_ctrlo= 0 -" call Decho("fname<".fname.">") -" call Decho("a:fname<".a:fname.">") - call s:NetrwExe("sil! !gvim ".fname.' -c "keepj keepalt file '.fnameescape(a:fname).'"') - - else - call s:NetrwExe("sil !atril ".s:ShellEscape(fname,1).redir) - endif - let ret= v:shell_error - - elseif has("unix") && executable("kfmclient") && s:CheckIfKde() -" call Decho("(netrw#BrowseX) unix and kfmclient",'~'.expand("")) - call s:NetrwExe("sil !kfmclient exec ".s:ShellEscape(fname,1)." ".redir) - let ret= v:shell_error - - elseif has("unix") && executable("exo-open") && executable("xdg-open") && executable("setsid") -" call Decho("(netrw#BrowseX) unix, exo-open, xdg-open",'~'.expand("")) - call s:NetrwExe("sil !setsid xdg-open ".s:ShellEscape(fname,1).redir.'&') - let ret= v:shell_error - - elseif has("unix") && executable("xdg-open") -" call Decho("(netrw#BrowseX) unix and xdg-open",'~'.expand("")) - call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir.'&') - let ret= v:shell_error - - elseif has("macunix") && executable("open") -" call Decho("(netrw#BrowseX) macunix and open",'~'.expand("")) - call s:NetrwExe("sil !open ".s:ShellEscape(fname,1)." ".redir) - let ret= v:shell_error - - else - " netrwFileHandlers#Invoke() always returns 0 -" call Decho("(netrw#BrowseX) use netrwFileHandlers",'~'.expand("")) - let ret= netrwFileHandlers#Invoke(exten,fname) - endif - - " if unsuccessful, attempt netrwFileHandlers#Invoke() - if ret -" call Decho("(netrw#BrowseX) ret=".ret," indicates unsuccessful thus far",'~'.expand("")) - let ret= netrwFileHandlers#Invoke(exten,fname) - endif - - " restoring redraw! after external file handlers - redraw! - - " cleanup: remove temporary file, - " delete current buffer if success with handler, - " return to prior buffer (directory listing) - " Feb 12, 2008: had to de-activate removal of - " temporary file because it wasn't getting seen. -" if remote == 1 && fname != a:fname -"" call Decho("deleting temporary file<".fname.">",'~'.expand("")) -" call s:NetrwDelete(fname) -" endif - - if remote == 1 - setl bh=delete bt=nofile - if g:netrw_use_noswf - setl noswf - endif - if use_ctrlo - exe "sil! NetrwKeepj norm! \" - endif - endif -" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("")) - call winrestview(screenposn) - let @@ = ykeep - let &aw= awkeep - -" call Dret("netrw#BrowseX") -endfun - -" --------------------------------------------------------------------- -" netrw#GX: gets word under cursor for gx support {{{2 -" See also: netrw#BrowseXVis -" netrw#BrowseX -fun! netrw#GX() -" call Dfunc("netrw#GX()") - if &ft == "netrw" - let fname= s:NetrwGetWord() - else - let fname= expand((exists("g:netrw_gx")? g:netrw_gx : '')) - endif -" call Dret("netrw#GX <".fname.">") - return fname -endfun - -" --------------------------------------------------------------------- -" netrw#BrowseXVis: used by gx in visual mode to select a file for browsing {{{2 -fun! netrw#BrowseXVis() -" call Dfunc("netrw#BrowseXVis()") - let akeep = @a - norm! gv"ay - let gxfile= @a - let @a = akeep - call netrw#BrowseX(gxfile,netrw#CheckIfRemote(gxfile)) -" call Dret("netrw#BrowseXVis") -endfun - -" --------------------------------------------------------------------- -" s:NetrwBufRename: renames a buffer without the side effect of retaining an unlisted buffer having the old name {{{2 -" Using the file command on a "[No Name]" buffer does not seem to cause the old "[No Name]" buffer -" to become an unlisted buffer, so in that case don't bwipe it. -fun! s:NetrwBufRename(newname) -" call Dfunc("s:NetrwBufRename(newname<".a:newname.">) buf(%)#".bufnr("%")."<".bufname(bufnr("%")).">") -" call Dredir("ls!","s:NetrwBufRename (before rename)") - let oldbufname= bufname(bufnr("%")) -" call Decho("buf#".bufnr("%").": oldbufname<".oldbufname.">",'~'.expand("")) - - if oldbufname != a:newname -" call Decho("do buffer rename: oldbufname<".oldbufname."> ≠ a:newname<".a:newname.">",'~'.expand("")) - let b:junk= 1 -" call Decho("rename buffer: sil! keepj keepalt file ".fnameescape(a:newname),'~'.expand("")) - exe 'sil! keepj keepalt file '.fnameescape(a:newname) -" call Dredir("ls!","s:NetrwBufRename (before bwipe)~".expand("")) - let oldbufnr= bufnr(oldbufname) -" call Decho("oldbufname<".oldbufname."> oldbufnr#".oldbufnr,'~'.expand("")) -" call Decho("bufnr(%)=".bufnr("%"),'~'.expand("")) - if oldbufname != "" && oldbufnr != -1 && oldbufnr != bufnr("%") -" call Decho("bwipe ".oldbufnr,'~'.expand("")) - exe "bwipe! ".oldbufnr -" else " Decho -" call Decho("did *not* bwipe buf#".oldbufnr,'~'.expand("")) -" call Decho("..reason: if oldbufname<".oldbufname."> is empty",'~'.expand(""))" -" call Decho("..reason: if oldbufnr#".oldbufnr." is -1",'~'.expand(""))" -" call Decho("..reason: if oldbufnr#".oldbufnr." != bufnr(%)#".bufnr("%"),'~'.expand(""))" - endif -" call Dredir("ls!","s:NetrwBufRename (after rename)") -" else " Decho -" call Decho("oldbufname<".oldbufname."> == a:newname: did *not* rename",'~'.expand("")) - endif - -" call Dret("s:NetrwBufRename : buf#".bufnr("%").": oldname<".oldbufname."> newname<".a:newname."> expand(%)<".expand("%").">") -endfun - -" --------------------------------------------------------------------- -" netrw#CheckIfRemote: returns 1 if current file looks like an url, 0 else {{{2 -fun! netrw#CheckIfRemote(...) -" call Dfunc("netrw#CheckIfRemote() a:0=".a:0) - if a:0 > 0 - let curfile= a:1 - else - let curfile= expand("%") - endif - - " Ignore terminal buffers - if &buftype ==# 'terminal' - return 0 - endif -" call Decho("curfile<".curfile.">") - if curfile =~ '^\a\{3,}://' -" call Dret("netrw#CheckIfRemote 1") - return 1 - else -" call Dret("netrw#CheckIfRemote 0") - return 0 - endif -endfun - -" --------------------------------------------------------------------- -" s:NetrwChgPerm: (implements "gp") change file permission {{{2 -fun! s:NetrwChgPerm(islocal,curdir) -" call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)") - let ykeep = @@ - call inputsave() - let newperm= input("Enter new permission: ") - call inputrestore() - let chgperm= substitute(g:netrw_chgperm,'\',s:ShellEscape(expand("")),'') - let chgperm= substitute(chgperm,'\',s:ShellEscape(newperm),'') -" call Decho("chgperm<".chgperm.">",'~'.expand("")) - call system(chgperm) - if v:shell_error != 0 - NetrwKeepj call netrw#ErrorMsg(1,"changing permission on file<".expand("")."> seems to have failed",75) - endif - if a:islocal - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - endif - let @@= ykeep -" call Dret("s:NetrwChgPerm") -endfun - -" --------------------------------------------------------------------- -" s:CheckIfKde: checks if kdeinit is running {{{2 -" Returns 0: kdeinit not running -" 1: kdeinit is running -fun! s:CheckIfKde() -" call Dfunc("s:CheckIfKde()") - " seems kde systems often have gnome-open due to dependencies, even though - " gnome-open's subsidiary display tools are largely absent. Kde systems - " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) - if !exists("s:haskdeinit") - if has("unix") && executable("ps") && !has("win32unix") - let s:haskdeinit= system("ps -e") =~ '\")) - endif - -" call Dret("s:CheckIfKde ".s:haskdeinit) - return s:haskdeinit -endfun - -" --------------------------------------------------------------------- -" s:NetrwClearExplore: clear explore variables (if any) {{{2 -fun! s:NetrwClearExplore() -" call Dfunc("s:NetrwClearExplore()") - 2match none - if exists("s:explore_match") |unlet s:explore_match |endif - if exists("s:explore_indx") |unlet s:explore_indx |endif - if exists("s:netrw_explore_prvdir") |unlet s:netrw_explore_prvdir |endif - if exists("s:dirstarstar") |unlet s:dirstarstar |endif - if exists("s:explore_prvdir") |unlet s:explore_prvdir |endif - if exists("w:netrw_explore_indx") |unlet w:netrw_explore_indx |endif - if exists("w:netrw_explore_listlen")|unlet w:netrw_explore_listlen|endif - if exists("w:netrw_explore_list") |unlet w:netrw_explore_list |endif - if exists("w:netrw_explore_bufnr") |unlet w:netrw_explore_bufnr |endif -" redraw! -" call Dret("s:NetrwClearExplore") -endfun - -" --------------------------------------------------------------------- -" s:NetrwEditBuf: decides whether or not to use keepalt to edit a buffer {{{2 -fun! s:NetrwEditBuf(bufnum) -" call Dfunc("s:NetrwEditBuf(fname<".a:bufnum.">)") - if exists("g:netrw_altfile") && g:netrw_altfile && &ft == "netrw" -" call Decho("exe sil! NetrwKeepj keepalt noswapfile b ".fnameescape(a:bufnum)) - exe "sil! NetrwKeepj keepalt noswapfile b ".fnameescape(a:bufnum) - else -" call Decho("exe sil! NetrwKeepj noswapfile b ".fnameescape(a:bufnum)) - exe "sil! NetrwKeepj noswapfile b ".fnameescape(a:bufnum) - endif -" call Dret("s:NetrwEditBuf") -endfun - -" --------------------------------------------------------------------- -" s:NetrwEditFile: decides whether or not to use keepalt to edit a file {{{2 -" NetrwKeepj [keepalt] -fun! s:NetrwEditFile(cmd,opt,fname) -" call Dfunc("s:NetrwEditFile(cmd<".a:cmd.">,opt<".a:opt.">,fname<".a:fname.">) ft<".&ft.">") - if exists("g:netrw_altfile") && g:netrw_altfile && &ft == "netrw" -" call Decho("exe NetrwKeepj keepalt ".a:opt." ".a:cmd." ".fnameescape(a:fname)) - exe "NetrwKeepj keepalt ".a:opt." ".a:cmd." ".fnameescape(a:fname) - else -" call Decho("exe NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname)) - exe "NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname) - endif -" call Dret("s:NetrwEditFile") -endfun - -" --------------------------------------------------------------------- -" s:NetrwExploreListUniq: {{{2 -fun! s:NetrwExploreListUniq(explist) -" call Dfunc("s:NetrwExploreListUniq(explist<".string(a:explist).">)") - - " this assumes that the list is already sorted - let newexplist= [] - for member in a:explist - if !exists("uniqmember") || member != uniqmember - let uniqmember = member - let newexplist = newexplist + [ member ] - endif - endfor - -" call Dret("s:NetrwExploreListUniq newexplist<".string(newexplist).">") - return newexplist -endfun - -" --------------------------------------------------------------------- -" s:NetrwForceChgDir: (gd support) Force treatment as a directory {{{2 -fun! s:NetrwForceChgDir(islocal,newdir) -" call Dfunc("s:NetrwForceChgDir(islocal=".a:islocal." newdir<".a:newdir.">)") - let ykeep= @@ - if a:newdir !~ '/$' - " ok, looks like force is needed to get directory-style treatment - if a:newdir =~ '@$' - let newdir= substitute(a:newdir,'@$','/','') - elseif a:newdir =~ '[*=|\\]$' - let newdir= substitute(a:newdir,'.$','/','') - else - let newdir= a:newdir.'/' - endif -" call Decho("adjusting newdir<".newdir."> due to gd",'~'.expand("")) - else - " should already be getting treatment as a directory - let newdir= a:newdir - endif - let newdir= s:NetrwBrowseChgDir(a:islocal,newdir) - call s:NetrwBrowse(a:islocal,newdir) - let @@= ykeep -" call Dret("s:NetrwForceChgDir") -endfun - -" --------------------------------------------------------------------- -" s:NetrwGlob: does glob() if local, remote listing otherwise {{{2 -" direntry: this is the name of the directory. Will be fnameescape'd to prevent wildcard handling by glob() -" expr : this is the expression to follow the directory. Will use s:ComposePath() -" pare =1: remove the current directory from the resulting glob() filelist -" =0: leave the current directory in the resulting glob() filelist -fun! s:NetrwGlob(direntry,expr,pare) -" call Dfunc("s:NetrwGlob(direntry<".a:direntry."> expr<".a:expr."> pare=".a:pare.")") - if netrw#CheckIfRemote() - keepalt 1sp - keepalt enew - let keep_liststyle = w:netrw_liststyle - let w:netrw_liststyle = s:THINLIST - if s:NetrwRemoteListing() == 0 - keepj keepalt %s@/@@ - let filelist= getline(1,$) - q! - else - " remote listing error -- leave treedict unchanged - let filelist= w:netrw_treedict[a:direntry] - endif - let w:netrw_liststyle= keep_liststyle - elseif v:version > 704 || (v:version == 704 && has("patch656")) - let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1,1) - if a:pare - let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') - endif - else - let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1) - if a:pare - let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') - endif - endif -" call Dret("s:NetrwGlob ".string(filelist)) - return filelist -endfun - -" --------------------------------------------------------------------- -" s:NetrwForceFile: (gf support) Force treatment as a file {{{2 -fun! s:NetrwForceFile(islocal,newfile) -" call Dfunc("s:NetrwForceFile(islocal=".a:islocal." newdir<".a:newfile.">)") - if a:newfile =~ '[/@*=|\\]$' - let newfile= substitute(a:newfile,'.$','','') - else - let newfile= a:newfile - endif - if a:islocal - call s:NetrwBrowseChgDir(a:islocal,newfile) - else - call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,newfile)) - endif -" call Dret("s:NetrwForceFile") -endfun - -" --------------------------------------------------------------------- -" s:NetrwHide: this function is invoked by the "a" map for browsing {{{2 -" and switches the hiding mode. The actual hiding is done by -" s:NetrwListHide(). -" g:netrw_hide= 0: show all -" 1: show not-hidden files -" 2: show hidden files only -fun! s:NetrwHide(islocal) -" call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide) - let ykeep= @@ - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - - if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">",'~'.expand("")) -" call Decho("g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) - - " hide the files in the markfile list - for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk,'~'.expand("")) - if match(g:netrw_list_hide,'\<'.fname.'\>') != -1 - " remove fname from hiding list - let g:netrw_list_hide= substitute(g:netrw_list_hide,'..\<'.escape(fname,g:netrw_fname_escape).'\>..','','') - let g:netrw_list_hide= substitute(g:netrw_list_hide,',,',',','g') - let g:netrw_list_hide= substitute(g:netrw_list_hide,'^,\|,$','','') -" call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) - else - " append fname to hiding list - if exists("g:netrw_list_hide") && g:netrw_list_hide != "" - let g:netrw_list_hide= g:netrw_list_hide.',\<'.escape(fname,g:netrw_fname_escape).'\>' - else - let g:netrw_list_hide= '\<'.escape(fname,g:netrw_fname_escape).'\>' - endif -" call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) - endif - endfor - NetrwKeepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - let g:netrw_hide= 1 - - else - - " switch between show-all/show-not-hidden/show-hidden - let g:netrw_hide=(g:netrw_hide+1)%3 - exe "NetrwKeepj norm! 0" - if g:netrw_hide && g:netrw_list_hide == "" - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) - let @@= ykeep -" call Dret("NetrwHide") - return - endif - endif - - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - let @@= ykeep -" call Dret("NetrwHide") -endfun - -" --------------------------------------------------------------------- -" s:NetrwHideEdit: allows user to edit the file/directory hiding list {{{2 -fun! s:NetrwHideEdit(islocal) -" call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") - - let ykeep= @@ - " save current cursor position - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - - " get new hiding list from user - call inputsave() - let newhide= input("Edit Hiding List: ",g:netrw_list_hide) - call inputrestore() - let g:netrw_list_hide= newhide -" call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) - - " refresh the listing - sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) - - " restore cursor position -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - call winrestview(svpos) - let @@= ykeep - -" call Dret("NetrwHideEdit") -endfun - -" --------------------------------------------------------------------- -" s:NetrwHidden: invoked by "gh" {{{2 -fun! s:NetrwHidden(islocal) -" call Dfunc("s:NetrwHidden()") - let ykeep= @@ - " save current position - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - - if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+' - " remove .file pattern from hiding list -" call Decho("remove .file pattern from hiding list",'~'.expand("")) - let g:netrw_list_hide= substitute(g:netrw_list_hide,'\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+','','') - elseif s:Strlen(g:netrw_list_hide) >= 1 -" call Decho("add .file pattern from hiding list",'~'.expand("")) - let g:netrw_list_hide= g:netrw_list_hide . ',\(^\|\s\s\)\zs\.\S\+' - else -" call Decho("set .file pattern as hiding list",'~'.expand("")) - let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+' - endif - if g:netrw_list_hide =~ '^,' - let g:netrw_list_hide= strpart(g:netrw_list_hide,1) - endif - - " refresh screen and return to saved position - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - let @@= ykeep -" call Dret("s:NetrwHidden") -endfun - -" --------------------------------------------------------------------- -" s:NetrwHome: this function determines a "home" for saving bookmarks and history {{{2 -fun! s:NetrwHome() - if exists("g:netrw_home") - let home= expand(g:netrw_home) - else - let home = stdpath('data') - endif - " insure that the home directory exists - if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home)) -" call Decho("insure that the home<".home."> directory exists") - if exists("g:netrw_mkdir") -" call Decho("call system(".g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home)).")") - call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home))) - else -" call Decho("mkdir(".home.")") - call mkdir(home) - endif - endif - let g:netrw_home= home - return home -endfun - -" --------------------------------------------------------------------- -" s:NetrwLeftmouse: handles the when in a netrw browsing window {{{2 -fun! s:NetrwLeftmouse(islocal) - if exists("s:netrwdrag") - return - endif - if &ft != "netrw" - return - endif -" call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")") - - let ykeep= @@ - " check if the status bar was clicked on instead of a file/directory name - while getchar(0) != 0 - "clear the input stream - endwhile - call feedkeys("\") - let c = getchar() - let mouse_lnum = v:mouse_lnum - let wlastline = line('w$') - let lastline = line('$') -" call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr(),'~'.expand("")) -" call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0),'~'.expand("")) - if mouse_lnum >= wlastline + 1 || v:mouse_win != winnr() - " appears to be a status bar leftmouse click - let @@= ykeep -" call Dret("s:NetrwLeftmouse : detected a status bar leftmouse click") - return - endif - " Dec 04, 2013: following test prevents leftmouse selection/deselection of directories and files in treelist mode - " Windows are separated by vertical separator bars - but the mouse seems to be doing what it should when dragging that bar - " without this test when its disabled. - " May 26, 2014: edit file, :Lex, resize window -- causes refresh. Reinstated a modified test. See if problems develop. -" call Decho("v:mouse_col=".v:mouse_col." col#".col('.')." virtcol#".virtcol('.')." col($)#".col("$")." virtcol($)#".virtcol("$"),'~'.expand("")) - if v:mouse_col > virtcol('.') - let @@= ykeep -" call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") - return - endif - - if a:islocal - if exists("b:netrw_curdir") - NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) - endif - else - if exists("b:netrw_curdir") - NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) - endif - endif - let @@= ykeep -" call Dret("s:NetrwLeftmouse") -endfun - -" --------------------------------------------------------------------- -" s:NetrwCLeftmouse: used to select a file/directory for a target {{{2 -fun! s:NetrwCLeftmouse(islocal) - if &ft != "netrw" - return - endif -" call Dfunc("s:NetrwCLeftmouse(islocal=".a:islocal.")") - call s:NetrwMarkFileTgt(a:islocal) -" call Dret("s:NetrwCLeftmouse") -endfun - -" --------------------------------------------------------------------- -" s:NetrwServerEdit: edit file in a server gvim, usually NETRWSERVER (implements ){{{2 -" a:islocal=0 : not used, remote -" a:islocal=1 : not used, local -" a:islocal=2 : used, remote -" a:islocal=3 : used, local -fun! s:NetrwServerEdit(islocal,fname) -" call Dfunc("s:NetrwServerEdit(islocal=".a:islocal.",fname<".a:fname.">)") - let islocal = a:islocal%2 " =0: remote =1: local - let ctrlr = a:islocal >= 2 " =0: not used =1: used -" call Decho("islocal=".islocal." ctrlr=".ctrlr,'~'.expand("")) - - if (islocal && isdirectory(s:NetrwFile(a:fname))) || (!islocal && a:fname =~ '/$') - " handle directories in the local window -- not in the remote vim server - " user must have closed the NETRWSERVER window. Treat as normal editing from netrw. -" call Decho("handling directory in client window",'~'.expand("")) - let g:netrw_browse_split= 0 - if exists("s:netrw_browse_split") && exists("s:netrw_browse_split_".winnr()) - let g:netrw_browse_split= s:netrw_browse_split_{winnr()} - unlet s:netrw_browse_split_{winnr()} - endif - call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) -" call Dret("s:NetrwServerEdit") - return - endif - -" call Decho("handling file in server window",'~'.expand("")) - if has("clientserver") && executable("gvim") -" call Decho("has clientserver and gvim",'~'.expand("")) - - if exists("g:netrw_browse_split") && type(g:netrw_browse_split) == 3 -" call Decho("g:netrw_browse_split=".string(g:netrw_browse_split),'~'.expand("")) - let srvrname = g:netrw_browse_split[0] - let tabnum = g:netrw_browse_split[1] - let winnum = g:netrw_browse_split[2] - - if serverlist() !~ '\<'.srvrname.'\>' -" call Decho("server not available; ctrlr=".ctrlr,'~'.expand("")) - - if !ctrlr - " user must have closed the server window and the user did not use , but - " used something like . -" call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("")) - if exists("g:netrw_browse_split") - unlet g:netrw_browse_split - endif - let g:netrw_browse_split= 0 - if exists("s:netrw_browse_split_".winnr()) - let g:netrw_browse_split= s:netrw_browse_split_{winnr()} - endif - call s:NetrwBrowseChgDir(islocal,a:fname) -" call Dret("s:NetrwServerEdit") - return - - elseif has("win32") && executable("start") - " start up remote netrw server under windows -" call Decho("starting up gvim server<".srvrname."> for windows",'~'.expand("")) - call system("start gvim --servername ".srvrname) - - else - " start up remote netrw server under linux -" call Decho("starting up gvim server<".srvrname.">",'~'.expand("")) - call system("gvim --servername ".srvrname) - endif - endif - -" call Decho("srvrname<".srvrname."> tabnum=".tabnum." winnum=".winnum." server-editing<".a:fname.">",'~'.expand("")) - call remote_send(srvrname,":tabn ".tabnum."\") - call remote_send(srvrname,":".winnum."wincmd w\") - call remote_send(srvrname,":e ".fnameescape(s:NetrwFile(a:fname))."\") - - else - - if serverlist() !~ '\<'.g:netrw_servername.'\>' - - if !ctrlr -" call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("")) - if exists("g:netrw_browse_split") - unlet g:netrw_browse_split - endif - let g:netrw_browse_split= 0 - call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) -" call Dret("s:NetrwServerEdit") - return - - else -" call Decho("server<".g:netrw_servername."> not available but ctrl-r used",'~'.expand("")) - if has("win32") && executable("start") - " start up remote netrw server under windows -" call Decho("starting up gvim server<".g:netrw_servername."> for windows",'~'.expand("")) - call system("start gvim --servername ".g:netrw_servername) - else - " start up remote netrw server under linux -" call Decho("starting up gvim server<".g:netrw_servername.">",'~'.expand("")) - call system("gvim --servername ".g:netrw_servername) - endif - endif - endif - - while 1 - try -" call Decho("remote-send: e ".a:fname,'~'.expand("")) - call remote_send(g:netrw_servername,":e ".fnameescape(s:NetrwFile(a:fname))."\") - break - catch /^Vim\%((\a\+)\)\=:E241/ - sleep 200m - endtry - endwhile - - if exists("g:netrw_browse_split") - if type(g:netrw_browse_split) != 3 - let s:netrw_browse_split_{winnr()}= g:netrw_browse_split - endif - unlet g:netrw_browse_split - endif - let g:netrw_browse_split= [g:netrw_servername,1,1] - endif - - else - call netrw#ErrorMsg(s:ERROR,"you need a gui-capable vim and client-server to use ",98) - endif - -" call Dret("s:NetrwServerEdit") -endfun - -" --------------------------------------------------------------------- -" s:NetrwSLeftmouse: marks the file under the cursor. May be dragged to select additional files {{{2 -fun! s:NetrwSLeftmouse(islocal) - if &ft != "netrw" - return - endif -" call Dfunc("s:NetrwSLeftmouse(islocal=".a:islocal.")") - - let s:ngw= s:NetrwGetWord() - call s:NetrwMarkFile(a:islocal,s:ngw) - -" call Dret("s:NetrwSLeftmouse") -endfun - -" --------------------------------------------------------------------- -" s:NetrwSLeftdrag: invoked via a shift-leftmouse and dragging {{{2 -" Used to mark multiple files. -fun! s:NetrwSLeftdrag(islocal) -" call Dfunc("s:NetrwSLeftdrag(islocal=".a:islocal.")") - if !exists("s:netrwdrag") - let s:netrwdrag = winnr() - if a:islocal - nno :call NetrwSLeftrelease(1) - else - nno :call NetrwSLeftrelease(0) - endif - endif - let ngw = s:NetrwGetWord() - if !exists("s:ngw") || s:ngw != ngw - call s:NetrwMarkFile(a:islocal,ngw) - endif - let s:ngw= ngw -" call Dret("s:NetrwSLeftdrag : s:netrwdrag=".s:netrwdrag." buf#".bufnr("%")) -endfun - -" --------------------------------------------------------------------- -" s:NetrwSLeftrelease: terminates shift-leftmouse dragging {{{2 -fun! s:NetrwSLeftrelease(islocal) -" call Dfunc("s:NetrwSLeftrelease(islocal=".a:islocal.") s:netrwdrag=".s:netrwdrag." buf#".bufnr("%")) - if exists("s:netrwdrag") - nunmap - let ngw = s:NetrwGetWord() - if !exists("s:ngw") || s:ngw != ngw - call s:NetrwMarkFile(a:islocal,ngw) - endif - if exists("s:ngw") - unlet s:ngw - endif - unlet s:netrwdrag - endif -" call Dret("s:NetrwSLeftrelease") -endfun - -" --------------------------------------------------------------------- -" s:NetrwListHide: uses [range]g~...~d to delete files that match {{{2 -" comma-separated patterns given in g:netrw_list_hide -fun! s:NetrwListHide() -" call Dfunc("s:NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") -" call Decho("initial: ".string(getline(w:netrw_bannercnt,'$'))) - let ykeep= @@ - - " find a character not in the "hide" string to use as a separator for :g and :v commands - " How-it-works: take the hiding command, convert it into a range. - " Duplicate characters don't matter. - " Remove all such characters from the '/~@#...890' string. - " Use the first character left as a separator character. -" call Decho("find a character not in the hide string to use as a separator",'~'.expand("")) - let listhide= g:netrw_list_hide - let sep = strpart(substitute('~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1) -" call Decho("sep<".sep."> (sep not in hide string)",'~'.expand("")) - - while listhide != "" - if listhide =~ ',' - let hide = substitute(listhide,',.*$','','e') - let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e') - else - let hide = listhide - let listhide = "" - endif -" call Decho("..extracted pattern from listhide: hide<".hide."> g:netrw_sort_by<".g:netrw_sort_by.'>','~'.expand("")) - if g:netrw_sort_by =~ '^[ts]' - if hide =~ '^\^' -" call Decho("..modify hide to handle a \"^...\" pattern",'~'.expand("")) - let hide= substitute(hide,'^\^','^\(\\d\\+/\)','') - elseif hide =~ '^\\(\^' - let hide= substitute(hide,'^\\(\^','\\(^\\(\\d\\+/\\)','') - endif -" call Decho("..hide<".hide."> listhide<".listhide.'>','~'.expand("")) - endif - - " Prune the list by hiding any files which match -" call Decho("..prune the list by hiding any files which ".((g:netrw_hide == 1)? "" : "don't")."match hide<".hide.">") - if g:netrw_hide == 1 -" call Decho("..hiding<".hide.">",'~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' - elseif g:netrw_hide == 2 -" call Decho("..showing<".hide.">",'~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' - endif -" call Decho("..result: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("")) - endwhile - - if g:netrw_hide == 2 - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' -" call Decho("..v KEEP: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' -" call Decho("..g KEEP: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("")) - endif - - " remove any blank lines that have somehow remained. - " This seems to happen under Windows. - exe 'sil! NetrwKeepj 1,$g@^\s*$@d' - - let @@= ykeep -" call Dret("s:NetrwListHide") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMakeDir: this function makes a directory (both local and remote) {{{2 -" implements the "d" mapping. -fun! s:NetrwMakeDir(usrhost) -" call Dfunc("s:NetrwMakeDir(usrhost<".a:usrhost.">)") - - let ykeep= @@ - " get name of new directory from user. A bare will skip. - " if its currently a directory, also request will be skipped, but with - " a message. - call inputsave() - let newdirname= input("Please give directory name: ") - call inputrestore() -" call Decho("newdirname<".newdirname.">",'~'.expand("")) - - if newdirname == "" - let @@= ykeep -" call Dret("s:NetrwMakeDir : user aborted with bare ") - return - endif - - if a:usrhost == "" -" call Decho("local mkdir",'~'.expand("")) - - " Local mkdir: - " sanity checks - let fullnewdir= b:netrw_curdir.'/'.newdirname -" call Decho("fullnewdir<".fullnewdir.">",'~'.expand("")) - if isdirectory(s:NetrwFile(fullnewdir)) - if !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) - endif - let @@= ykeep -" call Dret("s:NetrwMakeDir : directory<".newdirname."> exists previously") - return - endif - if s:FileReadable(fullnewdir) - if !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) - endif - let @@= ykeep -" call Dret("s:NetrwMakeDir : file<".newdirname."> exists previously") - return - endif - - " requested new local directory is neither a pre-existing file or - " directory, so make it! - if exists("*mkdir") - if has("unix") - call mkdir(fullnewdir,"p",xor(0777, system("umask"))) - else - call mkdir(fullnewdir,"p") - endif - else - let netrw_origdir= s:NetrwGetcwd(1) - if s:NetrwLcd(b:netrw_curdir) -" call Dret("s:NetrwMakeDir : lcd failure") - return - endif -" call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">",'~'.expand("")) - call s:NetrwExe("sil! !".g:netrw_localmkdir.g:netrw_localmkdiropt.' '.s:ShellEscape(newdirname,1)) - if v:shell_error != 0 - let @@= ykeep - call netrw#ErrorMsg(s:ERROR,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) -" call Dret("s:NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(newdirname,1)) - return - endif - if !g:netrw_keepdir -" call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("")) - if s:NetrwLcd(netrw_origdir) -" call Dret("s:NetrwBrowse : lcd failure") - return - endif - endif - endif - - if v:shell_error == 0 - " refresh listing -" call Decho("refresh listing",'~'.expand("")) - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - call winrestview(svpos) - elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",26) - endif -" redraw! - - elseif !exists("b:netrw_method") || b:netrw_method == 4 - " Remote mkdir: using ssh -" call Decho("remote mkdir",'~'.expand("")) - let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd) - let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname - call s:NetrwExe("sil! !".mkdircmd." ".s:ShellEscape(newdirname,1)) - if v:shell_error == 0 - " refresh listing - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - elseif !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) - endif -" redraw! - - elseif b:netrw_method == 2 - " Remote mkdir: using ftp+.netrc - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) -" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) - if exists("b:netrw_fname") -" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("")) - let remotepath= b:netrw_fname - else - let remotepath= "" - endif - call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"') - NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - - elseif b:netrw_method == 3 - " Remote mkdir: using ftp + machine, id, passwd, and fname (ie. no .netrc) - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) -" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) - if exists("b:netrw_fname") -" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("")) - let remotepath= b:netrw_fname - else - let remotepath= "" - endif - call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"') - NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - endif - - let @@= ykeep -" call Dret("s:NetrwMakeDir") -endfun - -" --------------------------------------------------------------------- -" s:TreeSqueezeDir: allows a shift-cr (gvim only) to squeeze the current tree-listing directory {{{2 -fun! s:TreeSqueezeDir(islocal) -" call Dfunc("s:TreeSqueezeDir(islocal=".a:islocal.")") - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") - " its a tree-listing style - let curdepth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') - let stopline = (exists("w:netrw_bannercnt")? (w:netrw_bannercnt + 1) : 1) - let depth = strchars(substitute(curdepth,' ','','g')) - let srch = -1 -" call Decho("curdepth<".curdepth.'>','~'.expand("")) -" call Decho("depth =".depth,'~'.expand("")) -" call Decho("stopline#".stopline,'~'.expand("")) -" call Decho("curline#".line(".")."<".getline('.').'>','~'.expand("")) - if depth >= 2 - NetrwKeepj norm! 0 - let curdepthm1= substitute(curdepth,'^'.s:treedepthstring,'','') - let srch = search('^'.curdepthm1.'\%('.s:treedepthstring.'\)\@!','bW',stopline) -" call Decho("curdepthm1<".curdepthm1.'>','~'.expand("")) -" call Decho("case depth>=2: srch<".srch.'>','~'.expand("")) - elseif depth == 1 - NetrwKeepj norm! 0 - let treedepthchr= substitute(s:treedepthstring,' ','','') - let srch = search('^[^'.treedepthchr.']','bW',stopline) -" call Decho("case depth==1: srch<".srch.'>','~'.expand("")) - endif - if srch > 0 -" call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("")) - call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord())) - exe srch - endif - endif -" call Dret("s:TreeSqueezeDir") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMaps: {{{2 -fun! s:NetrwMaps(islocal) -" call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") - - " mouse maps: {{{3 - if g:netrw_mousemaps && g:netrw_retmap -" call Decho("set up Rexplore 2-leftmouse",'~'.expand("")) - if !hasmapto("NetrwReturn") - if maparg("<2-leftmouse>","n") == "" || maparg("<2-leftmouse>","n") =~ '^-$' -" call Decho("making map for 2-leftmouse",'~'.expand("")) - nmap <2-leftmouse> NetrwReturn - elseif maparg("","n") == "" -" call Decho("making map for c-leftmouse",'~'.expand("")) - nmap NetrwReturn - endif - endif - nno NetrwReturn :Rexplore -" call Decho("made NetrwReturn map",'~'.expand("")) - endif - - " generate default maps {{{3 - if !hasmapto('NetrwHide') |nmap a NetrwHide_a|endif - if !hasmapto('NetrwBrowseUpDir') |nmap - NetrwBrowseUpDir|endif - if !hasmapto('NetrwOpenFile') |nmap % NetrwOpenFile|endif - if !hasmapto('NetrwBadd_cb') |nmap cb NetrwBadd_cb|endif - if !hasmapto('NetrwBadd_cB') |nmap cB NetrwBadd_cB|endif - if !hasmapto('NetrwLcd') |nmap cd NetrwLcd|endif - if !hasmapto('NetrwSetChgwin') |nmap C NetrwSetChgwin|endif - if !hasmapto('NetrwRefresh') |nmap NetrwRefresh|endif - if !hasmapto('NetrwLocalBrowseCheck') |nmap NetrwLocalBrowseCheck|endif - if !hasmapto('NetrwServerEdit') |nmap NetrwServerEdit|endif - if !hasmapto('NetrwMakeDir') |nmap d NetrwMakeDir|endif - if !hasmapto('NetrwBookHistHandler_gb')|nmap gb NetrwBookHistHandler_gb|endif -" --------------------------------------------------------------------- -" if !hasmapto('NetrwForceChgDir') |nmap gd NetrwForceChgDir|endif -" if !hasmapto('NetrwForceFile') |nmap gf NetrwForceFile|endif -" if !hasmapto('NetrwHidden') |nmap gh NetrwHidden|endif -" if !hasmapto('NetrwSetTreetop') |nmap gn NetrwSetTreetop|endif -" if !hasmapto('NetrwChgPerm') |nmap gp NetrwChgPerm|endif -" if !hasmapto('NetrwBannerCtrl') |nmap I NetrwBannerCtrl|endif -" if !hasmapto('NetrwListStyle') |nmap i NetrwListStyle|endif -" if !hasmapto('NetrwMarkMoveMF2Arglist')|nmap ma NetrwMarkMoveMF2Arglist|endif -" if !hasmapto('NetrwMarkMoveArglist2MF')|nmap mA NetrwMarkMoveArglist2MF|endif -" if !hasmapto('NetrwBookHistHandler_mA')|nmap mb NetrwBookHistHandler_mA|endif -" if !hasmapto('NetrwBookHistHandler_mB')|nmap mB NetrwBookHistHandler_mB|endif -" if !hasmapto('NetrwMarkFileCopy') |nmap mc NetrwMarkFileCopy|endif -" if !hasmapto('NetrwMarkFileDiff') |nmap md NetrwMarkFileDiff|endif -" if !hasmapto('NetrwMarkFileEdit') |nmap me NetrwMarkFileEdit|endif -" if !hasmapto('NetrwMarkFile') |nmap mf NetrwMarkFile|endif -" if !hasmapto('NetrwUnmarkList') |nmap mF NetrwUnmarkList|endif -" if !hasmapto('NetrwMarkFileGrep') |nmap mg NetrwMarkFileGrep|endif -" if !hasmapto('NetrwMarkHideSfx') |nmap mh NetrwMarkHideSfx|endif -" if !hasmapto('NetrwMarkFileMove') |nmap mm NetrwMarkFileMove|endif -" if !hasmapto('NetrwMarkFileRegexp') |nmap mr NetrwMarkFileRegexp|endif -" if !hasmapto('NetrwMarkFileSource') |nmap ms NetrwMarkFileSource|endif -" if !hasmapto('NetrwMarkFileTag') |nmap mT NetrwMarkFileTag|endif -" if !hasmapto('NetrwMarkFileTgt') |nmap mt NetrwMarkFileTgt|endif -" if !hasmapto('NetrwUnMarkFile') |nmap mu NetrwUnMarkFile|endif -" if !hasmapto('NetrwMarkFileVimCmd') |nmap mv NetrwMarkFileVimCmd|endif -" if !hasmapto('NetrwMarkFileExe_mx') |nmap mx NetrwMarkFileExe_mx|endif -" if !hasmapto('NetrwMarkFileExe_mX') |nmap mX NetrwMarkFileExe_mX|endif -" if !hasmapto('NetrwMarkFileCompress') |nmap mz NetrwMarkFileCompress|endif -" if !hasmapto('NetrwObtain') |nmap O NetrwObtain|endif -" if !hasmapto('NetrwSplit_o') |nmap o NetrwSplit_o|endif -" if !hasmapto('NetrwPreview') |nmap p NetrwPreview|endif -" if !hasmapto('NetrwPrevWinOpen') |nmap P NetrwPrevWinOpen|endif -" if !hasmapto('NetrwBookHistHandler_qb')|nmap qb NetrwBookHistHandler_qb|endif -" if !hasmapto('NetrwFileInfo') |nmap qf NetrwFileInfo|endif -" if !hasmapto('NetrwMarkFileQFEL_qF') |nmap qF NetrwMarkFileQFEL_qF|endif -" if !hasmapto('NetrwMarkFileQFEL_qL') |nmap qL NetrwMarkFileQFEL_qL|endif -" if !hasmapto('NetrwSortStyle') |nmap s NetrwSortStyle|endif -" if !hasmapto('NetSortSequence') |nmap S NetSortSequence|endif -" if !hasmapto('NetrwSetTgt_Tb') |nmap Tb NetrwSetTgt_Tb|endif -" if !hasmapto('NetrwSetTgt_Th') |nmap Th NetrwSetTgt_Th|endif -" if !hasmapto('NetrwSplit_t') |nmap t NetrwSplit_t|endif -" if !hasmapto('NetrwBookHistHandler_u') |nmap u NetrwBookHistHandler_u|endif -" if !hasmapto('NetrwBookHistHandler_U') |nmap U NetrwBookHistHandler_U|endif -" if !hasmapto('NetrwSplit_v') |nmap v NetrwSplit_v|endif -" if !hasmapto('NetrwBrowseX') |nmap x NetrwBrowseX|endif -" if !hasmapto('NetrwLocalExecute') |nmap X NetrwLocalExecute|endif - - if a:islocal -" call Decho("make local maps",'~'.expand("")) - " local normal-mode maps {{{3 - nnoremap NetrwHide_a :call NetrwHide(1) - nnoremap NetrwBrowseUpDir :call NetrwBrowseUpDir(1) - nnoremap NetrwOpenFile :call NetrwOpenFile(1) - nnoremap NetrwBadd_cb :call NetrwBadd(1,0) - nnoremap NetrwBadd_cB :call NetrwBadd(1,1) - nnoremap NetrwLcd :call NetrwLcd(b:netrw_curdir) - nnoremap NetrwSetChgwin :call NetrwSetChgwin() - nnoremap NetrwLocalBrowseCheck :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) - nnoremap NetrwServerEdit :call NetrwServerEdit(3,NetrwGetWord()) - nnoremap NetrwMakeDir :call NetrwMakeDir("") - nnoremap NetrwBookHistHandler_gb :call NetrwBookHistHandler(1,b:netrw_curdir) -" --------------------------------------------------------------------- - nnoremap gd :call NetrwForceChgDir(1,NetrwGetWord()) - nnoremap gf :call NetrwForceFile(1,NetrwGetWord()) - nnoremap gh :call NetrwHidden(1) - nnoremap gn :call netrw#SetTreetop(0,NetrwGetWord()) - nnoremap gp :call NetrwChgPerm(1,b:netrw_curdir) - nnoremap I :call NetrwBannerCtrl(1) - nnoremap i :call NetrwListStyle(1) - nnoremap ma :call NetrwMarkFileArgList(1,0) - nnoremap mA :call NetrwMarkFileArgList(1,1) - nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - nnoremap mc :call NetrwMarkFileCopy(1) - nnoremap md :call NetrwMarkFileDiff(1) - nnoremap me :call NetrwMarkFileEdit(1) - nnoremap mf :call NetrwMarkFile(1,NetrwGetWord()) - nnoremap mF :call NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - nnoremap mg :call NetrwMarkFileGrep(1) - nnoremap mh :call NetrwMarkHideSfx(1) - nnoremap mm :call NetrwMarkFileMove(1) - nnoremap mr :call NetrwMarkFileRegexp(1) - nnoremap ms :call NetrwMarkFileSource(1) - nnoremap mT :call NetrwMarkFileTag(1) - nnoremap mt :call NetrwMarkFileTgt(1) - nnoremap mu :call NetrwUnMarkFile(1) - nnoremap mv :call NetrwMarkFileVimCmd(1) - nnoremap mx :call NetrwMarkFileExe(1,0) - nnoremap mX :call NetrwMarkFileExe(1,1) - nnoremap mz :call NetrwMarkFileCompress(1) - nnoremap O :call NetrwObtain(1) - nnoremap o :call NetrwSplit(3) - nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - nnoremap P :call NetrwPrevWinOpen(1) - nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - nnoremap qf :call NetrwFileInfo(1,NetrwGetWord()) - nnoremap qF :call NetrwMarkFileQFEL(1,getqflist()) - nnoremap qL :call NetrwMarkFileQFEL(1,getloclist(v:count)) - nnoremap s :call NetrwSortStyle(1) - nnoremap S :call NetSortSequence(1) - nnoremap Tb :call NetrwSetTgt(1,'b',v:count1) - nnoremap t :call NetrwSplit(4) - nnoremap Th :call NetrwSetTgt(1,'h',v:count) - nnoremap u :call NetrwBookHistHandler(4,expand("%")) - nnoremap U :call NetrwBookHistHandler(5,expand("%")) - nnoremap v :call NetrwSplit(5) - nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" - nnoremap X :call NetrwLocalExecute(expand(""))" - - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) - if !hasmapto('NetrwHideEdit') - nmap NetrwHideEdit - endif - nnoremap NetrwHideEdit :call NetrwHideEdit(1) - if !hasmapto('NetrwRefresh') - nmap NetrwRefresh - endif - nnoremap NetrwRefresh :call NetrwRefresh(1,NetrwBrowseChgDir(1,(exists("w:netrw_liststyle") && exists("w:netrw_treetop") && w:netrw_liststyle == 3)? w:netrw_treetop : './')) - if s:didstarstar || !mapcheck("","n") - nnoremap :Nexplore - endif - if s:didstarstar || !mapcheck("","n") - nnoremap :Pexplore - endif - if !hasmapto('NetrwTreeSqueeze') - nmap NetrwTreeSqueeze - endif - nnoremap NetrwTreeSqueeze :call TreeSqueezeDir(1) - let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) - if g:netrw_mousemaps == 1 - nmap NetrwLeftmouse - nmap NetrwCLeftmouse - nmap NetrwMiddlemouse - nmap NetrwSLeftmouse - nmap NetrwSLeftdrag - nmap <2-leftmouse> Netrw2Leftmouse - imap ILeftmouse - imap IMiddlemouse - nno NetrwLeftmouse :exec "norm! \leftmouse>"call NetrwLeftmouse(1) - nno NetrwCLeftmouse :exec "norm! \leftmouse>"call NetrwCLeftmouse(1) - nno NetrwMiddlemouse :exec "norm! \leftmouse>"call NetrwPrevWinOpen(1) - nno NetrwSLeftmouse :exec "norm! \leftmouse>"call NetrwSLeftmouse(1) - nno NetrwSLeftdrag :exec "norm! \leftmouse>"call NetrwSLeftdrag(1) - nmap Netrw2Leftmouse - - exe 'nnoremap :exec "norm! \leftmouse>"call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'vnoremap :exec "norm! \leftmouse>"call NetrwLocalRm("'.mapsafecurdir.'")' - endif - exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'nnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'nnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' - exe 'nnoremap d :call NetrwMakeDir("")' - exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'vnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'vnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' - nnoremap :he netrw-quickhelp - - " support user-specified maps - call netrw#UserMaps(1) - - else - " remote normal-mode maps {{{3 -" call Decho("make remote maps",'~'.expand("")) - call s:RemotePathAnalysis(b:netrw_curdir) - nnoremap NetrwHide_a :call NetrwHide(0) - nnoremap NetrwBrowseUpDir :call NetrwBrowseUpDir(0) - nnoremap NetrwOpenFile :call NetrwOpenFile(0) - nnoremap NetrwBadd_cb :call NetrwBadd(0,0) - nnoremap NetrwBadd_cB :call NetrwBadd(0,1) - nnoremap NetrwLcd :call NetrwLcd(b:netrw_curdir) - nnoremap NetrwSetChgwin :call NetrwSetChgwin() - nnoremap NetrwRefresh :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) - nnoremap NetrwLocalBrowseCheck :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) - nnoremap NetrwServerEdit :call NetrwServerEdit(2,NetrwGetWord()) - nnoremap NetrwBookHistHandler_gb :call NetrwBookHistHandler(1,b:netrw_curdir) -" --------------------------------------------------------------------- - nnoremap gd :call NetrwForceChgDir(0,NetrwGetWord()) - nnoremap gf :call NetrwForceFile(0,NetrwGetWord()) - nnoremap gh :call NetrwHidden(0) - nnoremap gp :call NetrwChgPerm(0,b:netrw_curdir) - nnoremap I :call NetrwBannerCtrl(1) - nnoremap i :call NetrwListStyle(0) - nnoremap ma :call NetrwMarkFileArgList(0,0) - nnoremap mA :call NetrwMarkFileArgList(0,1) - nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - nnoremap mc :call NetrwMarkFileCopy(0) - nnoremap md :call NetrwMarkFileDiff(0) - nnoremap me :call NetrwMarkFileEdit(0) - nnoremap mf :call NetrwMarkFile(0,NetrwGetWord()) - nnoremap mF :call NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - nnoremap mg :call NetrwMarkFileGrep(0) - nnoremap mh :call NetrwMarkHideSfx(0) - nnoremap mm :call NetrwMarkFileMove(0) - nnoremap mr :call NetrwMarkFileRegexp(0) - nnoremap ms :call NetrwMarkFileSource(0) - nnoremap mT :call NetrwMarkFileTag(0) - nnoremap mt :call NetrwMarkFileTgt(0) - nnoremap mu :call NetrwUnMarkFile(0) - nnoremap mv :call NetrwMarkFileVimCmd(0) - nnoremap mx :call NetrwMarkFileExe(0,0) - nnoremap mX :call NetrwMarkFileExe(0,1) - nnoremap mz :call NetrwMarkFileCompress(0) - nnoremap O :call NetrwObtain(0) - nnoremap o :call NetrwSplit(0) - nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - nnoremap P :call NetrwPrevWinOpen(0) - nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - nnoremap qf :call NetrwFileInfo(0,NetrwGetWord()) - nnoremap qF :call NetrwMarkFileQFEL(0,getqflist()) - nnoremap qL :call NetrwMarkFileQFEL(0,getloclist(v:count)) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) - nnoremap s :call NetrwSortStyle(0) - nnoremap S :call NetSortSequence(0) - nnoremap Tb :call NetrwSetTgt(0,'b',v:count1) - nnoremap t :call NetrwSplit(1) - nnoremap Th :call NetrwSetTgt(0,'h',v:count) - nnoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) - nnoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) - nnoremap v :call NetrwSplit(2) - nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) - if !hasmapto('NetrwHideEdit') - nmap NetrwHideEdit - endif - nnoremap NetrwHideEdit :call NetrwHideEdit(0) - if !hasmapto('NetrwRefresh') - nmap NetrwRefresh - endif - if !hasmapto('NetrwTreeSqueeze') - nmap NetrwTreeSqueeze - endif - nnoremap NetrwTreeSqueeze :call TreeSqueezeDir(0) - - let mapsafepath = escape(s:path, s:netrw_map_escape) - let mapsafeusermach = escape(((s:user == "")? "" : s:user."@").s:machine, s:netrw_map_escape) - - nnoremap NetrwRefresh :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) - if g:netrw_mousemaps == 1 - nmap NetrwLeftmouse - nno NetrwLeftmouse :exec "norm! \leftmouse>"call NetrwLeftmouse(0) - nmap NetrwCLeftmouse - nno NetrwCLeftmouse :exec "norm! \leftmouse>"call NetrwCLeftmouse(0) - nmap NetrwSLeftmouse - nno NetrwSLeftmouse :exec "norm! \leftmouse>"call NetrwSLeftmouse(0) - nmap NetrwSLeftdrag - nno NetrwSLeftdrag :exec "norm! \leftmouse>"call NetrwSLeftdrag(0) - nmap NetrwMiddlemouse - nno NetrwMiddlemouse :exec "norm! \leftmouse>"call NetrwPrevWinOpen(0) - nmap <2-leftmouse> Netrw2Leftmouse - nmap Netrw2Leftmouse - - imap ILeftmouse - imap IMiddlemouse - imap ISLeftmouse - exe 'nnoremap :exec "norm! \leftmouse>"call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap :exec "norm! \leftmouse>"call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - endif - exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'nnoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' - exe 'nnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'nnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' - nnoremap :he netrw-quickhelp - - " support user-specified maps - call netrw#UserMaps(0) - endif " }}}3 - -" call Dret("s:NetrwMaps") -endfun - -" --------------------------------------------------------------------- -" s:NetrwCommands: set up commands {{{2 -" If -buffer, the command is only available from within netrw buffers -" Otherwise, the command is available from any window, so long as netrw -" has been used at least once in the session. -fun! s:NetrwCommands(islocal) -" call Dfunc("s:NetrwCommands(islocal=".a:islocal.")") - - com! -nargs=* -complete=file -bang NetrwMB call s:NetrwBookmark(0,) - com! -nargs=* NetrwC call s:NetrwSetChgwin() - com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"win#".winnr()." not a former netrw window",79)|endif - if a:islocal - com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(1,) - else - com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(0,) - endif - com! -buffer -nargs=? -complete=file MT call s:NetrwMarkTarget() - -" call Dret("s:NetrwCommands") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFiles: apply s:NetrwMarkFile() to named file(s) {{{2 -" glob()ing only works with local files -fun! s:NetrwMarkFiles(islocal,...) -" call Dfunc("s:NetrwMarkFiles(islocal=".a:islocal."...) a:0=".a:0) - let curdir = s:NetrwGetCurdir(a:islocal) - let i = 1 - while i <= a:0 - if a:islocal - if v:version > 704 || (v:version == 704 && has("patch656")) - let mffiles= glob(a:{i},0,1,1) - else - let mffiles= glob(a:{i},0,1) - endif - else - let mffiles= [a:{i}] - endif -" call Decho("mffiles".string(mffiles),'~'.expand("")) - for mffile in mffiles -" call Decho("mffile<".mffile.">",'~'.expand("")) - call s:NetrwMarkFile(a:islocal,mffile) - endfor - let i= i + 1 - endwhile -" call Dret("s:NetrwMarkFiles") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkTarget: implements :MT (mark target) {{{2 -fun! s:NetrwMarkTarget(...) -" call Dfunc("s:NetrwMarkTarget() a:0=".a:0) - if a:0 == 0 || (a:0 == 1 && a:1 == "") - let curdir = s:NetrwGetCurdir(1) - let tgt = b:netrw_curdir - else - let curdir = s:NetrwGetCurdir((a:1 =~ '^\a\{3,}://')? 0 : 1) - let tgt = a:1 - endif -" call Decho("tgt<".tgt.">",'~'.expand("")) - let s:netrwmftgt = tgt - let s:netrwmftgt_islocal = tgt !~ '^\a\{3,}://' - let curislocal = b:netrw_curdir !~ '^\a\{3,}://' - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - call s:NetrwRefresh(curislocal,s:NetrwBrowseChgDir(curislocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - call winrestview(svpos) -" call Dret("s:NetrwMarkTarget") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFile: (invoked by mf) This function is used to both {{{2 -" mark and unmark files. If a markfile list exists, -" then the rename and delete functions will use it instead -" of whatever may happen to be under the cursor at that -" moment. When the mouse and gui are available, -" shift-leftmouse may also be used to mark files. -" -" Creates two lists -" s:netrwmarkfilelist -- holds complete paths to all marked files -" s:netrwmarkfilelist_# -- holds list of marked files in current-buffer's directory (#==bufnr()) -" -" Creates a marked file match string -" s:netrwmarfilemtch_# -- used with 2match to display marked files -" -" Creates a buffer version of islocal -" b:netrw_islocal -fun! s:NetrwMarkFile(islocal,fname) -" call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") -" call Decho("bufnr(%)=".bufnr("%").": ".bufname("%"),'~'.expand("")) - - " sanity check - if empty(a:fname) -" call Dret("s:NetrwMarkFile : empty fname") - return - endif - let curdir = s:NetrwGetCurdir(a:islocal) - - let ykeep = @@ - let curbufnr= bufnr("%") - if a:fname =~ '^\a' - let leader= '\<' - else - let leader= '' - endif - if a:fname =~ '\a$' - let trailer = '\>[@=|\/\*]\=\ze\%( \|\t\|$\)' - else - let trailer = '[@=|\/\*]\=\ze\%( \|\t\|$\)' - endif - - if exists("s:netrwmarkfilelist_".curbufnr) - " markfile list pre-exists -" call Decho("case s:netrwmarkfilelist_".curbufnr." already exists",'~'.expand("")) -" call Decho("starting s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) -" call Decho("starting s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("")) - let b:netrw_islocal= a:islocal - - if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1 - " append filename to buffer's markfilelist -" call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) - call add(s:netrwmarkfilelist_{curbufnr},a:fname) - let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|'.leader.escape(a:fname,g:netrw_markfileesc).trailer - - else - " remove filename from buffer's markfilelist -" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) - call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname') - if s:netrwmarkfilelist_{curbufnr} == [] - " local markfilelist is empty; remove it entirely -" call Decho("markfile list now empty",'~'.expand("")) - call s:NetrwUnmarkList(curbufnr,curdir) - else - " rebuild match list to display markings correctly -" call Decho("rebuild s:netrwmarkfilemtch_".curbufnr,'~'.expand("")) - let s:netrwmarkfilemtch_{curbufnr}= "" - let first = 1 - for fname in s:netrwmarkfilelist_{curbufnr} - if first - let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.leader.escape(fname,g:netrw_markfileesc).trailer - else - let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|'.leader.escape(fname,g:netrw_markfileesc).trailer - endif - let first= 0 - endfor -" call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) - endif - endif - - else - " initialize new markfilelist -" call Decho("case: initialize new markfilelist",'~'.expand("")) - -" call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr,'~'.expand("")) - let s:netrwmarkfilelist_{curbufnr}= [] - call add(s:netrwmarkfilelist_{curbufnr},substitute(a:fname,'[|@]$','','')) -" call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) - - " build initial markfile matching pattern - if a:fname =~ '/$' - let s:netrwmarkfilemtch_{curbufnr}= leader.escape(a:fname,g:netrw_markfileesc) - else - let s:netrwmarkfilemtch_{curbufnr}= leader.escape(a:fname,g:netrw_markfileesc).trailer - endif -" call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("")) - endif - - " handle global markfilelist - if exists("s:netrwmarkfilelist") - let dname= s:ComposePath(b:netrw_curdir,a:fname) - if index(s:netrwmarkfilelist,dname) == -1 - " append new filename to global markfilelist - call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname)) -" call Decho("append filename<".a:fname."> to global s:markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("")) - else - " remove new filename from global markfilelist -" call Decho("remove new filename from global s:markfilelist",'~'.expand("")) -" call Decho("..filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("")) - call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"') -" call Decho("..ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("")) - if s:netrwmarkfilelist == [] -" call Decho("s:netrwmarkfilelist is empty; unlet it",'~'.expand("")) - unlet s:netrwmarkfilelist - endif - endif - else - " initialize new global-directory markfilelist - let s:netrwmarkfilelist= [] - call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname)) -" call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("")) - endif - - " set up 2match'ing to netrwmarkfilemtch_# list - if has("syntax") && exists("g:syntax_on") && g:syntax_on - if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != "" -" " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/",'~'.expand("")) - if exists("g:did_drchip_netrwlist_syntax") - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" - endif - else -" " call Decho("2match none",'~'.expand("")) - 2match none - endif - endif - let @@= ykeep -" call Decho("s:netrwmarkfilelist[".(exists("s:netrwmarkfilelist")? string(s:netrwmarkfilelist) : "")."] (avail in all buffers)",'~'.expand("")) -" call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist")."> (buf#".curbufnr."list)") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileArgList: ma: move the marked file list to the argument list (tomflist=0) {{{2 -" mA: move the argument list to marked file list (tomflist=1) -" Uses the global marked file list -fun! s:NetrwMarkFileArgList(islocal,tomflist) -" call Dfunc("s:NetrwMarkFileArgList(islocal=".a:islocal.",tomflist=".a:tomflist.")") - - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curdir = s:NetrwGetCurdir(a:islocal) - let curbufnr = bufnr("%") - - if a:tomflist - " mA: move argument list to marked file list - while argc() - let fname= argv(0) -" call Decho("exe argdel ".fname,'~'.expand("")) - exe "argdel ".fnameescape(fname) - call s:NetrwMarkFile(a:islocal,fname) - endwhile - - else - " ma: move marked file list to argument list - if exists("s:netrwmarkfilelist") - - " for every filename in the marked list - for fname in s:netrwmarkfilelist -" call Decho("exe argadd ".fname,'~'.expand("")) - exe "argadd ".fnameescape(fname) - endfor " for every file in the marked list - - " unmark list and refresh - call s:NetrwUnmarkList(curbufnr,curdir) - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - endif - endif - -" call Dret("s:NetrwMarkFileArgList") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileCompress: (invoked by mz) This function is used to {{{2 -" compress/decompress files using the programs -" in g:netrw_compress and g:netrw_uncompress, -" using g:netrw_compress_suffix to know which to -" do. By default: -" g:netrw_compress = "gzip" -" g:netrw_decompress = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf", ".xz" : "unxz"} -fun! s:NetrwMarkFileCompress(islocal) -" call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curdir = s:NetrwGetCurdir(a:islocal) - let curbufnr = bufnr("%") - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileCompress") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - - if exists("s:netrwmarkfilelist_{curbufnr}") && exists("g:netrw_compress") && exists("g:netrw_decompress") - - " for every filename in the marked list - for fname in s:netrwmarkfilelist_{curbufnr} - let sfx= substitute(fname,'^.\{-}\(\.\a\+\)$','\1','') -" call Decho("extracted sfx<".sfx.">",'~'.expand("")) - if exists("g:netrw_decompress['".sfx."']") - " fname has a suffix indicating that its compressed; apply associated decompression routine - let exe= g:netrw_decompress[sfx] -" call Decho("fname<".fname."> is compressed so decompress with <".exe.">",'~'.expand("")) - let exe= netrw#WinPath(exe) - if a:islocal - if g:netrw_keepdir - let fname= s:ShellEscape(s:ComposePath(curdir,fname)) - endif - call system(exe." ".fname) - if v:shell_error - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) - endif - else - let fname= s:ShellEscape(b:netrw_curdir.fname,1) - NetrwKeepj call s:RemoteSystem(exe." ".fname) - endif - - endif - unlet sfx - - if exists("exe") - unlet exe - elseif a:islocal - " fname not a compressed file, so compress it - call system(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,fname))) - if v:shell_error - call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_compress<".g:netrw_compress."> to something that works",104) - endif - else - " fname not a compressed file, so compress it - NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(fname)) - endif - endfor " for every file in the marked list - - call s:NetrwUnmarkList(curbufnr,curdir) - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - endif -" call Dret("s:NetrwMarkFileCompress") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileCopy: (invoked by mc) copy marked files to target {{{2 -" If no marked files, then set up directory as the -" target. Currently does not support copying entire -" directories. Uses the local-buffer marked file list. -" Returns 1=success (used by NetrwMarkFileMove()) -" 0=failure -fun! s:NetrwMarkFileCopy(islocal,...) -" call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---')."> a:0=".a:0) - - let curdir = s:NetrwGetCurdir(a:islocal) - let curbufnr = bufnr("%") - if b:netrw_curdir !~ '/$' - if !exists("b:netrw_curdir") - let b:netrw_curdir= curdir - endif - let b:netrw_curdir= b:netrw_curdir."/" - endif - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileCopy") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - - if !exists("s:netrwmftgt") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67) -" call Dret("s:NetrwMarkFileCopy 0") - return 0 - endif -" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) - - if a:islocal && s:netrwmftgt_islocal - " Copy marked files, local directory to local directory -" call Decho("copy from local to local",'~'.expand("")) - if !executable(g:netrw_localcopycmd) - call netrw#ErrorMsg(s:ERROR,"g:netrw_localcopycmd<".g:netrw_localcopycmd."> not executable on your system, aborting",91) -" call Dfunc("s:NetrwMarkFileMove : g:netrw_localcopycmd<".g:netrw_localcopycmd."> n/a!") - return - endif - - " copy marked files while within the same directory (ie. allow renaming) - if simplify(s:netrwmftgt) == simplify(b:netrw_curdir) - if len(s:netrwmarkfilelist_{bufnr('%')}) == 1 - " only one marked file -" call Decho("case: only one marked file",'~'.expand("")) - let args = s:ShellEscape(b:netrw_curdir.s:netrwmarkfilelist_{bufnr('%')}[0]) - let oldname = s:netrwmarkfilelist_{bufnr('%')}[0] - elseif a:0 == 1 -" call Decho("case: handling one input argument",'~'.expand("")) - " this happens when the next case was used to recursively call s:NetrwMarkFileCopy() - let args = s:ShellEscape(b:netrw_curdir.a:1) - let oldname = a:1 - else - " copy multiple marked files inside the same directory -" call Decho("case: handling a multiple marked files",'~'.expand("")) - let s:recursive= 1 - for oldname in s:netrwmarkfilelist_{bufnr("%")} - let ret= s:NetrwMarkFileCopy(a:islocal,oldname) - if ret == 0 - break - endif - endfor - unlet s:recursive - call s:NetrwUnmarkList(curbufnr,curdir) -" call Dret("s:NetrwMarkFileCopy ".ret) - return ret - endif - - call inputsave() - let newname= input("Copy ".oldname." to : ",oldname,"file") - call inputrestore() - if newname == "" -" call Dret("s:NetrwMarkFileCopy 0") - return 0 - endif - let args= s:ShellEscape(oldname) - let tgt = s:ShellEscape(s:netrwmftgt.'/'.newname) - else - let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"s:ShellEscape(b:netrw_curdir.\"/\".v:val)")) - let tgt = s:ShellEscape(s:netrwmftgt) - endif - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - let args= substitute(args,'/','\\','g') - let tgt = substitute(tgt, '/','\\','g') - endif - if args =~ "'" |let args= substitute(args,"'\\(.*\\)'",'\1','')|endif - if tgt =~ "'" |let tgt = substitute(tgt ,"'\\(.*\\)'",'\1','')|endif - if args =~ '//'|let args= substitute(args,'//','/','g')|endif - if tgt =~ '//'|let tgt = substitute(tgt ,'//','/','g')|endif -" call Decho("args <".args.">",'~'.expand("")) -" call Decho("tgt <".tgt.">",'~'.expand("")) - if isdirectory(s:NetrwFile(args)) -" call Decho("args<".args."> is a directory",'~'.expand("")) - let copycmd= g:netrw_localcopydircmd -" call Decho("using copydircmd<".copycmd.">",'~'.expand("")) - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - " window's xcopy doesn't copy a directory to a target properly. Instead, it copies a directory's - " contents to a target. One must append the source directory name to the target to get xcopy to - " do the right thing. - let tgt= tgt.'\'.substitute(a:1,'^.*[\\/]','','') -" call Decho("modified tgt for xcopy",'~'.expand("")) - endif - else - let copycmd= g:netrw_localcopycmd - endif - if g:netrw_localcopycmd =~ '\s' - let copycmd = substitute(copycmd,'\s.*$','','') - let copycmdargs = substitute(copycmd,'^.\{-}\(\s.*\)$','\1','') - let copycmd = netrw#WinPath(copycmd).copycmdargs - else - let copycmd = netrw#WinPath(copycmd) - endif -" call Decho("args <".args.">",'~'.expand("")) -" call Decho("tgt <".tgt.">",'~'.expand("")) -" call Decho("copycmd<".copycmd.">",'~'.expand("")) -" call Decho("system(".copycmd." '".args."' '".tgt."')",'~'.expand("")) - call system(copycmd.g:netrw_localcopycmdopt." '".args."' '".tgt."'") - if v:shell_error != 0 - if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir - call netrw#ErrorMsg(s:ERROR,"copy failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",101) - else - call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) - endif -" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".s:ShellEscape(s:netrwmftgt)) - return 0 - endif - - elseif a:islocal && !s:netrwmftgt_islocal - " Copy marked files, local directory to remote directory -" call Decho("copy from local to remote",'~'.expand("")) - NetrwKeepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) - - elseif !a:islocal && s:netrwmftgt_islocal - " Copy marked files, remote directory to local directory -" call Decho("copy from remote to local",'~'.expand("")) - NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) - - elseif !a:islocal && !s:netrwmftgt_islocal - " Copy marked files, remote directory to remote directory -" call Decho("copy from remote to remote",'~'.expand("")) - let curdir = getcwd() - let tmpdir = s:GetTempfile("") - if tmpdir !~ '/' - let tmpdir= curdir."/".tmpdir - endif - if exists("*mkdir") - call mkdir(tmpdir) - else - call s:NetrwExe("sil! !".g:netrw_localmkdir.g:netrw_localmkdiropt.' '.s:ShellEscape(tmpdir,1)) - if v:shell_error != 0 - call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) -" call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1) ) - return - endif - endif - if isdirectory(s:NetrwFile(tmpdir)) - if s:NetrwLcd(tmpdir) -" call Dret("s:NetrwMarkFileCopy : lcd failure") - return - endif - NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) - let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")') - NetrwKeepj call s:NetrwUpload(localfiles,s:netrwmftgt) - if getcwd() == tmpdir - for fname in s:netrwmarkfilelist_{bufnr('%')} - NetrwKeepj call s:NetrwDelete(fname) - endfor - if s:NetrwLcd(curdir) -" call Dret("s:NetrwMarkFileCopy : lcd failure") - return - endif - if delete(tmpdir,"d") - call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103) - endif - else - if s:NetrwLcd(curdir) -" call Dret("s:NetrwMarkFileCopy : lcd failure") - return - endif - endif - endif - endif - - " ------- - " cleanup - " ------- -" call Decho("cleanup",'~'.expand("")) - " remove markings from local buffer - call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer -" call Decho(" g:netrw_fastbrowse =".g:netrw_fastbrowse,'~'.expand("")) -" call Decho(" s:netrwmftgt =".s:netrwmftgt,'~'.expand("")) -" call Decho(" s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("")) -" call Decho(" curdir =".curdir,'~'.expand("")) -" call Decho(" a:islocal =".a:islocal,'~'.expand("")) -" call Decho(" curbufnr =".curbufnr,'~'.expand("")) - if exists("s:recursive") -" call Decho(" s:recursive =".s:recursive,'~'.expand("")) - else -" call Decho(" s:recursive =n/a",'~'.expand("")) - endif - " see s:LocalFastBrowser() for g:netrw_fastbrowse interpretation (refreshing done for both slow and medium) - if g:netrw_fastbrowse <= 1 - NetrwKeepj call s:LocalBrowseRefresh() - else - " refresh local and targets for fast browsing - if !exists("s:recursive") - " remove markings from local buffer -" call Decho(" remove markings from local buffer",'~'.expand("")) - NetrwKeepj call s:NetrwUnmarkList(curbufnr,curdir) - endif - - " refresh buffers - if s:netrwmftgt_islocal -" call Decho(" refresh s:netrwmftgt=".s:netrwmftgt,'~'.expand("")) - NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) - endif - if a:islocal && s:netrwmftgt != curdir -" call Decho(" refresh curdir=".curdir,'~'.expand("")) - NetrwKeepj call s:NetrwRefreshDir(a:islocal,curdir) - endif - endif - -" call Dret("s:NetrwMarkFileCopy 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileDiff: (invoked by md) This function is used to {{{2 -" invoke vim's diff mode on the marked files. -" Either two or three files can be so handled. -" Uses the global marked file list. -fun! s:NetrwMarkFileDiff(islocal) -" call Dfunc("s:NetrwMarkFileDiff(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") - let curbufnr= bufnr("%") - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileDiff") - return - endif - let curdir= s:NetrwGetCurdir(a:islocal) -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - - if exists("s:netrwmarkfilelist_{".curbufnr."}") - let cnt = 0 - for fname in s:netrwmarkfilelist - let cnt= cnt + 1 - if cnt == 1 -" call Decho("diffthis: fname<".fname.">",'~'.expand("")) - exe "NetrwKeepj e ".fnameescape(fname) - diffthis - elseif cnt == 2 || cnt == 3 - below vsplit -" call Decho("diffthis: ".fname,'~'.expand("")) - exe "NetrwKeepj e ".fnameescape(fname) - diffthis - else - break - endif - endfor - call s:NetrwUnmarkList(curbufnr,curdir) - endif - -" call Dret("s:NetrwMarkFileDiff") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileEdit: (invoked by me) put marked files on arg list and start editing them {{{2 -" Uses global markfilelist -fun! s:NetrwMarkFileEdit(islocal) -" call Dfunc("s:NetrwMarkFileEdit(islocal=".a:islocal.")") - - let curdir = s:NetrwGetCurdir(a:islocal) - let curbufnr = bufnr("%") - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileEdit") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - - if exists("s:netrwmarkfilelist_{curbufnr}") - call s:SetRexDir(a:islocal,curdir) - let flist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) - " unmark markedfile list -" call s:NetrwUnmarkList(curbufnr,curdir) - call s:NetrwUnmarkAll() -" call Decho("exe sil args ".flist,'~'.expand("")) - exe "sil args ".flist - endif - echo "(use :bn, :bp to navigate files; :Rex to return)" - -" call Dret("s:NetrwMarkFileEdit") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileQFEL: convert a quickfix-error or location list into a marked file list {{{2 -fun! s:NetrwMarkFileQFEL(islocal,qfel) -" call Dfunc("s:NetrwMarkFileQFEL(islocal=".a:islocal.",qfel)") - call s:NetrwUnmarkAll() - let curbufnr= bufnr("%") - - if !empty(a:qfel) - for entry in a:qfel - let bufnmbr= entry["bufnr"] -" call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"],'~'.expand("")) - if !exists("s:netrwmarkfilelist_{curbufnr}") -" call Decho("case: no marked file list",'~'.expand("")) - call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) - elseif index(s:netrwmarkfilelist_{curbufnr},bufname(bufnmbr)) == -1 - " s:NetrwMarkFile will remove duplicate entries from the marked file list. - " So, this test lets two or more hits on the same pattern to be ignored. -" call Decho("case: ".bufname(bufnmbr)." not currently in marked file list",'~'.expand("")) - call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) - else -" call Decho("case: ".bufname(bufnmbr)." already in marked file list",'~'.expand("")) - endif - endfor - echo "(use me to edit marked files)" - else - call netrw#ErrorMsg(s:WARNING,"can't convert quickfix error list; its empty!",92) - endif - -" call Dret("s:NetrwMarkFileQFEL") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileExe: (invoked by mx and mX) execute arbitrary system command on marked files {{{2 -" mx enbloc=0: Uses the local marked-file list, applies command to each file individually -" mX enbloc=1: Uses the global marked-file list, applies command to entire list -fun! s:NetrwMarkFileExe(islocal,enbloc) -" call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.",enbloc=".a:enbloc.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curdir = s:NetrwGetCurdir(a:islocal) - let curbufnr = bufnr("%") - - if a:enbloc == 0 - " individually apply command to files, one at a time - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileExe") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - - if exists("s:netrwmarkfilelist_{curbufnr}") - " get the command - call inputsave() - let cmd= input("Enter command: ","","file") - call inputrestore() -" call Decho("cmd<".cmd.">",'~'.expand("")) - if cmd == "" -" call Dret("s:NetrwMarkFileExe : early exit, empty command") - return - endif - - " apply command to marked files, individually. Substitute: filename -> % - " If no %, then append a space and the filename to the command - for fname in s:netrwmarkfilelist_{curbufnr} - if a:islocal - if g:netrw_keepdir - let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname))) - endif - else - let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname)) - endif - if cmd =~ '%' - let xcmd= substitute(cmd,'%',fname,'g') - else - let xcmd= cmd.' '.fname - endif - if a:islocal -" call Decho("local: xcmd<".xcmd.">",'~'.expand("")) - let ret= system(xcmd) - else -" call Decho("remote: xcmd<".xcmd.">",'~'.expand("")) - let ret= s:RemoteSystem(xcmd) - endif - if v:shell_error < 0 - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) - break - else - echo ret - endif - endfor - - " unmark marked file list - call s:NetrwUnmarkList(curbufnr,curdir) - - " refresh the listing - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - else - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) - endif - - else " apply command to global list of files, en bloc - - call inputsave() - let cmd= input("Enter command: ","","file") - call inputrestore() -" call Decho("cmd<".cmd.">",'~'.expand("")) - if cmd == "" -" call Dret("s:NetrwMarkFileExe : early exit, empty command") - return - endif - if cmd =~ '%' - let cmd= substitute(cmd,'%',join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' '),'g') - else - let cmd= cmd.' '.join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' ') - endif - if a:islocal - call system(cmd) - if v:shell_error < 0 - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) - endif - else - let ret= s:RemoteSystem(cmd) - endif - call s:NetrwUnmarkAll() - - " refresh the listing - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - - endif - -" call Dret("s:NetrwMarkFileExe") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkHideSfx: (invoked by mh) (un)hide files having same suffix -" as the marked file(s) (toggles suffix presence) -" Uses the local marked file list. -fun! s:NetrwMarkHideSfx(islocal) -" call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curbufnr = bufnr("%") - - " s:netrwmarkfilelist_{curbufnr}: the List of marked files - if exists("s:netrwmarkfilelist_{curbufnr}") - - for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("")) - " construct suffix pattern - if fname =~ '\.' - let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') - else - let sfxpat= '^\%(\%(\.\)\@!.\)*$' - endif - " determine if its in the hiding list or not - let inhidelist= 0 - if g:netrw_list_hide != "" - let itemnum = 0 - let hidelist= split(g:netrw_list_hide,',') - for hidepat in hidelist - if sfxpat == hidepat - let inhidelist= 1 - break - endif - let itemnum= itemnum + 1 - endfor - endif -" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("")) - if inhidelist - " remove sfxpat from list - call remove(hidelist,itemnum) - let g:netrw_list_hide= join(hidelist,",") - elseif g:netrw_list_hide != "" - " append sfxpat to non-empty list - let g:netrw_list_hide= g:netrw_list_hide.",".sfxpat - else - " set hiding list to sfxpat - let g:netrw_list_hide= sfxpat - endif - endfor - - " refresh the listing - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - else - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) - endif - -" call Dret("s:NetrwMarkHideSfx") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileVimCmd: (invoked by mv) execute arbitrary vim command on marked files, one at a time {{{2 -" Uses the local marked-file list. -fun! s:NetrwMarkFileVimCmd(islocal) -" call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curdir = s:NetrwGetCurdir(a:islocal) - let curbufnr = bufnr("%") - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileVimCmd") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - - if exists("s:netrwmarkfilelist_{curbufnr}") - " get the command - call inputsave() - let cmd= input("Enter vim command: ","","file") - call inputrestore() -" call Decho("cmd<".cmd.">",'~'.expand("")) - if cmd == "" -" " call Dret("s:NetrwMarkFileVimCmd : early exit, empty command") - return - endif - - " apply command to marked files. Substitute: filename -> % - " If no %, then append a space and the filename to the command - for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("fname<".fname.">",'~'.expand("")) - if a:islocal - 1split - exe "sil! NetrwKeepj keepalt e ".fnameescape(fname) -" call Decho("local<".fname.">: exe ".cmd,'~'.expand("")) - exe cmd - exe "sil! keepalt wq!" - else -" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET",'~'.expand("")) - echo "sorry, \"mv\" not supported yet for remote files" - endif - endfor - - " unmark marked file list - call s:NetrwUnmarkList(curbufnr,curdir) - - " refresh the listing - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - else - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) - endif - -" call Dret("s:NetrwMarkFileVimCmd") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkHideSfx: (invoked by mh) (un)hide files having same suffix -" as the marked file(s) (toggles suffix presence) -" Uses the local marked file list. -fun! s:NetrwMarkHideSfx(islocal) -" call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curbufnr = bufnr("%") - - " s:netrwmarkfilelist_{curbufnr}: the List of marked files - if exists("s:netrwmarkfilelist_{curbufnr}") - - for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("")) - " construct suffix pattern - if fname =~ '\.' - let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') - else - let sfxpat= '^\%(\%(\.\)\@!.\)*$' - endif - " determine if its in the hiding list or not - let inhidelist= 0 - if g:netrw_list_hide != "" - let itemnum = 0 - let hidelist= split(g:netrw_list_hide,',') - for hidepat in hidelist - if sfxpat == hidepat - let inhidelist= 1 - break - endif - let itemnum= itemnum + 1 - endfor - endif -" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("")) - if inhidelist - " remove sfxpat from list - call remove(hidelist,itemnum) - let g:netrw_list_hide= join(hidelist,",") - elseif g:netrw_list_hide != "" - " append sfxpat to non-empty list - let g:netrw_list_hide= g:netrw_list_hide.",".sfxpat - else - " set hiding list to sfxpat - let g:netrw_list_hide= sfxpat - endif - endfor - - " refresh the listing - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - else - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) - endif - -" call Dret("s:NetrwMarkHideSfx") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileGrep: (invoked by mg) This function applies vimgrep to marked files {{{2 -" Uses the global markfilelist -fun! s:NetrwMarkFileGrep(islocal) -" call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curbufnr = bufnr("%") - let curdir = s:NetrwGetCurdir(a:islocal) - - if exists("s:netrwmarkfilelist") -" call Decho("using s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("")) - let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) -" call Decho("keeping copy of s:netrwmarkfilelist in function-local variable,'~'.expand(""))" - call s:NetrwUnmarkAll() - else -" call Decho('no marked files, using "*"','~'.expand("")) - let netrwmarkfilelist= "*" - endif - - " ask user for pattern -" call Decho("ask user for search pattern",'~'.expand("")) - call inputsave() - let pat= input("Enter pattern: ","") - call inputrestore() - let patbang = "" - if pat =~ '^!' - let patbang = "!" - let pat = strpart(pat,2) - endif - if pat =~ '^\i' - let pat = escape(pat,'/') - let pat = '/'.pat.'/' - else - let nonisi = pat[0] - endif - - " use vimgrep for both local and remote -" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist,'~'.expand("")) - try - exe "NetrwKeepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist - catch /^Vim\%((\a\+)\)\=:E480/ - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pat.">",76) -" call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pat.">") - return - endtry - echo "(use :cn, :cp to navigate, :Rex to return)" - - 2match none -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - - if exists("nonisi") - " original, user-supplied pattern did not begin with a character from isident -" call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg",'~'.expand("")) - if pat =~# nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' - call s:NetrwMarkFileQFEL(a:islocal,getqflist()) - endif - endif - -" call Dret("s:NetrwMarkFileGrep") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileMove: (invoked by mm) execute arbitrary command on marked files, one at a time {{{2 -" uses the global marked file list -" s:netrwmfloc= 0: target directory is remote -" = 1: target directory is local -fun! s:NetrwMarkFileMove(islocal) -" call Dfunc("s:NetrwMarkFileMove(islocal=".a:islocal.")") - let curdir = s:NetrwGetCurdir(a:islocal) - let curbufnr = bufnr("%") - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileMove") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - - if !exists("s:netrwmftgt") - NetrwKeepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) -" call Dret("s:NetrwMarkFileCopy 0") - return 0 - endif -" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) - - if a:islocal && s:netrwmftgt_islocal - " move: local -> local -" call Decho("move from local to local",'~'.expand("")) -" call Decho("local to local move",'~'.expand("")) - if !executable(g:netrw_localmovecmd) - call netrw#ErrorMsg(s:ERROR,"g:netrw_localmovecmd<".g:netrw_localmovecmd."> not executable on your system, aborting",90) -" call Dfunc("s:NetrwMarkFileMove : g:netrw_localmovecmd<".g:netrw_localmovecmd."> n/a!") - return - endif - let tgt = s:ShellEscape(s:netrwmftgt) -" call Decho("tgt<".tgt.">",'~'.expand("")) - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - let tgt= substitute(tgt, '/','\\','g') -" call Decho("windows exception: tgt<".tgt.">",'~'.expand("")) - if g:netrw_localmovecmd =~ '\s' - let movecmd = substitute(g:netrw_localmovecmd,'\s.*$','','') - let movecmdargs = substitute(g:netrw_localmovecmd,'^.\{-}\(\s.*\)$','\1','') - let movecmd = netrw#WinPath(movecmd).movecmdargs -" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)",'~'.expand("")) - else - let movecmd = netrw#WinPath(g:netrw_localmovecmd) -" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)",'~'.expand("")) - endif - else - let movecmd = netrw#WinPath(g:netrw_localmovecmd) -" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)",'~'.expand("")) - endif - for fname in s:netrwmarkfilelist_{bufnr("%")} - if g:netrw_keepdir - " Jul 19, 2022: fixing file move when g:netrw_keepdir is 1 - let fname= b:netrw_curdir."/".fname - endif - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - let fname= substitute(fname,'/','\\','g') - endif -" call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("")) - let ret= system(movecmd.g:netrw_localmovecmdopt." ".s:ShellEscape(fname)." ".tgt) - if v:shell_error != 0 - if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir - call netrw#ErrorMsg(s:ERROR,"move failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",100) - else - call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) - endif - break - endif - endfor - - elseif a:islocal && !s:netrwmftgt_islocal - " move: local -> remote -" call Decho("move from local to remote",'~'.expand("")) -" call Decho("copy",'~'.expand("")) - let mflist= s:netrwmarkfilelist_{bufnr("%")} - NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove",'~'.expand("")) - for fname in mflist - let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') - let ok = s:NetrwLocalRmFile(b:netrw_curdir,barefname,1) - endfor - unlet mflist - - elseif !a:islocal && s:netrwmftgt_islocal - " move: remote -> local -" call Decho("move from remote to local",'~'.expand("")) -" call Decho("copy",'~'.expand("")) - let mflist= s:netrwmarkfilelist_{bufnr("%")} - NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove",'~'.expand("")) - for fname in mflist - let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') - let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1) - endfor - unlet mflist - - elseif !a:islocal && !s:netrwmftgt_islocal - " move: remote -> remote -" call Decho("move from remote to remote",'~'.expand("")) -" call Decho("copy",'~'.expand("")) - let mflist= s:netrwmarkfilelist_{bufnr("%")} - NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove",'~'.expand("")) - for fname in mflist - let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') - let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1) - endfor - unlet mflist - endif - - " ------- - " cleanup - " ------- -" call Decho("cleanup",'~'.expand("")) - - " remove markings from local buffer - call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer - - " refresh buffers - if !s:netrwmftgt_islocal -" call Decho("refresh netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) - NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) - endif - if a:islocal -" call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) - NetrwKeepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) - endif - if g:netrw_fastbrowse <= 1 -" call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh",'~'.expand("")) - NetrwKeepj call s:LocalBrowseRefresh() - endif - -" call Dret("s:NetrwMarkFileMove") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileRegexp: (invoked by mr) This function is used to mark {{{2 -" files when given a regexp (for which a prompt is -" issued) (matches to name of files). -fun! s:NetrwMarkFileRegexp(islocal) -" call Dfunc("s:NetrwMarkFileRegexp(islocal=".a:islocal.")") - - " get the regular expression - call inputsave() - let regexp= input("Enter regexp: ","","file") - call inputrestore() - - if a:islocal - let curdir= s:NetrwGetCurdir(a:islocal) -" call Decho("curdir<".fnameescape(curdir).">") - " get the matching list of files using local glob() -" call Decho("handle local regexp",'~'.expand("")) - let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - if v:version > 704 || (v:version == 704 && has("patch656")) - let filelist= glob(s:ComposePath(dirname,regexp),0,1,1) - else - let files = glob(s:ComposePath(dirname,regexp),0,0) - let filelist= split(files,"\n") - endif -" call Decho("files<".string(filelist).">",'~'.expand("")) - - " mark the list of files - for fname in filelist - if fname =~ '^'.fnameescape(curdir) -" call Decho("fname<".substitute(fname,'^'.fnameescape(curdir).'/','','').">",'~'.expand("")) - NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^'.fnameescape(curdir).'/','','')) - else -" call Decho("fname<".fname.">",'~'.expand("")) - NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) - endif - endfor - - else -" call Decho("handle remote regexp",'~'.expand("")) - - " convert displayed listing into a filelist - let eikeep = &ei - let areg = @a - sil NetrwKeepj %y a - setl ei=all ma -" call Decho("setl ei=all ma",'~'.expand("")) - 1split - NetrwKeepj call s:NetrwEnew() - NetrwKeepj call s:NetrwOptionsSafe(a:islocal) - sil NetrwKeepj norm! "ap - NetrwKeepj 2 - let bannercnt= search('^" =====','W') - exe "sil NetrwKeepj 1,".bannercnt."d" - setl bt=nofile - if g:netrw_liststyle == s:LONGLIST - sil NetrwKeepj %s/\s\{2,}\S.*$//e - call histdel("/",-1) - elseif g:netrw_liststyle == s:WIDELIST - sil NetrwKeepj %s/\s\{2,}/\r/ge - call histdel("/",-1) - elseif g:netrw_liststyle == s:TREELIST - exe 'sil NetrwKeepj %s/^'.s:treedepthstring.' //e' - sil! NetrwKeepj g/^ .*$/d - call histdel("/",-1) - call histdel("/",-1) - endif - " convert regexp into the more usual glob-style format - let regexp= substitute(regexp,'\*','.*','g') -" call Decho("regexp<".regexp.">",'~'.expand("")) - exe "sil! NetrwKeepj v/".escape(regexp,'/')."/d" - call histdel("/",-1) - let filelist= getline(1,line("$")) - q! - for filename in filelist - NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','','')) - endfor - unlet filelist - let @a = areg - let &ei = eikeep - endif - echo " (use me to edit marked files)" - -" call Dret("s:NetrwMarkFileRegexp") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileSource: (invoked by ms) This function sources marked files {{{2 -" Uses the local marked file list. -fun! s:NetrwMarkFileSource(islocal) -" call Dfunc("s:NetrwMarkFileSource(islocal=".a:islocal.")") - let curbufnr= bufnr("%") - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileSource") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - let curdir= s:NetrwGetCurdir(a:islocal) - - if exists("s:netrwmarkfilelist_{curbufnr}") - let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")} - call s:NetrwUnmarkList(curbufnr,curdir) - for fname in netrwmarkfilelist - if a:islocal - if g:netrw_keepdir - let fname= s:ComposePath(curdir,fname) - endif - else - let fname= curdir.fname - endif - " the autocmds will handle sourcing both local and remote files -" call Decho("exe so ".fnameescape(fname),'~'.expand("")) - exe "so ".fnameescape(fname) - endfor - 2match none - endif -" call Dret("s:NetrwMarkFileSource") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileTag: (invoked by mT) This function applies g:netrw_ctags to marked files {{{2 -" Uses the global markfilelist -fun! s:NetrwMarkFileTag(islocal) -" call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curdir = s:NetrwGetCurdir(a:islocal) - let curbufnr = bufnr("%") - - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileTag") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) - - if exists("s:netrwmarkfilelist") -" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("")) - let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "s:ShellEscape(v:val,".!a:islocal.")")) - call s:NetrwUnmarkAll() - - if a:islocal - -" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")",'~'.expand("")) - call system(g:netrw_ctags." ".netrwmarkfilelist) - if v:shell_error - call netrw#ErrorMsg(s:ERROR,"g:netrw_ctags<".g:netrw_ctags."> is not executable!",51) - endif - - else - let cmd = s:RemoteSystem(g:netrw_ctags." ".netrwmarkfilelist) - call netrw#Obtain(a:islocal,"tags") - let curdir= b:netrw_curdir - 1split - NetrwKeepj e tags - let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','') -" call Decho("curdir<".curdir."> path<".path.">",'~'.expand("")) - exe 'NetrwKeepj %s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e' - call histdel("/",-1) - wq! - endif - 2match none - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - call winrestview(svpos) - endif - -" call Dret("s:NetrwMarkFileTag") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMarkFileTgt: (invoked by mt) This function sets up a marked file target {{{2 -" Sets up two variables, -" s:netrwmftgt : holds the target directory -" s:netrwmftgt_islocal : 0=target directory is remote -" 1=target directory is local -fun! s:NetrwMarkFileTgt(islocal) -" call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curdir = s:NetrwGetCurdir(a:islocal) - let hadtgt = exists("s:netrwmftgt") - if !exists("w:netrw_bannercnt") - let w:netrw_bannercnt= b:netrw_bannercnt - endif - - " set up target - if line(".") < w:netrw_bannercnt -" call Decho("set up target: line(.) < w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("")) - " if cursor in banner region, use b:netrw_curdir for the target unless its already the target - if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") && s:netrwmftgt == b:netrw_curdir -" call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target",'~'.expand("")) - unlet s:netrwmftgt s:netrwmftgt_islocal - if g:netrw_fastbrowse <= 1 - call s:LocalBrowseRefresh() - endif - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - call winrestview(svpos) -" call Dret("s:NetrwMarkFileTgt : removed target") - return - else - let s:netrwmftgt= b:netrw_curdir -" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) - endif - - else - " get word under cursor. - " * If directory, use it for the target. - " * If file, use b:netrw_curdir for the target -" call Decho("get word under cursor",'~'.expand("")) - let curword= s:NetrwGetWord() - let tgtdir = s:ComposePath(curdir,curword) - if a:islocal && isdirectory(s:NetrwFile(tgtdir)) - let s:netrwmftgt = tgtdir -" call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) - elseif !a:islocal && tgtdir =~ '/$' - let s:netrwmftgt = tgtdir -" call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) - else - let s:netrwmftgt = curdir -" call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) - endif - endif - if a:islocal - " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) - let s:netrwmftgt= simplify(s:netrwmftgt) -" call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) - endif - if g:netrw_cygwin - let s:netrwmftgt= substitute(system("cygpath ".s:ShellEscape(s:netrwmftgt)),'\n$','','') - let s:netrwmftgt= substitute(s:netrwmftgt,'\n$','','') - endif - let s:netrwmftgt_islocal= a:islocal - - " need to do refresh so that the banner will be updated - " s:LocalBrowseRefresh handles all local-browsing buffers when not fast browsing - if g:netrw_fastbrowse <= 1 -" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers",'~'.expand("")) - call s:LocalBrowseRefresh() - endif -" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,w:netrw_treetop)) - else - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - endif -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - call winrestview(svpos) - if !hadtgt - sil! NetrwKeepj norm! j - endif - -" call Decho("getmatches=".string(getmatches()),'~'.expand("")) -" call Decho("s:netrwmarkfilelist=".(exists("s:netrwmarkfilelist")? string(s:netrwmarkfilelist) : 'n/a'),'~'.expand("")) -" call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">") -endfun - -" --------------------------------------------------------------------- -" s:NetrwGetCurdir: gets current directory and sets up b:netrw_curdir if necessary {{{2 -fun! s:NetrwGetCurdir(islocal) -" call Dfunc("s:NetrwGetCurdir(islocal=".a:islocal.")") - - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - let b:netrw_curdir = s:NetrwTreePath(w:netrw_treetop) -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used s:NetrwTreeDir)",'~'.expand("")) - elseif !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("")) - endif - -" call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern",'~'.expand("")) - if b:netrw_curdir !~ '\<\a\{3,}://' - let curdir= b:netrw_curdir -" call Decho("g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("")) - if g:netrw_keepdir == 0 - call s:NetrwLcd(curdir) - endif - endif - -" call Dret("s:NetrwGetCurdir <".curdir.">") - return b:netrw_curdir -endfun - -" --------------------------------------------------------------------- -" s:NetrwOpenFile: query user for a filename and open it {{{2 -fun! s:NetrwOpenFile(islocal) -" call Dfunc("s:NetrwOpenFile(islocal=".a:islocal.")") - let ykeep= @@ - call inputsave() - let fname= input("Enter filename: ") - call inputrestore() -" call Decho("(s:NetrwOpenFile) fname<".fname.">",'~'.expand("")) - - " determine if Lexplore is in use - if exists("t:netrw_lexbufnr") - " check if t:netrw_lexbufnr refers to a netrw window -" call Decho("(s:netrwOpenFile) ..t:netrw_lexbufnr=".t:netrw_lexbufnr,'~'.expand("")) - let lexwinnr = bufwinnr(t:netrw_lexbufnr) - if lexwinnr != -1 && exists("g:netrw_chgwin") && g:netrw_chgwin != -1 -" call Decho("(s:netrwOpenFile) ..Lexplore in use",'~'.expand("")) - exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" - exe "NetrwKeepj e ".fnameescape(fname) - let @@= ykeep -" call Dret("s:NetrwOpenFile : creating a file with Lexplore mode") - endif - endif - - " Does the filename contain a path? - if fname !~ '[/\\]' - if exists("b:netrw_curdir") - if exists("g:netrw_quiet") - let netrw_quiet_keep = g:netrw_quiet - endif - let g:netrw_quiet = 1 - " save position for benefit of Rexplore - let s:rexposn_{bufnr("%")}= winsaveview() -" call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("")) - if b:netrw_curdir =~ '/$' - exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname) - else - exe "e ".fnameescape(b:netrw_curdir."/".fname) - endif - if exists("netrw_quiet_keep") - let g:netrw_quiet= netrw_quiet_keep - else - unlet g:netrw_quiet - endif - endif - else - exe "NetrwKeepj e ".fnameescape(fname) - endif - let @@= ykeep -" call Dret("s:NetrwOpenFile") -endfun - -" --------------------------------------------------------------------- -" netrw#Shrink: shrinks/expands a netrw or Lexplorer window {{{2 -" For the mapping to this function be made via -" netrwPlugin, you'll need to have had -" g:netrw_usetab set to non-zero. -fun! netrw#Shrink() -" call Dfunc("netrw#Shrink() ft<".&ft."> winwidth=".winwidth(0)." lexbuf#".((exists("t:netrw_lexbufnr"))? t:netrw_lexbufnr : 'n/a')) - let curwin = winnr() - let wiwkeep = &wiw - set wiw=1 - - if &ft == "netrw" - if winwidth(0) > g:netrw_wiw - let t:netrw_winwidth= winwidth(0) - exe "vert resize ".g:netrw_wiw - wincmd l - if winnr() == curwin - wincmd h - endif -" call Decho("vert resize 0",'~'.expand("")) - else - exe "vert resize ".t:netrw_winwidth -" call Decho("vert resize ".t:netrw_winwidth,'~'.expand("")) - endif - - elseif exists("t:netrw_lexbufnr") - exe bufwinnr(t:netrw_lexbufnr)."wincmd w" - if winwidth(bufwinnr(t:netrw_lexbufnr)) > g:netrw_wiw - let t:netrw_winwidth= winwidth(0) - exe "vert resize ".g:netrw_wiw - wincmd l - if winnr() == curwin - wincmd h - endif -" call Decho("vert resize 0",'~'.expand("")) - elseif winwidth(bufwinnr(t:netrw_lexbufnr)) >= 0 - exe "vert resize ".t:netrw_winwidth -" call Decho("vert resize ".t:netrw_winwidth,'~'.expand("")) - else - call netrw#Lexplore(0,0) - endif - - else - call netrw#Lexplore(0,0) - endif - let wiw= wiwkeep - -" call Dret("netrw#Shrink") -endfun - -" --------------------------------------------------------------------- -" s:NetSortSequence: allows user to edit the sorting sequence {{{2 -fun! s:NetSortSequence(islocal) -" call Dfunc("NetSortSequence(islocal=".a:islocal.")") - - let ykeep= @@ - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - call inputsave() - let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) - call inputrestore() - - " refresh the listing - let g:netrw_sort_sequence= newsortseq - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - let @@= ykeep - -" call Dret("NetSortSequence") -endfun - -" --------------------------------------------------------------------- -" s:NetrwUnmarkList: delete local marked file list and remove their contents from the global marked-file list {{{2 -" User access provided by the mapping. (see :help netrw-mF) -" Used by many MarkFile functions. -fun! s:NetrwUnmarkList(curbufnr,curdir) -" call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)") - - " remove all files in local marked-file list from global list - if exists("s:netrwmarkfilelist") - for mfile in s:netrwmarkfilelist_{a:curbufnr} - let dfile = s:ComposePath(a:curdir,mfile) " prepend directory to mfile - let idx = index(s:netrwmarkfilelist,dfile) " get index in list of dfile - call remove(s:netrwmarkfilelist,idx) " remove from global list - endfor - if s:netrwmarkfilelist == [] - unlet s:netrwmarkfilelist - endif - - " getting rid of the local marked-file lists is easy - unlet s:netrwmarkfilelist_{a:curbufnr} - endif - if exists("s:netrwmarkfilemtch_{a:curbufnr}") - unlet s:netrwmarkfilemtch_{a:curbufnr} - endif - 2match none -" call Dret("s:NetrwUnmarkList") -endfun - -" --------------------------------------------------------------------- -" s:NetrwUnmarkAll: remove the global marked file list and all local ones {{{2 -fun! s:NetrwUnmarkAll() -" call Dfunc("s:NetrwUnmarkAll()") - if exists("s:netrwmarkfilelist") - unlet s:netrwmarkfilelist - endif - sil call s:NetrwUnmarkAll2() - 2match none -" call Dret("s:NetrwUnmarkAll") -endfun - -" --------------------------------------------------------------------- -" s:NetrwUnmarkAll2: unmark all files from all buffers {{{2 -fun! s:NetrwUnmarkAll2() -" call Dfunc("s:NetrwUnmarkAll2()") - redir => netrwmarkfilelist_let - let - redir END - let netrwmarkfilelist_list= split(netrwmarkfilelist_let,'\n') " convert let string into a let list - call filter(netrwmarkfilelist_list,"v:val =~ '^s:netrwmarkfilelist_'") " retain only those vars that start as s:netrwmarkfilelist_ - call map(netrwmarkfilelist_list,"substitute(v:val,'\\s.*$','','')") " remove what the entries are equal to - for flist in netrwmarkfilelist_list - let curbufnr= substitute(flist,'s:netrwmarkfilelist_','','') - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - endfor -" call Dret("s:NetrwUnmarkAll2") -endfun - -" --------------------------------------------------------------------- -" s:NetrwUnMarkFile: called via mu map; unmarks *all* marked files, both global and buffer-local {{{2 -" -" Marked files are in two types of lists: -" s:netrwmarkfilelist -- holds complete paths to all marked files -" s:netrwmarkfilelist_# -- holds list of marked files in current-buffer's directory (#==bufnr()) -" -" Marked files suitable for use with 2match are in: -" s:netrwmarkfilemtch_# -- used with 2match to display marked files -fun! s:NetrwUnMarkFile(islocal) -" call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")") - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let curbufnr = bufnr("%") - - " unmark marked file list - " (although I expect s:NetrwUpload() to do it, I'm just making sure) - if exists("s:netrwmarkfilelist") -" " call Decho("unlet'ing: s:netrwmarkfilelist",'~'.expand("")) - unlet s:netrwmarkfilelist - endif - - let ibuf= 1 - while ibuf < bufnr("$") - if exists("s:netrwmarkfilelist_".ibuf) - unlet s:netrwmarkfilelist_{ibuf} - unlet s:netrwmarkfilemtch_{ibuf} - endif - let ibuf = ibuf + 1 - endwhile - 2match none - -" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -"call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) -call winrestview(svpos) -" call Dret("s:NetrwUnMarkFile") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMenu: generates the menu for gvim and netrw {{{2 -fun! s:NetrwMenu(domenu) - - if !exists("g:NetrwMenuPriority") - let g:NetrwMenuPriority= 80 - endif - - if has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu -" call Dfunc("NetrwMenu(domenu=".a:domenu.")") - - if !exists("s:netrw_menu_enabled") && a:domenu -" call Decho("initialize menu",'~'.expand("")) - let s:netrw_menu_enabled= 1 - exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help ' - exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' - exe 'sil! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory- -' - exe 'sil! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewerx x' - if g:netrw_dirhistmax > 0 - exe 'sil! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directorymb mb' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)u u' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)U U' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Listqb qb' - else - exe 'sil! menu '.g:NetrwMenuPriority.'.8 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History :echo "(disabled)"'."\" - endif - exe 'sil! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Horizontal\ Splito o' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Vertical\ Splitv v' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.New\ Tabt t' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Previewp p' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List'." \'" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.6 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ SequenceS S' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.7 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files'."gh gh" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.8 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing'." \" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.9 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options:NetrwSettings '.":NetrwSettings\" - exe 'sil! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/DirectoryD D' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Create\ New\ File% %' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window '."\" - exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directoryp p' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ WindowP P' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Windowo o' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Tabt t' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Windowv v' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore ' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only):Explore\ */ :Explore */' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs):Explore\ **/ :Explore **/' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only):Explore\ *// :Explore *//' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs):Explore\ **// :Explore **//' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match:Nexplore :Nexplore' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match:Pexplore :Pexplore' - exe 'sil! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectoryd d' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.1 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Filemf mf' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.2 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Files\ by\ Regexpmr mr' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.3 '.g:NetrwTopLvlMenu.'Marked\ Files.Hide-Show-List\ Controla a' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.4 '.g:NetrwTopLvlMenu.'Marked\ Files.Copy\ To\ Targetmc mc' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.5 '.g:NetrwTopLvlMenu.'Marked\ Files.DeleteD D' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.6 '.g:NetrwTopLvlMenu.'Marked\ Files.Diffmd md' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.7 '.g:NetrwTopLvlMenu.'Marked\ Files.Editme me' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmdmx mx' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Targetmm mm' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.ObtainO O' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Printmp mp' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.ReplaceR R' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Targetmt mt' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.TagmT mT' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.15 '.g:NetrwTopLvlMenu.'Marked\ Files.Zip/Unzip/Compress/Uncompressmz mz' - exe 'sil! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'Obtain\ FileO O' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.thini :let w:netrw_liststyle=0' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.longi :let w:netrw_liststyle=1' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.widei :let w:netrw_liststyle=2' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.treei :let w:netrw_liststyle=3' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.1 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Show\ Alla :let g:netrw_hide=0' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.3 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Normala :let g:netrw_hide=1' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.2 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Hidden\ Onlya :let g:netrw_hide=2' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.3 '.g:NetrwTopLvlMenu.'Style.Reverse\ Sorting\ Order'."r r" - exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.1 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Names :let g:netrw_sort_by="name"' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.2 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Times :let g:netrw_sort_by="time"' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Sizes :let g:netrw_sort_by="size"' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Extens :let g:netrw_sort_by="exten"' - exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/DirectoryR R' - exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directoryc c' - let s:netrw_menucnt= 28 - call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4, 8.2.x - call s:NetrwTgtMenu() " let bookmarks and history be easy targets - - elseif !a:domenu - let s:netrwcnt = 0 - let curwin = winnr() - windo if getline(2) =~# "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif - exe curwin."wincmd w" - - if s:netrwcnt <= 1 -" call Decho("clear menus",'~'.expand("")) - exe 'sil! unmenu '.g:NetrwTopLvlMenu -" call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*','~'.expand("")) - sil! unlet s:netrw_menu_enabled - endif - endif -" call Dret("NetrwMenu") - return - endif - -endfun - -" --------------------------------------------------------------------- -" s:NetrwObtain: obtain file under cursor or from markfile list {{{2 -" Used by the O maps (as NetrwObtain()) -fun! s:NetrwObtain(islocal) -" call Dfunc("NetrwObtain(islocal=".a:islocal.")") - - let ykeep= @@ - if exists("s:netrwmarkfilelist_{bufnr('%')}") - let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\{3,}://' - call netrw#Obtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) - call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) - else - call netrw#Obtain(a:islocal,s:NetrwGetWord()) - endif - let @@= ykeep - -" call Dret("NetrwObtain") -endfun - -" --------------------------------------------------------------------- -" s:NetrwPrevWinOpen: open file/directory in previous window. {{{2 -" If there's only one window, then the window will first be split. -" Returns: -" choice = 0 : didn't have to choose -" choice = 1 : saved modified file in window first -" choice = 2 : didn't save modified file, opened window -" choice = 3 : cancel open -fun! s:NetrwPrevWinOpen(islocal) -" call Dfunc("s:NetrwPrevWinOpen(islocal=".a:islocal.") win#".winnr()) - - let ykeep= @@ - " grab a copy of the b:netrw_curdir to pass it along to newly split windows - let curdir = b:netrw_curdir -" call Decho("COMBAK#1: mod=".&mod." win#".winnr()) - - " get last window number and the word currently under the cursor - let origwin = winnr() - let lastwinnr = winnr("$") -" call Decho("origwin#".origwin." lastwinnr#".lastwinnr) -" call Decho("COMBAK#2: mod=".&mod." win#".winnr()) - let curword = s:NetrwGetWord() - let choice = 0 - let s:prevwinopen= 1 " lets s:NetrwTreeDir() know that NetrwPrevWinOpen called it (s:NetrwTreeDir() will unlet s:prevwinopen) -" call Decho("COMBAK#3: mod=".&mod." win#".winnr()) - let s:treedir = s:NetrwTreeDir(a:islocal) -" call Decho("COMBAK#4: mod=".&mod." win#".winnr()) - let curdir = s:treedir -" call Decho("COMBAK#5: mod=".&mod." win#".winnr()) -" call Decho("winnr($)#".lastwinnr." curword<".curword.">",'~'.expand("")) -" call Decho("COMBAK#6: mod=".&mod." win#".winnr()) - - let didsplit = 0 - if lastwinnr == 1 - " if only one window, open a new one first -" call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")",'~'.expand("")) - " g:netrw_preview=0: preview window shown in a horizontally split window - " g:netrw_preview=1: preview window shown in a vertically split window - if g:netrw_preview - " vertically split preview window - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize -" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s",'~'.expand("")) - exe (g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s" - else - " horizontally split preview window - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("")) - exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" - endif - let didsplit = 1 -" call Decho("did split",'~'.expand("")) - - else -" call Decho("COMBAK#7: mod=".&mod." win#".winnr()) - NetrwKeepj call s:SaveBufVars() -" call Decho("COMBAK#8: mod=".&mod." win#".winnr()) - let eikeep= &ei -" call Decho("COMBAK#9: mod=".&mod." win#".winnr()) - setl ei=all -" call Decho("COMBAK#10: mod=".&mod." win#".winnr()) - wincmd p -" call Decho("COMBAK#11: mod=".&mod) -" call Decho("wincmd p (now in win#".winnr().") curdir<".curdir.">",'~'.expand("")) -" call Decho("COMBAK#12: mod=".&mod) - - if exists("s:lexplore_win") && s:lexplore_win == winnr() - " whoops -- user trying to open file in the Lexplore window. - " Use Lexplore's opening-file window instead. -" call Decho("whoops -- user trying to open file in Lexplore Window. Use win#".g:netrw_chgwin." instead") -" exe g:netrw_chgwin."wincmd w" - wincmd p - call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) - endif - - " prevwinnr: the window number of the "prev" window - " prevbufnr: the buffer number of the buffer in the "prev" window - " bnrcnt : the qty of windows open on the "prev" buffer - let prevwinnr = winnr() - let prevbufnr = bufnr("%") - let prevbufname = bufname("%") - let prevmod = &mod - let bnrcnt = 0 -" call Decho("COMBAK#13: mod=".&mod." win#".winnr()) - NetrwKeepj call s:RestoreBufVars() -" call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr,'~'.expand("")) -" call Decho("COMBAK#14: mod=".&mod." win#".winnr()) - - " if the previous window's buffer has been changed (ie. its modified flag is set), - " and it doesn't appear in any other extant window, then ask the - " user if s/he wants to abandon modifications therein. - if prevmod -" call Decho("detected that prev window's buffer has been modified: prevbufnr=".prevbufnr." winnr()#".winnr(),'~'.expand("")) - windo if winbufnr(0) == prevbufnr | let bnrcnt=bnrcnt+1 | endif -" call Decho("prevbufnr=".prevbufnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr()=".winnr()." prevwinnr#".prevwinnr,'~'.expand("")) - exe prevwinnr."wincmd w" -" call Decho("COMBAK#15: mod=".&mod." win#".winnr()) - - if bnrcnt == 1 && &hidden == 0 - " only one copy of the modified buffer in a window, and - " hidden not set, so overwriting will lose the modified file. Ask first... - let choice = confirm("Save modified buffer<".prevbufname."> first?","&Yes\n&No\n&Cancel") -" call Decho("prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr(),'~'.expand("")) - let &ei= eikeep -" call Decho("COMBAK#16: mod=".&mod." win#".winnr()) - - if choice == 1 - " Yes -- write file & then browse - let v:errmsg= "" - sil w - if v:errmsg != "" - call netrw#ErrorMsg(s:ERROR,"unable to write <".(exists("prevbufname")? prevbufname : 'n/a').">!",30) - exe origwin."wincmd w" - let &ei = eikeep - let @@ = ykeep -" call Dret("s:NetrwPrevWinOpen ".choice." : unable to write <".prevbufname.">") - return choice - endif - - elseif choice == 2 - " No -- don't worry about changed file, just browse anyway -" call Decho("don't worry about chgd file, just browse anyway (winnr($)#".winnr("$").")",'~'.expand("")) - echomsg "**note** changes to ".prevbufname." abandoned" - - else - " Cancel -- don't do this -" call Decho("cancel, don't browse, switch to win#".origwin,'~'.expand("")) - exe origwin."wincmd w" - let &ei= eikeep - let @@ = ykeep -" call Dret("s:NetrwPrevWinOpen ".choice." : cancelled") - return choice - endif - endif - endif - let &ei= eikeep - endif -" call Decho("COMBAK#17: mod=".&mod." win#".winnr()) - - " restore b:netrw_curdir (window split/enew may have lost it) - let b:netrw_curdir= curdir - if a:islocal < 2 - if a:islocal - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(a:islocal,curword)) - else - call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,curword)) - endif - endif - let @@= ykeep -" call Dret("s:NetrwPrevWinOpen ".choice) - return choice -endfun - -" --------------------------------------------------------------------- -" s:NetrwUpload: load fname to tgt (used by NetrwMarkFileCopy()) {{{2 -" Always assumed to be local -> remote -" call s:NetrwUpload(filename, target) -" call s:NetrwUpload(filename, target, fromdirectory) -fun! s:NetrwUpload(fname,tgt,...) -" call Dfunc("s:NetrwUpload(fname<".((type(a:fname) == 1)? a:fname : string(a:fname))."> tgt<".a:tgt.">) a:0=".a:0) - - if a:tgt =~ '^\a\{3,}://' - let tgtdir= substitute(a:tgt,'^\a\{3,}://[^/]\+/\(.\{-}\)$','\1','') - else - let tgtdir= substitute(a:tgt,'^\(.*\)/[^/]*$','\1','') - endif -" call Decho("tgtdir<".tgtdir.">",'~'.expand("")) - - if a:0 > 0 - let fromdir= a:1 - else - let fromdir= getcwd() - endif -" call Decho("fromdir<".fromdir.">",'~'.expand("")) - - if type(a:fname) == 1 - " handle uploading a single file using NetWrite -" call Decho("handle uploading a single file via NetWrite",'~'.expand("")) - 1split -" call Decho("exe e ".fnameescape(s:NetrwFile(a:fname)),'~'.expand("")) - exe "NetrwKeepj e ".fnameescape(s:NetrwFile(a:fname)) -" call Decho("now locally editing<".expand("%").">, has ".line("$")." lines",'~'.expand("")) - if a:tgt =~ '/$' - let wfname= substitute(a:fname,'^.*/','','') -" call Decho("exe w! ".fnameescape(wfname),'~'.expand("")) - exe "w! ".fnameescape(a:tgt.wfname) - else -" call Decho("writing local->remote: exe w ".fnameescape(a:tgt),'~'.expand("")) - exe "w ".fnameescape(a:tgt) -" call Decho("done writing local->remote",'~'.expand("")) - endif - q! - - elseif type(a:fname) == 3 - " handle uploading a list of files via scp -" call Decho("handle uploading a list of files via scp",'~'.expand("")) - let curdir= getcwd() - if a:tgt =~ '^scp:' - if s:NetrwLcd(fromdir) -" call Dret("s:NetrwUpload : lcd failure") - return - endif - let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')}) - let args = join(map(filelist,"s:ShellEscape(v:val, 1)")) - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " ".g:netrw_scpport." ".g:netrw_port - else - let useport= "" - endif - let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','') - let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','') - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".args." ".s:ShellEscape(machine.":".tgt,1)) - if s:NetrwLcd(curdir) -" call Dret("s:NetrwUpload : lcd failure") - return - endif - - elseif a:tgt =~ '^ftp:' - call s:NetrwMethod(a:tgt) - - if b:netrw_method == 2 - " handle uploading a list of files via ftp+.netrc - let netrw_fname = b:netrw_fname - sil NetrwKeepj new -" call Decho("filter input window#".winnr(),'~'.expand("")) - - NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$'),'~'.expand("")) - - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - - if tgtdir == "" - let tgtdir= '/' - endif - NetrwKeepj call setline(line("$")+1,'cd "'.tgtdir.'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - - for fname in a:fname - NetrwKeepj call setline(line("$")+1,'put "'.s:NetrwFile(fname).'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endfor - - if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) - else -" call Decho("filter input window#".winnr(),'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) - endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - sil NetrwKeepj g/Local directory now/d - call histdel("/",-1) - if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' - call netrw#ErrorMsg(s:ERROR,getline(1),14) - else - bw!|q - endif - - elseif b:netrw_method == 3 - " upload with ftp + machine, id, passwd, and fname (ie. no .netrc) - let netrw_fname= b:netrw_fname - NetrwKeepj call s:SaveBufVars()|sil NetrwKeepj new|NetrwKeepj call s:RestoreBufVars() - let tmpbufnr= bufnr("%") - setl ff=unix - - if exists("g:netrw_port") && g:netrw_port != "" - NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$'),'~'.expand("")) - else - NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - if exists("g:netrw_uid") && g:netrw_uid != "" - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('$'),'~'.expand("")) - if exists("s:netrw_passwd") - NetrwKeepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') - endif -" call Decho("filter input: ".getline('$'),'~'.expand("")) - elseif exists("s:netrw_passwd") - NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - endif - - NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - - if exists("b:netrw_fname") && b:netrw_fname != "" - NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endif - - for fname in a:fname - NetrwKeepj call setline(line("$")+1,'put "'.fname.'"') -" call Decho("filter input: ".getline('$'),'~'.expand("")) - endfor - - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password - NetrwKeepj norm! 1G"_dd - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - sil NetrwKeepj g/Local directory now/d - call histdel("/",-1) - if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' - let debugkeep= &debug - setl debug=msg - call netrw#ErrorMsg(s:ERROR,getline(1),15) - let &debug = debugkeep - let mod = 1 - else - bw!|q - endif - elseif !exists("b:netrw_method") || b:netrw_method < 0 -" call Dret("s:#NetrwUpload : unsupported method") - return - endif - else - call netrw#ErrorMsg(s:ERROR,"can't obtain files with protocol from<".a:tgt.">",63) - endif - endif - -" call Dret("s:NetrwUpload") -endfun - -" --------------------------------------------------------------------- -" s:NetrwPreview: supports netrw's "p" map {{{2 -fun! s:NetrwPreview(path) range -" call Dfunc("NetrwPreview(path<".a:path.">)") -" call Decho("g:netrw_alto =".(exists("g:netrw_alto")? g:netrw_alto : 'n/a'),'~'.expand("")) -" call Decho("g:netrw_preview=".(exists("g:netrw_preview")? g:netrw_preview : 'n/a'),'~'.expand("")) - let ykeep= @@ - NetrwKeepj call s:NetrwOptionsSave("s:") - if a:path !~ '^\*\{1,2}/' && a:path !~ '^\a\{3,}://' - NetrwKeepj call s:NetrwOptionsSafe(1) - else - NetrwKeepj call s:NetrwOptionsSafe(0) - endif - if has("quickfix") -" call Decho("has quickfix",'~'.expand("")) - if !isdirectory(s:NetrwFile(a:path)) -" call Decho("good; not previewing a directory",'~'.expand("")) - if g:netrw_preview - " vertical split - let pvhkeep = &pvh - let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize - let &pvh = winwidth(0) - winsz -" call Decho("g:netrw_preview: winsz=".winsz." &pvh=".&pvh." (temporarily) g:netrw_winsize=".g:netrw_winsize,'~'.expand("")) - else - " horizontal split - let pvhkeep = &pvh - let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize - let &pvh = winheight(0) - winsz -" call Decho("!g:netrw_preview: winsz=".winsz." &pvh=".&pvh." (temporarily) g:netrw_winsize=".g:netrw_winsize,'~'.expand("")) - endif - " g:netrw_preview g:netrw_alto - " 1 : vert 1: top -- preview window is vertically split off and on the left - " 1 : vert 0: bot -- preview window is vertically split off and on the right - " 0 : 1: top -- preview window is horizontally split off and on the top - " 0 : 0: bot -- preview window is horizontally split off and on the bottom - " - " Note that the file being previewed is already known to not be a directory, hence we can avoid doing a LocalBrowseCheck() check via - " the BufEnter event set up in netrwPlugin.vim -" call Decho("exe ".(g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path),'~'.expand("")) - let eikeep = &ei - set ei=BufEnter - exe (g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path) - let &ei= eikeep -" call Decho("winnr($)=".winnr("$"),'~'.expand("")) - if exists("pvhkeep") - let &pvh= pvhkeep - endif - elseif !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38) - endif - elseif !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) - endif - NetrwKeepj call s:NetrwOptionsRestore("s:") - let @@= ykeep -" call Dret("NetrwPreview") -endfun - -" --------------------------------------------------------------------- -" s:NetrwRefresh: {{{2 -fun! s:NetrwRefresh(islocal,dirname) -" call Dfunc("s:NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") g:netrw_hide=".g:netrw_hide." g:netrw_sort_direction=".g:netrw_sort_direction) - " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first. - setl ma noro -" call Decho("setl ma noro",'~'.expand("")) -" call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("")) - let ykeep = @@ - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - if !exists("w:netrw_treetop") - if exists("b:netrw_curdir") - let w:netrw_treetop= b:netrw_curdir - else - let w:netrw_treetop= getcwd() - endif - endif - NetrwKeepj call s:NetrwRefreshTreeDict(w:netrw_treetop) - endif - - " save the cursor position before refresh. - let screenposn = winsaveview() -" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("")) - -" call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">",'~'.expand("")) -" call Decho("clearing buffer prior to refresh",'~'.expand("")) - sil! NetrwKeepj %d _ - if a:islocal - NetrwKeepj call netrw#LocalBrowseCheck(a:dirname) - else - NetrwKeepj call s:NetrwBrowse(a:islocal,a:dirname) - endif - - " restore position -" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("")) - NetrwKeepj call winrestview(screenposn) - - " restore file marks - if has("syntax") && exists("g:syntax_on") && g:syntax_on - if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("")) - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" - else -" " call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("")) - 2match none - endif - endif - -" restore - let @@= ykeep -" call Dret("s:NetrwRefresh") -endfun - -" --------------------------------------------------------------------- -" s:NetrwRefreshDir: refreshes a directory by name {{{2 -" Called by NetrwMarkFileCopy() -" Interfaces to s:NetrwRefresh() and s:LocalBrowseRefresh() -fun! s:NetrwRefreshDir(islocal,dirname) -" call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) g:netrw_fastbrowse=".g:netrw_fastbrowse) - if g:netrw_fastbrowse == 0 - " slowest mode (keep buffers refreshed, local or remote) -" call Decho("slowest mode: keep buffers refreshed, local or remote",'~'.expand("")) - let tgtwin= bufwinnr(a:dirname) -" call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin,'~'.expand("")) - - if tgtwin > 0 - " tgtwin is being displayed, so refresh it - let curwin= winnr() -" call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")",'~'.expand("")) - exe tgtwin."wincmd w" - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - exe curwin."wincmd w" - - elseif bufnr(a:dirname) > 0 - let bn= bufnr(a:dirname) -" call Decho("bd bufnr(".a:dirname.")=".bn,'~'.expand("")) - exe "sil keepj bd ".bn - endif - - elseif g:netrw_fastbrowse <= 1 -" call Decho("medium-speed mode: refresh local buffers only",'~'.expand("")) - NetrwKeepj call s:LocalBrowseRefresh() - endif -" call Dret("s:NetrwRefreshDir") -endfun - -" --------------------------------------------------------------------- -" s:NetrwSetChgwin: set g:netrw_chgwin; a will use the specified -" window number to do its editing in. -" Supports [count]C where the count, if present, is used to specify -" a window to use for editing via the mapping. -fun! s:NetrwSetChgwin(...) -" call Dfunc("s:NetrwSetChgwin() v:count=".v:count) - if a:0 > 0 -" call Decho("a:1<".a:1.">",'~'.expand("")) - if a:1 == "" " :NetrwC win# - let g:netrw_chgwin= winnr() - else " :NetrwC - let g:netrw_chgwin= a:1 - endif - elseif v:count > 0 " [count]C - let g:netrw_chgwin= v:count - else " C - let g:netrw_chgwin= winnr() - endif - echo "editing window now set to window#".g:netrw_chgwin -" call Dret("s:NetrwSetChgwin : g:netrw_chgwin=".g:netrw_chgwin) -endfun - -" --------------------------------------------------------------------- -" s:NetrwSetSort: sets up the sort based on the g:netrw_sort_sequence {{{2 -" What this function does is to compute a priority for the patterns -" in the g:netrw_sort_sequence. It applies a substitute to any -" "files" that satisfy each pattern, putting the priority / in -" front. An "*" pattern handles the default priority. -fun! s:NetrwSetSort() -" call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt) - let ykeep= @@ - if w:netrw_liststyle == s:LONGLIST - let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge') - else - let seqlist = g:netrw_sort_sequence - endif - " sanity check -- insure that * appears somewhere - if seqlist == "" - let seqlist= '*' - elseif seqlist !~ '\*' - let seqlist= seqlist.',*' - endif - let priority = 1 - while seqlist != "" - if seqlist =~ ',' - let seq = substitute(seqlist,',.*$','','e') - let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e') - else - let seq = seqlist - let seqlist = "" - endif - if priority < 10 - let spriority= "00".priority.g:netrw_sepchr - elseif priority < 100 - let spriority= "0".priority.g:netrw_sepchr - else - let spriority= priority.g:netrw_sepchr - endif -" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">",'~'.expand("")) - - " sanity check - if w:netrw_bannercnt > line("$") - " apparently no files were left after a Hiding pattern was used -" call Dret("SetSort : no files left after hiding") - return - endif - if seq == '*' - let starpriority= spriority - else - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/' - call histdel("/",-1) - " sometimes multiple sorting patterns will match the same file or directory. - " The following substitute is intended to remove the excess matches. - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e' - NetrwKeepj call histdel("/",-1) - endif - let priority = priority + 1 - endwhile - if exists("starpriority") - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/e' - NetrwKeepj call histdel("/",-1) - endif - - " Following line associated with priority -- items that satisfy a priority - " pattern get prefixed by ###/ which permits easy sorting by priority. - " Sometimes files can satisfy multiple priority patterns -- only the latest - " priority pattern needs to be retained. So, at this point, these excess - " priority prefixes need to be removed, but not directories that happen to - " be just digits themselves. - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e' - NetrwKeepj call histdel("/",-1) - let @@= ykeep - -" call Dret("SetSort") -endfun - -" --------------------------------------------------------------------- -" s:NetrwSetTgt: sets the target to the specified choice index {{{2 -" Implements [count]Tb (bookhist) -" [count]Th (bookhist) -" See :help netrw-qb for how to make the choice. -fun! s:NetrwSetTgt(islocal,bookhist,choice) -" call Dfunc("s:NetrwSetTgt(islocal=".a:islocal." bookhist<".a:bookhist."> choice#".a:choice.")") - - if a:bookhist == 'b' - " supports choosing a bookmark as a target using a qb-generated list - let choice= a:choice - 1 - if exists("g:netrw_bookmarklist[".choice."]") - call netrw#MakeTgt(g:netrw_bookmarklist[choice]) - else - echomsg "Sorry, bookmark#".a:choice." doesn't exist!" - endif - - elseif a:bookhist == 'h' - " supports choosing a history stack entry as a target using a qb-generated list - let choice= (a:choice % g:netrw_dirhistmax) + 1 - if exists("g:netrw_dirhist_".choice) - let histentry = g:netrw_dirhist_{choice} - call netrw#MakeTgt(histentry) - else - echomsg "Sorry, history#".a:choice." not available!" - endif - endif - - " refresh the display - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() - endif - call s:NetrwRefresh(a:islocal,b:netrw_curdir) - -" call Dret("s:NetrwSetTgt") -endfun - -" ===================================================================== -" s:NetrwSortStyle: change sorting style (name - time - size - exten) and refresh display {{{2 -fun! s:NetrwSortStyle(islocal) -" call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">") - NetrwKeepj call s:NetrwSaveWordPosn() - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - - let g:netrw_sort_by= (g:netrw_sort_by =~# '^n')? 'time' : (g:netrw_sort_by =~# '^t')? 'size' : (g:netrw_sort_by =~# '^siz')? 'exten' : 'name' - NetrwKeepj norm! 0 - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - -" call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">") -endfun - -" --------------------------------------------------------------------- -" s:NetrwSplit: mode {{{2 -" =0 : net and o -" =1 : net and t -" =2 : net and v -" =3 : local and o -" =4 : local and t -" =5 : local and v -fun! s:NetrwSplit(mode) -" call Dfunc("s:NetrwSplit(mode=".a:mode.") alto=".g:netrw_alto." altv=".g:netrw_altv) - - let ykeep= @@ - call s:SaveWinVars() - - if a:mode == 0 - " remote and o - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize - if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("")) - exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" - let s:didsplit= 1 - NetrwKeepj call s:RestoreWinVars() - NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) - unlet s:didsplit - - elseif a:mode == 1 - " remote and t - let newdir = s:NetrwBrowseChgDir(0,s:NetrwGetWord()) -" call Decho("tabnew",'~'.expand("")) - tabnew - let s:didsplit= 1 - NetrwKeepj call s:RestoreWinVars() - NetrwKeepj call s:NetrwBrowse(0,newdir) - unlet s:didsplit - - elseif a:mode == 2 - " remote and v - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize - if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("")) - exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" - let s:didsplit= 1 - NetrwKeepj call s:RestoreWinVars() - NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) - unlet s:didsplit - - elseif a:mode == 3 - " local and o - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize - if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("")) - exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" - let s:didsplit= 1 - NetrwKeepj call s:RestoreWinVars() - NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) - unlet s:didsplit - - elseif a:mode == 4 - " local and t - let cursorword = s:NetrwGetWord() - let eikeep = &ei - let netrw_winnr = winnr() - let netrw_line = line(".") - let netrw_col = virtcol(".") - NetrwKeepj norm! H0 - let netrw_hline = line(".") - setl ei=all - exe "NetrwKeepj norm! ".netrw_hline."G0z\" - exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\" - let &ei = eikeep - let netrw_curdir = s:NetrwTreeDir(0) -" call Decho("tabnew",'~'.expand("")) - tabnew - let b:netrw_curdir = netrw_curdir - let s:didsplit = 1 - NetrwKeepj call s:RestoreWinVars() - NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword)) - if &ft == "netrw" - setl ei=all - exe "NetrwKeepj norm! ".netrw_hline."G0z\" - exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\" - let &ei= eikeep - endif - unlet s:didsplit - - elseif a:mode == 5 - " local and v - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize - if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("")) - exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" - let s:didsplit= 1 - NetrwKeepj call s:RestoreWinVars() - NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) - unlet s:didsplit - - else - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45) - endif - - let @@= ykeep -" call Dret("s:NetrwSplit") -endfun - -" --------------------------------------------------------------------- -" s:NetrwTgtMenu: {{{2 -fun! s:NetrwTgtMenu() - if !exists("s:netrw_menucnt") - return - endif -" call Dfunc("s:NetrwTgtMenu()") - - " the following test assures that gvim is running, has menus available, and has menus enabled. - if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu - if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("")) - exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Targets' - endif - if !exists("s:netrw_initbookhist") - call s:NetrwBookHistRead() - endif - - " try to cull duplicate entries - let tgtdict={} - - " target bookmarked places - if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 -" call Decho("installing bookmarks as easy targets",'~'.expand("")) - let cnt= 1 - for bmd in g:netrw_bookmarklist - if has_key(tgtdict,bmd) - let cnt= cnt + 1 - continue - endif - let tgtdict[bmd]= cnt - let ebmd= escape(bmd,g:netrw_menu_escape) - " show bookmarks for goto menu -" call Decho("menu: Targets: ".bmd,'~'.expand("")) - exe 'sil! menu '.g:NetrwMenuPriority.".19.1.".cnt." ".g:NetrwTopLvlMenu.'Targets.'.ebmd." :call netrw#MakeTgt('".bmd."')\" - let cnt= cnt + 1 - endfor - endif - - " target directory browsing history - if exists("g:netrw_dirhistmax") && g:netrw_dirhistmax > 0 -" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")",'~'.expand("")) - let histcnt = 1 - while histcnt <= g:netrw_dirhistmax - let priority = g:netrw_dirhistcnt + histcnt - if exists("g:netrw_dirhist_{histcnt}") - let histentry = g:netrw_dirhist_{histcnt} - if has_key(tgtdict,histentry) - let histcnt = histcnt + 1 - continue - endif - let tgtdict[histentry] = histcnt - let ehistentry = escape(histentry,g:netrw_menu_escape) -" call Decho("menu: Targets: ".histentry,'~'.expand("")) - exe 'sil! menu '.g:NetrwMenuPriority.".19.2.".priority." ".g:NetrwTopLvlMenu.'Targets.'.ehistentry." :call netrw#MakeTgt('".histentry."')\" - endif - let histcnt = histcnt + 1 - endwhile - endif - endif -" call Dret("s:NetrwTgtMenu") -endfun - -" --------------------------------------------------------------------- -" s:NetrwTreeDir: determine tree directory given current cursor position {{{2 -" (full path directory with trailing slash returned) -fun! s:NetrwTreeDir(islocal) -" call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) -" call Decho("Determine tree directory given current cursor position") -" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("")) -" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("")) -" call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'),'~'.expand("")) -" call Decho("current line<".getline(".").">") - - if exists("s:treedir") && exists("s:prevwinopen") - " s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early -" call Decho('s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early') - let treedir= s:treedir - unlet s:treedir - unlet s:prevwinopen -" call Dret("s:NetrwTreeDir ".treedir.": early return since s:treedir existed previously") - return treedir - endif - if exists("s:prevwinopen") - unlet s:prevwinopen - endif -" call Decho("COMBAK#18 : mod=".&mod." win#".winnr()) - - if !exists("b:netrw_curdir") || b:netrw_curdir == "" - let b:netrw_curdir= getcwd() - endif - let treedir = b:netrw_curdir -" call Decho("set initial treedir<".treedir.">",'~'.expand("")) -" call Decho("COMBAK#19 : mod=".&mod." win#".winnr()) - - let s:treecurpos= winsaveview() -" call Decho("saving posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("")) -" call Decho("COMBAK#20 : mod=".&mod." win#".winnr()) - - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Decho("w:netrw_liststyle is TREELIST:",'~'.expand("")) -" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">",'~'.expand("")) -" call Decho("COMBAK#21 : mod=".&mod." win#".winnr()) - - " extract tree directory if on a line specifying a subdirectory (ie. ends with "/") - let curline= substitute(getline('.'),"\t -->.*$",'','') - if curline =~ '/$' -" call Decho("extract tree subdirectory from current line",'~'.expand("")) - let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') -" call Decho("treedir<".treedir.">",'~'.expand("")) - elseif curline =~ '@$' -" call Decho("handle symbolic link from current line",'~'.expand("")) - let potentialdir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e')) -" call Decho("treedir<".treedir.">",'~'.expand("")) - else -" call Decho("do not extract tree subdirectory from current line and set treedir to empty",'~'.expand("")) - let treedir= "" - endif -" call Decho("COMBAK#22 : mod=".&mod." win#".winnr()) - - " detect user attempting to close treeroot -" call Decho("check if user is attempting to close treeroot",'~'.expand("")) -" call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) -" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~# '^'.s:treedepthstring)? '=~#' : '!~').' ^'.s:treedepthstring,'~'.expand("")) - if curline !~ '^'.s:treedepthstring && getline('.') != '..' -" call Decho(".user may have attempted to close treeroot",'~'.expand("")) - " now force a refresh -" call Decho(".force refresh: clear buffer<".expand("%")."> with :%d",'~'.expand("")) - sil! NetrwKeepj %d _ -" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") - return b:netrw_curdir -" else " Decho -" call Decho(".user not attempting to close treeroot",'~'.expand("")) - endif -" call Decho("COMBAK#23 : mod=".&mod." win#".winnr()) - -" call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("")) -" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir),'~'.expand("")) -" call Decho("COMBAK#24 : mod=".&mod." win#".winnr()) - - " COMBAK: a symbolic link may point anywhere -- so it will be used to start a new treetop -" if a:islocal && curline =~ '@$' && isdirectory(s:NetrwFile(potentialdir)) -" let newdir = w:netrw_treetop.'/'.potentialdir -" " call Decho("apply NetrwTreePath to newdir<".newdir.">",'~'.expand("")) -" let treedir = s:NetrwTreePath(newdir) -" let w:netrw_treetop = newdir -" " call Decho("newdir <".newdir.">",'~'.expand("")) -" else -" call Decho("apply NetrwTreePath to treetop<".w:netrw_treetop.">",'~'.expand("")) - if a:islocal && curline =~ '@$' - if isdirectory(s:NetrwFile(potentialdir)) - let treedir = w:netrw_treetop.'/'.potentialdir.'/' - let w:netrw_treetop = treedir - endif - else - let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1','')) - let treedir = s:NetrwTreePath(w:netrw_treetop) - endif - endif -" call Decho("COMBAK#25 : mod=".&mod." win#".winnr()) - - " sanity maintenance: keep those //s away... - let treedir= substitute(treedir,'//$','/','') -" call Decho("treedir<".treedir.">",'~'.expand("")) -" call Decho("COMBAK#26 : mod=".&mod." win#".winnr()) - -" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") - return treedir -endfun - -" --------------------------------------------------------------------- -" s:NetrwTreeDisplay: recursive tree display {{{2 -fun! s:NetrwTreeDisplay(dir,depth) -" call Dfunc("NetrwTreeDisplay(dir<".a:dir."> depth<".a:depth.">)") - - " insure that there are no folds - setl nofen - - " install ../ and shortdir - if a:depth == "" - call setline(line("$")+1,'../') -" call Decho("setline#".line("$")." ../ (depth is zero)",'~'.expand("")) - endif - if a:dir =~ '^\a\{3,}://' - if a:dir == w:netrw_treetop - let shortdir= a:dir - else - let shortdir= substitute(a:dir,'^.*/\([^/]\+\)/$','\1/','e') - endif - call setline(line("$")+1,a:depth.shortdir) - else - let shortdir= substitute(a:dir,'^.*/','','e') - call setline(line("$")+1,a:depth.shortdir.'/') - endif -" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">",'~'.expand("")) - " append a / to dir if its missing one - let dir= a:dir - - " display subtrees (if any) - let depth= s:treedepthstring.a:depth -" call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("")) - - " implement g:netrw_hide for tree listings (uses g:netrw_list_hide) - if g:netrw_hide == 1 - " hide given patterns - let listhide= split(g:netrw_list_hide,',') -" call Decho("listhide=".string(listhide)) - for pat in listhide - call filter(w:netrw_treedict[dir],'v:val !~ "'.escape(pat,'\\').'"') - endfor - - elseif g:netrw_hide == 2 - " show given patterns (only) - let listhide= split(g:netrw_list_hide,',') -" call Decho("listhide=".string(listhide)) - let entries=[] - for entry in w:netrw_treedict[dir] - for pat in listhide - if entry =~ pat - call add(entries,entry) - break - endif - endfor - endfor - let w:netrw_treedict[dir]= entries - endif - if depth != "" - " always remove "." and ".." entries when there's depth - call filter(w:netrw_treedict[dir],'v:val !~ "\\.\\.$"') - call filter(w:netrw_treedict[dir],'v:val !~ "\\.$"') - endif - -" call Decho("for every entry in w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("")) - for entry in w:netrw_treedict[dir] - if dir =~ '/$' - let direntry= substitute(dir.entry,'[@/]$','','e') - else - let direntry= substitute(dir.'/'.entry,'[@/]$','','e') - endif -" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("")) - if entry =~ '/$' && has_key(w:netrw_treedict,direntry) -" call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("")) - NetrwKeepj call s:NetrwTreeDisplay(direntry,depth) - elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') -" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("")) - NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) - elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@') -" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("")) - NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) - else -" call Decho("<".entry."> is not a key in treedict (no subtree)",'~'.expand("")) - sil! NetrwKeepj call setline(line("$")+1,depth.entry) - endif - endfor -" call Decho("displaying: ".string(getline(w:netrw_bannercnt,'$'))) - -" call Dret("NetrwTreeDisplay") -endfun - -" --------------------------------------------------------------------- -" s:NetrwRefreshTreeDict: updates the contents information for a tree (w:netrw_treedict) {{{2 -fun! s:NetrwRefreshTreeDict(dir) -" call Dfunc("s:NetrwRefreshTreeDict(dir<".a:dir.">)") - if !exists("w:netrw_treedict") -" call Dret("s:NetrwRefreshTreeDict : w:netrw_treedict doesn't exist") - return - endif - - for entry in w:netrw_treedict[a:dir] - let direntry= substitute(a:dir.'/'.entry,'[@/]$','','e') -" call Decho("a:dir<".a:dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("")) - - if entry =~ '/$' && has_key(w:netrw_treedict,direntry) -" call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("")) - NetrwKeepj call s:NetrwRefreshTreeDict(direntry) - let liststar = s:NetrwGlob(direntry,'*',1) - let listdotstar = s:NetrwGlob(direntry,'.*',1) - let w:netrw_treedict[direntry] = liststar + listdotstar -" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("")) - - elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') -" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("")) - NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/') - let liststar = s:NetrwGlob(direntry.'/','*',1) - let listdotstar= s:NetrwGlob(direntry.'/','.*',1) - let w:netrw_treedict[direntry]= liststar + listdotstar -" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("")) - - elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@') -" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("")) - NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/') - let liststar = s:NetrwGlob(direntry.'/','*',1) - let listdotstar= s:NetrwGlob(direntry.'/','.*',1) -" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("")) - - else -" call Decho('not updating w:netrw_treedict['.string(direntry).'] with entry<'.string(entry).'> (no subtree)','~'.expand("")) - endif - endfor -" call Dret("s:NetrwRefreshTreeDict") -endfun - -" --------------------------------------------------------------------- -" s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2 -" Called by s:PerformListing() -fun! s:NetrwTreeListing(dirname) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Dfunc("s:NetrwTreeListing() bufname<".expand("%").">") -" call Decho("curdir<".a:dirname.">",'~'.expand("")) -" call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"),'~'.expand("")) -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - - " update the treetop - if !exists("w:netrw_treetop") -" call Decho("update the treetop (w:netrw_treetop doesn't exist yet)",'~'.expand("")) - let w:netrw_treetop= a:dirname - let s:netrw_treetop= w:netrw_treetop -" call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)",'~'.expand("")) - elseif (w:netrw_treetop =~ ('^'.a:dirname) && s:Strlen(a:dirname) < s:Strlen(w:netrw_treetop)) || a:dirname !~ ('^'.w:netrw_treetop) -" call Decho("update the treetop (override w:netrw_treetop with a:dirname<".a:dirname.">)",'~'.expand("")) - let w:netrw_treetop= a:dirname - let s:netrw_treetop= w:netrw_treetop -" call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)",'~'.expand("")) - endif - if exists("w:netrw_treetop") - let s:netrw_treetop= w:netrw_treetop - else - let w:netrw_treetop= getcwd() - let s:netrw_treetop= w:netrw_treetop - endif - - if !exists("w:netrw_treedict") - " insure that we have a treedict, albeit empty -" call Decho("initializing w:netrw_treedict to empty",'~'.expand("")) - let w:netrw_treedict= {} - endif - - " update the dictionary for the current directory -" call Decho("updating: w:netrw_treedict[".a:dirname.'] -> [directory listing]','~'.expand("")) -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("")) - exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d _' - let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$")) -" call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname]),'~'.expand("")) - exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _" - - " if past banner, record word - if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt - let fname= expand("") - else - let fname= "" - endif -" call Decho("fname<".fname.">",'~'.expand("")) -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - - " display from treetop on down -" call Decho("(s:NetrwTreeListing) w:netrw_treetop<".w:netrw_treetop.">") - NetrwKeepj call s:NetrwTreeDisplay(w:netrw_treetop,"") -" call Decho("s:NetrwTreeDisplay) setl noma nomod ro",'~'.expand("")) - - " remove any blank line remaining as line#1 (happens in treelisting mode with banner suppressed) - while getline(1) =~ '^\s*$' && byte2line(1) > 0 -" call Decho("deleting blank line",'~'.expand("")) - 1d - endwhile - - exe "setl ".g:netrw_bufsettings - -" call Dret("s:NetrwTreeListing : bufname<".expand("%").">") - return - endif -endfun - -" --------------------------------------------------------------------- -" s:NetrwTreePath: returns path to current file/directory in tree listing {{{2 -" Normally, treetop is w:netrw_treetop, but a -" user of the function ( netrw#SetTreetop() ) -" wipes that out prior to calling this function -fun! s:NetrwTreePath(treetop) -" call Dfunc("s:NetrwTreePath(treetop<".a:treetop.">) line#".line(".")."<".getline(".").">") - if line(".") < w:netrw_bannercnt + 2 - let treedir= a:treetop - if treedir !~ '/$' - let treedir= treedir.'/' - endif -" call Dret("s:NetrwTreePath ".treedir." : line#".line(".")." ≤ ".(w:netrw_bannercnt+2)) - return treedir - endif - - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') -" call Decho("depth<".depth."> 1st subst",'~'.expand("")) - let depth = substitute(depth,'^'.s:treedepthstring,'','') -" call Decho("depth<".depth."> 2nd subst (first depth removed)",'~'.expand("")) - let curline= getline('.') -" call Decho("curline<".curline.'>','~'.expand("")) - if curline =~ '/$' -" call Decho("extract tree directory from current line",'~'.expand("")) - let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') -" call Decho("treedir<".treedir.">",'~'.expand("")) - elseif curline =~ '@\s\+-->' -" call Decho("extract tree directory using symbolic link",'~'.expand("")) - let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') - let treedir= substitute(treedir,'@\s\+-->.*$','','e') -" call Decho("treedir<".treedir.">",'~'.expand("")) - else -" call Decho("do not extract tree directory from current line and set treedir to empty",'~'.expand("")) - let treedir= "" - endif - " construct treedir by searching backwards at correct depth -" call Decho("construct treedir by searching backwards for correct depth",'~'.expand("")) -" call Decho("initial treedir<".treedir."> depth<".depth.">",'~'.expand("")) - while depth != "" && search('^'.depth.'[^'.s:treedepthstring.'].\{-}/$','bW') - let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') - let treedir= dirname.treedir - let depth = substitute(depth,'^'.s:treedepthstring,'','') -" call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">",'~'.expand("")) - endwhile -" call Decho("treedir#1<".treedir.">",'~'.expand("")) - if a:treetop =~ '/$' - let treedir= a:treetop.treedir - else - let treedir= a:treetop.'/'.treedir - endif -" call Decho("treedir#2<".treedir.">",'~'.expand("")) - let treedir= substitute(treedir,'//$','/','') -" call Decho("treedir#3<".treedir.">",'~'.expand("")) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand(""))" - call winrestview(svpos) -" call Dret("s:NetrwTreePath <".treedir.">") - return treedir -endfun - -" --------------------------------------------------------------------- -" s:NetrwWideListing: {{{2 -fun! s:NetrwWideListing() - - if w:netrw_liststyle == s:WIDELIST -" call Dfunc("NetrwWideListing() w:netrw_liststyle=".w:netrw_liststyle.' fo='.&fo.' l:fo='.&l:fo) - " look for longest filename (cpf=characters per filename) - " cpf: characters per filename - " fpl: filenames per line - " fpc: filenames per column - setl ma noro - let keepa= @a -" call Decho("setl ma noro",'~'.expand("")) - let b:netrw_cpf= 0 - if line("$") >= w:netrw_bannercnt - " determine the maximum filename size; use that to set cpf - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' - NetrwKeepj call histdel("/",-1) - else - let @a= keepa -" call Dret("NetrwWideListing") - return - endif - " allow for two spaces to separate columns - let b:netrw_cpf= b:netrw_cpf + 2 -" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("")) - - " determine qty files per line (fpl) - let w:netrw_fpl= winwidth(0)/b:netrw_cpf - if w:netrw_fpl <= 0 - let w:netrw_fpl= 1 - endif -" call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl,'~'.expand("")) - - " make wide display - " fpc: files per column of wide listing - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'S",submatch(0)),"\\")/' - NetrwKeepj call histdel("/",-1) - let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl - let newcolstart = w:netrw_bannercnt + fpc - let newcolend = newcolstart + fpc - 1 -" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("")) - while line("$") >= newcolstart - if newcolend > line("$") | let newcolend= line("$") | endif - let newcolqty= newcolend - newcolstart - exe newcolstart - " COMBAK: both of the visual-mode using lines below are problematic vis-a-vis @* - if newcolqty == 0 - exe "sil! NetrwKeepj norm! 0\$h\"ax".w:netrw_bannercnt."G$\"ap" - else - exe "sil! NetrwKeepj norm! 0\".newcolqty.'j$h"ax'.w:netrw_bannercnt.'G$"ap' - endif - exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _' - exe 'sil! NetrwKeepj '.w:netrw_bannercnt - endwhile - exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/\s\+$//e' - NetrwKeepj call histdel("/",-1) - exe 'nno w :call search(''^.\\|\s\s\zs\S'',''W'')'."\" - exe 'nno b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\" -" call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("")) - exe "setl ".g:netrw_bufsettings - let @a= keepa -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("NetrwWideListing") - return - else - if hasmapto("w","n") - sil! nunmap w - endif - if hasmapto("b","n") - sil! nunmap b - endif - endif - -endfun - -" --------------------------------------------------------------------- -" s:PerformListing: {{{2 -fun! s:PerformListing(islocal) -" call Dfunc("s:PerformListing(islocal=".a:islocal.")") -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) -" call Decho("settings: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)"." ei<".&ei.">",'~'.expand("")) - sil! NetrwKeepj %d _ -" call DechoBuf(bufnr("%")) - - " set up syntax highlighting {{{3 -" call Decho("--set up syntax highlighting (ie. setl ft=netrw)",'~'.expand("")) - sil! setl ft=netrw - - NetrwKeepj call s:NetrwOptionsSafe(a:islocal) - setl noro ma -" call Decho("setl noro ma bh=".&bh,'~'.expand("")) - -" if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho -" call Decho("Processing your browsing request...",'~'.expand("")) -" endif " Decho - -" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("")) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") - " force a refresh for tree listings -" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d",'~'.expand("")) - sil! NetrwKeepj %d _ - endif - - " save current directory on directory history list - NetrwKeepj call s:NetrwBookHistHandler(3,b:netrw_curdir) - - " Set up the banner {{{3 - if g:netrw_banner -" call Decho("--set up banner",'~'.expand("")) - NetrwKeepj call setline(1,'" ============================================================================') - if exists("g:netrw_pchk") - " this undocumented option allows pchk to run with different versions of netrw without causing spurious - " failure detections. - NetrwKeepj call setline(2,'" Netrw Directory Listing') - else - NetrwKeepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') - endif - if exists("g:netrw_pchk") - let curdir= substitute(b:netrw_curdir,expand("$HOME"),'~','') - else - let curdir= b:netrw_curdir - endif - if exists("g:netrw_bannerbackslash") && g:netrw_bannerbackslash - NetrwKeepj call setline(3,'" '.substitute(curdir,'/','\\','g')) - else - NetrwKeepj call setline(3,'" '.curdir) - endif - let w:netrw_bannercnt= 3 - NetrwKeepj exe "sil! NetrwKeepj ".w:netrw_bannercnt - else -" call Decho("--no banner",'~'.expand("")) - NetrwKeepj 1 - let w:netrw_bannercnt= 1 - endif -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr(),'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) - - " construct sortby string: [name|time|size|exten] [reversed] - let sortby= g:netrw_sort_by - if g:netrw_sort_direction =~# "^r" - let sortby= sortby." reversed" - endif - - " Sorted by... {{{3 - if g:netrw_banner -" call Decho("--handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("")) - if g:netrw_sort_by =~# "^n" -" call Decho("directories will be sorted by name",'~'.expand("")) - " sorted by name (also includes the sorting sequence in the banner) - NetrwKeepj put ='\" Sorted by '.sortby - NetrwKeepj put ='\" Sort sequence: '.g:netrw_sort_sequence - let w:netrw_bannercnt= w:netrw_bannercnt + 2 - else -" call Decho("directories will be sorted by size or time",'~'.expand("")) - " sorted by time, size, exten - NetrwKeepj put ='\" Sorted by '.sortby - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - endif - exe "sil! NetrwKeepj ".w:netrw_bannercnt -" else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - endif - - " show copy/move target, if any {{{3 - if g:netrw_banner - if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") -" call Decho("--show copy/move target<".s:netrwmftgt.">",'~'.expand("")) - NetrwKeepj put ='' - if s:netrwmftgt_islocal - sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') - else - sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)') - endif - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - else -" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt",'~'.expand("")) - endif - exe "sil! NetrwKeepj ".w:netrw_bannercnt - endif - - " Hiding... -or- Showing... {{{3 - if g:netrw_banner -" call Decho("--handle hiding/showing in banner (g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("")) - if g:netrw_list_hide != "" && g:netrw_hide - if g:netrw_hide == 1 - NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide - else - NetrwKeepj put ='\" Showing: '.g:netrw_list_hide - endif - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - endif - exe "NetrwKeepj ".w:netrw_bannercnt - -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - let quickhelp = g:netrw_quickhelp%len(s:QuickHelp) -" call Decho("quickhelp =".quickhelp,'~'.expand("")) - NetrwKeepj put ='\" Quick Help: :help '.s:QuickHelp[quickhelp] -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - NetrwKeepj put ='\" ==============================================================================' - let w:netrw_bannercnt= w:netrw_bannercnt + 2 -" else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - endif - - " bannercnt should index the line just after the banner - if g:netrw_banner - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - exe "sil! NetrwKeepj ".w:netrw_bannercnt -" call Decho("--w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"),'~'.expand("")) -" else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - endif - - " get list of files -" call Decho("--Get list of files - islocal=".a:islocal,'~'.expand("")) - if a:islocal - NetrwKeepj call s:LocalListing() - else " remote - NetrwKeepj let badresult= s:NetrwRemoteListing() - if badresult -" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) -" call Dret("s:PerformListing : error detected by NetrwRemoteListing") - return - endif - endif - - " manipulate the directory listing (hide, sort) {{{3 - if !exists("w:netrw_bannercnt") - let w:netrw_bannercnt= 0 - endif -" call Decho("--manipulate directory listing (hide, sort)",'~'.expand("")) -" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)",'~'.expand("")) -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - - if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (support hide)",'~'.expand("")) -" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) - if g:netrw_hide && g:netrw_list_hide != "" - NetrwKeepj call s:NetrwListHide() - endif - if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("")) - - if g:netrw_sort_by =~# "^n" - " sort by name -" call Decho("sort by name",'~'.expand("")) - NetrwKeepj call s:NetrwSetSort() - - if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - if g:netrw_sort_direction =~# 'n' - " name: sort by name of file - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options - else - " reverse direction sorting - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options - endif - endif - - " remove priority pattern prefix -" call Decho("remove priority pattern prefix",'~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' - NetrwKeepj call histdel("/",-1) - - elseif g:netrw_sort_by =~# "^ext" - " exten: sort by extension - " The histdel(...,-1) calls remove the last search from the search history -" call Decho("sort by extension",'~'.expand("")) - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g+/+s/^/001'.g:netrw_sepchr.'/' - NetrwKeepj call histdel("/",-1) - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+[./]+s/^/002'.g:netrw_sepchr.'/' - NetrwKeepj call histdel("/",-1) - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+['.g:netrw_sepchr.'/]+s/^\(.*\.\)\(.\{-\}\)$/\2'.g:netrw_sepchr.'&/e' - NetrwKeepj call histdel("/",-1) - if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - if g:netrw_sort_direction =~# 'n' - " normal direction sorting - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options - else - " reverse direction sorting - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options - endif - endif - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^.\{-}'.g:netrw_sepchr.'//e' - NetrwKeepj call histdel("/",-1) - - elseif a:islocal - if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction,'~'.expand("")) - if g:netrw_sort_direction =~# 'n' -" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort','~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options - else -" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!','~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options - endif -" call Decho("remove leading digits/ (sorting) information from listing",'~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e' - NetrwKeepj call histdel("/",-1) - endif - endif - - elseif g:netrw_sort_direction =~# 'r' -" call Decho('(s:PerformListing) reverse the sorted listing','~'.expand("")) - if !g:netrw_banner || w:netrw_bannercnt < line('$') - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt - call histdel("/",-1) - endif - endif - endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - - " convert to wide/tree listing {{{3 -" call Decho("--modify display if wide/tree listing style",'~'.expand("")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)",'~'.expand("")) - NetrwKeepj call s:NetrwWideListing() -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)",'~'.expand("")) - NetrwKeepj call s:NetrwTreeListing(b:netrw_curdir) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)",'~'.expand("")) - - " resolve symbolic links if local and (thin or tree) - if a:islocal && (w:netrw_liststyle == s:THINLIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST)) -" call Decho("--resolve symbolic links if local and thin|tree",'~'.expand("")) - sil! g/@$/call s:ShowLink() - endif - - if exists("w:netrw_bannercnt") && (line("$") >= w:netrw_bannercnt || !g:netrw_banner) - " place cursor on the top-left corner of the file listing -" call Decho("--place cursor on top-left corner of file listing",'~'.expand("")) - exe 'sil! '.w:netrw_bannercnt - sil! NetrwKeepj norm! 0 -" call Decho(" tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) - else -" call Decho("--did NOT place cursor on top-left corner",'~'.expand("")) -" call Decho(" w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("")) -" call Decho(" line($)=".line("$"),'~'.expand("")) -" call Decho(" g:netrw_banner=".(exists("g:netrw_banner")? g:netrw_banner : 'n/a'),'~'.expand("")) - endif - - " record previous current directory - let w:netrw_prvdir= b:netrw_curdir -" call Decho("--record netrw_prvdir<".w:netrw_prvdir.">",'~'.expand("")) - - " save certain window-oriented variables into buffer-oriented variables {{{3 -" call Decho("--save some window-oriented variables into buffer oriented variables",'~'.expand("")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)",'~'.expand("")) - NetrwKeepj call s:SetBufWinVars() -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)",'~'.expand("")) - NetrwKeepj call s:NetrwOptionsRestore("w:") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)",'~'.expand("")) - - " set display to netrw display settings -" call Decho("--set display to netrw display settings (".g:netrw_bufsettings.")",'~'.expand("")) - exe "setl ".g:netrw_bufsettings -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#7)",'~'.expand("")) - if g:netrw_liststyle == s:LONGLIST -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("")) - exe "setl ts=".(g:netrw_maxfilenamelen+1) - endif -" call Decho("PerformListing buffer:",'~'.expand("")) -" call DechoBuf(bufnr("%")) - - if exists("s:treecurpos") -" call Decho("s:treecurpos exists; restore posn",'~'.expand("")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)",'~'.expand("")) -" call Decho("restoring posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("")) - NetrwKeepj call winrestview(s:treecurpos) - unlet s:treecurpos - endif - -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (return)",'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) -" call Dret("s:PerformListing : curpos<".string(getpos(".")).">") -endfun - -" --------------------------------------------------------------------- -" s:SetupNetrwStatusLine: {{{2 -fun! s:SetupNetrwStatusLine(statline) -" call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)") - - if !exists("s:netrw_setup_statline") - let s:netrw_setup_statline= 1 -" call Decho("do first-time status line setup",'~'.expand("")) - - if !exists("s:netrw_users_stl") - let s:netrw_users_stl= &stl - endif - if !exists("s:netrw_users_ls") - let s:netrw_users_ls= &laststatus - endif - - " set up User9 highlighting as needed - let keepa= @a - redir @a - try - hi User9 - catch /^Vim\%((\a\{3,})\)\=:E411/ - if &bg == "dark" - hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue - else - hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue - endif - endtry - redir END - let @a= keepa - endif - - " set up status line (may use User9 highlighting) - " insure that windows have a statusline - " make sure statusline is displayed - let &l:stl=a:statline - setl laststatus=2 -" call Decho("stl=".&stl,'~'.expand("")) - redraw - -" call Dret("SetupNetrwStatusLine : stl=".&stl) -endfun - -" ========================================= -" Remote Directory Browsing Support: {{{1 -" ========================================= - -" --------------------------------------------------------------------- -" s:NetrwRemoteFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2 -" This function assumes that a long listing will be received. Size, time, -" and reverse sorts will be requested of the server but not otherwise -" enforced here. -fun! s:NetrwRemoteFtpCmd(path,listcmd) -" call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) w:netrw_method=".(exists("w:netrw_method")? w:netrw_method : (exists("b:netrw_method")? b:netrw_method : "???"))) -" call Decho("line($)=".line("$")." win#".winnr()." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("")) - " sanity check: {{{3 - if !exists("w:netrw_method") - if exists("b:netrw_method") - let w:netrw_method= b:netrw_method - else - call netrw#ErrorMsg(2,"(s:NetrwRemoteFtpCmd) internal netrw error",93) -" call Dret("NetrwRemoteFtpCmd") - return - endif - endif - - " WinXX ftp uses unix style input, so set ff to unix " {{{3 - let ffkeep= &ff - setl ma ff=unix noro -" call Decho("setl ma ff=unix noro",'~'.expand("")) - - " clear off any older non-banner lines " {{{3 - " note that w:netrw_bannercnt indexes the line after the banner -" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d _ (clear off old non-banner lines)",'~'.expand("")) - exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _" - - "......................................... - if w:netrw_method == 2 || w:netrw_method == 5 " {{{3 - " ftp + <.netrc>: Method #2 - if a:path != "" - NetrwKeepj put ='cd \"'.a:path.'\"' - endif - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.'),'~'.expand("")) - endif - NetrwKeepj call setline(line("$")+1,a:listcmd) -" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand(""))' - if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1),'~'.expand("")) - exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1) - else -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1),'~'.expand("")) - exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1) - endif - - "......................................... - elseif w:netrw_method == 3 " {{{3 - " ftp + machine,id,passwd,filename: Method #3 - setl ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port - else - NetrwKeepj put ='open '.g:netrw_machine - endif - - " handle userid and password - let host= substitute(g:netrw_machine,'\..*$','','') -" call Decho("host<".host.">",'~'.expand("")) - if exists("s:netrw_hup") && exists("s:netrw_hup[host]") - call NetUserPass("ftp:".host) - endif - if exists("g:netrw_uid") && g:netrw_uid != "" - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - NetrwKeepj put =g:netrw_uid - if exists("s:netrw_passwd") && s:netrw_passwd != "" - NetrwKeepj put ='\"'.s:netrw_passwd.'\"' - endif - elseif exists("s:netrw_passwd") - NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' - endif - endif - - if a:path != "" - NetrwKeepj put ='cd \"'.a:path.'\"' - endif - if exists("g:netrw_ftpextracmd") - NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.'),'~'.expand("")) - endif - NetrwKeepj call setline(line("$")+1,a:listcmd) - - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password - if exists("w:netrw_bannercnt") -" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand(""))' - call s:NetrwExe(s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) -" else " Decho -" call Decho("WARNING: w:netrw_bannercnt doesn't exist!",'~'.expand("")) -" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline("."),'~'.expand("")) - endif - - "......................................... - elseif w:netrw_method == 9 " {{{3 - " sftp username@machine: Method #9 - " s:netrw_sftp_cmd - setl ff=unix - - " restore settings - let &l:ff= ffkeep -" call Dret("NetrwRemoteFtpCmd") - return - - "......................................... - else " {{{3 - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . bufname("%") . ">",23) - endif - - " cleanup for Windows " {{{3 - if has("win32") || has("win95") || has("win64") || has("win16") - sil! NetrwKeepj %s/\r$//e - NetrwKeepj call histdel("/",-1) - endif - if a:listcmd == "dir" - " infer directory/link based on the file permission string - sil! NetrwKeepj g/d\%([-r][-w][-x]\)\{3}/NetrwKeepj s@$@/@e - sil! NetrwKeepj g/l\%([-r][-w][-x]\)\{3}/NetrwKeepj s/$/@/e - NetrwKeepj call histdel("/",-1) - NetrwKeepj call histdel("/",-1) - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST) - exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' - NetrwKeepj call histdel("/",-1) - endif - endif - - " ftp's listing doesn't seem to include ./ or ../ " {{{3 - if !search('^\.\/$\|\s\.\/$','wn') - exe 'NetrwKeepj '.w:netrw_bannercnt - NetrwKeepj put ='./' - endif - if !search('^\.\.\/$\|\s\.\.\/$','wn') - exe 'NetrwKeepj '.w:netrw_bannercnt - NetrwKeepj put ='../' - endif - - " restore settings " {{{3 - let &l:ff= ffkeep -" call Dret("NetrwRemoteFtpCmd") -endfun - -" --------------------------------------------------------------------- -" s:NetrwRemoteListing: {{{2 -fun! s:NetrwRemoteListing() -" call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">) win#".winnr()) - - if !exists("w:netrw_bannercnt") && exists("s:bannercnt") - let w:netrw_bannercnt= s:bannercnt - endif - if !exists("w:netrw_bannercnt") && exists("b:bannercnt") - let w:netrw_bannercnt= b:bannercnt - endif - - call s:RemotePathAnalysis(b:netrw_curdir) - - " sanity check: - if exists("b:netrw_method") && b:netrw_method =~ '[235]' -" call Decho("b:netrw_method=".b:netrw_method,'~'.expand("")) - if !executable("ftp") -" call Decho("ftp is not executable",'~'.expand("")) - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18) - endif - call s:NetrwOptionsRestore("w:") -" call Dret("s:NetrwRemoteListing -1") - return -1 - endif - - elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' -" call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">",'~'.expand("")) - if !exists("g:netrw_quiet") - if g:netrw_list_cmd == "" - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your g:netrw_list_cmd is empty; perhaps ".g:netrw_ssh_cmd." is not executable on your system",47) - else - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19) - endif - endif - - NetrwKeepj call s:NetrwOptionsRestore("w:") -" call Dret("s:NetrwRemoteListing -1") - return -1 - endif " (remote handling sanity check) -" call Decho("passed remote listing sanity checks",'~'.expand("")) - - if exists("b:netrw_method") -" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">",'~'.expand("")) - let w:netrw_method= b:netrw_method - endif - - if s:method == "ftp" - " use ftp to get remote file listing {{{3 -" call Decho("use ftp to get remote file listing",'~'.expand("")) - let s:method = "ftp" - let listcmd = g:netrw_ftp_list_cmd - if g:netrw_sort_by =~# '^t' - let listcmd= g:netrw_ftp_timelist_cmd - elseif g:netrw_sort_by =~# '^s' - let listcmd= g:netrw_ftp_sizelist_cmd - endif -" call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)",'~'.expand("")) - call s:NetrwRemoteFtpCmd(s:path,listcmd) -" exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."),''~''.expand(""))' - - " report on missing file or directory messages - if search('[Nn]o such file or directory\|Failed to change directory') - let mesg= getline(".") - if exists("w:netrw_bannercnt") - setl ma - exe w:netrw_bannercnt.",$d _" - setl noma - endif - NetrwKeepj call s:NetrwOptionsRestore("w:") - call netrw#ErrorMsg(s:WARNING,mesg,96) -" call Dret("s:NetrwRemoteListing : -1") - return -1 - endif - - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST) - " shorten the listing -" call Decho("generate short listing",'~'.expand("")) - exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt - - " cleanup - if g:netrw_ftp_browse_reject != "" - exe "sil! keepalt NetrwKeepj g/".g:netrw_ftp_browse_reject."/NetrwKeepj d" - NetrwKeepj call histdel("/",-1) - endif - sil! NetrwKeepj %s/\r$//e - NetrwKeepj call histdel("/",-1) - - " if there's no ../ listed, then put ../ in - let line1= line(".") - exe "sil! NetrwKeepj ".w:netrw_bannercnt - let line2= search('\.\.\/\%(\s\|$\)','cnW') -" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("")) - if line2 == 0 -" call Decho("netrw is putting ../ into listing",'~'.expand("")) - sil! NetrwKeepj put='../' - endif - exe "sil! NetrwKeepj ".line1 - sil! NetrwKeepj norm! 0 - -" call Decho("line1=".line1." line2=".line2." line(.)=".line("."),'~'.expand("")) - if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup -" call Decho("M$ ftp cleanup",'~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+//' - NetrwKeepj call histdel("/",-1) - else " normal ftp cleanup -" call Decho("normal ftp cleanup",'~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' - exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' - exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' - NetrwKeepj call histdel("/",-1) - NetrwKeepj call histdel("/",-1) - NetrwKeepj call histdel("/",-1) - endif - endif - - else - " use ssh to get remote file listing {{{3 -" call Decho("use ssh to get remote file listing: s:path<".s:path.">",'~'.expand("")) - let listcmd= s:MakeSshCmd(g:netrw_list_cmd) -" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)",'~'.expand("")) - if g:netrw_scp_cmd =~ '^pscp' -" call Decho("1: exe r! ".s:ShellEscape(listcmd.s:path, 1),'~'.expand("")) - exe "NetrwKeepj r! ".listcmd.s:ShellEscape(s:path, 1) - " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like - sil! NetrwKeepj g/^Listing directory/NetrwKeepj d - sil! NetrwKeepj g/^d[-rwx][-rwx][-rwx]/NetrwKeepj s+$+/+e - sil! NetrwKeepj g/^l[-rwx][-rwx][-rwx]/NetrwKeepj s+$+@+e - NetrwKeepj call histdel("/",-1) - NetrwKeepj call histdel("/",-1) - NetrwKeepj call histdel("/",-1) - if g:netrw_liststyle != s:LONGLIST - sil! NetrwKeepj g/^[dlsp-][-rwx][-rwx][-rwx]/NetrwKeepj s/^.*\s\(\S\+\)$/\1/e - NetrwKeepj call histdel("/",-1) - endif - else - if s:path == "" -" call Decho("2: exe r! ".listcmd,'~'.expand("")) - exe "NetrwKeepj keepalt r! ".listcmd - else -" call Decho("3: exe r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1),'~'.expand("")) - exe "NetrwKeepj keepalt r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1) -" call Decho("listcmd<".listcmd."> path<".s:path.">",'~'.expand("")) - endif - endif - - " cleanup - if g:netrw_ssh_browse_reject != "" -" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d",'~'.expand("")) - exe "sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d" - NetrwKeepj call histdel("/",-1) - endif - endif - - if w:netrw_liststyle == s:LONGLIST - " do a long listing; these substitutions need to be done prior to sorting {{{3 -" call Decho("fix long listing:",'~'.expand("")) - - if s:method == "ftp" - " cleanup - exe "sil! NetrwKeepj ".w:netrw_bannercnt - while getline('.') =~# g:netrw_ftp_browse_reject - sil! NetrwKeepj d - endwhile - " if there's no ../ listed, then put ../ in - let line1= line(".") - sil! NetrwKeepj 1 - sil! NetrwKeepj call search('^\.\.\/\%(\s\|$\)','W') - let line2= line(".") - if line2 == 0 - if b:netrw_curdir != '/' - exe 'sil! NetrwKeepj '.w:netrw_bannercnt."put='../'" - endif - endif - exe "sil! NetrwKeepj ".line1 - sil! NetrwKeepj norm! 0 - endif - - if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup -" call Decho("M$ ftp site listing cleanup",'~'.expand("")) - exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/' - elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") -" call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("")) - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/ -> .*$//e' - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2 \t\1/e' - exe 'sil NetrwKeepj '.w:netrw_bannercnt - NetrwKeepj call histdel("/",-1) - NetrwKeepj call histdel("/",-1) - NetrwKeepj call histdel("/",-1) - endif - endif - -" if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho -" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."),''~''.expand(""))' -" endif " Decho - -" call Dret("s:NetrwRemoteListing 0") - return 0 -endfun - -" --------------------------------------------------------------------- -" s:NetrwRemoteRm: remove/delete a remote file or directory {{{2 -fun! s:NetrwRemoteRm(usrhost,path) range -" call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol(".")) -" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("")) - let svpos= winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - - let all= 0 - if exists("s:netrwmarkfilelist_{bufnr('%')}") - " remove all marked files -" call Decho("remove all marked files with bufnr#".bufnr("%"),'~'.expand("")) - for fname in s:netrwmarkfilelist_{bufnr("%")} - let ok= s:NetrwRemoteRmFile(a:path,fname,all) - if ok =~# 'q\%[uit]' - break - elseif ok =~# 'a\%[ll]' - let all= 1 - endif - endfor - call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - - else - " remove files specified by range -" call Decho("remove files specified by range",'~'.expand("")) - - " preparation for removing multiple files/directories - let keepsol = &l:sol - setl nosol - let ctr = a:firstline - - " remove multiple files and directories - while ctr <= a:lastline - exe "NetrwKeepj ".ctr - let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all) - if ok =~# 'q\%[uit]' - break - elseif ok =~# 'a\%[ll]' - let all= 1 - endif - let ctr= ctr + 1 - endwhile - let &l:sol = keepsol - endif - - " refresh the (remote) directory listing -" call Decho("refresh remote directory listing",'~'.expand("")) - NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - -" call Dret("s:NetrwRemoteRm") -endfun - -" --------------------------------------------------------------------- -" s:NetrwRemoteRmFile: {{{2 -fun! s:NetrwRemoteRmFile(path,rmfile,all) -" call Dfunc("s:NetrwRemoteRmFile(path<".a:path."> rmfile<".a:rmfile.">) all=".a:all) - - let all= a:all - let ok = "" - - if a:rmfile !~ '^"' && (a:rmfile =~ '@$' || a:rmfile !~ '[\/]$') - " attempt to remove file -" call Decho("attempt to remove file (all=".all.")",'~'.expand("")) - if !all - echohl Statement -" call Decho("case all=0:",'~'.expand("")) - call inputsave() - let ok= input("Confirm deletion of file<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - echohl NONE - if ok == "" - let ok="no" - endif - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~# 'a\%[ll]' - let all= 1 - endif - endif - - if all || ok =~# 'y\%[es]' || ok == "" -" call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : ""),'~'.expand("")) - if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) -" call Decho("case ftp:",'~'.expand("")) - let path= a:path - if path =~ '^\a\{3,}://' - let path= substitute(path,'^\a\{3,}://[^/]\+/','','') - endif - sil! NetrwKeepj .,$d _ - call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"') - else -" call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">",'~'.expand("")) - let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd) -" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("")) - if !exists("b:netrw_curdir") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) - let ok="q" - else - let remotedir= substitute(b:netrw_curdir,'^.\{-}//[^/]\+/\(.*\)$','\1','') -" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("")) -" call Decho("remotedir<".remotedir.">",'~'.expand("")) -" call Decho("rmfile<".a:rmfile.">",'~'.expand("")) - if remotedir != "" - let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(remotedir.a:rmfile)) - else - let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(a:rmfile)) - endif -" call Decho("call system(".netrw_rm_cmd.")",'~'.expand("")) - let ret= system(netrw_rm_cmd) - if v:shell_error != 0 - if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir - call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102) - else - call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) - endif - elseif ret != 0 - call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) - endif -" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("")) - endif - endif - elseif ok =~# 'q\%[uit]' -" call Decho("ok==".ok,'~'.expand("")) - endif - - else - " attempt to remove directory -" call Decho("attempt to remove directory",'~'.expand("")) - if !all - call inputsave() - let ok= input("Confirm deletion of directory<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - if ok == "" - let ok="no" - endif - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~# 'a\%[ll]' - let all= 1 - endif - endif - - if all || ok =~# 'y\%[es]' || ok == "" - if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) - else - let rmfile = substitute(a:path.a:rmfile,'/$','','') - let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.s:ShellEscape(netrw#WinPath(rmfile)) -" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")",'~'.expand("")) - let ret= system(netrw_rmdir_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("")) - - if v:shell_error != 0 -" call Decho("v:shell_error not 0",'~'.expand("")) - let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.s:ShellEscape(netrw#WinPath(substitute(rmfile,'[\/]$','','e'))) -" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")",'~'.expand("")) - let ret= system(netrw_rmf_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("")) - - if v:shell_error != 0 && !exists("g:netrw_quiet") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) - endif - endif - endif - - elseif ok =~# 'q\%[uit]' -" call Decho("ok==".ok,'~'.expand("")) - endif - endif - -" call Dret("s:NetrwRemoteRmFile ".ok) - return ok -endfun - -" --------------------------------------------------------------------- -" s:NetrwRemoteRename: rename a remote file or directory {{{2 -fun! s:NetrwRemoteRename(usrhost,path) range -" call Dfunc("NetrwRemoteRename(usrhost<".a:usrhost."> path<".a:path.">)") - - " preparation for removing multiple files/directories - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - let ctr = a:firstline - let rename_cmd = s:MakeSshCmd(g:netrw_rename_cmd) - - " rename files given by the markfilelist - if exists("s:netrwmarkfilelist_{bufnr('%')}") - for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">",'~'.expand("")) - if exists("subfrom") - let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("")) - else - call inputsave() - let newname= input("Moving ".oldname." to : ",oldname) - call inputrestore() - if newname =~ '^s/' - let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') - let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') - let newname = substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("")) - endif - endif - - if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) - else - let oldname= s:ShellEscape(a:path.oldname) - let newname= s:ShellEscape(a:path.newname) -" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("")) - let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) - endif - - endfor - call s:NetrwUnMarkFile(1) - - else - - " attempt to rename files/directories - let keepsol= &l:sol - setl nosol - while ctr <= a:lastline - exe "NetrwKeepj ".ctr - - let oldname= s:NetrwGetWord() -" call Decho("oldname<".oldname.">",'~'.expand("")) - - call inputsave() - let newname= input("Moving ".oldname." to : ",oldname) - call inputrestore() - - if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) - else - let oldname= s:ShellEscape(a:path.oldname) - let newname= s:ShellEscape(a:path.newname) -" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("")) - let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) - endif - - let ctr= ctr + 1 - endwhile - let &l:sol= keepsol - endif - - " refresh the directory - NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - -" call Dret("NetrwRemoteRename") -endfun - -" ========================================== -" Local Directory Browsing Support: {{{1 -" ========================================== - -" --------------------------------------------------------------------- -" netrw#FileUrlEdit: handles editing file://* files {{{2 -" Should accept: file://localhost/etc/fstab -" file:///etc/fstab -" file:///c:/WINDOWS/clock.avi -" file:///c|/WINDOWS/clock.avi -" file://localhost/c:/WINDOWS/clock.avi -" file://localhost/c|/WINDOWS/clock.avi -" file://c:/foo.txt -" file:///c:/foo.txt -" and %XX (where X is [0-9a-fA-F] is converted into a character with the given hexadecimal value -fun! netrw#FileUrlEdit(fname) -" call Dfunc("netrw#FileUrlEdit(fname<".a:fname.">)") - let fname = a:fname - if fname =~ '^file://localhost/' -" call Decho('converting file://localhost/ -to- file:///','~'.expand("")) - let fname= substitute(fname,'^file://localhost/','file:///','') -" call Decho("fname<".fname.">",'~'.expand("")) - endif - if (has("win32") || has("win95") || has("win64") || has("win16")) - if fname =~ '^file:///\=\a[|:]/' -" call Decho('converting file:///\a|/ -to- file://\a:/','~'.expand("")) - let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','') -" call Decho("fname<".fname.">",'~'.expand("")) - endif - endif - let fname2396 = netrw#RFC2396(fname) - let fname2396e= fnameescape(fname2396) - let plainfname= substitute(fname2396,'file://\(.*\)','\1',"") - if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows exception for plainfname",'~'.expand("")) - if plainfname =~ '^/\+\a:' -" call Decho('removing leading "/"s','~'.expand("")) - let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') - endif - endif - -" call Decho("fname2396<".fname2396.">",'~'.expand("")) -" call Decho("plainfname<".plainfname.">",'~'.expand("")) - exe "sil doau BufReadPre ".fname2396e - exe 'NetrwKeepj keepalt edit '.plainfname - exe 'sil! NetrwKeepj keepalt bdelete '.fnameescape(a:fname) - -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("netrw#FileUrlEdit") - exe "sil doau BufReadPost ".fname2396e -endfun - -" --------------------------------------------------------------------- -" netrw#LocalBrowseCheck: {{{2 -fun! netrw#LocalBrowseCheck(dirname) - " This function is called by netrwPlugin.vim's s:LocalBrowseCheck(), s:NetrwRexplore(), - " and by when atop a listed file/directory (via a buffer-local map) - " - " unfortunate interaction -- split window debugging can't be used here, must use - " D-echoRemOn or D-echoTabOn as the BufEnter event triggers - " another call to LocalBrowseCheck() when attempts to write - " to the DBG buffer are made. - " - " The &ft == "netrw" test was installed because the BufEnter event - " would hit when re-entering netrw windows, creating unexpected - " refreshes (and would do so in the middle of NetrwSaveOptions(), too) -" call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">)") -" call Decho("isdir<".a:dirname."> =".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).'~'.expand("")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) - " getting E930: Cannot use :redir inside execute -"" call Dredir("ls!","netrw#LocalBrowseCheck") -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Decho("current buffer#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("")) - - let ykeep= @@ - if isdirectory(s:NetrwFile(a:dirname)) -" call Decho("is-directory ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse,'~'.expand("")) - - if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1 -" call Decho("case 1 : ft=".&ft,'~'.expand("")) -" call Decho("s:rexposn_".bufnr("%")."<".bufname("%")."> ".(exists("s:rexposn_".bufnr("%"))? "exists" : "does not exist"),'~'.expand("")) - sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - - elseif &ft == "netrw" && line("$") == 1 -" call Decho("case 2 (ft≡netrw && line($)≡1)",'~'.expand("")) - sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - - elseif exists("s:treeforceredraw") -" call Decho("case 3 (treeforceredraw)",'~'.expand("")) - unlet s:treeforceredraw - sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - endif -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dret("netrw#LocalBrowseCheck") - return - endif - - " The following code wipes out currently unused netrw buffers - " IF g:netrw_fastbrowse is zero (ie. slow browsing selected) - " AND IF the listing style is not a tree listing - if exists("g:netrw_fastbrowse") && g:netrw_fastbrowse == 0 && g:netrw_liststyle != s:TREELIST -" call Decho("wiping out currently unused netrw buffers",'~'.expand("")) - let ibuf = 1 - let buflast = bufnr("$") - while ibuf <= buflast - if bufwinnr(ibuf) == -1 && isdirectory(s:NetrwFile(bufname(ibuf))) - exe "sil! keepj keepalt ".ibuf."bw!" - endif - let ibuf= ibuf + 1 - endwhile - endif - let @@= ykeep -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) - " not a directory, ignore it -" call Dret("netrw#LocalBrowseCheck : not a directory, ignoring it; dirname<".a:dirname.">") -endfun - -" --------------------------------------------------------------------- -" s:LocalBrowseRefresh: this function is called after a user has {{{2 -" performed any shell command. The idea is to cause all local-browsing -" buffers to be refreshed after a user has executed some shell command, -" on the chance that s/he removed/created a file/directory with it. -fun! s:LocalBrowseRefresh() -" call Dfunc("s:LocalBrowseRefresh() tabpagenr($)=".tabpagenr("$")) -" call Decho("s:netrw_browselist =".(exists("s:netrw_browselist")? string(s:netrw_browselist) : ''),'~'.expand("")) -" call Decho("w:netrw_bannercnt =".(exists("w:netrw_bannercnt")? string(w:netrw_bannercnt) : ''),'~'.expand("")) - - " determine which buffers currently reside in a tab - if !exists("s:netrw_browselist") -" call Dret("s:LocalBrowseRefresh : browselist is empty") - return - endif - if !exists("w:netrw_bannercnt") -" call Dret("s:LocalBrowseRefresh : don't refresh when focus not on netrw window") - return - endif - if !empty(getcmdwintype()) - " cannot move away from cmdline window, see :h E11 - return - endif - if exists("s:netrw_events") && s:netrw_events == 1 - " s:LocalFastBrowser gets called (indirectly) from a - let s:netrw_events= 2 -" call Dret("s:LocalBrowseRefresh : avoid initial double refresh") - return - endif - let itab = 1 - let buftablist = [] - let ykeep = @@ - while itab <= tabpagenr("$") - let buftablist = buftablist + tabpagebuflist() - let itab = itab + 1 - sil! tabn - endwhile -" call Decho("buftablist".string(buftablist),'~'.expand("")) -" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">",'~'.expand("")) - " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): - " | refresh any netrw window - " | wipe out any non-displaying netrw buffer - let curwinid = win_getid(winnr()) - let ibl = 0 - for ibuf in s:netrw_browselist -" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf),'~'.expand("")) - if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1 - " wipe out any non-displaying netrw buffer - " (ibuf not shown in a current window AND - " ibuf not in any tab) -" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">",'~'.expand("")) - exe "sil! keepj bd ".fnameescape(ibuf) - call remove(s:netrw_browselist,ibl) -" call Decho("browselist=".string(s:netrw_browselist),'~'.expand("")) - continue - elseif index(tabpagebuflist(),ibuf) != -1 - " refresh any netrw buffer -" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf),'~'.expand("")) - exe bufwinnr(ibuf)."wincmd w" - if getline(".") =~# 'Quick Help' - " decrement g:netrw_quickhelp to prevent refresh from changing g:netrw_quickhelp - " (counteracts s:NetrwBrowseChgDir()'s incrementing) - let g:netrw_quickhelp= g:netrw_quickhelp - 1 - endif -" call Decho("#3: quickhelp=".g:netrw_quickhelp,'~'.expand("")) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - NetrwKeepj call s:NetrwRefreshTreeDict(w:netrw_treetop) - endif - NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - endif - let ibl= ibl + 1 -" call Decho("bottom of s:netrw_browselist for loop: ibl=".ibl,'~'.expand("")) - endfor -" call Decho("restore window: win_gotoid(".curwinid.")") - call win_gotoid(curwinid) - let @@= ykeep - -" call Dret("s:LocalBrowseRefresh") -endfun - -" --------------------------------------------------------------------- -" s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2 -" -" g:netrw_ Directory Is -" fastbrowse Local Remote -" slow 0 D D D=Deleting a buffer implies it will not be re-used (slow) -" med 1 D H H=Hiding a buffer implies it may be re-used (fast) -" fast 2 H H -" -" Deleting a buffer means that it will be re-loaded when examined, hence "slow". -" Hiding a buffer means that it will be re-used when examined, hence "fast". -" (re-using a buffer may not be as accurate) -" -" s:netrw_events : doesn't exist, s:LocalFastBrowser() will install autocmds with medium-speed or fast browsing -" =1: autocmds installed, but ignore next FocusGained event to avoid initial double-refresh of listing. -" BufEnter may be first event, then a FocusGained event. Ignore the first FocusGained event. -" If :Explore used: it sets s:netrw_events to 2, so no FocusGained events are ignored. -" =2: autocmds installed (doesn't ignore any FocusGained events) -fun! s:LocalFastBrowser() -" call Dfunc("s:LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) -" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a'),'~'.expand("")) -" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "already installed" : "not installed"),'~'.expand("")) -" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "already installed" : "not installed"),'~'.expand("")) - - " initialize browselist, a list of buffer numbers that the local browser has used - if !exists("s:netrw_browselist") -" call Decho("initialize s:netrw_browselist",'~'.expand("")) - let s:netrw_browselist= [] - endif - - " append current buffer to fastbrowse list - if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1] -" call Decho("appendng current buffer to browselist",'~'.expand("")) - call add(s:netrw_browselist,bufnr("%")) -" call Decho("browselist=".string(s:netrw_browselist),'~'.expand("")) - endif - - " enable autocmd events to handle refreshing/removing local browser buffers - " If local browse buffer is currently showing: refresh it - " If local browse buffer is currently hidden : wipe it - " g:netrw_fastbrowse=0 : slow speed, never re-use directory listing - " =1 : medium speed, re-use directory listing for remote only - " =2 : fast speed, always re-use directory listing when possible - if g:netrw_fastbrowse <= 1 && !exists("#ShellCmdPost") && !exists("s:netrw_events") - let s:netrw_events= 1 - augroup AuNetrwEvent - au! - if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("installing autocmd: ShellCmdPost",'~'.expand("")) - au ShellCmdPost * call s:LocalBrowseRefresh() - else -" call Decho("installing autocmds: ShellCmdPost FocusGained",'~'.expand("")) - au ShellCmdPost,FocusGained * call s:LocalBrowseRefresh() - endif - augroup END - - " user must have changed fastbrowse to its fast setting, so remove - " the associated autocmd events - elseif g:netrw_fastbrowse > 1 && exists("#ShellCmdPost") && exists("s:netrw_events") -" call Decho("remove AuNetrwEvent autcmd group",'~'.expand("")) - unlet s:netrw_events - augroup AuNetrwEvent - au! - augroup END - augroup! AuNetrwEvent - endif - -" call Dret("s:LocalFastBrowser : browselist<".string(s:netrw_browselist).">") -endfun - -" --------------------------------------------------------------------- -" s:LocalListing: does the job of "ls" for local directories {{{2 -fun! s:LocalListing() -" call Dfunc("s:LocalListing()") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) - -" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist",'~'.expand("")) |endif -" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist",'~'.expand(""))|endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - - " get the list of files contained in the current directory - let dirname = b:netrw_curdir - let dirnamelen = strlen(b:netrw_curdir) - let filelist = s:NetrwGlob(dirname,"*",0) - let filelist = filelist + s:NetrwGlob(dirname,".*",0) -" call Decho("filelist=".string(filelist),'~'.expand("")) - - if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("filelist=".string(filelist),'~'.expand("")) - elseif index(filelist,'..') == -1 && b:netrw_curdir !~ '/' - " include ../ in the glob() entry if its missing -" call Decho("forcibly including on \"..\"",'~'.expand("")) - let filelist= filelist+[s:ComposePath(b:netrw_curdir,"../")] -" call Decho("filelist=".string(filelist),'~'.expand("")) - endif - -" call Decho("before while: dirname <".dirname.">",'~'.expand("")) -" call Decho("before while: dirnamelen<".dirnamelen.">",'~'.expand("")) -" call Decho("before while: filelist =".string(filelist),'~'.expand("")) - - if get(g:, 'netrw_dynamic_maxfilenamelen', 0) - let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")') - let g:netrw_maxfilenamelen = max(map(filelistcopy,'len(v:val)')) + 1 -" call Decho("dynamic_maxfilenamelen: filenames =".string(filelistcopy),'~'.expand("")) -" call Decho("dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen,'~'.expand("")) - endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) - - for filename in filelist -" call Decho(" ",'~'.expand("")) -" call Decho("for filename in filelist: filename<".filename.">",'~'.expand("")) - - if getftype(filename) == "link" - " indicate a symbolic link -" call Decho("indicate <".filename."> is a symbolic link with trailing @",'~'.expand("")) - let pfile= filename."@" - - elseif getftype(filename) == "socket" - " indicate a socket -" call Decho("indicate <".filename."> is a socket with trailing =",'~'.expand("")) - let pfile= filename."=" - - elseif getftype(filename) == "fifo" - " indicate a fifo -" call Decho("indicate <".filename."> is a fifo with trailing |",'~'.expand("")) - let pfile= filename."|" - - elseif isdirectory(s:NetrwFile(filename)) - " indicate a directory -" call Decho("indicate <".filename."> is a directory with trailing /",'~'.expand("")) - let pfile= filename."/" - - elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(s:NetrwFile(filename)) - if (has("win32") || has("win95") || has("win64") || has("win16")) - if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$' - " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("")) - let pfile= filename."*" - else - " normal file - let pfile= filename - endif - elseif executable(filename) - " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("")) - let pfile= filename."*" - else - " normal file - let pfile= filename - endif - - else - " normal file - let pfile= filename - endif -" call Decho("pfile<".pfile."> (after *@/ appending)",'~'.expand("")) - - if pfile =~ '//$' - let pfile= substitute(pfile,'//$','/','e') -" call Decho("change // to /: pfile<".pfile.">",'~'.expand("")) - endif - let pfile= strpart(pfile,dirnamelen) - let pfile= substitute(pfile,'^[/\\]','','e') -" call Decho("filename<".filename.">",'~'.expand("")) -" call Decho("pfile <".pfile.">",'~'.expand("")) - - if w:netrw_liststyle == s:LONGLIST - let longfile = printf("%-".g:netrw_maxfilenamelen."S",pfile) - let sz = getfsize(filename) - let szlen = 15 - (strdisplaywidth(longfile) - g:netrw_maxfilenamelen) - let szlen = (szlen > 0) ? szlen : 0 - - if g:netrw_sizestyle =~# "[hH]" - let sz= s:NetrwHumanReadable(sz) - endif - let fsz = printf("%".szlen."S",sz) - let pfile= longfile." ".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) -" call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("")) - endif - - if g:netrw_sort_by =~# "^t" - " sort by time (handles time up to 1 quintillion seconds, US) - " Decorate listing by prepending a timestamp/ . Sorting will then be done based on time. -" call Decho("implementing g:netrw_sort_by=".g:netrw_sort_by." (time)") -" call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("")) - let t = getftime(filename) - let ft = printf("%018d",t) -" call Decho("exe NetrwKeepj put ='".ft.'/'.pfile."'",'~'.expand("")) - let ftpfile= ft.'/'.pfile - sil! NetrwKeepj put=ftpfile - - elseif g:netrw_sort_by =~ "^s" - " sort by size (handles file sizes up to 1 quintillion bytes, US) -" call Decho("implementing g:netrw_sort_by=".g:netrw_sort_by." (size)") -" call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("")) - let sz = getfsize(filename) - let fsz = printf("%018d",sz) -" call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'",'~'.expand("")) - let fszpfile= fsz.'/'.pfile - sil! NetrwKeepj put =fszpfile - - else - " sort by name -" call Decho("implementing g:netrw_sort_by=".g:netrw_sort_by." (name)") -" call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("")) - sil! NetrwKeepj put=pfile - endif -" call DechoBuf(bufnr("%"),"bufnr(%)") - endfor - - " cleanup any windows mess at end-of-line - sil! NetrwKeepj g/^$/d - sil! NetrwKeepj %s/\r$//e - call histdel("/",-1) -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("")) - exe "setl ts=".(g:netrw_maxfilenamelen+1) - -" call Dret("s:LocalListing") -endfun - -" --------------------------------------------------------------------- -" s:NetrwLocalExecute: uses system() to execute command under cursor ("X" command support) {{{2 -fun! s:NetrwLocalExecute(cmd) -" call Dfunc("s:NetrwLocalExecute(cmd<".a:cmd.">)") - let ykeep= @@ - " sanity check - if !executable(a:cmd) - call netrw#ErrorMsg(s:ERROR,"the file<".a:cmd."> is not executable!",89) - let @@= ykeep -" call Dret("s:NetrwLocalExecute") - return - endif - - let optargs= input(":!".a:cmd,"","file") -" call Decho("optargs<".optargs.">",'~'.expand("")) - let result= system(a:cmd.optargs) -" call Decho("result,'~'.expand("")) - - " strip any ansi escape sequences off - let result = substitute(result,"\e\\[[0-9;]*m","","g") - - " show user the result(s) - echomsg result - let @@= ykeep - -" call Dret("s:NetrwLocalExecute") -endfun - -" --------------------------------------------------------------------- -" s:NetrwLocalRename: rename a local file or directory {{{2 -fun! s:NetrwLocalRename(path) range -" call Dfunc("NetrwLocalRename(path<".a:path.">)") - - if !exists("w:netrw_bannercnt") - let w:netrw_bannercnt= b:netrw_bannercnt - endif - - " preparation for removing multiple files/directories - let ykeep = @@ - let ctr = a:firstline - let svpos = winsaveview() - let all = 0 -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - - " rename files given by the markfilelist - if exists("s:netrwmarkfilelist_{bufnr('%')}") - for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">",'~'.expand("")) - if exists("subfrom") - let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("")) - else - call inputsave() - let newname= input("Moving ".oldname." to : ",oldname,"file") - call inputrestore() - if newname =~ '' - " two ctrl-x's : ignore all of string preceding the ctrl-x's - let newname = substitute(newname,'^.*','','') - elseif newname =~ '' - " one ctrl-x : ignore portion of string preceding ctrl-x but after last / - let newname = substitute(newname,'[^/]*','','') - endif - if newname =~ '^s/' - let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') - let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("")) - let newname = substitute(oldname,subfrom,subto,'') - endif - endif - if !all && filereadable(newname) - call inputsave() - let response= input("File<".newname."> already exists; do you want to overwrite it? (y/all/n) ") - call inputrestore() - if response == "all" - let all= 1 - elseif response != "y" && response != "yes" - " refresh the directory -" call Decho("refresh the directory listing",'~'.expand("")) - NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - let @@= ykeep -" call Dret("NetrwLocalRename") - return - endif - endif - call rename(oldname,newname) - endfor - call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - - else - - " attempt to rename files/directories - while ctr <= a:lastline - exe "NetrwKeepj ".ctr - - " sanity checks - if line(".") < w:netrw_bannercnt - let ctr= ctr + 1 - continue - endif - let curword= s:NetrwGetWord() - if curword == "./" || curword == "../" - let ctr= ctr + 1 - continue - endif - - NetrwKeepj norm! 0 - let oldname= s:ComposePath(a:path,curword) -" call Decho("oldname<".oldname.">",'~'.expand("")) - - call inputsave() - let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) - call inputrestore() - - call rename(oldname,newname) -" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("")) - - let ctr= ctr + 1 - endwhile - endif - - " refresh the directory -" call Decho("refresh the directory listing",'~'.expand("")) - NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - let @@= ykeep - -" call Dret("NetrwLocalRename") -endfun - -" --------------------------------------------------------------------- -" s:NetrwLocalRm: {{{2 -fun! s:NetrwLocalRm(path) range -" call Dfunc("s:NetrwLocalRm(path<".a:path.">)") -" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("")) - - if !exists("w:netrw_bannercnt") - let w:netrw_bannercnt= b:netrw_bannercnt - endif - - " preparation for removing multiple files/directories - let ykeep = @@ - let ret = 0 - let all = 0 - let svpos = winsaveview() -" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) - - if exists("s:netrwmarkfilelist_{bufnr('%')}") - " remove all marked files -" call Decho("remove all marked files",'~'.expand("")) - for fname in s:netrwmarkfilelist_{bufnr("%")} - let ok= s:NetrwLocalRmFile(a:path,fname,all) - if ok =~# 'q\%[uit]' || ok == "no" - break - elseif ok =~# 'a\%[ll]' - let all= 1 - endif - endfor - call s:NetrwUnMarkFile(1) - - else - " remove (multiple) files and directories -" call Decho("remove files in range [".a:firstline.",".a:lastline."]",'~'.expand("")) - - let keepsol= &l:sol - setl nosol - let ctr = a:firstline - while ctr <= a:lastline - exe "NetrwKeepj ".ctr - - " sanity checks - if line(".") < w:netrw_bannercnt - let ctr= ctr + 1 - continue - endif - let curword= s:NetrwGetWord() - if curword == "./" || curword == "../" - let ctr= ctr + 1 - continue - endif - let ok= s:NetrwLocalRmFile(a:path,curword,all) - if ok =~# 'q\%[uit]' || ok == "no" - break - elseif ok =~# 'a\%[ll]' - let all= 1 - endif - let ctr= ctr + 1 - endwhile - let &l:sol= keepsol - endif - - " refresh the directory -" call Decho("bufname<".bufname("%").">",'~'.expand("")) - if bufname("%") != "NetrwMessage" - NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) -" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) - NetrwKeepj call winrestview(svpos) - endif - let @@= ykeep - -" call Dret("s:NetrwLocalRm") -endfun - -" --------------------------------------------------------------------- -" s:NetrwLocalRmFile: remove file fname given the path {{{2 -" Give confirmation prompt unless all==1 -fun! s:NetrwLocalRmFile(path,fname,all) -" call Dfunc("s:NetrwLocalRmFile(path<".a:path."> fname<".a:fname."> all=".a:all) - - let all= a:all - let ok = "" - NetrwKeepj norm! 0 - let rmfile= s:NetrwFile(s:ComposePath(a:path,a:fname)) -" call Decho("rmfile<".rmfile.">",'~'.expand("")) - - if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') - " attempt to remove file -" call Decho("attempt to remove file<".rmfile.">",'~'.expand("")) - if !all - echohl Statement - call inputsave() - let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - echohl NONE - if ok == "" - let ok="no" - endif -" call Decho("response: ok<".ok.">",'~'.expand("")) - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') -" call Decho("response: ok<".ok."> (after sub)",'~'.expand("")) - if ok =~# 'a\%[ll]' - let all= 1 - endif - endif - - if all || ok =~# 'y\%[es]' || ok == "" - let ret= s:NetrwDelete(rmfile) -" call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("")) - endif - - else - " attempt to remove directory - if !all - echohl Statement - call inputsave() - let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok == "" - let ok="no" - endif - if ok =~# 'a\%[ll]' - let all= 1 - endif - endif - let rmfile= substitute(rmfile,'[\/]$','','e') - - if all || ok =~# 'y\%[es]' || ok == "" - if delete(rmfile,"d") - call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103) - endif - endif - endif - -" call Dret("s:NetrwLocalRmFile ".ok) - return ok -endfun - -" ===================================================================== -" Support Functions: {{{1 - -" --------------------------------------------------------------------- -" netrw#Access: intended to provide access to variable values for netrw's test suite {{{2 -" 0: marked file list of current buffer -" 1: marked file target -fun! netrw#Access(ilist) - if a:ilist == 0 - if exists("s:netrwmarkfilelist_".bufnr('%')) - return s:netrwmarkfilelist_{bufnr('%')} - else - return "no-list-buf#".bufnr('%') - endif - elseif a:ilist == 1 - return s:netrwmftgt - endif -endfun - -" --------------------------------------------------------------------- -" netrw#Call: allows user-specified mappings to call internal netrw functions {{{2 -fun! netrw#Call(funcname,...) - return call("s:".a:funcname,a:000) -endfun - -" --------------------------------------------------------------------- -" netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2 -" I expect this function to be used in -" :PChkAssert netrw#Expose("netrwmarkfilelist") -" for example. -fun! netrw#Expose(varname) -" call Dfunc("netrw#Expose(varname<".a:varname.">)") - if exists("s:".a:varname) - exe "let retval= s:".a:varname -" call Decho("retval=".retval,'~'.expand("")) - if exists("g:netrw_pchk") -" call Decho("type(g:netrw_pchk=".g:netrw_pchk.")=".type(retval),'~'.expand("")) - if type(retval) == 3 - let retval = copy(retval) - let i = 0 - while i < len(retval) - let retval[i]= substitute(retval[i],expand("$HOME"),'~','') - let i = i + 1 - endwhile - endif -" call Dret("netrw#Expose ".string(retval)),'~'.expand("")) - return string(retval) - else -" call Decho("g:netrw_pchk doesn't exist",'~'.expand("")) - endif - else -" call Decho("s:".a:varname." doesn't exist",'~'.expand("")) - let retval= "n/a" - endif - -" call Dret("netrw#Expose ".string(retval)) - return retval -endfun - -" --------------------------------------------------------------------- -" netrw#Modify: allows UserMaps to set (modify) script-local variables {{{2 -fun! netrw#Modify(varname,newvalue) -" call Dfunc("netrw#Modify(varname<".a:varname.">,newvalue<".string(a:newvalue).">)") - exe "let s:".a:varname."= ".string(a:newvalue) -" call Dret("netrw#Modify") -endfun - -" --------------------------------------------------------------------- -" netrw#RFC2396: converts %xx into characters {{{2 -fun! netrw#RFC2396(fname) -" call Dfunc("netrw#RFC2396(fname<".a:fname.">)") - let fname = escape(substitute(a:fname,'%\(\x\x\)','\=printf("%c","0x".submatch(1))','ge')," \t") -" call Dret("netrw#RFC2396 ".fname) - return fname -endfun - -" --------------------------------------------------------------------- -" netrw#UserMaps: supports user-specified maps {{{2 -" see :help function() -" -" g:Netrw_UserMaps is a List with members such as: -" [[keymap sequence, function reference],...] -" -" The referenced function may return a string, -" refresh : refresh the display -" -other- : this string will be executed -" or it may return a List of strings. -" -" Each keymap-sequence will be set up with a nnoremap -" to invoke netrw#UserMaps(a:islocal). -" Related functions: -" netrw#Expose(varname) -- see s:varname variables -" netrw#Modify(varname,newvalue) -- modify value of s:varname variable -" netrw#Call(funcname,...) -- call internal netrw function with optional arguments -fun! netrw#UserMaps(islocal) -" call Dfunc("netrw#UserMaps(islocal=".a:islocal.")") -" call Decho("g:Netrw_UserMaps ".(exists("g:Netrw_UserMaps")? "exists" : "does NOT exist"),'~'.expand("")) - - " set up usermaplist - if exists("g:Netrw_UserMaps") && type(g:Netrw_UserMaps) == 3 -" call Decho("g:Netrw_UserMaps has type 3",'~'.expand("")) - for umap in g:Netrw_UserMaps -" call Decho("type(umap[0]<".string(umap[0]).">)=".type(umap[0])." (should be 1=string)",'~'.expand("")) -" call Decho("type(umap[1])=".type(umap[1])." (should be 1=string)",'~'.expand("")) - " if umap[0] is a string and umap[1] is a string holding a function name - if type(umap[0]) == 1 && type(umap[1]) == 1 -" call Decho("nno ".umap[0]." :call s:UserMaps(".a:islocal.",".string(umap[1]).")",'~'.expand("")) - exe "nno ".umap[0]." :call UserMaps(".a:islocal.",'".umap[1]."')" - else - call netrw#ErrorMsg(s:WARNING,"ignoring usermap <".string(umap[0])."> -- not a [string,funcref] entry",99) - endif - endfor - endif -" call Dret("netrw#UserMaps") -endfun - -" --------------------------------------------------------------------- -" netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2 -fun! netrw#WinPath(path) -" call Dfunc("netrw#WinPath(path<".a:path.">)") - if (!g:netrw_cygwin || &shell !~ '\%(\\|\\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16")) - " remove cygdrive prefix, if present - let path = substitute(a:path,g:netrw_cygdrive.'/\(.\)','\1:','') - " remove trailing slash (Win95) - let path = substitute(path, '\(\\\|/\)$', '', 'g') - " remove escaped spaces - let path = substitute(path, '\ ', ' ', 'g') - " convert slashes to backslashes - let path = substitute(path, '/', '\', 'g') - else - let path= a:path - endif -" call Dret("netrw#WinPath <".path.">") - return path -endfun - -" --------------------------------------------------------------------- -" s:NetrwBadd: adds marked files to buffer list or vice versa {{{2 -" cb : bl2mf=0 add marked files to buffer list -" cB : bl2mf=1 use bufferlist to mark files -" (mnemonic: cb = copy (marked files) to buffer list) -fun! s:NetrwBadd(islocal,bl2mf) -" " call Dfunc("s:NetrwBadd(islocal=".a:islocal." mf2bl=".mf2bl.")") - if a:bl2mf - " cB: add buffer list to marked files - redir => bufl - ls - redir END - let bufl = map(split(bufl,"\n"),'substitute(v:val,''^.\{-}"\(.*\)".\{-}$'',''\1'','''')') - for fname in bufl - call s:NetrwMarkFile(a:islocal,fname) - endfor - else - " cb: add marked files to buffer list - for fname in s:netrwmarkfilelist_{bufnr("%")} -" " call Decho("badd ".fname,'~'.expand("")) - exe "badd ".fnameescape(fname) - endfor - let curbufnr = bufnr("%") - let curdir = s:NetrwGetCurdir(a:islocal) - call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer - endif -" call Dret("s:NetrwBadd") -endfun - -" --------------------------------------------------------------------- -" s:ComposePath: Appends a new part to a path taking different systems into consideration {{{2 -fun! s:ComposePath(base,subdir) -" call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)") - - if has("amiga") -" call Decho("amiga",'~'.expand("")) - let ec = a:base[s:Strlen(a:base)-1] - if ec != '/' && ec != ':' - let ret = a:base."/" . a:subdir - else - let ret = a:base.a:subdir - endif - - " COMBAK: test on windows with changing to root directory: :e C:/ - elseif a:subdir =~ '^\a:[/\\]\([^/\\]\|$\)' && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows",'~'.expand("")) - let ret= a:subdir - - elseif a:base =~ '^\a:[/\\]\([^/\\]\|$\)' && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows",'~'.expand("")) - if a:base =~ '[/\\]$' - let ret= a:base.a:subdir - else - let ret= a:base.'/'.a:subdir - endif - - elseif a:base =~ '^\a\{3,}://' -" call Decho("remote linux/macos",'~'.expand("")) - let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','') - let curpath = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\2','') - if a:subdir == '../' - if curpath =~ '[^/]/[^/]\+/$' - let curpath= substitute(curpath,'[^/]\+/$','','') - else - let curpath="" - endif - let ret= urlbase.curpath - else - let ret= urlbase.curpath.a:subdir - endif -" call Decho("urlbase<".urlbase.">",'~'.expand("")) -" call Decho("curpath<".curpath.">",'~'.expand("")) -" call Decho("ret<".ret.">",'~'.expand("")) - - else -" call Decho("local linux/macos",'~'.expand("")) - let ret = substitute(a:base."/".a:subdir,"//","/","g") - if a:base =~ '^//' - " keeping initial '//' for the benefit of network share listing support - let ret= '/'.ret - endif - let ret= simplify(ret) - endif - -" call Dret("s:ComposePath ".ret) - return ret -endfun - -" --------------------------------------------------------------------- -" s:DeleteBookmark: deletes a file/directory from Netrw's bookmark system {{{2 -" Related Functions: s:MakeBookmark() s:NetrwBookHistHandler() s:NetrwBookmark() -fun! s:DeleteBookmark(fname) -" call Dfunc("s:DeleteBookmark(fname<".a:fname.">)") - call s:MergeBookmarks() - - if exists("g:netrw_bookmarklist") - let indx= index(g:netrw_bookmarklist,a:fname) - if indx == -1 - let indx= 0 - while indx < len(g:netrw_bookmarklist) - if g:netrw_bookmarklist[indx] =~ a:fname - call remove(g:netrw_bookmarklist,indx) - let indx= indx - 1 - endif - let indx= indx + 1 - endwhile - else - " remove exact match - call remove(g:netrw_bookmarklist,indx) - endif - endif - -" call Dret("s:DeleteBookmark") -endfun - -" --------------------------------------------------------------------- -" s:FileReadable: o/s independent filereadable {{{2 -fun! s:FileReadable(fname) -" call Dfunc("s:FileReadable(fname<".a:fname.">)") - - if g:netrw_cygwin - let ret= filereadable(s:NetrwFile(substitute(a:fname,g:netrw_cygdrive.'/\(.\)','\1:/',''))) - else - let ret= filereadable(s:NetrwFile(a:fname)) - endif - -" call Dret("s:FileReadable ".ret) - return ret -endfun - -" --------------------------------------------------------------------- -" s:GetTempfile: gets a tempname that'll work for various o/s's {{{2 -" Places correct suffix on end of temporary filename, -" using the suffix provided with fname -fun! s:GetTempfile(fname) -" call Dfunc("s:GetTempfile(fname<".a:fname.">)") - - if !exists("b:netrw_tmpfile") - " get a brand new temporary filename - let tmpfile= tempname() -" call Decho("tmpfile<".tmpfile."> : from tempname()",'~'.expand("")) - - let tmpfile= substitute(tmpfile,'\','/','ge') -" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /",'~'.expand("")) - - " sanity check -- does the temporary file's directory exist? - if !isdirectory(s:NetrwFile(substitute(tmpfile,'[^/]\+$','','e'))) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) -" call Dret("s:GetTempfile getcwd<".getcwd().">") - return "" - endif - - " let netrw#NetSource() know about the tmpfile - let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#BrowseX() -" call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">",'~'.expand("")) - - " o/s dependencies - if g:netrw_cygwin != 0 - let tmpfile = substitute(tmpfile,'^\(\a\):',g:netrw_cygdrive.'/\1','e') - elseif has("win32") || has("win95") || has("win64") || has("win16") - if !exists("+shellslash") || !&ssl - let tmpfile = substitute(tmpfile,'/','\','g') - endif - else - let tmpfile = tmpfile - endif - let b:netrw_tmpfile= tmpfile -" call Decho("o/s dependent fixed tempname<".tmpfile.">",'~'.expand("")) - else - " re-use temporary filename - let tmpfile= b:netrw_tmpfile -" call Decho("tmpfile<".tmpfile."> re-using",'~'.expand("")) - endif - - " use fname's suffix for the temporary file - if a:fname != "" - if a:fname =~ '\.[^./]\+$' -" call Decho("using fname<".a:fname.">'s suffix",'~'.expand("")) - if a:fname =~ '\.tar\.gz$' || a:fname =~ '\.tar\.bz2$' || a:fname =~ '\.tar\.xz$' - let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') - elseif a:fname =~ '.txz$' - let suffix = ".txz".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') - else - let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') - endif -" call Decho("suffix<".suffix.">",'~'.expand("")) - let tmpfile= substitute(tmpfile,'\.tmp$','','e') -" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)",'~'.expand("")) - let tmpfile .= suffix -" call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">",'~'.expand("")) - let s:netrw_tmpfile= tmpfile " supports netrw#NetSource() - endif - endif - -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("s:GetTempfile <".tmpfile.">") - return tmpfile -endfun - -" --------------------------------------------------------------------- -" s:MakeSshCmd: transforms input command using USEPORT HOSTNAME into {{{2 -" a correct command for use with a system() call -fun! s:MakeSshCmd(sshcmd) -" call Dfunc("s:MakeSshCmd(sshcmd<".a:sshcmd.">) user<".s:user."> machine<".s:machine.">") - if s:user == "" - let sshcmd = substitute(a:sshcmd,'\',s:machine,'') - else - let sshcmd = substitute(a:sshcmd,'\',s:user."@".s:machine,'') - endif - if exists("g:netrw_port") && g:netrw_port != "" - let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.g:netrw_port,'') - elseif exists("s:port") && s:port != "" - let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.s:port,'') - else - let sshcmd= substitute(sshcmd,"USEPORT ",'','') - endif -" call Dret("s:MakeSshCmd <".sshcmd.">") - return sshcmd -endfun - -" --------------------------------------------------------------------- -" s:MakeBookmark: enters a bookmark into Netrw's bookmark system {{{2 -fun! s:MakeBookmark(fname) -" call Dfunc("s:MakeBookmark(fname<".a:fname.">)") - - if !exists("g:netrw_bookmarklist") - let g:netrw_bookmarklist= [] - endif - - if index(g:netrw_bookmarklist,a:fname) == -1 - " curdir not currently in g:netrw_bookmarklist, so include it - if isdirectory(s:NetrwFile(a:fname)) && a:fname !~ '/$' - call add(g:netrw_bookmarklist,a:fname.'/') - elseif a:fname !~ '/' - call add(g:netrw_bookmarklist,getcwd()."/".a:fname) - else - call add(g:netrw_bookmarklist,a:fname) - endif - call sort(g:netrw_bookmarklist) - endif - -" call Dret("s:MakeBookmark") -endfun - -" --------------------------------------------------------------------- -" s:MergeBookmarks: merge current bookmarks with saved bookmarks {{{2 -fun! s:MergeBookmarks() -" call Dfunc("s:MergeBookmarks() : merge current bookmarks into .netrwbook") - " get bookmarks from .netrwbook file - let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(s:NetrwFile(savefile)) -" call Decho("merge bookmarks (active and file)",'~'.expand("")) - NetrwKeepj call s:NetrwBookHistSave() -" call Decho("bookmark delete savefile<".savefile.">",'~'.expand("")) - NetrwKeepj call delete(savefile) - endif -" call Dret("s:MergeBookmarks") -endfun - -" --------------------------------------------------------------------- -" s:NetrwBMShow: {{{2 -fun! s:NetrwBMShow() -" call Dfunc("s:NetrwBMShow()") - redir => bmshowraw - menu - redir END - let bmshowlist = split(bmshowraw,'\n') - if bmshowlist != [] - let bmshowfuncs= filter(bmshowlist,'v:val =~# "\\d\\+_BMShow()"') - if bmshowfuncs != [] - let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','') - if bmshowfunc =~# '^call.*BMShow()' - exe "sil! NetrwKeepj ".bmshowfunc - endif - endif - endif -" call Dret("s:NetrwBMShow : bmshowfunc<".(exists("bmshowfunc")? bmshowfunc : 'n/a').">") -endfun - -" --------------------------------------------------------------------- -" s:NetrwCursor: responsible for setting cursorline/cursorcolumn based upon g:netrw_cursor {{{2 -fun! s:NetrwCursor(editfile) - if !exists("w:netrw_liststyle") - let w:netrw_liststyle= g:netrw_liststyle - endif -" call Dfunc("s:NetrwCursor() ft<".&ft."> liststyle=".w:netrw_liststyle." g:netrw_cursor=".g:netrw_cursor." s:netrw_usercuc=".s:netrw_usercuc." s:netrw_usercul=".s:netrw_usercul) - -" call Decho("(s:NetrwCursor) COMBAK: cuc=".&l:cuc." cul=".&l:cul) - - if &ft != "netrw" - " if the current window isn't a netrw directory listing window, then use user cursorline/column - " settings. Affects when netrw is used to read/write a file using scp/ftp/etc. -" call Decho("case ft!=netrw: use user cul,cuc",'~'.expand("")) - - elseif g:netrw_cursor == 8 - if w:netrw_liststyle == s:WIDELIST - setl cursorline - setl cursorcolumn - else - setl cursorline - endif - elseif g:netrw_cursor == 7 - setl cursorline - elseif g:netrw_cursor == 6 - if w:netrw_liststyle == s:WIDELIST - setl cursorline - endif - elseif g:netrw_cursor == 4 - " all styles: cursorline, cursorcolumn -" call Decho("case g:netrw_cursor==4: setl cul cuc",'~'.expand("")) - setl cursorline - setl cursorcolumn - - elseif g:netrw_cursor == 3 - " thin-long-tree: cursorline, user's cursorcolumn - " wide : cursorline, cursorcolumn - if w:netrw_liststyle == s:WIDELIST -" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc",'~'.expand("")) - setl cursorline - setl cursorcolumn - else -" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)",'~'.expand("")) - setl cursorline - endif - - elseif g:netrw_cursor == 2 - " thin-long-tree: cursorline, user's cursorcolumn - " wide : cursorline, user's cursorcolumn -" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)",'~'.expand("")) - setl cursorline - - elseif g:netrw_cursor == 1 - " thin-long-tree: user's cursorline, user's cursorcolumn - " wide : cursorline, user's cursorcolumn - if w:netrw_liststyle == s:WIDELIST -" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)",'~'.expand("")) - setl cursorline - else -" call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)",'~'.expand("")) - endif - - else - " all styles: user's cursorline, user's cursorcolumn -" call Decho("default: (use user's cul,cuc)",'~'.expand("")) - let &l:cursorline = s:netrw_usercul - let &l:cursorcolumn = s:netrw_usercuc - endif - -" call Decho("(s:NetrwCursor) COMBAK: cuc=".&l:cuc." cul=".&l:cul) -" call Dret("s:NetrwCursor : l:cursorline=".&l:cursorline." l:cursorcolumn=".&l:cursorcolumn) -endfun - -" --------------------------------------------------------------------- -" s:RestoreCursorline: restores cursorline/cursorcolumn to original user settings {{{2 -fun! s:RestoreCursorline() -" call Dfunc("s:RestoreCursorline() currently, cul=".&l:cursorline." cuc=".&l:cursorcolumn." win#".winnr()." buf#".bufnr("%")) - if exists("s:netrw_usercul") - let &l:cursorline = s:netrw_usercul - endif - if exists("s:netrw_usercuc") - let &l:cursorcolumn = s:netrw_usercuc - endif -" call Decho("(s:RestoreCursorline) COMBAK: cuc=".&l:cuc." cul=".&l:cul) -" call Dret("s:RestoreCursorline : restored cul=".&l:cursorline." cuc=".&l:cursorcolumn) -endfun - -" --------------------------------------------------------------------- -" s:NetrwDelete: Deletes a file. {{{2 -" Uses Steve Hall's idea to insure that Windows paths stay -" acceptable. No effect on Unix paths. -" Examples of use: let result= s:NetrwDelete(path) -fun! s:NetrwDelete(path) -" call Dfunc("s:NetrwDelete(path<".a:path.">)") - - let path = netrw#WinPath(a:path) - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - if exists("+shellslash") - let sskeep= &shellslash - setl noshellslash - let result = delete(path) - let &shellslash = sskeep - else -" call Decho("exe let result= ".a:cmd."('".path."')",'~'.expand("")) - let result= delete(path) - endif - else -" call Decho("let result= delete(".path.")",'~'.expand("")) - let result= delete(path) - endif - if result < 0 - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) - endif - -" call Dret("s:NetrwDelete ".result) - return result -endfun - -" --------------------------------------------------------------------- -" s:NetrwBufRemover: removes a buffer that: {{{2s -" has buffer-id > 1 -" is unlisted -" is unnamed -" does not appear in any window -fun! s:NetrwBufRemover(bufid) -" call Dfunc("s:NetrwBufRemover(".a:bufid.")") -" call Decho("buf#".a:bufid." ".((a:bufid > 1)? ">" : "≯")." must be >1 for removal","~".expand("")) -" call Decho("buf#".a:bufid." is ".(buflisted(a:bufid)? "listed" : "unlisted"),"~".expand("")) -" call Decho("buf#".a:bufid." has name <".bufname(a:bufid).">","~".expand("")) -" call Decho("buf#".a:bufid." has winid#".bufwinid(a:bufid),"~".expand("")) - - if a:bufid > 1 && !buflisted(a:bufid) && bufloaded(a:bufid) && bufname(a:bufid) == "" && bufwinid(a:bufid) == -1 -" call Decho("(s:NetrwBufRemover) removing buffer#".a:bufid,"~".expand("")) - exe "sil! bd! ".a:bufid - endif - -" call Dret("s:NetrwBufRemover") -endfun - -" --------------------------------------------------------------------- -" s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 -fun! s:NetrwEnew(...) -" call Dfunc("s:NetrwEnew() a:0=".a:0." win#".winnr()." winnr($)=".winnr("$")." bufnr($)=".bufnr("$")." expand(%)<".expand("%").">") -" call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) - - " Clean out the last buffer: - " Check if the last buffer has # > 1, is unlisted, is unnamed, and does not appear in a window - " If so, delete it. - call s:NetrwBufRemover(bufnr("$")) - - " grab a function-local-variable copy of buffer variables -" call Decho("make function-local copy of netrw variables",'~'.expand("")) - if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif - if exists("b:netrw_browser_active") |let netrw_browser_active = b:netrw_browser_active |endif - if exists("b:netrw_cpf") |let netrw_cpf = b:netrw_cpf |endif - if exists("b:netrw_curdir") |let netrw_curdir = b:netrw_curdir |endif - if exists("b:netrw_explore_bufnr") |let netrw_explore_bufnr = b:netrw_explore_bufnr |endif - if exists("b:netrw_explore_indx") |let netrw_explore_indx = b:netrw_explore_indx |endif - if exists("b:netrw_explore_line") |let netrw_explore_line = b:netrw_explore_line |endif - if exists("b:netrw_explore_list") |let netrw_explore_list = b:netrw_explore_list |endif - if exists("b:netrw_explore_listlen")|let netrw_explore_listlen = b:netrw_explore_listlen|endif - if exists("b:netrw_explore_mtchcnt")|let netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif - if exists("b:netrw_fname") |let netrw_fname = b:netrw_fname |endif - if exists("b:netrw_lastfile") |let netrw_lastfile = b:netrw_lastfile |endif - if exists("b:netrw_liststyle") |let netrw_liststyle = b:netrw_liststyle |endif - if exists("b:netrw_method") |let netrw_method = b:netrw_method |endif - if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif - if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif - - NetrwKeepj call s:NetrwOptionsRestore("w:") -" call Decho("generate a buffer with NetrwKeepj enew!",'~'.expand("")) - " when tree listing uses file TreeListing... a new buffer is made. - " Want the old buffer to be unlisted. - " COMBAK: this causes a problem, see P43 -" setl nobl - let netrw_keepdiff= &l:diff - call s:NetrwEditFile("enew!","","") - let &l:diff= netrw_keepdiff -" call Decho("bufnr($)=".bufnr("$")."<".bufname(bufnr("$"))."> winnr($)=".winnr("$"),'~'.expand("")) - NetrwKeepj call s:NetrwOptionsSave("w:") - - " copy function-local-variables to buffer variable equivalents -" call Decho("copy function-local variables back to buffer netrw variables",'~'.expand("")) - if exists("netrw_bannercnt") |let b:netrw_bannercnt = netrw_bannercnt |endif - if exists("netrw_browser_active") |let b:netrw_browser_active = netrw_browser_active |endif - if exists("netrw_cpf") |let b:netrw_cpf = netrw_cpf |endif - if exists("netrw_curdir") |let b:netrw_curdir = netrw_curdir |endif - if exists("netrw_explore_bufnr") |let b:netrw_explore_bufnr = netrw_explore_bufnr |endif - if exists("netrw_explore_indx") |let b:netrw_explore_indx = netrw_explore_indx |endif - if exists("netrw_explore_line") |let b:netrw_explore_line = netrw_explore_line |endif - if exists("netrw_explore_list") |let b:netrw_explore_list = netrw_explore_list |endif - if exists("netrw_explore_listlen")|let b:netrw_explore_listlen = netrw_explore_listlen|endif - if exists("netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt = netrw_explore_mtchcnt|endif - if exists("netrw_fname") |let b:netrw_fname = netrw_fname |endif - if exists("netrw_lastfile") |let b:netrw_lastfile = netrw_lastfile |endif - if exists("netrw_liststyle") |let b:netrw_liststyle = netrw_liststyle |endif - if exists("netrw_method") |let b:netrw_method = netrw_method |endif - if exists("netrw_option") |let b:netrw_option = netrw_option |endif - if exists("netrw_prvdir") |let b:netrw_prvdir = netrw_prvdir |endif - - if a:0 > 0 - let b:netrw_curdir= a:1 - if b:netrw_curdir =~ '/$' - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - setl nobl - file NetrwTreeListing - setl nobl bt=nowrite bh=hide - nno [ :sil call TreeListMove('[') - nno ] :sil call TreeListMove(']') - else - call s:NetrwBufRename(b:netrw_curdir) - endif - endif - endif - if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") - let &l:bexpr = "netrw#BalloonHelp()" - endif - -" call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#")."> bh=".&bh." win#".winnr()." winnr($)#".winnr("$")) -endfun - -" --------------------------------------------------------------------- -" s:NetrwExe: executes a string using "!" {{{2 -fun! s:NetrwExe(cmd) -" call Dfunc("s:NetrwExe(a:cmd<".a:cmd.">)") - if has("win32") && &shell !~? 'cmd\|pwsh\|powershell' && !g:netrw_cygwin -" call Decho("using win32:",expand("")) - let savedShell=[&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] - set shell& shellcmdflag& shellxquote& shellxescape& - set shellquote& shellpipe& shellredir& shellslash& - exe a:cmd - let [&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] = savedShell - else -" call Decho("exe ".a:cmd,'~'.expand("")) - exe a:cmd - endif - if v:shell_error - call netrw#ErrorMsg(s:WARNING,"shell signalled an error",106) - endif -" call Dret("s:NetrwExe : v:shell_error=".v:shell_error) -endfun - -" --------------------------------------------------------------------- -" s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2 -fun! s:NetrwInsureWinVars() - if !exists("w:netrw_liststyle") -" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) - let curbuf = bufnr("%") - let curwin = winnr() - let iwin = 1 - while iwin <= winnr("$") - exe iwin."wincmd w" - if winnr() != curwin && bufnr("%") == curbuf && exists("w:netrw_liststyle") - " looks like ctrl-w_s or ctrl-w_v was used to split a netrw buffer - let winvars= w: - break - endif - let iwin= iwin + 1 - endwhile - exe "keepalt ".curwin."wincmd w" - if exists("winvars") -" call Decho("copying w#".iwin." window variables to w#".curwin,'~'.expand("")) - for k in keys(winvars) - let w:{k}= winvars[k] - endfor - endif -" call Dret("s:NetrwInsureWinVars win#".winnr()) - endif -endfun - -" --------------------------------------------------------------------- -" s:NetrwLcd: handles changing the (local) directory {{{2 -" Returns: 0=success -" -1=failed -fun! s:NetrwLcd(newdir) -" call Dfunc("s:NetrwLcd(newdir<".a:newdir.">)") -" call Decho("changing local directory",'~'.expand("")) - - let err472= 0 - try - exe 'NetrwKeepj sil lcd '.fnameescape(a:newdir) - catch /^Vim\%((\a\+)\)\=:E344/ - " Vim's lcd fails with E344 when attempting to go above the 'root' of a Windows share. - " Therefore, detect if a Windows share is present, and if E344 occurs, just settle at - " 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or - " forward slashes ('//Foo'), depending on whether backslashes have been converted to - " forward slashes by earlier code; so check for both. - if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin - if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+' - let dirname = '\' - exe 'NetrwKeepj sil lcd '.fnameescape(dirname) - endif - endif - catch /^Vim\%((\a\+)\)\=:E472/ - let err472= 1 - endtry - - if err472 - call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".a:newdir."> (permissions?)",61) - if exists("w:netrw_prvdir") - let a:newdir= w:netrw_prvdir - else - call s:NetrwOptionsRestore("w:") -" call Decho("setl noma nomod nowrap",'~'.expand("")) - exe "setl ".g:netrw_bufsettings -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) - let a:newdir= dirname - endif -" call Dret("s:NetrwBrowse -1 : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") - return -1 - endif - -" call Decho("getcwd <".getcwd().">") -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") -" call Dret("s:NetrwLcd 0") - return 0 -endfun - -" ------------------------------------------------------------------------ -" s:NetrwSaveWordPosn: used to keep cursor on same word after refresh, {{{2 -" changed sorting, etc. Also see s:NetrwRestoreWordPosn(). -fun! s:NetrwSaveWordPosn() -" call Dfunc("NetrwSaveWordPosn()") - let s:netrw_saveword= '^'.fnameescape(getline('.')).'$' -" call Dret("NetrwSaveWordPosn : saveword<".s:netrw_saveword.">") -endfun - -" --------------------------------------------------------------------- -" s:NetrwHumanReadable: takes a number and makes it "human readable" {{{2 -" 1000 -> 1K, 1000000 -> 1M, 1000000000 -> 1G -fun! s:NetrwHumanReadable(sz) -" call Dfunc("s:NetrwHumanReadable(sz=".a:sz.") type=".type(a:sz)." style=".g:netrw_sizestyle ) - - if g:netrw_sizestyle == 'h' - if a:sz >= 1000000000 - let sz = printf("%.1f",a:sz/1000000000.0)."g" - elseif a:sz >= 10000000 - let sz = printf("%d",a:sz/1000000)."m" - elseif a:sz >= 1000000 - let sz = printf("%.1f",a:sz/1000000.0)."m" - elseif a:sz >= 10000 - let sz = printf("%d",a:sz/1000)."k" - elseif a:sz >= 1000 - let sz = printf("%.1f",a:sz/1000.0)."k" - else - let sz= a:sz - endif - - elseif g:netrw_sizestyle == 'H' - if a:sz >= 1073741824 - let sz = printf("%.1f",a:sz/1073741824.0)."G" - elseif a:sz >= 10485760 - let sz = printf("%d",a:sz/1048576)."M" - elseif a:sz >= 1048576 - let sz = printf("%.1f",a:sz/1048576.0)."M" - elseif a:sz >= 10240 - let sz = printf("%d",a:sz/1024)."K" - elseif a:sz >= 1024 - let sz = printf("%.1f",a:sz/1024.0)."K" - else - let sz= a:sz - endif - - else - let sz= a:sz - endif - -" call Dret("s:NetrwHumanReadable ".sz) - return sz -endfun - -" --------------------------------------------------------------------- -" s:NetrwRestoreWordPosn: used to keep cursor on same word after refresh, {{{2 -" changed sorting, etc. Also see s:NetrwSaveWordPosn(). -fun! s:NetrwRestoreWordPosn() -" call Dfunc("NetrwRestoreWordPosn()") - sil! call search(s:netrw_saveword,'w') -" call Dret("NetrwRestoreWordPosn") -endfun - -" --------------------------------------------------------------------- -" s:RestoreBufVars: {{{2 -fun! s:RestoreBufVars() -" call Dfunc("s:RestoreBufVars()") - - if exists("s:netrw_curdir") |let b:netrw_curdir = s:netrw_curdir |endif - if exists("s:netrw_lastfile") |let b:netrw_lastfile = s:netrw_lastfile |endif - if exists("s:netrw_method") |let b:netrw_method = s:netrw_method |endif - if exists("s:netrw_fname") |let b:netrw_fname = s:netrw_fname |endif - if exists("s:netrw_machine") |let b:netrw_machine = s:netrw_machine |endif - if exists("s:netrw_browser_active")|let b:netrw_browser_active = s:netrw_browser_active|endif - -" call Dret("s:RestoreBufVars") -endfun - -" --------------------------------------------------------------------- -" s:RemotePathAnalysis: {{{2 -fun! s:RemotePathAnalysis(dirname) -" call Dfunc("s:RemotePathAnalysis(a:dirname<".a:dirname.">)") - - " method :// user @ machine :port /path - let dirpat = '^\(\w\{-}\)://\(\(\w\+\)@\)\=\([^/:#]\+\)\%([:#]\(\d\+\)\)\=/\(.*\)$' - let s:method = substitute(a:dirname,dirpat,'\1','') - let s:user = substitute(a:dirname,dirpat,'\3','') - let s:machine = substitute(a:dirname,dirpat,'\4','') - let s:port = substitute(a:dirname,dirpat,'\5','') - let s:path = substitute(a:dirname,dirpat,'\6','') - let s:fname = substitute(s:path,'^.*/\ze.','','') - if s:machine =~ '@' - let dirpat = '^\(.*\)@\(.\{-}\)$' - let s:user = s:user.'@'.substitute(s:machine,dirpat,'\1','') - let s:machine = substitute(s:machine,dirpat,'\2','') - endif - -" call Decho("set up s:method <".s:method .">",'~'.expand("")) -" call Decho("set up s:user <".s:user .">",'~'.expand("")) -" call Decho("set up s:machine<".s:machine.">",'~'.expand("")) -" call Decho("set up s:port <".s:port.">",'~'.expand("")) -" call Decho("set up s:path <".s:path .">",'~'.expand("")) -" call Decho("set up s:fname <".s:fname .">",'~'.expand("")) - -" call Dret("s:RemotePathAnalysis") -endfun - -" --------------------------------------------------------------------- -" s:RemoteSystem: runs a command on a remote host using ssh {{{2 -" Returns status -" Runs system() on -" [cd REMOTEDIRPATH;] a:cmd -" Note that it doesn't do s:ShellEscape(a:cmd)! -fun! s:RemoteSystem(cmd) -" call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)") - if !executable(g:netrw_ssh_cmd) - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52) - elseif !exists("b:netrw_curdir") - NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) - else - let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME") - let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') - if remotedir != "" - let cmd= cmd.' cd '.s:ShellEscape(remotedir).";" - else - let cmd= cmd.' ' - endif - let cmd= cmd.a:cmd -" call Decho("call system(".cmd.")",'~'.expand("")) - let ret= system(cmd) - endif -" call Dret("s:RemoteSystem ".ret) - return ret -endfun - -" --------------------------------------------------------------------- -" s:RestoreWinVars: (used by Explore() and NetrwSplit()) {{{2 -fun! s:RestoreWinVars() -" call Dfunc("s:RestoreWinVars()") - if exists("s:bannercnt") |let w:netrw_bannercnt = s:bannercnt |unlet s:bannercnt |endif - if exists("s:col") |let w:netrw_col = s:col |unlet s:col |endif - if exists("s:curdir") |let w:netrw_curdir = s:curdir |unlet s:curdir |endif - if exists("s:explore_bufnr") |let w:netrw_explore_bufnr = s:explore_bufnr |unlet s:explore_bufnr |endif - if exists("s:explore_indx") |let w:netrw_explore_indx = s:explore_indx |unlet s:explore_indx |endif - if exists("s:explore_line") |let w:netrw_explore_line = s:explore_line |unlet s:explore_line |endif - if exists("s:explore_listlen")|let w:netrw_explore_listlen = s:explore_listlen|unlet s:explore_listlen|endif - if exists("s:explore_list") |let w:netrw_explore_list = s:explore_list |unlet s:explore_list |endif - if exists("s:explore_mtchcnt")|let w:netrw_explore_mtchcnt = s:explore_mtchcnt|unlet s:explore_mtchcnt|endif - if exists("s:fpl") |let w:netrw_fpl = s:fpl |unlet s:fpl |endif - if exists("s:hline") |let w:netrw_hline = s:hline |unlet s:hline |endif - if exists("s:line") |let w:netrw_line = s:line |unlet s:line |endif - if exists("s:liststyle") |let w:netrw_liststyle = s:liststyle |unlet s:liststyle |endif - if exists("s:method") |let w:netrw_method = s:method |unlet s:method |endif - if exists("s:prvdir") |let w:netrw_prvdir = s:prvdir |unlet s:prvdir |endif - if exists("s:treedict") |let w:netrw_treedict = s:treedict |unlet s:treedict |endif - if exists("s:treetop") |let w:netrw_treetop = s:treetop |unlet s:treetop |endif - if exists("s:winnr") |let w:netrw_winnr = s:winnr |unlet s:winnr |endif -" call Dret("s:RestoreWinVars") -endfun - -" --------------------------------------------------------------------- -" s:Rexplore: implements returning from a buffer to a netrw directory {{{2 -" -" s:SetRexDir() sets up <2-leftmouse> maps (if g:netrw_retmap -" is true) and a command, :Rexplore, which call this function. -" -" s:netrw_posn is set up by s:NetrwBrowseChgDir() -" -" s:rexposn_BUFNR used to save/restore cursor position -fun! s:NetrwRexplore(islocal,dirname) - if exists("s:netrwdrag") - return - endif -" call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir."> win#".winnr()) -" call Decho("currently in bufname<".bufname("%").">",'~'.expand("")) -" call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">",'~'.expand("")) - - if &ft == "netrw" && exists("w:netrw_rexfile") && w:netrw_rexfile != "" - " a :Rex while in a netrw buffer means: edit the file in w:netrw_rexfile -" call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">",'~'.expand("")) - exe "NetrwKeepj e ".w:netrw_rexfile - unlet w:netrw_rexfile -" call Dret("s:NetrwRexplore returning from netrw to buf#".bufnr("%")."<".bufname("%")."> (ft=".&ft.")") - return -" else " Decho -" call Decho("treating as not-netrw-buffer: ft=".&ft.((&ft == "netrw")? " == netrw" : "!= netrw"),'~'.expand("")) -" call Decho("treating as not-netrw-buffer: w:netrw_rexfile<".((exists("w:netrw_rexfile"))? w:netrw_rexfile : 'n/a').">",'~'.expand("")) - endif - - " --------------------------- - " :Rex issued while in a file - " --------------------------- - - " record current file so :Rex can return to it from netrw - let w:netrw_rexfile= expand("%") -" call Decho("set w:netrw_rexfile<".w:netrw_rexfile."> (win#".winnr().")",'~'.expand("")) - - if !exists("w:netrw_rexlocal") -" call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft." win#".winnr().")") - return - endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) - if w:netrw_rexlocal - NetrwKeepj call netrw#LocalBrowseCheck(w:netrw_rexdir) - else - NetrwKeepj call s:NetrwBrowse(0,w:netrw_rexdir) - endif - if exists("s:initbeval") - setl beval - endif - if exists("s:rexposn_".bufnr("%")) -" call Decho("restore posn, then unlet s:rexposn_".bufnr('%')."<".bufname("%").">",'~'.expand("")) - " restore position in directory listing -" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("")) - NetrwKeepj call winrestview(s:rexposn_{bufnr('%')}) - if exists("s:rexposn_".bufnr('%')) - unlet s:rexposn_{bufnr('%')} - endif - else -" call Decho("s:rexposn_".bufnr('%')."<".bufname("%")."> doesn't exist",'~'.expand("")) - endif - - if has("syntax") && exists("g:syntax_on") && g:syntax_on - if exists("s:explore_match") - exe "2match netrwMarkFile /".s:explore_match."/" - endif - endif - -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Dret("s:NetrwRexplore : ft=".&ft) -endfun - -" --------------------------------------------------------------------- -" s:SaveBufVars: save selected b: variables to s: variables {{{2 -" use s:RestoreBufVars() to restore b: variables from s: variables -fun! s:SaveBufVars() -" call Dfunc("s:SaveBufVars() buf#".bufnr("%")) - - if exists("b:netrw_curdir") |let s:netrw_curdir = b:netrw_curdir |endif - if exists("b:netrw_lastfile") |let s:netrw_lastfile = b:netrw_lastfile |endif - if exists("b:netrw_method") |let s:netrw_method = b:netrw_method |endif - if exists("b:netrw_fname") |let s:netrw_fname = b:netrw_fname |endif - if exists("b:netrw_machine") |let s:netrw_machine = b:netrw_machine |endif - if exists("b:netrw_browser_active")|let s:netrw_browser_active = b:netrw_browser_active|endif - -" call Dret("s:SaveBufVars") -endfun - -" --------------------------------------------------------------------- -" s:SavePosn: saves position associated with current buffer into a dictionary {{{2 -fun! s:SavePosn(posndict) -" call Dfunc("s:SavePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") - - if !exists("a:posndict[bufnr('%')]") - let a:posndict[bufnr("%")]= [] - endif -" call Decho("before push: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')])) - call add(a:posndict[bufnr("%")],winsaveview()) -" call Decho("after push: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')])) - -" call Dret("s:SavePosn posndict") - return a:posndict -endfun - -" --------------------------------------------------------------------- -" s:RestorePosn: restores position associated with current buffer using dictionary {{{2 -fun! s:RestorePosn(posndict) -" call Dfunc("s:RestorePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") - if exists("a:posndict") - if has_key(a:posndict,bufnr("%")) -" call Decho("before pop: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')])) - let posnlen= len(a:posndict[bufnr("%")]) - if posnlen > 0 - let posnlen= posnlen - 1 -" call Decho("restoring posn posndict[".bufnr("%")."][".posnlen."]=".string(a:posndict[bufnr("%")][posnlen]),'~'.expand("")) - call winrestview(a:posndict[bufnr("%")][posnlen]) - call remove(a:posndict[bufnr("%")],posnlen) -" call Decho("after pop: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')])) - endif - endif - endif -" call Dret("s:RestorePosn") -endfun - -" --------------------------------------------------------------------- -" s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2 -fun! s:SaveWinVars() -" call Dfunc("s:SaveWinVars() win#".winnr()) - if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif - if exists("w:netrw_col") |let s:col = w:netrw_col |endif - if exists("w:netrw_curdir") |let s:curdir = w:netrw_curdir |endif - if exists("w:netrw_explore_bufnr") |let s:explore_bufnr = w:netrw_explore_bufnr |endif - if exists("w:netrw_explore_indx") |let s:explore_indx = w:netrw_explore_indx |endif - if exists("w:netrw_explore_line") |let s:explore_line = w:netrw_explore_line |endif - if exists("w:netrw_explore_listlen")|let s:explore_listlen = w:netrw_explore_listlen|endif - if exists("w:netrw_explore_list") |let s:explore_list = w:netrw_explore_list |endif - if exists("w:netrw_explore_mtchcnt")|let s:explore_mtchcnt = w:netrw_explore_mtchcnt|endif - if exists("w:netrw_fpl") |let s:fpl = w:netrw_fpl |endif - if exists("w:netrw_hline") |let s:hline = w:netrw_hline |endif - if exists("w:netrw_line") |let s:line = w:netrw_line |endif - if exists("w:netrw_liststyle") |let s:liststyle = w:netrw_liststyle |endif - if exists("w:netrw_method") |let s:method = w:netrw_method |endif - if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif - if exists("w:netrw_treedict") |let s:treedict = w:netrw_treedict |endif - if exists("w:netrw_treetop") |let s:treetop = w:netrw_treetop |endif - if exists("w:netrw_winnr") |let s:winnr = w:netrw_winnr |endif -" call Dret("s:SaveWinVars") -endfun - -" --------------------------------------------------------------------- -" s:SetBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck()) {{{2 -" To allow separate windows to have their own activities, such as -" Explore **/pattern, several variables have been made window-oriented. -" However, when the user splits a browser window (ex: ctrl-w s), these -" variables are not inherited by the new window. SetBufWinVars() and -" UseBufWinVars() get around that. -fun! s:SetBufWinVars() -" call Dfunc("s:SetBufWinVars() win#".winnr()) - if exists("w:netrw_liststyle") |let b:netrw_liststyle = w:netrw_liststyle |endif - if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif - if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif - if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif - if exists("w:netrw_explore_indx") |let b:netrw_explore_indx = w:netrw_explore_indx |endif - if exists("w:netrw_explore_listlen")|let b:netrw_explore_listlen= w:netrw_explore_listlen|endif - if exists("w:netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt= w:netrw_explore_mtchcnt|endif - if exists("w:netrw_explore_bufnr") |let b:netrw_explore_bufnr = w:netrw_explore_bufnr |endif - if exists("w:netrw_explore_line") |let b:netrw_explore_line = w:netrw_explore_line |endif - if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif -" call Dret("s:SetBufWinVars") -endfun - -" --------------------------------------------------------------------- -" s:SetRexDir: set directory for :Rexplore {{{2 -fun! s:SetRexDir(islocal,dirname) -" call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">) win#".winnr()) - let w:netrw_rexdir = a:dirname - let w:netrw_rexlocal = a:islocal - let s:rexposn_{bufnr("%")} = winsaveview() -" call Decho("setting w:netrw_rexdir =".w:netrw_rexdir,'~'.expand("")) -" call Decho("setting w:netrw_rexlocal=".w:netrw_rexlocal,'~'.expand("")) -" call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("")) -" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to ".string(winsaveview()),'~'.expand("")) -" call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) -endfun - -" --------------------------------------------------------------------- -" s:ShowLink: used to modify thin and tree listings to show links {{{2 -fun! s:ShowLink() -" " call Dfunc("s:ShowLink()") -" " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("")) -" " call Decho(printf("line#%4d: %s",line("."),getline(".")),'~'.expand("")) - if exists("b:netrw_curdir") - norm! $?\a - let fname = b:netrw_curdir.'/'.s:NetrwGetWord() - let resname = resolve(fname) -" " call Decho("fname <".fname.">",'~'.expand("")) -" " call Decho("resname <".resname.">",'~'.expand("")) -" " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) - if resname =~ '^\M'.b:netrw_curdir.'/' - let dirlen = strlen(b:netrw_curdir) - let resname = strpart(resname,dirlen+1) -" " call Decho("resname<".resname."> (b:netrw_curdir elided)",'~'.expand("")) - endif - let modline = getline(".")."\t --> ".resname -" " call Decho("fname <".fname.">",'~'.expand("")) -" " call Decho("modline<".modline.">",'~'.expand("")) - setl noro ma - call setline(".",modline) - setl ro noma nomod - endif -" " call Dret("s:ShowLink".((exists("fname")? ' : '.fname : 'n/a'))) -endfun - -" --------------------------------------------------------------------- -" s:ShowStyle: {{{2 -fun! s:ShowStyle() - if !exists("w:netrw_liststyle") - let liststyle= g:netrw_liststyle - else - let liststyle= w:netrw_liststyle - endif - if liststyle == s:THINLIST - return s:THINLIST.":thin" - elseif liststyle == s:LONGLIST - return s:LONGLIST.":long" - elseif liststyle == s:WIDELIST - return s:WIDELIST.":wide" - elseif liststyle == s:TREELIST - return s:TREELIST.":tree" - else - return 'n/a' - endif -endfun - -" --------------------------------------------------------------------- -" s:Strlen: this function returns the length of a string, even if its using multi-byte characters. {{{2 -" Solution from Nicolai Weibull, vim docs (:help strlen()), -" Tony Mechelynck, and my own invention. -fun! s:Strlen(x) -" "" call Dfunc("s:Strlen(x<".a:x."> g:Align_xstrlen=".g:Align_xstrlen.")") - - if v:version >= 703 && exists("*strdisplaywidth") - let ret= strdisplaywidth(a:x) - - elseif type(g:Align_xstrlen) == 1 - " allow user to specify a function to compute the string length (ie. let g:Align_xstrlen="mystrlenfunc") - exe "let ret= ".g:Align_xstrlen."('".substitute(a:x,"'","''","g")."')" - - elseif g:Align_xstrlen == 1 - " number of codepoints (Latin a + combining circumflex is two codepoints) - " (comment from TM, solution from NW) - let ret= strlen(substitute(a:x,'.','c','g')) - - elseif g:Align_xstrlen == 2 - " number of spacing codepoints (Latin a + combining circumflex is one spacing - " codepoint; a hard tab is one; wide and narrow CJK are one each; etc.) - " (comment from TM, solution from TM) - let ret=strlen(substitute(a:x, '.\Z', 'x', 'g')) - - elseif g:Align_xstrlen == 3 - " virtual length (counting, for instance, tabs as anything between 1 and - " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately - " preceded by lam, one otherwise, etc.) - " (comment from TM, solution from me) - let modkeep= &l:mod - exe "norm! o\" - call setline(line("."),a:x) - let ret= virtcol("$") - 1 - d - NetrwKeepj norm! k - let &l:mod= modkeep - - else - " at least give a decent default - let ret= strlen(a:x) - endif -" "" call Dret("s:Strlen ".ret) - return ret -endfun - -" --------------------------------------------------------------------- -" s:ShellEscape: shellescape(), or special windows handling {{{2 -fun! s:ShellEscape(s, ...) - if (has('win32') || has('win64')) && $SHELL == '' && &shellslash - return printf('"%s"', substitute(a:s, '"', '""', 'g')) - endif - let f = a:0 > 0 ? a:1 : 0 - return shellescape(a:s, f) -endfun - -" --------------------------------------------------------------------- -" s:TreeListMove: supports [[, ]], [], and ][ in tree mode {{{2 -fun! s:TreeListMove(dir) -" call Dfunc("s:TreeListMove(dir<".a:dir.">)") - let curline = getline('.') - let prvline = (line(".") > 1)? getline(line(".")-1) : '' - let nxtline = (line(".") < line("$"))? getline(line(".")+1) : '' - let curindent = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') - let indentm1 = substitute(curindent,'^'.s:treedepthstring,'','') - let treedepthchr = substitute(s:treedepthstring,' ','','g') - let stopline = exists("w:netrw_bannercnt")? w:netrw_bannercnt : 1 -" call Decho("prvline <".prvline."> #".(line(".")-1), '~'.expand("")) -" call Decho("curline <".curline."> #".line(".") , '~'.expand("")) -" call Decho("nxtline <".nxtline."> #".(line(".")+1), '~'.expand("")) -" call Decho("curindent<".curindent.">" , '~'.expand("")) -" call Decho("indentm1 <".indentm1.">" , '~'.expand("")) - " COMBAK : need to handle when on a directory - " COMBAK : need to handle ]] and ][. In general, needs work!!! - if curline !~ '/$' - if a:dir == '[[' && prvline != '' - NetrwKeepj norm! 0 - let nl = search('^'.indentm1.'\%('.s:treedepthstring.'\)\@!','bWe',stopline) " search backwards -" call Decho("regfile srch back: ".nl,'~'.expand("")) - elseif a:dir == '[]' && nxtline != '' - NetrwKeepj norm! 0 -" call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>','~'.expand("")) - let nl = search('^\%('.curindent.'\)\@!','We') " search forwards - if nl != 0 - NetrwKeepj norm! k - else - NetrwKeepj norm! G - endif -" call Decho("regfile srch fwd: ".nl,'~'.expand("")) - endif - endif - -" call Dret("s:TreeListMove") -endfun - -" --------------------------------------------------------------------- -" s:UpdateBuffersMenu: does emenu Buffers.Refresh (but due to locale, the menu item may not be called that) {{{2 -" The Buffers.Refresh menu calls s:BMShow(); unfortunately, that means that that function -" can't be called except via emenu. But due to locale, that menu line may not be called -" Buffers.Refresh; hence, s:NetrwBMShow() utilizes a "cheat" to call that function anyway. -fun! s:UpdateBuffersMenu() -" call Dfunc("s:UpdateBuffersMenu()") - if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu - try - sil emenu Buffers.Refresh\ menu - catch /^Vim\%((\a\+)\)\=:E/ - let v:errmsg= "" - sil NetrwKeepj call s:NetrwBMShow() - endtry - endif -" call Dret("s:UpdateBuffersMenu") -endfun - -" --------------------------------------------------------------------- -" s:UseBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck() {{{2 -" Matching function to s:SetBufWinVars() -fun! s:UseBufWinVars() -" call Dfunc("s:UseBufWinVars()") - if exists("b:netrw_liststyle") && !exists("w:netrw_liststyle") |let w:netrw_liststyle = b:netrw_liststyle |endif - if exists("b:netrw_bannercnt") && !exists("w:netrw_bannercnt") |let w:netrw_bannercnt = b:netrw_bannercnt |endif - if exists("b:netrw_method") && !exists("w:netrw_method") |let w:netrw_method = b:netrw_method |endif - if exists("b:netrw_prvdir") && !exists("w:netrw_prvdir") |let w:netrw_prvdir = b:netrw_prvdir |endif - if exists("b:netrw_explore_indx") && !exists("w:netrw_explore_indx") |let w:netrw_explore_indx = b:netrw_explore_indx |endif - if exists("b:netrw_explore_listlen") && !exists("w:netrw_explore_listlen")|let w:netrw_explore_listlen = b:netrw_explore_listlen|endif - if exists("b:netrw_explore_mtchcnt") && !exists("w:netrw_explore_mtchcnt")|let w:netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif - if exists("b:netrw_explore_bufnr") && !exists("w:netrw_explore_bufnr") |let w:netrw_explore_bufnr = b:netrw_explore_bufnr |endif - if exists("b:netrw_explore_line") && !exists("w:netrw_explore_line") |let w:netrw_explore_line = b:netrw_explore_line |endif - if exists("b:netrw_explore_list") && !exists("w:netrw_explore_list") |let w:netrw_explore_list = b:netrw_explore_list |endif -" call Dret("s:UseBufWinVars") -endfun - -" --------------------------------------------------------------------- -" s:UserMaps: supports user-defined UserMaps {{{2 -" * calls a user-supplied funcref(islocal,curdir) -" * interprets result -" See netrw#UserMaps() -fun! s:UserMaps(islocal,funcname) -" call Dfunc("s:UserMaps(islocal=".a:islocal.",funcname<".a:funcname.">)") - - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() - endif - let Funcref = function(a:funcname) - let result = Funcref(a:islocal) - - if type(result) == 1 - " if result from user's funcref is a string... -" call Decho("result string from user funcref<".result.">",'~'.expand("")) - if result == "refresh" -" call Decho("refreshing display",'~'.expand("")) - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - elseif result != "" -" call Decho("executing result<".result.">",'~'.expand("")) - exe result - endif - - elseif type(result) == 3 - " if result from user's funcref is a List... -" call Decho("result List from user funcref<".string(result).">",'~'.expand("")) - for action in result - if action == "refresh" -" call Decho("refreshing display",'~'.expand("")) - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - elseif action != "" -" call Decho("executing action<".action.">",'~'.expand("")) - exe action - endif - endfor - endif - -" call Dret("s:UserMaps") -endfun - -" ========================== -" Settings Restoration: {{{1 -" ========================== -let &cpo= s:keepcpo -unlet s:keepcpo - -" =============== -" Modelines: {{{1 -" =============== -" vim:ts=8 fdm=marker -" doing autoload/netrw.vim version v172g ~57 -" varname value=0 ~1 -" varname value=0 ~1 -" varname value=1 ~1 -" varname value=2 ~1 -" varname value=3 ~1 -" varname value=4 ~1 -" varname value=2 ~1 -" varname value=-q -O ~1 -" varname value=curl -T ~1 -" varname value=keepj ~1 -" varname value=rcp ~1 -" varname value=rsync ~1 -" varname value=/ ~1 -" varname value=scp -q ~1 -" varname value=sftp ~1 -" varname value=ssh ~1 -" varname value=0 ~1 -" varname value=1 ~1 -" varname value=1 ~1 -" varname value=0 ~1 -" varname value=noma nomod nonu nobl nowrap ro nornu ~1 -" varname value=-1 ~1 -" varname value=1 ~1 -" varname value=gzip ~1 -" varname value=ctags ~1 -" varname value=2 ~1 -" (netrw) COMBAK: cuc=0 cul=0 initialization of s:netrw_cu[cl] -" varname value=/cygdrive ~1 -" varname value=0 ~1 -" varname value=0 ~1 -" varname value={ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" } ~1 -" varname value=10 ~1 -" varname value=0 ~1 -" varname value=1 ~1 -" varname value=^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$ ~1 -" varname value=binary ~1 -" varname value=1 ~1 -" varname value=1 ~1 -" varname value= ~1 -" varname value=mkdir ~1 -" varname value=mkdir ~1 -" varname value=0 ~1 -" varname value=*./[\~ ~1 -" varname value=32 ~1 -" varname value=1 ~1 -" varname value=ssh USEPORT HOSTNAME mkdir ~1 -" varname value=1 ~1 -" varname value=0 ~1 -" varname value=chmod PERM FILENAME ~1 -" varname value=0 ~1 diff --git a/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim deleted file mode 100644 index 2b6f8f7a0f10b4..00000000000000 --- a/runtime/autoload/netrwFileHandlers.vim +++ /dev/null @@ -1,363 +0,0 @@ -" netrwFileHandlers: contains various extension-based file handlers for -" netrw's browsers' x command ("eXecute launcher") -" Maintainer: This runtime file is looking for a new maintainer. -" Original Author: Charles E. Campbell -" Date: Sep 18, 2020 -" Version: 11 -" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" netrwFileHandlers.vim is provided *as is* and comes with no -" warranty of any kind, either expressed or implied. In no -" event will the copyright holder be liable for any damages -" resulting from the use of this software. -" -" Rom 6:23 (WEB) For the wages of sin is death, but the free gift of God {{{1 -" is eternal life in Christ Jesus our Lord. - -" --------------------------------------------------------------------- -" Load Once: {{{1 -if exists("g:loaded_netrwFileHandlers") || &cp - finish -endif -let g:loaded_netrwFileHandlers= "v11" -if v:version < 702 - echohl WarningMsg - echo "***warning*** this version of netrwFileHandlers needs vim 7.2" - echohl Normal - finish -endif -let s:keepcpo= &cpo -set cpo&vim - -" --------------------------------------------------------------------- -" netrwFileHandlers#Invoke: {{{1 -fun! netrwFileHandlers#Invoke(exten,fname) -" call Dfunc("netrwFileHandlers#Invoke(exten<".a:exten."> fname<".a:fname.">)") - let exten= a:exten - " list of supported special characters. Consider rcs,v --- that can be - " supported with a NFH_rcsCOMMAv() handler - if exten =~ '[@:,$!=\-+%?;~]' - let specials= { -\ '@' : 'AT', -\ ':' : 'COLON', -\ ',' : 'COMMA', -\ '$' : 'DOLLAR', -\ '!' : 'EXCLAMATION', -\ '=' : 'EQUAL', -\ '-' : 'MINUS', -\ '+' : 'PLUS', -\ '%' : 'PERCENT', -\ '?' : 'QUESTION', -\ ';' : 'SEMICOLON', -\ '~' : 'TILDE'} - let exten= substitute(a:exten,'[@:,$!=\-+%?;~]','\=specials[submatch(0)]','ge') -" call Decho('fname<'.fname.'> done with dictionary') - endif - - if a:exten != "" && exists("*NFH_".exten) - " support user NFH_*() functions -" call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")') - exe "let ret= NFH_".exten.'("'.a:fname.'")' - elseif a:exten != "" && exists("*s:NFH_".exten) - " use builtin-NFH_*() functions -" call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")') - exe "let ret= s:NFH_".a:exten.'("'.a:fname.'")' - endif - -" call Dret("netrwFileHandlers#Invoke 0 : ret=".ret) - return 0 -endfun - -" --------------------------------------------------------------------- -" s:NFH_html: handles html when the user hits "x" when the {{{1 -" cursor is atop a *.html file -fun! s:NFH_html(pagefile) -" call Dfunc("s:NFH_html(".a:pagefile.")") - - let page= substitute(a:pagefile,'^','file://','') - - if executable("mozilla") -" call Decho("executing !mozilla ".page) - exe "!mozilla ".shellescape(page,1) - elseif executable("netscape") -" call Decho("executing !netscape ".page) - exe "!netscape ".shellescape(page,1) - else -" call Dret("s:NFH_html 0") - return 0 - endif - -" call Dret("s:NFH_html 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_htm: handles html when the user hits "x" when the {{{1 -" cursor is atop a *.htm file -fun! s:NFH_htm(pagefile) -" call Dfunc("s:NFH_htm(".a:pagefile.")") - - let page= substitute(a:pagefile,'^','file://','') - - if executable("mozilla") -" call Decho("executing !mozilla ".page) - exe "!mozilla ".shellescape(page,1) - elseif executable("netscape") -" call Decho("executing !netscape ".page) - exe "!netscape ".shellescape(page,1) - else -" call Dret("s:NFH_htm 0") - return 0 - endif - -" call Dret("s:NFH_htm 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_jpg: {{{1 -fun! s:NFH_jpg(jpgfile) -" call Dfunc("s:NFH_jpg(jpgfile<".a:jpgfile.">)") - - if executable("gimp") - exe "silent! !gimp -s ".shellescape(a:jpgfile,1) - elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") -" call Decho("silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".escape(a:jpgfile," []|'")) - exe "!".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:jpgfile,1) - else -" call Dret("s:NFH_jpg 0") - return 0 - endif - -" call Dret("s:NFH_jpg 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_gif: {{{1 -fun! s:NFH_gif(giffile) -" call Dfunc("s:NFH_gif(giffile<".a:giffile.">)") - - if executable("gimp") - exe "silent! !gimp -s ".shellescape(a:giffile,1) - elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:giffile,1) - else -" call Dret("s:NFH_gif 0") - return 0 - endif - -" call Dret("s:NFH_gif 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_png: {{{1 -fun! s:NFH_png(pngfile) -" call Dfunc("s:NFH_png(pngfile<".a:pngfile.">)") - - if executable("gimp") - exe "silent! !gimp -s ".shellescape(a:pngfile,1) - elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:pngfile,1) - else -" call Dret("s:NFH_png 0") - return 0 - endif - -" call Dret("s:NFH_png 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_pnm: {{{1 -fun! s:NFH_pnm(pnmfile) -" call Dfunc("s:NFH_pnm(pnmfile<".a:pnmfile.">)") - - if executable("gimp") - exe "silent! !gimp -s ".shellescape(a:pnmfile,1) - elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:pnmfile,1) - else -" call Dret("s:NFH_pnm 0") - return 0 - endif - -" call Dret("s:NFH_pnm 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_bmp: visualize bmp files {{{1 -fun! s:NFH_bmp(bmpfile) -" call Dfunc("s:NFH_bmp(bmpfile<".a:bmpfile.">)") - - if executable("gimp") - exe "silent! !gimp -s ".a:bmpfile - elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:bmpfile,1) - else -" call Dret("s:NFH_bmp 0") - return 0 - endif - -" call Dret("s:NFH_bmp 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_pdf: visualize pdf files {{{1 -fun! s:NFH_pdf(pdf) -" call Dfunc("s:NFH_pdf(pdf<".a:pdf.">)") - if executable("gs") - exe 'silent! !gs '.shellescape(a:pdf,1) - elseif executable("pdftotext") - exe 'silent! pdftotext -nopgbrk '.shellescape(a:pdf,1) - else -" call Dret("s:NFH_pdf 0") - return 0 - endif - -" call Dret("s:NFH_pdf 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_doc: visualize doc files {{{1 -fun! s:NFH_doc(doc) -" call Dfunc("s:NFH_doc(doc<".a:doc.">)") - - if executable("oowriter") - exe 'silent! !oowriter '.shellescape(a:doc,1) - redraw! - else -" call Dret("s:NFH_doc 0") - return 0 - endif - -" call Dret("s:NFH_doc 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_sxw: visualize sxw files {{{1 -fun! s:NFH_sxw(sxw) -" call Dfunc("s:NFH_sxw(sxw<".a:sxw.">)") - - if executable("oowriter") - exe 'silent! !oowriter '.shellescape(a:sxw,1) - redraw! - else -" call Dret("s:NFH_sxw 0") - return 0 - endif - -" call Dret("s:NFH_sxw 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_xls: visualize xls files {{{1 -fun! s:NFH_xls(xls) -" call Dfunc("s:NFH_xls(xls<".a:xls.">)") - - if executable("oocalc") - exe 'silent! !oocalc '.shellescape(a:xls,1) - redraw! - else -" call Dret("s:NFH_xls 0") - return 0 - endif - -" call Dret("s:NFH_xls 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_ps: handles PostScript files {{{1 -fun! s:NFH_ps(ps) -" call Dfunc("s:NFH_ps(ps<".a:ps.">)") - if executable("gs") -" call Decho("exe silent! !gs ".a:ps) - exe "silent! !gs ".shellescape(a:ps,1) - redraw! - elseif executable("ghostscript") -" call Decho("exe silent! !ghostscript ".a:ps) - exe "silent! !ghostscript ".shellescape(a:ps,1) - redraw! - elseif executable("gswin32") -" call Decho("exe silent! !gswin32 ".shellescape(a:ps,1)) - exe "silent! !gswin32 ".shellescape(a:ps,1) - redraw! - else -" call Dret("s:NFH_ps 0") - return 0 - endif - -" call Dret("s:NFH_ps 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_eps: handles encapsulated PostScript files {{{1 -fun! s:NFH_eps(eps) -" call Dfunc("s:NFH_eps()") - if executable("gs") - exe "silent! !gs ".shellescape(a:eps,1) - redraw! - elseif executable("ghostscript") - exe "silent! !ghostscript ".shellescape(a:eps,1) - redraw! - elseif executable("ghostscript") - exe "silent! !ghostscript ".shellescape(a:eps,1) - redraw! - elseif executable("gswin32") - exe "silent! !gswin32 ".shellescape(a:eps,1) - redraw! - else -" call Dret("s:NFH_eps 0") - return 0 - endif -" call Dret("s:NFH_eps 0") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_fig: handles xfig files {{{1 -fun! s:NFH_fig(fig) -" call Dfunc("s:NFH_fig()") - if executable("xfig") - exe "silent! !xfig ".a:fig - redraw! - else -" call Dret("s:NFH_fig 0") - return 0 - endif - -" call Dret("s:NFH_fig 1") - return 1 -endfun - -" --------------------------------------------------------------------- -" s:NFH_obj: handles tgif's obj files {{{1 -fun! s:NFH_obj(obj) -" call Dfunc("s:NFH_obj()") - if has("unix") && executable("tgif") - exe "silent! !tgif ".a:obj - redraw! - else -" call Dret("s:NFH_obj 0") - return 0 - endif - -" call Dret("s:NFH_obj 1") - return 1 -endfun - -let &cpo= s:keepcpo -unlet s:keepcpo -" --------------------------------------------------------------------- -" Modelines: {{{1 -" vim: fdm=marker diff --git a/runtime/autoload/paste.vim b/runtime/autoload/paste.vim index 1ba336c2b3ee8e..84d4d774018631 100644 --- a/runtime/autoload/paste.vim +++ b/runtime/autoload/paste.vim @@ -4,7 +4,7 @@ " Former Maintainer: Bram Moolenaar " Define the string to use for items that are present both in Edit, Popup and -" Toolbar menu. Also used in mswin.vim and macmap.vim. +" Toolbar menu. Also used in mswin.vim. let paste#paste_cmd = {'n': ":call paste#Paste()"} let paste#paste_cmd['v'] = '"-c' . paste#paste_cmd['n'] diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 82e09531963adf..0bfd82f61d4da4 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -140,13 +140,25 @@ function! provider#clipboard#Executable() abort let s:copy['*'] = s:copy['+'] let s:paste['*'] = s:paste['+'] return 'win32yank' + elseif executable('putclip') && executable('getclip') + let s:copy['+'] = ['putclip'] + let s:paste['+'] = ['getclip'] + let s:copy['*'] = s:copy['+'] + let s:paste['*'] = s:paste['+'] + return 'putclip' + elseif executable('clip') && executable('powershell') + let s:copy['+'] = ['clip'] + let s:paste['+'] = ['powershell', '-NoProfile', '-NoLogo', '-Command', 'Get-Clipboard'] + let s:copy['*'] = s:copy['+'] + let s:paste['*'] = s:paste['+'] + return 'clip' elseif executable('termux-clipboard-set') let s:copy['+'] = ['termux-clipboard-set'] let s:paste['+'] = ['termux-clipboard-get'] let s:copy['*'] = s:copy['+'] let s:paste['*'] = s:paste['+'] return 'termux-clipboard' - elseif !empty($TMUX) && executable('tmux') + elseif executable('tmux') && (!empty($TMUX) || 0 == jobwait([jobstart(['tmux', 'list-buffers'])], 2000)[0]) let tmux_v = v:lua.vim.version.parse(system(['tmux', '-V'])) if !empty(tmux_v) && !v:lua.vim.version.lt(tmux_v, [3,2,0]) let s:copy['+'] = ['tmux', 'load-buffer', '-w', '-'] @@ -157,6 +169,14 @@ function! provider#clipboard#Executable() abort let s:copy['*'] = s:copy['+'] let s:paste['*'] = s:paste['+'] return 'tmux' + elseif get(get(g:, 'termfeatures', {}), 'osc52') && &clipboard ==# '' + " Don't use OSC 52 when 'clipboard' is set. It can be slow and cause a lot + " of user prompts. Users can opt-in to it by setting g:clipboard manually. + let s:copy['+'] = v:lua.require'vim.ui.clipboard.osc52'.copy('+') + let s:copy['*'] = v:lua.require'vim.ui.clipboard.osc52'.copy('*') + let s:paste['+'] = v:lua.require'vim.ui.clipboard.osc52'.paste('+') + let s:paste['*'] = v:lua.require'vim.ui.clipboard.osc52'.paste('*') + return 'OSC 52' endif let s:err = 'clipboard: No clipboard tool. :help clipboard' diff --git a/runtime/autoload/shada.vim b/runtime/autoload/shada.vim index ae718ad2e75b71..4753973196ec83 100644 --- a/runtime/autoload/shada.vim +++ b/runtime/autoload/shada.vim @@ -230,7 +230,7 @@ function s:shada_check_type(type, val) abort return 0 elseif a:type is# 'bin' " Binary string without zero bytes - if type isnot# 'binary' + if type isnot# 'string' return 'Expected binary string' elseif (type(a:val) == type({}) \&& !empty(filter(copy(a:val._VAL), 'stridx(v:val, "\n") != -1'))) @@ -247,7 +247,7 @@ function s:shada_check_type(type, val) abort if type isnot# 'array' return 'Expected array value' elseif !empty(filter(copy(type(a:val) == type({}) ? a:val._VAL : a:val), - \'msgpack#type(v:val) isnot# "binary"')) + \'msgpack#type(v:val) isnot# "string"')) return 'Expected array of binary strings' else for element in (type(a:val) == type({}) ? a:val._VAL : a:val) diff --git a/runtime/autoload/spotbugs.vim b/runtime/autoload/spotbugs.vim new file mode 100644 index 00000000000000..9161395794ea24 --- /dev/null +++ b/runtime/autoload/spotbugs.vim @@ -0,0 +1,250 @@ +" Default pre- and post-compiler actions for SpotBugs +" Maintainers: @konfekt and @zzzyxwvut +" Last Change: 2024 Nov 27 + +let s:save_cpo = &cpo +set cpo&vim + +if v:version > 900 + + function! spotbugs#DeleteClassFiles() abort + if !exists('b:spotbugs_class_files') + return + endif + + for pathname in b:spotbugs_class_files + let classname = pathname =~# "^'.\\+\\.class'$" + \ ? eval(pathname) + \ : pathname + + if classname =~# '\.class$' && filereadable(classname) + " Since v9.0.0795. + let octad = readblob(classname, 0, 8) + + " Test the magic number and the major version number (45 for v1.0). + " Since v9.0.2027. + if len(octad) == 8 && octad[0 : 3] == 0zcafe.babe && + \ or((octad[6] << 8), octad[7]) >= 45 + echomsg printf('Deleting %s: %d', classname, delete(classname)) + endif + endif + endfor + + let b:spotbugs_class_files = [] + endfunction + +else + + function! s:DeleteClassFilesWithNewLineCodes(classname) abort + " The distribution of "0a"s in class file versions 2560 and 2570: + " + " 0zca.fe.ba.be.00.00.0a.00 0zca.fe.ba.be.00.00.0a.0a + " 0zca.fe.ba.be.00.0a.0a.00 0zca.fe.ba.be.00.0a.0a.0a + " 0zca.fe.ba.be.0a.00.0a.00 0zca.fe.ba.be.0a.00.0a.0a + " 0zca.fe.ba.be.0a.0a.0a.00 0zca.fe.ba.be.0a.0a.0a.0a + let numbers = [0, 0, 0, 0, 0, 0, 0, 0] + let offset = 0 + let lines = readfile(a:classname, 'b', 4) + + " Track NL byte counts to handle files of less than 8 bytes. + let nl_cnt = len(lines) + " Track non-NL byte counts for "0zca.fe.ba.be.0a.0a.0a.0a". + let non_nl_cnt = 0 + + for line in lines + for idx in range(strlen(line)) + " Remap NLs to Nuls. + let numbers[offset] = (line[idx] == "\n") ? 0 : char2nr(line[idx]) % 256 + let non_nl_cnt += 1 + let offset += 1 + + if offset > 7 + break + endif + endfor + + let nl_cnt -= 1 + + if offset > 7 || (nl_cnt < 1 && non_nl_cnt > 4) + break + endif + + " Reclaim NLs. + let numbers[offset] = 10 + let offset += 1 + + if offset > 7 + break + endif + endfor + + " Test the magic number and the major version number (45 for v1.0). + if offset > 7 && numbers[0] == 0xca && numbers[1] == 0xfe && + \ numbers[2] == 0xba && numbers[3] == 0xbe && + \ (numbers[6] * 256 + numbers[7]) >= 45 + echomsg printf('Deleting %s: %d', a:classname, delete(a:classname)) + endif + endfunction + + function! spotbugs#DeleteClassFiles() abort + if !exists('b:spotbugs_class_files') + return + endif + + let encoding = &encoding + + try + set encoding=latin1 + + for pathname in b:spotbugs_class_files + let classname = pathname =~# "^'.\\+\\.class'$" + \ ? eval(pathname) + \ : pathname + + if classname =~# '\.class$' && filereadable(classname) + let line = get(readfile(classname, 'b', 1), 0, '') + let length = strlen(line) + + " Test the magic number and the major version number (45 for v1.0). + if length > 3 && line[0 : 3] == "\xca\xfe\xba\xbe" + if length > 7 && ((line[6] == "\n" ? 0 : char2nr(line[6]) % 256) * 256 + + \ (line[7] == "\n" ? 0 : char2nr(line[7]) % 256)) >= 45 + echomsg printf('Deleting %s: %d', classname, delete(classname)) + else + call s:DeleteClassFilesWithNewLineCodes(classname) + endif + endif + endif + endfor + finally + let &encoding = encoding + endtry + + let b:spotbugs_class_files = [] + endfunction + +endif + +function! spotbugs#DefaultPostCompilerAction() abort + " Since v7.4.191. + make %:S +endfunction + +" Look for "spotbugs#compiler" in "ftplugin/java.vim". +let s:compiler = exists('spotbugs#compiler') ? spotbugs#compiler : '' +let s:readable = filereadable($VIMRUNTIME . '/compiler/' . s:compiler . '.vim') + +if s:readable && s:compiler ==# 'maven' && executable('mvn') + + function! spotbugs#DefaultPreCompilerAction() abort + call spotbugs#DeleteClassFiles() + compiler maven + make compile + endfunction + + function! spotbugs#DefaultPreCompilerTestAction() abort + call spotbugs#DeleteClassFiles() + compiler maven + make test-compile + endfunction + + function! spotbugs#DefaultProperties() abort + return { + \ 'PreCompilerAction': + \ function('spotbugs#DefaultPreCompilerAction'), + \ 'PreCompilerTestAction': + \ function('spotbugs#DefaultPreCompilerTestAction'), + \ 'PostCompilerAction': + \ function('spotbugs#DefaultPostCompilerAction'), + \ 'sourceDirPath': 'src/main/java', + \ 'classDirPath': 'target/classes', + \ 'testSourceDirPath': 'src/test/java', + \ 'testClassDirPath': 'target/test-classes', + \ } + endfunction + + unlet s:readable s:compiler +elseif s:readable && s:compiler ==# 'ant' && executable('ant') + + function! spotbugs#DefaultPreCompilerAction() abort + call spotbugs#DeleteClassFiles() + compiler ant + make compile + endfunction + + function! spotbugs#DefaultPreCompilerTestAction() abort + call spotbugs#DeleteClassFiles() + compiler ant + make compile-test + endfunction + + function! spotbugs#DefaultProperties() abort + return { + \ 'PreCompilerAction': + \ function('spotbugs#DefaultPreCompilerAction'), + \ 'PreCompilerTestAction': + \ function('spotbugs#DefaultPreCompilerTestAction'), + \ 'PostCompilerAction': + \ function('spotbugs#DefaultPostCompilerAction'), + \ 'sourceDirPath': 'src', + \ 'classDirPath': 'build/classes', + \ 'testSourceDirPath': 'test', + \ 'testClassDirPath': 'build/test/classes', + \ } + endfunction + + unlet s:readable s:compiler +elseif s:readable && s:compiler ==# 'javac' && executable('javac') + + function! spotbugs#DefaultPreCompilerAction() abort + call spotbugs#DeleteClassFiles() + compiler javac + + if get(b:, 'javac_makeprg_params', get(g:, 'javac_makeprg_params', '')) =~ '\s@\S' + " Read options and filenames from @options [@sources ...]. + make + else + " Let Javac figure out what files to compile. + execute 'make ' . join(map(filter(copy(v:argv), + \ "v:val =~# '\\.java\\=$'"), + \ 'shellescape(v:val)'), ' ') + endif + endfunction + + function! spotbugs#DefaultPreCompilerTestAction() abort + call spotbugs#DefaultPreCompilerAction() + endfunction + + function! spotbugs#DefaultProperties() abort + return { + \ 'PreCompilerAction': + \ function('spotbugs#DefaultPreCompilerAction'), + \ 'PreCompilerTestAction': + \ function('spotbugs#DefaultPreCompilerTestAction'), + \ 'PostCompilerAction': + \ function('spotbugs#DefaultPostCompilerAction'), + \ } + endfunction + + unlet s:readable s:compiler +else + + function! spotbugs#DefaultPreCompilerAction() abort + echomsg printf('Not supported: "%s"', s:compiler) + endfunction + + function! spotbugs#DefaultPreCompilerTestAction() abort + call spotbugs#DefaultPreCompilerAction() + endfunction + + function! spotbugs#DefaultProperties() abort + return {} + endfunction + + unlet s:readable +endif + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set foldmethod=syntax shiftwidth=2 expandtab: diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index f2a74db5ed36f6..12409f81453fad 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -1,6 +1,6 @@ " tar.vim: Handles browsing tarfiles " AUTOLOAD PORTION -" Date: Nov 14, 2023 +" Date: Nov 11, 2024 " Version: 32b (with modifications from the Vim Project) " Maintainer: This runtime file is looking for a new maintainer. " Former Maintainer: Charles E Campbell @@ -23,7 +23,7 @@ if &cp || exists("g:loaded_tar") finish endif -let g:loaded_tar= "v32a" +let g:loaded_tar= "v32b" if v:version < 702 echohl WarningMsg echo "***warning*** this version of tar needs vim 7.2" @@ -41,7 +41,7 @@ if !exists("g:tar_browseoptions") let g:tar_browseoptions= "Ptf" endif if !exists("g:tar_readoptions") - let g:tar_readoptions= "OPxf" + let g:tar_readoptions= "pPxf" endif if !exists("g:tar_cmd") let g:tar_cmd= "tar" @@ -80,7 +80,7 @@ if !exists("g:tar_copycmd") let g:tar_copycmd= g:netrw_localcopycmd endif if !exists("g:tar_extractcmd") - let g:tar_extractcmd= "tar -xf" + let g:tar_extractcmd= "tar -pxf" endif " set up shell quoting character @@ -294,6 +294,41 @@ fun! tar#Read(fname,mode) set report=10 let tarfile = substitute(a:fname,'tarfile:\(.\{-}\)::.*$','\1','') let fname = substitute(a:fname,'tarfile:.\{-}::\(.*\)$','\1','') + +" changing the directory to the temporary earlier to allow tar to extract the file with permissions intact + if !exists("*mkdir") + redraw! + echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None + let &report= repkeep + return + endif + + let curdir= getcwd() + let tmpdir= tempname() + let b:curdir= tmpdir + let b:tmpdir= curdir + if tmpdir =~ '\.' + let tmpdir= substitute(tmpdir,'\.[^.]*$','','e') + endif + call mkdir(tmpdir,"p") + + " attempt to change to the indicated directory + try + exe "cd ".fnameescape(tmpdir) + catch /^Vim\%((\a\+)\)\=:E344/ + redraw! + echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None + let &report= repkeep + return + endtry + + " place temporary files under .../_ZIPVIM_/ + if isdirectory("_ZIPVIM_") + call s:Rmdir("_ZIPVIM_") + endif + call mkdir("_ZIPVIM_") + cd _ZIPVIM_ + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') @@ -332,9 +367,10 @@ fun! tar#Read(fname,mode) if tarfile =~# '\.bz2$' exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "read ".fname elseif tarfile =~# '\.\(gz\)$' exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp - + exe "read ".fname elseif tarfile =~# '\(\.tgz\|\.tbz\|\.txz\)' if has("unix") && executable("file") let filekind= system("file ".shellescape(tarfile,1)) @@ -343,20 +379,27 @@ fun! tar#Read(fname,mode) 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 + exe "read ".fname elseif filekind =~ "XZ" exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "read ".fname elseif filekind =~ "Zstandard" exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "read ".fname else exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "read ".fname endif elseif tarfile =~# '\.lrp$' exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "read ".fname elseif tarfile =~# '\.lzma$' exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "read ".fname elseif tarfile =~# '\.\(xz\|txz\)$' exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "read ".fname else if tarfile =~ '^\s*-' " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. @@ -364,6 +407,16 @@ fun! tar#Read(fname,mode) endif " call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions.tar_secure.shellescape(tarfile,1)." ".shellescape(fname,1).decmp) exe "silent r! ".g:tar_cmd." -".g:tar_readoptions.shellescape(tarfile,1)." ".tar_secure.shellescape(fname,1).decmp + exe "read ".fname + endif + + redraw! + +if v:shell_error != 0 + cd .. + call s:Rmdir("_ZIPVIM_") + exe "cd ".fnameescape(curdir) + echohl Error | echo "***error*** (tar#Read) sorry, unable to open or extract ".tarfile." with ".fname | echohl None endif if doro @@ -388,6 +441,10 @@ fun! tar#Write(fname) " call Dfunc("tar#Write(fname<".a:fname.">) b:tarfile<".b:tarfile."> tblfile_".winnr()."<".s:tblfile_{winnr()}.">") let repkeep= &report set report=10 + + " temporary buffer variable workaround because too fucking tired. but it works now + let curdir= b:curdir + let tmpdir= b:tmpdir if !exists("g:tar_secure") && a:fname =~ '^\s*-\|\s\+-' redraw! @@ -404,44 +461,6 @@ fun! tar#Write(fname) " call Dret("tar#Write") return endif - if !exists("*mkdir") - 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 - let &report= repkeep -" call Dret("tar#Write") - return - endif - - let curdir= getcwd() - let tmpdir= tempname() -" call Decho("orig tempname<".tmpdir.">") - if tmpdir =~ '\.' - let tmpdir= substitute(tmpdir,'\.[^.]*$','','e') - endif -" call Decho("tmpdir<".tmpdir.">") - call mkdir(tmpdir,"p") - - " attempt to change to the indicated directory - try - exe "cd ".fnameescape(tmpdir) - catch /^Vim\%((\a\+)\)\=:E344/ - redraw! -" call Decho("***error*** (tar#Write) cannot cd to temporary directory") - echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None - let &report= repkeep -" call Dret("tar#Write") - return - endtry -" call Decho("current directory now: ".getcwd()) - - " place temporary files under .../_ZIPVIM_/ - if isdirectory("_ZIPVIM_") - call s:Rmdir("_ZIPVIM_") - endif - call mkdir("_ZIPVIM_") - cd _ZIPVIM_ -" call Decho("current directory now: ".getcwd()) let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','') let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','') diff --git a/runtime/autoload/typst.vim b/runtime/autoload/typst.vim new file mode 100644 index 00000000000000..362da3f45e5ff1 --- /dev/null +++ b/runtime/autoload/typst.vim @@ -0,0 +1,79 @@ +" Language: Typst +" Previous Maintainer: Gregory Anders +" Maintainer: Luca Saccarola +" Last Change: 2024 Dec 09 +" Based on: https://github.com/kaarmu/typst.vim + +function! typst#indentexpr() abort + let l:lnum = v:lnum + let s:sw = shiftwidth() + + let [l:plnum, l:pline] = s:get_prev_nonblank(l:lnum - 1) + if l:plnum == 0 | return 0 | endif + + let l:line = getline(l:lnum) + let l:ind = indent(l:plnum) + + let l:synname = synIDattr(synID(l:lnum, 1, 1), 'name') + + " Use last indent for block comments + if l:synname == 'typstCommentBlock' + return l:ind + " do not change the indents of bullet lists + elseif l:synname == 'typstMarkupBulletList' + return indent(a:lnum) + endif + + if l:pline =~ '\v[{[(]\s*$' + let l:ind += s:sw + endif + + if l:line =~ '\v^\s*[}\])]' + let l:ind -= s:sw + endif + + return l:ind +endfunction + +function typst#foldexpr() + let line = getline(v:lnum) + + " Whenever the user wants to fold nested headers under the parent + let nested = get(g:, "typst_foldnested", 1) + + " Regular headers + let depth = match(line, '\(^=\+\)\@<=\( .*$\)\@=') + + " Do not fold nested regular headers + if depth > 1 && !nested + let depth = 1 + endif + + if depth > 0 + " check syntax, it should be typstMarkupHeading + let syncode = synstack(v:lnum, 1) + if len(syncode) > 0 && synIDattr(syncode[0], 'name') ==# 'typstMarkupHeading' + return ">" . depth + endif + endif + + return "=" +endfunction + +" Gets the previous non-blank line that is not a comment. +function! s:get_prev_nonblank(lnum) abort + let l:lnum = prevnonblank(a:lnum) + let l:line = getline(l:lnum) + + while l:lnum > 0 && l:line =~ '^\s*//' + let l:lnum = prevnonblank(l:lnum - 1) + let l:line = getline(l:lnum) + endwhile + + return [l:lnum, s:remove_comments(l:line)] +endfunction + +" Removes comments from the given line. +function! s:remove_comments(line) abort + return substitute(a:line, '\s*//.*', '', '') +endfunction diff --git a/runtime/autoload/zig/fmt.vim b/runtime/autoload/zig/fmt.vim deleted file mode 100644 index b78c1994dd8172..00000000000000 --- a/runtime/autoload/zig/fmt.vim +++ /dev/null @@ -1,100 +0,0 @@ -" Adapted from fatih/vim-go: autoload/go/fmt.vim -" -" Copyright 2011 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" Upstream: https://github.com/ziglang/zig.vim - -function! zig#fmt#Format() abort - " Save cursor position and many other things. - let view = winsaveview() - - if !executable('zig') - echohl Error | echomsg "no zig binary found in PATH" | echohl None - return - endif - - let cmdline = 'zig fmt --stdin --ast-check' - let current_buf = bufnr('') - - " The formatted code is output on stdout, the errors go on stderr. - if exists('*systemlist') - silent let out = systemlist(cmdline, current_buf) - else - silent let out = split(system(cmdline, current_buf)) - endif - if len(out) == 1 - if out[0] == "error: unrecognized parameter: '--ast-check'" - let cmdline = 'zig fmt --stdin' - if exists('*systemlist') - silent let out = systemlist(cmdline, current_buf) - else - silent let out = split(system(cmdline, current_buf)) - endif - endif - endif - let err = v:shell_error - - - if err == 0 - " remove undo point caused via BufWritePre. - try | silent undojoin | catch | endtry - - " Replace the file content with the formatted version. - if exists('*deletebufline') - call deletebufline(current_buf, len(out), line('$')) - else - silent execute ':' . len(out) . ',' . line('$') . ' delete _' - endif - call setline(1, out) - - " No errors detected, close the loclist. - call setloclist(0, [], 'r') - lclose - elseif get(g:, 'zig_fmt_parse_errors', 1) - let errors = s:parse_errors(expand('%'), out) - - call setloclist(0, [], 'r', { - \ 'title': 'Errors', - \ 'items': errors, - \ }) - - let max_win_height = get(g:, 'zig_fmt_max_window_height', 5) - " Prevent the loclist from becoming too long. - let win_height = min([max_win_height, len(errors)]) - " Open the loclist, but only if there's at least one error to show. - execute 'silent! lwindow ' . win_height - endif - - call winrestview(view) - - if err != 0 - echohl Error | echomsg "zig fmt returned error" | echohl None - return - endif - - " Run the syntax highlighter on the updated content and recompute the folds if - " needed. - syntax sync fromstart -endfunction - -" parse_errors parses the given errors and returns a list of parsed errors -function! s:parse_errors(filename, lines) abort - " list of errors to be put into location list - let errors = [] - for line in a:lines - let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') - if !empty(tokens) - call add(errors,{ - \"filename": a:filename, - \"lnum": tokens[2], - \"col": tokens[3], - \"text": tokens[4], - \ }) - endif - endfor - - return errors -endfunction -" vim: sw=2 ts=2 et diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index c0034f8a7abdb8..a8ea6a3fab6830 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -1,36 +1,38 @@ " zip.vim: Handles browsing zipfiles -" AUTOLOAD PORTION -" Date: Mar 12, 2023 -" Version: 33 +" AUTOLOAD PORTION +" Date: 2024 Aug 21 +" Version: 34 " Maintainer: This runtime file is looking for a new maintainer. " Former Maintainer: Charles E Campbell +" Last Change: +" 2024 Jun 16 by Vim Project: handle whitespace on Windows properly (#14998) +" 2024 Jul 23 by Vim Project: fix 'x' command +" 2024 Jul 24 by Vim Project: use delete() function +" 2024 Jul 30 by Vim Project: fix opening remote zipfile +" 2024 Aug 04 by Vim Project: escape '[' in name of file to be extracted +" 2024 Aug 05 by Vim Project: workaround for the FreeBSD's unzip +" 2024 Aug 05 by Vim Project: clean-up and make it work with shellslash on Windows +" 2024 Aug 18 by Vim Project: correctly handle special globbing chars +" 2024 Aug 21 by Vim Project: simplify condition to detect MS-Windows " License: Vim License (see vim's :help license) -" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" zip.vim and zipPlugin.vim are provided *as is* and comes with -" no warranty of any kind, either expressed or implied. By using -" this plugin, you agree that in no event will the copyright -" holder be liable for any damages resulting from the use -" of this software. -"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() +" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" zip.vim and zipPlugin.vim are provided *as is* and comes with +" no warranty of any kind, either expressed or implied. By using +" this plugin, you agree that in no event will the copyright +" holder be liable for any damages resulting from the use +" of this software. " --------------------------------------------------------------------- " Load Once: {{{1 if &cp || exists("g:loaded_zip") finish endif -let g:loaded_zip= "v33" -if v:version < 702 - echohl WarningMsg - echo "***warning*** this version of zip needs vim 7.2 or later" - echohl Normal - finish -endif +let g:loaded_zip= "v34" let s:keepcpo= &cpo set cpo&vim -"DechoTabOn let s:zipfile_escape = ' ?&;\' let s:ERROR = 2 @@ -58,8 +60,27 @@ if !exists("g:zip_extractcmd") let g:zip_extractcmd= g:zip_unzipcmd endif +" --------------------------------------------------------------------- +" required early +" s:Mess: {{{2 +fun! s:Mess(group, msg) + redraw! + exe "echohl " . a:group + echomsg a:msg + echohl Normal +endfun + +if v:version < 702 + call s:Mess('WarningMsg', "***warning*** this version of zip needs vim 7.2 or later") + finish +endif +" sanity checks +if !executable(g:zip_unzipcmd) + call s:Mess('Error', "***error*** (zip#Browse) unzip not available on your system") + finish +endif if !dist#vim#IsSafeExecutable('zip', g:zip_unzipcmd) - echoerr "Warning: NOT executing " .. g:zip_unzipcmd .. " from current directory!" + call s:Mess('Error', "Warning: NOT executing " .. g:zip_unzipcmd .. " from current directory!") finish endif @@ -70,47 +91,28 @@ endif " --------------------------------------------------------------------- " zip#Browse: {{{2 fun! zip#Browse(zipfile) -" call Dfunc("zip#Browse(zipfile<".a:zipfile.">)") - " sanity check: insure that the zipfile has "PK" as its first two letters - " (zipped files have a leading PK as a "magic cookie") - if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK' - exe "noswapfile noautocmd noswapfile e ".fnameescape(a:zipfile) -" call Dret("zip#Browse : not a zipfile<".a:zipfile.">") + " sanity check: ensure that the zipfile has "PK" as its first two letters + " (zip files have a leading PK as a "magic cookie") + if filereadable(a:zipfile) && readblob(a:zipfile, 0, 2) != 0z50.4B + exe "noswapfile noautocmd e " .. fnameescape(a:zipfile) return -" else " Decho -" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - it's a zip file") endif - let repkeep= &report - set report=10 + let dict = s:SetSaneOpts() + defer s:RestoreOpts(dict) " sanity checks - if !exists("*fnameescape") - if &verbose > 1 - echoerr "the zip plugin is not available (your vim doesn't support fnameescape())" - endif - return - endif if !executable(g:zip_unzipcmd) - redraw! - echohl Error | echo "***error*** (zip#Browse) unzip not available on your system" -" call inputsave()|call input("Press to continue")|call inputrestore() - let &report= repkeep -" call Dret("zip#Browse") + call s:Mess('Error', "***error*** (zip#Browse) unzip not available on your system") return endif if !filereadable(a:zipfile) if a:zipfile !~# '^\a\+://' " if it's an url, don't complain, let url-handlers such as vim do its thing - redraw! - echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() + call s:Mess('Error', "***error*** (zip#Browse) File not readable <".a:zipfile.">") endif - let &report= repkeep -" call Dret("zip#Browse : file<".a:zipfile."> not readable") return endif -" call Decho("passed sanity checks") if &ma != 1 set ma endif @@ -135,19 +137,15 @@ fun! zip#Browse(zipfile) \ '" Select a file with cursor and press ENTER']) keepj $ -" call Decho("exe silent r! ".g:zip_unzipcmd." -l -- ".s:Escape(a:zipfile,1)) - exe "keepj sil! r! ".g:zip_unzipcmd." -Z -1 -- ".s:Escape(a:zipfile,1) + exe $"keepj sil r! {g:zip_unzipcmd} -Z1 -- {s:Escape(a:zipfile, 1)}" if v:shell_error != 0 - redraw! - echohl WarningMsg | echo "***warning*** (zip#Browse) ".fnameescape(a:zipfile)." is not a zip file" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() + call s:Mess('WarningMsg', "***warning*** (zip#Browse) ".fnameescape(a:zipfile)." is not a zip file") keepj sil! %d let eikeep= &ei set ei=BufReadCmd,FileReadCmd exe "keepj r ".fnameescape(a:zipfile) let &ei= eikeep keepj 1d -" call Dret("zip#Browse") return endif @@ -159,64 +157,46 @@ fun! zip#Browse(zipfile) noremap :call ZipBrowseSelect() endif - let &report= repkeep -" call Dret("zip#Browse") endfun " --------------------------------------------------------------------- " ZipBrowseSelect: {{{2 fun! s:ZipBrowseSelect() - " call Dfunc("ZipBrowseSelect() zipfile<".((exists("b:zipfile"))? b:zipfile : "n/a")."> curfile<".expand("%").">") - let repkeep= &report - set report=10 + let dict = s:SetSaneOpts() + defer s:RestoreOpts(dict) let fname= getline(".") if !exists("b:zipfile") -" call Dret("ZipBrowseSelect : b:zipfile doesn't exist!") return endif " sanity check if fname =~ '^"' - let &report= repkeep -" call Dret("ZipBrowseSelect") return endif if fname =~ '/$' - redraw! - echohl Error | echo "***error*** (zip#Browse) Please specify a file, not a directory" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() - let &report= repkeep -" call Dret("ZipBrowseSelect") + call s:Mess('Error', "***error*** (zip#Browse) Please specify a file, not a directory") return endif -" call Decho("fname<".fname.">") - " get zipfile to the new-window let zipfile = b:zipfile let curfile = expand("%") -" call Decho("zipfile<".zipfile.">") -" call Decho("curfile<".curfile.">") noswapfile new if !exists("g:zip_nomax") || g:zip_nomax == 0 wincmd _ endif let s:zipfile_{winnr()}= curfile -" call Decho("exe e ".fnameescape("zipfile://".zipfile.'::'.fname)) exe "noswapfile e ".fnameescape("zipfile://".zipfile.'::'.fname) filetype detect - let &report= repkeep -" call Dret("ZipBrowseSelect : s:zipfile_".winnr()."<".s:zipfile_{winnr()}.">") endfun " --------------------------------------------------------------------- " zip#Read: {{{2 fun! zip#Read(fname,mode) -" call Dfunc("zip#Read(fname<".a:fname.">,mode=".a:mode.")") - let repkeep= &report - set report=10 + let dict = s:SetSaneOpts() + defer s:RestoreOpts(dict) if has("unix") let zipfile = substitute(a:fname,'zipfile://\(.\{-}\)::[^\\].*$','\1','') @@ -224,28 +204,20 @@ fun! zip#Read(fname,mode) else let zipfile = substitute(a:fname,'^.\{-}zipfile://\(.\{-}\)::[^\\].*$','\1','') let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','') - let fname = substitute(fname, '[', '[[]', 'g') endif -" call Decho("zipfile<".zipfile.">") -" call Decho("fname <".fname.">") + let fname = fname->substitute('[', '[[]', 'g')->escape('?*\\') " sanity check if !executable(substitute(g:zip_unzipcmd,'\s\+.*$','','')) - redraw! - echohl Error | echo "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() - let &report= repkeep -" call Dret("zip#Write") + call s:Mess('Error', "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program") return endif " the following code does much the same thing as - " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1) + " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1) " but allows zipfile://... entries in quickfix lists let temp = tempname() -" call Decho("using temp file<".temp.">") let fn = expand('%:p') - exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp -" call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp) + exe "sil !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1).' > '.temp sil exe 'keepalt file '.temp sil keepj e! sil exe 'keepalt file '.fnameescape(fn) @@ -254,62 +226,44 @@ fun! zip#Read(fname,mode) filetype detect " cleanup - " keepj 0d " used to be needed for the ...r! ... method set nomod - let &report= repkeep -" call Dret("zip#Read") endfun " --------------------------------------------------------------------- " zip#Write: {{{2 fun! zip#Write(fname) -" call Dfunc("zip#Write(fname<".a:fname.">) zipfile_".winnr()."<".s:zipfile_{winnr()}.">") - let repkeep= &report - set report=10 + let dict = s:SetSaneOpts() + defer s:RestoreOpts(dict) " sanity checks if !executable(substitute(g:zip_zipcmd,'\s\+.*$','','')) - redraw! - echohl Error | echo "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() - let &report= repkeep -" call Dret("zip#Write") + call s:Mess('Error', "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program") return endif if !exists("*mkdir") - redraw! - echohl Error | echo "***error*** (zip#Write) sorry, mkdir() doesn't work on your system" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() - let &report= repkeep -" call Dret("zip#Write") + call s:Mess('Error', "***error*** (zip#Write) sorry, mkdir() doesn't work on your system") return endif let curdir= getcwd() let tmpdir= tempname() -" call Decho("orig tempname<".tmpdir.">") if tmpdir =~ '\.' let tmpdir= substitute(tmpdir,'\.[^.]*$','','e') endif -" call Decho("tmpdir<".tmpdir.">") call mkdir(tmpdir,"p") " attempt to change to the indicated directory if s:ChgDir(tmpdir,s:ERROR,"(zip#Write) cannot cd to temporary directory") - let &report= repkeep -" call Dret("zip#Write") return endif -" call Decho("current directory now: ".getcwd()) " place temporary files under .../_ZIPVIM_/ if isdirectory("_ZIPVIM_") - call s:Rmdir("_ZIPVIM_") + call delete("_ZIPVIM_", "rf") endif call mkdir("_ZIPVIM_") cd _ZIPVIM_ -" call Decho("current directory now: ".getcwd()) if has("unix") let zipfile = substitute(a:fname,'zipfile://\(.\{-}\)::[^\\].*$','\1','') @@ -318,21 +272,17 @@ fun! zip#Write(fname) let zipfile = substitute(a:fname,'^.\{-}zipfile://\(.\{-}\)::[^\\].*$','\1','') let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','') endif -" call Decho("zipfile<".zipfile.">") -" call Decho("fname <".fname.">") if fname =~ '/' let dirpath = substitute(fname,'/[^/]\+$','','e') if has("win32unix") && executable("cygpath") let dirpath = substitute(system("cygpath ".s:Escape(dirpath,0)),'\n','','e') endif -" call Decho("mkdir(dirpath<".dirpath.">,p)") call mkdir(dirpath,"p") endif if zipfile !~ '/' let zipfile= curdir.'/'.zipfile endif -" call Decho("zipfile<".zipfile."> fname<".fname.">") exe "w! ".fnameescape(fname) if has("win32unix") && executable("cygpath") @@ -343,17 +293,13 @@ fun! zip#Write(fname) let fname = substitute(fname, '[', '[[]', 'g') endif -" call Decho(g:zip_zipcmd." -u ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0)) call system(g:zip_zipcmd." -u ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0)) if v:shell_error != 0 - redraw! - echohl Error | echo "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() + call s:Mess('Error', "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname) elseif s:zipfile_{winnr()} =~ '^\a\+://' " support writing zipfiles across a network let netzipfile= s:zipfile_{winnr()} -" call Decho("handle writing <".zipfile."> across network as <".netzipfile.">") 1split|enew let binkeep= &binary let eikeep = &ei @@ -365,64 +311,63 @@ fun! zip#Write(fname) q! unlet s:zipfile_{winnr()} endif - + " cleanup and restore current directory cd .. - call s:Rmdir("_ZIPVIM_") + call delete("_ZIPVIM_", "rf") call s:ChgDir(curdir,s:WARNING,"(zip#Write) unable to return to ".curdir."!") - call s:Rmdir(tmpdir) + call delete(tmpdir, "rf") setlocal nomod - let &report= repkeep -" call Dret("zip#Write") endfun " --------------------------------------------------------------------- " zip#Extract: extract a file from a zip archive {{{2 fun! zip#Extract() -" call Dfunc("zip#Extract()") - let repkeep= &report - set report=10 + let dict = s:SetSaneOpts() + defer s:RestoreOpts(dict) let fname= getline(".") -" call Decho("fname<".fname.">") " sanity check if fname =~ '^"' - let &report= repkeep -" call Dret("zip#Extract") return endif if fname =~ '/$' - redraw! - echohl Error | echo "***error*** (zip#Extract) Please specify a file, not a directory" | echohl None - let &report= repkeep -" call Dret("zip#Extract") + call s:Mess('Error', "***error*** (zip#Extract) Please specify a file, not a directory") + return + endif + if filereadable(fname) + call s:Mess('Error', "***error*** (zip#Extract) <" .. fname .."> already exists in directory, not overwriting!") return endif + let target = fname->substitute('\[', '[[]', 'g') + if &shell =~ 'cmd' && has("win32") + let target = target + \ ->substitute('[?*]', '[&]', 'g') + \ ->substitute('[\\]', '?', 'g') + \ ->shellescape() + " there cannot be a file name with '\' in its name, unzip replaces it by _ + let fname = fname->substitute('[\\?*]', '_', 'g') + else + let target = target->escape('*?\\')->shellescape() + endif " extract the file mentioned under the cursor -" call Decho("system(".g:zip_extractcmd." ".shellescape(b:zipfile)." ".shellescape(shell).")") - call system(g:zip_extractcmd." ".shellescape(b:zipfile)." ".shellescape(shell)) -" call Decho("zipfile<".b:zipfile.">") + call system($"{g:zip_extractcmd} -o {shellescape(b:zipfile)} {target}") if v:shell_error != 0 - echohl Error | echo "***error*** ".g:zip_extractcmd." ".b:zipfile." ".fname.": failed!" | echohl NONE + call s:Mess('Error', "***error*** ".g:zip_extractcmd." ".b:zipfile." ".fname.": failed!") elseif !filereadable(fname) - echohl Error | echo "***error*** attempted to extract ".fname." but it doesn't appear to be present!" + call s:Mess('Error', "***error*** attempted to extract ".fname." but it doesn't appear to be present!") else - echo "***note*** successfully extracted ".fname + echomsg "***note*** successfully extracted ".fname endif - " restore option - let &report= repkeep - -" call Dret("zip#Extract") endfun " --------------------------------------------------------------------- " s:Escape: {{{2 fun! s:Escape(fname,isfilt) -" call Dfunc("QuoteFileDir(fname<".a:fname."> isfilt=".a:isfilt.")") if exists("*shellescape") if a:isfilt let qnameq= shellescape(a:fname,1) @@ -432,45 +377,50 @@ fun! s:Escape(fname,isfilt) else let qnameq= g:zip_shq.escape(a:fname,g:zip_shq).g:zip_shq endif -" call Dret("QuoteFileDir <".qnameq.">") return qnameq endfun " --------------------------------------------------------------------- -" ChgDir: {{{2 +" s:ChgDir: {{{2 fun! s:ChgDir(newdir,errlvl,errmsg) -" call Dfunc("ChgDir(newdir<".a:newdir."> errlvl=".a:errlvl." errmsg<".a:errmsg.">)") - try exe "cd ".fnameescape(a:newdir) catch /^Vim\%((\a\+)\)\=:E344/ redraw! if a:errlvl == s:NOTE - echo "***note*** ".a:errmsg + echomsg "***note*** ".a:errmsg elseif a:errlvl == s:WARNING - echohl WarningMsg | echo "***warning*** ".a:errmsg | echohl NONE + call s:Mess("WarningMsg", "***warning*** ".a:errmsg) elseif a:errlvl == s:ERROR - echohl Error | echo "***error*** ".a:errmsg | echohl NONE + call s:Mess("Error", "***error*** ".a:errmsg) endif -" call inputsave()|call input("Press to continue")|call inputrestore() -" call Dret("ChgDir 1") return 1 endtry -" call Dret("ChgDir 0") return 0 endfun " --------------------------------------------------------------------- -" s:Rmdir: {{{2 -fun! s:Rmdir(fname) -" call Dfunc("Rmdir(fname<".a:fname.">)") - if (has("win32") || has("win95") || has("win64") || has("win16")) && &shell !~? 'sh$' - call system("rmdir /S/Q ".s:Escape(a:fname,0)) - else - call system("/bin/rm -rf ".s:Escape(a:fname,0)) +" s:SetSaneOpts: {{{2 +fun! s:SetSaneOpts() + let dict = {} + let dict.report = &report + let dict.shellslash = &shellslash + + let &report = 10 + if exists('+shellslash') + let &shellslash = 0 endif -" call Dret("Rmdir") + + return dict +endfun + +" --------------------------------------------------------------------- +" s:RestoreOpts: {{{2 +fun! s:RestoreOpts(dict) + for [key, val] in items(a:dict) + exe $"let &{key} = {val}" + endfor endfun " ------------------------------------------------------------------------ diff --git a/runtime/colors/README.txt b/runtime/colors/README.txt index bc6b8f09656775..7a13312ed25a88 100644 --- a/runtime/colors/README.txt +++ b/runtime/colors/README.txt @@ -84,9 +84,6 @@ The default color settings can be found in the source file If you think you have a color scheme that is good enough to be used by others, please check the following items: -- Source the $VIMRUNTIME/colors/tools/check_colors.vim script to check for - common mistakes. - - Does it work in a color terminal as well as in the GUI? Is it consistent? - Is "g:colors_name" set to a meaningful value? In case of doubt you can do diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim index d6931e4c71a7a6..7a17fc38b7a4a7 100644 --- a/runtime/colors/blue.vim +++ b/runtime/colors/blue.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Steven Vertigan " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Mon 08 Jan 2024 09:42:49 AM AEDT +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -27,9 +27,11 @@ hi Normal guifg=#ffd700 guibg=#000087 gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#005faf gui=NONE cterm=NONE hi Pmenu guifg=#ffffff guibg=#008787 gui=NONE cterm=NONE hi PmenuSel guifg=#008787 guibg=#ffffff gui=NONE cterm=NONE +hi PmenuMatch guifg=#ffd700 guibg=#008787 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff7f50 guibg=#ffffff gui=NONE cterm=NONE hi QuickFixLine guifg=#000000 guibg=#d787d7 gui=NONE cterm=NONE hi ColorColumn guifg=NONE guibg=#870087 gui=NONE cterm=NONE -hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi Conceal guifg=#008787 guibg=NONE gui=NONE cterm=NONE hi Cursor guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE hi CursorColumn guifg=NONE guibg=#005faf gui=NONE cterm=NONE hi CursorIM guifg=#000000 guibg=#ffd700 gui=NONE cterm=NONE @@ -80,6 +82,7 @@ hi Type guifg=#ffa500 guibg=NONE gui=bold cterm=NONE hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline hi Label guifg=#ffd700 guibg=NONE gui=NONE cterm=NONE hi! link Terminal Normal +hi! link PopupSelected PmenuSel hi! link Debug Special hi! link Added String hi! link Removed WarningMsg @@ -137,9 +140,11 @@ if s:t_Co >= 256 hi CursorLine ctermfg=NONE ctermbg=25 cterm=NONE hi Pmenu ctermfg=231 ctermbg=30 cterm=NONE hi PmenuSel ctermfg=30 ctermbg=231 cterm=NONE + hi PmenuMatch ctermfg=220 ctermbg=30 cterm=NONE + hi PmenuMatchSel ctermfg=209 ctermbg=231 cterm=NONE hi QuickFixLine ctermfg=16 ctermbg=176 cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=90 cterm=NONE - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=30 ctermbg=NONE cterm=NONE hi Cursor ctermfg=16 ctermbg=46 cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=25 cterm=NONE hi CursorIM ctermfg=16 ctermbg=220 cterm=NONE @@ -190,6 +195,7 @@ if s:t_Co >= 256 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Label ctermfg=220 ctermbg=NONE cterm=NONE hi! link Terminal Normal + hi! link PopupSelected PmenuSel hi! link Debug Special hi! link Added String hi! link Removed WarningMsg @@ -250,9 +256,11 @@ if s:t_Co >= 16 hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE hi PmenuSel ctermfg=black ctermbg=white cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=white cterm=bold hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=darkmagenta cterm=NONE - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=darkcyan ctermbg=NONE cterm=NONE hi Cursor ctermfg=black ctermbg=green cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=blue cterm=NONE hi CursorIM ctermfg=black ctermbg=yellow cterm=NONE @@ -303,6 +311,7 @@ if s:t_Co >= 16 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Label ctermfg=yellow ctermbg=NONE cterm=NONE hi! link Terminal Normal + hi! link PopupSelected PmenuSel hi! link Debug Special hi! link Added String hi! link Removed WarningMsg @@ -363,6 +372,8 @@ if s:t_Co >= 8 hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi Pmenu ctermfg=black ctermbg=cyan cterm=NONE hi PmenuSel ctermfg=black ctermbg=gray cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=cyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=gray cterm=bold hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=magenta cterm=NONE hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE @@ -415,6 +426,7 @@ if s:t_Co >= 8 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Label ctermfg=yellow ctermbg=NONE cterm=NONE hi! link Terminal Normal + hi! link PopupSelected PmenuSel hi! link Debug Special hi! link Added String hi! link Removed WarningMsg diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim index 471b8561fb9088..90dc304791eecc 100644 --- a/runtime/colors/darkblue.vim +++ b/runtime/colors/darkblue.vim @@ -4,7 +4,7 @@ " Maintainer: Original author Bohdan Vlasyuk " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Mon 08 Jan 2024 09:43:03 AM AEDT +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -24,6 +24,7 @@ if (has('termguicolors') && &termguicolors) || has('gui_running') endfor endif hi! link Terminal Normal +hi! link PopupSelected PmenuSel hi! link CursorColumn CursorLine hi! link CursorIM Cursor hi! link EndOfBuffer NonText @@ -73,7 +74,7 @@ hi! link CurSearch Search hi! link MessageWindow Pmenu hi! link PopupNotification Todo hi Normal guifg=#c0c0c0 guibg=#000040 gui=NONE cterm=NONE -hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi Conceal guifg=#008b8b guibg=NONE gui=NONE cterm=NONE hi ColorColumn guifg=#c0c0c0 guibg=#8b0000 gui=NONE cterm=NONE hi Cursor guifg=#000000 guibg=#ffff60 gui=NONE cterm=NONE hi QuickFixLine guifg=#000000 guibg=#ff80ff gui=NONE cterm=NONE @@ -90,6 +91,8 @@ hi Pmenu guifg=#ffffff guibg=#0030ff gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel guifg=#0030ff guibg=#ffffff gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE +hi PmenuMatch guifg=#ff80ff guibg=#0030ff gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff00ff guibg=#ffffff gui=NONE cterm=NONE hi Question guifg=#90f020 guibg=NONE gui=NONE cterm=NONE hi SignColumn guifg=#808080 guibg=NONE gui=NONE cterm=NONE hi SpecialKey guifg=#008b8b guibg=NONE gui=NONE cterm=NONE @@ -132,6 +135,7 @@ hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE if s:t_Co >= 256 hi! link Terminal Normal + hi! link PopupSelected PmenuSel hi! link CursorColumn CursorLine hi! link CursorIM Cursor hi! link EndOfBuffer NonText @@ -181,7 +185,7 @@ if s:t_Co >= 256 hi! link MessageWindow Pmenu hi! link PopupNotification Todo hi Normal ctermfg=252 ctermbg=17 cterm=NONE - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=30 ctermbg=NONE cterm=NONE hi ColorColumn ctermfg=252 ctermbg=88 cterm=NONE hi Cursor ctermfg=16 ctermbg=227 cterm=NONE hi QuickFixLine ctermfg=16 ctermbg=213 cterm=NONE @@ -198,6 +202,8 @@ if s:t_Co >= 256 hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=27 ctermbg=231 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE + hi PmenuMatch ctermfg=213 ctermbg=27 cterm=NONE + hi PmenuMatchSel ctermfg=201 ctermbg=231 cterm=NONE hi Question ctermfg=118 ctermbg=NONE cterm=NONE hi SignColumn ctermfg=102 ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=30 ctermbg=NONE cterm=NONE @@ -243,7 +249,7 @@ endif if s:t_Co >= 16 hi Normal ctermfg=grey ctermbg=black cterm=NONE - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=darkcyan ctermbg=NONE cterm=NONE hi ColorColumn ctermfg=grey ctermbg=darkred cterm=NONE hi Cursor ctermfg=black ctermbg=yellow cterm=NONE hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE @@ -260,6 +266,8 @@ if s:t_Co >= 16 hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=blue ctermbg=white cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE + hi PmenuMatch ctermfg=magenta ctermbg=blue cterm=NONE + hi PmenuMatchSel ctermfg=darkmagenta ctermbg=white cterm=NONE hi Question ctermfg=green ctermbg=NONE cterm=NONE hi SignColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE @@ -323,6 +331,8 @@ if s:t_Co >= 8 hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=blue ctermbg=grey cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE + hi PmenuMatch ctermfg=grey ctermbg=blue cterm=bold + hi PmenuMatchSel ctermfg=blue ctermbg=grey cterm=bold hi Question ctermfg=darkgreen ctermbg=NONE cterm=bold hi Search ctermfg=darkcyan ctermbg=blue cterm=NONE hi SignColumn ctermfg=grey ctermbg=NONE cterm=NONE diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim index 1919526760e134..d29980d6853a77 100644 --- a/runtime/colors/delek.vim +++ b/runtime/colors/delek.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer David Schweikert " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:34 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -24,6 +24,7 @@ if (has('termguicolors') && &termguicolors) || has('gui_running') endfor endif hi! link Terminal Normal +hi! link PopupSelected PmenuSel hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link CurSearch Search @@ -43,6 +44,8 @@ hi Pmenu guifg=#000000 guibg=#add8e6 gui=NONE cterm=NONE hi PmenuSel guifg=#ffffff guibg=#00008b gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#ffffff gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#008b8b gui=NONE cterm=NONE +hi PmenuMatch guifg=#cd00cd guibg=#add8e6 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff87ff guibg=#00008b gui=NONE cterm=NONE hi TabLine guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE hi TabLineFill guifg=NONE guibg=#bcbcbc gui=NONE cterm=NONE hi TabLineSel guifg=#000000 guibg=#ffffff gui=bold cterm=bold @@ -50,6 +53,7 @@ hi ToolbarLine guifg=NONE guibg=#e4e4e4 gui=NONE cterm=NONE hi ToolbarButton guifg=#ffffff guibg=#bcbcbc gui=bold cterm=bold hi NonText guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE hi SpecialKey guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE +hi Conceal guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE hi Folded guifg=#00008b guibg=#e4e4e4 gui=NONE cterm=NONE hi Visual guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE hi VisualNOS guifg=NONE guibg=#ee0000 gui=NONE cterm=NONE @@ -87,7 +91,6 @@ hi PreProc guifg=#cd00cd guibg=NONE gui=NONE cterm=NONE hi Type guifg=#0000ff guibg=NONE gui=bold cterm=bold hi Special guifg=#ff1493 guibg=NONE gui=NONE cterm=NONE hi Directory guifg=#008b8b guibg=NONE gui=bold cterm=bold -hi Conceal guifg=#ee0000 guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Title guifg=#cd00cd guibg=NONE gui=bold cterm=bold hi CursorLine guifg=NONE guibg=#e4e4e4 gui=NONE cterm=NONE @@ -98,6 +101,7 @@ hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE if s:t_Co >= 256 hi! link Terminal Normal + hi! link PopupSelected PmenuSel hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link CurSearch Search @@ -117,6 +121,8 @@ if s:t_Co >= 256 hi PmenuSel ctermfg=231 ctermbg=18 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=231 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=30 cterm=NONE + hi PmenuMatch ctermfg=164 ctermbg=152 cterm=NONE + hi PmenuMatchSel ctermfg=213 ctermbg=18 cterm=NONE hi TabLine ctermfg=16 ctermbg=254 cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=250 cterm=NONE hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold @@ -124,6 +130,7 @@ if s:t_Co >= 256 hi ToolbarButton ctermfg=231 ctermbg=250 cterm=bold hi NonText ctermfg=250 ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=250 ctermbg=NONE cterm=NONE + hi Conceal ctermfg=250 ctermbg=NONE cterm=NONE hi Folded ctermfg=18 ctermbg=254 cterm=NONE hi Visual ctermfg=16 ctermbg=252 cterm=NONE hi VisualNOS ctermfg=NONE ctermbg=196 cterm=NONE @@ -161,7 +168,6 @@ if s:t_Co >= 256 hi Type ctermfg=21 ctermbg=NONE cterm=bold hi Special ctermfg=198 ctermbg=NONE cterm=NONE hi Directory ctermfg=30 ctermbg=NONE cterm=bold - hi Conceal ctermfg=196 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=164 ctermbg=NONE cterm=bold hi CursorLine ctermfg=NONE ctermbg=254 cterm=NONE @@ -185,6 +191,8 @@ if s:t_Co >= 16 hi PmenuSel ctermfg=white ctermbg=darkblue cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=white cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkcyan cterm=NONE + hi PmenuMatch ctermfg=darkmagenta ctermbg=grey cterm=NONE + hi PmenuMatchSel ctermfg=magenta ctermbg=darkblue cterm=NONE hi TabLine ctermfg=black ctermbg=grey cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE hi TabLineSel ctermfg=black ctermbg=white cterm=bold @@ -192,6 +200,7 @@ if s:t_Co >= 16 hi ToolbarButton ctermfg=white ctermbg=darkgrey cterm=bold hi NonText ctermfg=darkgrey ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Folded ctermfg=darkblue ctermbg=grey cterm=NONE hi Visual ctermfg=black ctermbg=darkgrey cterm=NONE hi VisualNOS ctermfg=NONE ctermbg=darkred cterm=NONE @@ -229,7 +238,6 @@ if s:t_Co >= 16 hi Type ctermfg=blue ctermbg=NONE cterm=bold hi Special ctermfg=magenta ctermbg=NONE cterm=NONE hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold - hi Conceal ctermfg=darkred ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline @@ -254,6 +262,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkgreen cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLine ctermfg=gray ctermbg=black cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=black cterm=NONE hi TabLineSel ctermfg=black ctermbg=gray cterm=NONE @@ -261,6 +271,7 @@ if s:t_Co >= 8 hi ToolbarButton ctermfg=black ctermbg=gray cterm=bold,reverse hi NonText ctermfg=darkblue ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=darkblue ctermbg=NONE cterm=NONE + hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Folded ctermfg=darkyellow ctermbg=NONE cterm=NONE hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline @@ -296,7 +307,6 @@ if s:t_Co >= 8 hi Type ctermfg=darkblue ctermbg=NONE cterm=NONE hi Special ctermfg=darkmagenta ctermbg=NONE cterm=bold hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE @@ -403,6 +413,7 @@ endif " Color: darkmagenta #870087 18 darkmagenta " Color: darkcyan #008787 30 darkcyan " Color: gray #878787 102 gray +" Color: magenta #ff87ff 213 magenta " Term colors: bg0 statement constant preproc identifier type special bg1 " Term colors: comment statement constant preproc identifier type special fg0 " Color: bgDiffA #5F875F 65 darkgreen diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim index 453e966899aa61..b5f404a14e743d 100644 --- a/runtime/colors/desert.vim +++ b/runtime/colors/desert.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Hans Fugal " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:34 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -32,6 +32,7 @@ hi! link CursorLineSign CursorLine hi! link EndOfBuffer NonText hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi Normal guifg=#ffffff guibg=#333333 gui=NONE cterm=NONE hi StatusLine guifg=#333333 guibg=#c2bfa5 gui=NONE cterm=NONE hi StatusLineNC guifg=#7f7f8c guibg=#c2bfa5 gui=NONE cterm=NONE @@ -42,6 +43,8 @@ hi Pmenu guifg=#ffffff guibg=#666666 gui=NONE cterm=NONE hi PmenuSel guifg=#333333 guibg=#f0e68c gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#333333 gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#c2bfa5 gui=NONE cterm=NONE +hi PmenuMatch guifg=#ffa0a0 guibg=#666666 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#cd5c5c guibg=#f0e68c gui=NONE cterm=NONE hi TabLine guifg=#333333 guibg=#c2bfa5 gui=NONE cterm=NONE hi TabLineFill guifg=NONE guibg=#c2bfa5 gui=NONE cterm=NONE hi TabLineSel guifg=#333333 guibg=#f0e68c gui=NONE cterm=NONE @@ -106,6 +109,7 @@ if s:t_Co >= 256 hi! link EndOfBuffer NonText hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi Normal ctermfg=231 ctermbg=236 cterm=NONE hi StatusLine ctermfg=236 ctermbg=144 cterm=NONE hi StatusLineNC ctermfg=242 ctermbg=144 cterm=NONE @@ -116,6 +120,8 @@ if s:t_Co >= 256 hi PmenuSel ctermfg=236 ctermbg=186 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=236 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=144 cterm=NONE + hi PmenuMatch ctermfg=217 ctermbg=241 cterm=NONE + hi PmenuMatchSel ctermfg=167 ctermbg=186 cterm=NONE hi TabLine ctermfg=236 ctermbg=144 cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=144 cterm=NONE hi TabLineSel ctermfg=236 ctermbg=186 cterm=NONE @@ -182,6 +188,8 @@ if s:t_Co >= 16 hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE + hi PmenuMatch ctermfg=NONE ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold hi TabLine ctermfg=black ctermbg=grey cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=white cterm=NONE hi TabLineSel ctermfg=white ctermbg=black cterm=NONE @@ -248,6 +256,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLine ctermfg=black ctermbg=grey cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim index 001368861f5d4f..355e161a4646e4 100644 --- a/runtime/colors/elflord.vim +++ b/runtime/colors/elflord.vim @@ -3,7 +3,7 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:35 +" Last Change: 2024 Aug 15 " Generated by Colortemplate v2.2.3 @@ -77,6 +77,8 @@ hi Pmenu guifg=#ffffff guibg=#444444 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#bebebe gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE +hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=bold cterm=bold +hi PmenuMatchSel guifg=#ff00ff guibg=#00cdcd gui=bold cterm=bold hi Question guifg=#00ff00 guibg=NONE gui=bold cterm=bold hi Search guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE hi SignColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE @@ -145,6 +147,8 @@ if s:t_Co >= 256 hi PmenuSbar ctermfg=NONE ctermbg=250 cterm=NONE hi PmenuSel ctermfg=16 ctermbg=44 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE + hi PmenuMatch ctermfg=201 ctermbg=238 cterm=bold + hi PmenuMatchSel ctermfg=201 ctermbg=44 cterm=bold hi Question ctermfg=46 ctermbg=NONE cterm=bold hi Search ctermfg=16 ctermbg=226 cterm=NONE hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE @@ -216,6 +220,8 @@ if s:t_Co >= 16 hi PmenuSbar ctermfg=NONE ctermbg=grey cterm=NONE hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE + hi PmenuMatch ctermfg=magenta ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=magenta ctermbg=darkcyan cterm=bold hi Question ctermfg=green ctermbg=NONE cterm=bold hi Search ctermfg=black ctermbg=yellow cterm=NONE hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE @@ -286,6 +292,8 @@ if s:t_Co >= 8 hi PmenuSbar ctermfg=grey ctermbg=grey cterm=NONE hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkcyan cterm=NONE + hi PmenuMatch ctermfg=grey ctermbg=NONE cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold hi Question ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Search ctermfg=black ctermbg=darkyellow cterm=NONE hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim index 1abdd8006f0c4a..2f6859ad10da78 100644 --- a/runtime/colors/evening.vim +++ b/runtime/colors/evening.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Steven Vertigan " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Mon 08 Jan 2024 09:43:27 AM AEDT +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -24,6 +24,7 @@ if (has('termguicolors') && &termguicolors) || has('gui_running') endfor endif hi! link VertSplit StatusLineNC +hi! link PopupSelected PmenuSel hi! link StatusLineTerm StatusLine hi! link StatusLineTermNC StatusLineNC hi! link TabLineFill TabLine @@ -80,6 +81,8 @@ hi StatusLine guifg=#333333 guibg=#ffffff gui=bold cterm=bold hi StatusLineNC guifg=#333333 guibg=#d3d3d3 gui=NONE cterm=NONE hi TabLineSel guifg=#333333 guibg=#ffffff gui=bold cterm=bold hi TabLine guifg=#333333 guibg=#d3d3d3 gui=NONE cterm=NONE +hi PmenuMatch guifg=#ff80ff guibg=#4d4d4d gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#8b008b guibg=#bebebe gui=NONE cterm=NONE hi Pmenu guifg=#ffffff guibg=#4d4d4d gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#bebebe gui=NONE cterm=NONE @@ -89,7 +92,7 @@ hi Cursor guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE hi Error guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse hi ErrorMsg guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE hi LineNr guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE -hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE hi FoldColumn guifg=#add8e6 guibg=NONE gui=NONE cterm=NONE hi Folded guifg=#00008b guibg=#d3d3d3 gui=bold cterm=bold hi IncSearch guifg=#00ff00 guibg=NONE gui=reverse cterm=reverse @@ -132,6 +135,7 @@ hi DiffDelete guifg=#ffffff guibg=#af5faf gui=NONE cterm=NONE if s:t_Co >= 256 hi! link VertSplit StatusLineNC + hi! link PopupSelected PmenuSel hi! link StatusLineTerm StatusLine hi! link StatusLineTermNC StatusLineNC hi! link TabLineFill TabLine @@ -188,6 +192,8 @@ if s:t_Co >= 256 hi StatusLineNC ctermfg=236 ctermbg=252 cterm=NONE hi TabLineSel ctermfg=236 ctermbg=231 cterm=bold hi TabLine ctermfg=236 ctermbg=252 cterm=NONE + hi PmenuMatch ctermfg=201 ctermbg=239 cterm=NONE + hi PmenuMatchSel ctermfg=90 ctermbg=250 cterm=NONE hi Pmenu ctermfg=231 ctermbg=239 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=16 ctermbg=250 cterm=NONE @@ -197,7 +203,7 @@ if s:t_Co >= 256 hi Error ctermfg=196 ctermbg=231 cterm=reverse hi ErrorMsg ctermfg=231 ctermbg=196 cterm=NONE hi LineNr ctermfg=226 ctermbg=NONE cterm=NONE - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=241 ctermbg=NONE cterm=NONE hi FoldColumn ctermfg=153 ctermbg=NONE cterm=NONE hi Folded ctermfg=18 ctermbg=252 cterm=bold hi IncSearch ctermfg=46 ctermbg=NONE cterm=reverse @@ -243,6 +249,7 @@ endif if s:t_Co >= 16 hi! link VertSplit StatusLineNC + hi! link PopupSelected PmenuSel hi! link StatusLineTerm StatusLine hi! link StatusLineTermNC StatusLineNC hi! link TabLineFill TabLine @@ -299,6 +306,8 @@ if s:t_Co >= 16 hi StatusLineNC ctermfg=black ctermbg=gray cterm=NONE hi TabLineSel ctermfg=black ctermbg=white cterm=NONE hi TabLine ctermfg=black ctermbg=gray cterm=NONE + hi PmenuMatch ctermfg=white ctermbg=darkgray cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=gray cterm=bold hi Pmenu ctermfg=white ctermbg=darkgray cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=black ctermbg=gray cterm=NONE @@ -308,7 +317,7 @@ if s:t_Co >= 16 hi Error ctermfg=red ctermbg=white cterm=reverse hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=darkgray ctermbg=NONE cterm=NONE hi FoldColumn ctermfg=lightblue ctermbg=NONE cterm=NONE hi Folded ctermfg=darkblue ctermbg=gray cterm=bold hi IncSearch ctermfg=green ctermbg=NONE cterm=reverse @@ -366,6 +375,8 @@ if s:t_Co >= 8 hi PmenuSbar ctermfg=NONE ctermbg=gray cterm=NONE hi PmenuSel ctermfg=black ctermbg=gray cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=black cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=gray cterm=bold hi QuickFixLine ctermfg=gray ctermbg=darkmagenta cterm=NONE hi Error ctermfg=red ctermbg=gray cterm=reverse hi ErrorMsg ctermfg=gray ctermbg=red cterm=NONE diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim index 66f40ab56a7829..e4113d80bbf1dd 100644 --- a/runtime/colors/habamax.vim +++ b/runtime/colors/habamax.vim @@ -4,7 +4,7 @@ " Maintainer: Maxim Kim " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Mon 08 Jan 2024 09:39:53 AM AEDT +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -17,7 +17,7 @@ let g:colors_name = 'habamax' let s:t_Co = &t_Co if (has('termguicolors') && &termguicolors) || has('gui_running') - let g:terminal_ansi_colors = ['#1c1c1c', '#d75f5f', '#87af87', '#afaf87', '#5f87af', '#af87af', '#5f8787', '#9e9e9e', '#767676', '#d7875f', '#afd7af', '#d7d787', '#87afd7', '#d7afd7', '#87afaf', '#bcbcbc'] + let g:terminal_ansi_colors = ['#1c1c1c', '#af5f5f', '#5faf5f', '#af875f', '#5f87af', '#af87af', '#5f8787', '#9e9e9e', '#767676', '#d75f87', '#87d787', '#d7af87', '#5fafd7', '#d787d7', '#87afaf', '#bcbcbc'] " Nvim uses g:terminal_color_{0-15} instead for i in range(g:terminal_ansi_colors->len()) let g:terminal_color_{i} = g:terminal_ansi_colors[i] @@ -27,7 +27,7 @@ hi! link Terminal Normal hi! link StatuslineTerm Statusline hi! link StatuslineTermNC StatuslineNC hi! link MessageWindow Pmenu -hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi! link javaScriptFunction Statement hi! link javaScriptIdentifier Statement hi! link sqlKeyword Statement @@ -39,7 +39,6 @@ hi! link vimOper Normal hi! link vimSep Normal hi! link vimParenSep Normal hi! link vimCommentString Comment -hi! link gitCommitSummary Title hi! link markdownUrl String hi Normal guifg=#bcbcbc guibg=#1c1c1c gui=NONE cterm=NONE hi Statusline guifg=#1c1c1c guibg=#9e9e9e gui=NONE cterm=NONE @@ -47,11 +46,11 @@ hi StatuslineNC guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE hi VertSplit guifg=#767676 guibg=#767676 gui=NONE cterm=NONE hi TabLine guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE hi TabLineFill guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE -hi TabLineSel guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold +hi TabLineSel guifg=#1c1c1c guibg=#9e9e9e gui=bold cterm=bold hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE -hi ToolbarButton guifg=#9e9e9e guibg=#1c1c1c gui=bold,reverse cterm=bold,reverse +hi ToolbarButton guifg=#767676 guibg=#1c1c1c gui=bold,reverse cterm=bold,reverse hi QuickFixLine guifg=#1c1c1c guibg=#5f87af gui=NONE cterm=NONE -hi CursorLineNr guifg=#ffaf5f guibg=NONE gui=bold cterm=bold +hi CursorLineNr guifg=#dadada guibg=NONE gui=bold cterm=bold hi LineNr guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi LineNrAbove guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi LineNrBelow guifg=#585858 guibg=NONE gui=NONE cterm=NONE @@ -59,71 +58,72 @@ hi NonText guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi EndOfBuffer guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi SpecialKey guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi FoldColumn guifg=#585858 guibg=NONE gui=NONE cterm=NONE -hi Visual guifg=#1c1c1c guibg=#87afaf gui=NONE cterm=NONE +hi Visual guifg=#87afaf guibg=#1c1c1c gui=reverse cterm=reverse hi VisualNOS guifg=#1c1c1c guibg=#5f8787 gui=NONE cterm=NONE hi Pmenu guifg=NONE guibg=#3a3a3a gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#767676 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE -hi PmenuSel guifg=#1c1c1c guibg=#afaf87 gui=NONE cterm=NONE -hi PmenuKind guifg=#d7875f guibg=#3a3a3a gui=NONE cterm=NONE -hi PmenuKindSel guifg=#d75f5f guibg=#afaf87 gui=NONE cterm=NONE +hi PmenuSel guifg=NONE guibg=#585858 gui=NONE cterm=NONE +hi PmenuKind guifg=#5f8787 guibg=#3a3a3a gui=NONE cterm=NONE +hi PmenuKindSel guifg=#5f8787 guibg=#585858 gui=NONE cterm=NONE hi PmenuExtra guifg=#767676 guibg=#3a3a3a gui=NONE cterm=NONE -hi PmenuExtraSel guifg=#1c1c1c guibg=#afaf87 gui=NONE cterm=NONE +hi PmenuExtraSel guifg=#9e9e9e guibg=#585858 gui=NONE cterm=NONE +hi PmenuMatch guifg=#ffaf5f guibg=#3a3a3a gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ffaf5f guibg=#585858 gui=NONE cterm=NONE hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE -hi Error guifg=#d75f5f guibg=#1c1c1c gui=reverse cterm=reverse -hi ErrorMsg guifg=#d75f5f guibg=#1c1c1c gui=reverse cterm=reverse -hi ModeMsg guifg=#1c1c1c guibg=#d7d787 gui=NONE cterm=NONE -hi MoreMsg guifg=#87af87 guibg=NONE gui=NONE cterm=NONE -hi Question guifg=#afaf87 guibg=NONE gui=NONE cterm=NONE -hi WarningMsg guifg=#d7875f guibg=NONE gui=NONE cterm=NONE -hi Todo guifg=#d7d787 guibg=#1c1c1c gui=reverse cterm=reverse +hi Error guifg=#af5f5f guibg=#1c1c1c gui=reverse cterm=reverse +hi ErrorMsg guifg=#af5f5f guibg=#1c1c1c gui=reverse cterm=reverse +hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold +hi MoreMsg guifg=#5faf5f guibg=NONE gui=NONE cterm=NONE +hi Question guifg=#d7af87 guibg=NONE gui=NONE cterm=NONE +hi WarningMsg guifg=#d75f87 guibg=NONE gui=NONE cterm=NONE +hi Todo guifg=#dadada guibg=NONE gui=bold cterm=bold hi MatchParen guifg=#ff00af guibg=NONE gui=bold cterm=bold -hi Search guifg=#1c1c1c guibg=#87af87 gui=NONE cterm=NONE -hi IncSearch guifg=#1c1c1c guibg=#ffaf5f gui=NONE cterm=NONE -hi CurSearch guifg=#1c1c1c guibg=#afaf87 gui=NONE cterm=NONE -hi WildMenu guifg=#1c1c1c guibg=#d7d787 gui=NONE cterm=NONE +hi Search guifg=#5fafd7 guibg=#1c1c1c gui=reverse cterm=reverse +hi IncSearch guifg=#ffaf5f guibg=#1c1c1c gui=reverse cterm=reverse +hi CurSearch guifg=#ffaf5f guibg=#1c1c1c gui=reverse cterm=reverse +hi WildMenu guifg=#1c1c1c guibg=#d7af87 gui=bold cterm=bold hi debugPC guifg=#1c1c1c guibg=#5f87af gui=NONE cterm=NONE -hi debugBreakpoint guifg=#1c1c1c guibg=#d7875f gui=NONE cterm=NONE -hi Cursor guifg=#1c1c1c guibg=#ffaf5f gui=NONE cterm=NONE +hi debugBreakpoint guifg=#1c1c1c guibg=#d75f87 gui=NONE cterm=NONE +hi Cursor guifg=#000000 guibg=#dadada gui=NONE cterm=NONE hi lCursor guifg=#1c1c1c guibg=#5fff00 gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#303030 gui=NONE cterm=NONE hi CursorColumn guifg=NONE guibg=#303030 gui=NONE cterm=NONE hi Folded guifg=#9e9e9e guibg=#262626 gui=NONE cterm=NONE hi ColorColumn guifg=NONE guibg=#3a3a3a gui=NONE cterm=NONE hi SpellBad guifg=NONE guibg=NONE guisp=#d75f5f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline -hi SpellCap guifg=NONE guibg=NONE guisp=#5f87af gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline -hi SpellLocal guifg=NONE guibg=NONE guisp=#87af87 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline -hi SpellRare guifg=NONE guibg=NONE guisp=#d7afd7 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellCap guifg=NONE guibg=NONE guisp=#ffaf5f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellLocal guifg=NONE guibg=NONE guisp=#5fd75f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellRare guifg=NONE guibg=NONE guisp=#d787d7 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline hi Comment guifg=#767676 guibg=NONE gui=NONE cterm=NONE -hi Constant guifg=#d7875f guibg=NONE gui=NONE cterm=NONE -hi String guifg=#87af87 guibg=NONE gui=NONE cterm=NONE -hi Character guifg=#afd7af guibg=NONE gui=NONE cterm=NONE +hi Constant guifg=#d75f87 guibg=NONE gui=NONE cterm=NONE +hi String guifg=#5faf5f guibg=NONE gui=NONE cterm=NONE +hi Character guifg=#87d787 guibg=NONE gui=NONE cterm=NONE hi Identifier guifg=#87afaf guibg=NONE gui=NONE cterm=NONE hi Statement guifg=#af87af guibg=NONE gui=NONE cterm=NONE -hi PreProc guifg=#afaf87 guibg=NONE gui=NONE cterm=NONE -hi Type guifg=#87afd7 guibg=NONE gui=NONE cterm=NONE +hi PreProc guifg=#af875f guibg=NONE gui=NONE cterm=NONE +hi Type guifg=#5f87af guibg=NONE gui=NONE cterm=NONE hi Special guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline -hi Title guifg=#d7d787 guibg=NONE gui=bold cterm=bold +hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold hi Directory guifg=#87afaf guibg=NONE gui=bold cterm=bold -hi Conceal guifg=#767676 guibg=NONE gui=NONE cterm=NONE +hi Conceal guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Debug guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE -hi DiffAdd guifg=#dadada guibg=#5f875f gui=NONE cterm=NONE -hi DiffDelete guifg=#af875f guibg=NONE gui=NONE cterm=NONE -hi Added guifg=#87af87 guibg=NONE gui=NONE cterm=NONE -hi Changed guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE +hi DiffAdd guifg=#5faf5f guibg=NONE gui=reverse cterm=reverse +hi DiffChange guifg=#5f87af guibg=NONE gui=reverse cterm=reverse +hi DiffText guifg=#af87af guibg=NONE gui=reverse cterm=reverse +hi DiffDelete guifg=#af5f5f guibg=NONE gui=reverse cterm=reverse +hi Added guifg=#5fd75f guibg=NONE gui=NONE cterm=NONE +hi Changed guifg=#ffaf5f guibg=NONE gui=NONE cterm=NONE hi Removed guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE -hi diffSubname guifg=#af87af guibg=NONE gui=NONE cterm=NONE -hi DiffText guifg=#dadada guibg=#878787 gui=NONE cterm=NONE -hi DiffChange guifg=#bcbcbc guibg=#5f5f5f gui=NONE cterm=NONE if s:t_Co >= 256 hi! link Terminal Normal hi! link StatuslineTerm Statusline hi! link StatuslineTermNC StatuslineNC hi! link MessageWindow Pmenu - hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi! link javaScriptFunction Statement hi! link javaScriptIdentifier Statement hi! link sqlKeyword Statement @@ -135,7 +135,6 @@ if s:t_Co >= 256 hi! link vimSep Normal hi! link vimParenSep Normal hi! link vimCommentString Comment - hi! link gitCommitSummary Title hi! link markdownUrl String hi Normal ctermfg=250 ctermbg=234 cterm=NONE hi Statusline ctermfg=234 ctermbg=247 cterm=NONE @@ -143,11 +142,11 @@ if s:t_Co >= 256 hi VertSplit ctermfg=243 ctermbg=243 cterm=NONE hi TabLine ctermfg=234 ctermbg=243 cterm=NONE hi TabLineFill ctermfg=234 ctermbg=243 cterm=NONE - hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold + hi TabLineSel ctermfg=234 ctermbg=247 cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton ctermfg=247 ctermbg=234 cterm=bold,reverse + hi ToolbarButton ctermfg=243 ctermbg=234 cterm=bold,reverse hi QuickFixLine ctermfg=234 ctermbg=67 cterm=NONE - hi CursorLineNr ctermfg=215 ctermbg=NONE cterm=bold + hi CursorLineNr ctermfg=253 ctermbg=NONE cterm=bold hi LineNr ctermfg=240 ctermbg=NONE cterm=NONE hi LineNrAbove ctermfg=240 ctermbg=NONE cterm=NONE hi LineNrBelow ctermfg=240 ctermbg=NONE cterm=NONE @@ -155,62 +154,63 @@ if s:t_Co >= 256 hi EndOfBuffer ctermfg=240 ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=240 ctermbg=NONE cterm=NONE hi FoldColumn ctermfg=240 ctermbg=NONE cterm=NONE - hi Visual ctermfg=234 ctermbg=109 cterm=NONE + hi Visual ctermfg=109 ctermbg=234 cterm=reverse hi VisualNOS ctermfg=234 ctermbg=66 cterm=NONE hi Pmenu ctermfg=NONE ctermbg=237 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=243 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE - hi PmenuSel ctermfg=234 ctermbg=144 cterm=NONE - hi PmenuKind ctermfg=173 ctermbg=237 cterm=NONE - hi PmenuKindSel ctermfg=167 ctermbg=144 cterm=NONE + hi PmenuSel ctermfg=NONE ctermbg=240 cterm=NONE + hi PmenuKind ctermfg=66 ctermbg=237 cterm=NONE + hi PmenuKindSel ctermfg=66 ctermbg=240 cterm=NONE hi PmenuExtra ctermfg=243 ctermbg=237 cterm=NONE - hi PmenuExtraSel ctermfg=234 ctermbg=144 cterm=NONE + hi PmenuExtraSel ctermfg=247 ctermbg=240 cterm=NONE + hi PmenuMatch ctermfg=215 ctermbg=237 cterm=NONE + hi PmenuMatchSel ctermfg=215 ctermbg=240 cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE - hi Error ctermfg=167 ctermbg=234 cterm=reverse - hi ErrorMsg ctermfg=167 ctermbg=234 cterm=reverse - hi ModeMsg ctermfg=234 ctermbg=186 cterm=NONE - hi MoreMsg ctermfg=108 ctermbg=NONE cterm=NONE - hi Question ctermfg=144 ctermbg=NONE cterm=NONE - hi WarningMsg ctermfg=173 ctermbg=NONE cterm=NONE - hi Todo ctermfg=186 ctermbg=234 cterm=reverse + hi Error ctermfg=131 ctermbg=234 cterm=reverse + hi ErrorMsg ctermfg=131 ctermbg=234 cterm=reverse + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold + hi MoreMsg ctermfg=71 ctermbg=NONE cterm=NONE + hi Question ctermfg=180 ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=168 ctermbg=NONE cterm=NONE + hi Todo ctermfg=253 ctermbg=NONE cterm=bold hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold - hi Search ctermfg=234 ctermbg=108 cterm=NONE - hi IncSearch ctermfg=234 ctermbg=215 cterm=NONE - hi CurSearch ctermfg=234 ctermbg=144 cterm=NONE - hi WildMenu ctermfg=234 ctermbg=186 cterm=NONE + hi Search ctermfg=74 ctermbg=234 cterm=reverse + hi IncSearch ctermfg=215 ctermbg=234 cterm=reverse + hi CurSearch ctermfg=215 ctermbg=234 cterm=reverse + hi WildMenu ctermfg=234 ctermbg=180 cterm=bold hi debugPC ctermfg=234 ctermbg=67 cterm=NONE - hi debugBreakpoint ctermfg=234 ctermbg=173 cterm=NONE + hi debugBreakpoint ctermfg=234 ctermbg=168 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=236 cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=236 cterm=NONE hi Folded ctermfg=247 ctermbg=235 cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=237 cterm=NONE hi SpellBad ctermfg=167 ctermbg=NONE cterm=underline - hi SpellCap ctermfg=67 ctermbg=NONE cterm=underline - hi SpellLocal ctermfg=108 ctermbg=NONE cterm=underline - hi SpellRare ctermfg=182 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=215 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=77 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=176 ctermbg=NONE cterm=underline hi Comment ctermfg=243 ctermbg=NONE cterm=NONE - hi Constant ctermfg=173 ctermbg=NONE cterm=NONE - hi String ctermfg=108 ctermbg=NONE cterm=NONE - hi Character ctermfg=151 ctermbg=NONE cterm=NONE + hi Constant ctermfg=168 ctermbg=NONE cterm=NONE + hi String ctermfg=71 ctermbg=NONE cterm=NONE + hi Character ctermfg=114 ctermbg=NONE cterm=NONE hi Identifier ctermfg=109 ctermbg=NONE cterm=NONE hi Statement ctermfg=139 ctermbg=NONE cterm=NONE - hi PreProc ctermfg=144 ctermbg=NONE cterm=NONE - hi Type ctermfg=110 ctermbg=NONE cterm=NONE + hi PreProc ctermfg=137 ctermbg=NONE cterm=NONE + hi Type ctermfg=67 ctermbg=NONE cterm=NONE hi Special ctermfg=66 ctermbg=NONE cterm=NONE hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline - hi Title ctermfg=186 ctermbg=NONE cterm=bold + hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=109 ctermbg=NONE cterm=bold - hi Conceal ctermfg=243 ctermbg=NONE cterm=NONE + hi Conceal ctermfg=240 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Debug ctermfg=66 ctermbg=NONE cterm=NONE - hi DiffAdd ctermfg=253 ctermbg=65 cterm=NONE - hi DiffDelete ctermfg=137 ctermbg=NONE cterm=NONE - hi Added ctermfg=108 ctermbg=NONE cterm=NONE - hi Changed ctermfg=66 ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=71 ctermbg=NONE cterm=reverse + hi DiffChange ctermfg=67 ctermbg=NONE cterm=reverse + hi DiffText ctermfg=139 ctermbg=NONE cterm=reverse + hi DiffDelete ctermfg=131 ctermbg=NONE cterm=reverse + hi Added ctermfg=77 ctermbg=NONE cterm=NONE + hi Changed ctermfg=215 ctermbg=NONE cterm=NONE hi Removed ctermfg=167 ctermbg=NONE cterm=NONE - hi diffSubname ctermfg=139 ctermbg=NONE cterm=NONE - hi DiffText ctermfg=253 ctermbg=102 cterm=NONE - hi DiffChange ctermfg=250 ctermbg=59 cterm=NONE unlet s:t_Co finish endif @@ -222,11 +222,11 @@ if s:t_Co >= 16 hi VertSplit ctermfg=darkgray ctermbg=darkgray cterm=NONE hi TabLine ctermfg=black ctermbg=darkgray cterm=NONE hi TabLineFill ctermfg=black ctermbg=darkgray cterm=NONE - hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold + hi TabLineSel ctermfg=black ctermbg=gray cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton ctermfg=gray ctermbg=black cterm=bold,reverse - hi QuickFixLine ctermfg=black ctermbg=blue cterm=NONE - hi CursorLineNr ctermfg=red ctermbg=NONE cterm=bold + hi ToolbarButton ctermfg=darkgray ctermbg=black cterm=bold,reverse + hi QuickFixLine ctermfg=black ctermbg=darkblue cterm=NONE + hi CursorLineNr ctermfg=white ctermbg=NONE cterm=bold hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE hi LineNrAbove ctermfg=darkgrey ctermbg=NONE cterm=NONE hi LineNrBelow ctermfg=darkgrey ctermbg=NONE cterm=NONE @@ -234,7 +234,7 @@ if s:t_Co >= 16 hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=darkgrey ctermbg=NONE cterm=NONE hi FoldColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE - hi Visual ctermfg=black ctermbg=cyan cterm=NONE + hi Visual ctermfg=cyan ctermbg=black cterm=reverse hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE hi Pmenu ctermfg=black ctermbg=gray cterm=NONE hi PmenuThumb ctermfg=gray ctermbg=black cterm=NONE @@ -244,27 +244,29 @@ if s:t_Co >= 16 hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE hi PmenuExtra ctermfg=darkgray ctermbg=gray cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=gray cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=darkred ctermbg=black cterm=reverse hi ErrorMsg ctermfg=darkred ctermbg=black cterm=reverse - hi ModeMsg ctermfg=black ctermbg=yellow cterm=NONE + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi Question ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi Question ctermfg=yellow ctermbg=NONE cterm=NONE hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE - hi Todo ctermfg=yellow ctermbg=black cterm=reverse + hi Todo ctermfg=white ctermbg=NONE cterm=bold hi MatchParen ctermfg=magenta ctermbg=NONE cterm=bold - hi Search ctermfg=black ctermbg=darkgreen cterm=NONE - hi IncSearch ctermfg=black ctermbg=red cterm=NONE - hi CurSearch ctermfg=black ctermbg=darkyellow cterm=NONE - hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE - hi debugPC ctermfg=black ctermbg=blue cterm=NONE + hi Search ctermfg=blue ctermbg=black cterm=reverse + hi IncSearch ctermfg=red ctermbg=black cterm=reverse + hi CurSearch ctermfg=red ctermbg=black cterm=reverse + hi WildMenu ctermfg=black ctermbg=yellow cterm=bold + hi debugPC ctermfg=black ctermbg=darkblue cterm=NONE hi debugBreakpoint ctermfg=black ctermbg=red cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE hi Folded ctermfg=black ctermbg=darkyellow cterm=NONE hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE hi SpellBad ctermfg=darkred ctermbg=NONE cterm=underline - hi SpellCap ctermfg=blue ctermbg=NONE cterm=underline + hi SpellCap ctermfg=darkyellow ctermbg=NONE cterm=underline hi SpellLocal ctermfg=darkgreen ctermbg=NONE cterm=underline hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline hi Comment ctermfg=darkgray ctermbg=NONE cterm=NONE @@ -274,22 +276,21 @@ if s:t_Co >= 16 hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE hi Statement ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi PreProc ctermfg=darkyellow ctermbg=NONE cterm=NONE - hi Type ctermfg=blue ctermbg=NONE cterm=NONE + hi Type ctermfg=darkblue ctermbg=NONE cterm=NONE hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline - hi Title ctermfg=yellow ctermbg=NONE cterm=bold + hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=cyan ctermbg=NONE cterm=bold - hi Conceal ctermfg=darkgray ctermbg=NONE cterm=NONE + hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE - hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE - hi DiffDelete ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=darkgreen ctermbg=NONE cterm=reverse + hi DiffChange ctermfg=darkblue ctermbg=NONE cterm=reverse + hi DiffText ctermfg=darkmagenta ctermbg=NONE cterm=reverse + hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=reverse hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi Changed ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkyellow ctermbg=NONE cterm=NONE hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE - hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE - hi DiffText ctermfg=white ctermbg=lightgrey cterm=NONE - hi DiffChange ctermfg=white ctermbg=darkgray cterm=NONE unlet s:t_Co finish endif @@ -298,13 +299,13 @@ if s:t_Co >= 8 hi Normal ctermfg=gray ctermbg=black cterm=NONE hi Statusline ctermfg=gray ctermbg=black cterm=bold,reverse hi StatuslineNC ctermfg=gray ctermbg=black cterm=reverse - hi VertSplit ctermfg=gray ctermbg=black cterm=reverse + hi VertSplit ctermfg=gray ctermbg=gray cterm=NONE hi TabLine ctermfg=black ctermbg=gray cterm=NONE - hi TabLineFill ctermfg=black ctermbg=gray cterm=NONE - hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineFill ctermfg=gray ctermbg=gray cterm=NONE + hi TabLineSel ctermfg=black ctermbg=gray cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton ctermfg=gray ctermbg=black cterm=bold,reverse - hi QuickFixLine ctermfg=black ctermbg=blue cterm=NONE + hi ToolbarButton ctermfg=gray ctermbg=black cterm=reverse + hi QuickFixLine ctermfg=black ctermbg=darkblue cterm=NONE hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold hi LineNr ctermfg=gray ctermbg=NONE cterm=bold hi LineNrAbove ctermfg=gray ctermbg=NONE cterm=bold @@ -323,52 +324,53 @@ if s:t_Co >= 8 hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE hi PmenuExtra ctermfg=black ctermbg=gray cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=gray cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=darkred ctermbg=gray cterm=bold,reverse hi ErrorMsg ctermfg=darkred ctermbg=gray cterm=bold,reverse - hi ModeMsg ctermfg=black ctermbg=darkyellow cterm=NONE + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Question ctermfg=darkyellow ctermbg=NONE cterm=NONE hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE - hi Todo ctermfg=darkyellow ctermbg=black cterm=reverse + hi Todo ctermfg=gray ctermbg=NONE cterm=bold hi MatchParen ctermfg=magenta ctermbg=NONE cterm=bold - hi Search ctermfg=black ctermbg=darkgreen cterm=NONE + hi Search ctermfg=black ctermbg=darkblue cterm=NONE hi IncSearch ctermfg=black ctermbg=darkyellow cterm=NONE hi CurSearch ctermfg=black ctermbg=darkyellow cterm=NONE hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE - hi debugPC ctermfg=black ctermbg=blue cterm=NONE + hi debugPC ctermfg=black ctermbg=darkblue cterm=NONE hi debugBreakpoint ctermfg=black ctermbg=darkcyan cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE hi Folded ctermfg=black ctermbg=darkyellow cterm=NONE hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE hi SpellBad ctermfg=darkred ctermbg=gray cterm=reverse - hi SpellCap ctermfg=blue ctermbg=gray cterm=reverse + hi SpellCap ctermfg=darkblue ctermbg=gray cterm=reverse hi SpellLocal ctermfg=darkgreen ctermbg=black cterm=reverse hi SpellRare ctermfg=darkmagenta ctermbg=gray cterm=reverse hi Comment ctermfg=gray ctermbg=NONE cterm=bold - hi Constant ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Character ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Identifier ctermfg=gray ctermbg=NONE cterm=NONE hi Statement ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi PreProc ctermfg=darkyellow ctermbg=NONE cterm=NONE - hi Type ctermfg=blue ctermbg=NONE cterm=NONE + hi Type ctermfg=darkblue ctermbg=NONE cterm=NONE hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline - hi Title ctermfg=darkyellow ctermbg=NONE cterm=bold + hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold hi Conceal ctermfg=gray ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE - hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE - hi DiffDelete ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=darkgreen ctermbg=NONE cterm=reverse + hi DiffChange ctermfg=darkblue ctermbg=NONE cterm=reverse + hi DiffText ctermfg=darkmagenta ctermbg=NONE cterm=reverse + hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=reverse hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE - hi Changed ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkyellow ctermbg=NONE cterm=NONE hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE - hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE - hi DiffText ctermfg=white ctermbg=black cterm=bold,reverse - hi DiffChange ctermfg=black ctermbg=white cterm=NONE unlet s:t_Co finish endif @@ -442,36 +444,39 @@ if s:t_Co >= 0 endif " Background: dark -" Color: color00 #1C1C1C 234 black +" Color: color00 #1c1c1c 234 black " Color: color08 #767676 243 darkgray -" Color: color01 #D75F5F 167 darkred -" Color: color09 #D7875F 173 red -" Color: color02 #87AF87 108 darkgreen -" Color: color10 #AFD7AF 151 green -" Color: color03 #AFAF87 144 darkyellow -" Color: color11 #D7D787 186 yellow -" Color: color04 #5F87AF 67 blue -" Color: color12 #87AFD7 110 blue -" Color: color05 #AF87AF 139 darkmagenta -" Color: color13 #D7AFD7 182 magenta -" Color: color06 #5F8787 66 darkcyan -" Color: color14 #87AFAF 109 cyan -" Color: color07 #9E9E9E 247 gray -" Color: color15 #BCBCBC 250 white +" Color: color01 #af5f5f 131 darkred +" Color: color09 #d75f87 168 red +" Color: color02 #5faf5f 71 darkgreen +" Color: color10 #87d787 114 green +" Color: color03 #af875f 137 darkyellow +" Color: color11 #d7af87 180 yellow +" Color: color04 #5f87af 67 darkblue +" Color: color12 #5fafd7 74 blue +" Color: color05 #af87af 139 darkmagenta +" Color: color13 #d787d7 176 magenta +" Color: color06 #5f8787 66 darkcyan +" Color: color14 #87afaf 109 cyan +" Color: color07 #9e9e9e 247 gray +" Color: color15 #bcbcbc 250 white " Color: colorLine #303030 236 darkgrey " Color: colorB #3a3a3a 237 darkgrey " Color: colorF #262626 235 darkgrey " Color: colorNonT #585858 240 darkgrey -" Color: colorC #FFAF5F 215 red -" Color: colorlC #5FFF00 82 green -" Color: colorV #1F3F5F 109 cyan +" Color: colorC #ffaf5f 215 red +" Color: colorlC #5fff00 82 green +" Color: colorV #1f3f5f 109 cyan " Color: colorMP #ff00af 199 magenta -" Color: diffAdd #5f875f 65 darkgreen -" Color: diffDelete #af875f 137 darkyellow -" Color: diffChange #5f5f5f 59 darkgray -" Color: diffText #878787 102 lightgrey +" Color: diffAdd #5faf5f 71 darkgreen +" Color: diffDelete #af5f5f 131 darkred +" Color: diffChange #5f87af 67 darkblue +" Color: diffText #af87af 139 darkmagenta " Color: black #000000 16 black " Color: white #dadada 253 white +" Color: Added #5fd75f 77 darkgreen +" Color: Changed #ffaf5f 215 darkyellow +" Color: Removed #d75f5f 167 darkred " Term colors: color00 color01 color02 color03 color04 color05 color06 color07 " Term colors: color08 color09 color10 color11 color12 color13 color14 color15 " vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim index 449bf3b67647dd..edb86188a86e3e 100644 --- a/runtime/colors/industry.vim +++ b/runtime/colors/industry.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Shian Lee. " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:36 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -34,6 +34,8 @@ hi Pmenu guifg=#dadada guibg=#444444 gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#000000 gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#6c6c6c gui=NONE cterm=NONE +hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff00ff guibg=#ffff00 gui=NONE cterm=NONE hi TabLine guifg=#dadada guibg=#444444 gui=NONE cterm=NONE hi TabLineFill guifg=NONE guibg=#6c6c6c gui=NONE cterm=NONE hi TabLineSel guifg=#ffffff guibg=#000000 gui=bold cterm=bold @@ -84,6 +86,7 @@ hi Conceal guifg=#6c6c6c guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Title guifg=#ff00ff guibg=NONE gui=bold cterm=bold hi! link Terminal Normal +hi! link PopupSelected PmenuSel hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link CurSearch Search @@ -108,6 +111,8 @@ if s:t_Co >= 256 hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=16 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=242 cterm=NONE + hi PmenuMatch ctermfg=201 ctermbg=238 cterm=NONE + hi PmenuMatchSel ctermfg=201 ctermbg=226 cterm=NONE hi TabLine ctermfg=253 ctermbg=238 cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=242 cterm=NONE hi TabLineSel ctermfg=231 ctermbg=16 cterm=bold @@ -158,6 +163,7 @@ if s:t_Co >= 256 hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=201 ctermbg=NONE cterm=bold hi! link Terminal Normal + hi! link PopupSelected PmenuSel hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link CurSearch Search @@ -185,6 +191,8 @@ if s:t_Co >= 16 hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE + hi PmenuMatch ctermfg=white ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold hi TabLine ctermfg=white ctermbg=darkgrey cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE hi TabLineSel ctermfg=white ctermbg=black cterm=bold @@ -235,6 +243,7 @@ if s:t_Co >= 16 hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=magenta ctermbg=NONE cterm=bold hi! link Terminal Normal + hi! link PopupSelected PmenuSel hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link CurSearch Search @@ -262,6 +271,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLine ctermfg=black ctermbg=grey cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim index 8a63f91a94f9e0..953c6a67fa2a15 100644 --- a/runtime/colors/koehler.vim +++ b/runtime/colors/koehler.vim @@ -3,7 +3,7 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:36 +" Last Change: 2024 Aug 15 " Generated by Colortemplate v2.2.3 @@ -67,7 +67,7 @@ hi CursorLine guifg=NONE guibg=#555555 gui=NONE cterm=NONE hi CursorLineNr guifg=#ffff00 guibg=NONE gui=bold cterm=bold hi Folded guifg=#00cdcd guibg=#666666 gui=NONE cterm=NONE hi QuickFixLine guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE -hi Conceal guifg=#e5e5e5 guibg=#a9a9a9 gui=NONE cterm=NONE +hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE hi Cursor guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE hi Directory guifg=#cc8000 guibg=NONE gui=NONE cterm=NONE hi EndOfBuffer guifg=#cd0000 guibg=NONE gui=bold cterm=bold @@ -82,6 +82,8 @@ hi Pmenu guifg=#ffffff guibg=#444444 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE +hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff0000 guibg=#00cdcd gui=NONE cterm=NONE hi Question guifg=#5c5cff guibg=NONE gui=bold cterm=bold hi Search guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE hi SignColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE @@ -128,7 +130,7 @@ if s:t_Co >= 256 hi CursorLineNr ctermfg=226 ctermbg=NONE cterm=bold hi Folded ctermfg=44 ctermbg=59 cterm=NONE hi QuickFixLine ctermfg=16 ctermbg=226 cterm=NONE - hi Conceal ctermfg=254 ctermbg=145 cterm=NONE + hi Conceal ctermfg=59 ctermbg=NONE cterm=NONE hi Cursor ctermfg=16 ctermbg=46 cterm=NONE hi Directory ctermfg=172 ctermbg=NONE cterm=NONE hi EndOfBuffer ctermfg=160 ctermbg=NONE cterm=bold @@ -143,6 +145,8 @@ if s:t_Co >= 256 hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=16 ctermbg=44 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE + hi PmenuMatch ctermfg=201 ctermbg=238 cterm=NONE + hi PmenuMatchSel ctermfg=196 ctermbg=44 cterm=NONE hi Question ctermfg=63 ctermbg=NONE cterm=bold hi Search ctermfg=231 ctermbg=196 cterm=NONE hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE @@ -192,7 +196,7 @@ if s:t_Co >= 16 hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE hi QuickFixLine ctermfg=black ctermbg=yellow cterm=NONE - hi Conceal ctermfg=grey ctermbg=grey cterm=NONE + hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Cursor ctermfg=black ctermbg=green cterm=NONE hi Directory ctermfg=darkyellow ctermbg=NONE cterm=NONE hi EndOfBuffer ctermfg=darkred ctermbg=NONE cterm=bold @@ -207,6 +211,8 @@ if s:t_Co >= 16 hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE + hi PmenuMatch ctermfg=white ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold hi Question ctermfg=blue ctermbg=NONE cterm=bold hi Search ctermfg=white ctermbg=red cterm=NONE hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE @@ -270,6 +276,8 @@ if s:t_Co >= 8 hi PmenuSbar ctermfg=NONE ctermbg=grey cterm=NONE hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkcyan cterm=NONE + hi PmenuMatch ctermfg=grey ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold hi Question ctermfg=darkblue ctermbg=NONE cterm=bold hi Search ctermfg=grey ctermbg=darkred cterm=NONE hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE diff --git a/runtime/colors/lunaperche.vim b/runtime/colors/lunaperche.vim index 62538468dce7c8..464b7af00e1ff8 100644 --- a/runtime/colors/lunaperche.vim +++ b/runtime/colors/lunaperche.vim @@ -4,7 +4,7 @@ " Maintainer: Maxim Kim " Website: https://www.github.com/vim/colorschemes " License: Vim License (see `:help license`) -" Last Updated: Mon 08 Jan 2024 09:41:03 AM AEDT +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -93,6 +93,7 @@ hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link MessageWindow PMenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel if &background ==# 'dark' if (has('termguicolors') && &termguicolors) || has('gui_running') let g:terminal_ansi_colors = ['#000000', '#af5f5f', '#5faf5f', '#af875f', '#5f87af', '#d787d7', '#5fafaf', '#c6c6c6', '#767676', '#ff5f5f', '#5fd75f', '#ffd787', '#5fafff', '#ff87ff', '#5fd7d7', '#ffffff'] @@ -125,6 +126,8 @@ if &background ==# 'dark' hi PmenuKindSel guifg=#ff5f5f guibg=#4e4e4e gui=NONE cterm=NONE hi PmenuExtra guifg=#767676 guibg=#303030 gui=NONE cterm=NONE hi PmenuExtraSel guifg=#767676 guibg=#4e4e4e gui=NONE cterm=NONE + hi PmenuMatch guifg=#d787d7 guibg=#303030 gui=NONE cterm=NONE + hi PmenuMatchSel guifg=#d787d7 guibg=#4e4e4e gui=NONE cterm=NONE hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Error guifg=#ffffff guibg=#ff5f5f gui=NONE cterm=NONE hi ErrorMsg guifg=#ffffff guibg=#ff5f5f gui=NONE cterm=NONE @@ -163,7 +166,7 @@ if &background ==# 'dark' hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold hi Directory guifg=#5fafff guibg=NONE gui=bold cterm=bold - hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd guifg=#c6c6c6 guibg=#875f87 gui=NONE cterm=NONE hi DiffChange guifg=#c6c6c6 guibg=#5f5f5f gui=NONE cterm=NONE @@ -220,6 +223,8 @@ else hi PmenuKindSel guifg=#af0000 guibg=#c6c6c6 gui=NONE cterm=NONE hi PmenuExtra guifg=#767676 guibg=#e4e4e4 gui=NONE cterm=NONE hi PmenuExtraSel guifg=#767676 guibg=#c6c6c6 gui=NONE cterm=NONE + hi PmenuMatch guifg=#af00af guibg=#e4e4e4 gui=NONE cterm=NONE + hi PmenuMatchSel guifg=#af00af guibg=#c6c6c6 gui=NONE cterm=NONE hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Error guifg=#ffffff guibg=#d70000 gui=NONE cterm=NONE hi ErrorMsg guifg=#ffffff guibg=#d70000 gui=NONE cterm=NONE @@ -258,7 +263,7 @@ else hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold hi Directory guifg=#005fd7 guibg=NONE gui=bold cterm=bold - hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal guifg=#9e9e9e guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd guifg=#000000 guibg=#d7afd7 gui=NONE cterm=NONE hi DiffChange guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE @@ -365,6 +370,7 @@ if s:t_Co >= 256 hi! link LineNrBelow LineNr hi! link MessageWindow PMenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel if &background ==# 'dark' hi Normal ctermfg=251 ctermbg=16 cterm=NONE hi Statusline ctermfg=251 ctermbg=16 cterm=bold,reverse @@ -390,6 +396,8 @@ if s:t_Co >= 256 hi PmenuKindSel ctermfg=203 ctermbg=239 cterm=NONE hi PmenuExtra ctermfg=243 ctermbg=236 cterm=NONE hi PmenuExtraSel ctermfg=243 ctermbg=239 cterm=NONE + hi PmenuMatch ctermfg=176 ctermbg=236 cterm=NONE + hi PmenuMatchSel ctermfg=176 ctermbg=239 cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=231 ctermbg=203 cterm=NONE hi ErrorMsg ctermfg=231 ctermbg=203 cterm=NONE @@ -426,7 +434,7 @@ if s:t_Co >= 256 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=75 ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=240 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=251 ctermbg=96 cterm=NONE hi DiffChange ctermfg=251 ctermbg=59 cterm=NONE @@ -476,6 +484,8 @@ if s:t_Co >= 256 hi PmenuKindSel ctermfg=124 ctermbg=251 cterm=NONE hi PmenuExtra ctermfg=243 ctermbg=254 cterm=NONE hi PmenuExtraSel ctermfg=243 ctermbg=251 cterm=NONE + hi PmenuMatch ctermfg=127 ctermbg=254 cterm=NONE + hi PmenuMatchSel ctermfg=127 ctermbg=251 cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=231 ctermbg=160 cterm=NONE hi ErrorMsg ctermfg=231 ctermbg=160 cterm=NONE @@ -512,7 +522,7 @@ if s:t_Co >= 256 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=26 ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=247 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=16 ctermbg=182 cterm=NONE hi DiffChange ctermfg=16 ctermbg=252 cterm=NONE @@ -568,6 +578,8 @@ if s:t_Co >= 16 hi PmenuKindSel ctermfg=darkred ctermbg=darkcyan cterm=NONE hi PmenuExtra ctermfg=black ctermbg=grey cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkcyan cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=white ctermbg=red cterm=NONE hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE @@ -603,7 +615,7 @@ if s:t_Co >= 16 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=blue ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=white ctermbg=darkmagenta cterm=NONE hi DiffChange ctermfg=white ctermbg=darkgreen cterm=NONE @@ -689,7 +701,7 @@ if s:t_Co >= 16 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE @@ -745,6 +757,8 @@ if s:t_Co >= 8 hi PmenuKindSel ctermfg=darkred ctermbg=darkcyan cterm=NONE hi PmenuExtra ctermfg=black ctermbg=grey cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkcyan cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=grey ctermbg=darkred cterm=NONE hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim index 12f1efe9a6a239..463d009e88ad14 100644 --- a/runtime/colors/morning.vim +++ b/runtime/colors/morning.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Bram Moolenaar " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:37 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -33,6 +33,7 @@ hi! link StatuslineTerm Statusline hi! link StatuslineTermNC StatuslineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi Normal guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE hi EndOfBuffer guifg=#0000ff guibg=#cccccc gui=bold cterm=bold hi Folded guifg=#00008b guibg=#d3d3d3 gui=NONE cterm=NONE @@ -47,6 +48,8 @@ hi Pmenu guifg=#000000 guibg=#b2b2b2 gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#e4e4e4 gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#000000 gui=NONE cterm=NONE +hi PmenuMatch guifg=#a52a2a guibg=#b2b2b2 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#a52a2a guibg=#ffff00 gui=NONE cterm=NONE hi TabLine guifg=#000000 guibg=#bcbcbc gui=underline cterm=underline hi TabLineFill guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel guifg=#000000 guibg=#e4e4e4 gui=bold cterm=bold @@ -87,7 +90,7 @@ hi Type guifg=#2e8b57 guibg=NONE gui=bold cterm=bold hi Special guifg=#6a5acd guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Directory guifg=#008787 guibg=NONE gui=bold cterm=bold -hi Conceal guifg=#0000ff guibg=NONE gui=NONE cterm=NONE +hi Conceal guifg=#878787 guibg=NONE gui=NONE cterm=NONE hi Title guifg=#a52a2a guibg=NONE gui=bold cterm=bold hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE @@ -105,6 +108,7 @@ if s:t_Co >= 256 hi! link StatuslineTermNC StatuslineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi Normal ctermfg=16 ctermbg=254 cterm=NONE hi EndOfBuffer ctermfg=21 ctermbg=252 cterm=bold hi Folded ctermfg=18 ctermbg=252 cterm=NONE @@ -119,6 +123,8 @@ if s:t_Co >= 256 hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=254 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=16 cterm=NONE + hi PmenuMatch ctermfg=124 ctermbg=249 cterm=NONE + hi PmenuMatchSel ctermfg=124 ctermbg=226 cterm=NONE hi TabLine ctermfg=16 ctermbg=250 cterm=underline hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=16 ctermbg=254 cterm=bold @@ -159,7 +165,7 @@ if s:t_Co >= 256 hi Special ctermfg=62 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Directory ctermfg=30 ctermbg=NONE cterm=bold - hi Conceal ctermfg=21 ctermbg=NONE cterm=NONE + hi Conceal ctermfg=102 ctermbg=NONE cterm=NONE hi Title ctermfg=124 ctermbg=NONE cterm=bold hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE @@ -184,6 +190,8 @@ if s:t_Co >= 16 hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=grey cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=black cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=white cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold hi TabLine ctermfg=black ctermbg=white cterm=underline hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=black ctermbg=grey cterm=bold @@ -224,7 +232,7 @@ if s:t_Co >= 16 hi Special ctermfg=darkblue ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold - hi Conceal ctermfg=blue ctermbg=NONE cterm=NONE + hi Conceal ctermfg=gray ctermbg=NONE cterm=NONE hi Title ctermfg=darkred ctermbg=NONE cterm=bold hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE hi DiffChange ctermfg=white ctermbg=blue cterm=NONE @@ -249,6 +257,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkgreen cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLine ctermfg=gray ctermbg=black cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=black ctermbg=gray cterm=NONE diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim index c1612fbc0e9231..f00bdbd608d5f5 100644 --- a/runtime/colors/murphy.vim +++ b/runtime/colors/murphy.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Ron Aaron . " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Mon 08 Jan 2024 09:50:15 AM AEDT +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -33,6 +33,7 @@ hi! link StatusLineTerm StatusLine hi! link StatusLineTermNC StatusLineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi! link Added Constant hi Normal guifg=#87ff87 guibg=#000000 gui=NONE cterm=NONE hi EndOfBuffer guifg=#0000ff guibg=#000000 gui=NONE cterm=NONE @@ -43,6 +44,8 @@ hi Pmenu guifg=#ffffff guibg=#444444 gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#303030 gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#bcbcbc gui=NONE cterm=NONE +hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff00ff guibg=#ffff00 gui=NONE cterm=NONE hi TabLineFill guifg=NONE guibg=#303030 gui=NONE cterm=NONE hi TabLine guifg=#87ff87 guibg=#444444 gui=NONE cterm=NONE hi TabLineSel guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE @@ -106,6 +109,7 @@ if s:t_Co >= 256 hi! link StatusLineTermNC StatusLineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi! link Added Constant hi Normal ctermfg=120 ctermbg=16 cterm=NONE hi EndOfBuffer ctermfg=21 ctermbg=16 cterm=NONE @@ -116,6 +120,8 @@ if s:t_Co >= 256 hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=236 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=250 cterm=NONE + hi PmenuMatch ctermfg=201 ctermbg=238 cterm=NONE + hi PmenuMatchSel ctermfg=201 ctermbg=226 cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=236 cterm=NONE hi TabLine ctermfg=120 ctermbg=238 cterm=NONE hi TabLineSel ctermfg=231 ctermbg=16 cterm=NONE @@ -181,6 +187,8 @@ if s:t_Co >= 16 hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE + hi PmenuMatch ctermfg=white ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE hi TabLine ctermfg=green ctermbg=darkgrey cterm=NONE hi TabLineSel ctermfg=white ctermbg=black cterm=NONE @@ -246,6 +254,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE hi TabLine ctermfg=grey ctermbg=black cterm=reverse hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim index f53739bc6d72d5..202f505136e3c2 100644 --- a/runtime/colors/pablo.vim +++ b/runtime/colors/pablo.vim @@ -3,7 +3,7 @@ " Maintainer: Original maintainerRon Aaron " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:38 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -30,6 +30,7 @@ hi! link CursorLineFold CursorLine hi! link CursorLineSign CursorLine hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi Normal guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE hi Comment guifg=#808080 guibg=NONE gui=NONE cterm=NONE hi Constant guifg=#00ffff guibg=NONE gui=NONE cterm=NONE @@ -42,7 +43,7 @@ hi Underlined guifg=#80a0ff guibg=NONE gui=underline cterm=underline hi Ignore guifg=#000000 guibg=#000000 gui=NONE cterm=NONE hi Error guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE hi Todo guifg=#000000 guibg=#c0c000 gui=NONE cterm=NONE -hi Conceal guifg=#e5e5e5 guibg=#a9a9a9 gui=NONE cterm=NONE +hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE hi Cursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE hi lCursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE hi CursorIM guifg=NONE guibg=fg gui=NONE cterm=NONE @@ -85,6 +86,8 @@ hi TabLineFill guifg=NONE guibg=#000000 gui=reverse cterm=reverse hi TabLineSel guifg=#ffffff guibg=#000000 gui=bold cterm=bold hi ToolbarLine guifg=NONE guibg=#000000 gui=NONE cterm=NONE hi ToolbarButton guifg=#000000 guibg=#e5e5e5 gui=bold cterm=bold +hi PmenuMatch guifg=#ff00ff guibg=#303030 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff00ff guibg=#e5e5e5 gui=NONE cterm=NONE hi Pmenu guifg=fg guibg=#303030 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#e5e5e5 gui=NONE cterm=NONE @@ -103,6 +106,7 @@ if s:t_Co >= 256 hi! link CursorLineSign CursorLine hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi Normal ctermfg=231 ctermbg=16 cterm=NONE hi Comment ctermfg=244 ctermbg=NONE cterm=NONE hi Constant ctermfg=51 ctermbg=NONE cterm=NONE @@ -115,7 +119,7 @@ if s:t_Co >= 256 hi Ignore ctermfg=16 ctermbg=16 cterm=NONE hi Error ctermfg=231 ctermbg=196 cterm=NONE hi Todo ctermfg=16 ctermbg=142 cterm=NONE - hi Conceal ctermfg=254 ctermbg=248 cterm=NONE + hi Conceal ctermfg=241 ctermbg=NONE cterm=NONE hi Cursor ctermfg=16 ctermbg=231 cterm=NONE hi lCursor ctermfg=16 ctermbg=231 cterm=NONE hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE @@ -158,6 +162,8 @@ if s:t_Co >= 256 hi TabLineSel ctermfg=231 ctermbg=16 cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=16 cterm=NONE hi ToolbarButton ctermfg=16 ctermbg=254 cterm=bold + hi PmenuMatch ctermfg=201 ctermbg=236 cterm=NONE + hi PmenuMatchSel ctermfg=201 ctermbg=254 cterm=NONE hi Pmenu ctermfg=fg ctermbg=236 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=16 ctermbg=254 cterm=NONE @@ -183,7 +189,7 @@ if s:t_Co >= 16 hi Ignore ctermfg=black ctermbg=black cterm=NONE hi Error ctermfg=white ctermbg=red cterm=NONE hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE - hi Conceal ctermfg=grey ctermbg=grey cterm=NONE + hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Cursor ctermfg=black ctermbg=white cterm=NONE hi lCursor ctermfg=black ctermbg=white cterm=NONE hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE @@ -226,6 +232,8 @@ if s:t_Co >= 16 hi TabLineSel ctermfg=white ctermbg=black cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE hi ToolbarButton ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatch ctermfg=fg ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=grey cterm=bold hi Pmenu ctermfg=fg ctermbg=darkgrey cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=black ctermbg=grey cterm=NONE @@ -250,6 +258,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLine ctermfg=black ctermbg=grey cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim index f4c1e216972d3d..508346a7ced139 100644 --- a/runtime/colors/peachpuff.vim +++ b/runtime/colors/peachpuff.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer David Ne\v{c}as (Yeti) " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:39 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -31,6 +31,7 @@ hi! link CursorLineFold CursorLine hi! link CursorLineSign CursorLine hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi Normal guifg=#000000 guibg=#ffdab9 gui=NONE cterm=NONE hi Folded guifg=#000000 guibg=#e3c1a5 gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#f5c195 gui=NONE cterm=NONE @@ -44,9 +45,11 @@ hi StatusLineTerm guifg=#ffffff guibg=#2e8b57 gui=bold cterm=bold hi StatusLineTermNC guifg=#ffdab9 guibg=#008b8b gui=bold cterm=bold hi VertSplit guifg=#ffdab9 guibg=#737373 gui=NONE cterm=NONE hi Pmenu guifg=#000000 guibg=#ffaf87 gui=NONE cterm=NONE -hi PmenuSel guifg=#000000 guibg=#f5c195 gui=bold cterm=bold hi PmenuSbar guifg=NONE guibg=#ffdab9 gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#737373 gui=NONE cterm=NONE +hi PmenuSel guifg=#000000 guibg=#f5c195 gui=bold cterm=bold +hi PmenuMatch guifg=#a52a2a guibg=#ffaf87 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#a52a2a guibg=#f5c195 gui=bold cterm=bold hi TabLine guifg=#ffdab9 guibg=#737373 gui=underline cterm=underline hi TabLineFill guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel guifg=#000000 guibg=#ffdab9 gui=bold cterm=bold @@ -86,7 +89,7 @@ hi PreProc guifg=#cd00cd guibg=NONE gui=NONE cterm=NONE hi Type guifg=#2e8b57 guibg=NONE gui=bold cterm=bold hi Special guifg=#6a5acd guibg=NONE gui=NONE cterm=NONE hi Directory guifg=#008b8b guibg=NONE gui=bold cterm=bold -hi Conceal guifg=#406090 guibg=NONE gui=NONE cterm=NONE +hi Conceal guifg=#737373 guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Title guifg=#cd00cd guibg=NONE gui=bold cterm=bold hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE @@ -103,6 +106,7 @@ if s:t_Co >= 256 hi! link CursorLineSign CursorLine hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi Normal ctermfg=16 ctermbg=223 cterm=NONE hi Folded ctermfg=16 ctermbg=252 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=180 cterm=NONE @@ -116,9 +120,11 @@ if s:t_Co >= 256 hi StatusLineTermNC ctermfg=223 ctermbg=30 cterm=bold hi VertSplit ctermfg=223 ctermbg=243 cterm=NONE hi Pmenu ctermfg=16 ctermbg=216 cterm=NONE - hi PmenuSel ctermfg=16 ctermbg=180 cterm=bold hi PmenuSbar ctermfg=NONE ctermbg=223 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=243 cterm=NONE + hi PmenuSel ctermfg=16 ctermbg=180 cterm=bold + hi PmenuMatch ctermfg=124 ctermbg=216 cterm=NONE + hi PmenuMatchSel ctermfg=124 ctermbg=180 cterm=bold hi TabLine ctermfg=223 ctermbg=243 cterm=underline hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=16 ctermbg=223 cterm=bold @@ -158,7 +164,7 @@ if s:t_Co >= 256 hi Type ctermfg=29 ctermbg=NONE cterm=bold hi Special ctermfg=62 ctermbg=NONE cterm=NONE hi Directory ctermfg=30 ctermbg=NONE cterm=bold - hi Conceal ctermfg=25 ctermbg=NONE cterm=NONE + hi Conceal ctermfg=243 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=164 ctermbg=NONE cterm=bold hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE @@ -183,9 +189,11 @@ if s:t_Co >= 16 hi StatusLineTermNC ctermfg=white ctermbg=darkcyan cterm=bold hi VertSplit ctermfg=white ctermbg=darkgrey cterm=NONE hi Pmenu ctermfg=black ctermbg=grey cterm=NONE - hi PmenuSel ctermfg=black ctermbg=yellow cterm=bold hi PmenuSbar ctermfg=NONE ctermbg=white cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkgrey cterm=NONE + hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold hi TabLine ctermfg=white ctermbg=darkgrey cterm=underline hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=black ctermbg=white cterm=bold @@ -253,6 +261,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkgreen cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLine ctermfg=gray ctermbg=black cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=black ctermbg=white cterm=NONE diff --git a/runtime/colors/quiet.vim b/runtime/colors/quiet.vim index d7f8582888656d..38349d76e80224 100644 --- a/runtime/colors/quiet.vim +++ b/runtime/colors/quiet.vim @@ -4,7 +4,7 @@ " Maintainer: Maxence Weynans " Website: https://github.com/vim/colorschemes " License: Vim License (see `:help license`)` -" Last Updated: Fri 15 Dec 2023 20:05:39 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -14,11 +14,15 @@ let g:colors_name = 'quiet' let s:t_Co = &t_Co +hi! link Added Normal +hi! link Changed Normal +hi! link Removed Normal hi! link Terminal Normal hi! link StatusLineTerm StatusLine hi! link StatusLineTermNC StatusLineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement @@ -79,10 +83,12 @@ if &background ==# 'dark' hi MoreMsg guifg=#dadada guibg=NONE gui=NONE cterm=NONE hi NonText guifg=#707070 guibg=NONE gui=NONE cterm=NONE hi Pmenu guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE + hi PmenuMatch guifg=#d7005f guibg=#a8a8a8 gui=NONE cterm=NONE hi PmenuExtra guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE hi PmenuKind guifg=#000000 guibg=#a8a8a8 gui=bold cterm=bold hi PmenuSbar guifg=#707070 guibg=#585858 gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#dadada gui=NONE cterm=NONE + hi PmenuMatchSel guifg=#d7005f guibg=#dadada gui=bold cterm=bold hi PmenuExtraSel guifg=#000000 guibg=#dadada gui=NONE cterm=NONE hi PmenuKindSel guifg=#000000 guibg=#dadada gui=bold cterm=bold hi PmenuThumb guifg=#dadada guibg=#dadada gui=NONE cterm=NONE @@ -153,10 +159,12 @@ else hi MoreMsg guifg=#000000 guibg=NONE gui=NONE cterm=NONE hi NonText guifg=#626262 guibg=NONE gui=NONE cterm=NONE hi Pmenu guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE + hi PmenuMatch guifg=#d70000 guibg=#a8a8a8 gui=NONE cterm=NONE hi PmenuExtra guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE hi PmenuKind guifg=#000000 guibg=#a8a8a8 gui=bold cterm=bold hi PmenuSbar guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE hi PmenuSel guifg=#d7d7d7 guibg=#000000 gui=NONE cterm=NONE + hi PmenuMatchSel guifg=#d70000 guibg=#000000 gui=bold cterm=bold hi PmenuExtraSel guifg=#d7d7d7 guibg=#000000 gui=NONE cterm=NONE hi PmenuKindSel guifg=#d7d7d7 guibg=#000000 gui=bold cterm=bold hi PmenuThumb guifg=#000000 guibg=#000000 gui=NONE cterm=NONE @@ -222,10 +230,12 @@ if s:t_Co >= 256 hi MoreMsg ctermfg=253 ctermbg=NONE cterm=NONE hi NonText ctermfg=242 ctermbg=NONE cterm=NONE hi Pmenu ctermfg=16 ctermbg=248 cterm=NONE + hi PmenuMatch ctermfg=161 ctermbg=248 cterm=NONE hi PmenuExtra ctermfg=16 ctermbg=248 cterm=NONE hi PmenuKind ctermfg=16 ctermbg=248 cterm=bold hi PmenuSbar ctermfg=242 ctermbg=240 cterm=NONE hi PmenuSel ctermfg=16 ctermbg=253 cterm=NONE + hi PmenuMatchSel ctermfg=161 ctermbg=253 cterm=bold hi PmenuExtraSel ctermfg=16 ctermbg=253 cterm=NONE hi PmenuKindSel ctermfg=16 ctermbg=253 cterm=bold hi PmenuThumb ctermfg=253 ctermbg=253 cterm=NONE @@ -289,10 +299,12 @@ if s:t_Co >= 256 hi MoreMsg ctermfg=16 ctermbg=NONE cterm=NONE hi NonText ctermfg=241 ctermbg=NONE cterm=NONE hi Pmenu ctermfg=16 ctermbg=248 cterm=NONE + hi PmenuMatch ctermfg=160 ctermbg=248 cterm=NONE hi PmenuExtra ctermfg=16 ctermbg=248 cterm=NONE hi PmenuKind ctermfg=16 ctermbg=248 cterm=bold hi PmenuSbar ctermfg=16 ctermbg=254 cterm=NONE hi PmenuSel ctermfg=188 ctermbg=16 cterm=NONE + hi PmenuMatchSel ctermfg=160 ctermbg=16 cterm=bold hi PmenuExtraSel ctermfg=188 ctermbg=16 cterm=NONE hi PmenuKindSel ctermfg=188 ctermbg=16 cterm=bold hi PmenuThumb ctermfg=16 ctermbg=16 cterm=NONE @@ -368,9 +380,11 @@ if s:t_Co >= 16 hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE @@ -434,9 +448,11 @@ if s:t_Co >= 16 hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE @@ -507,9 +523,11 @@ if s:t_Co >= 8 hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE @@ -573,9 +591,11 @@ if s:t_Co >= 8 hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE diff --git a/runtime/colors/retrobox.vim b/runtime/colors/retrobox.vim index b4a194d8852504..f34fc99dc5bf32 100644 --- a/runtime/colors/retrobox.vim +++ b/runtime/colors/retrobox.vim @@ -4,7 +4,7 @@ " Maintainer: Maxim Kim , ported from gruvbox8 of Lifepillar " Website: https://www.github.com/vim/colorschemes " License: Vim License (see `:help license`) -" Last Updated: Fri 15 Dec 2023 20:05:40 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -22,7 +22,9 @@ hi! link Tag Special hi! link lCursor Cursor hi! link MessageWindow PMenu hi! link PopupNotification Todo -hi! link CurSearch Search +hi! link PopupSelected PmenuSel +hi! link CurSearch IncSearch +hi! link Terminal Normal if &background ==# 'dark' if (has('termguicolors') && &termguicolors) || has('gui_running') @@ -33,7 +35,7 @@ if &background ==# 'dark' endfor endif hi Normal guifg=#ebdbb2 guibg=#1c1c1c gui=NONE cterm=NONE - hi CursorLineNr guifg=#fabd2f guibg=#303030 gui=NONE cterm=NONE + hi CursorLineNr guifg=#fabd2f guibg=#1c1c1c gui=bold cterm=bold hi FoldColumn guifg=#928374 guibg=#1c1c1c gui=NONE cterm=NONE hi SignColumn guifg=#928374 guibg=#1c1c1c gui=NONE cterm=NONE hi VertSplit guifg=#303030 guibg=#1c1c1c gui=NONE cterm=NONE @@ -54,6 +56,8 @@ if &background ==# 'dark' hi PmenuKindSel guifg=#fb4934 guibg=#83a598 gui=NONE cterm=NONE hi PmenuExtra guifg=#a89984 guibg=#3c3836 gui=NONE cterm=NONE hi PmenuExtraSel guifg=#303030 guibg=#83a598 gui=NONE cterm=NONE + hi PmenuMatch guifg=#b16286 guibg=#3c3836 gui=NONE cterm=NONE + hi PmenuMatchSel guifg=#b16286 guibg=#83a598 gui=bold cterm=bold hi SpecialKey guifg=#928374 guibg=NONE gui=NONE cterm=NONE hi StatusLine guifg=#504945 guibg=#ebdbb2 gui=bold,reverse cterm=bold,reverse hi StatusLineNC guifg=#3c3836 guibg=#a89984 gui=reverse cterm=reverse @@ -65,7 +69,7 @@ if &background ==# 'dark' hi Visual guifg=#1c1c1c guibg=#83a598 gui=NONE cterm=NONE hi WildMenu guifg=#83a598 guibg=#504945 gui=bold cterm=bold hi EndOfBuffer guifg=#504945 guibg=NONE gui=NONE cterm=NONE - hi Conceal guifg=#83a598 guibg=NONE gui=NONE cterm=NONE + hi Conceal guifg=#504945 guibg=NONE gui=NONE cterm=NONE hi Cursor guifg=#1c1c1c guibg=#fbf1c7 gui=NONE cterm=NONE hi DiffAdd guifg=#b8bb26 guibg=#1c1c1c gui=reverse cterm=reverse hi DiffChange guifg=#8ec07c guibg=#1c1c1c gui=reverse cterm=reverse @@ -128,7 +132,7 @@ else endfor endif hi Normal guifg=#3c3836 guibg=#fbf1c7 gui=NONE cterm=NONE - hi CursorLineNr guifg=#b57614 guibg=#e5d4b1 gui=NONE cterm=NONE + hi CursorLineNr guifg=#b57614 guibg=#fbf1c7 gui=bold cterm=bold hi FoldColumn guifg=#928374 guibg=#fbf1c7 gui=NONE cterm=NONE hi SignColumn guifg=#3c3836 guibg=#fbf1c7 gui=NONE cterm=NONE hi VertSplit guifg=#bdae93 guibg=#fbf1c7 gui=NONE cterm=NONE @@ -149,6 +153,8 @@ else hi PmenuKindSel guifg=#9d0006 guibg=#076678 gui=NONE cterm=NONE hi PmenuExtra guifg=#7c6f64 guibg=#e5d4b1 gui=NONE cterm=NONE hi PmenuExtraSel guifg=#bdae93 guibg=#076678 gui=NONE cterm=NONE + hi PmenuMatch guifg=#8f3f71 guibg=#e5d4b1 gui=NONE cterm=NONE + hi PmenuMatchSel guifg=#d3869b guibg=#076678 gui=bold cterm=bold hi SpecialKey guifg=#928374 guibg=NONE gui=NONE cterm=NONE hi StatusLine guifg=#bdae93 guibg=#3c3836 gui=bold,reverse cterm=bold,reverse hi StatusLineNC guifg=#ebdbb2 guibg=#3c3836 gui=reverse cterm=reverse @@ -160,7 +166,7 @@ else hi Visual guifg=#fbf1c7 guibg=#076678 gui=NONE cterm=NONE hi WildMenu guifg=#076678 guibg=#e5d4b1 gui=bold cterm=bold hi EndOfBuffer guifg=#e5d4b1 guibg=NONE gui=NONE cterm=NONE - hi Conceal guifg=#076678 guibg=NONE gui=NONE cterm=NONE + hi Conceal guifg=#a89984 guibg=NONE gui=NONE cterm=NONE hi Cursor guifg=#fbf1c7 guibg=#282828 gui=NONE cterm=NONE hi DiffAdd guifg=#79740e guibg=#fbf1c7 gui=reverse cterm=reverse hi DiffChange guifg=#427b58 guibg=#fbf1c7 gui=reverse cterm=reverse @@ -218,7 +224,7 @@ endif if s:t_Co >= 256 if &background ==# 'dark' hi Normal ctermfg=187 ctermbg=234 cterm=NONE - hi CursorLineNr ctermfg=214 ctermbg=236 cterm=NONE + hi CursorLineNr ctermfg=214 ctermbg=234 cterm=bold hi FoldColumn ctermfg=102 ctermbg=234 cterm=NONE hi SignColumn ctermfg=102 ctermbg=234 cterm=NONE hi VertSplit ctermfg=236 ctermbg=234 cterm=NONE @@ -239,6 +245,8 @@ if s:t_Co >= 256 hi PmenuKindSel ctermfg=203 ctermbg=109 cterm=NONE hi PmenuExtra ctermfg=102 ctermbg=237 cterm=NONE hi PmenuExtraSel ctermfg=236 ctermbg=109 cterm=NONE + hi PmenuMatch ctermfg=132 ctermbg=237 cterm=NONE + hi PmenuMatchSel ctermfg=132 ctermbg=109 cterm=bold hi SpecialKey ctermfg=102 ctermbg=NONE cterm=NONE hi StatusLine ctermfg=239 ctermbg=187 cterm=bold,reverse hi StatusLineNC ctermfg=237 ctermbg=102 cterm=reverse @@ -250,7 +258,7 @@ if s:t_Co >= 256 hi Visual ctermfg=234 ctermbg=109 cterm=NONE hi WildMenu ctermfg=109 ctermbg=239 cterm=bold hi EndOfBuffer ctermfg=239 ctermbg=NONE cterm=NONE - hi Conceal ctermfg=109 ctermbg=NONE cterm=NONE + hi Conceal ctermfg=239 ctermbg=NONE cterm=NONE hi Cursor ctermfg=234 ctermbg=230 cterm=NONE hi DiffAdd ctermfg=142 ctermbg=234 cterm=reverse hi DiffChange ctermfg=107 ctermbg=234 cterm=reverse @@ -306,7 +314,7 @@ if s:t_Co >= 256 else " Light background hi Normal ctermfg=237 ctermbg=230 cterm=NONE - hi CursorLineNr ctermfg=172 ctermbg=188 cterm=NONE + hi CursorLineNr ctermfg=172 ctermbg=230 cterm=bold hi FoldColumn ctermfg=102 ctermbg=230 cterm=NONE hi SignColumn ctermfg=237 ctermbg=230 cterm=NONE hi VertSplit ctermfg=144 ctermbg=230 cterm=NONE @@ -327,6 +335,8 @@ if s:t_Co >= 256 hi PmenuKindSel ctermfg=124 ctermbg=23 cterm=NONE hi PmenuExtra ctermfg=243 ctermbg=188 cterm=NONE hi PmenuExtraSel ctermfg=144 ctermbg=23 cterm=NONE + hi PmenuMatch ctermfg=126 ctermbg=188 cterm=NONE + hi PmenuMatchSel ctermfg=175 ctermbg=23 cterm=bold hi SpecialKey ctermfg=102 ctermbg=NONE cterm=NONE hi StatusLine ctermfg=144 ctermbg=237 cterm=bold,reverse hi StatusLineNC ctermfg=187 ctermbg=237 cterm=reverse @@ -338,7 +348,7 @@ if s:t_Co >= 256 hi Visual ctermfg=230 ctermbg=23 cterm=NONE hi WildMenu ctermfg=23 ctermbg=188 cterm=bold hi EndOfBuffer ctermfg=188 ctermbg=NONE cterm=NONE - hi Conceal ctermfg=23 ctermbg=NONE cterm=NONE + hi Conceal ctermfg=137 ctermbg=NONE cterm=NONE hi Cursor ctermfg=230 ctermbg=235 cterm=NONE hi DiffAdd ctermfg=64 ctermbg=230 cterm=reverse hi DiffChange ctermfg=29 ctermbg=230 cterm=reverse @@ -418,6 +428,8 @@ if s:t_Co >= 16 hi PmenuKindSel ctermfg=DarkRed ctermbg=Blue cterm=NONE hi PmenuExtra ctermfg=gray ctermbg=DarkGray cterm=NONE hi PmenuExtraSel ctermfg=Black ctermbg=Blue cterm=NONE + hi PmenuMatch ctermfg=White ctermbg=DarkGray cterm=bold + hi PmenuMatchSel ctermfg=Black ctermbg=Blue cterm=bold hi SignColumn ctermfg=DarkGray ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=DarkGray ctermbg=NONE cterm=NONE hi StatusLine ctermfg=gray ctermbg=Black cterm=bold,reverse @@ -431,7 +443,7 @@ if s:t_Co >= 16 hi Visual ctermfg=Black ctermbg=Blue cterm=NONE hi WildMenu ctermfg=White ctermbg=Black cterm=bold hi EndOfBuffer ctermfg=DarkGray ctermbg=NONE cterm=NONE - hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE + hi Conceal ctermfg=DarkGray ctermbg=NONE cterm=NONE hi Cursor ctermfg=Black ctermbg=White cterm=NONE hi DiffAdd ctermfg=Green ctermbg=Black cterm=reverse hi DiffChange ctermfg=Cyan ctermbg=Black cterm=reverse @@ -506,6 +518,8 @@ if s:t_Co >= 16 hi PmenuKindSel ctermfg=DarkRed ctermbg=Blue cterm=NONE hi PmenuExtra ctermfg=DarkGray ctermbg=Grey cterm=NONE hi PmenuExtraSel ctermfg=White ctermbg=Blue cterm=NONE + hi PmenuMatch ctermfg=Black ctermbg=Grey cterm=bold + hi PmenuMatchSel ctermfg=White ctermbg=Blue cterm=bold hi SignColumn ctermfg=Grey ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=Grey ctermbg=NONE cterm=NONE hi StatusLine ctermfg=DarkGray ctermbg=White cterm=bold,reverse @@ -519,7 +533,7 @@ if s:t_Co >= 16 hi Visual ctermfg=White ctermbg=Blue cterm=NONE hi WildMenu ctermfg=Black ctermbg=White cterm=bold hi EndOfBuffer ctermfg=Grey ctermbg=NONE cterm=NONE - hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE + hi Conceal ctermfg=Grey ctermbg=NONE cterm=NONE hi Cursor ctermfg=White ctermbg=DarkGray cterm=NONE hi DiffAdd ctermfg=Green ctermbg=White cterm=reverse hi DiffChange ctermfg=Cyan ctermbg=White cterm=reverse @@ -599,6 +613,8 @@ if s:t_Co >= 8 hi PmenuKindSel ctermfg=Red ctermbg=Blue cterm=NONE hi PmenuExtra ctermfg=DarkGray ctermbg=White cterm=NONE hi PmenuExtraSel ctermfg=DarkGray ctermbg=Blue cterm=NONE + hi PmenuMatch ctermfg=DarkGray ctermbg=White cterm=bold + hi PmenuMatchSel ctermfg=Black ctermbg=Blue cterm=bold hi SignColumn ctermfg=gray ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=gray ctermbg=NONE cterm=NONE hi StatusLine ctermfg=gray ctermbg=Black cterm=bold,reverse @@ -612,7 +628,7 @@ if s:t_Co >= 8 hi Visual ctermfg=Black ctermbg=Blue cterm=NONE hi WildMenu ctermfg=Blue ctermbg=DarkGray cterm=bold hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE - hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE + hi Conceal ctermfg=DarkGray ctermbg=NONE cterm=NONE hi Cursor ctermfg=Black ctermbg=White cterm=NONE hi DiffAdd ctermfg=Green ctermbg=Black cterm=reverse hi DiffChange ctermfg=Cyan ctermbg=Black cterm=reverse @@ -687,6 +703,8 @@ if s:t_Co >= 8 hi PmenuKindSel ctermfg=Red ctermbg=Blue cterm=NONE hi PmenuExtra ctermfg=Grey ctermbg=Black cterm=NONE hi PmenuExtraSel ctermfg=Grey ctermbg=Blue cterm=NONE + hi PmenuMatch ctermfg=Grey ctermbg=Black cterm=bold + hi PmenuMatchSel ctermfg=White ctermbg=Blue cterm=bold hi SignColumn ctermfg=Black ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=Black ctermbg=NONE cterm=NONE hi StatusLine ctermfg=Black ctermbg=White cterm=bold,reverse @@ -700,7 +718,7 @@ if s:t_Co >= 8 hi Visual ctermfg=White ctermbg=Blue cterm=NONE hi WildMenu ctermfg=Blue ctermbg=Grey cterm=bold hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE - hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE + hi Conceal ctermfg=Grey ctermbg=NONE cterm=NONE hi Cursor ctermfg=White ctermbg=DarkGray cterm=NONE hi DiffAdd ctermfg=Green ctermbg=White cterm=reverse hi DiffChange ctermfg=Cyan ctermbg=White cterm=reverse @@ -861,7 +879,7 @@ endif " Color: bg1 #ebdbb2 187 Grey " Color: bg2 #e5d4b1 188 Grey " Color: bg3 #bdae93 144 -" Color: bg4 #a89984 137 +" Color: bg4 #a89984 137 Grey " Color: bg5 #ebe1b7 229 Grey " Color: bg6 #ffffd7 231 Grey " Color: fg0 #282828 235 DarkGray @@ -875,6 +893,7 @@ endif " Color: yellow #b57614 172 Yellow " Color: blue #076678 23 Blue " Color: purple #8f3f71 126 Magenta +" Color: lightpurple #d3869b 175 Magenta " Color: aqua #427b58 29 Cyan " Color: orange #ff5f00 202 Magenta " Term colors: fg1 neutralred neutralgreen neutralyellow neutralblue neutralpurple neutralaqua fg4 diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim index 4d55f9978f7a82..f847ff3dd474dc 100644 --- a/runtime/colors/ron.vim +++ b/runtime/colors/ron.vim @@ -3,7 +3,7 @@ " Maintainer: original maintainer Ron Aaron " Website: https://www.github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:41 +" Last Change: 2024 Aug 15 " Generated by Colortemplate v2.2.3 @@ -63,7 +63,7 @@ hi CursorColumn guifg=NONE guibg=#666666 gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#666666 gui=NONE cterm=NONE hi CursorLineNr guifg=#ffff00 guibg=NONE gui=bold cterm=NONE hi QuickFixLine guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE -hi Conceal guifg=#e5e5e5 guibg=#a9a9a9 gui=NONE cterm=NONE +hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE hi Cursor guifg=#ffffff guibg=#60a060 gui=NONE cterm=NONE hi Directory guifg=#00ffff guibg=NONE gui=NONE cterm=NONE hi EndOfBuffer guifg=#ffff00 guibg=#303030 gui=NONE cterm=NONE @@ -80,6 +80,8 @@ hi Pmenu guifg=#ffffff guibg=#444444 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#000000 gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#e5e5e5 gui=NONE cterm=NONE +hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff00ff guibg=#00cdcd gui=NONE cterm=NONE hi Question guifg=#00ff00 guibg=#000000 gui=bold cterm=NONE hi Search guifg=#000000 guibg=#a9a9a9 gui=bold cterm=NONE hi SignColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE @@ -128,7 +130,7 @@ if s:t_Co >= 256 hi CursorLine ctermfg=NONE ctermbg=59 cterm=NONE hi CursorLineNr ctermfg=226 ctermbg=NONE cterm=NONE hi QuickFixLine ctermfg=16 ctermbg=44 cterm=NONE - hi Conceal ctermfg=254 ctermbg=145 cterm=NONE + hi Conceal ctermfg=59 ctermbg=NONE cterm=NONE hi Cursor ctermfg=231 ctermbg=71 cterm=NONE hi Directory ctermfg=51 ctermbg=NONE cterm=NONE hi EndOfBuffer ctermfg=226 ctermbg=236 cterm=NONE @@ -145,6 +147,8 @@ if s:t_Co >= 256 hi PmenuSbar ctermfg=NONE ctermbg=16 cterm=NONE hi PmenuSel ctermfg=16 ctermbg=44 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=254 cterm=NONE + hi PmenuMatch ctermfg=201 ctermbg=238 cterm=NONE + hi PmenuMatchSel ctermfg=201 ctermbg=44 cterm=NONE hi Question ctermfg=46 ctermbg=16 cterm=NONE hi Search ctermfg=16 ctermbg=145 cterm=NONE hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE @@ -196,7 +200,7 @@ if s:t_Co >= 16 hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=underline hi QuickFixLine ctermfg=black ctermbg=darkcyan cterm=NONE - hi Conceal ctermfg=grey ctermbg=grey cterm=NONE + hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Cursor ctermfg=white ctermbg=green cterm=NONE hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE hi EndOfBuffer ctermfg=yellow ctermbg=darkgrey cterm=NONE @@ -213,6 +217,8 @@ if s:t_Co >= 16 hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE + hi PmenuMatch ctermfg=white ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold hi Question ctermfg=green ctermbg=black cterm=NONE hi Search ctermfg=black ctermbg=grey cterm=NONE hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE @@ -280,6 +286,8 @@ if s:t_Co >= 8 hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE + hi PmenuMatch ctermfg=grey ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold hi Question ctermfg=darkgreen ctermbg=black cterm=bold hi Search ctermfg=black ctermbg=grey cterm=NONE hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim index b4a87935899ea5..39e6dae9560446 100644 --- a/runtime/colors/shine.vim +++ b/runtime/colors/shine.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer is Yasuhiro Matsumoto " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:41 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -35,6 +35,7 @@ hi! link Tag Special hi! link Operator Statement hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi Normal guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE hi Folded guifg=#00008b guibg=#dadada gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#dadada gui=NONE cterm=NONE @@ -50,6 +51,8 @@ hi Pmenu guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#ffff60 gui=NONE cterm=NONE hi PmenuSbar guifg=#ffffff guibg=#ffffff gui=NONE cterm=NONE hi PmenuThumb guifg=#767676 guibg=#767676 gui=NONE cterm=NONE +hi PmenuMatch guifg=#ff0000 guibg=#a8a8a8 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff0000 guibg=#ffff60 gui=NONE cterm=NONE hi TabLine guifg=#000000 guibg=#dadada gui=underline cterm=underline hi TabLineFill guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel guifg=#000000 guibg=#ffffff gui=bold cterm=bold @@ -84,7 +87,7 @@ hi Statement guifg=#2e8b57 guibg=NONE gui=bold cterm=bold hi Type guifg=#2e8b57 guibg=NONE gui=bold cterm=bold hi Comment guifg=#a8a8a8 guibg=NONE gui=bold cterm=NONE hi StorageClass guifg=#ff0000 guibg=NONE gui=bold cterm=bold -hi Conceal guifg=#dadada guibg=#767676 gui=NONE cterm=NONE +hi Conceal guifg=#add8e6 guibg=NONE gui=NONE cterm=NONE hi Identifier guifg=#008b8b guibg=NONE gui=NONE cterm=NONE hi Constant guifg=#a07070 guibg=NONE gui=NONE cterm=NONE hi Number guifg=#a07070 guibg=NONE gui=bold cterm=bold @@ -113,6 +116,7 @@ if s:t_Co >= 256 hi! link Operator Statement hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi Normal ctermfg=16 ctermbg=231 cterm=NONE hi Folded ctermfg=18 ctermbg=253 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=253 cterm=NONE @@ -128,6 +132,8 @@ if s:t_Co >= 256 hi PmenuSel ctermfg=16 ctermbg=228 cterm=NONE hi PmenuSbar ctermfg=231 ctermbg=231 cterm=NONE hi PmenuThumb ctermfg=243 ctermbg=243 cterm=NONE + hi PmenuMatch ctermfg=196 ctermbg=248 cterm=NONE + hi PmenuMatchSel ctermfg=196 ctermbg=228 cterm=NONE hi TabLine ctermfg=16 ctermbg=253 cterm=underline hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold @@ -162,7 +168,7 @@ if s:t_Co >= 256 hi Type ctermfg=29 ctermbg=NONE cterm=bold hi Comment ctermfg=248 ctermbg=NONE cterm=NONE hi StorageClass ctermfg=196 ctermbg=NONE cterm=bold - hi Conceal ctermfg=253 ctermbg=243 cterm=NONE + hi Conceal ctermfg=153 ctermbg=NONE cterm=NONE hi Identifier ctermfg=30 ctermbg=NONE cterm=NONE hi Constant ctermfg=95 ctermbg=NONE cterm=NONE hi Number ctermfg=95 ctermbg=NONE cterm=bold @@ -197,6 +203,8 @@ if s:t_Co >= 16 hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE hi PmenuSbar ctermfg=white ctermbg=white cterm=NONE hi PmenuThumb ctermfg=darkgrey ctermbg=darkgrey cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold hi TabLine ctermfg=black ctermbg=grey cterm=underline hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=black ctermbg=white cterm=bold @@ -231,7 +239,7 @@ if s:t_Co >= 16 hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE hi StorageClass ctermfg=red ctermbg=NONE cterm=bold - hi Conceal ctermfg=grey ctermbg=darkgrey cterm=NONE + hi Conceal ctermfg=blue ctermbg=NONE cterm=NONE hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE hi Number ctermfg=darkred ctermbg=NONE cterm=bold @@ -266,6 +274,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=grey ctermbg=grey cterm=NONE hi PmenuThumb ctermfg=black ctermbg=black cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLine ctermfg=black ctermbg=grey cterm=reverse hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=grey ctermbg=black cterm=reverse diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim index aab6208b260b7f..319ab9e0aa7463 100644 --- a/runtime/colors/slate.vim +++ b/runtime/colors/slate.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Ralph Amissah " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:41 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -31,6 +31,7 @@ hi! link CursorLineFold CursorLine hi! link CursorLineSign CursorLine hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi Normal guifg=#ffffff guibg=#262626 gui=NONE cterm=NONE hi EndOfBuffer guifg=#5f87d7 guibg=NONE gui=NONE cterm=NONE hi StatusLine guifg=#000000 guibg=#afaf87 gui=NONE cterm=NONE @@ -38,10 +39,12 @@ hi StatusLineNC guifg=#666666 guibg=#afaf87 gui=NONE cterm=NONE hi StatusLineTerm guifg=#000000 guibg=#afaf87 gui=NONE cterm=NONE hi StatusLineTermNC guifg=#666666 guibg=#afaf87 gui=NONE cterm=NONE hi VertSplit guifg=#666666 guibg=#afaf87 gui=NONE cterm=NONE -hi PmenuSel guifg=#262626 guibg=#d7d787 gui=NONE cterm=NONE hi Pmenu guifg=NONE guibg=#4a4a4a gui=NONE cterm=NONE +hi PmenuSel guifg=#262626 guibg=#d7d787 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#262626 gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#ffd700 gui=NONE cterm=NONE +hi PmenuMatch guifg=#d7875f guibg=#4a4a4a gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#d7875f guibg=#d7d787 gui=NONE cterm=NONE hi TabLineSel guifg=#000000 guibg=#afaf87 gui=NONE cterm=NONE hi TabLine guifg=#666666 guibg=#333333 gui=NONE cterm=NONE hi TabLineFill guifg=#ff8787 guibg=#333333 gui=NONE cterm=NONE @@ -108,6 +111,7 @@ if s:t_Co >= 256 hi! link CursorLineSign CursorLine hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi Normal ctermfg=231 ctermbg=235 cterm=NONE hi EndOfBuffer ctermfg=68 ctermbg=NONE cterm=NONE hi StatusLine ctermfg=16 ctermbg=144 cterm=NONE @@ -115,10 +119,12 @@ if s:t_Co >= 256 hi StatusLineTerm ctermfg=16 ctermbg=144 cterm=NONE hi StatusLineTermNC ctermfg=241 ctermbg=144 cterm=NONE hi VertSplit ctermfg=241 ctermbg=144 cterm=NONE - hi PmenuSel ctermfg=235 ctermbg=186 cterm=NONE hi Pmenu ctermfg=NONE ctermbg=239 cterm=NONE + hi PmenuSel ctermfg=235 ctermbg=186 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=235 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=220 cterm=NONE + hi PmenuMatch ctermfg=173 ctermbg=239 cterm=NONE + hi PmenuMatchSel ctermfg=173 ctermbg=186 cterm=NONE hi TabLineSel ctermfg=16 ctermbg=144 cterm=NONE hi TabLine ctermfg=241 ctermbg=236 cterm=NONE hi TabLineFill ctermfg=210 ctermbg=236 cterm=NONE @@ -185,10 +191,12 @@ if s:t_Co >= 16 hi StatusLineTerm ctermfg=white ctermbg=black cterm=bold,reverse hi StatusLineTermNC ctermfg=black ctermbg=grey cterm=NONE hi VertSplit ctermfg=darkgrey ctermbg=grey cterm=NONE - hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi Pmenu ctermfg=NONE ctermbg=darkgrey cterm=NONE + hi PmenuSel ctermfg=black ctermbg=darkmagenta cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=yellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkmagenta cterm=bold hi TabLineSel ctermfg=black ctermbg=darkyellow cterm=NONE hi TabLine ctermfg=grey ctermbg=darkgrey cterm=NONE hi TabLineFill ctermfg=cyan ctermbg=darkgrey cterm=NONE @@ -255,10 +263,12 @@ if s:t_Co >= 8 hi StatusLineTerm ctermfg=grey ctermbg=black cterm=bold,reverse hi StatusLineTermNC ctermfg=grey ctermbg=black cterm=reverse hi VertSplit ctermfg=grey ctermbg=black cterm=reverse - hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE + hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLineSel ctermfg=black ctermbg=darkyellow cterm=NONE hi TabLine ctermfg=grey ctermbg=black cterm=reverse hi TabLineFill ctermfg=grey ctermbg=black cterm=reverse diff --git a/runtime/colors/sorbet.vim b/runtime/colors/sorbet.vim index e4ef42469ca536..25c27bf635d721 100644 --- a/runtime/colors/sorbet.vim +++ b/runtime/colors/sorbet.vim @@ -4,7 +4,7 @@ " Maintainer: Maxence Weynans " Website: https://github.com/vim/colorschemes " License: Vim License (see `:help license`)` -" Last Updated: Fri 15 Dec 2023 20:05:42 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -21,6 +21,7 @@ hi! link StatusLineTerm StatusLine hi! link StatusLineTermNC StatusLineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement @@ -56,6 +57,9 @@ if (has('termguicolors') && &termguicolors) || has('gui_running') endfor endif hi Normal guifg=#dadada guibg=#161821 gui=NONE cterm=NONE +hi Added guifg=#87d75f guibg=NONE gui=NONE cterm=NONE +hi Changed guifg=#87afd7 guibg=NONE gui=NONE cterm=NONE +hi Removed guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE hi ColorColumn guifg=NONE guibg=#262831 gui=NONE cterm=NONE hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi CurSearch guifg=#ff5fff guibg=#000000 gui=reverse cterm=reverse @@ -78,10 +82,12 @@ hi ModeMsg guifg=#dadada guibg=NONE gui=bold cterm=bold hi MoreMsg guifg=#dadada guibg=NONE gui=NONE cterm=NONE hi NonText guifg=#707070 guibg=NONE gui=NONE cterm=NONE hi Pmenu guifg=#000000 guibg=#a6a8b1 gui=NONE cterm=NONE +hi PmenuMatch guifg=#d7005f guibg=#a6a8b1 gui=NONE cterm=NONE hi PmenuExtra guifg=#000000 guibg=#a6a8b1 gui=NONE cterm=NONE hi PmenuKind guifg=#000000 guibg=#a6a8b1 gui=bold cterm=bold hi PmenuSbar guifg=#707070 guibg=#5f5f87 gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#d7d7ff gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#d7005f guibg=#d7d7ff gui=bold cterm=bold hi PmenuExtraSel guifg=#000000 guibg=#d7d7ff gui=NONE cterm=NONE hi PmenuKindSel guifg=#000000 guibg=#d7d7ff gui=bold cterm=bold hi PmenuThumb guifg=#dadada guibg=#d7d7ff gui=NONE cterm=NONE @@ -120,11 +126,13 @@ hi Underlined guifg=#dadada guibg=NONE gui=underline cterm=underline hi CursorIM guifg=#000000 guibg=#afff00 gui=NONE cterm=NONE hi ToolbarLine guifg=NONE guibg=#000000 gui=NONE cterm=NONE hi ToolbarButton guifg=#dadada guibg=#000000 gui=bold cterm=bold -hi DiffRemoved guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE hi debugBreakpoint guifg=#8787af guibg=#000000 gui=bold,reverse cterm=bold,reverse if s:t_Co >= 256 hi Normal ctermfg=253 ctermbg=233 cterm=NONE + hi Added ctermfg=113 ctermbg=NONE cterm=NONE + hi Changed ctermfg=110 ctermbg=NONE cterm=NONE + hi Removed ctermfg=167 ctermbg=NONE cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=235 cterm=NONE hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi CurSearch ctermfg=207 ctermbg=16 cterm=reverse @@ -147,10 +155,12 @@ if s:t_Co >= 256 hi MoreMsg ctermfg=253 ctermbg=NONE cterm=NONE hi NonText ctermfg=242 ctermbg=NONE cterm=NONE hi Pmenu ctermfg=16 ctermbg=248 cterm=NONE + hi PmenuMatch ctermfg=161 ctermbg=248 cterm=NONE hi PmenuExtra ctermfg=16 ctermbg=248 cterm=NONE hi PmenuKind ctermfg=16 ctermbg=248 cterm=bold hi PmenuSbar ctermfg=242 ctermbg=60 cterm=NONE hi PmenuSel ctermfg=16 ctermbg=189 cterm=NONE + hi PmenuMatchSel ctermfg=161 ctermbg=189 cterm=bold hi PmenuExtraSel ctermfg=16 ctermbg=189 cterm=NONE hi PmenuKindSel ctermfg=16 ctermbg=189 cterm=bold hi PmenuThumb ctermfg=253 ctermbg=189 cterm=NONE @@ -189,7 +199,6 @@ if s:t_Co >= 256 hi CursorIM ctermfg=16 ctermbg=154 cterm=NONE hi ToolbarLine ctermfg=NONE ctermbg=16 cterm=NONE hi ToolbarButton ctermfg=253 ctermbg=16 cterm=bold - hi DiffRemoved ctermfg=167 ctermbg=NONE cterm=NONE hi debugBreakpoint ctermfg=103 ctermbg=16 cterm=bold,reverse unlet s:t_Co finish @@ -209,6 +218,9 @@ if s:t_Co >= 16 hi TabLine ctermfg=darkgrey ctermbg=NONE cterm=reverse hi VertSplit ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Normal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkblue ctermbg=NONE cterm=NONE + hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=NONE cterm=reverse hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse @@ -225,9 +237,11 @@ if s:t_Co >= 16 hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE @@ -261,7 +275,6 @@ if s:t_Co >= 16 hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse - hi DiffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE hi debugBreakpoint ctermfg=NONE ctermbg=NONE cterm=bold,reverse unlet s:t_Co finish @@ -281,6 +294,9 @@ if s:t_Co >= 8 hi TabLine ctermfg=NONE ctermbg=NONE cterm=bold,underline hi VertSplit ctermfg=NONE ctermbg=NONE cterm=NONE hi Normal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkblue ctermbg=NONE cterm=NONE + hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=NONE cterm=reverse hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse @@ -297,9 +313,11 @@ if s:t_Co >= 8 hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse + hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold + hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE @@ -333,7 +351,6 @@ if s:t_Co >= 8 hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse - hi DiffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE hi debugBreakpoint ctermfg=NONE ctermbg=NONE cterm=bold,reverse unlet s:t_Co finish diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim index 36da28e59612f2..0709263f7cc318 100644 --- a/runtime/colors/torte.vim +++ b/runtime/colors/torte.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Thorsten Maerz " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:42 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -33,6 +33,7 @@ hi! link StatusLineTerm StatusLine hi! link StatusLineTermNC StatusLineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi Normal guifg=#cccccc guibg=#000000 gui=NONE cterm=NONE hi Comment guifg=#80a0ff guibg=NONE gui=NONE cterm=NONE hi Constant guifg=#ffa0a0 guibg=NONE gui=NONE cterm=NONE @@ -53,7 +54,7 @@ hi CursorLineNr guifg=#ffff00 guibg=#666666 gui=NONE cterm=NONE hi SignColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE hi FoldColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE hi ColorColumn guifg=#cccccc guibg=#8b0000 gui=NONE cterm=NONE -hi Conceal guifg=#e5e5e5 guibg=#a9a9a9 gui=NONE cterm=NONE +hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE hi Cursor guifg=#000000 guibg=#00ff00 gui=bold cterm=NONE hi lCursor guifg=#000000 guibg=#e5e5e5 gui=NONE cterm=NONE hi CursorIM guifg=NONE guibg=fg gui=NONE cterm=NONE @@ -86,6 +87,8 @@ hi TabLineFill guifg=NONE guibg=#000000 gui=reverse cterm=reverse hi TabLineSel guifg=#cccccc guibg=#000000 gui=bold cterm=bold hi ToolbarLine guifg=NONE guibg=#000000 gui=NONE cterm=NONE hi ToolbarButton guifg=#000000 guibg=#e5e5e5 gui=bold cterm=bold +hi PmenuMatch guifg=#ff00ff guibg=#303030 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ff00ff guibg=#ffff00 gui=NONE cterm=NONE hi Pmenu guifg=fg guibg=#303030 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE @@ -106,6 +109,7 @@ if s:t_Co >= 256 hi! link StatusLineTermNC StatusLineNC hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi Normal ctermfg=251 ctermbg=16 cterm=NONE hi Comment ctermfg=111 ctermbg=NONE cterm=NONE hi Constant ctermfg=217 ctermbg=NONE cterm=NONE @@ -126,7 +130,7 @@ if s:t_Co >= 256 hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE hi FoldColumn ctermfg=51 ctermbg=NONE cterm=NONE hi ColorColumn ctermfg=251 ctermbg=88 cterm=NONE - hi Conceal ctermfg=254 ctermbg=248 cterm=NONE + hi Conceal ctermfg=242 ctermbg=NONE cterm=NONE hi Cursor ctermfg=16 ctermbg=46 cterm=NONE hi lCursor ctermfg=16 ctermbg=254 cterm=NONE hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE @@ -159,6 +163,8 @@ if s:t_Co >= 256 hi TabLineSel ctermfg=251 ctermbg=16 cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=16 cterm=NONE hi ToolbarButton ctermfg=16 ctermbg=254 cterm=bold + hi PmenuMatch ctermfg=201 ctermbg=236 cterm=NONE + hi PmenuMatchSel ctermfg=201 ctermbg=226 cterm=NONE hi Pmenu ctermfg=fg ctermbg=236 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE @@ -192,7 +198,7 @@ if s:t_Co >= 16 hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE hi FoldColumn ctermfg=cyan ctermbg=NONE cterm=NONE hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE - hi Conceal ctermfg=grey ctermbg=grey cterm=NONE + hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE hi Cursor ctermfg=black ctermbg=green cterm=NONE hi lCursor ctermfg=black ctermbg=grey cterm=NONE hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE @@ -225,6 +231,8 @@ if s:t_Co >= 16 hi TabLineSel ctermfg=white ctermbg=black cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE hi ToolbarButton ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatch ctermfg=fg ctermbg=darkgrey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold hi Pmenu ctermfg=fg ctermbg=darkgrey cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE @@ -292,6 +300,8 @@ if s:t_Co >= 8 hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkmagenta cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE hi DiffText ctermfg=black ctermbg=grey cterm=NONE diff --git a/runtime/colors/unokai.vim b/runtime/colors/unokai.vim new file mode 100644 index 00000000000000..168eda148304be --- /dev/null +++ b/runtime/colors/unokai.vim @@ -0,0 +1,522 @@ +" Name: unokai +" Description: Color scheme similar to Monokai originally created by Wimer Hazenberg for TextMate +" Author: k-37 <60838818+k-37@users.noreply.github.com> +" Maintainer: k-37 <60838818+k-37@users.noreply.github.com> +" Website: https://github.com/vim/colorschemes +" License: Vim License (see `:help license`) +" Last Change: 2024 Dec 15 + +" Generated by Colortemplate v2.2.3 + +set background=dark + +" hi clear +source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme +let g:colors_name = 'unokai' + +let s:t_Co = &t_Co + +if (has('termguicolors') && &termguicolors) || has('gui_running') + let g:terminal_ansi_colors = ['#282923', '#c61e5c', '#81af24', '#fd971f', '#51aebe', '#ae81ff', '#80beb5', '#bababa', '#74705d', '#f92672', '#a6e22e', '#e6db74', '#66d9ef', '#fd5ff0', '#a1efe4', '#f8f8f2'] + " Nvim uses g:terminal_color_{0-15} instead + for i in range(g:terminal_ansi_colors->len()) + let g:terminal_color_{i} = g:terminal_ansi_colors[i] + endfor +endif +hi! link CursorLineFold FoldColumn +hi! link CursorLineSign SignColumn +hi! link MessageWindow Pmenu +hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel +hi! link StatusLineTerm StatusLine +hi! link StatusLineTermNC StatusLineNC +hi! link Terminal Normal +hi! link Delimiter PreProc +hi! link Operator PreProc +hi! link StorageClass PreProc +hi! link Structure PreProc +hi! link Define Identifier +hi! link Label String +hi! link markdownCode Comment +hi! link markdownCodeBlock markdownCode +hi! link markdownCodeDelimiter markdownCode +hi Normal guifg=#f8f8f2 guibg=#282923 gui=NONE cterm=NONE +hi StatusLine guifg=#282923 guibg=#bababa gui=NONE cterm=NONE +hi StatusLineNC guifg=#282923 guibg=#74705d gui=NONE cterm=NONE +hi VertSplit guifg=#74705d guibg=#74705d gui=NONE cterm=NONE +hi TabLine guifg=#282923 guibg=#74705d gui=NONE cterm=NONE +hi TabLineFill guifg=#282923 guibg=#74705d gui=NONE cterm=NONE +hi TabLineSel guifg=#282923 guibg=#bababa gui=bold cterm=bold +hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi ToolbarButton guifg=#74705d guibg=#f8f8f2 gui=bold,reverse cterm=bold,reverse +hi QuickFixLine guifg=#282923 guibg=#51aebe gui=NONE cterm=NONE +hi CursorLineNr guifg=#dadada guibg=NONE gui=bold cterm=bold +hi LineNr guifg=#8a8a8a guibg=NONE gui=NONE cterm=NONE +hi LineNrAbove guifg=#8a8a8a guibg=NONE gui=NONE cterm=NONE +hi LineNrBelow guifg=#8a8a8a guibg=NONE gui=NONE cterm=NONE +hi NonText guifg=#8a8a8a guibg=NONE gui=NONE cterm=NONE +hi EndOfBuffer guifg=#8a8a8a guibg=NONE gui=NONE cterm=NONE +hi SpecialKey guifg=#8a8a8a guibg=NONE gui=NONE cterm=NONE +hi FoldColumn guifg=#8a8a8a guibg=NONE gui=NONE cterm=NONE +hi Visual guifg=#a1efe4 guibg=#282923 gui=reverse cterm=reverse +hi VisualNOS guifg=#282923 guibg=#80beb5 gui=NONE cterm=NONE +hi Pmenu guifg=NONE guibg=#585858 gui=NONE cterm=NONE +hi PmenuThumb guifg=NONE guibg=#74705d gui=NONE cterm=NONE +hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi PmenuSel guifg=NONE guibg=#8a8a8a gui=NONE cterm=NONE +hi PmenuKind guifg=#80beb5 guibg=#585858 gui=NONE cterm=NONE +hi PmenuKindSel guifg=#80beb5 guibg=#8a8a8a gui=NONE cterm=NONE +hi PmenuExtra guifg=#bababa guibg=#585858 gui=NONE cterm=NONE +hi PmenuExtraSel guifg=#bababa guibg=#8a8a8a gui=NONE cterm=NONE +hi PmenuMatch guifg=#ffaf5f guibg=#585858 gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#ffaf5f guibg=#8a8a8a gui=NONE cterm=NONE +hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi Error guifg=#f92672 guibg=#000000 gui=reverse cterm=reverse +hi ErrorMsg guifg=#f92672 guibg=#000000 gui=reverse cterm=reverse +hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold +hi MoreMsg guifg=#81af24 guibg=NONE gui=NONE cterm=NONE +hi Question guifg=#e6db74 guibg=NONE gui=NONE cterm=NONE +hi WarningMsg guifg=#f92672 guibg=NONE gui=NONE cterm=NONE +hi Todo guifg=#dadada guibg=NONE gui=bold cterm=bold +hi MatchParen guifg=#fd971f guibg=NONE gui=bold cterm=bold +hi Search guifg=#66d9ef guibg=#282923 gui=reverse cterm=reverse +hi IncSearch guifg=#ffaf5f guibg=#282923 gui=reverse cterm=reverse +hi CurSearch guifg=#ffaf5f guibg=#282923 gui=reverse cterm=reverse +hi WildMenu guifg=#282923 guibg=#e6db74 gui=bold cterm=bold +hi debugPC guifg=#282923 guibg=#51aebe gui=NONE cterm=NONE +hi debugBreakpoint guifg=#282923 guibg=#f92672 gui=NONE cterm=NONE +hi Cursor guifg=#000000 guibg=#dadada gui=NONE cterm=NONE +hi lCursor guifg=#282923 guibg=#5fff00 gui=NONE cterm=NONE +hi CursorLine guifg=NONE guibg=#3a392f gui=NONE cterm=NONE +hi CursorColumn guifg=NONE guibg=#3a392f gui=NONE cterm=NONE +hi Folded guifg=#bababa guibg=#414141 gui=NONE cterm=NONE +hi ColorColumn guifg=NONE guibg=#585858 gui=NONE cterm=NONE +hi SpellBad guifg=NONE guibg=NONE guisp=#d75f5f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellCap guifg=NONE guibg=NONE guisp=#ffaf5f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellLocal guifg=NONE guibg=NONE guisp=#5fd75f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi SpellRare guifg=NONE guibg=NONE guisp=#fd5ff0 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline +hi Constant guifg=#ae81ff guibg=NONE gui=NONE cterm=NONE +hi Type guifg=#fd971f guibg=NONE gui=bold cterm=bold +hi Character guifg=#a6e22e guibg=NONE gui=NONE cterm=NONE +hi Comment guifg=#74705d guibg=NONE gui=NONE cterm=NONE +hi String guifg=#e6db74 guibg=NONE gui=NONE cterm=NONE +hi Function guifg=#a6e22e guibg=NONE gui=NONE cterm=NONE +hi Identifier guifg=#66d9ef guibg=NONE gui=NONE cterm=NONE +hi PreProc guifg=#f92672 guibg=NONE gui=NONE cterm=NONE +hi Special guifg=#80beb5 guibg=NONE gui=NONE cterm=NONE +hi Statement guifg=#f92672 guibg=NONE gui=bold cterm=bold +hi Underlined guifg=#66d9ef guibg=NONE gui=underline cterm=underline +hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold +hi Debug guifg=#80beb5 guibg=NONE gui=NONE cterm=NONE +hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi Directory guifg=#a1efe4 guibg=NONE gui=bold cterm=bold +hi Conceal guifg=#8a8a8a guibg=NONE gui=NONE cterm=NONE +hi DiffAdd guifg=#5faf5f guibg=NONE gui=reverse cterm=reverse +hi DiffChange guifg=#5f87af guibg=NONE gui=reverse cterm=reverse +hi DiffText guifg=#af87af guibg=NONE gui=reverse cterm=reverse +hi DiffDelete guifg=#af5f5f guibg=NONE gui=reverse cterm=reverse +hi Added guifg=#5fd75f guibg=NONE gui=NONE cterm=NONE +hi Changed guifg=#ffaf5f guibg=NONE gui=NONE cterm=NONE +hi Removed guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE +hi htmlBold guifg=#f8f8f2 guibg=NONE gui=bold cterm=bold +hi htmlItalic guifg=#f8f8f2 guibg=NONE gui=italic cterm=italic +hi markdownHeadingDelimiter guifg=#f8f8f2 guibg=NONE gui=NONE cterm=NONE +hi markdownH1Delimiter guifg=#f92672 guibg=NONE gui=NONE cterm=NONE +hi markdownH2Delimiter guifg=#e6db74 guibg=NONE gui=NONE cterm=NONE +hi markdownH4Delimiter guifg=#66d9ef guibg=NONE gui=NONE cterm=NONE +hi markdownH6Delimiter guifg=#a6e22e guibg=NONE gui=NONE cterm=NONE +hi markdownH3Delimiter guifg=#fd971f guibg=NONE gui=NONE cterm=NONE +hi markdownH5Delimiter guifg=#51aebe guibg=NONE gui=NONE cterm=NONE + +if s:t_Co >= 256 + hi! link CursorLineFold FoldColumn + hi! link CursorLineSign SignColumn + hi! link MessageWindow Pmenu + hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel + hi! link StatusLineTerm StatusLine + hi! link StatusLineTermNC StatusLineNC + hi! link Terminal Normal + hi! link Delimiter PreProc + hi! link Operator PreProc + hi! link StorageClass PreProc + hi! link Structure PreProc + hi! link Define Identifier + hi! link Label String + hi! link markdownCode Comment + hi! link markdownCodeBlock markdownCode + hi! link markdownCodeDelimiter markdownCode + hi Normal ctermfg=255 ctermbg=235 cterm=NONE + hi StatusLine ctermfg=235 ctermbg=250 cterm=NONE + hi StatusLineNC ctermfg=235 ctermbg=244 cterm=NONE + hi VertSplit ctermfg=244 ctermbg=244 cterm=NONE + hi TabLine ctermfg=235 ctermbg=244 cterm=NONE + hi TabLineFill ctermfg=235 ctermbg=244 cterm=NONE + hi TabLineSel ctermfg=235 ctermbg=250 cterm=bold + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarButton ctermfg=244 ctermbg=255 cterm=bold,reverse + hi QuickFixLine ctermfg=235 ctermbg=141 cterm=NONE + hi CursorLineNr ctermfg=253 ctermbg=NONE cterm=bold + hi LineNr ctermfg=245 ctermbg=NONE cterm=NONE + hi LineNrAbove ctermfg=245 ctermbg=NONE cterm=NONE + hi LineNrBelow ctermfg=245 ctermbg=NONE cterm=NONE + hi NonText ctermfg=245 ctermbg=NONE cterm=NONE + hi EndOfBuffer ctermfg=245 ctermbg=NONE cterm=NONE + hi SpecialKey ctermfg=245 ctermbg=NONE cterm=NONE + hi FoldColumn ctermfg=245 ctermbg=NONE cterm=NONE + hi Visual ctermfg=116 ctermbg=235 cterm=reverse + hi VisualNOS ctermfg=235 ctermbg=73 cterm=NONE + hi Pmenu ctermfg=NONE ctermbg=240 cterm=NONE + hi PmenuThumb ctermfg=NONE ctermbg=244 cterm=NONE + hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE + hi PmenuSel ctermfg=NONE ctermbg=245 cterm=NONE + hi PmenuKind ctermfg=73 ctermbg=240 cterm=NONE + hi PmenuKindSel ctermfg=73 ctermbg=245 cterm=NONE + hi PmenuExtra ctermfg=250 ctermbg=240 cterm=NONE + hi PmenuExtraSel ctermfg=250 ctermbg=245 cterm=NONE + hi PmenuMatch ctermfg=215 ctermbg=240 cterm=NONE + hi PmenuMatchSel ctermfg=215 ctermbg=245 cterm=NONE + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=197 ctermbg=16 cterm=reverse + hi ErrorMsg ctermfg=197 ctermbg=16 cterm=reverse + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold + hi MoreMsg ctermfg=106 ctermbg=NONE cterm=NONE + hi Question ctermfg=185 ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=197 ctermbg=NONE cterm=NONE + hi Todo ctermfg=253 ctermbg=NONE cterm=bold + hi MatchParen ctermfg=208 ctermbg=NONE cterm=bold + hi Search ctermfg=81 ctermbg=235 cterm=reverse + hi IncSearch ctermfg=215 ctermbg=235 cterm=reverse + hi CurSearch ctermfg=215 ctermbg=235 cterm=reverse + hi WildMenu ctermfg=235 ctermbg=185 cterm=bold + hi debugPC ctermfg=235 ctermbg=73 cterm=NONE + hi debugBreakpoint ctermfg=235 ctermbg=197 cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE + hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE + hi Folded ctermfg=250 ctermbg=238 cterm=NONE + hi ColorColumn ctermfg=NONE ctermbg=240 cterm=NONE + hi SpellBad ctermfg=167 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=215 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=77 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=207 ctermbg=NONE cterm=underline + hi Constant ctermfg=141 ctermbg=NONE cterm=NONE + hi Type ctermfg=208 ctermbg=NONE cterm=bold + hi Character ctermfg=112 ctermbg=NONE cterm=NONE + hi Comment ctermfg=244 ctermbg=NONE cterm=NONE + hi String ctermfg=185 ctermbg=NONE cterm=NONE + hi Function ctermfg=112 ctermbg=NONE cterm=NONE + hi Identifier ctermfg=81 ctermbg=NONE cterm=NONE + hi PreProc ctermfg=197 ctermbg=NONE cterm=NONE + hi Special ctermfg=73 ctermbg=NONE cterm=NONE + hi Statement ctermfg=197 ctermbg=NONE cterm=bold + hi Underlined ctermfg=81 ctermbg=NONE cterm=underline + hi Title ctermfg=NONE ctermbg=NONE cterm=bold + hi Debug ctermfg=73 ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi Directory ctermfg=116 ctermbg=NONE cterm=bold + hi Conceal ctermfg=245 ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=71 ctermbg=NONE cterm=reverse + hi DiffChange ctermfg=67 ctermbg=NONE cterm=reverse + hi DiffText ctermfg=139 ctermbg=NONE cterm=reverse + hi DiffDelete ctermfg=131 ctermbg=NONE cterm=reverse + hi Added ctermfg=77 ctermbg=NONE cterm=NONE + hi Changed ctermfg=215 ctermbg=NONE cterm=NONE + hi Removed ctermfg=167 ctermbg=NONE cterm=NONE + hi htmlBold ctermfg=255 ctermbg=NONE cterm=bold + hi htmlItalic ctermfg=255 ctermbg=NONE cterm=underline + hi markdownHeadingDelimiter ctermfg=255 ctermbg=NONE cterm=NONE + hi markdownH1Delimiter ctermfg=197 ctermbg=NONE cterm=NONE + hi markdownH2Delimiter ctermfg=185 ctermbg=NONE cterm=NONE + hi markdownH4Delimiter ctermfg=81 ctermbg=NONE cterm=NONE + hi markdownH6Delimiter ctermfg=112 ctermbg=NONE cterm=NONE + hi markdownH3Delimiter ctermfg=208 ctermbg=NONE cterm=NONE + hi markdownH5Delimiter ctermfg=73 ctermbg=NONE cterm=NONE + unlet s:t_Co + finish +endif + +if s:t_Co >= 16 + hi Normal ctermfg=white ctermbg=black cterm=NONE + hi StatusLine ctermfg=black ctermbg=gray cterm=NONE + hi StatusLineNC ctermfg=black ctermbg=darkgray cterm=NONE + hi VertSplit ctermfg=darkgray ctermbg=darkgray cterm=NONE + hi TabLine ctermfg=black ctermbg=darkgray cterm=NONE + hi TabLineFill ctermfg=black ctermbg=darkgray cterm=NONE + hi TabLineSel ctermfg=black ctermbg=gray cterm=bold + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarButton ctermfg=darkgray ctermbg=white cterm=bold,reverse + hi QuickFixLine ctermfg=black ctermbg=darkmagenta cterm=NONE + hi CursorLineNr ctermfg=white ctermbg=NONE cterm=bold + hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi LineNrAbove ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi LineNrBelow ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi NonText ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi SpecialKey ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi FoldColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi Visual ctermfg=cyan ctermbg=black cterm=reverse + hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE + hi Pmenu ctermfg=black ctermbg=gray cterm=NONE + hi PmenuThumb ctermfg=gray ctermbg=black cterm=NONE + hi PmenuSbar ctermfg=NONE ctermbg=gray cterm=NONE + hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuKind ctermfg=darkred ctermbg=gray cterm=NONE + hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE + hi PmenuExtra ctermfg=darkgray ctermbg=gray cterm=NONE + hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=gray cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=red ctermbg=black cterm=reverse + hi ErrorMsg ctermfg=red ctermbg=black cterm=reverse + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold + hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Question ctermfg=yellow ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE + hi Todo ctermfg=white ctermbg=NONE cterm=bold + hi MatchParen ctermfg=darkyellow ctermbg=NONE cterm=bold + hi Search ctermfg=blue ctermbg=black cterm=reverse + hi IncSearch ctermfg=red ctermbg=black cterm=reverse + hi CurSearch ctermfg=red ctermbg=black cterm=reverse + hi WildMenu ctermfg=black ctermbg=yellow cterm=bold + hi debugPC ctermfg=black ctermbg=darkblue cterm=NONE + hi debugBreakpoint ctermfg=black ctermbg=red cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE + hi Folded ctermfg=black ctermbg=darkyellow cterm=NONE + hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE + hi SpellBad ctermfg=darkred ctermbg=NONE cterm=underline + hi SpellCap ctermfg=darkyellow ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=darkgreen ctermbg=NONE cterm=underline + hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline + hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi Type ctermfg=darkyellow ctermbg=NONE cterm=bold + hi Character ctermfg=green ctermbg=NONE cterm=NONE + hi Comment ctermfg=darkgray ctermbg=NONE cterm=NONE + hi String ctermfg=yellow ctermbg=NONE cterm=NONE + hi Function ctermfg=green ctermbg=NONE cterm=NONE + hi Identifier ctermfg=blue ctermbg=NONE cterm=NONE + hi PreProc ctermfg=red ctermbg=NONE cterm=NONE + hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Statement ctermfg=red ctermbg=NONE cterm=bold + hi Underlined ctermfg=blue ctermbg=NONE cterm=underline + hi Title ctermfg=NONE ctermbg=NONE cterm=bold + hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi Directory ctermfg=cyan ctermbg=NONE cterm=bold + hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=darkgreen ctermbg=NONE cterm=reverse + hi DiffChange ctermfg=darkblue ctermbg=NONE cterm=reverse + hi DiffText ctermfg=darkmagenta ctermbg=NONE cterm=reverse + hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=reverse + hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE + hi htmlBold ctermfg=white ctermbg=NONE cterm=bold + hi htmlItalic ctermfg=white ctermbg=NONE cterm=underline + hi markdownHeadingDelimiter ctermfg=white ctermbg=NONE cterm=NONE + hi markdownH1Delimiter ctermfg=red ctermbg=NONE cterm=NONE + hi markdownH2Delimiter ctermfg=yellow ctermbg=NONE cterm=NONE + hi markdownH4Delimiter ctermfg=blue ctermbg=NONE cterm=NONE + hi markdownH6Delimiter ctermfg=green ctermbg=NONE cterm=NONE + hi markdownH3Delimiter ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi markdownH5Delimiter ctermfg=darkblue ctermbg=NONE cterm=NONE + unlet s:t_Co + finish +endif + +if s:t_Co >= 8 + hi Normal ctermfg=gray ctermbg=black cterm=NONE + hi StatusLine ctermfg=gray ctermbg=black cterm=bold,reverse + hi StatusLineNC ctermfg=gray ctermbg=black cterm=reverse + hi VertSplit ctermfg=gray ctermbg=gray cterm=NONE + hi TabLine ctermfg=black ctermbg=gray cterm=NONE + hi TabLineFill ctermfg=gray ctermbg=gray cterm=NONE + hi TabLineSel ctermfg=black ctermbg=gray cterm=bold + hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE + hi ToolbarButton ctermfg=gray ctermbg=black cterm=reverse + hi QuickFixLine ctermfg=black ctermbg=darkyellow cterm=NONE + hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold + hi LineNr ctermfg=gray ctermbg=NONE cterm=bold + hi LineNrAbove ctermfg=gray ctermbg=NONE cterm=bold + hi LineNrBelow ctermfg=gray ctermbg=NONE cterm=bold + hi NonText ctermfg=gray ctermbg=NONE cterm=bold + hi EndOfBuffer ctermfg=gray ctermbg=NONE cterm=bold + hi SpecialKey ctermfg=gray ctermbg=NONE cterm=bold + hi FoldColumn ctermfg=gray ctermbg=NONE cterm=bold + hi Visual ctermfg=black ctermbg=darkcyan cterm=NONE + hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE + hi Pmenu ctermfg=black ctermbg=gray cterm=NONE + hi PmenuThumb ctermfg=gray ctermbg=black cterm=NONE + hi PmenuSbar ctermfg=NONE ctermbg=gray cterm=NONE + hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuKind ctermfg=darkred ctermbg=gray cterm=NONE + hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE + hi PmenuExtra ctermfg=black ctermbg=gray cterm=NONE + hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=gray cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold + hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE + hi Error ctermfg=darkred ctermbg=gray cterm=bold,reverse + hi ErrorMsg ctermfg=darkred ctermbg=gray cterm=bold,reverse + hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold + hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Question ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE + hi Todo ctermfg=gray ctermbg=NONE cterm=bold + hi MatchParen ctermfg=darkyellow ctermbg=NONE cterm=bold + hi Search ctermfg=black ctermbg=darkblue cterm=NONE + hi IncSearch ctermfg=black ctermbg=darkyellow cterm=NONE + hi CurSearch ctermfg=black ctermbg=darkyellow cterm=NONE + hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE + hi debugPC ctermfg=black ctermbg=darkblue cterm=NONE + hi debugBreakpoint ctermfg=black ctermbg=darkcyan cterm=NONE + hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline + hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE + hi Folded ctermfg=black ctermbg=darkyellow cterm=NONE + hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE + hi SpellBad ctermfg=darkred ctermbg=gray cterm=reverse + hi SpellCap ctermfg=darkblue ctermbg=gray cterm=reverse + hi SpellLocal ctermfg=darkgreen ctermbg=black cterm=reverse + hi SpellRare ctermfg=darkmagenta ctermbg=gray cterm=reverse + hi Constant ctermfg=darkmagenta ctermbg=NONE cterm=NONE + hi Type ctermfg=darkyellow ctermbg=NONE cterm=bold + hi Character ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Comment ctermfg=gray ctermbg=NONE cterm=bold + hi String ctermfg=darkyellow ctermbg=NONE cterm=bold + hi Function ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Identifier ctermfg=darkblue ctermbg=NONE cterm=NONE + hi PreProc ctermfg=darkred ctermbg=NONE cterm=NONE + hi Special ctermfg=darkcyan ctermbg=NONE cterm=bold + hi Statement ctermfg=darkred ctermbg=NONE cterm=bold + hi Underlined ctermfg=darkblue ctermbg=NONE cterm=underline + hi Title ctermfg=NONE ctermbg=NONE cterm=bold + hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE + hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE + hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold + hi Conceal ctermfg=gray ctermbg=NONE cterm=NONE + hi DiffAdd ctermfg=darkgreen ctermbg=NONE cterm=reverse + hi DiffChange ctermfg=darkblue ctermbg=NONE cterm=reverse + hi DiffText ctermfg=darkmagenta ctermbg=NONE cterm=reverse + hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=reverse + hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi Changed ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE + hi htmlBold ctermfg=gray ctermbg=NONE cterm=bold + hi htmlItalic ctermfg=gray ctermbg=NONE cterm=underline + hi markdownHeadingDelimiter ctermfg=gray ctermbg=NONE cterm=NONE + hi markdownH1Delimiter ctermfg=darkred ctermbg=NONE cterm=NONE + hi markdownH2Delimiter ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi markdownH4Delimiter ctermfg=darkblue ctermbg=NONE cterm=NONE + hi markdownH6Delimiter ctermfg=darkgreen ctermbg=NONE cterm=NONE + hi markdownH3Delimiter ctermfg=darkyellow ctermbg=NONE cterm=NONE + hi markdownH5Delimiter ctermfg=darkblue ctermbg=NONE cterm=NONE + unlet s:t_Co + finish +endif + +if s:t_Co >= 0 + hi Normal term=NONE + hi ColorColumn term=reverse + hi Conceal term=NONE + hi Cursor term=reverse + hi CursorColumn term=NONE + hi CursorLine term=underline + hi CursorLineNr term=bold + hi DiffAdd term=reverse + hi DiffChange term=NONE + hi DiffDelete term=reverse + hi DiffText term=reverse + hi Directory term=NONE + hi EndOfBuffer term=NONE + hi ErrorMsg term=bold,reverse + hi FoldColumn term=NONE + hi Folded term=NONE + hi IncSearch term=bold,reverse,underline + hi LineNr term=NONE + hi MatchParen term=bold,underline + hi ModeMsg term=bold + hi MoreMsg term=NONE + hi NonText term=NONE + hi Pmenu term=reverse + hi PmenuSbar term=reverse + hi PmenuSel term=bold + hi PmenuThumb term=NONE + hi Question term=standout + hi Search term=reverse + hi SignColumn term=reverse + hi SpecialKey term=bold + hi SpellBad term=underline + hi SpellCap term=underline + hi SpellLocal term=underline + hi SpellRare term=underline + hi StatusLine term=bold,reverse + hi StatusLineNC term=bold,underline + hi TabLine term=bold,underline + hi TabLineFill term=NONE + hi Terminal term=NONE + hi TabLineSel term=bold,reverse + hi Title term=NONE + hi VertSplit term=NONE + hi Visual term=reverse + hi VisualNOS term=NONE + hi WarningMsg term=standout + hi WildMenu term=bold + hi CursorIM term=NONE + hi ToolbarLine term=reverse + hi ToolbarButton term=bold,reverse + hi CurSearch term=reverse + hi CursorLineFold term=underline + hi CursorLineSign term=underline + hi Comment term=bold + hi Constant term=NONE + hi Error term=bold,reverse + hi Identifier term=NONE + hi Ignore term=NONE + hi PreProc term=NONE + hi Special term=NONE + hi Statement term=NONE + hi Todo term=bold,reverse + hi Type term=NONE + hi Underlined term=underline + unlet s:t_Co + finish +endif + +" Background: dark +" Color: color00 #282923 235 black +" Color: color08 #74705d 244 darkgray +" Color: color01 #c61e5c 125 darkred +" Color: color09 #f92672 197 red +" Color: color02 #81af24 106 darkgreen +" Color: color10 #a6e22e 112 green +" Color: color03 #fd971f 208 darkyellow +" Color: color11 #e6db74 185 yellow +" Color: color04 #51aebe 73 darkblue +" Color: color12 #66d9ef 81 blue +" Color: color05 #ae81ff 141 darkmagenta +" Color: color13 #fd5ff0 207 magenta +" Color: color06 #80beb5 73 darkcyan +" Color: color14 #a1efe4 116 cyan +" Color: color07 #bababa 250 gray +" Color: color15 #f8f8f2 255 white +" Color: colorLine #3a392f 237 darkgrey +" Color: colorB #585858 240 darkgrey +" Color: colorF #414141 238 darkgrey +" Color: colorNonT #8a8a8a 245 darkgrey +" Color: colorC #ffaf5f 215 red +" Color: colorlC #5fff00 82 green +" Color: colorV #1f3f5f 109 cyan +" Color: colorMP #fd971f 208 darkyellow +" Color: diffAdd #5faf5f 71 darkgreen +" Color: diffDelete #af5f5f 131 darkred +" Color: diffChange #5f87af 67 darkblue +" Color: diffText #af87af 139 darkmagenta +" Color: black #000000 16 black +" Color: white #dadada 253 white +" Color: Added #5fd75f 77 darkgreen +" Color: Changed #ffaf5f 215 darkyellow +" Color: Removed #d75f5f 167 darkred +" Term colors: color00 color01 color02 color03 color04 color05 color06 color07 +" Term colors: color08 color09 color10 color11 color12 color13 color14 color15 +" vim: et ts=8 sw=2 sts=2 diff --git a/runtime/colors/vim.lua b/runtime/colors/vim.lua index 7231418f5f9ddd..dd59e5075dda04 100644 --- a/runtime/colors/vim.lua +++ b/runtime/colors/vim.lua @@ -56,8 +56,11 @@ hi('CursorLineFold', { link = 'FoldColumn' }) hi('CurSearch', { link = 'Search' }) hi('PmenuKind', { link = 'Pmenu' }) hi('PmenuKindSel', { link = 'PmenuSel' }) +hi('PmenuMatch', { link = 'Pmenu' }) +hi('PmenuMatchSel', { link = 'PmenuSel' }) hi('PmenuExtra', { link = 'Pmenu' }) hi('PmenuExtraSel', { link = 'PmenuSel' }) +hi('ComplMatchIns', {}) hi('Substitute', { link = 'Search' }) hi('Whitespace', { link = 'NonText' }) hi('MsgSeparator', { link = 'StatusLine' }) @@ -209,81 +212,85 @@ hi('@lsp.type.variable', { link = 'Identifier' }) if vim.o.background == 'light' then -- Default colors only used with a light background. - hi('ColorColumn', { bg = 'LightRed', ctermbg = 'LightRed' }) - hi('CursorColumn', { bg = 'Grey90', ctermbg = 'LightGrey' }) - hi('CursorLine', { bg = 'Grey90', cterm = { underline = true } }) - hi('CursorLineNr', { fg = 'Brown', bold = true, ctermfg = 'Brown', cterm = { underline = true } }) - hi('DiffAdd', { bg = 'LightBlue', ctermbg = 'LightBlue' }) - hi('DiffChange', { bg = 'LightMagenta', ctermbg = 'LightMagenta' }) - hi('DiffDelete', { fg = 'Blue', bg = 'LightCyan', bold = true, ctermfg = 'Blue', ctermbg = 'LightCyan' }) - hi('Directory', { fg = 'Blue', ctermfg = 'DarkBlue' }) - hi('FoldColumn', { fg = 'DarkBlue', bg = 'Grey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) - hi('Folded', { fg = 'DarkBlue', bg = 'LightGrey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) - hi('LineNr', { fg = 'Brown', ctermfg = 'Brown' }) - hi('MatchParen', { bg = 'Cyan', ctermbg = 'Cyan' }) - hi('MoreMsg', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) - hi('Pmenu', { bg = 'LightMagenta', ctermfg = 'Black', ctermbg = 'LightMagenta' }) - hi('PmenuSel', { bg = 'Grey', ctermfg = 'Black', ctermbg = 'LightGrey' }) - hi('PmenuThumb', { bg = 'Black', ctermbg = 'Black' }) - hi('Question', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) - hi('Search', { bg = 'Yellow', ctermbg = 'Yellow' }) - hi('SignColumn', { fg = 'DarkBlue', bg = 'Grey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) - hi('SpecialKey', { fg = 'Blue', ctermfg = 'DarkBlue' }) - hi('SpellBad', { sp = 'Red', undercurl = true, ctermbg = 'LightRed' }) - hi('SpellCap', { sp = 'Blue', undercurl = true, ctermbg = 'LightBlue' }) - hi('SpellLocal', { sp = 'DarkCyan', undercurl = true, ctermbg = 'Cyan' }) - hi('SpellRare', { sp = 'Magenta', undercurl = true, ctermbg = 'LightMagenta' }) - hi('TabLine', { bg = 'LightGrey', underline = true, ctermfg = 'Black', ctermbg = 'LightGrey', cterm = { underline = true } }) - hi('Title', { fg = 'Magenta', bold = true, ctermfg = 'DarkMagenta' }) - hi('Visual', { fg = 'Black', bg = 'LightGrey', ctermfg = 'Black', ctermbg = 'Grey' }) - hi('WarningMsg', { fg = 'Red', ctermfg = 'DarkRed' }) - hi('Comment', { fg = 'Blue', ctermfg = 'DarkBlue' }) - hi('Constant', { fg = 'Magenta', ctermfg = 'DarkRed' }) - hi('Special', { fg = '#6a5acd', ctermfg = 'DarkMagenta' }) - hi('Identifier', { fg = 'DarkCyan', ctermfg = 'DarkCyan' }) - hi('Statement', { fg = 'Brown', bold = true, ctermfg = 'Brown' }) - hi('PreProc', { fg = '#6a0dad', ctermfg = 'DarkMagenta' }) - hi('Type', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) - hi('Underlined', { fg = 'SlateBlue', underline = true, ctermfg = 'DarkMagenta', cterm = { underline = true } }) - hi('Ignore', { ctermfg = 'White' }) + hi('ColorColumn', { bg = 'LightRed', ctermbg = 'LightRed' }) + hi('CursorColumn', { bg = 'Grey90', ctermbg = 'LightGrey' }) + hi('CursorLine', { bg = 'Grey90', cterm = { underline = true } }) + hi('CursorLineNr', { fg = 'Brown', bold = true, ctermfg = 'Brown', cterm = { underline = true } }) + hi('DiffAdd', { bg = 'LightBlue', ctermbg = 'LightBlue' }) + hi('DiffChange', { bg = 'LightMagenta', ctermbg = 'LightMagenta' }) + hi('DiffDelete', { fg = 'Blue', bg = 'LightCyan', bold = true, ctermfg = 'Blue', ctermbg = 'LightCyan' }) + hi('Directory', { fg = 'Blue', ctermfg = 'DarkBlue' }) + hi('FoldColumn', { fg = 'DarkBlue', bg = 'Grey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) + hi('Folded', { fg = 'DarkBlue', bg = 'LightGrey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) + hi('LineNr', { fg = 'Brown', ctermfg = 'Brown' }) + hi('MatchParen', { bg = 'Cyan', ctermbg = 'Cyan' }) + hi('MoreMsg', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) + hi('Pmenu', { bg = 'LightMagenta', ctermfg = 'Black', ctermbg = 'LightMagenta' }) + hi('PmenuSel', { bg = 'Grey', ctermfg = 'Black', ctermbg = 'LightGrey' }) + hi('PmenuThumb', { bg = 'Black', ctermbg = 'Black' }) + hi('Question', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) + hi('Search', { bg = 'Yellow', ctermbg = 'Yellow' }) + hi('SignColumn', { fg = 'DarkBlue', bg = 'Grey', ctermfg = 'DarkBlue', ctermbg = 'Grey' }) + hi('SpecialKey', { fg = 'Blue', ctermfg = 'DarkBlue' }) + hi('SpellBad', { sp = 'Red', undercurl = true, ctermbg = 'LightRed' }) + hi('SpellCap', { sp = 'Blue', undercurl = true, ctermbg = 'LightBlue' }) + hi('SpellLocal', { sp = 'DarkCyan', undercurl = true, ctermbg = 'Cyan' }) + hi('SpellRare', { sp = 'Magenta', undercurl = true, ctermbg = 'LightMagenta' }) + hi('StatusLineTerm', { fg = 'White', bg = 'DarkGreen', bold = true, ctermfg = 'White', ctermbg = 'DarkGreen', cterm = { bold = true } }) + hi('StatusLineTermNC', { fg = 'White', bg = 'DarkGreen', ctermfg = 'White', ctermbg = 'DarkGreen' }) + hi('TabLine', { bg = 'LightGrey', underline = true, ctermfg = 'Black', ctermbg = 'LightGrey', cterm = { underline = true } }) + hi('Title', { fg = 'Magenta', bold = true, ctermfg = 'DarkMagenta' }) + hi('Visual', { fg = 'Black', bg = 'LightGrey', ctermfg = 'Black', ctermbg = 'Grey' }) + hi('WarningMsg', { fg = 'Red', ctermfg = 'DarkRed' }) + hi('Comment', { fg = 'Blue', ctermfg = 'DarkBlue' }) + hi('Constant', { fg = 'Magenta', ctermfg = 'DarkRed' }) + hi('Special', { fg = '#6a5acd', ctermfg = 'DarkMagenta' }) + hi('Identifier', { fg = 'DarkCyan', ctermfg = 'DarkCyan' }) + hi('Statement', { fg = 'Brown', bold = true, ctermfg = 'Brown' }) + hi('PreProc', { fg = '#6a0dad', ctermfg = 'DarkMagenta' }) + hi('Type', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' }) + hi('Underlined', { fg = 'SlateBlue', underline = true, ctermfg = 'DarkMagenta', cterm = { underline = true } }) + hi('Ignore', { ctermfg = 'White' }) else -- Default colors only used with a dark background. - hi('ColorColumn', { bg = 'DarkRed', ctermbg = 'DarkRed' }) - hi('CursorColumn', { bg = 'Grey40', ctermbg = 'DarkGrey' }) - hi('CursorLine', { bg = 'Grey40', cterm = { underline = true } }) - hi('CursorLineNr', { fg = 'Yellow', bold = true, ctermfg = 'Yellow', cterm = { underline = true } }) - hi('DiffAdd', { bg = 'DarkBlue', ctermbg = 'DarkBlue' }) - hi('DiffChange', { bg = 'DarkMagenta', ctermbg = 'DarkMagenta' }) - hi('DiffDelete', { fg = 'Blue', bg = 'DarkCyan', bold = true, ctermfg = 'Blue', ctermbg = 'DarkCyan' }) - hi('Directory', { fg = 'Cyan', ctermfg = 'LightCyan' }) - hi('FoldColumn', { fg = 'Cyan', bg = 'Grey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) - hi('Folded', { fg = 'Cyan', bg = 'DarkGrey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) - hi('LineNr', { fg = 'Yellow', ctermfg = 'Yellow' }) - hi('MatchParen', { bg = 'DarkCyan', ctermbg = 'DarkCyan' }) - hi('MoreMsg', { fg = 'SeaGreen', bold = true, ctermfg = 'LightGreen' }) - hi('Pmenu', { bg = 'Magenta', ctermfg = 'Black', ctermbg = 'Magenta' }) - hi('PmenuSel', { bg = 'DarkGrey', ctermfg = 'DarkGrey', ctermbg = 'Black' }) - hi('PmenuThumb', { bg = 'White', ctermbg = 'White' }) - hi('Question', { fg = 'Green', bold = true, ctermfg = 'LightGreen' }) - hi('Search', { fg = 'Black', bg = 'Yellow', ctermfg = 'Black', ctermbg = 'Yellow' }) - hi('SignColumn', { fg = 'Cyan', bg = 'Grey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) - hi('SpecialKey', { fg = 'Cyan', ctermfg = 'LightBlue' }) - hi('SpellBad', { sp = 'Red', undercurl = true, ctermbg = 'Red' }) - hi('SpellCap', { sp = 'Blue', undercurl = true, ctermbg = 'Blue' }) - hi('SpellLocal', { sp = 'Cyan', undercurl = true, ctermbg = 'Cyan' }) - hi('SpellRare', { sp = 'Magenta', undercurl = true, ctermbg = 'Magenta' }) - hi('TabLine', { bg = 'DarkGrey', underline = true, ctermfg = 'White', ctermbg = 'DarkGrey', cterm = { underline = true } }) - hi('Title', { fg = 'Magenta', bold = true, ctermfg = 'LightMagenta' }) - hi('Visual', { fg = 'LightGrey', bg = '#575757', ctermfg = 'Black', ctermbg = 'Grey' }) - hi('WarningMsg', { fg = 'Red', ctermfg = 'LightRed' }) - hi('Comment', { fg = '#80a0ff', ctermfg = 'Cyan' }) - hi('Constant', { fg = '#ffa0a0', ctermfg = 'Magenta' }) - hi('Special', { fg = 'Orange', ctermfg = 'LightRed' }) - hi('Identifier', { fg = '#40ffff', ctermfg = 'Cyan', cterm = { bold = true } }) - hi('Statement', { fg = '#ffff60', bold = true, ctermfg = 'Yellow' }) - hi('PreProc', { fg = '#ff80ff', ctermfg = 'LightBlue' }) - hi('Type', { fg = '#60ff60', bold = true, ctermfg = 'LightGreen' }) - hi('Underlined', { fg = '#80a0ff', underline = true, ctermfg = 'LightBlue', cterm = { underline = true } }) - hi('Ignore', { ctermfg = 'Black' }) + hi('ColorColumn', { bg = 'DarkRed', ctermbg = 'DarkRed' }) + hi('CursorColumn', { bg = 'Grey40', ctermbg = 'DarkGrey' }) + hi('CursorLine', { bg = 'Grey40', cterm = { underline = true } }) + hi('CursorLineNr', { fg = 'Yellow', bold = true, ctermfg = 'Yellow', cterm = { underline = true } }) + hi('DiffAdd', { bg = 'DarkBlue', ctermbg = 'DarkBlue' }) + hi('DiffChange', { bg = 'DarkMagenta', ctermbg = 'DarkMagenta' }) + hi('DiffDelete', { fg = 'Blue', bg = 'DarkCyan', bold = true, ctermfg = 'Blue', ctermbg = 'DarkCyan' }) + hi('Directory', { fg = 'Cyan', ctermfg = 'LightCyan' }) + hi('FoldColumn', { fg = 'Cyan', bg = 'Grey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) + hi('Folded', { fg = 'Cyan', bg = 'DarkGrey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) + hi('LineNr', { fg = 'Yellow', ctermfg = 'Yellow' }) + hi('MatchParen', { bg = 'DarkCyan', ctermbg = 'DarkCyan' }) + hi('MoreMsg', { fg = 'SeaGreen', bold = true, ctermfg = 'LightGreen' }) + hi('Pmenu', { bg = 'Magenta', ctermfg = 'Black', ctermbg = 'Magenta' }) + hi('PmenuSel', { bg = 'DarkGrey', ctermfg = 'DarkGrey', ctermbg = 'Black' }) + hi('PmenuThumb', { bg = 'White', ctermbg = 'White' }) + hi('Question', { fg = 'Green', bold = true, ctermfg = 'LightGreen' }) + hi('Search', { fg = 'Black', bg = 'Yellow', ctermfg = 'Black', ctermbg = 'Yellow' }) + hi('SignColumn', { fg = 'Cyan', bg = 'Grey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' }) + hi('SpecialKey', { fg = 'Cyan', ctermfg = 'LightBlue' }) + hi('SpellBad', { sp = 'Red', undercurl = true, ctermbg = 'Red' }) + hi('SpellCap', { sp = 'Blue', undercurl = true, ctermbg = 'Blue' }) + hi('SpellLocal', { sp = 'Cyan', undercurl = true, ctermbg = 'Cyan' }) + hi('SpellRare', { sp = 'Magenta', undercurl = true, ctermbg = 'Magenta' }) + hi('StatusLineTerm', { fg = 'Black', bg = 'LightGreen', bold = true, ctermfg = 'Black', ctermbg = 'LightGreen', cterm = { bold = true } }) + hi('StatusLineTermNC', { fg = 'Black', bg = 'LightGreen', ctermfg = 'Black', ctermbg = 'LightGreen' }) + hi('TabLine', { bg = 'DarkGrey', underline = true, ctermfg = 'White', ctermbg = 'DarkGrey', cterm = { underline = true } }) + hi('Title', { fg = 'Magenta', bold = true, ctermfg = 'LightMagenta' }) + hi('Visual', { fg = 'LightGrey', bg = '#575757', ctermfg = 'Black', ctermbg = 'Grey' }) + hi('WarningMsg', { fg = 'Red', ctermfg = 'LightRed' }) + hi('Comment', { fg = '#80a0ff', ctermfg = 'Cyan' }) + hi('Constant', { fg = '#ffa0a0', ctermfg = 'Magenta' }) + hi('Special', { fg = 'Orange', ctermfg = 'LightRed' }) + hi('Identifier', { fg = '#40ffff', ctermfg = 'Cyan', cterm = { bold = true } }) + hi('Statement', { fg = '#ffff60', bold = true, ctermfg = 'Yellow' }) + hi('PreProc', { fg = '#ff80ff', ctermfg = 'LightBlue' }) + hi('Type', { fg = '#60ff60', bold = true, ctermfg = 'LightGreen' }) + hi('Underlined', { fg = '#80a0ff', underline = true, ctermfg = 'LightBlue', cterm = { underline = true } }) + hi('Ignore', { ctermfg = 'Black' }) end --stylua: ignore end diff --git a/runtime/colors/wildcharm.vim b/runtime/colors/wildcharm.vim index c47a66d148edb8..00ebc16529a475 100644 --- a/runtime/colors/wildcharm.vim +++ b/runtime/colors/wildcharm.vim @@ -4,7 +4,7 @@ " Maintainer: Maxim Kim " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Mon 08 Jan 2024 09:40:36 AM AEDT +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -21,6 +21,7 @@ hi! link LineNrAbove LineNr hi! link LineNrBelow LineNr hi! link MessageWindow PMenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi! link CurSearch IncSearch if &background ==# 'dark' if (has('termguicolors') && &termguicolors) || has('gui_running') @@ -31,14 +32,14 @@ if &background ==# 'dark' endfor endif hi Normal guifg=#d0d0d0 guibg=#000000 gui=NONE cterm=NONE - hi Statusline guifg=#d0d0d0 guibg=#000000 gui=reverse cterm=reverse + hi Statusline guifg=#9e9e9e guibg=#000000 gui=bold,reverse cterm=bold,reverse hi StatuslineNC guifg=#767676 guibg=#000000 gui=reverse cterm=reverse - hi VertSplit guifg=#767676 guibg=#767676 gui=NONE cterm=NONE - hi TabLine guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE - hi TabLineFill guifg=NONE guibg=#767676 gui=NONE cterm=NONE - hi TabLineSel guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE + hi VertSplit guifg=#767676 guibg=NONE gui=NONE cterm=NONE + hi TabLine guifg=#000000 guibg=#767676 gui=NONE cterm=NONE + hi TabLineFill guifg=NONE guibg=#000000 gui=NONE cterm=NONE + hi TabLineSel guifg=#000000 guibg=#9e9e9e gui=bold cterm=bold hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE + hi ToolbarButton guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE hi QuickFixLine guifg=#000000 guibg=#ff87ff gui=NONE cterm=NONE hi CursorLineNr guifg=#ffffff guibg=NONE gui=bold cterm=bold hi LineNr guifg=#585858 guibg=NONE gui=NONE cterm=NONE @@ -48,13 +49,15 @@ if &background ==# 'dark' hi EndOfBuffer guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi EndOfBuffer guifg=#767676 guibg=NONE gui=NONE cterm=NONE hi Pmenu guifg=#d0d0d0 guibg=#303030 gui=NONE cterm=NONE - hi PmenuSel guifg=#000000 guibg=#ffaf00 gui=NONE cterm=NONE + hi PmenuSel guifg=#d0d0d0 guibg=#585858 gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#d0d0d0 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuKind guifg=#ff5f87 guibg=#303030 gui=NONE cterm=NONE - hi PmenuKindSel guifg=#d7005f guibg=#ffaf00 gui=NONE cterm=NONE + hi PmenuKindSel guifg=#ff5f87 guibg=#585858 gui=NONE cterm=NONE hi PmenuExtra guifg=#767676 guibg=#303030 gui=NONE cterm=NONE - hi PmenuExtraSel guifg=#000000 guibg=#ffaf00 gui=NONE cterm=NONE + hi PmenuExtraSel guifg=#767676 guibg=#585858 gui=NONE cterm=NONE + hi PmenuMatch guifg=#d787d7 guibg=#303030 gui=NONE cterm=NONE + hi PmenuMatchSel guifg=#d787d7 guibg=#585858 gui=NONE cterm=NONE hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Error guifg=#d7005f guibg=#ffffff gui=reverse cterm=reverse hi ErrorMsg guifg=#d7005f guibg=#ffffff gui=reverse cterm=reverse @@ -70,7 +73,7 @@ if &background ==# 'dark' hi debugBreakpoint guifg=#00afaf guibg=NONE gui=reverse cterm=reverse hi Cursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE hi lCursor guifg=#000000 guibg=#ff5fff gui=NONE cterm=NONE - hi Visual guifg=#0087d7 guibg=#000000 gui=reverse cterm=reverse + hi Visual guifg=#5fd7ff guibg=#000000 gui=reverse cterm=reverse hi VisualNOS guifg=#000000 guibg=#00afff gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#262626 gui=NONE cterm=NONE hi CursorColumn guifg=NONE guibg=#262626 gui=NONE cterm=NONE @@ -92,7 +95,7 @@ if &background ==# 'dark' hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold hi Directory guifg=#00afff guibg=NONE gui=bold cterm=bold - hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal guifg=#585858 guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd guifg=#afffaf guibg=#5f875f gui=NONE cterm=NONE hi DiffChange guifg=#d0d0d0 guibg=#5f5f5f gui=NONE cterm=NONE @@ -111,14 +114,14 @@ else endfor endif hi Normal guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE - hi Statusline guifg=#ffffff guibg=#5f5f5f gui=NONE cterm=NONE + hi Statusline guifg=#ffffff guibg=#5f5f5f gui=bold cterm=bold hi StatuslineNC guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE - hi VertSplit guifg=#d0d0d0 guibg=#d0d0d0 gui=NONE cterm=NONE + hi VertSplit guifg=#5f5f5f guibg=NONE gui=NONE cterm=NONE hi TabLine guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE - hi TabLineFill guifg=NONE guibg=#808080 gui=NONE cterm=NONE - hi TabLineSel guifg=#ffffff guibg=#000000 gui=reverse cterm=reverse + hi TabLineFill guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineSel guifg=#5f5f5f guibg=#ffffff gui=bold,reverse cterm=bold,reverse hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE + hi ToolbarButton guifg=#ffffff guibg=#5f5f5f gui=NONE cterm=NONE hi QuickFixLine guifg=#ffffff guibg=#870087 gui=NONE cterm=NONE hi CursorLineNr guifg=#000000 guibg=NONE gui=bold cterm=bold hi LineNr guifg=#b2b2b2 guibg=NONE gui=NONE cterm=NONE @@ -127,13 +130,15 @@ else hi EndOfBuffer guifg=#b2b2b2 guibg=NONE gui=NONE cterm=NONE hi SpecialKey guifg=#b2b2b2 guibg=NONE gui=NONE cterm=NONE hi Pmenu guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE - hi PmenuSel guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE + hi PmenuSel guifg=#000000 guibg=#b2b2b2 gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#808080 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuKind guifg=#d70000 guibg=#e4e4e4 gui=NONE cterm=NONE - hi PmenuKindSel guifg=#af0000 guibg=#d78700 gui=NONE cterm=NONE + hi PmenuKindSel guifg=#d70000 guibg=#b2b2b2 gui=NONE cterm=NONE hi PmenuExtra guifg=#808080 guibg=#e4e4e4 gui=NONE cterm=NONE - hi PmenuExtraSel guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE + hi PmenuExtraSel guifg=#808080 guibg=#b2b2b2 gui=NONE cterm=NONE + hi PmenuMatch guifg=#870087 guibg=#e4e4e4 gui=NONE cterm=NONE + hi PmenuMatchSel guifg=#870087 guibg=#b2b2b2 gui=NONE cterm=NONE hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Error guifg=#d70000 guibg=#ffffff gui=reverse cterm=reverse hi ErrorMsg guifg=#d70000 guibg=#ffffff gui=reverse cterm=reverse @@ -141,7 +146,7 @@ else hi MoreMsg guifg=#008700 guibg=NONE gui=NONE cterm=NONE hi Question guifg=#870087 guibg=NONE gui=NONE cterm=NONE hi WarningMsg guifg=#af5f00 guibg=NONE gui=NONE cterm=NONE - hi Todo guifg=#8700ff guibg=#ffffff gui=reverse cterm=reverse + hi Todo guifg=#5f00d7 guibg=#ffffff gui=reverse cterm=reverse hi Search guifg=#ffffff guibg=#008700 gui=NONE cterm=NONE hi IncSearch guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE hi WildMenu guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE @@ -167,11 +172,11 @@ else hi Statement guifg=#005faf guibg=NONE gui=NONE cterm=NONE hi Type guifg=#af5f00 guibg=NONE gui=NONE cterm=NONE hi PreProc guifg=#008787 guibg=NONE gui=NONE cterm=NONE - hi Special guifg=#8700ff guibg=NONE gui=NONE cterm=NONE + hi Special guifg=#5f00d7 guibg=NONE gui=NONE cterm=NONE hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold hi Directory guifg=#005faf guibg=NONE gui=bold cterm=bold - hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal guifg=#b2b2b2 guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd guifg=#005f00 guibg=#afd7af gui=NONE cterm=NONE hi DiffChange guifg=#262626 guibg=#dadada gui=NONE cterm=NONE @@ -190,17 +195,18 @@ if s:t_Co >= 256 hi! link LineNrBelow LineNr hi! link MessageWindow PMenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi! link CurSearch IncSearch if &background ==# 'dark' hi Normal ctermfg=252 ctermbg=16 cterm=NONE - hi Statusline ctermfg=252 ctermbg=16 cterm=reverse + hi Statusline ctermfg=247 ctermbg=16 cterm=bold,reverse hi StatuslineNC ctermfg=243 ctermbg=16 cterm=reverse - hi VertSplit ctermfg=243 ctermbg=243 cterm=NONE - hi TabLine ctermfg=16 ctermbg=252 cterm=NONE - hi TabLineFill ctermfg=NONE ctermbg=243 cterm=NONE - hi TabLineSel ctermfg=231 ctermbg=16 cterm=NONE + hi VertSplit ctermfg=243 ctermbg=NONE cterm=NONE + hi TabLine ctermfg=16 ctermbg=243 cterm=NONE + hi TabLineFill ctermfg=NONE ctermbg=16 cterm=NONE + hi TabLineSel ctermfg=16 ctermbg=247 cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton ctermfg=16 ctermbg=231 cterm=NONE + hi ToolbarButton ctermfg=16 ctermbg=252 cterm=NONE hi QuickFixLine ctermfg=16 ctermbg=213 cterm=NONE hi CursorLineNr ctermfg=231 ctermbg=NONE cterm=bold hi LineNr ctermfg=240 ctermbg=NONE cterm=NONE @@ -210,13 +216,15 @@ if s:t_Co >= 256 hi EndOfBuffer ctermfg=240 ctermbg=NONE cterm=NONE hi EndOfBuffer ctermfg=243 ctermbg=NONE cterm=NONE hi Pmenu ctermfg=252 ctermbg=236 cterm=NONE - hi PmenuSel ctermfg=16 ctermbg=214 cterm=NONE + hi PmenuSel ctermfg=252 ctermbg=240 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=252 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuKind ctermfg=204 ctermbg=236 cterm=NONE - hi PmenuKindSel ctermfg=161 ctermbg=214 cterm=NONE + hi PmenuKindSel ctermfg=204 ctermbg=240 cterm=NONE hi PmenuExtra ctermfg=243 ctermbg=236 cterm=NONE - hi PmenuExtraSel ctermfg=16 ctermbg=214 cterm=NONE + hi PmenuExtraSel ctermfg=243 ctermbg=240 cterm=NONE + hi PmenuMatch ctermfg=176 ctermbg=236 cterm=NONE + hi PmenuMatchSel ctermfg=176 ctermbg=240 cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=161 ctermbg=231 cterm=reverse hi ErrorMsg ctermfg=161 ctermbg=231 cterm=reverse @@ -230,17 +238,17 @@ if s:t_Co >= 256 hi WildMenu ctermfg=16 ctermbg=214 cterm=NONE hi debugPC ctermfg=32 ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=37 ctermbg=NONE cterm=reverse - hi Visual ctermfg=32 ctermbg=16 cterm=reverse + hi Visual ctermfg=81 ctermbg=16 cterm=reverse hi VisualNOS ctermfg=16 ctermbg=39 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=235 cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=235 cterm=NONE hi Folded ctermfg=243 ctermbg=236 cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=236 cterm=NONE hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold - hi SpellBad ctermfg=161 ctermbg=231 cterm=reverse - hi SpellCap ctermfg=37 ctermbg=16 cterm=reverse - hi SpellLocal ctermfg=41 ctermbg=16 cterm=reverse - hi SpellRare ctermfg=213 ctermbg=16 cterm=reverse + hi SpellBad ctermfg=161 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=37 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=41 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=213 ctermbg=NONE cterm=underline hi Comment ctermfg=243 ctermbg=NONE cterm=NONE hi Constant ctermfg=204 ctermbg=NONE cterm=NONE hi String ctermfg=41 ctermbg=NONE cterm=NONE @@ -252,7 +260,7 @@ if s:t_Co >= 256 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=39 ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=240 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=157 ctermbg=65 cterm=NONE hi DiffChange ctermfg=252 ctermbg=59 cterm=NONE @@ -264,14 +272,14 @@ if s:t_Co >= 256 else " Light background hi Normal ctermfg=16 ctermbg=231 cterm=NONE - hi Statusline ctermfg=231 ctermbg=59 cterm=NONE + hi Statusline ctermfg=231 ctermbg=59 cterm=bold hi StatuslineNC ctermfg=16 ctermbg=252 cterm=NONE - hi VertSplit ctermfg=252 ctermbg=252 cterm=NONE + hi VertSplit ctermfg=59 ctermbg=NONE cterm=NONE hi TabLine ctermfg=16 ctermbg=252 cterm=NONE - hi TabLineFill ctermfg=NONE ctermbg=240 cterm=NONE - hi TabLineSel ctermfg=231 ctermbg=16 cterm=reverse + hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=59 ctermbg=231 cterm=bold,reverse hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton ctermfg=231 ctermbg=16 cterm=NONE + hi ToolbarButton ctermfg=231 ctermbg=59 cterm=NONE hi QuickFixLine ctermfg=231 ctermbg=90 cterm=NONE hi CursorLineNr ctermfg=16 ctermbg=NONE cterm=bold hi LineNr ctermfg=249 ctermbg=NONE cterm=NONE @@ -280,13 +288,15 @@ if s:t_Co >= 256 hi EndOfBuffer ctermfg=249 ctermbg=NONE cterm=NONE hi SpecialKey ctermfg=249 ctermbg=NONE cterm=NONE hi Pmenu ctermfg=16 ctermbg=254 cterm=NONE - hi PmenuSel ctermfg=231 ctermbg=172 cterm=NONE + hi PmenuSel ctermfg=16 ctermbg=249 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=240 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE hi PmenuKind ctermfg=160 ctermbg=254 cterm=NONE - hi PmenuKindSel ctermfg=124 ctermbg=172 cterm=NONE + hi PmenuKindSel ctermfg=160 ctermbg=249 cterm=NONE hi PmenuExtra ctermfg=240 ctermbg=254 cterm=NONE - hi PmenuExtraSel ctermfg=231 ctermbg=172 cterm=NONE + hi PmenuExtraSel ctermfg=240 ctermbg=249 cterm=NONE + hi PmenuMatch ctermfg=90 ctermbg=254 cterm=NONE + hi PmenuMatchSel ctermfg=90 ctermbg=249 cterm=NONE hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=160 ctermbg=231 cterm=reverse hi ErrorMsg ctermfg=160 ctermbg=231 cterm=reverse @@ -294,7 +304,7 @@ if s:t_Co >= 256 hi MoreMsg ctermfg=28 ctermbg=NONE cterm=NONE hi Question ctermfg=90 ctermbg=NONE cterm=NONE hi WarningMsg ctermfg=130 ctermbg=NONE cterm=NONE - hi Todo ctermfg=93 ctermbg=231 cterm=reverse + hi Todo ctermfg=56 ctermbg=231 cterm=reverse hi Search ctermfg=231 ctermbg=28 cterm=NONE hi IncSearch ctermfg=231 ctermbg=172 cterm=NONE hi WildMenu ctermfg=231 ctermbg=172 cterm=NONE @@ -307,10 +317,10 @@ if s:t_Co >= 256 hi Folded ctermfg=240 ctermbg=254 cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=254 cterm=NONE hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold - hi SpellBad ctermfg=160 ctermbg=231 cterm=reverse - hi SpellCap ctermfg=30 ctermbg=231 cterm=reverse - hi SpellLocal ctermfg=28 ctermbg=231 cterm=reverse - hi SpellRare ctermfg=127 ctermbg=231 cterm=reverse + hi SpellBad ctermfg=160 ctermbg=NONE cterm=underline + hi SpellCap ctermfg=30 ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=28 ctermbg=NONE cterm=underline + hi SpellRare ctermfg=127 ctermbg=NONE cterm=underline hi Comment ctermfg=245 ctermbg=NONE cterm=NONE hi Constant ctermfg=124 ctermbg=NONE cterm=NONE hi String ctermfg=28 ctermbg=NONE cterm=NONE @@ -318,11 +328,11 @@ if s:t_Co >= 256 hi Statement ctermfg=25 ctermbg=NONE cterm=NONE hi Type ctermfg=130 ctermbg=NONE cterm=NONE hi PreProc ctermfg=30 ctermbg=NONE cterm=NONE - hi Special ctermfg=93 ctermbg=NONE cterm=NONE + hi Special ctermfg=56 ctermbg=NONE cterm=NONE hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=25 ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=249 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=22 ctermbg=151 cterm=NONE hi DiffChange ctermfg=235 ctermbg=253 cterm=NONE @@ -339,14 +349,14 @@ endif if s:t_Co >= 16 if &background ==# 'dark' hi Normal ctermfg=grey ctermbg=black cterm=NONE - hi Statusline ctermfg=grey ctermbg=black cterm=reverse + hi Statusline ctermfg=grey ctermbg=black cterm=bold,reverse hi StatuslineNC ctermfg=darkgrey ctermbg=black cterm=reverse - hi VertSplit ctermfg=darkgrey ctermbg=darkgrey cterm=NONE - hi TabLine ctermfg=black ctermbg=grey cterm=NONE - hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE - hi TabLineSel ctermfg=white ctermbg=black cterm=NONE + hi VertSplit ctermfg=darkgrey ctermbg=NONE cterm=NONE + hi TabLine ctermfg=black ctermbg=darkgrey cterm=NONE + hi TabLineFill ctermfg=NONE ctermbg=black cterm=NONE + hi TabLineSel ctermfg=black ctermbg=grey cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton ctermfg=black ctermbg=white cterm=NONE + hi ToolbarButton ctermfg=black ctermbg=grey cterm=NONE hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE hi CursorLineNr ctermfg=white ctermbg=NONE cterm=bold hi LineNr ctermfg=grey ctermbg=NONE cterm=NONE @@ -362,6 +372,8 @@ if s:t_Co >= 16 hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE hi PmenuExtra ctermfg=darkgrey ctermbg=grey cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=darkred ctermbg=white cterm=reverse hi ErrorMsg ctermfg=darkred ctermbg=white cterm=reverse @@ -375,17 +387,17 @@ if s:t_Co >= 16 hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse - hi Visual ctermfg=darkblue ctermbg=black cterm=reverse + hi Visual ctermfg=cyan ctermbg=black cterm=reverse hi VisualNOS ctermfg=black ctermbg=blue cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE hi Folded ctermfg=black ctermbg=NONE cterm=bold hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline - hi SpellBad ctermfg=darkred ctermbg=white cterm=reverse - hi SpellCap ctermfg=darkcyan ctermbg=black cterm=reverse - hi SpellLocal ctermfg=green ctermbg=black cterm=reverse - hi SpellRare ctermfg=magenta ctermbg=black cterm=reverse + hi SpellBad ctermfg=darkred ctermbg=NONE cterm=underline + hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=green ctermbg=NONE cterm=underline + hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Constant ctermfg=red ctermbg=NONE cterm=NONE hi String ctermfg=green ctermbg=NONE cterm=NONE @@ -397,7 +409,7 @@ if s:t_Co >= 16 hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=blue ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE @@ -409,14 +421,14 @@ if s:t_Co >= 16 else " Light background hi Normal ctermfg=black ctermbg=white cterm=NONE - hi Statusline ctermfg=white ctermbg=darkgrey cterm=NONE + hi Statusline ctermfg=white ctermbg=darkgrey cterm=bold hi StatuslineNC ctermfg=black ctermbg=lightgrey cterm=NONE - hi VertSplit ctermfg=lightgrey ctermbg=lightgrey cterm=NONE + hi VertSplit ctermfg=darkgrey ctermbg=NONE cterm=NONE hi TabLine ctermfg=black ctermbg=lightgrey cterm=NONE - hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE - hi TabLineSel ctermfg=white ctermbg=black cterm=reverse + hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=darkgrey ctermbg=white cterm=bold,reverse hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE - hi ToolbarButton ctermfg=white ctermbg=black cterm=NONE + hi ToolbarButton ctermfg=white ctermbg=darkgrey cterm=NONE hi QuickFixLine ctermfg=white ctermbg=darkmagenta cterm=NONE hi CursorLineNr ctermfg=black ctermbg=NONE cterm=bold hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE @@ -432,6 +444,8 @@ if s:t_Co >= 16 hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE hi PmenuExtra ctermfg=darkgrey ctermbg=grey cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=red ctermbg=white cterm=reverse hi ErrorMsg ctermfg=red ctermbg=white cterm=reverse @@ -439,7 +453,7 @@ if s:t_Co >= 16 hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Question ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi WarningMsg ctermfg=darkyellow ctermbg=NONE cterm=NONE - hi Todo ctermfg=darkred ctermbg=white cterm=reverse + hi Todo ctermfg=blue ctermbg=white cterm=reverse hi Search ctermfg=white ctermbg=darkgreen cterm=NONE hi IncSearch ctermfg=white ctermbg=yellow cterm=NONE hi WildMenu ctermfg=white ctermbg=yellow cterm=NONE @@ -452,10 +466,10 @@ if s:t_Co >= 16 hi Folded ctermfg=black ctermbg=NONE cterm=bold hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline - hi SpellBad ctermfg=red ctermbg=white cterm=reverse - hi SpellCap ctermfg=darkcyan ctermbg=white cterm=reverse - hi SpellLocal ctermfg=darkgreen ctermbg=white cterm=reverse - hi SpellRare ctermfg=magenta ctermbg=white cterm=reverse + hi SpellBad ctermfg=red ctermbg=NONE cterm=underline + hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=underline + hi SpellLocal ctermfg=darkgreen ctermbg=NONE cterm=underline + hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE @@ -463,11 +477,11 @@ if s:t_Co >= 16 hi Statement ctermfg=darkblue ctermbg=NONE cterm=NONE hi Type ctermfg=darkyellow ctermbg=NONE cterm=NONE hi PreProc ctermfg=darkcyan ctermbg=NONE cterm=NONE - hi Special ctermfg=darkred ctermbg=NONE cterm=NONE + hi Special ctermfg=blue ctermbg=NONE cterm=NONE hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline hi Title ctermfg=NONE ctermbg=NONE cterm=bold hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold - hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE + hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE @@ -486,10 +500,10 @@ if s:t_Co >= 8 hi Normal ctermfg=grey ctermbg=black cterm=NONE hi Statusline ctermfg=grey ctermbg=black cterm=bold,reverse hi StatuslineNC ctermfg=black ctermbg=grey cterm=NONE - hi VertSplit ctermfg=grey ctermbg=grey cterm=NONE - hi TabLine ctermfg=grey ctermbg=black cterm=reverse - hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE - hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE + hi VertSplit ctermfg=grey ctermbg=NONE cterm=NONE + hi TabLine ctermfg=grey ctermbg=black cterm=NONE + hi TabLineFill ctermfg=grey ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=grey ctermbg=black cterm=bold,reverse hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse hi QuickFixLine ctermfg=black ctermbg=darkmagenta cterm=NONE @@ -507,6 +521,8 @@ if s:t_Co >= 8 hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE hi PmenuExtra ctermfg=black ctermbg=grey cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=grey ctermbg=darkred cterm=NONE hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE @@ -553,10 +569,10 @@ if s:t_Co >= 8 hi Normal ctermfg=black ctermbg=grey cterm=NONE hi Statusline ctermfg=grey ctermbg=black cterm=bold hi StatuslineNC ctermfg=grey ctermbg=darkgrey cterm=NONE - hi VertSplit ctermfg=black ctermbg=black cterm=NONE - hi TabLine ctermfg=black ctermbg=grey cterm=reverse - hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE - hi TabLineSel ctermfg=black ctermbg=grey cterm=NONE + hi VertSplit ctermfg=black ctermbg=NONE cterm=NONE + hi TabLine ctermfg=black ctermbg=grey cterm=NONE + hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE + hi TabLineSel ctermfg=grey ctermbg=black cterm=bold hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold hi QuickFixLine ctermfg=black ctermbg=darkmagenta cterm=NONE @@ -574,6 +590,8 @@ if s:t_Co >= 8 hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE hi PmenuExtra ctermfg=grey ctermbg=black cterm=NONE hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE + hi PmenuMatch ctermfg=grey ctermbg=black cterm=bold + hi PmenuMatchSel ctermfg=NONE ctermbg=darkyellow cterm=bold hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE hi Error ctermfg=white ctermbg=darkred cterm=NONE hi ErrorMsg ctermfg=white ctermbg=darkred cterm=NONE @@ -581,7 +599,7 @@ if s:t_Co >= 8 hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Question ctermfg=darkmagenta ctermbg=NONE cterm=NONE hi WarningMsg ctermfg=darkyellow ctermbg=NONE cterm=NONE - hi Todo ctermfg=darkred ctermbg=black cterm=reverse + hi Todo ctermfg=blue ctermbg=black cterm=reverse hi Search ctermfg=darkgreen ctermbg=black cterm=reverse hi IncSearch ctermfg=darkyellow ctermbg=black cterm=reverse hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE @@ -715,6 +733,8 @@ endif " Color: colorlC #ff5fff 207 magenta " Color: colorDim #878787 102 grey " Color: colorMP #ff00af 199 magenta +" Color: colorV #5fd7ff 81 cyan +" Color: colorSt #9e9e9e 247 grey " Color: diffAdd #5f875f 65 darkgreen " Color: diffAddFg #afffaf 157 black " Color: diffDelete #875f5f 95 darkred @@ -742,7 +762,7 @@ endif " Color: color14 #00afaf 37 cyan " Color: color07 #8a8a8a 245 grey " Color: color15 #ffffff 231 white -" Color: color16 #8700ff 93 darkred +" Color: color16 #5f00d7 56 blue " Color: colorCm #8a8a8a 245 darkgrey " Color: colorLine #EEEEEE 255 grey " Color: colorB #E4E4E4 254 grey @@ -750,7 +770,7 @@ endif " Color: colorTab #d0d0d0 252 lightgrey " Color: colorC #000000 16 black " Color: colorlC #FF00FF 201 magenta -" Color: colorV #5F87AF 67 darkblue +" Color: colorV #0087af 31 darkcyan " Color: colorDim #626262 241 darkgrey " Color: colorSt #5f5f5f 59 darkgrey " Color: colorMP #ff00af 199 magenta diff --git a/runtime/colors/zaibatsu.vim b/runtime/colors/zaibatsu.vim index 726843345bcb9b..49047617c45ec5 100644 --- a/runtime/colors/zaibatsu.vim +++ b/runtime/colors/zaibatsu.vim @@ -4,7 +4,7 @@ " Maintainer: Romain Lafourcade " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:43 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -40,6 +40,8 @@ hi PmenuExtra guifg=#878092 guibg=#ffffff gui=NONE cterm=NONE hi! link PmenuExtraSel PmenuSel hi PmenuKind guifg=#878092 guibg=#ffffff gui=NONE cterm=NONE hi! link PmenuKindSel PmenuSel +hi PmenuMatch guifg=#d700ff guibg=#ffffff gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#d700ff guibg=#afafff gui=NONE cterm=NONE hi ColorColumn guifg=NONE guibg=#510039 gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#362b49 gui=NONE cterm=NONE hi CursorColumn guifg=NONE guibg=#362b49 gui=NONE cterm=NONE @@ -94,6 +96,7 @@ hi! link TabLineFill StatusLineNC hi! link TabLineSel StatusLine hi! link Terminal Normal hi! link lCursor Cursor +hi! link PopupSelected PmenuSel hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement @@ -143,6 +146,8 @@ if s:t_Co >= 256 hi! link PmenuExtraSel PmenuSel hi PmenuKind ctermfg=103 ctermbg=231 cterm=NONE hi! link PmenuKindSel PmenuSel + hi PmenuMatch ctermfg=165 ctermbg=231 cterm=NONE + hi PmenuMatchSel ctermfg=165 ctermbg=147 cterm=NONE hi ColorColumn ctermfg=NONE ctermbg=52 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE @@ -197,6 +202,7 @@ if s:t_Co >= 256 hi! link TabLineSel StatusLine hi! link Terminal Normal hi! link lCursor Cursor + hi! link PopupSelected PmenuSel hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement @@ -249,6 +255,8 @@ if s:t_Co >= 16 hi! link PmenuExtraSel PmenuSel hi PmenuKind ctermfg=darkgray ctermbg=white cterm=NONE hi! link PmenuKindSel PmenuSel + hi PmenuMatch ctermfg=black ctermbg=white cterm=bold + hi PmenuMatchSel ctermfg=white ctermbg=blue cterm=bold hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=NONE ctermbg=blue cterm=NONE @@ -303,6 +311,7 @@ if s:t_Co >= 16 hi! link TabLineSel StatusLine hi! link Terminal Normal hi! link lCursor Cursor + hi! link PopupSelected PmenuSel hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement @@ -355,6 +364,8 @@ if s:t_Co >= 8 hi! link PmenuExtraSel PmenuSel hi! link PmenuKind Pmenu hi! link PmenuKindSel PmenuSel + hi PmenuMatch ctermfg=black ctermbg=white cterm=bold + hi PmenuMatchSel ctermfg=white ctermbg=blue cterm=bold hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline hi CursorColumn ctermfg=NONE ctermbg=blue cterm=NONE @@ -409,6 +420,7 @@ if s:t_Co >= 8 hi! link TabLineSel StatusLine hi! link Terminal Normal hi! link lCursor Cursor + hi! link PopupSelected PmenuSel hi! link Boolean Constant hi! link Character Constant hi! link Conditional Statement diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim index 37f012e92d1472..298ec0f70049b3 100644 --- a/runtime/colors/zellner.vim +++ b/runtime/colors/zellner.vim @@ -4,7 +4,7 @@ " Maintainer: Original maintainer Ron Aaron " Website: https://github.com/vim/colorschemes " License: Same as Vim -" Last Updated: Fri 15 Dec 2023 20:05:44 +" Last Change: 2025 Jan 07 " Generated by Colortemplate v2.2.3 @@ -31,6 +31,7 @@ hi! link CursorLineFold CursorLine hi! link CursorLineSign CursorLine hi! link MessageWindow Pmenu hi! link PopupNotification Todo +hi! link PopupSelected PmenuSel hi Normal guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE hi Folded guifg=#00008b guibg=#d3d3d3 gui=NONE cterm=NONE hi CursorLine guifg=NONE guibg=#e5e5e5 gui=NONE cterm=NONE @@ -47,6 +48,8 @@ hi Pmenu guifg=#000000 guibg=#dadada gui=NONE cterm=NONE hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE hi PmenuSbar guifg=NONE guibg=#ffffff gui=NONE cterm=NONE hi PmenuThumb guifg=NONE guibg=#a9a9a9 gui=NONE cterm=NONE +hi PmenuMatch guifg=#a52a2a guibg=#dadada gui=NONE cterm=NONE +hi PmenuMatchSel guifg=#a52a2a guibg=#ffff00 gui=NONE cterm=NONE hi TabLine guifg=#000000 guibg=#a9a9a9 gui=underline cterm=underline hi TabLineFill guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel guifg=#000000 guibg=#ffffff gui=bold cterm=bold @@ -87,7 +90,7 @@ hi Type guifg=#0000ff guibg=NONE gui=NONE cterm=NONE hi Special guifg=#ff00ff guibg=NONE gui=NONE cterm=NONE hi Tag guifg=#006400 guibg=NONE gui=NONE cterm=NONE hi Directory guifg=#0000ff guibg=NONE gui=bold cterm=bold -hi Conceal guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE +hi Conceal guifg=#a9a9a9 guibg=NONE gui=NONE cterm=NONE hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE hi Title guifg=#a020f0 guibg=NONE gui=bold cterm=bold hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE @@ -104,6 +107,7 @@ if s:t_Co >= 256 hi! link CursorLineSign CursorLine hi! link MessageWindow Pmenu hi! link PopupNotification Todo + hi! link PopupSelected PmenuSel hi Normal ctermfg=16 ctermbg=231 cterm=NONE hi Folded ctermfg=18 ctermbg=252 cterm=NONE hi CursorLine ctermfg=NONE ctermbg=254 cterm=NONE @@ -120,6 +124,8 @@ if s:t_Co >= 256 hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=231 cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=248 cterm=NONE + hi PmenuMatch ctermfg=124 ctermbg=253 cterm=NONE + hi PmenuMatchSel ctermfg=124 ctermbg=226 cterm=NONE hi TabLine ctermfg=16 ctermbg=248 cterm=underline hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold @@ -160,7 +166,7 @@ if s:t_Co >= 256 hi Special ctermfg=201 ctermbg=NONE cterm=NONE hi Tag ctermfg=22 ctermbg=NONE cterm=NONE hi Directory ctermfg=21 ctermbg=NONE cterm=bold - hi Conceal ctermfg=196 ctermbg=NONE cterm=NONE + hi Conceal ctermfg=248 ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=129 ctermbg=NONE cterm=bold hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE @@ -188,6 +194,8 @@ if s:t_Co >= 16 hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=white cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkgrey cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold hi TabLine ctermfg=black ctermbg=grey cterm=underline hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=black ctermbg=white cterm=bold @@ -228,7 +236,7 @@ if s:t_Co >= 16 hi Special ctermfg=magenta ctermbg=NONE cterm=NONE hi Tag ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Directory ctermfg=blue ctermbg=NONE cterm=bold - hi Conceal ctermfg=red ctermbg=NONE cterm=NONE + hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE @@ -256,6 +264,8 @@ if s:t_Co >= 8 hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE hi PmenuThumb ctermfg=NONE ctermbg=darkmagenta cterm=NONE + hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold + hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold hi TabLine ctermfg=black ctermbg=gray cterm=reverse hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse hi TabLineSel ctermfg=gray ctermbg=black cterm=bold,reverse @@ -293,7 +303,7 @@ if s:t_Co >= 8 hi Type ctermfg=darkblue ctermbg=NONE cterm=bold hi Special ctermfg=darkgreen ctermbg=NONE cterm=NONE hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold - hi Conceal ctermfg=darkred ctermbg=NONE cterm=NONE + hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE diff --git a/runtime/compiler/README.txt b/runtime/compiler/README.txt index dccf4a97629be5..327d0a7fded57e 100644 --- a/runtime/compiler/README.txt +++ b/runtime/compiler/README.txt @@ -4,6 +4,8 @@ They are used with the ":compiler" command. These scripts usually set options, for example 'errorformat'. See ":help write-compiler-plugin". +To undo the effect of a compiler plugin, use the make compiler plugin. + If you want to write your own compiler plugin, have a look at the other files for how to do it, the format is simple. diff --git a/runtime/compiler/bash.vim b/runtime/compiler/bash.vim new file mode 100644 index 00000000000000..cbd76ae410a62c --- /dev/null +++ b/runtime/compiler/bash.vim @@ -0,0 +1,12 @@ +" Vim compiler file +" Compiler: Bash Syntax Checker +" Maintainer: @konfekt +" Last Change: 2024 Dec 27 + +if exists("current_compiler") + finish +endif +let current_compiler = "bash" + +CompilerSet makeprg=bash\ -n +CompilerSet errorformat=%f:\ line\ %l:\ %m diff --git a/runtime/compiler/cppcheck.vim b/runtime/compiler/cppcheck.vim new file mode 100644 index 00000000000000..033613c091ada9 --- /dev/null +++ b/runtime/compiler/cppcheck.vim @@ -0,0 +1,40 @@ +" vim compiler file +" Compiler: cppcheck (C++ static checker) +" Maintainer: Vincent B. (twinside@free.fr) +" Last Change: 2024 Nov 19 by @Konfekt + +if exists("current_compiler") | finish | endif +let current_compiler = "cppcheck" + +let s:cpo_save = &cpo +set cpo&vim + +let s:slash = has('win32')? '\' : '/' + +if !exists('g:c_cppcheck_params') + let g:c_cppcheck_params = '--verbose --force --inline-suppr' + \ ..' '..'--enable=warning,style,performance,portability,information,missingInclude' + \ ..' '..(executable('getconf') ? '-j' .. systemlist('getconf _NPROCESSORS_ONLN')[0] : '') + let s:undo_compiler = 'unlet! g:c_cppcheck_params' +endif + +let &l:makeprg = 'cppcheck --quiet' + \ ..' --template="{file}:{line}:{column}: {severity}: [{id}] {message} {callstack}"' + \ ..' '..get(b:, 'c_cppcheck_params', get(g:, 'c_cppcheck_params', (&filetype ==# 'cpp' ? ' --language=c++' : ''))) + \ ..' '..get(b:, 'c_cppcheck_includes', get(g:, 'c_cppcheck_includes', + \ (filereadable('compile_commands.json') ? '--project=compile_commands.json' : + \ (!empty(glob('*'..s:slash..'compile_commands.json', 1, 1)) ? '--project='..glob('*'..s:slash..'compile_commands.json', 1, 1)[0] : + \ (empty(&path) ? '' : '-I')..join(map(filter(split(&path, ','), 'isdirectory(v:val)'),'shellescape(v:val)'), ' -I'))))) +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') + +CompilerSet errorformat= + \%f:%l:%c:\ %tarning:\ %m, + \%f:%l:%c:\ %trror:\ %m, + \%f:%l:%c:\ %tnformation:\ %m, + \%f:%l:%c:\ %m, + \%.%#\ :\ [%f:%l]\ %m + +exe get(s:, 'undo_compiler', '') + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/compiler/eslint.vim b/runtime/compiler/eslint.vim index db7a665991e610..0414817900554a 100644 --- a/runtime/compiler/eslint.vim +++ b/runtime/compiler/eslint.vim @@ -1,13 +1,12 @@ " Vim compiler file " Compiler: ESLint for JavaScript " Maintainer: Romain Lafourcade -" Last Change: 2020 August 20 -" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition) +" Last Change: 2024 Nov 30 if exists("current_compiler") finish endif let current_compiler = "eslint" -CompilerSet makeprg=npx\ eslint\ --format\ compact -CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m,%-G%.%# +CompilerSet makeprg=npx\ eslint\ --format\ stylish +CompilerSet errorformat=%-P%f,\%\\s%#%l:%c\ %#\ %trror\ \ %m,\%\\s%#%l:%c\ %#\ %tarning\ \ %m,\%-Q,\%-G%.%#, diff --git a/runtime/compiler/groff.vim b/runtime/compiler/groff.vim new file mode 100644 index 00000000000000..3e9ae0488fc4e2 --- /dev/null +++ b/runtime/compiler/groff.vim @@ -0,0 +1,45 @@ +" Vim compiler file +" Compiler: Groff +" Maintainer: Konfekt +" Last Change: 2024 Nov 19 +" +" Expects output file extension, say `:make html` or `:make pdf`. +" Supported devices as of Sept 2024 are: (x)html, pdf, ps, dvi, lj4, lbp ... +" Adjust command-line flags, language, encoding by buffer-local/global variables +" groff_compiler_args, groff_compiler_lang, and groff_compiler_encoding, +" which default to '', &spelllang and 'utf8'. + +if exists("current_compiler") + finish +endif + +let s:keepcpo = &cpo +set cpo&vim + +let current_compiler = 'groff' + +silent! function s:groff_compiler_lang() + let lang = get(b:, 'groff_compiler_lang', + \ &spell ? matchstr(&spelllang, '^\a\a') : '') + if lang ==# 'en' | let lang = '' | endif + return empty(lang) ? '' : '-m'..lang +endfunction + +" Requires output format (= device) to be set by user after :make. +execute 'CompilerSet makeprg=groff'..escape( + \ ' '..s:groff_compiler_lang().. + \ ' -K'..get(b:, 'groff_compiler_encoding', get(g:, 'groff_compiler_encoding', 'utf8')).. + \ ' '..get(b:, 'groff_compiler_args', get(g:, 'groff_compiler_args', '')).. + \ ' -mom -T$* -- %:S > %:r:S.$*', ' \|"') +" From Gavin Freeborn's https://github.com/Gavinok/vim-troff under Vim License +" https://github.com/Gavinok/vim-troff/blob/91017b1423caa80aba541c997909a4f810edd275/compiler/troff.vim#L39 +CompilerSet errorformat=%o:\ (%f):%l:%m, + \%o:\ \ (%f):%l:%m, + \%o:%f:%l:%m, + \%o:\ %f:%l:%m, + \%f:%l:\ macro\ %trror:%m, + \%f:%l:%m, + \%W%tarning:\ file\ '%f'\\,\ around\ line\ %l:,%Z%m + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/hare.vim b/runtime/compiler/hare.vim index c98bbb9c63961e..33edb3a2813536 100644 --- a/runtime/compiler/hare.vim +++ b/runtime/compiler/hare.vim @@ -1,28 +1,29 @@ -" Vim compiler file -" Compiler: Hare Compiler -" Maintainer: Amelia Clarke -" Last Change: 2022-09-21 -" 2024 Apr 05 by The Vim Project (removed :CompilerSet definition) +" Vim compiler file. +" Compiler: Hare +" Maintainer: Amelia Clarke +" Last Change: 2024-05-23 +" Upstream: https://git.sr.ht/~sircmpwn/hare.vim -if exists("g:current_compiler") +if exists('current_compiler') finish endif -let g:current_compiler = "hare" +let current_compiler = 'hare' let s:cpo_save = &cpo set cpo&vim -if filereadable("Makefile") || filereadable("makefile") +if filereadable('Makefile') || filereadable('makefile') CompilerSet makeprg=make else CompilerSet makeprg=hare\ build endif CompilerSet errorformat= - \Error\ %f:%l:%c:\ %m, - \Syntax\ error:\ %.%#\ at\ %f:%l:%c\\,\ %m, + \%f:%l:%c:\ syntax\ error:\ %m, + \%f:%l:%c:\ error:\ %m, \%-G%.%# let &cpo = s:cpo_save unlet s:cpo_save -" vim: tabstop=2 shiftwidth=2 expandtab + +" vim: et sts=2 sw=2 ts=8 diff --git a/runtime/compiler/javac.vim b/runtime/compiler/javac.vim index f5fe84124f51fe..53cd772ed8a02f 100644 --- a/runtime/compiler/javac.vim +++ b/runtime/compiler/javac.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Java Development Kit Compiler " Maintainer: Doug Kearns -" Last Change: 2024 Apr 03 +" Last Change: 2024 Nov 19 (enable local javac_makeprg_params) if exists("current_compiler") finish @@ -11,7 +11,8 @@ let current_compiler = "javac" let s:cpo_save = &cpo set cpo&vim -CompilerSet makeprg=javac +execute $'CompilerSet makeprg=javac\ {escape(get(b:, 'javac_makeprg_params', get(g:, 'javac_makeprg_params', '')), ' \|"')}' + CompilerSet errorformat=%E%f:%l:\ error:\ %m, \%W%f:%l:\ warning:\ %m, \%-Z%p^, diff --git a/runtime/compiler/jq.vim b/runtime/compiler/jq.vim new file mode 100644 index 00000000000000..a656223e513f55 --- /dev/null +++ b/runtime/compiler/jq.vim @@ -0,0 +1,25 @@ +" Vim compiler file +" Compiler: jq +" Maintainer: Vito +" Last Change: 2024 Apr 17 +" Upstream: https://github.com/vito-c/jq.vim + +if exists('b:current_compiler') + finish +endif +let b:current_compiler = 'jq' + +let s:save_cpoptions = &cpoptions +set cpoptions&vim + +if has('unix') + CompilerSet makeprg=jq\ -f\ %:S\ /dev/null +else + CompilerSet makeprg=jq\ -f\ %:S\ nul +endif +CompilerSet errorformat=%E%m\ at\ \\<%o\\>\\,\ line\ %l:, + \%Z, + \%-G%.%# + +let &cpoptions = s:save_cpoptions +unlet s:save_cpoptions diff --git a/runtime/compiler/make.vim b/runtime/compiler/make.vim new file mode 100644 index 00000000000000..748251bf8ee221 --- /dev/null +++ b/runtime/compiler/make.vim @@ -0,0 +1,13 @@ +" Vim compiler plugin +" +" Maintainer: The Vim Project +" Last Change: 2024 Sep 10 +" Original Author: Konfekt +" +" This compiler plugin is used to reset previously set compiler options. + +if exists("g:current_compiler") | unlet g:current_compiler | endif +if exists("b:current_compiler") | unlet b:current_compiler | endif + +CompilerSet makeprg& +CompilerSet errorformat& diff --git a/runtime/compiler/maven.vim b/runtime/compiler/maven.vim new file mode 100644 index 00000000000000..72e74e301da769 --- /dev/null +++ b/runtime/compiler/maven.vim @@ -0,0 +1,40 @@ +" Vim compiler file +" Compiler: Maven +" Maintainer: D. Ben Knoble +" Maintainer: Konfekt +" Original Source: https://github.com/JalaiAmitahl/maven-compiler.vim/blob/master/compiler/mvn.vim +" (Copyright Dan Taylor, distributed under the same terms as LICENSE) +" Original Source: https://github.com/mikelue/vim-maven-plugin/blob/master/compiler/maven.vim +" (distributed under same terms as LICENSE per +" https://github.com/mikelue/vim-maven-plugin/issues/13) +" Last Change: 2024 Nov 12 + +if exists("current_compiler") + finish +endif +let current_compiler = "maven" + +execute $'CompilerSet makeprg=mvn\ --batch-mode\ {escape(get(b:, 'maven_makeprg_params', get(g:, 'maven_makeprg_params', '')), ' \|"')}' + +" Error message for POM +CompilerSet errorformat=[FATAL]\ Non-parseable\ POM\ %f:\ %m%\\s%\\+@%.%#line\ %l\\,\ column\ %c%.%#, +CompilerSet errorformat+=[%tRROR]\ Malformed\ POM\ %f:\ %m%\\s%\\+@%.%#line\ %l\\,\ column\ %c%.%# + +" Java related build messages +CompilerSet errorformat+=[%tARNING]\ %f:[%l\\,%c]\ %m +CompilerSet errorformat+=[%tRROR]\ %f:[%l\\,%c]\ %m +CompilerSet errorformat+=%A[%t%[A-Z]%#]\ %f:[%l\\,%c]\ %m,%Z +CompilerSet errorformat+=%A%f:[%l\\,%c]\ %m,%Z + +" jUnit related build messages +CompilerSet errorformat+=%+E\ \ %#test%m,%Z +CompilerSet errorformat+=%+E[ERROR]\ Please\ refer\ to\ %f\ for\ the\ individual\ test\ results. +" Message from JUnit 5(5.3.X), TestNG(6.14.X), JMockit(1.43), and AssertJ(3.11.X) +CompilerSet errorformat+=%+E%>[ERROR]\ %.%\\+Time\ elapsed:%.%\\+<<<\ FAILURE!, +CompilerSet errorformat+=%+E%>[ERROR]\ %.%\\+Time\ elapsed:%.%\\+<<<\ ERROR!, +CompilerSet errorformat+=%+Z%\\s%#at\ %f(%\\f%\\+:%l), +CompilerSet errorformat+=%+C%.%# + +" Misc message removal +CompilerSet errorformat+=%-G[INFO]\ %.%#, +CompilerSet errorformat+=%-G[debug]\ %.%# diff --git a/runtime/compiler/mypy.vim b/runtime/compiler/mypy.vim new file mode 100644 index 00000000000000..907b98b777ea4d --- /dev/null +++ b/runtime/compiler/mypy.vim @@ -0,0 +1,19 @@ +" Vim compiler file +" Compiler: Mypy (Python static checker) +" Maintainer: @Konfekt +" Last Change: 2024 Nov 19 + +if exists("current_compiler") | finish | endif +let current_compiler = "mypy" + +let s:cpo_save = &cpo +set cpo&vim + +" CompilerSet makeprg=mypy +let &l:makeprg = 'mypy --show-column-numbers ' + \ ..get(b:, 'mypy_makeprg_params', get(g:, 'mypy_makeprg_params', '--strict --ignore-missing-imports')) +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') +CompilerSet errorformat=%f:%l:%c:\ %t%*[^:]:\ %m + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/compiler/pandoc.vim b/runtime/compiler/pandoc.vim index 6c151930c5c0c8..5d90a518c98d36 100644 --- a/runtime/compiler/pandoc.vim +++ b/runtime/compiler/pandoc.vim @@ -1,9 +1,12 @@ " Vim compiler file " Compiler: Pandoc " Maintainer: Konfekt +" Last Change: 2024 Nov 19 " " Expects output file extension, say `:make html` or `:make pdf`. " Passes additional arguments to pandoc, say `:make html --self-contained`. +" Adjust command-line flags by buffer-local/global variable +" b/g:pandoc_compiler_args which defaults to empty. if exists("current_compiler") finish @@ -25,31 +28,36 @@ let s:supported_filetypes = silent! function s:PandocFiletype(filetype) abort let ft = a:filetype - if ft ==# 'pandoc' - return 'markdown' - elseif ft ==# 'tex' - return 'latex' - elseif ft ==# 'xml' - " Pandoc does not support XML as a generic input format, but it does support - " EndNote XML and Jats XML out of which the latter seems more universal. - return 'jats' - elseif ft ==# 'text' || empty(ft) - return 'markdown' - elseif index(s:supported_filetypes, &ft) >= 0 - return ft + + if ft ==# 'pandoc' | return 'markdown' + elseif ft ==# 'tex' | return 'latex' + " Pandoc does not support XML as a generic input format, but it does support + " EndNote XML and Jats XML out of which the latter seems more universal. + elseif ft ==# 'xml' | return 'jats' + elseif ft ==# 'text' || empty(ft) | return 'markdown' + elseif index(s:supported_filetypes, &ft) >= 0 | return ft else - echomsg 'Unsupported filetype: ' . ft . ', falling back to Markdown as input format!' + echomsg 'Unsupported filetype: '..ft..', falling back to Markdown as input format!' return 'markdown' endif endfunction -execute 'CompilerSet makeprg=pandoc\ --standalone' . - \ '\ --metadata\ title=%:t:r:S' . - \ '\ --metadata\ lang=' . matchstr(&spelllang, '^\a\a') . - \ '\ --from=' . s:PandocFiletype(&filetype) . - \ '\ ' . escape(get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')), ' ') . - \ '\ --output\ %:r:S.$*\ %:S' - -CompilerSet errorformat="%f",\ line\ %l:\ %m + +silent! function s:PandocLang() + let lang = get(b:, 'pandoc_compiler_lang', + \ &spell ? matchstr(&spelllang, '^\a\a') : '') + if lang ==# 'en' | let lang = '' | endif + return empty(lang) ? '' : '--metadata lang='..lang +endfunction + +execute 'CompilerSet makeprg=pandoc'..escape( + \ ' --standalone'.. + \ (s:PandocFiletype(&filetype) ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ? + \ '' : ' --metadata title=%:t:r:S').. + \ ' '..s:PandocLang().. + \ ' --from='..s:PandocFiletype(&filetype).. + \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')).. + \ ' --output %:r:S.$* -- %:S', ' \|"') +CompilerSet errorformat=\"%f\",\ line\ %l:\ %m let &cpo = s:keepcpo unlet s:keepcpo diff --git a/runtime/compiler/powershell.vim b/runtime/compiler/powershell.vim index 821fea40859f57..3d37d7c847775f 100644 --- a/runtime/compiler/powershell.vim +++ b/runtime/compiler/powershell.vim @@ -3,8 +3,9 @@ " URL: https://github.com/PProvost/vim-ps1 " Contributors: Enno Nagel " Last Change: 2024 Mar 29 -" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition) -" 2024 Apr 05 by The Vim Project (avoid leaving behind g:makeprg) +" 2024 Apr 03 by the Vim Project (removed :CompilerSet definition) +" 2024 Apr 05 by the Vim Project (avoid leaving behind g:makeprg) +" 2024 Nov 19 by the Vim Project (properly escape makeprg setting) if exists("current_compiler") finish @@ -49,7 +50,7 @@ let s:makeprg = g:ps1_makeprg_cmd .. ' %:p:S' " + CategoryInfo : ObjectNotFound: (Write-Ouput:String) [], CommandNotFoundException " + FullyQualifiedErrorId : CommandNotFoundException -execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' ') +execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' \|"') " Showing error in context with underlining. CompilerSet errorformat=%+G+%m diff --git a/runtime/compiler/pylint.vim b/runtime/compiler/pylint.vim index 14e9696dbb4c5d..96abf315ab7c4b 100644 --- a/runtime/compiler/pylint.vim +++ b/runtime/compiler/pylint.vim @@ -1,13 +1,21 @@ " Vim compiler file -" Compiler: Pylint for Python -" Maintainer: Daniel Moch -" Last Change: 2016 May 20 -" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition) - -if exists("current_compiler") - finish -endif +" Compiler: Pylint for Python +" Maintainer: Daniel Moch +" Last Change: 2024 Nov 07 by The Vim Project (added params variable) +" 2024 Nov 19 by the Vim Project (properly escape makeprg setting) + +if exists("current_compiler") | finish | endif let current_compiler = "pylint" -CompilerSet makeprg=pylint\ --output-format=text\ --msg-template=\"{path}:{line}:{column}:{C}:\ [{symbol}]\ {msg}\"\ --reports=no +let s:cpo_save = &cpo +set cpo&vim + +" CompilerSet makeprg=ruff +let &l:makeprg = 'pylint ' . + \ '--output-format=text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" --reports=no ' . + \ get(b:, "pylint_makeprg_params", get(g:, "pylint_makeprg_params", '--jobs=0')) +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') CompilerSet errorformat=%A%f:%l:%c:%t:\ %m,%A%f:%l:\ %m,%A%f:(%l):\ %m,%-Z%p^%.%#,%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/compiler/pytest.vim b/runtime/compiler/pytest.vim new file mode 100644 index 00000000000000..7fc189932c0e85 --- /dev/null +++ b/runtime/compiler/pytest.vim @@ -0,0 +1,103 @@ +" Vim compiler file +" Compiler: Pytest (Python testing framework) +" Maintainer: @Konfekt and @mgedmin +" Last Change: 2024 Nov 28 + +if exists("current_compiler") | finish | endif +let current_compiler = "pytest" + +let s:cpo_save = &cpo +set cpo&vim + +" CompilerSet makeprg=pytest +if has('unix') + execute $'CompilerSet makeprg=/usr/bin/env\ PYTHONWARNINGS=ignore\ pytest\ {escape(get(b:, 'pytest_makeprg_params', get(g:, 'pytest_makeprg_params', '--tb=short --quiet')), ' \|"')}' +elseif has('win32') + execute $'CompilerSet makeprg=set\ PYTHONWARNINGS=ignore\ &&\ pytest\ {escape(get(b:, 'pytest_makeprg_params', get(g:, 'pytest_makeprg_params', '--tb=short --quiet')), ' \|"')}' +else + CompilerSet makeprg=pytest\ --tb=short\ --quiet + execute $'CompilerSet makeprg=pytest\ {escape(get(b:, 'pytest_makeprg_params', get(g:, 'pytest_makeprg_params', '--tb=short --quiet')), ' \|"')}' +endif + +" Pytest syntax errors {{{2 + +" Reset error format so that sourcing .vimrc again and again doesn't grow it +" without bounds +setlocal errorformat& + +" For the record, the default errorformat is this: +" +" %*[^"]"%f"%*\D%l: %m +" "%f"%*\D%l: %m +" %-G%f:%l: (Each undeclared identifier is reported only once +" %-G%f:%l: for each function it appears in.) +" %-GIn file included from %f:%l:%c: +" %-GIn file included from %f:%l:%c\, +" %-GIn file included from %f:%l:%c +" %-GIn file included from %f:%l +" %-G%*[ ]from %f:%l:%c +" %-G%*[ ]from %f:%l: +" %-G%*[ ]from %f:%l\, +" %-G%*[ ]from %f:%l +" %f:%l:%c:%m +" %f(%l):%m +" %f:%l:%m +" "%f"\, line %l%*\D%c%*[^ ] %m +" %D%*\a[%*\d]: Entering directory %*[`']%f' +" %X%*\a[%*\d]: Leaving directory %*[`']%f' +" %D%*\a: Entering directory %*[`']%f' +" %X%*\a: Leaving directory %*[`']%f' +" %DMaking %*\a in %f +" %f|%l| %m +" +" and sometimes it misfires, so let's fix it up a bit +" (TBH I don't even know what compiler produces filename(lineno) so why even +" have it?) +setlocal errorformat-=%f(%l):%m + +" Sometimes Vim gets confused about ISO-8601 timestamps and thinks they're +" filenames; this is a big hammer that ignores anything filename-like on lines +" that start with at least two spaces, possibly preceded by a number and +" optional punctuation +setlocal errorformat^=%+G%\\d%#%.%\\=\ \ %.%# + +" Similar, but when the entire line starts with a date +setlocal errorformat^=%+G\\d\\d\\d\\d-\\d\\d-\\d\\d\ \\d\\d:\\d\\d%.%# + +" make: *** [Makefile:14: target] Error 1 +setlocal errorformat^=%+Gmake:\ ***\ %.%# + +" FAILED tests.py::test_with_params[YYYY-MM-DD:HH:MM:SS] - Exception: bla bla +setlocal errorformat^=%+GFAILED\ %.%# + +" AssertionError: assert ...YYYY-MM-DD:HH:MM:SS... +setlocal errorformat^=%+GAssertionError:\ %.%# + +" --- /path/to/file:before YYYY-MM-DD HH:MM:SS.ssssss +setlocal errorformat^=---%f:%m + +" +++ /path/to/file:before YYYY-MM-DD HH:MM:SS.ssssss +setlocal errorformat^=+++%f:%m + +" Sometimes pytest prepends an 'E' marker at the beginning of a traceback line +setlocal errorformat+=E\ %#File\ \"%f\"\\,\ line\ %l%.%# + +" Python tracebacks (unittest + doctest output) {{{2 + +" This collapses the entire traceback into just the last file+lineno, +" which is convenient when you want to jump to the line that failed (and not +" the top-level entry point), but it makes it impossible to see the full +" traceback, which sucks. +""setlocal errorformat+= +"" \File\ \"%f\"\\,\ line\ %l%.%#, +"" \%C\ %.%#, +"" \%-A\ \ File\ \"unittest%.py\"\\,\ line\ %.%#, +"" \%-A\ \ File\ \"%f\"\\,\ line\ 0%.%#, +"" \%A\ \ File\ \"%f\"\\,\ line\ %l%.%#, +"" \%Z%[%^\ ]%\\@=%m +setlocal errorformat+=File\ \"%f\"\\,\ line\ %l\\,%#%m + +exe 'CompilerSet errorformat='..escape(&l:errorformat, ' \|"') + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/compiler/ruff.vim b/runtime/compiler/ruff.vim new file mode 100644 index 00000000000000..318f4fe5cbdc54 --- /dev/null +++ b/runtime/compiler/ruff.vim @@ -0,0 +1,20 @@ +" Vim compiler file +" Compiler: Ruff (Python linter) +" Maintainer: @pbnj-dragon +" Last Change: 2024 Nov 07 +" 2024 Nov 19 by the Vim Project (properly escape makeprg setting) + +if exists("current_compiler") | finish | endif +let current_compiler = "ruff" + +let s:cpo_save = &cpo +set cpo&vim + +" CompilerSet makeprg=ruff +let &l:makeprg= 'ruff check --output-format=concise ' + \ ..get(b:, 'ruff_makeprg_params', get(g:, 'ruff_makeprg_params', '--preview')) +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') +CompilerSet errorformat=%f:%l:%c:\ %m,%f:%l:\ %m,%f:%l:%c\ -\ %m,%f: + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/compiler/spotbugs.vim b/runtime/compiler/spotbugs.vim new file mode 100644 index 00000000000000..72a508497658a7 --- /dev/null +++ b/runtime/compiler/spotbugs.vim @@ -0,0 +1,189 @@ +" Vim compiler file +" Compiler: Spotbugs (Java static checker; needs javac compiled classes) +" Maintainer: @konfekt and @zzzyxwvut +" Last Change: 2024 Nov 27 + +if exists('g:current_compiler') || bufname() !~# '\.java\=$' || wordcount().chars < 9 + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Unfortunately Spotbugs does not output absolute paths, so you need to +" pass the directory of the files being checked as `-sourcepath` parameter. +" The regex, auxpath and glob try to include all dependent classes of the +" current buffer. See https://github.com/spotbugs/spotbugs/issues/856 + +" FIXME: When "search()" is used with the "e" flag, it makes no _further_ +" progress after claiming an EOL match (i.e. "\_" or "\n", but not "$"). +" XXX: Omit anonymous class declarations +let s:keywords = '\C\<\%(\.\@1' +" Capture ";" for counting a class file directory (see s:package_dir_heads below) +let s:package_names = '\C\ 0 + let name_attr = synIDattr(synID(lnum, (col('.') - 1), 0), 'name') + if name_attr ==# 'javaClassDecl' + let tokens = matchlist(getline(lnum)..getline(lnum + 1), s:type_names) + if !empty(tokens) | call add(type_names, tokens[1]) | endif + elseif name_attr ==# 'javaExternal' + let tokens = matchlist(getline(lnum)..getline(lnum + 1), s:package_names) + if !empty(tokens) | let s:package = tokens[1] | endif + endif + let lnum = search(s:keywords, 'eW') + endwhile + return type_names + endfunction + +else + function! s:GetDeclaredTypeNames() abort + if bufname() =~# '\<\%(module\|package\)-info\.java\=$' + return [expand('%:t:r')] + endif + " Undo the unsetting of &hls, see below + if &hls + defer execute('set hls') + endif + " Possibly restore the current values for registers '"' and "y", see below + defer call('setreg', ['"', getreg('"'), getregtype('"')]) + defer call('setreg', ['y', getreg('y'), getregtype('y')]) + defer execute('silent bwipeout') + " Copy buffer contents for modification + silent %y y + new + " Apply ":help scratch-buffer" effects and match "$" in Java (generated) + " type names (see s:type_names) + setlocal iskeyword+=$ buftype=nofile bufhidden=hide noswapfile nohls + 0put y + " Discard text blocks and strings + silent keeppatterns %s/\\\@ 0 + let line = getline(lnum) + if line =~# '\' + let tokens = matchlist(line..getline(lnum + 1), s:package_names) + if !empty(tokens) | let s:package = tokens[1] | endif + else + let tokens = matchlist(line..getline(lnum + 1), s:type_names) + if !empty(tokens) | call add(type_names, tokens[1]) | endif + endif + let lnum = search(s:keywords, 'eW') + endwhile + return type_names + endfunction +endif + +if has('win32') + + function! s:GlobClassFiles(src_type_name) abort + return glob(a:src_type_name..'$*.class', 1, 1) + endfunction + +else + function! s:GlobClassFiles(src_type_name) abort + return glob(a:src_type_name..'\$*.class', 1, 1) + endfunction +endif + +if exists('g:spotbugs_properties') && + \ (has_key(g:spotbugs_properties, 'sourceDirPath') && + \ has_key(g:spotbugs_properties, 'classDirPath')) || + \ (has_key(g:spotbugs_properties, 'testSourceDirPath') && + \ has_key(g:spotbugs_properties, 'testClassDirPath')) + +function! s:FindClassFiles(src_type_name) abort + let class_files = [] + " Match pairwise the components of source and class pathnames + for [src_dir, bin_dir] in filter([ + \ [get(g:spotbugs_properties, 'sourceDirPath', ''), + \ get(g:spotbugs_properties, 'classDirPath', '')], + \ [get(g:spotbugs_properties, 'testSourceDirPath', ''), + \ get(g:spotbugs_properties, 'testClassDirPath', '')]], + \ '!(empty(v:val[0]) || empty(v:val[1]))') + " Since only the rightmost "src" is sought, while there can be any number of + " such filenames, no "fnamemodify(a:src_type_name, ':p:s?src?bin?')" is used + let tail_idx = strridx(a:src_type_name, src_dir) + " No such directory or no such inner type (i.e. without "$") + if tail_idx < 0 | continue | endif + " Substitute "bin_dir" for the rightmost "src_dir" + let candidate_type_name = strpart(a:src_type_name, 0, tail_idx).. + \ bin_dir.. + \ strpart(a:src_type_name, (tail_idx + strlen(src_dir))) + for candidate in insert(s:GlobClassFiles(candidate_type_name), + \ candidate_type_name..'.class') + if filereadable(candidate) | call add(class_files, shellescape(candidate)) | endif + endfor + if !empty(class_files) | break | endif + endfor + return class_files +endfunction + +else +function! s:FindClassFiles(src_type_name) abort + let class_files = [] + for candidate in insert(s:GlobClassFiles(a:src_type_name), + \ a:src_type_name..'.class') + if filereadable(candidate) | call add(class_files, shellescape(candidate)) | endif + endfor + return class_files +endfunction +endif + +function! s:CollectClassFiles() abort + " Get a platform-independent pathname prefix, cf. "expand('%:p:h')..'/'" + let pathname = expand('%:p') + let tail_idx = strridx(pathname, expand('%:t')) + let src_pathname = strpart(pathname, 0, tail_idx) + let all_class_files = [] + " Get all type names in the current buffer and let the filename globbing + " discover inner type names from arbitrary type names + for type_name in s:GetDeclaredTypeNames() + call extend(all_class_files, s:FindClassFiles(src_pathname..type_name)) + endfor + return all_class_files +endfunction + +" Expose class files for removal etc. +let b:spotbugs_class_files = s:CollectClassFiles() +let s:package_dir_heads = repeat(':h', (1 + strlen(substitute(s:package, '[^.;]', '', 'g')))) +let g:current_compiler = 'spotbugs' +" CompilerSet makeprg=spotbugs +let &l:makeprg = 'spotbugs'..(has('win32') ? '.bat' : '')..' '.. + \ get(b:, 'spotbugs_makeprg_params', get(g:, 'spotbugs_makeprg_params', '-workHard -experimental')).. + \ ' -textui -emacs -auxclasspath %:p'..s:package_dir_heads..':S -sourcepath %:p'..s:package_dir_heads..':S '.. + \ join(b:spotbugs_class_files, ' ') +" Emacs expects doubled line numbers +setlocal errorformat=%f:%l:%*[0-9]\ %m,%f:-%*[0-9]:-%*[0-9]\ %m + +" " This compiler is meant to be used for a single buffer only +" exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"') +" exe 'CompilerSet errorformat='..escape(&l:errorformat, ' \|"') + +delfunction s:CollectClassFiles +delfunction s:FindClassFiles +delfunction s:GlobClassFiles +delfunction s:GetDeclaredTypeNames +let &cpo = s:cpo_save +unlet s:package_dir_heads s:package s:package_names s:type_names s:keywords s:cpo_save + +" vim: set foldmethod=syntax shiftwidth=2 expandtab: diff --git a/runtime/compiler/tex.vim b/runtime/compiler/tex.vim index 282b3a0588e9ea..bc1623729ab1db 100644 --- a/runtime/compiler/tex.vim +++ b/runtime/compiler/tex.vim @@ -3,8 +3,9 @@ " Maintainer: Artem Chuprina " Contributors: Enno Nagel " Last Change: 2024 Mar 29 -" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition) -" 2024 Apr 05 by The Vim Project (avoid leaving behind g:makeprg) +" 2024 Apr 03 by the Vim Project (removed :CompilerSet definition) +" 2024 Apr 05 by the Vim Project (avoid leaving behind g:makeprg) +" 2024 Nov 19 by the Vim Project (properly escape makeprg setting) if exists("current_compiler") finish @@ -27,7 +28,7 @@ if exists('b:tex_ignore_makefile') || exists('g:tex_ignore_makefile') || let current_compiler = "latex" endif let s:makeprg=current_compiler .. ' -interaction=nonstopmode' - execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' ') + execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' \|"') else let current_compiler = 'make' endif diff --git a/runtime/compiler/typst.vim b/runtime/compiler/typst.vim new file mode 100644 index 00000000000000..13699f46750f73 --- /dev/null +++ b/runtime/compiler/typst.vim @@ -0,0 +1,16 @@ +" Vim compiler file +" Language: Typst +" Previous Maintainer: Gregory Anders +" Maintainer: Luca Saccarola +" Last Change: 2024 Dec 09 +" Based on: https://github.com/kaarmu/typst.vim + +if exists('current_compiler') + finish +endif +let current_compiler = get(g:, 'typst_cmd', 'typst') + +" With `--diagnostic-format` we can use the default errorformat +let s:makeprg = [current_compiler, 'compile', '--diagnostic-format', 'short', '%:S'] + +execute 'CompilerSet makeprg=' . join(s:makeprg, '\ ') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 91b80601dafcf8..5a6361d45ff712 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -42,9 +42,9 @@ The RPC API is like a more powerful version of Vim's "clientserver" feature. CONNECTING *rpc-connecting* See |channel-intro| for various ways to open a channel. Channel-opening -functions take an `rpc` key in the options dictionary. RPC channels can also -be opened by other processes connecting to TCP/IP sockets or named pipes -listened to by Nvim. +functions take an `rpc` key in the options dict. RPC channels can also be +opened by other processes connecting to TCP/IP sockets or named pipes listened +to by Nvim. Nvim creates a default RPC socket at |startup|, given by |v:servername|. To start with a TCP/IP socket instead, use |--listen| with a TCP-style address: > @@ -108,11 +108,15 @@ Basic types ~ Integer (signed 64-bit integer) int64_t Float (IEEE 754 double precision) double String {char* data, size_t size} struct - Array - Dictionary (msgpack: map) - Object + Array kvec + Dict (msgpack: map) kvec + Object any of the above < - Note: empty Array is accepted as a valid argument for Dictionary parameter. + Note: + - Empty Array is accepted as a valid Dictionary parameter. + - Functions cannot cross RPC boundaries. But API functions (e.g. + |nvim_create_autocmd()|) may support Lua function parameters for non-RPC + invocations. Special types (msgpack EXT) ~ @@ -504,8 +508,9 @@ Extended marks (extmarks) represent buffer annotations that track text changes in the buffer. They can represent cursors, folds, misspelled words, anything that needs to track a logical location in the buffer over time. |api-indexing| -Extmark position works like "bar" cursor: it exists between characters. Thus, -the maximum extmark index on a line is 1 more than the character index: > +Extmark position works like a "vertical bar" cursor: it exists between +characters. Thus, the maximum extmark index on a line is 1 more than the +character index: > f o o b a r line contents 0 1 2 3 4 5 character positions (0-based) @@ -579,109 +584,6 @@ created for extmark changes. ============================================================================== Global Functions *api-global* -nvim__get_runtime({pat}, {all}, {opts}) *nvim__get_runtime()* - Find files in runtime directories - - Attributes: ~ - |api-fast| - - Parameters: ~ - • {pat} pattern of files to search for - • {all} whether to return all matches or only the first - • {opts} is_lua: only search Lua subdirs - - Return: ~ - list of absolute paths to the found files - -nvim__id({obj}) *nvim__id()* - Returns object given as argument. - - This API function is used for testing. One should not rely on its presence - in plugins. - - Parameters: ~ - • {obj} Object to return. - - Return: ~ - its argument. - -nvim__id_array({arr}) *nvim__id_array()* - Returns array given as argument. - - This API function is used for testing. One should not rely on its presence - in plugins. - - Parameters: ~ - • {arr} Array to return. - - Return: ~ - its argument. - -nvim__id_dictionary({dct}) *nvim__id_dictionary()* - Returns dictionary given as argument. - - This API function is used for testing. One should not rely on its presence - in plugins. - - Parameters: ~ - • {dct} Dictionary to return. - - Return: ~ - its argument. - -nvim__id_float({flt}) *nvim__id_float()* - Returns floating-point value given as argument. - - This API function is used for testing. One should not rely on its presence - in plugins. - - Parameters: ~ - • {flt} Value to return. - - Return: ~ - its argument. - -nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()* - NB: if your UI doesn't use hlstate, this will not return hlstate first - time. - -nvim__invalidate_glyph_cache() *nvim__invalidate_glyph_cache()* - For testing. The condition in schar_cache_clear_if_full is hard to reach, - so this function can be used to force a cache clear in a test. - -nvim__stats() *nvim__stats()* - Gets internal stats. - - Return: ~ - Map of various internal stats. - -nvim_call_atomic({calls}) *nvim_call_atomic()* - Calls many API methods atomically. - - This has two main usages: - 1. To perform several requests from an async context atomically, i.e. - without interleaving redraws, RPC requests from other clients, or user - interactions (however API methods may trigger autocommands or event - processing which have such side effects, e.g. |:sleep| may wake - timers). - 2. To minimize RPC overhead (roundtrips) of a sequence of many requests. - - Attributes: ~ - |RPC| only - - Parameters: ~ - • {calls} an array of calls, where each call is described by an array - with two elements: the request name, and an array of - arguments. - - Return: ~ - Array of two elements. The first is an array of return values. The - second is NIL if all calls succeeded. If a call resulted in an error, - it is a three-element array with the zero-based index of the call - which resulted in an error, the error type and the error message. If - an error occurred, the values from all preceding calls will still be - returned. - nvim_chan_send({chan}, {data}) *nvim_chan_send()* Send data to channel `id`. For a job, it writes it to the stdin of the process. For the stdio channel |channel-stdio|, it writes to Nvim's @@ -700,21 +602,6 @@ nvim_chan_send({chan}, {data}) *nvim_chan_send()* • {chan} id of the channel • {data} data to write. 8-bit clean: can contain NUL bytes. -nvim_complete_set({index}, {opts}) *nvim_complete_set()* - Set info for the completion candidate index. if the info was shown in a - window, then the window and buffer ids are returned for further - customization. If the text was not shown, an empty dict is returned. - - Parameters: ~ - • {index} the completion candidate index - • {opts} Optional parameters. - • info: (string) info text. - - Return: ~ - Dictionary containing these keys: - • winid: (number) floating window id - • bufnr: (number) buffer id in floating window - nvim_create_buf({listed}, {scratch}) *nvim_create_buf()* Creates a new, empty, unnamed buffer. @@ -767,35 +654,22 @@ nvim_del_var({name}) *nvim_del_var()* • {name} Variable name nvim_echo({chunks}, {history}, {opts}) *nvim_echo()* - Echo a message. + Prints a message given by a list of `[text, hl_group]` "chunks". + + Example: >lua + vim.api.nvim_echo({ { 'chunk1-line1\nchunk1-line2\n' }, { 'chunk2-line1' } }, true, {}) +< Parameters: ~ - • {chunks} A list of `[text, hl_group]` arrays, each representing a - text chunk with specified highlight. `hl_group` element can - be omitted for no highlight. + • {chunks} List of `[text, hl_group]` pairs, where each is a `text` + string highlighted by the (optional) name or ID `hl_group`. • {history} if true, add to |message-history|. • {opts} Optional parameters. - • verbose: Message was printed as a result of 'verbose' - option if Nvim was invoked with -V3log_file, the message - will be redirected to the log_file and suppressed from - direct output. - -nvim_err_write({str}) *nvim_err_write()* - Writes a message to the Vim error buffer. Does not append "\n", the - message is buffered (won't display) until a linefeed is written. - - Parameters: ~ - • {str} Message - -nvim_err_writeln({str}) *nvim_err_writeln()* - Writes a message to the Vim error buffer. Appends "\n", so the buffer is - flushed (and displayed). - - Parameters: ~ - • {str} Message - - See also: ~ - • nvim_err_write() + • err: Treat the message like `:echoerr`. Sets `hl_group` + to |hl-ErrorMsg| by default. + • verbose: Message is controlled by the 'verbose' option. + Nvim invoked with `-V3log` will write the message to the + "log" file instead of standard output. nvim_eval_statusline({str}, {opts}) *nvim_eval_statusline()* Evaluates statusline string. @@ -821,12 +695,12 @@ nvim_eval_statusline({str}, {opts}) *nvim_eval_statusline()* line number instead of statusline. Return: ~ - Dictionary containing statusline information, with these keys: + Dict containing statusline information, with these keys: • str: (string) Characters that will be displayed on the statusline. • width: (number) Display width of the statusline. • highlights: Array containing highlight information of the statusline. Only included when the "highlights" key in {opts} is - true. Each element of the array is a |Dictionary| with these keys: + true. Each element of the array is a |Dict| with these keys: • start: (number) Byte index (0-based) of first character that uses the highlight. • group: (string) Name of highlight group. @@ -876,7 +750,7 @@ nvim_feedkeys({keys}, {mode}, {escape_ks}) *nvim_feedkeys()* nvim_get_api_info() *nvim_get_api_info()* Returns a 2-tuple (Array), where item 0 is the current channel id and item - 1 is the |api-metadata| map (Dictionary). + 1 is the |api-metadata| map (Dict). Attributes: ~ |api-fast| @@ -888,11 +762,13 @@ nvim_get_api_info() *nvim_get_api_info()* nvim_get_chan_info({chan}) *nvim_get_chan_info()* Gets information about a channel. + See |nvim_list_uis()| for an example of how to get channel info. + Parameters: ~ • {chan} channel_id, or 0 for current channel Return: ~ - Dictionary describing a channel, with these keys: + Channel info dict with these keys: • "id" Channel id. • "argv" (optional) Job arguments list. • "stream" Stream underlying the channel. @@ -905,11 +781,11 @@ nvim_get_chan_info({chan}) *nvim_get_chan_info()* • "terminal" |terminal| instance interprets ASCII sequences. • "rpc" |RPC| communication on the channel is active. • "pty" (optional) Name of pseudoterminal. On a POSIX system this is a - device path like "/dev/pts/1". If the name is unknown, the key will - still be present if a pty is used (e.g. for conpty on Windows). - • "buffer" (optional) Buffer with connected |terminal| instance. + device path like "/dev/pts/1". If unknown, the key will still be + present if a pty is used (e.g. for conpty on Windows). + • "buffer" (optional) Buffer connected to |terminal| instance. • "client" (optional) Info about the peer (client on the other end of - the RPC channel), if provided by it via |nvim_set_client_info()|. + the channel), as set by |nvim_set_client_info()|. nvim_get_color_by_name({name}) *nvim_get_color_by_name()* Returns the 24-bit RGB value of a |nvim_get_color_map()| color name or @@ -1052,7 +928,7 @@ nvim_get_mode() *nvim_get_mode()* |api-fast| Return: ~ - Dictionary { "mode": String, "blocking": Boolean } + Dict { "mode": String, "blocking": Boolean } nvim_get_proc({pid}) *nvim_get_proc()* Gets info describing process `pid`. @@ -1067,11 +943,11 @@ nvim_get_proc_children({pid}) *nvim_get_proc_children()* Array of child process ids, empty if process not found. nvim_get_runtime_file({name}, {all}) *nvim_get_runtime_file()* - Find files in runtime directories + Finds files in runtime directories, in 'runtimepath' order. "name" can contain wildcards. For example - nvim_get_runtime_file("colors/*.vim", true) will return all color scheme - files. Always use forward slashes (/) in the search pattern for + `nvim_get_runtime_file("colors/*.{vim,lua}", true)` will return all color + scheme files. Always use forward slashes (/) in the search pattern for subdirectories regardless of platform. It is not an error to not find any files. An empty array is returned then. @@ -1109,6 +985,9 @@ nvim_input({keys}) *nvim_input()* input buffer and the call is non-blocking (input is processed asynchronously by the eventloop). + To input blocks of text, |nvim_paste()| is much faster and should be + preferred. + On execution error: does not fail, but updates v:errmsg. Note: ~ @@ -1189,6 +1068,12 @@ nvim_list_tabpages() *nvim_list_tabpages()* nvim_list_uis() *nvim_list_uis()* Gets a list of dictionaries representing attached UIs. + Example: The Nvim builtin |TUI| sets its channel info as described in + |startup-tui|. In particular, it sets `client.name` to "nvim-tui". So you + can check if the TUI is running by inspecting the client name of each UI: >lua + vim.print(vim.api.nvim_get_chan_info(vim.api.nvim_list_uis()[1].chan).client.name) +< + Return: ~ Array of UI dictionaries, each with these keys: • "height" Requested height of the UI @@ -1209,22 +1094,11 @@ nvim_load_context({dict}) *nvim_load_context()* Parameters: ~ • {dict} |Context| map. -nvim_notify({msg}, {log_level}, {opts}) *nvim_notify()* - Notify the user with a message - - Relays the call to vim.notify . By default forwards your message in the - echo area but can be overridden to trigger desktop notifications. - - Parameters: ~ - • {msg} Message to display to the user - • {log_level} The log level - • {opts} Reserved for future use. - nvim_open_term({buffer}, {opts}) *nvim_open_term()* Open a terminal instance in a buffer By default (and currently the only option) the terminal will not be - connected to an external process. Instead, input send on the channel will + connected to an external process. Instead, input sent on the channel will be echoed directly by the terminal. This is useful to display ANSI terminal sequences returned as part of a rpc message, or similar. @@ -1235,6 +1109,17 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()* |nvim_chan_send()| can be called immediately to process sequences in a virtual terminal having the intended size. + Example: this `TermHl` command can be used to display and highlight raw + ANSI termcodes, so you can use Nvim as a "scrollback pager" (for terminals + like kitty): *ansi-colorize* *terminal-scrollback-pager* >lua + vim.api.nvim_create_user_command('TermHl', function() + local b = vim.api.nvim_create_buf(false, true) + local chan = vim.api.nvim_open_term(b, {}) + vim.api.nvim_chan_send(chan, table.concat(vim.api.nvim_buf_get_lines(0, 0, -1, false), '\n')) + vim.api.nvim_win_set_buf(0, b) + end, { desc = 'Highlights ANSI termcodes in curbuf' }) +< + Attributes: ~ not allowed when |textlock| is active @@ -1253,29 +1138,36 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()* Return: ~ Channel id, or 0 on error -nvim_out_write({str}) *nvim_out_write()* - Writes a message to the Vim output buffer. Does not append "\n", the - message is buffered (won't display) until a linefeed is written. - - Parameters: ~ - • {str} Message - nvim_paste({data}, {crlf}, {phase}) *nvim_paste()* - Pastes at cursor, in any mode. + Pastes at cursor (in any mode), and sets "redo" so dot (|.|) will repeat + the input. UIs call this to implement "paste", but it's also intended for + use by scripts to input large, dot-repeatable blocks of text (as opposed + to |nvim_input()| which is subject to mappings/events and is thus much + slower). - Invokes the `vim.paste` handler, which handles each mode appropriately. - Sets redo/undo. Faster than |nvim_input()|. Lines break at LF ("\n"). + Invokes the |vim.paste()| handler, which handles each mode appropriately. Errors ('nomodifiable', `vim.paste()` failure, …) are reflected in `err` but do not affect the return value (which is strictly decided by - `vim.paste()`). On error, subsequent calls are ignored ("drained") until - the next paste is initiated (phase 1 or -1). + `vim.paste()`). On error or cancel, subsequent calls are ignored + ("drained") until the next paste is initiated (phase 1 or -1). + + Useful in mappings and scripts to insert multiline text. Example: >lua + vim.keymap.set('n', 'x', function() + vim.api.nvim_paste([[ + line1 + line2 + line3 + ]], false, -1) + end, { buffer = true }) +< Attributes: ~ not allowed when |textlock| is active Parameters: ~ - • {data} Multiline input. May be binary (containing NUL bytes). + • {data} Multiline input. Lines break at LF ("\n"). May be binary + (containing NUL bytes). • {crlf} Also break lines at CR and CRLF. • {phase} -1: paste in a single call (i.e. without streaming). To "stream" a paste, call `nvim_paste` sequentially with these @@ -1286,10 +1178,11 @@ nvim_paste({data}, {crlf}, {phase}) *nvim_paste()* Return: ~ • true: Client may continue pasting. - • false: Client must cancel the paste. + • false: Client should cancel the paste. nvim_put({lines}, {type}, {after}, {follow}) *nvim_put()* - Puts text at cursor, in any mode. + Puts text at cursor, in any mode. For dot-repeatable input, use + |nvim_paste()|. Compare |:put| and |p| which are always linewise. @@ -1343,27 +1236,24 @@ nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts}) *nvim_set_client_info()* nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes}) - Self-identifies the client. + Self-identifies the client. Sets the `client` object returned by + |nvim_get_chan_info()|. - The client/plugin/application should call this after connecting, to - provide hints about its identity and purpose, for debugging and - orchestration. + Clients should call this just after connecting, to provide hints for + debugging and orchestration. (Note: Something is better than nothing! + Fields are optional, but at least set `name`.) Can be called more than once; the caller should merge old info if appropriate. Example: library first identifies the channel, then a plugin using that library later identifies itself. - Note: ~ - • "Something is better than nothing". You don't need to include all the - fields. - Attributes: ~ |RPC| only Parameters: ~ - • {name} Short name for the connected client - • {version} Dictionary describing the version, with these (optional) - keys: + • {name} Client short-name. Sets the `client.name` field of + |nvim_get_chan_info()|. + • {version} Dict describing the version, with these (optional) keys: • "major" major version (defaults to 0 if not set, for no release yet) • "minor" minor version @@ -1398,6 +1288,7 @@ nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes}) inclusive. • {attributes} Arbitrary string:string map of informal client properties. Suggested keys: + • "pid": Process id. • "website": Client homepage URL (e.g. GitHub repository) • "license": License description ("Apache 2", "GPLv3", @@ -1574,23 +1465,127 @@ nvim_strwidth({text}) *nvim_strwidth()* Return: ~ Number of cells -nvim_subscribe({event}) *nvim_subscribe()* - Subscribes to event broadcasts. +nvim__complete_set({index}, {opts}) *nvim__complete_set()* + EXPERIMENTAL: this API may change in the future. - Attributes: ~ - |RPC| only + Sets info for the completion item at the given index. If the info text was + shown in a window, returns the window and buffer ids, or empty dict if not + shown. Parameters: ~ - • {event} Event type string + • {index} Completion candidate index + • {opts} Optional parameters. + • info: (string) info text. + + Return: ~ + Dict containing these keys: + • winid: (number) floating window id + • bufnr: (number) buffer id in floating window -nvim_unsubscribe({event}) *nvim_unsubscribe()* - Unsubscribes to event broadcasts. +nvim__get_runtime({pat}, {all}, {opts}) *nvim__get_runtime()* + Find files in runtime directories Attributes: ~ - |RPC| only + |api-fast| Parameters: ~ - • {event} Event type string + • {pat} pattern of files to search for + • {all} whether to return all matches or only the first + • {opts} is_lua: only search Lua subdirs + + Return: ~ + list of absolute paths to the found files + +nvim__id({obj}) *nvim__id()* + Returns object given as argument. + + This API function is used for testing. One should not rely on its presence + in plugins. + + Parameters: ~ + • {obj} Object to return. + + Return: ~ + its argument. + +nvim__id_array({arr}) *nvim__id_array()* + Returns array given as argument. + + This API function is used for testing. One should not rely on its presence + in plugins. + + Parameters: ~ + • {arr} Array to return. + + Return: ~ + its argument. + +nvim__id_dict({dct}) *nvim__id_dict()* + Returns dict given as argument. + + This API function is used for testing. One should not rely on its presence + in plugins. + + Parameters: ~ + • {dct} Dict to return. + + Return: ~ + its argument. + +nvim__id_float({flt}) *nvim__id_float()* + Returns floating-point value given as argument. + + This API function is used for testing. One should not rely on its presence + in plugins. + + Parameters: ~ + • {flt} Value to return. + + Return: ~ + its argument. + +nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()* + NB: if your UI doesn't use hlstate, this will not return hlstate first + time. + +nvim__invalidate_glyph_cache() *nvim__invalidate_glyph_cache()* + For testing. The condition in schar_cache_clear_if_full is hard to reach, + so this function can be used to force a cache clear in a test. + +nvim__redraw({opts}) *nvim__redraw()* + EXPERIMENTAL: this API may change in the future. + + Instruct Nvim to redraw various components. + + Parameters: ~ + • {opts} Optional parameters. + • win: Target a specific |window-ID| as described below. + • buf: Target a specific buffer number as described below. + • flush: Update the screen with pending updates. + • valid: When present mark `win`, `buf`, or all windows for + redraw. When `true`, only redraw changed lines (useful for + decoration providers). When `false`, forcefully redraw. + • range: Redraw a range in `buf`, the buffer in `win` or the + current buffer (useful for decoration providers). Expects a + tuple `[first, last]` with the first and last line number of + the range, 0-based end-exclusive |api-indexing|. + • cursor: Immediately update cursor position on the screen in + `win` or the current window. + • statuscolumn: Redraw the 'statuscolumn' in `buf`, `win` or + all windows. + • statusline: Redraw the 'statusline' in `buf`, `win` or all + windows. + • winbar: Redraw the 'winbar' in `buf`, `win` or all windows. + • tabline: Redraw the 'tabline'. + + See also: ~ + • |:redraw| + +nvim__stats() *nvim__stats()* + Gets internal stats. + + Return: ~ + Map of various internal stats. ============================================================================== @@ -1603,7 +1598,7 @@ nvim_call_dict_function({dict}, {fn}, {args}) On execution error: fails with Vimscript error, updates v:errmsg. Parameters: ~ - • {dict} Dictionary, or String evaluating to a Vimscript |self| dict + • {dict} Dict, or String evaluating to a Vimscript |self| dict • {fn} Name of the function defined on the Vimscript dict • {args} Function arguments packed in an Array @@ -1627,17 +1622,15 @@ nvim_command({command}) *nvim_command()* On execution error: fails with Vimscript error, updates v:errmsg. - Prefer using |nvim_cmd()| or |nvim_exec2()| over this. To evaluate - multiple lines of Vim script or an Ex command directly, use - |nvim_exec2()|. To construct an Ex command using a structured format and - then execute it, use |nvim_cmd()|. To modify an Ex command before - evaluating it, use |nvim_parse_cmd()| in conjunction with |nvim_cmd()|. + Prefer |nvim_cmd()| or |nvim_exec2()| instead. To modify an Ex command in + a structured way before executing it, modify the result of + |nvim_parse_cmd()| then pass it to |nvim_cmd()|. Parameters: ~ • {command} Ex command string nvim_eval({expr}) *nvim_eval()* - Evaluates a Vimscript |expression|. Dictionaries and Lists are recursively + Evaluates a Vimscript |expression|. Dicts and Lists are recursively expanded. On execution error: fails with Vimscript error, updates v:errmsg. @@ -1664,7 +1657,7 @@ nvim_exec2({src}, {opts}) *nvim_exec2()* return all (non-error, non-shell |:!|) output. Return: ~ - Dictionary containing information about execution, with these keys: + Dict containing information about execution, with these keys: • output: (string|nil) Output if `opts.output` is true. See also: ~ @@ -1701,9 +1694,9 @@ nvim_parse_expression({expr}, {flags}, {highlight}) region [start_col, end_col)). Return: ~ - • AST: top-level dictionary with these keys: - • "error": Dictionary with error, present only if parser saw some - error. Contains the following keys: + • AST: top-level dict with these keys: + • "error": Dict with error, present only if parser saw some error. + Contains the following keys: • "message": String, error message in printf format, translated. Must contain exactly one "%.*s". • "arg": String, error message argument. @@ -1711,7 +1704,7 @@ nvim_parse_expression({expr}, {flags}, {highlight}) that should be equal to the length of expr string. ("Successfully parsed" here means "participated in AST creation", not "till the first error".) - • "ast": AST, either nil or a dictionary with these keys: + • "ast": AST, either nil or a dict with these keys: • "type": node type, one of the value names from ExprASTNodeType stringified without "kExprNode" prefix. • "start": a pair `[line, column]` describing where node is @@ -1787,8 +1780,8 @@ nvim_buf_get_commands({buffer}, {opts}) *nvim_buf_get_commands()* nvim_cmd({cmd}, {opts}) *nvim_cmd()* Executes an Ex command. - Unlike |nvim_command()| this command takes a structured Dictionary instead - of a String. This allows for easier construction and manipulation of an Ex + Unlike |nvim_command()| this command takes a structured Dict instead of a + String. This allows for easier construction and manipulation of an Ex command. This also allows for things such as having spaces inside a command argument, expanding filenames in a command that otherwise doesn't expand filenames, etc. Command arguments may also be Number, Boolean or @@ -1802,8 +1795,8 @@ nvim_cmd({cmd}, {opts}) *nvim_cmd()* On execution error: fails with Vimscript error, updates v:errmsg. Parameters: ~ - • {cmd} Command to execute. Must be a Dictionary that can contain the - same values as the return value of |nvim_parse_cmd()| except + • {cmd} Command to execute. Must be a Dict that can contain the same + values as the return value of |nvim_parse_cmd()| except "addr", "nargs" and "nextcmd" which are ignored if provided. All values except for "cmd" are optional. • {opts} Optional parameters. @@ -1905,7 +1898,7 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()* • {opts} Optional parameters. Reserved for future use. Return: ~ - Dictionary containing command information, with these keys: + Dict containing command information, with these keys: • cmd: (string) Command name. • range: (array) (optional) Command range ( ). Omitted if command doesn't accept a range. Otherwise, has no elements if no @@ -1922,15 +1915,15 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()* • nargs: (string) Value of |:command-nargs|. • nextcmd: (string) Next command if there are multiple commands separated by a |:bar|. Empty if there isn't a next command. - • magic: (dictionary) Which characters have special meaning in the - command arguments. + • magic: (dict) Which characters have special meaning in the command + arguments. • file: (boolean) The command expands filenames. Which means characters such as "%", "#" and wildcards are expanded. • bar: (boolean) The "|" character is treated as a command separator and the double quote character (") is treated as the start of a comment. - • mods: (dictionary) |:command-modifiers|. - • filter: (dictionary) |:filter|. + • mods: (dict) |:command-modifiers|. + • filter: (dict) |:filter|. • pattern: (string) Filter pattern. Empty string if there is no filter. • force: (boolean) Whether filter is inverted or not. @@ -1967,11 +1960,11 @@ Options Functions *api-options* nvim_get_all_options_info() *nvim_get_all_options_info()* Gets the option information for all options. - The dictionary has the full option names as keys and option metadata - dictionaries as detailed at |nvim_get_option_info2()|. + The dict has the full option names as keys and option metadata dicts as + detailed at |nvim_get_option_info2()|. Return: ~ - dictionary of all options + dict of all options See also: ~ • |nvim_get_commands()| @@ -1979,7 +1972,7 @@ nvim_get_all_options_info() *nvim_get_all_options_info()* nvim_get_option_info2({name}, {opts}) *nvim_get_option_info2()* Gets the option information for one option from arbitrary buffer or window - Resulting dictionary has keys: + Resulting dict has keys: • name: Name of the option (like 'filetype') • shortname: Shortened name of the option (like 'ft') • type: type of option ("string", "number" or "boolean") @@ -2147,17 +2140,17 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()* • |api-buffer-updates-lua| nvim_buf_call({buffer}, {fun}) *nvim_buf_call()* - call a function with buffer as temporary current buffer + Call a function with buffer as temporary current buffer. This temporarily switches current buffer to "buffer". If the current - window already shows "buffer", the window is not switched If a window - inside the current tabpage (including a float) already shows the buffer - One of these windows will be set as current window temporarily. Otherwise - a temporary scratch window (called the "autocmd window" for historical - reasons) will be used. + window already shows "buffer", the window is not switched. If a window + inside the current tabpage (including a float) already shows the buffer, + then one of those windows will be set as current window temporarily. + Otherwise a temporary scratch window (called the "autocmd window" for + historical reasons) will be used. This is useful e.g. to call Vimscript functions that only work with the - current buffer/window currently, like |termopen()|. + current buffer/window currently, like `jobstart(…, {'term': v:true})`. Attributes: ~ Lua |vim.api| only @@ -2469,10 +2462,11 @@ nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col}, `start_row = end_row = row` and `start_col = end_col = col`. To delete the text in a range, use `replacement = {}`. - Prefer |nvim_buf_set_lines()| if you are only adding or deleting entire - lines. - - Prefer |nvim_put()| if you want to insert text at the cursor position. + Note: ~ + • Prefer |nvim_buf_set_lines()| (for performance) to add or delete + entire lines. + • Prefer |nvim_paste()| or |nvim_put()| to insert (instead of replace) + text at cursor. Attributes: ~ not allowed when |textlock| is active @@ -2485,10 +2479,6 @@ nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col}, • {end_col} Ending column (byte offset) on last line, exclusive • {replacement} Array of lines to use as replacement - See also: ~ - • |nvim_buf_set_lines()| - • |nvim_put()| - nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()* Sets a buffer-scoped (b:) variable @@ -2666,8 +2656,10 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) • id : id of the extmark to edit. • end_row : ending line of the mark, 0-based inclusive. • end_col : ending col of the mark, 0-based exclusive. - • hl_group : name of the highlight group used to highlight - this mark. + • hl_group : highlight group used for the text range. This + and below highlight groups can be supplied either as a + string or as an integer, the latter of which can be + obtained using |nvim_get_hl_id_by_name()|. • hl_eol : when true, for a multiline highlight covering the EOL of a line, continue the highlight for the rest of the screen line (just like for diff and cursorline highlight). @@ -2676,9 +2668,7 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) with specified highlight. `highlight` element can either be a single highlight group, or an array of multiple highlight groups that will be stacked (highest priority - last). A highlight group can be supplied either as a - string or as an integer, the latter which can be obtained - using |nvim_get_hl_id_by_name()|. + last). • virt_text_pos : position of virtual text. Possible values: • "eol": right after eol character (default). • "overlay": display over the specified column, without @@ -2744,15 +2734,14 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) buffer or end of the line respectively. Defaults to true. • sign_text: string of length 1-2 used to display in the sign column. - • sign_hl_group: name of the highlight group used to - highlight the sign column text. - • number_hl_group: name of the highlight group used to - highlight the number column. - • line_hl_group: name of the highlight group used to - highlight the whole line. - • cursorline_hl_group: name of the highlight group used to - highlight the sign column text when the cursor is on the - same line as the mark and 'cursorline' is enabled. + • sign_hl_group: highlight group used for the sign column + text. + • number_hl_group: highlight group used for the number + column. + • line_hl_group: highlight group used for the whole line. + • cursorline_hl_group: highlight group used for the sign + column text when the cursor is on the same line as the + mark and 'cursorline' is enabled. • conceal: string which should be either empty or a single character. Enable concealing similar to |:syn-conceal|. When a character is supplied it is used as |:syn-cchar|. @@ -2767,8 +2756,6 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) • url: A URL to associate with this extmark. In the TUI, the OSC 8 control sequence is used to generate a clickable hyperlink to this URL. - • scoped: boolean that indicates that the extmark should - only be displayed in the namespace scope. (experimental) Return: ~ Id of the created/updated extmark @@ -2811,7 +2798,7 @@ nvim_set_decoration_provider({ns_id}, {opts}) Note: this function should not be called often. Rather, the callbacks themselves can be used to throttle unneeded callbacks. the `on_start` callback can return `false` to disable the provider until the next redraw. - Similarly, return `false` in `on_win` will skip the `on_lines` calls for + Similarly, return `false` in `on_win` will skip the `on_line` calls for that window (but any extmarks set in `on_win` will still be used). A plugin managing multiple sources of decoration should ideally only set one provider, and merge the sources internally. You can use multiple `ns_id` @@ -2820,10 +2807,10 @@ nvim_set_decoration_provider({ns_id}, {opts}) Note: doing anything other than setting extmarks is considered experimental. Doing things like changing options are not explicitly forbidden, but is likely to have unexpected consequences (such as 100% CPU - consumption). doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is + consumption). Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite dubious for the moment. - Note: It is not allowed to remove or update extmarks in 'on_line' + Note: It is not allowed to remove or update extmarks in `on_line` callbacks. Attributes: ~ @@ -2835,12 +2822,12 @@ nvim_set_decoration_provider({ns_id}, {opts}) • on_start: called first on each screen redraw > ["start", tick] < - • on_buf: called for each buffer being redrawn (before window - callbacks) > + • on_buf: called for each buffer being redrawn (once per + edit, before window callbacks) > ["buf", bufnr, tick] < • on_win: called when starting to redraw a specific window. > - ["win", winid, bufnr, topline, botline] + ["win", winid, bufnr, toprow, botrow] < • on_line: called for each buffer line being redrawn. (The interaction with fold lines is subject to change) > @@ -2850,34 +2837,26 @@ nvim_set_decoration_provider({ns_id}, {opts}) ["end", tick] < -nvim_win_add_ns({window}, {ns_id}) *nvim_win_add_ns()* - Adds the namespace scope to the window. +nvim__ns_get({ns_id}) *nvim__ns_get()* + EXPERIMENTAL: this API will change in the future. - Parameters: ~ - • {window} Window handle, or 0 for current window - • {ns_id} the namespace to add - - Return: ~ - true if the namespace was added, else false - -nvim_win_get_ns({window}) *nvim_win_get_ns()* - Gets all the namespaces scopes associated with a window. + Get the properties for namespace Parameters: ~ - • {window} Window handle, or 0 for current window + • {ns_id} Namespace Return: ~ - a list of namespaces ids + Map defining the namespace properties, see |nvim__ns_set()| -nvim_win_remove_ns({window}, {ns_id}) *nvim_win_remove_ns()* - Removes the namespace scope from the window. +nvim__ns_set({ns_id}, {opts}) *nvim__ns_set()* + EXPERIMENTAL: this API will change in the future. - Parameters: ~ - • {window} Window handle, or 0 for current window - • {ns_id} the namespace to remove + Set some properties for namespace - Return: ~ - true if the namespace was removed, else false + Parameters: ~ + • {ns_id} Namespace + • {opts} Optional parameters to set: + • wins: a list of windows to be scoped in ============================================================================== @@ -3099,7 +3078,7 @@ nvim_win_text_height({window}, {opts}) *nvim_win_text_height()* omitted include the whole line. Return: ~ - Dictionary containing text height information, with these keys: + Dict containing text height information, with these keys: • all: The total number of screen lines occupied by the range. • fill: The number of diff filler or virtual lines among them. @@ -3171,11 +3150,13 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* • {config} Map defining the window configuration. Keys: • relative: Sets the window layout to "floating", placed at (row,col) coordinates relative to: - • "editor" The global editor grid + • "cursor" Cursor position in current window. + • "editor" The global editor grid. + • "laststatus" 'laststatus' if present, or last row. + • "mouse" Mouse position. + • "tabline" Tabline if present, or first row. • "win" Window given by the `win` field, or current window. - • "cursor" Cursor position in current window. - • "mouse" Mouse position • win: |window-ID| window to split, or relative window when creating a float (relative="win"). • anchor: Decides which corner of the float to place at @@ -3199,7 +3180,13 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* be fractional. • focusable: Enable focus by user actions (wincmds, mouse events). Defaults to true. Non-focusable windows can be - entered by |nvim_set_current_win()|. + entered by |nvim_set_current_win()|, or, when the `mouse` + field is set to true, by mouse events. See |focusable|. + • mouse: Specify how this window interacts with mouse + events. Defaults to `focusable` value. + • If false, mouse events pass through this window. + • If true, mouse events interact with this window + normally. • external: GUI should display the window as an external top-level window. Currently accepts no other positioning configuration together with this. @@ -3261,13 +3248,15 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* < • title: Title (optional) in window border, string or list. List should consist of `[text, highlight]` tuples. If - string, the default highlight group is `FloatTitle`. + string, or a tuple lacks a highlight, the default + highlight group is `FloatTitle`. • title_pos: Title position. Must be set with `title` option. Value can be one of "left", "center", or "right". Default is `"left"`. • footer: Footer (optional) in window border, string or list. List should consist of `[text, highlight]` tuples. - If string, the default highlight group is `FloatFooter`. + If string, or a tuple lacks a highlight, the default + highlight group is `FloatFooter`. • footer_pos: Footer position. Must be set with `footer` option. Value can be one of "left", "center", or "right". Default is `"left"`. @@ -3421,7 +3410,7 @@ nvim_create_augroup({name}, {opts}) *nvim_create_augroup()* Parameters: ~ • {name} String: The name of the group - • {opts} Dictionary Parameters + • {opts} Dict Parameters • clear (bool) optional: defaults to true. Clear existing commands if the group already exists |autocmd-groups|. @@ -3474,16 +3463,17 @@ nvim_create_autocmd({event}, {opts}) *nvim_create_autocmd()* Vimscript function name, if string) called when the event(s) is triggered. Lua callback can return a truthy value (not `false` or `nil`) to delete the autocommand. - Receives a table argument with these keys: + Receives one argument, a table with these keys: + *event-args* • id: (number) autocommand id • event: (string) name of the triggered event |autocmd-events| • group: (number|nil) autocommand group id, if any - • match: (string) expanded value of - • buf: (number) expanded value of - • file: (string) expanded value of + • file: (string) (not expanded to a full path) + • match: (string) (expanded to a full path) + • buf: (number) • data: (any) arbitrary data passed from - |nvim_exec_autocmds()| + |nvim_exec_autocmds()| *event-data* • command (string) optional: Vim command to execute on event. Cannot be used with {callback} • once (boolean) optional: defaults to false. Run the @@ -3539,7 +3529,7 @@ nvim_exec_autocmds({event}, {opts}) *nvim_exec_autocmds()* Parameters: ~ • {event} (String|Array) The event or events to execute - • {opts} Dictionary of autocommand options: + • {opts} Dict of autocommand options: • group (string|integer) optional: the autocommand group name or id to match against. |autocmd-groups|. • pattern (string|array) optional: defaults to "*" @@ -3575,7 +3565,7 @@ nvim_get_autocmds({opts}) *nvim_get_autocmds()* autocommands that match any combination of them. Parameters: ~ - • {opts} Dictionary with at least one of the following: + • {opts} Dict with at least one of the following: • group (string|integer): the autocommand group name or id to match against. • event (string|array): event or events to match against diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index b3974e3246a628..c094281154161a 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -353,15 +353,11 @@ BufWritePost After writing the whole buffer to a file ChanInfo State of channel changed, for instance the client of a RPC channel described itself. Sets these |v:event| keys: - info - See |nvim_get_chan_info()| for the format of - the info Dictionary. + info as from |nvim_get_chan_info()| *ChanOpen* ChanOpen Just after a channel was opened. Sets these |v:event| keys: - info - See |nvim_get_chan_info()| for the format of - the info Dictionary. + info as from |nvim_get_chan_info()| *CmdUndefined* CmdUndefined When a user command is used but it isn't defined. Useful for defining a command only @@ -466,6 +462,20 @@ CompleteDone After Insert mode completion is done. Either CompleteDonePre if you need it. |v:completed_item| gives the completed item. + Sets these |v:event| keys: + complete_word The word that was + selected, empty if + abandoned complete. + complete_type |complete_info_mode| + reason Reason for completion being + done. Can be one of: + - "accept": completion was + accepted using |complete_CTRL-Y|. + - "cancel": completion was cancelled + using |complete_CTRL-E|, pressing + a non-keyword character, or + triggering a new completion. + *CursorHold* CursorHold When the user doesn't press a key for the time specified with 'updatetime'. Not triggered @@ -512,6 +522,11 @@ CursorMoved After the cursor was moved in Normal or Visual Careful: This is triggered very often, don't do anything that the user does not expect or that is slow. + *CursorMovedC* +CursorMovedC After the cursor was moved in the command + line. Be careful not to mess up the command + line, it may cause Vim to lock up. + expands to the |cmdline-char|. *CursorMovedI* CursorMovedI After the cursor was moved in Insert mode. Not triggered when the popup menu is visible. @@ -903,18 +918,18 @@ ShellFilterPost After executing a shell command with ":{range}!cmd", ":w !cmd" or ":r !cmd". Can be used to check for any changed files. *SourcePre* -SourcePre Before sourcing a vim/lua file. |:source| +SourcePre Before sourcing a Vimscript/Lua file. |:source| is the name of the file being sourced. *SourcePost* -SourcePost After sourcing a vim/lua file. |:source| +SourcePost After sourcing a Vimscript/Lua file. |:source| is the name of the file being sourced. Not triggered when sourcing was interrupted. Also triggered after a SourceCmd autocommand was triggered. *SourceCmd* -SourceCmd When sourcing a vim/lua file. |:source| +SourceCmd When sourcing a Vimscript/Lua file. |:source| is the name of the file being sourced. - The autocommand must source this file. + The autocommand must source that file. |Cmd-event| *SpellFileMissing* SpellFileMissing When trying to load a spell checking file and @@ -989,18 +1004,16 @@ TermClose When a |terminal| job ends. Sets these |v:event| keys: status *TermRequest* -TermRequest When a |terminal| job emits an OSC or DCS - sequence. Sets |v:termrequest|. When used from - Lua, the request string is included in the - "data" field of the autocommand callback. +TermRequest When a |:terminal| child process emits an OSC + or DCS sequence. Sets |v:termrequest|. The + |event-data| is the request string. *TermResponse* TermResponse When Nvim receives an OSC or DCS response from - the terminal. Sets |v:termresponse|. When used - from Lua, the response string is included in - the "data" field of the autocommand callback. - May be triggered halfway through another event - (file I/O, a shell command, or anything else - that takes time). Example: >lua + the host terminal. Sets |v:termresponse|. The + |event-data| is the response string. May be + triggered during another event (file I/O, + a shell command, or anything else that takes + time). Example: >lua -- Query the terminal palette for the RGB value of color 1 -- (red) using OSC 4 diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 94721f5024ceaf..d4a6bbf9d87d07 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -25,6 +25,12 @@ abs({expr}) *abs()* echo abs(-4) < 4 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`number`) + acos({expr}) *acos()* Return the arc cosine of {expr} measured in radians, as a |Float| in the range of [0, pi]. @@ -38,6 +44,12 @@ acos({expr}) *acos()* echo acos(-0.5) < 2.094395 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`number`) + add({object}, {expr}) *add()* Append the item {expr} to |List| or |Blob| {object}. Returns the resulting |List| or |Blob|. Examples: >vim @@ -49,6 +61,14 @@ add({object}, {expr}) *add()* Use |insert()| to add an item at another position. Returns 1 if {object} is not a |List| or a |Blob|. + Parameters: ~ + • {object} (`any`) + • {expr} (`any`) + + Return: ~ + (`any`) Resulting |List| or |Blob|, or 1 if {object} is not + a |List| or a |Blob|. + and({expr}, {expr}) *and()* Bitwise AND on the two arguments. The arguments are converted to a number. A List, Dict or Float argument causes an error. @@ -57,6 +77,13 @@ and({expr}, {expr}) *and()* let flag = and(bits, 0x80) < + Parameters: ~ + • {expr} (`number`) + • {expr1} (`number`) + + Return: ~ + (`integer`) + api_info() *api_info()* Returns Dictionary of |api-metadata|. @@ -64,6 +91,9 @@ api_info() *api_info()* lua vim.print(vim.fn.api_info()) < + Return: ~ + (`table`) + append({lnum}, {text}) *append()* When {text} is a |List|: Append each item of the |List| as a text line below line {lnum} in the current buffer. @@ -79,6 +109,13 @@ append({lnum}, {text}) *append()* let failed = append(0, ["Chapter 1", "the beginning"]) < + Parameters: ~ + • {lnum} (`integer`) + • {text} (`string|string[]`) + + Return: ~ + (`0|1`) + appendbufline({buf}, {lnum}, {text}) *appendbufline()* Like |append()| but append the text in buffer {expr}. @@ -100,6 +137,14 @@ appendbufline({buf}, {lnum}, {text}) *appendbufline()* < However, when {text} is an empty list then no error is given for an invalid {lnum}, since {lnum} isn't actually used. + Parameters: ~ + • {buf} (`integer|string`) + • {lnum} (`integer`) + • {text} (`string`) + + Return: ~ + (`0|1`) + argc([{winid}]) *argc()* The result is the number of files in the argument list. See |arglist|. @@ -110,10 +155,19 @@ argc([{winid}]) *argc()* list is used: either the window number or the window ID. Returns -1 if the {winid} argument is invalid. + Parameters: ~ + • {winid} (`integer?`) + + Return: ~ + (`integer`) + argidx() *argidx()* The result is the current index in the argument list. 0 is the first file. argc() - 1 is the last one. See |arglist|. + Return: ~ + (`integer`) + arglistid([{winnr} [, {tabnr}]]) *arglistid()* Return the argument list ID. This is a number which identifies the argument list being used. Zero is used for the @@ -126,6 +180,13 @@ arglistid([{winnr} [, {tabnr}]]) *arglistid()* page. {winnr} can be the window number or the |window-ID|. + Parameters: ~ + • {winnr} (`integer?`) + • {tabnr} (`integer?`) + + Return: ~ + (`integer`) + argv([{nr} [, {winid}]]) *argv()* The result is the {nr}th file in the argument list. See |arglist|. "argv(0)" is the first one. Example: >vim @@ -145,6 +206,13 @@ argv([{nr} [, {winid}]]) *argv()* the argument list. Returns an empty List if the {winid} argument is invalid. + Parameters: ~ + • {nr} (`integer?`) + • {winid} (`integer?`) + + Return: ~ + (`string|string[]`) + asin({expr}) *asin()* Return the arc sine of {expr} measured in radians, as a |Float| in the range of [-pi/2, pi/2]. @@ -158,35 +226,63 @@ asin({expr}) *asin()* echo asin(-0.5) < -0.523599 + Parameters: ~ + • {expr} (`any`) + + Return: ~ + (`number`) + assert_beeps({cmd}) *assert_beeps()* Run {cmd} and add an error message to |v:errors| if it does NOT produce a beep or visual bell. Also see |assert_fails()|, |assert_nobeep()| and |assert-return|. + Parameters: ~ + • {cmd} (`string`) + + Return: ~ + (`0|1`) + assert_equal({expected}, {actual} [, {msg}]) *assert_equal()* When {expected} and {actual} are not equal an error message is added to |v:errors| and 1 is returned. Otherwise zero is returned. |assert-return| The error is in the form "Expected {expected} but got - {actual}". When {msg} is present it is prefixed to that. + {actual}". When {msg} is present it is prefixed to that, + along with the location of the assert when run from a script. There is no automatic conversion, the String "4" is different from the Number 4. And the number 4 is different from the Float 4.0. The value of 'ignorecase' is not used here, case always matters. Example: >vim - assert_equal('foo', 'bar') -< Will result in a string to be added to |v:errors|: - test.vim line 12: Expected 'foo' but got 'bar' ~ + call assert_equal('foo', 'bar', 'baz') +< Will add the following to |v:errors|: + test.vim line 12: baz: Expected 'foo' but got 'bar' ~ + + Parameters: ~ + • {expected} (`any`) + • {actual} (`any`) + • {msg} (`any?`) + + Return: ~ + (`0|1`) -assert_equalfile({fname-one}, {fname-two}) *assert_equalfile()* - When the files {fname-one} and {fname-two} do not contain +assert_equalfile({fname_one}, {fname_two}) *assert_equalfile()* + When the files {fname_one} and {fname_two} do not contain exactly the same text an error message is added to |v:errors|. Also see |assert-return|. - When {fname-one} or {fname-two} does not exist the error will + When {fname_one} or {fname_two} does not exist the error will mention that. + Parameters: ~ + • {fname_one} (`string`) + • {fname_two} (`string`) + + Return: ~ + (`0|1`) + assert_exception({error} [, {msg}]) *assert_exception()* When v:exception does not contain the string {error} an error message is added to |v:errors|. Also see |assert-return|. @@ -201,6 +297,13 @@ assert_exception({error} [, {msg}]) *assert_exception()* endtry < + Parameters: ~ + • {error} (`any`) + • {msg} (`any?`) + + Return: ~ + (`0|1`) + *assert_fails()* assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]]) Run {cmd} and add an error message to |v:errors| if it does @@ -210,25 +313,25 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]]) When {error} is a string it must be found literally in the first reported error. Most often this will be the error code, including the colon, e.g. "E123:". >vim - assert_fails('bad cmd', 'E987:') + call assert_fails('bad cmd', 'E987:') < When {error} is a |List| with one or two strings, these are used as patterns. The first pattern is matched against the first reported error: >vim - assert_fails('cmd', ['E987:.*expected bool']) + call assert_fails('cmd', ['E987:.*expected bool']) < The second pattern, if present, is matched against the last reported error. To only match the last error use an empty string for the first error: >vim - assert_fails('cmd', ['', 'E987:']) + call assert_fails('cmd', ['', 'E987:']) < If {msg} is empty then it is not used. Do this to get the default message when passing the {lnum} argument. - + *E1115* When {lnum} is present and not negative, and the {error} argument is present and matches, then this is compared with the line number at which the error was reported. That can be the line number in a function or in a script. - + *E1116* When {context} is present it is used as a pattern and matched against the context (script name or function name) where {lnum} is located in. @@ -236,16 +339,34 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]]) Note that beeping is not considered an error, and some failing commands only beep. Use |assert_beeps()| for those. + Parameters: ~ + • {cmd} (`string`) + • {error} (`any?`) + • {msg} (`any?`) + • {lnum} (`integer?`) + • {context} (`any?`) + + Return: ~ + (`0|1`) + assert_false({actual} [, {msg}]) *assert_false()* When {actual} is not false an error message is added to |v:errors|, like with |assert_equal()|. The error is in the form "Expected False but got {actual}". - When {msg} is present it is prepended to that. + When {msg} is present it is prefixed to that, along with the + location of the assert when run from a script. Also see |assert-return|. A value is false when it is zero. When {actual} is not a number the assert fails. + Parameters: ~ + • {actual} (`any`) + • {msg} (`any?`) + + Return: ~ + (`0|1`) + assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* This asserts number and |Float| values. When {actual} is lower than {lower} or higher than {upper} an error message is added @@ -254,11 +375,21 @@ assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* but got {actual}". When {msg} is present it is prefixed to that. + Parameters: ~ + • {lower} (`number`) + • {upper} (`number`) + • {actual} (`number`) + • {msg} (`string?`) + + Return: ~ + (`0|1`) + assert_match({pattern}, {actual} [, {msg}]) *assert_match()* When {pattern} does not match {actual} an error message is added to |v:errors|. Also see |assert-return|. The error is in the form "Pattern {pattern} does not match - {actual}". When {msg} is present it is prefixed to that. + {actual}". When {msg} is present it is prefixed to that, + along with the location of the assert when run from a script. {pattern} is used as with |expr-=~|: The matching is always done like 'magic' was set and 'cpoptions' is empty, no matter what @@ -269,36 +400,80 @@ assert_match({pattern}, {actual} [, {msg}]) *assert_match()* Use both to match the whole text. Example: >vim - assert_match('^f.*o$', 'foobar') + call assert_match('^f.*o$', 'foobar') < Will result in a string to be added to |v:errors|: test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ + Parameters: ~ + • {pattern} (`string`) + • {actual} (`string`) + • {msg} (`string?`) + + Return: ~ + (`0|1`) + assert_nobeep({cmd}) *assert_nobeep()* Run {cmd} and add an error message to |v:errors| if it produces a beep or visual bell. Also see |assert_beeps()|. + Parameters: ~ + • {cmd} (`string`) + + Return: ~ + (`0|1`) + assert_notequal({expected}, {actual} [, {msg}]) *assert_notequal()* The opposite of `assert_equal()`: add an error message to |v:errors| when {expected} and {actual} are equal. Also see |assert-return|. + Parameters: ~ + • {expected} (`any`) + • {actual} (`any`) + • {msg} (`any?`) + + Return: ~ + (`0|1`) + assert_notmatch({pattern}, {actual} [, {msg}]) *assert_notmatch()* The opposite of `assert_match()`: add an error message to |v:errors| when {pattern} matches {actual}. Also see |assert-return|. + Parameters: ~ + • {pattern} (`string`) + • {actual} (`string`) + • {msg} (`string?`) + + Return: ~ + (`0|1`) + assert_report({msg}) *assert_report()* Report a test failure directly, using String {msg}. Always returns one. + Parameters: ~ + • {msg} (`string`) + + Return: ~ + (`0|1`) + assert_true({actual} [, {msg}]) *assert_true()* When {actual} is not true an error message is added to |v:errors|, like with |assert_equal()|. Also see |assert-return|. A value is |TRUE| when it is a non-zero number or |v:true|. When {actual} is not a number or |v:true| the assert fails. - When {msg} is given it precedes the default message. + When {msg} is given it is prefixed to the default message, + along with the location of the assert when run from a script. + + Parameters: ~ + • {actual} (`any`) + • {msg} (`string?`) + + Return: ~ + (`0|1`) atan({expr}) *atan()* Return the principal value of the arc tangent of {expr}, in @@ -311,6 +486,12 @@ atan({expr}) *atan()* echo atan(-4.01) < -1.326405 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`number`) + atan2({expr1}, {expr2}) *atan2()* Return the arc tangent of {expr1} / {expr2}, measured in radians, as a |Float| in the range [-pi, pi]. @@ -323,6 +504,13 @@ atan2({expr1}, {expr2}) *atan2()* echo atan2(1, -1) < 2.356194 + Parameters: ~ + • {expr1} (`number`) + • {expr2} (`number`) + + Return: ~ + (`number`) + blob2list({blob}) *blob2list()* Return a List containing the number value of each byte in Blob {blob}. Examples: >vim @@ -331,6 +519,12 @@ blob2list({blob}) *blob2list()* < Returns an empty List on error. |list2blob()| does the opposite. + Parameters: ~ + • {blob} (`any`) + + Return: ~ + (`any[]`) + browse({save}, {title}, {initdir}, {default}) *browse()* Put up a file requester. This only works when "has("browse")" returns |TRUE| (only in some GUI versions). @@ -342,6 +536,15 @@ browse({save}, {title}, {initdir}, {default}) *browse()* An empty string is returned when the "Cancel" button is hit, something went wrong, or browsing is not possible. + Parameters: ~ + • {save} (`any`) + • {title} (`string`) + • {initdir} (`string`) + • {default} (`string`) + + Return: ~ + (`0|1`) + browsedir({title}, {initdir}) *browsedir()* Put up a directory requester. This only works when "has("browse")" returns |TRUE| (only in some GUI versions). @@ -354,6 +557,13 @@ browsedir({title}, {initdir}) *browsedir()* When the "Cancel" button is hit, something went wrong, or browsing is not possible, an empty string is returned. + Parameters: ~ + • {title} (`string`) + • {initdir} (`string`) + + Return: ~ + (`0|1`) + bufadd({name}) *bufadd()* Add a buffer to the buffer list with name {name} (must be a String). @@ -368,6 +578,12 @@ bufadd({name}) *bufadd()* call setbufline(bufnr, 1, ['some', 'text']) < Returns 0 on error. + Parameters: ~ + • {name} (`string`) + + Return: ~ + (`integer`) + bufexists({buf}) *bufexists()* The result is a Number, which is |TRUE| if a buffer called {buf} exists. @@ -390,11 +606,23 @@ bufexists({buf}) *bufexists()* Use "bufexists(0)" to test for the existence of an alternate file name. + Parameters: ~ + • {buf} (`any`) + + Return: ~ + (`0|1`) + buflisted({buf}) *buflisted()* The result is a Number, which is |TRUE| if a buffer called {buf} exists and is listed (has the 'buflisted' option set). The {buf} argument is used like with |bufexists()|. + Parameters: ~ + • {buf} (`any`) + + Return: ~ + (`0|1`) + bufload({buf}) *bufload()* Ensure the buffer {buf} is loaded. When the buffer name refers to an existing file then the file is read. Otherwise @@ -405,11 +633,20 @@ bufload({buf}) *bufload()* there will be no dialog, the buffer will be loaded anyway. The {buf} argument is used like with |bufexists()|. + Parameters: ~ + • {buf} (`any`) + bufloaded({buf}) *bufloaded()* The result is a Number, which is |TRUE| if a buffer called {buf} exists and is loaded (shown in a window or hidden). The {buf} argument is used like with |bufexists()|. + Parameters: ~ + • {buf} (`any`) + + Return: ~ + (`0|1`) + bufname([{buf}]) *bufname()* The result is the name of a buffer. Mostly as it is displayed by the `:ls` command, but not using special names such as @@ -441,6 +678,12 @@ bufname([{buf}]) *bufname()* echo bufname("file2") " name of buffer where "file2" matches. < + Parameters: ~ + • {buf} (`integer|string?`) + + Return: ~ + (`string`) + bufnr([{buf} [, {create}]]) *bufnr()* The result is the number of a buffer, as it is displayed by the `:ls` command. For the use of {buf}, see |bufname()| @@ -455,6 +698,13 @@ bufnr([{buf} [, {create}]]) *bufnr()* number necessarily exist, because ":bwipeout" may have removed them. Use bufexists() to test for the existence of a buffer. + Parameters: ~ + • {buf} (`integer|string?`) + • {create} (`any?`) + + Return: ~ + (`integer`) + bufwinid({buf}) *bufwinid()* The result is a Number, which is the |window-ID| of the first window associated with buffer {buf}. For the use of {buf}, @@ -466,6 +716,12 @@ bufwinid({buf}) *bufwinid()* Only deals with the current tab page. See |win_findbuf()| for finding more. + Parameters: ~ + • {buf} (`any`) + + Return: ~ + (`integer`) + bufwinnr({buf}) *bufwinnr()* Like |bufwinid()| but return the window number instead of the |window-ID|. @@ -477,6 +733,12 @@ bufwinnr({buf}) *bufwinnr()* < The number can be used with |CTRL-W_w| and ":wincmd w" |:wincmd|. + Parameters: ~ + • {buf} (`any`) + + Return: ~ + (`integer`) + byte2line({byte}) *byte2line()* Return the line number that contains the character at byte count {byte} in the current buffer. This includes the @@ -487,6 +749,12 @@ byte2line({byte}) *byte2line()* Returns -1 if the {byte} value is invalid. + Parameters: ~ + • {byte} (`any`) + + Return: ~ + (`integer`) + byteidx({expr}, {nr} [, {utf16}]) *byteidx()* Return byte index of the {nr}th character in the String {expr}. Use zero for the first character, it then returns @@ -523,6 +791,14 @@ byteidx({expr}, {nr} [, {utf16}]) *byteidx()* echo byteidx('a😊😊', 3, 1) " returns 5 < + Parameters: ~ + • {expr} (`any`) + • {nr} (`integer`) + • {utf16} (`any?`) + + Return: ~ + (`integer`) + byteidxcomp({expr}, {nr} [, {utf16}]) *byteidxcomp()* Like byteidx(), except that a composing character is counted as a separate character. Example: >vim @@ -534,6 +810,14 @@ byteidxcomp({expr}, {nr} [, {utf16}]) *byteidxcomp()* character is 3 bytes), the second echo results in 1 ('e' is one byte). + Parameters: ~ + • {expr} (`any`) + • {nr} (`integer`) + • {utf16} (`any?`) + + Return: ~ + (`integer`) + call({func}, {arglist} [, {dict}]) *call()* *E699* Call function {func} with the items in |List| {arglist} as arguments. @@ -543,6 +827,14 @@ call({func}, {arglist} [, {dict}]) *call()* *E69 {dict} is for functions with the "dict" attribute. It will be used to set the local variable "self". |Dictionary-function| + Parameters: ~ + • {func} (`any`) + • {arglist} (`any`) + • {dict} (`any?`) + + Return: ~ + (`any`) + ceil({expr}) *ceil()* Return the smallest integral value greater than or equal to {expr} as a |Float| (round up). @@ -557,6 +849,12 @@ ceil({expr}) *ceil()* Returns 0.0 if {expr} is not a |Float| or a |Number|. + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`number`) + chanclose({id} [, {stream}]) *chanclose()* Close a channel or a specific stream associated with it. For a job, {stream} can be one of "stdin", "stdout", @@ -567,6 +865,13 @@ chanclose({id} [, {stream}]) *chanclose()* For a socket, there is only one stream, and {stream} should be omitted. + Parameters: ~ + • {id} (`integer`) + • {stream} (`string?`) + + Return: ~ + (`0|1`) + changenr() *changenr()* Return the number of the most recent change. This is the same number as what is displayed with |:undolist| and can be used @@ -576,6 +881,9 @@ changenr() *changenr()* one less than the number of the undone change. Returns 0 if the undo list is empty. + Return: ~ + (`integer`) + chansend({id}, {data}) *chansend()* Send data to channel {id}. For a job, it writes it to the stdin of the process. For the stdio channel |channel-stdio|, @@ -594,6 +902,13 @@ chansend({id}, {data}) *chansend()* was created with `"rpc":v:true` then the channel expects RPC messages, use |rpcnotify()| and |rpcrequest()| instead. + Parameters: ~ + • {id} (`number`) + • {data} (`string|string[]`) + + Return: ~ + (`0|1`) + char2nr({string} [, {utf8}]) *char2nr()* Return Number value of the first char in {string}. Examples: >vim @@ -609,17 +924,30 @@ char2nr({string} [, {utf8}]) *char2nr()* Returns 0 if {string} is not a |String|. + Parameters: ~ + • {string} (`string`) + • {utf8} (`any?`) + + Return: ~ + (`0|1`) + charclass({string}) *charclass()* Return the character class of the first character in {string}. The character class is one of: 0 blank 1 punctuation - 2 word character + 2 word character (depends on 'iskeyword') 3 emoji other specific Unicode class The class is used in patterns and word motions. Returns 0 if {string} is not a |String|. + Parameters: ~ + • {string} (`string`) + + Return: ~ + (`0|1|2|3|'other'`) + charcol({expr} [, {winid}]) *charcol()* Same as |col()| but returns the character index of the column position given with {expr} instead of the byte position. @@ -628,6 +956,14 @@ charcol({expr} [, {winid}]) *charcol()* With the cursor on '세' in line 5 with text "여보세요": >vim echo charcol('.') " returns 3 echo col('.') " returns 7 +< + + Parameters: ~ + • {expr} (`string|any[]`) + • {winid} (`integer?`) + + Return: ~ + (`integer`) charidx({string}, {idx} [, {countcc} [, {utf16}]]) *charidx()* Return the character index of the byte at {idx} in {string}. @@ -663,6 +999,15 @@ charidx({string}, {idx} [, {countcc} [, {utf16}]]) *charidx()* echo charidx('a😊😊', 4, 0, 1) " returns 2 < + Parameters: ~ + • {string} (`string`) + • {idx} (`integer`) + • {countcc} (`boolean?`) + • {utf16} (`boolean?`) + + Return: ~ + (`integer`) + chdir({dir}) *chdir()* Change the current working directory to {dir}. The scope of the directory change depends on the directory of the current @@ -684,6 +1029,13 @@ chdir({dir}) *chdir()* " ... do some work call chdir(save_dir) endif +< + + Parameters: ~ + • {dir} (`string`) + + Return: ~ + (`string`) cindent({lnum}) *cindent()* Get the amount of indent for line {lnum} according the C @@ -693,41 +1045,50 @@ cindent({lnum}) *cindent()* When {lnum} is invalid -1 is returned. See |C-indenting|. + Parameters: ~ + • {lnum} (`integer`) + + Return: ~ + (`integer`) + clearmatches([{win}]) *clearmatches()* Clears all matches previously defined for the current window by |matchadd()| and the |:match| commands. If {win} is specified, use the window with this number or window ID instead of the current window. + Parameters: ~ + • {win} (`integer?`) + col({expr} [, {winid}]) *col()* The result is a Number, which is the byte index of the column - position given with {expr}. The accepted positions are: - . the cursor position - $ the end of the cursor line (the result is the - number of bytes in the cursor line plus one) - 'x position of mark x (if the mark is not set, 0 is - returned) - v In Visual mode: the start of the Visual area (the - cursor is the end). When not in Visual mode - returns the cursor position. Differs from |'<| in - that it's updated right away. + position given with {expr}. + For accepted positions see |getpos()|. + When {expr} is "$", it means the end of the cursor line, so + the result is the number of bytes in the cursor line plus one. Additionally {expr} can be [lnum, col]: a |List| with the line and column number. Most useful when the column is "$", to get the last column of a specific line. When "lnum" or "col" is out of range then col() returns zero. + With the optional {winid} argument the values are obtained for that window instead of the current window. + To get the line number use |line()|. To get both use |getpos()|. + For the screen column position use |virtcol()|. For the character position use |charcol()|. + Note that only marks in the current file can be used. + Examples: >vim echo col(".") " column of cursor echo col("$") " length of cursor line plus one echo col("'t") " column of mark t echo col("'" .. markname) " column of mark markname -< The first column is 1. Returns 0 if {expr} is invalid or when +< + The first column is 1. Returns 0 if {expr} is invalid or when the window with ID {winid} is not found. For an uppercase mark the column may actually be in another buffer. @@ -736,6 +1097,14 @@ col({expr} [, {winid}]) *col()* line. Also, when using a mapping the cursor isn't moved, this can be used to obtain the column in Insert mode: >vim imap echo col(".").."\n" +< + + Parameters: ~ + • {expr} (`string|any[]`) + • {winid} (`integer?`) + + Return: ~ + (`integer`) complete({startcol}, {matches}) *complete()* *E785* Set the matches for Insert mode completion. @@ -767,6 +1136,10 @@ complete({startcol}, {matches}) *complete()* *E78 < This isn't very useful, but it shows how it works. Note that an empty string is returned to avoid a zero being inserted. + Parameters: ~ + • {startcol} (`integer`) + • {matches} (`any[]`) + complete_add({expr}) *complete_add()* Add {expr} to the list of matches. Only to be used by the function specified with the 'completefunc' option. @@ -776,6 +1149,12 @@ complete_add({expr}) *complete_add()* See |complete-functions| for an explanation of {expr}. It is the same as one item in the list that 'omnifunc' would return. + Parameters: ~ + • {expr} (`any`) + + Return: ~ + (`0|1|2`) + complete_check() *complete_check()* Check for a key typed while looking for completion matches. This is to be used when looking for matches takes some time. @@ -784,6 +1163,9 @@ complete_check() *complete_check()* Only to be used by the function specified with the 'completefunc' option. + Return: ~ + (`0|1`) + complete_info([{what}]) *complete_info()* Returns a |Dictionary| with information about Insert mode completion. See |ins-completion|. @@ -792,16 +1174,22 @@ complete_info([{what}]) *complete_info()* See |complete_info_mode| for the values. pum_visible |TRUE| if popup menu is visible. See |pumvisible()|. - items List of completion matches. Each item is a - dictionary containing the entries "word", + items List of all completion candidates. Each item + is a dictionary containing the entries "word", "abbr", "menu", "kind", "info" and "user_data". See |complete-items|. + matches Same as "items", but only returns items that + are matching current query. If both "matches" + and "items" are in "what", the returned list + will still be named "items", but each item + will have an additional "match" field. selected Selected item index. First index is zero. Index is -1 if no item is selected (showing typed text only, or the last completion after no item is selected when using the or keys) - inserted Inserted string. [NOT IMPLEMENTED YET] + completed Return a dictionary containing the entries of + the currently selected index item. preview_winid Info floating preview window id. preview_bufnr Info floating preview buffer id. @@ -843,6 +1231,13 @@ complete_info([{what}]) *complete_info()* call complete_info(['mode']) " Get only 'mode' and 'pum_visible' call complete_info(['mode', 'pum_visible']) +< + + Parameters: ~ + • {what} (`any[]?`) + + Return: ~ + (`table`) confirm({msg} [, {choices} [, {default} [, {type}]]]) *confirm()* confirm() offers the user a dialog, from which a choice can be @@ -896,6 +1291,15 @@ confirm({msg} [, {choices} [, {default} [, {type}]]]) *confirm()* don't fit, a vertical layout is used anyway. For some systems the horizontal layout is always used. + Parameters: ~ + • {msg} (`string`) + • {choices} (`string?`) + • {default} (`integer?`) + • {type} (`string?`) + + Return: ~ + (`integer`) + copy({expr}) *copy()* Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. @@ -906,6 +1310,12 @@ copy({expr}) *copy()* A |Dictionary| is copied in a similar way as a |List|. Also see |deepcopy()|. + Parameters: ~ + • {expr} (`T`) + + Return: ~ + (`T`) + cos({expr}) *cos()* Return the cosine of {expr}, measured in radians, as a |Float|. {expr} must evaluate to a |Float| or a |Number|. @@ -916,6 +1326,12 @@ cos({expr}) *cos()* echo cos(-4.01) < -0.646043 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`number`) + cosh({expr}) *cosh()* Return the hyperbolic cosine of {expr} as a |Float| in the range [1, inf]. @@ -927,6 +1343,12 @@ cosh({expr}) *cosh()* echo cosh(-0.5) < -1.127626 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`number`) + count({comp}, {expr} [, {ic} [, {start}]]) *count()* *E706* Return the number of times an item with value {expr} appears in |String|, |List| or |Dictionary| {comp}. @@ -940,15 +1362,33 @@ count({comp}, {expr} [, {ic} [, {start}]]) *count()* *E70 occurrences of {expr} is returned. Zero is returned when {expr} is an empty string. + Parameters: ~ + • {comp} (`string|table|any[]`) + • {expr} (`any`) + • {ic} (`boolean?`) + • {start} (`integer?`) + + Return: ~ + (`integer`) + ctxget([{index}]) *ctxget()* Returns a |Dictionary| representing the |context| at {index} from the top of the |context-stack| (see |context-dict|). If {index} is not given, it is assumed to be 0 (i.e.: top). + Parameters: ~ + • {index} (`integer?`) + + Return: ~ + (`table`) + ctxpop() *ctxpop()* Pops and restores the |context| at the top of the |context-stack|. + Return: ~ + (`any`) + ctxpush([{types}]) *ctxpush()* Pushes the current editor state (|context|) on the |context-stack|. @@ -956,15 +1396,31 @@ ctxpush([{types}]) *ctxpush()* which |context-types| to include in the pushed context. Otherwise, all context types are included. + Parameters: ~ + • {types} (`string[]?`) + + Return: ~ + (`any`) + ctxset({context} [, {index}]) *ctxset()* Sets the |context| at {index} from the top of the |context-stack| to that represented by {context}. {context} is a Dictionary with context data (|context-dict|). If {index} is not given, it is assumed to be 0 (i.e.: top). + Parameters: ~ + • {context} (`table`) + • {index} (`integer?`) + + Return: ~ + (`integer`) + ctxsize() *ctxsize()* Returns the size of the |context-stack|. + Return: ~ + (`any`) + cursor({lnum}, {col} [, {off}]) *cursor()* cursor({list}) Positions the cursor at the column (byte count) {col} in the @@ -998,6 +1454,12 @@ cursor({list}) position within a or after the last character. Returns 0 when the position could be set, -1 otherwise. + Parameters: ~ + • {list} (`integer[]`) + + Return: ~ + (`any`) + debugbreak({pid}) *debugbreak()* Specifically used to interrupt a program being debugged. It will cause process {pid} to get a SIGTRAP. Behavior for other @@ -1007,6 +1469,12 @@ debugbreak({pid}) *debugbreak()* Returns |TRUE| if successfully interrupted the program. Otherwise returns |FALSE|. + Parameters: ~ + • {pid} (`integer`) + + Return: ~ + (`any`) + deepcopy({expr} [, {noref}]) *deepcopy()* *E698* Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. @@ -1027,6 +1495,13 @@ deepcopy({expr} [, {noref}]) *deepcopy()* *E69 {noref} set to 1 will fail. Also see |copy()|. + Parameters: ~ + • {expr} (`T`) + • {noref} (`boolean?`) + + Return: ~ + (`T`) + delete({fname} [, {flags}]) *delete()* Without {flags} or with {flags} empty: Deletes the file by the name {fname}. @@ -1046,6 +1521,13 @@ delete({fname} [, {flags}]) *delete()* operation was successful and -1/true when the deletion failed or partly failed. + Parameters: ~ + • {fname} (`string`) + • {flags} (`string?`) + + Return: ~ + (`integer`) + deletebufline({buf}, {first} [, {last}]) *deletebufline()* Delete lines {first} to {last} (inclusive) from buffer {buf}. If {last} is omitted then delete line {first} only. @@ -1060,6 +1542,14 @@ deletebufline({buf}, {first} [, {last}]) *deletebufline()* when using |line()| this refers to the current buffer. Use "$" to refer to the last line in buffer {buf}. + Parameters: ~ + • {buf} (`integer|string`) + • {first} (`integer|string`) + • {last} (`integer|string?`) + + Return: ~ + (`any`) + dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()* Adds a watcher to a dictionary. A dictionary watcher is identified by three components: @@ -1100,11 +1590,27 @@ dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()* This function can be used by plugins to implement options with validation and parsing logic. + Parameters: ~ + • {dict} (`table`) + • {pattern} (`string`) + • {callback} (`function`) + + Return: ~ + (`any`) + dictwatcherdel({dict}, {pattern}, {callback}) *dictwatcherdel()* Removes a watcher added with |dictwatcheradd()|. All three arguments must match the ones passed to |dictwatcheradd()| in order for the watcher to be successfully deleted. + Parameters: ~ + • {dict} (`any`) + • {pattern} (`string`) + • {callback} (`function`) + + Return: ~ + (`any`) + did_filetype() *did_filetype()* Returns |TRUE| when autocommands are being executed and the FileType event has been triggered at least once. Can be used @@ -1117,6 +1623,9 @@ did_filetype() *did_filetype()* editing another buffer to set 'filetype' and load a syntax file. + Return: ~ + (`integer`) + diff_filler({lnum}) *diff_filler()* Returns the number of filler lines above line {lnum}. These are the lines that were inserted at this point in @@ -1126,6 +1635,12 @@ diff_filler({lnum}) *diff_filler()* line, "'m" mark m, etc. Returns 0 if the current window is not in diff mode. + Parameters: ~ + • {lnum} (`integer`) + + Return: ~ + (`integer`) + diff_hlID({lnum}, {col}) *diff_hlID()* Returns the highlight ID for diff mode at line {lnum} column {col} (byte index). When the current line does not have a @@ -1137,6 +1652,13 @@ diff_hlID({lnum}, {col}) *diff_hlID()* The highlight ID can be used with |synIDattr()| to obtain syntax information about the highlighting. + Parameters: ~ + • {lnum} (`integer`) + • {col} (`integer`) + + Return: ~ + (`any`) + digraph_get({chars}) *digraph_get()* *E1214* Return the digraph of {chars}. This should be a string with exactly two characters. If {chars} are not just two @@ -1154,6 +1676,12 @@ digraph_get({chars}) *digraph_get()* *E121 echo digraph_get('aa') " Returns 'あ' < + Parameters: ~ + • {chars} (`string`) + + Return: ~ + (`string`) + digraph_getlist([{listall}]) *digraph_getlist()* Return a list of digraphs. If the {listall} argument is given and it is TRUE, return all digraphs, including the default @@ -1169,6 +1697,12 @@ digraph_getlist([{listall}]) *digraph_getlist()* echo digraph_getlist(1) < + Parameters: ~ + • {listall} (`boolean?`) + + Return: ~ + (`string[][]`) + digraph_set({chars}, {digraph}) *digraph_set()* Add digraph {chars} to the list. {chars} must be a string with two characters. {digraph} is a string with one UTF-8 @@ -1186,9 +1720,13 @@ digraph_set({chars}, {digraph}) *digraph_set()* Example: >vim call digraph_set(' ', 'あ') < - Can be used as a |method|: >vim - GetString()->digraph_set('あ') -< + + Parameters: ~ + • {chars} (`string`) + • {digraph} (`string`) + + Return: ~ + (`any`) digraph_setlist({digraphlist}) *digraph_setlist()* Similar to |digraph_set()| but this function can add multiple @@ -1205,9 +1743,11 @@ digraph_setlist({digraphlist}) *digraph_setlist()* < Except that the function returns after the first error, following digraphs will not be added. - Can be used as a |method|: >vim - GetList()->digraph_setlist() -< + Parameters: ~ + • {digraphlist} (`table`) + + Return: ~ + (`any`) empty({expr}) *empty()* Return the Number 1 if {expr} is empty, zero otherwise. @@ -1218,6 +1758,12 @@ empty({expr}) *empty()* - |v:false| and |v:null| are empty, |v:true| is not. - A |Blob| is empty when its length is zero. + Parameters: ~ + • {expr} (`any`) + + Return: ~ + (`integer`) + environ() *environ()* Return all of environment variables as dictionary. You can check if an environment variable exists like this: >vim @@ -1227,6 +1773,9 @@ environ() *environ()* echo index(keys(environ()), 'HOME', 0, 1) != -1 < + Return: ~ + (`any`) + escape({string}, {chars}) *escape()* Escape the characters in {chars} that occur in {string} with a backslash. Example: >vim @@ -1235,6 +1784,13 @@ escape({string}, {chars}) *escape()* c:\\program\ files\\vim < Also see |shellescape()| and |fnameescape()|. + Parameters: ~ + • {string} (`string`) + • {chars} (`string`) + + Return: ~ + (`string`) + eval({string}) *eval()* Evaluate {string} and return the result. Especially useful to turn the result of |string()| back into the original value. @@ -1242,34 +1798,56 @@ eval({string}) *eval()* of them. Also works for |Funcref|s that refer to existing functions. + Parameters: ~ + • {string} (`string`) + + Return: ~ + (`any`) + eventhandler() *eventhandler()* Returns 1 when inside an event handler. That is that Vim got interrupted while waiting for the user to type a character, e.g., when dropping a file on Vim. This means interactive commands cannot be used. Otherwise zero is returned. + Return: ~ + (`any`) + executable({expr}) *executable()* This function checks if an executable with the name {expr} exists. {expr} must be the name of the program without any arguments. + executable() uses the value of $PATH and/or the normal - searchpath for programs. *PATHEXT* + searchpath for programs. + *PATHEXT* On MS-Windows the ".exe", ".bat", etc. can optionally be included. Then the extensions in $PATHEXT are tried. Thus if "foo.exe" does not exist, "foo.exe.bat" can be found. If - $PATHEXT is not set then ".exe;.com;.bat;.cmd" is used. A dot + $PATHEXT is not set then ".com;.exe;.bat;.cmd" is used. A dot by itself can be used in $PATHEXT to try using the name without an extension. When 'shell' looks like a Unix shell, then the name is also tried without adding an extension. On MS-Windows it only checks if the file exists and is not a directory, not if it's really executable. - On Windows an executable in the same directory as Vim is - always found (it is added to $PATH at |startup|). + On MS-Windows an executable in the same directory as the Vim + executable is always found (it's added to $PATH at |startup|). + *NoDefaultCurrentDirectoryInExePath* + On MS-Windows an executable in Vim's current working directory + is also normally found, but this can be disabled by setting + the $NoDefaultCurrentDirectoryInExePath environment variable. + The result is a Number: 1 exists 0 does not exist |exepath()| can be used to get the full path of an executable. + Parameters: ~ + • {expr} (`string`) + + Return: ~ + (`0|1`) + execute({command} [, {silent}]) *execute()* Execute {command} and capture its output. If {command} is a |String|, returns {command} output. @@ -1298,12 +1876,25 @@ execute({command} [, {silent}]) *execute()* To execute a command in another window than the current one use `win_execute()`. + Parameters: ~ + • {command} (`string|string[]`) + • {silent} (`''|'silent'|'silent!'?`) + + Return: ~ + (`string`) + exepath({expr}) *exepath()* Returns the full path of {expr} if it is an executable and given as a (partial or full) path or is found in $PATH. Returns empty string otherwise. If {expr} starts with "./" the |current-directory| is used. + Parameters: ~ + • {expr} (`string`) + + Return: ~ + (`string`) + exists({expr}) *exists()* The result is a Number, which is |TRUE| if {expr} is defined, zero otherwise. @@ -1393,6 +1984,12 @@ exists({expr}) *exists()* < This doesn't check for existence of the "bufcount" variable, but gets the value of "bufcount", and checks if that exists. + Parameters: ~ + • {expr} (`string`) + + Return: ~ + (`0|1`) + exp({expr}) *exp()* Return the exponential of {expr} as a |Float| in the range [0, inf]. @@ -1404,6 +2001,12 @@ exp({expr}) *exp()* echo exp(-1) < 0.367879 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`any`) + expand({string} [, {nosuf} [, {list}]]) *expand()* Expand wildcards and the following special keywords in {string}. 'wildignorecase' applies. @@ -1495,6 +2098,14 @@ expand({string} [, {nosuf} [, {list}]]) *expand()* See |glob()| for finding existing files. See |system()| for getting the raw output of an external command. + Parameters: ~ + • {string} (`string`) + • {nosuf} (`boolean?`) + • {list} (`nil|false?`) + + Return: ~ + (`string`) + expandcmd({string} [, {options}]) *expandcmd()* Expand special items in String {string} like what is done for an Ex command such as `:edit`. This expands special keywords, @@ -1519,6 +2130,13 @@ expandcmd({string} [, {options}]) *expandcmd()* echo expandcmd('make %<.o', {'errmsg': v:true}) < + Parameters: ~ + • {string} (`string`) + • {options} (`table?`) + + Return: ~ + (`any`) + extend({expr1}, {expr2} [, {expr3}]) *extend()* {expr1} and {expr2} must be both |Lists| or both |Dictionaries|. @@ -1555,11 +2173,27 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* fails. Returns {expr1}. Returns 0 on error. + Parameters: ~ + • {expr1} (`table`) + • {expr2} (`table`) + • {expr3} (`table?`) + + Return: ~ + (`any`) + extendnew({expr1}, {expr2} [, {expr3}]) *extendnew()* Like |extend()| but instead of adding items to {expr1} a new List or Dictionary is created and returned. {expr1} remains unchanged. + Parameters: ~ + • {expr1} (`table`) + • {expr2} (`table`) + • {expr3} (`table?`) + + Return: ~ + (`any`) + feedkeys({string} [, {mode}]) *feedkeys()* Characters in {string} are queued for processing as if they come from a mapping or were typed by the user. @@ -1606,6 +2240,29 @@ feedkeys({string} [, {mode}]) *feedkeys()* Return value is always 0. + Parameters: ~ + • {string} (`string`) + • {mode} (`string?`) + + Return: ~ + (`any`) + +filecopy({from}, {to}) *filecopy()* + Copy the file pointed to by the name {from} to {to}. The + result is a Number, which is |TRUE| if the file was copied + successfully, and |FALSE| when it failed. + If a file with name {to} already exists, it will fail. + Note that it does not handle directories (yet). + + This function is not available in the |sandbox|. + + Parameters: ~ + • {from} (`string`) + • {to} (`string`) + + Return: ~ + (`0|1`) + filereadable({file}) *filereadable()* The result is a Number, which is |TRUE| when a file with the name {file} exists, and can be read. If {file} doesn't exist, @@ -1623,12 +2280,24 @@ filereadable({file}) *filereadable()* 1 < + Parameters: ~ + • {file} (`string`) + + Return: ~ + (`0|1`) + filewritable({file}) *filewritable()* The result is a Number, which is 1 when a file with the name {file} exists, and can be written. If {file} doesn't exist, or is not writable, the result is 0. If {file} is a directory, and we can write to it, the result is 2. + Parameters: ~ + • {file} (`string`) + + Return: ~ + (`0|1`) + filter({expr1}, {expr2}) *filter()* {expr1} must be a |List|, |String|, |Blob| or |Dictionary|. For each item in {expr1} evaluate {expr2} and when the result @@ -1682,6 +2351,13 @@ filter({expr1}, {expr2}) *filter()* When {expr2} is a Funcref errors inside a function are ignored, unless it was defined with the "abort" flag. + Parameters: ~ + • {expr1} (`string|table`) + • {expr2} (`string|function`) + + Return: ~ + (`any`) + finddir({name} [, {path} [, {count}]]) *finddir()* Find directory {name} in {path}. Supports both downwards and upwards recursive directory searches. See |file-searching| @@ -1700,6 +2376,14 @@ finddir({name} [, {path} [, {count}]]) *finddir()* This is quite similar to the ex-command `:find`. + Parameters: ~ + • {name} (`string`) + • {path} (`string?`) + • {count} (`integer?`) + + Return: ~ + (`any`) + findfile({name} [, {path} [, {count}]]) *findfile()* Just like |finddir()|, but find a file instead of a directory. Uses 'suffixesadd'. @@ -1708,6 +2392,14 @@ findfile({name} [, {path} [, {count}]]) *findfile()* < Searches from the directory of the current file upwards until it finds the file "tags.vim". + Parameters: ~ + • {name} (`string`) + • {path} (`string?`) + • {count} (`any?`) + + Return: ~ + (`any`) + flatten({list} [, {maxdepth}]) *flatten()* Flatten {list} up to {maxdepth} levels. Without {maxdepth} the result is a |List| without nesting, as if {maxdepth} is @@ -1727,9 +2419,23 @@ flatten({list} [, {maxdepth}]) *flatten()* echo flatten([1, [2, [3, 4]], 5], 1) < [1, 2, [3, 4], 5] + Parameters: ~ + • {list} (`any[]`) + • {maxdepth} (`integer?`) + + Return: ~ + (`any[]|0`) + flattennew({list} [, {maxdepth}]) *flattennew()* Like |flatten()| but first make a copy of {list}. + Parameters: ~ + • {list} (`any[]`) + • {maxdepth} (`integer?`) + + Return: ~ + (`any[]|0`) + float2nr({expr}) *float2nr()* Convert {expr} to a Number by omitting the part after the decimal point. @@ -1752,6 +2458,12 @@ float2nr({expr}) *float2nr()* echo float2nr(1.0e-100) < 0 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`any`) + floor({expr}) *floor()* Return the largest integral value less than or equal to {expr} as a |Float| (round down). @@ -1765,6 +2477,12 @@ floor({expr}) *floor()* echo floor(4.0) < 4.0 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`any`) + fmod({expr1}, {expr2}) *fmod()* Return the remainder of {expr1} / {expr2}, even if the division is not representable. Returns {expr1} - i * {expr2} @@ -1781,6 +2499,13 @@ fmod({expr1}, {expr2}) *fmod()* echo fmod(-12.33, 1.22) < -0.13 + Parameters: ~ + • {expr1} (`number`) + • {expr2} (`number`) + + Return: ~ + (`any`) + fnameescape({string}) *fnameescape()* Escape {string} for use as file name command argument. All characters that have a special meaning, such as `'%'` and `'|'` @@ -1798,6 +2523,12 @@ fnameescape({string}) *fnameescape()* edit \+some\ str\%nge\|name < + Parameters: ~ + • {string} (`string`) + + Return: ~ + (`string`) + fnamemodify({fname}, {mods}) *fnamemodify()* Modify file name {fname} according to {mods}. {mods} is a string of characters like it is used for file names on the @@ -1815,6 +2546,13 @@ fnamemodify({fname}, {mods}) *fnamemodify()* Note: Environment variables don't work in {fname}, use |expand()| first then. + Parameters: ~ + • {fname} (`string`) + • {mods} (`string`) + + Return: ~ + (`string`) + foldclosed({lnum}) *foldclosed()* The result is a Number. If the line {lnum} is in a closed fold, the result is the number of the first line in that fold. @@ -1822,6 +2560,12 @@ foldclosed({lnum}) *foldclosed()* {lnum} is used like with |getline()|. Thus "." is the current line, "'m" mark m, etc. + Parameters: ~ + • {lnum} (`integer`) + + Return: ~ + (`integer`) + foldclosedend({lnum}) *foldclosedend()* The result is a Number. If the line {lnum} is in a closed fold, the result is the number of the last line in that fold. @@ -1829,6 +2573,12 @@ foldclosedend({lnum}) *foldclosedend()* {lnum} is used like with |getline()|. Thus "." is the current line, "'m" mark m, etc. + Parameters: ~ + • {lnum} (`integer`) + + Return: ~ + (`integer`) + foldlevel({lnum}) *foldlevel()* The result is a Number, which is the foldlevel of line {lnum} in the current buffer. For nested folds the deepest level is @@ -1841,6 +2591,12 @@ foldlevel({lnum}) *foldlevel()* {lnum} is used like with |getline()|. Thus "." is the current line, "'m" mark m, etc. + Parameters: ~ + • {lnum} (`integer`) + + Return: ~ + (`integer`) + foldtext() *foldtext()* Returns a String, to be displayed for a closed fold. This is the default function used for the 'foldtext' option and should @@ -1858,6 +2614,9 @@ foldtext() *foldtext()* setting. Returns an empty string when there is no fold. + Return: ~ + (`string`) + foldtextresult({lnum}) *foldtextresult()* Returns the text that is displayed for the closed fold at line {lnum}. Evaluates 'foldtext' in the appropriate context. @@ -1867,6 +2626,12 @@ foldtextresult({lnum}) *foldtextresult()* line, "'m" mark m, etc. Useful when exporting folded text, e.g., to HTML. + Parameters: ~ + • {lnum} (`integer`) + + Return: ~ + (`string`) + foreach({expr1}, {expr2}) *foreach()* {expr1} must be a |List|, |String|, |Blob| or |Dictionary|. For each item in {expr1} execute {expr2}. {expr1} is not @@ -1902,6 +2667,13 @@ foreach({expr1}, {expr2}) *foreach()* When {expr2} is a Funcref errors inside a function are ignored, unless it was defined with the "abort" flag. + Parameters: ~ + • {expr1} (`string|table`) + • {expr2} (`string|function`) + + Return: ~ + (`string|table`) + fullcommand({name}) *fullcommand()* Get the full command name from a short abbreviated command name; see |20.2| for details on command abbreviations. @@ -1914,6 +2686,12 @@ fullcommand({name}) *fullcommand()* For example `fullcommand('s')`, `fullcommand('sub')`, `fullcommand(':%substitute')` all return "substitute". + Parameters: ~ + • {name} (`string`) + + Return: ~ + (`string`) + funcref({name} [, {arglist}] [, {dict}]) *funcref()* Just like |function()|, but the returned Funcref will lookup the function by reference, not by name. This matters when the @@ -1926,6 +2704,14 @@ funcref({name} [, {arglist}] [, {dict}]) *funcref()* instead). {name} cannot be a builtin function. Returns 0 on error. + Parameters: ~ + • {name} (`string`) + • {arglist} (`any?`) + • {dict} (`any?`) + + Return: ~ + (`any`) + function({name} [, {arglist}] [, {dict}]) *function()* *partial* *E700* *E923* Return a |Funcref| variable that refers to function {name}. {name} can be the name of a user defined function or an @@ -2008,6 +2794,14 @@ function({name} [, {arglist}] [, {dict}]) *function()* *partial* *E700* < Returns 0 on error. + Parameters: ~ + • {name} (`string`) + • {arglist} (`any?`) + • {dict} (`any?`) + + Return: ~ + (`any`) + garbagecollect([{atexit}]) *garbagecollect()* Cleanup unused |Lists| and |Dictionaries| that have circular references. @@ -2028,17 +2822,39 @@ garbagecollect([{atexit}]) *garbagecollect()* it's safe to perform. This is when waiting for the user to type a character. -get({list}, {idx} [, {default}]) *get()* + Parameters: ~ + • {atexit} (`boolean?`) + + Return: ~ + (`any`) + +get({list}, {idx} [, {default}]) *get()* *get()-list* Get item {idx} from |List| {list}. When this item is not available return {default}. Return zero when {default} is omitted. -get({blob}, {idx} [, {default}]) + Parameters: ~ + • {list} (`any[]`) + • {idx} (`integer`) + • {default} (`any?`) + + Return: ~ + (`any`) + +get({blob}, {idx} [, {default}]) *get()-blob* Get byte {idx} from |Blob| {blob}. When this byte is not available return {default}. Return -1 when {default} is omitted. -get({dict}, {key} [, {default}]) + Parameters: ~ + • {blob} (`string`) + • {idx} (`integer`) + • {default} (`any?`) + + Return: ~ + (`any`) + +get({dict}, {key} [, {default}]) *get()-dict* Get item with key {key} from |Dictionary| {dict}. When this item is not available return {default}. Return zero when {default} is omitted. Useful example: >vim @@ -2046,15 +2862,43 @@ get({dict}, {key} [, {default}]) < This gets the value of g:var_name if it exists, and uses "default" when it does not exist. -get({func}, {what}) - Get item {what} from Funcref {func}. Possible values for + Parameters: ~ + • {dict} (`table`) + • {key} (`string`) + • {default} (`any?`) + + Return: ~ + (`any`) + +get({func}, {what}) *get()-func* + Get item {what} from |Funcref| {func}. Possible values for {what} are: - "name" The function name - "func" The function - "dict" The dictionary - "args" The list with arguments + "name" The function name + "func" The function + "dict" The dictionary + "args" The list with arguments + "arity" A dictionary with information about the number of + arguments accepted by the function (minus the + {arglist}) with the following fields: + required the number of positional arguments + optional the number of optional arguments, + in addition to the required ones + varargs |TRUE| if the function accepts a + variable number of arguments |...| + + Note: There is no error, if the {arglist} of + the Funcref contains more arguments than the + Funcref expects, it's not validated. + Returns zero on error. + Parameters: ~ + • {func} (`function`) + • {what} (`string`) + + Return: ~ + (`any`) + getbufinfo([{buf}]) *getbufinfo()* getbufinfo([{dict}]) Get information about buffers as a List of Dictionaries. @@ -2124,6 +2968,12 @@ getbufinfo([{dict}]) getbufvar({bufnr}, '&option_name') < + Parameters: ~ + • {dict} (`vim.fn.getbufinfo.dict?`) + + Return: ~ + (`vim.fn.getbufinfo.ret.item[]`) + getbufline({buf}, {lnum} [, {end}]) *getbufline()* Return a |List| with the lines starting from {lnum} to {end} (inclusive) in the buffer {buf}. If {end} is omitted, a @@ -2148,11 +2998,27 @@ getbufline({buf}, {lnum} [, {end}]) *getbufline()* Example: >vim let lines = getbufline(bufnr("myfile"), 1, "$") +< + + Parameters: ~ + • {buf} (`integer|string`) + • {lnum} (`integer`) + • {end} (`integer?`) + + Return: ~ + (`string[]`) getbufoneline({buf}, {lnum}) *getbufoneline()* Just like `getbufline()` but only get one line and return it as a string. + Parameters: ~ + • {buf} (`integer|string`) + • {lnum} (`integer`) + + Return: ~ + (`string`) + getbufvar({buf}, {varname} [, {def}]) *getbufvar()* The result is the value of option or local buffer variable {varname} in buffer {buf}. Note that the name without "b:" @@ -2174,12 +3040,23 @@ getbufvar({buf}, {varname} [, {def}]) *getbufvar()* let bufmodified = getbufvar(1, "&mod") echo "todo myvar = " .. getbufvar("todo", "myvar") + Parameters: ~ + • {buf} (`integer|string`) + • {varname} (`string`) + • {def} (`any?`) + + Return: ~ + (`any`) + getcellwidths() *getcellwidths()* Returns a |List| of cell widths of character ranges overridden by |setcellwidths()|. The format is equal to the argument of |setcellwidths()|. If no character ranges have their cell widths overridden, an empty List is returned. + Return: ~ + (`any`) + getchangelist([{buf}]) *getchangelist()* Returns the |changelist| for the buffer {buf}. For the use of {buf}, see |bufname()| above. If buffer {buf} doesn't @@ -2196,6 +3073,12 @@ getchangelist([{buf}]) *getchangelist()* position refers to the position in the list. For other buffers, it is set to the length of the list. + Parameters: ~ + • {buf} (`integer|string?`) + + Return: ~ + (`table[]`) + getchar([{expr}]) *getchar()* Get a single character from the user or input stream. If {expr} is omitted, wait until a character is available. @@ -2261,6 +3144,12 @@ getchar([{expr}]) *getchar()* endfunction < + Parameters: ~ + • {expr} (`0|1?`) + + Return: ~ + (`integer`) + getcharmod() *getcharmod()* The result is a Number which is the state of the modifiers for the last obtained character with getchar() or in another way. @@ -2277,6 +3166,9 @@ getcharmod() *getcharmod()* character itself are obtained. Thus Shift-a results in "A" without a modifier. Returns 0 if no modifiers are used. + Return: ~ + (`integer`) + getcharpos({expr}) *getcharpos()* Get the position for String {expr}. Same as |getpos()| but the column number in the returned List is a character index @@ -2291,6 +3183,12 @@ getcharpos({expr}) *getcharpos()* getpos('.') returns [0, 5, 7, 0] < + Parameters: ~ + • {expr} (`string`) + + Return: ~ + (`integer[]`) + getcharsearch() *getcharsearch()* Return the current character search information as a {dict} with the following entries: @@ -2311,6 +3209,9 @@ getcharsearch() *getcharsearch()* nnoremap , getcharsearch().forward ? ',' : ';' < Also see |setcharsearch()|. + Return: ~ + (`table`) + getcharstr([{expr}]) *getcharstr()* Get a single character from the user or input stream as a string. @@ -2323,34 +3224,71 @@ getcharstr([{expr}]) *getcharstr()* Otherwise this works like |getchar()|, except that a number result is converted to a string. + Parameters: ~ + • {expr} (`0|1?`) + + Return: ~ + (`string`) + +getcmdcomplpat() *getcmdcomplpat()* + Return completion pattern of the current command-line. + Only works when the command line is being edited, thus + requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. + Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, + |getcmdprompt()|, |getcmdcompltype()| and |setcmdline()|. + Returns an empty string when completion is not defined. + + Return: ~ + (`string`) + getcmdcompltype() *getcmdcompltype()* Return the type of the current command-line completion. Only works when the command line is being edited, thus requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. See |:command-completion| for the return string. - Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and - |setcmdline()|. + Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, + |getcmdprompt()|, |getcmdcomplpat()| and |setcmdline()|. Returns an empty string when completion is not defined. + Return: ~ + (`string`) + getcmdline() *getcmdline()* - Return the current command-line. Only works when the command - line is being edited, thus requires use of |c_CTRL-\_e| or - |c_CTRL-R_=|. + Return the current command-line input. Only works when the + command line is being edited, thus requires use of + |c_CTRL-\_e| or |c_CTRL-R_=|. Example: >vim cmap eescape(getcmdline(), ' \') -< Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()| and - |setcmdline()|. +< Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()|, + |getcmdprompt()| and |setcmdline()|. Returns an empty string when entering a password or using |inputsecret()|. + Return: ~ + (`string`) + getcmdpos() *getcmdpos()* Return the position of the cursor in the command line as a byte count. The first column is 1. Only works when editing the command line, thus requires use of |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping. Returns 0 otherwise. - Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and - |setcmdline()|. + Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, + |getcmdprompt()| and |setcmdline()|. + + Return: ~ + (`integer`) + +getcmdprompt() *getcmdprompt()* + Return the current command-line prompt when using functions + like |input()| or |confirm()|. + Only works when the command line is being edited, thus + requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. + Also see |getcmdtype()|, |getcmdline()|, |getcmdpos()|, + |setcmdpos()| and |setcmdline()|. + + Return: ~ + (`string`) getcmdscreenpos() *getcmdscreenpos()* Return the screen position of the cursor in the command line @@ -2362,6 +3300,9 @@ getcmdscreenpos() *getcmdscreenpos()* Also see |getcmdpos()|, |setcmdpos()|, |getcmdline()| and |setcmdline()|. + Return: ~ + (`integer`) + getcmdtype() *getcmdtype()* Return the current command-line type. Possible return values are: @@ -2377,11 +3318,17 @@ getcmdtype() *getcmdtype()* Returns an empty string otherwise. Also see |getcmdpos()|, |setcmdpos()| and |getcmdline()|. + Return: ~ + (`':'|'>'|'/'|'?'|'@'|'-'|'='`) + getcmdwintype() *getcmdwintype()* Return the current |command-line-window| type. Possible return values are the same as |getcmdtype()|. Returns an empty string when not in the command-line window. + Return: ~ + (`':'|'>'|'/'|'?'|'@'|'-'|'='`) + getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* Return a list of command-line completion matches. The String {type} argument specifies what for. The following completion @@ -2399,6 +3346,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* customlist,{func} custom completion, defined via {func} diff_buffer |:diffget| and |:diffput| completion dir directory names + dir_in_path directory names in |'cdpath'| environment environment variable names event autocommand events expression Vim expression @@ -2420,6 +3368,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* runtime |:runtime| completion scriptnames sourced script names |:scriptnames| shellcmd Shell command + shellcmdline Shell command line with filename arguments sign |:sign| suboptions syntax syntax file names |'syntax'| syntime |:syntime| suboptions @@ -2451,6 +3400,14 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* If there are no matches, an empty list is returned. An invalid value for {type} produces an error. + Parameters: ~ + • {pat} (`string`) + • {type} (`string`) + • {filtered} (`boolean?`) + + Return: ~ + (`string[]`) + getcurpos([{winid}]) *getcurpos()* Get the position of the cursor. This is like getpos('.'), but includes an extra "curswant" item in the list: @@ -2476,6 +3433,12 @@ getcurpos([{winid}]) *getcurpos()* < Note that this only works within the window. See |winrestview()| for restoring more state. + Parameters: ~ + • {winid} (`integer?`) + + Return: ~ + (`any`) + getcursorcharpos([{winid}]) *getcursorcharpos()* Same as |getcurpos()| but the column number in the returned List is a character index instead of a byte index. @@ -2486,6 +3449,12 @@ getcursorcharpos([{winid}]) *getcursorcharpos()* getcurpos() " returns [0, 3, 4, 0, 3] < + Parameters: ~ + • {winid} (`integer?`) + + Return: ~ + (`any`) + getcwd([{winnr} [, {tabnr}]]) *getcwd()* With no arguments, returns the name of the effective |current-directory|. With {winnr} or {tabnr} the working @@ -2502,6 +3471,13 @@ getcwd([{winnr} [, {tabnr}]]) *getcwd()* directory is returned. Throw error if the arguments are invalid. |E5000| |E5001| |E5002| + Parameters: ~ + • {winnr} (`integer?`) + • {tabnr} (`integer?`) + + Return: ~ + (`string`) + getenv({name}) *getenv()* Return the value of environment variable {name}. The {name} argument is a string, without a leading '$'. Example: >vim @@ -2511,6 +3487,12 @@ getenv({name}) *getenv()* is different from a variable set to an empty string. See also |expr-env|. + Parameters: ~ + • {name} (`string`) + + Return: ~ + (`string`) + getfontname([{name}]) *getfontname()* Without an argument returns the name of the normal font being used. Like what is used for the Normal highlight group @@ -2523,6 +3505,12 @@ getfontname([{name}]) *getfontname()* gvimrc file. Use the |GUIEnter| autocommand to use this function just after the GUI has started. + Parameters: ~ + • {name} (`string?`) + + Return: ~ + (`string`) + getfperm({fname}) *getfperm()* The result is a String, which is the read, write, and execute permissions of the given file {fname}. @@ -2540,6 +3528,12 @@ getfperm({fname}) *getfperm()* For setting permissions use |setfperm()|. + Parameters: ~ + • {fname} (`string`) + + Return: ~ + (`string`) + getfsize({fname}) *getfsize()* The result is a Number, which is the size in bytes of the given file {fname}. @@ -2548,6 +3542,12 @@ getfsize({fname}) *getfsize()* If the size of {fname} is too big to fit in a Number then -2 is returned. + Parameters: ~ + • {fname} (`string`) + + Return: ~ + (`integer`) + getftime({fname}) *getftime()* The result is a Number, which is the last modification time of the given file {fname}. The value is measured as seconds @@ -2555,6 +3555,12 @@ getftime({fname}) *getftime()* |localtime()| and |strftime()|. If the file {fname} can't be found -1 is returned. + Parameters: ~ + • {fname} (`string`) + + Return: ~ + (`integer`) + getftype({fname}) *getftype()* The result is a String, which is a description of the kind of file of the given file {fname}. @@ -2575,6 +3581,12 @@ getftype({fname}) *getftype()* systems that support it. On some systems only "dir" and "file" are returned. + Parameters: ~ + • {fname} (`string`) + + Return: ~ + (`'file'|'dir'|'link'|'bdev'|'cdev'|'socket'|'fifo'|'other'`) + getjumplist([{winnr} [, {tabnr}]]) *getjumplist()* Returns the |jumplist| for the specified window. @@ -2595,6 +3607,13 @@ getjumplist([{winnr} [, {tabnr}]]) *getjumplist()* filename filename if available lnum line number + Parameters: ~ + • {winnr} (`integer?`) + • {tabnr} (`integer?`) + + Return: ~ + (`vim.fn.getjumplist.ret`) + getline({lnum} [, {end}]) *getline()* Without {end} the result is a String, which is line {lnum} from the current buffer. Example: >vim @@ -2620,6 +3639,13 @@ getline({lnum} [, {end}]) *getline()* < To get lines from another buffer see |getbufline()| and |getbufoneline()| + Parameters: ~ + • {lnum} (`integer|string`) + • {end} (`nil|false?`) + + Return: ~ + (`string`) + getloclist({nr} [, {what}]) *getloclist()* Returns a |List| with all the entries in the location list for window {nr}. {nr} can be the window number or the |window-ID|. @@ -2652,6 +3678,13 @@ getloclist({nr} [, {what}]) *getloclist()* echo getloclist(5, {'filewinid': 0}) < + Parameters: ~ + • {nr} (`integer`) + • {what} (`table?`) + + Return: ~ + (`any`) + getmarklist([{buf}]) *getmarklist()* Without the {buf} argument returns a |List| with information about all the global marks. |mark| @@ -2671,6 +3704,12 @@ getmarklist([{buf}]) *getmarklist()* Refer to |getpos()| for getting information about a specific mark. + Parameters: ~ + • {buf} (`integer??`) + + Return: ~ + (`vim.fn.getmarklist.ret.item[]`) + getmatches([{win}]) *getmatches()* Returns a |List| with all matches previously defined for the current window by |matchadd()| and the |:match| commands. @@ -2703,6 +3742,12 @@ getmatches([{win}]) *getmatches()* unlet m < + Parameters: ~ + • {win} (`integer?`) + + Return: ~ + (`any`) + getmousepos() *getmousepos()* Returns a |Dictionary| with the last known position of the mouse. This can be used in a mapping for a mouse click. The @@ -2734,14 +3779,45 @@ getmousepos() *getmousepos()* When using |getchar()| the Vim variables |v:mouse_lnum|, |v:mouse_col| and |v:mouse_winid| also provide these values. + Return: ~ + (`vim.fn.getmousepos.ret`) + getpid() *getpid()* Return a Number which is the process ID of the Vim process. This is a unique number, until Vim exits. + Return: ~ + (`integer`) + getpos({expr}) *getpos()* - Get the position for String {expr}. For possible values of - {expr} see |line()|. For getting the cursor position see - |getcurpos()|. + Get the position for String {expr}. + The accepted values for {expr} are: + . The cursor position. + $ The last line in the current buffer. + 'x Position of mark x (if the mark is not set, 0 is + returned for all values). + w0 First line visible in current window (one if the + display isn't updated, e.g. in silent Ex mode). + w$ Last line visible in current window (this is one + less than "w0" if no lines are visible). + v When not in Visual mode, returns the cursor + position. In Visual mode, returns the other end + of the Visual area. A good way to think about + this is that in Visual mode "v" and "." complement + each other. While "." refers to the cursor + position, "v" refers to where |v_o| would move the + cursor. As a result, you can use "v" and "." + together to work on all of a selection in + characterwise Visual mode. If the cursor is at + the end of a characterwise Visual area, "v" refers + to the start of the same Visual area. And if the + cursor is at the start of a characterwise Visual + area, "v" refers to the end of the same Visual + area. "v" differs from |'<| and |'>| in that it's + updated right away. + Note that a mark in another file can be used. The line number + then applies to another buffer. + The result is a |List| with four numbers: [bufnum, lnum, col, off] "bufnum" is zero, unless a mark like '0 or 'A is used, then it @@ -2752,20 +3828,31 @@ getpos({expr}) *getpos()* it is the offset in screen columns from the start of the character. E.g., a position within a or after the last character. - Note that for '< and '> Visual mode matters: when it is "V" - (visual line mode) the column of '< is zero and the column of - '> is a large number equal to |v:maxcol|. + + For getting the cursor position see |getcurpos()|. The column number in the returned List is the byte position within the line. To get the character position in the line, use |getcharpos()|. + + Note that for '< and '> Visual mode matters: when it is "V" + (visual line mode) the column of '< is zero and the column of + '> is a large number equal to |v:maxcol|. A very large column number equal to |v:maxcol| can be returned, in which case it means "after the end of the line". If {expr} is invalid, returns a list with all zeros. + This can be used to save and restore the position of a mark: >vim let save_a_mark = getpos("'a") " ... call setpos("'a", save_a_mark) -< Also see |getcharpos()|, |getcurpos()| and |setpos()|. +< + Also see |getcharpos()|, |getcurpos()| and |setpos()|. + + Parameters: ~ + • {expr} (`string`) + + Return: ~ + (`integer[]`) getqflist([{what}]) *getqflist()* Returns a |List| with all the current quickfix errors. Each @@ -2871,6 +3958,12 @@ getqflist([{what}]) *getqflist()* echo getqflist({'lines' : ["F1:10:L10"]}) < + Parameters: ~ + • {what} (`table?`) + + Return: ~ + (`any`) + getreg([{regname} [, 1 [, {list}]]]) *getreg()* The result is a String, which is the contents of register {regname}. Example: >vim @@ -2894,6 +3987,13 @@ getreg([{regname} [, 1 [, {list}]]]) *getreg()* If {regname} is not specified, |v:register| is used. + Parameters: ~ + • {regname} (`string?`) + • {list} (`nil|false?`) + + Return: ~ + (`string`) + getreginfo([{regname}]) *getreginfo()* Returns detailed information about register {regname} as a Dictionary with the following entries: @@ -2918,6 +4018,12 @@ getreginfo([{regname}]) *getreginfo()* If {regname} is not specified, |v:register| is used. The returned Dictionary can be passed to |setreg()|. + Parameters: ~ + • {regname} (`string?`) + + Return: ~ + (`table`) + getregion({pos1}, {pos2} [, {opts}]) *getregion()* Returns the list of strings from {pos1} to {pos2} from a buffer. @@ -2930,14 +4036,14 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()* The optional argument {opts} is a Dict and supports the following items: - type Specify the region's selection type - (default: "v"): - "v" for |charwise| mode - "V" for |linewise| mode - "" for |blockwise-visual| mode + type Specify the region's selection type. + See |getregtype()| for possible values, + except that the width can be omitted + and an empty string cannot be used. + (default: "v") exclusive If |TRUE|, use exclusive selection - for the end position + for the end position. (default: follow 'selection') You can get the last selection type by |visualmode()|. @@ -2963,12 +4069,60 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()* difference if the buffer is displayed in a window with different 'virtualedit' or 'list' values. - Examples: > - :xnoremap + Examples: >vim + xnoremap \ echom getregion( \ getpos('v'), getpos('.'), #{ type: mode() }) < + Parameters: ~ + • {pos1} (`table`) + • {pos2} (`table`) + • {opts} (`table?`) + + Return: ~ + (`string[]`) + +getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()* + Same as |getregion()|, but returns a list of positions + describing the buffer text segments bound by {pos1} and + {pos2}. + The segments are a pair of positions for every line: > + [[{start_pos}, {end_pos}], ...] +< + The position is a |List| with four numbers: + [bufnum, lnum, col, off] + "bufnum" is the buffer number. + "lnum" and "col" are the position in the buffer. The first + column is 1. + If the "off" number of a starting position is non-zero, it is + the offset in screen columns from the start of the character. + E.g., a position within a or after the last character. + If the "off" number of an ending position is non-zero, it is + the offset of the character's first cell not included in the + selection, otherwise all its cells are included. + + Apart from the options supported by |getregion()|, {opts} also + supports the following: + + eol If |TRUE|, indicate positions beyond + the end of a line with "col" values + one more than the length of the line. + If |FALSE|, positions are limited + within their lines, and if a line is + empty or the selection is entirely + beyond the end of a line, a "col" + value of 0 is used for both positions. + (default: |FALSE|) + + Parameters: ~ + • {pos1} (`table`) + • {pos2} (`table`) + • {opts} (`table?`) + + Return: ~ + (`integer[][][]`) + getregtype([{regname}]) *getregtype()* The result is a String, which is type of register {regname}. The value will be one of: @@ -2980,6 +4134,12 @@ getregtype([{regname}]) *getregtype()* The {regname} argument is a string. If {regname} is not specified, |v:register| is used. + Parameters: ~ + • {regname} (`string?`) + + Return: ~ + (`string`) + getscriptinfo([{opts}]) *getscriptinfo()* Returns a |List| with information about all the sourced Vim scripts in the order they were sourced, like what @@ -3014,9 +4174,30 @@ getscriptinfo([{opts}]) *getscriptinfo()* Examples: >vim echo getscriptinfo({'name': 'myscript'}) - echo getscriptinfo({'sid': 15}).variables + echo getscriptinfo({'sid': 15})[0].variables < + Parameters: ~ + • {opts} (`table?`) + + Return: ~ + (`vim.fn.getscriptinfo.ret[]`) + +getstacktrace() *getstacktrace()* + Returns the current stack trace of Vim scripts. + Stack trace is a |List|, of which each item is a |Dictionary| + with the following items: + funcref The funcref if the stack is at a function, + otherwise this item is omitted. + event The string of the event description if the + stack is at an autocmd event, otherwise this + item is omitted. + lnum The line number in the script on the stack. + filepath The file path of the script on the stack. + + Return: ~ + (`table[]`) + gettabinfo([{tabnr}]) *gettabinfo()* If {tabnr} is not specified, then information about all the tab pages is returned as a |List|. Each List item is a @@ -3030,6 +4211,12 @@ gettabinfo([{tabnr}]) *gettabinfo()* tabpage-local variables windows List of |window-ID|s in the tab page. + Parameters: ~ + • {tabnr} (`integer?`) + + Return: ~ + (`any`) + gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* Get the value of a tab-local variable {varname} in tab page {tabnr}. |t:var| @@ -3040,6 +4227,14 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* When the tab or variable doesn't exist {def} or an empty string is returned, there is no error message. + Parameters: ~ + • {tabnr} (`integer`) + • {varname} (`string`) + • {def} (`any?`) + + Return: ~ + (`any`) + gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* Get the value of window-local variable {varname} in window {winnr} in tab page {tabnr}. @@ -3067,6 +4262,15 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* gettabwinvar({tabnr}, {winnr}, '&') < + Parameters: ~ + • {tabnr} (`integer`) + • {winnr} (`integer`) + • {varname} (`string`) + • {def} (`any?`) + + Return: ~ + (`any`) + gettagstack([{winnr}]) *gettagstack()* The result is a Dict, which is the tag stack of window {winnr}. {winnr} can be the window number or the |window-ID|. @@ -3095,6 +4299,12 @@ gettagstack([{winnr}]) *gettagstack()* See |tagstack| for more information about the tag stack. + Parameters: ~ + • {winnr} (`integer?`) + + Return: ~ + (`any`) + gettext({text}) *gettext()* Translate String {text} if possible. This is mainly for use in the distributed Vim scripts. When @@ -3106,6 +4316,12 @@ gettext({text}) *gettext()* xgettext does not understand escaping in single quoted strings. + Parameters: ~ + • {text} (`string`) + + Return: ~ + (`string`) + getwininfo([{winid}]) *getwininfo()* Returns information about windows as a |List| with Dictionaries. @@ -3120,6 +4336,8 @@ getwininfo([{winid}]) *getwininfo()* botline last complete displayed buffer line bufnr number of buffer in the window height window height (excluding winbar) + leftcol first column displayed; only used when + 'wrap' is off loclist 1 if showing a location list quickfix 1 if quickfix or location list window terminal 1 if a terminal window @@ -3140,6 +4358,12 @@ getwininfo([{winid}]) *getwininfo()* winrow topmost screen line of the window; "row" from |win_screenpos()| + Parameters: ~ + • {winid} (`integer?`) + + Return: ~ + (`vim.fn.getwininfo.ret.item[]`) + getwinpos([{timeout}]) *getwinpos()* The result is a |List| with two numbers, the result of |getwinposx()| and |getwinposy()| combined: @@ -3161,24 +4385,44 @@ getwinpos([{timeout}]) *getwinpos()* endwhile < + Parameters: ~ + • {timeout} (`integer?`) + + Return: ~ + (`any`) + getwinposx() *getwinposx()* The result is a Number, which is the X coordinate in pixels of the left hand side of the GUI Vim window. The result will be -1 if the information is not available. The value can be used with `:winpos`. + Return: ~ + (`integer`) + getwinposy() *getwinposy()* The result is a Number, which is the Y coordinate in pixels of the top of the GUI Vim window. The result will be -1 if the information is not available. The value can be used with `:winpos`. + Return: ~ + (`integer`) + getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* Like |gettabwinvar()| for the current tabpage. Examples: >vim let list_is_on = getwinvar(2, '&list') echo "myvar = " .. getwinvar(1, 'myvar') + Parameters: ~ + • {winnr} (`integer`) + • {varname} (`string`) + • {def} (`any?`) + + Return: ~ + (`any`) + glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* Expand the file wildcards in {expr}. See |wildcards| for the use of special characters. @@ -3215,6 +4459,15 @@ glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* See |expand()| for expanding special Vim variables. See |system()| for getting the raw output of an external command. + Parameters: ~ + • {expr} (`string`) + • {nosuf} (`boolean?`) + • {list} (`boolean?`) + • {alllinks} (`boolean?`) + + Return: ~ + (`any`) + glob2regpat({string}) *glob2regpat()* Convert a file pattern, as used by glob(), into a search pattern. The result can be used to match with a string that @@ -3231,6 +4484,12 @@ glob2regpat({string}) *glob2regpat()* Note that the result depends on the system. On MS-Windows a backslash usually means a path separator. + Parameters: ~ + • {string} (`string`) + + Return: ~ + (`string`) + globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) *globpath()* Perform glob() for String {expr} on all directories in {path} and concatenate the results. Example: >vim @@ -3266,6 +4525,16 @@ globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) *globpath()* < Upwards search and limiting the depth of "**" is not supported, thus using 'path' will not always work properly. + Parameters: ~ + • {path} (`string`) + • {expr} (`string`) + • {nosuf} (`boolean?`) + • {list} (`boolean?`) + • {allinks} (`boolean?`) + + Return: ~ + (`any`) + has({feature}) *has()* Returns 1 if {feature} is supported, 0 otherwise. The {feature} argument is a feature name like "nvim-0.2.1" or @@ -3334,11 +4603,24 @@ has({feature}) *has()* endif < + Parameters: ~ + • {feature} (`string`) + + Return: ~ + (`0|1`) + has_key({dict}, {key}) *has_key()* The result is a Number, which is TRUE if |Dictionary| {dict} has an entry with key {key}. FALSE otherwise. The {key} argument is a string. + Parameters: ~ + • {dict} (`table`) + • {key} (`string`) + + Return: ~ + (`0|1`) + haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()* The result is a Number, which is 1 when the window has set a local path via |:lcd| or when {winnr} is -1 and the tabpage @@ -3356,6 +4638,13 @@ haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()* If {winnr} is -1 it is ignored, only the tab is resolved. Throw error if the arguments are invalid. |E5000| |E5001| |E5002| + Parameters: ~ + • {winnr} (`integer?`) + • {tabnr} (`integer?`) + + Return: ~ + (`0|1`) + hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* The result is a Number, which is TRUE if there is a mapping that contains {what} in somewhere in the rhs (what it is @@ -3387,6 +4676,14 @@ hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* < This installs the mapping to "\ABCdoit" only if there isn't already a mapping to "\ABCdoit". + Parameters: ~ + • {what} (`any`) + • {mode} (`string?`) + • {abbr} (`boolean?`) + + Return: ~ + (`0|1`) + histadd({history}, {item}) *histadd()* Add the String {item} to the history {history} which can be one of: *hist-names* @@ -3408,6 +4705,13 @@ histadd({history}, {item}) *histadd()* let date=input("Enter date: ") < This function is not available in the |sandbox|. + Parameters: ~ + • {history} (`string`) + • {item} (`any`) + + Return: ~ + (`0|1`) + histdel({history} [, {item}]) *histdel()* Clear {history}, i.e. delete all its entries. See |hist-names| for the possible values of {history}. @@ -3441,6 +4745,13 @@ histdel({history} [, {item}]) *histdel()* let @/ = histget("search", -1) < + Parameters: ~ + • {history} (`string`) + • {item} (`any?`) + + Return: ~ + (`0|1`) + histget({history} [, {index}]) *histget()* The result is a String, the entry with Number {index} from {history}. See |hist-names| for the possible values of @@ -3457,6 +4768,13 @@ histget({history} [, {index}]) *histget()* command -nargs=1 H execute histget("cmd", 0+) < + Parameters: ~ + • {history} (`string`) + • {index} (`integer|string?`) + + Return: ~ + (`string`) + histnr({history}) *histnr()* The result is the Number of the current entry in {history}. See |hist-names| for the possible values of {history}. @@ -3464,6 +4782,13 @@ histnr({history}) *histnr()* Example: >vim let inp_index = histnr("expr") +< + + Parameters: ~ + • {history} (`string`) + + Return: ~ + (`integer`) hlID({name}) *hlID()* The result is a Number, which is the ID of the highlight group @@ -3475,6 +4800,12 @@ hlID({name}) *hlID()* echo synIDattr(synIDtrans(hlID("Comment")), "bg") < + Parameters: ~ + • {name} (`string`) + + Return: ~ + (`integer`) + hlexists({name}) *hlexists()* The result is a Number, which is TRUE if a highlight group called {name} exists. This is when the group has been @@ -3482,11 +4813,20 @@ hlexists({name}) *hlexists()* been defined for it, it may also have been used for a syntax item. + Parameters: ~ + • {name} (`string`) + + Return: ~ + (`0|1`) + hostname() *hostname()* The result is a String, which is the name of the machine on which Vim is currently running. Machine names greater than 256 characters long are truncated. + Return: ~ + (`string`) + iconv({string}, {from}, {to}) *iconv()* The result is a String, which is the text {string} converted from encoding {from} to encoding {to}. @@ -3499,6 +4839,14 @@ iconv({string}, {from}, {to}) *iconv()* from/to UCS-2 is automatically changed to use UTF-8. You cannot use UCS-2 in a string anyway, because of the NUL bytes. + Parameters: ~ + • {string} (`string`) + • {from} (`string`) + • {to} (`string`) + + Return: ~ + (`string`) + id({expr}) *id()* Returns a |String| which is a unique identifier of the container type (|List|, |Dict|, |Blob| and |Partial|). It is @@ -3507,7 +4855,7 @@ id({expr}) *id()* Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and `v:_null_blob` have the same `id()` with different types because they are internally represented as NULL pointers. - `id()` returns a hexadecimal representanion of the pointers to + `id()` returns a hexadecimal representation of the pointers to the containers (i.e. like `0x994a40`), same as `printf("%p", {expr})`, but it is advised against counting on the exact format of the return value. @@ -3516,6 +4864,12 @@ id({expr}) *id()* will not be equal to some other `id()`: new containers may reuse identifiers of the garbage-collected ones. + Parameters: ~ + • {expr} (`any`) + + Return: ~ + (`string`) + indent({lnum}) *indent()* The result is a Number, which is indent of line {lnum} in the current buffer. The indent is counted in spaces, the value @@ -3523,6 +4877,12 @@ indent({lnum}) *indent()* |getline()|. When {lnum} is invalid -1 is returned. + Parameters: ~ + • {lnum} (`integer|string`) + + Return: ~ + (`integer`) + index({object}, {expr} [, {start} [, {ic}]]) *index()* Find {expr} in {object} and return its index. See |indexof()| for using a lambda to select the item. @@ -3549,6 +4909,16 @@ index({object}, {expr} [, {start} [, {ic}]]) *index()* if index(numbers, 123) >= 0 " ... endif +< + + Parameters: ~ + • {object} (`any`) + • {expr} (`any`) + • {start} (`integer?`) + • {ic} (`boolean?`) + + Return: ~ + (`integer`) indexof({object}, {expr} [, {opts}]) *indexof()* Returns the index of an item in {object} where {expr} is @@ -3587,9 +4957,26 @@ indexof({object}, {expr} [, {opts}]) *indexof()* echo indexof(l, "v:val.n == 20") echo indexof(l, {i, v -> v.n == 30}) echo indexof(l, "v:val.n == 20", #{startidx: 1}) +< + + Parameters: ~ + • {object} (`any`) + • {expr} (`any`) + • {opts} (`table?`) + + Return: ~ + (`integer`) input({prompt} [, {text} [, {completion}]]) *input()* + Parameters: ~ + • {prompt} (`string`) + • {text} (`string?`) + • {completion} (`string?`) + + Return: ~ + (`string`) + input({opts}) The result is a String, which is whatever the user typed on the command-line. The {prompt} argument is either a prompt @@ -3699,6 +5086,13 @@ input({opts}) let g:Foo = input("enter search pattern: ") call inputrestore() endfunction +< + + Parameters: ~ + • {opts} (`table`) + + Return: ~ + (`string`) inputlist({textlist}) *inputlist()* {textlist} must be a |List| of strings. This |List| is @@ -3717,12 +5111,21 @@ inputlist({textlist}) *inputlist()* let color = inputlist(['Select color:', '1. red', \ '2. green', '3. blue']) + Parameters: ~ + • {textlist} (`string[]`) + + Return: ~ + (`any`) + inputrestore() *inputrestore()* Restore typeahead that was saved with a previous |inputsave()|. Should be called the same number of times inputsave() is called. Calling it more often is harmless though. Returns TRUE when there is nothing to restore, FALSE otherwise. + Return: ~ + (`integer`) + inputsave() *inputsave()* Preserve typeahead (also from mappings) and clear it, so that a following prompt gets input from the user. Should be @@ -3731,6 +5134,9 @@ inputsave() *inputsave()* many inputrestore() calls. Returns TRUE when out of memory, FALSE otherwise. + Return: ~ + (`integer`) + inputsecret({prompt} [, {text}]) *inputsecret()* This function acts much like the |input()| function with but two exceptions: @@ -3742,6 +5148,13 @@ inputsecret({prompt} [, {text}]) *inputsecret()* typed on the command-line in response to the issued prompt. NOTE: Command-line completion is not supported. + Parameters: ~ + • {prompt} (`string`) + • {text} (`string?`) + + Return: ~ + (`string`) + insert({object}, {item} [, {idx}]) *insert()* When {object} is a |List| or a |Blob| insert {item} at the start of it. @@ -3759,6 +5172,14 @@ insert({object}, {item} [, {idx}]) *insert()* Note that when {item} is a |List| it is inserted as a single item. Use |extend()| to concatenate |Lists|. + Parameters: ~ + • {object} (`any`) + • {item} (`any`) + • {idx} (`integer?`) + + Return: ~ + (`any`) + interrupt() *interrupt()* Interrupt script execution. It works more or less like the user typing CTRL-C, most commands won't execute and control @@ -3773,18 +5194,54 @@ interrupt() *interrupt()* au BufWritePre * call s:check_typoname(expand('')) < + Return: ~ + (`any`) + invert({expr}) *invert()* Bitwise invert. The argument is converted to a number. A List, Dict or Float argument causes an error. Example: >vim let bits = invert(bits) < + Parameters: ~ + • {expr} (`integer`) + + Return: ~ + (`integer`) + +isabsolutepath({path}) *isabsolutepath()* + The result is a Number, which is |TRUE| when {path} is an + absolute path. + On Unix, a path is considered absolute when it starts with '/'. + On MS-Windows, it is considered absolute when it starts with an + optional drive prefix and is followed by a '\' or '/'. UNC paths + are always absolute. + Example: >vim + echo isabsolutepath('/usr/share/') " 1 + echo isabsolutepath('./foobar') " 0 + echo isabsolutepath('C:\Windows') " 1 + echo isabsolutepath('foobar') " 0 + echo isabsolutepath('\\remote\file') " 1 +< + + Parameters: ~ + • {path} (`string`) + + Return: ~ + (`0|1`) + isdirectory({directory}) *isdirectory()* The result is a Number, which is |TRUE| when a directory with the name {directory} exists. If {directory} doesn't exist, or isn't a directory, the result is |FALSE|. {directory} is any expression, which is used as a String. + Parameters: ~ + • {directory} (`string`) + + Return: ~ + (`0|1`) + isinf({expr}) *isinf()* Return 1 if {expr} is a positive infinity, or -1 a negative infinity, otherwise 0. >vim @@ -3793,6 +5250,12 @@ isinf({expr}) *isinf()* echo isinf(-1.0 / 0.0) < -1 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`1|0|-1`) + islocked({expr}) *islocked()* *E786* The result is a Number, which is |TRUE| when {expr} is the name of a locked variable. @@ -3807,11 +5270,23 @@ islocked({expr}) *islocked()* *E78 < When {expr} is a variable that does not exist you get an error message. Use |exists()| to check for existence. + Parameters: ~ + • {expr} (`any`) + + Return: ~ + (`0|1`) + isnan({expr}) *isnan()* Return |TRUE| if {expr} is a float with value NaN. >vim echo isnan(0.0 / 0.0) < 1 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`0|1`) + items({dict}) *items()* Return a |List| with all the key-value pairs of {dict}. Each |List| item is a list with two items: the key of a {dict} @@ -3821,17 +5296,41 @@ items({dict}) *items()* for [key, value] in items(mydict) echo key .. ': ' .. value endfor +< + A List or a String argument is also supported. In these + cases, items() returns a List with the index and the value at + the index. + + Parameters: ~ + • {dict} (`table`) + + Return: ~ + (`any`) jobpid({job}) *jobpid()* Return the PID (process id) of |job-id| {job}. + Parameters: ~ + • {job} (`integer`) + + Return: ~ + (`integer`) + jobresize({job}, {width}, {height}) *jobresize()* Resize the pseudo terminal window of |job-id| {job} to {width} columns and {height} rows. Fails if the job was not started with `"pty":v:true`. + Parameters: ~ + • {job} (`integer`) + • {width} (`integer`) + • {height} (`integer`) + + Return: ~ + (`any`) + jobstart({cmd} [, {opts}]) *jobstart()* - Note: Prefer |vim.system()| in Lua (unless using the `pty` option). + Note: Prefer |vim.system()| in Lua (unless using `rpc`, `pty`, or `term`). Spawns {cmd} as a job. If {cmd} is a List it runs directly (no 'shell'). @@ -3839,8 +5338,11 @@ jobstart({cmd} [, {opts}]) *jobstart()* call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}']) < (See |shell-unquoting| for details.) - Example: >vim - call jobstart('nvim -h', {'on_stdout':{j,d,e->append(line('.'),d)}}) + Example: start a job and handle its output: >vim + call jobstart(['nvim', '-h'], {'on_stdout':{j,d,e->append(line('.'),d)}}) +< + Example: start a job in a |terminal| connected to the current buffer: >vim + call jobstart(['nvim', '-h'], {'term':v:true}) < Returns |job-id| on success, 0 on invalid arguments (or job table is full), -1 if {cmd}[0] or 'shell' is not executable. @@ -3905,6 +5407,10 @@ jobstart({cmd} [, {opts}]) *jobstart()* stdin: (string) Either "pipe" (default) to connect the job's stdin to a channel or "null" to disconnect stdin. + term: (boolean) Spawns {cmd} in a new pseudo-terminal session + connected to the current (unmodified) buffer. Implies "pty". + Default "height" and "width" are set to the current window + dimensions. |jobstart()|. Defaults $TERM to "xterm-256color". width: (number) Width of the `pty` terminal. {opts} is passed as |self| dictionary to the callback; the @@ -3916,6 +5422,13 @@ jobstart({cmd} [, {opts}]) *jobstart()* - -1 if {cmd}[0] is not executable. See also |job-control|, |channel|, |msgpack-rpc|. + Parameters: ~ + • {cmd} (`string|string[]`) + • {opts} (`table?`) + + Return: ~ + (`integer`) + jobstop({id}) *jobstop()* Stop |job-id| {id} by sending SIGTERM to the job process. If the process does not terminate after a timeout then SIGKILL @@ -3926,6 +5439,12 @@ jobstop({id}) *jobstop()* Returns 1 for valid job id, 0 for invalid id, including jobs have exited or stopped. + Parameters: ~ + • {id} (`integer`) + + Return: ~ + (`integer`) + jobwait({jobs} [, {timeout}]) *jobwait()* Waits for jobs and their |on_exit| handlers to complete. @@ -3947,6 +5466,13 @@ jobwait({jobs} [, {timeout}]) *jobwait()* -2 if the job was interrupted (by |CTRL-C|) -3 if the job-id is invalid + Parameters: ~ + • {jobs} (`integer[]`) + • {timeout} (`integer?`) + + Return: ~ + (`integer[]`) + join({list} [, {sep}]) *join()* Join the items in {list} together into one String. When {sep} is specified it is put in between the items. If @@ -3958,6 +5484,13 @@ join({list} [, {sep}]) *join()* converted into a string like with |string()|. The opposite function is |split()|. + Parameters: ~ + • {list} (`any[]`) + • {sep} (`string?`) + + Return: ~ + (`string`) + json_decode({expr}) *json_decode()* Convert {expr} from JSON object. Accepts |readfile()|-style list as the input, as well as regular string. May output any @@ -3973,6 +5506,12 @@ json_decode({expr}) *json_decode()* recommended and the only one required to be supported. Non-UTF-8 characters are an error. + Parameters: ~ + • {expr} (`any`) + + Return: ~ + (`any`) + json_encode({expr}) *json_encode()* Convert {expr} into a JSON string. Accepts |msgpack-special-dict| as the input. Will not convert @@ -3985,10 +5524,22 @@ json_encode({expr}) *json_encode()* or special escapes like "\t", other are dumped as-is. |Blob|s are converted to arrays of the individual bytes. + Parameters: ~ + • {expr} (`any`) + + Return: ~ + (`string`) + keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in arbitrary order. Also see |items()| and |values()|. + Parameters: ~ + • {dict} (`table`) + + Return: ~ + (`string[]`) + keytrans({string}) *keytrans()* Turn the internal byte representation of keys into a form that can be used for |:map|. E.g. >vim @@ -3996,6 +5547,12 @@ keytrans({string}) *keytrans()* echo keytrans(xx) < + Parameters: ~ + • {string} (`string`) + + Return: ~ + (`string`) + len({expr}) *len()* *E701* The result is a Number, which is the length of the argument. When {expr} is a String or a Number the length in bytes is @@ -4007,6 +5564,12 @@ len({expr}) *len()* *E70 |Dictionary| is returned. Otherwise an error is given and returns zero. + Parameters: ~ + • {expr} (`any[]`) + + Return: ~ + (`integer`) + libcall({libname}, {funcname}, {argument}) *libcall()* *E364* *E368* Call function {funcname} in the run-time library {libname} with single argument {argument}. @@ -4049,6 +5612,14 @@ libcall({libname}, {funcname}, {argument}) *libcall()* *E364* *E Examples: >vim echo libcall("libc.so", "getenv", "HOME") + Parameters: ~ + • {libname} (`string`) + • {funcname} (`string`) + • {argument} (`any`) + + Return: ~ + (`any`) + libcallnr({libname}, {funcname}, {argument}) *libcallnr()* Just like |libcall()|, but used for a function that returns an int instead of a string. @@ -4058,29 +5629,25 @@ libcallnr({libname}, {funcname}, {argument}) *libcallnr()* call libcallnr("libc.so", "sleep", 10) < + Parameters: ~ + • {libname} (`string`) + • {funcname} (`string`) + • {argument} (`any`) + + Return: ~ + (`any`) + line({expr} [, {winid}]) *line()* - The result is a Number, which is the line number of the file - position given with {expr}. The {expr} argument is a string. - The accepted positions are: - . the cursor position - $ the last line in the current buffer - 'x position of mark x (if the mark is not set, 0 is - returned) - w0 first line visible in current window (one if the - display isn't updated, e.g. in silent Ex mode) - w$ last line visible in current window (this is one - less than "w0" if no lines are visible) - v In Visual mode: the start of the Visual area (the - cursor is the end). When not in Visual mode - returns the cursor position. Differs from |'<| in - that it's updated right away. - Note that a mark in another file can be used. The line number - then applies to another buffer. + See |getpos()| for accepted positions. + To get the column number use |col()|. To get both use |getpos()|. + With the optional {winid} argument the values are obtained for that window instead of the current window. + Returns 0 for invalid values of {expr} and {winid}. + Examples: >vim echo line(".") " line number of the cursor echo line(".", winid) " idem, in window "winid" @@ -4090,6 +5657,13 @@ line({expr} [, {winid}]) *line()* To jump to the last known position when opening a file see |last-position-jump|. + Parameters: ~ + • {expr} (`string|integer[]`) + • {winid} (`integer?`) + + Return: ~ + (`integer`) + line2byte({lnum}) *line2byte()* Return the byte count from the start of the buffer for line {lnum}. This includes the end-of-line character, depending on @@ -4103,6 +5677,12 @@ line2byte({lnum}) *line2byte()* |getline()|. When {lnum} is invalid -1 is returned. Also see |byte2line()|, |go| and |:goto|. + Parameters: ~ + • {lnum} (`integer`) + + Return: ~ + (`integer`) + lispindent({lnum}) *lispindent()* Get the amount of indent for line {lnum} according the lisp indenting rules, as with 'lisp'. @@ -4110,6 +5690,12 @@ lispindent({lnum}) *lispindent()* relevant. {lnum} is used just like in |getline()|. When {lnum} is invalid, -1 is returned. + Parameters: ~ + • {lnum} (`integer`) + + Return: ~ + (`integer`) + list2blob({list}) *list2blob()* Return a Blob concatenating all the number values in {list}. Examples: >vim @@ -4120,6 +5706,12 @@ list2blob({list}) *list2blob()* |blob2list()| does the opposite. + Parameters: ~ + • {list} (`any[]`) + + Return: ~ + (`string`) + list2str({list} [, {utf8}]) *list2str()* Convert each number in {list} to a character string can concatenate them all. Examples: >vim @@ -4136,10 +5728,20 @@ list2str({list} [, {utf8}]) *list2str()* < Returns an empty string on error. + Parameters: ~ + • {list} (`any[]`) + • {utf8} (`boolean?`) + + Return: ~ + (`string`) + localtime() *localtime()* Return the current time, measured as seconds since 1st Jan 1970. See also |strftime()|, |strptime()| and |getftime()|. + Return: ~ + (`integer`) + log({expr}) *log()* Return the natural logarithm (base e) of {expr} as a |Float|. {expr} must evaluate to a |Float| or a |Number| in the range @@ -4151,6 +5753,12 @@ log({expr}) *log()* echo log(exp(5)) < 5.0 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`number`) + log10({expr}) *log10()* Return the logarithm of Float {expr} to base 10 as a |Float|. {expr} must evaluate to a |Float| or a |Number|. @@ -4161,13 +5769,26 @@ log10({expr}) *log10()* echo log10(0.01) < -2.0 + Parameters: ~ + • {expr} (`number`) + + Return: ~ + (`number`) + luaeval({expr} [, {expr}]) *luaeval()* Evaluate Lua expression {expr} and return its result converted to Vim data structures. See |lua-eval| for more details. + Parameters: ~ + • {expr} (`string`) + • {expr1} (`any[]?`) + + Return: ~ + (`any`) + map({expr1}, {expr2}) *map()* {expr1} must be a |List|, |String|, |Blob| or |Dictionary|. - When {expr1} is a |List|| or |Dictionary|, replace each + When {expr1} is a |List| or |Dictionary|, replace each item in {expr1} with the result of evaluating {expr2}. For a |Blob| each byte is replaced. For a |String|, each character, including composing @@ -4219,6 +5840,13 @@ map({expr1}, {expr2}) *map()* When {expr2} is a Funcref errors inside a function are ignored, unless it was defined with the "abort" flag. + Parameters: ~ + • {expr1} (`string|table|any[]`) + • {expr2} (`string|function`) + + Return: ~ + (`any`) + maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* When {dict} is omitted or zero: Return the rhs of mapping {name} in mode {mode}. The returned String has special @@ -4258,6 +5886,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* "lhsrawalt" The {lhs} of the mapping as raw bytes, alternate form, only present when it differs from "lhsraw" "rhs" The {rhs} of the mapping as typed. + "callback" Lua function, if RHS was defined as such. "silent" 1 for a |:map-silent| mapping, else 0. "noremap" 1 if the {rhs} of the mapping is not remappable. "script" 1 if mapping was defined with