This commit is contained in:
tomit4 2021-11-05 20:24:40 -07:00
commit 78b81b46af
354 changed files with 37443 additions and 21 deletions

@ -0,0 +1 @@
Subproject commit f9534d2710651d45c29e656a2dd7cb1b63c2d709

1
.vim/plugged/coc.nvim Submodule

@ -0,0 +1 @@
Subproject commit 287c743c9f227fdf0e1db452bbb8ae3c5caffc36

@ -0,0 +1 @@
Subproject commit 61e964f2d168f52cb8e80e67d26605b52d726b16

@ -0,0 +1 @@
Subproject commit 5617a1cf7d315e6e6f84d825c85e3b669d220bfa

@ -0,0 +1 @@
Subproject commit e5bfe9b89dc9c2fbd24ed0f0596c85fd0568b143

1
.vim/plugged/neoterm Submodule

@ -0,0 +1 @@
Subproject commit e78179a9ceb98de8d0c37bdda435a5deab4d5e71

@ -0,0 +1 @@
Subproject commit a65465d321f2f8a74b2ffa540b9b87563f7e12e8

1
.vim/plugged/nerdtree Submodule

@ -0,0 +1 @@
Subproject commit eed488b1cd1867bd25f19f90e10440c5cc7d6424

@ -0,0 +1 @@
Subproject commit e1fe727127a813095854a5b063c15e955a77eafb

1
.vim/plugged/rainbow Submodule

@ -0,0 +1 @@
Subproject commit 54c79a24725af3a15d3aad20f70a56c7abbd46c3

@ -0,0 +1 @@
Subproject commit d8ff037621e2351278cf0892ca19ee7ce479e802

@ -0,0 +1 @@
Subproject commit d16475cbd7d50664e3d9261951cd4415967c5c41

@ -0,0 +1 @@
Subproject commit 256702dd1432894b3607d3de6cd660863b331818

@ -0,0 +1 @@
Subproject commit 5178ee4d7f4e7761187df30bb709f703d91df18a

@ -0,0 +1 @@
Subproject commit 4d4aa5fe553a47ef5c5c6d0a97bb487fdfda2d5b

@ -0,0 +1 @@
Subproject commit e20908963d9b0114e5da1eacbc516e4b09cf5803

@ -0,0 +1 @@
Subproject commit 9dc9899cedf84d78b93263b1fdb105b37c54c7b5

24
.vscode/argv.json vendored Normal file
View file

@ -0,0 +1,24 @@
// This configuration file allows you to pass permanent command line arguments to VS Code.
// Only a subset of arguments is currently supported to reduce the likelihood of breaking
// the installation.
//
// PLEASE DO NOT CHANGE WITHOUT UNDERSTANDING THE IMPACT
//
// NOTE: Changing this file requires a restart of VS Code.
{
// Use software rendering instead of hardware accelerated rendering.
// This can help in cases where you see rendering issues in VS Code.
// "disable-hardware-acceleration": true,
// Enabled by default by VS Code to resolve color issues in the renderer
// See https://github.com/microsoft/vscode/issues/51791 for details
"disable-color-correct-rendering": true,
// Allows to disable crash reporting.
// Should restart the app if the value is changed.
"enable-crash-reporter": true,
// Unique id used for correlating crash reports sent from this instance.
// Do not edit this value.
"crash-reporter-id": "259d1e94-1ea1-4dcf-8193-0be07efab62d"
}

View file

@ -0,0 +1,18 @@
#!/bin/sh
# Copyright (C) 2017-present Arctic Ice Studio <development@arcticicestudio.com>
# Copyright (C) 2017-present Sven Greb <development@svengreb.de>
#
# Project: Nord Visual Studio Code
# Repository: https://github.com/arcticicestudio/nord-visual-studio-code
# License: MIT
# Git "pre-commit" hook for husky.
#
# References:
# 1. https://github.com/typicode/husky
# 2. https://git-scm.com/docs/githooks#_pre_commit
. "$(dirname "$0")/_/husky.sh"
npm exec lint-staged

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Language="en-US" Id="nord-visual-studio-code" Version="0.19.0" Publisher="arcticicestudio" />
<DisplayName>Nord</DisplayName>
<Description xml:space="preserve">An arctic, north-bluish clean and elegant Visual Studio Code theme.</Description>
<Tags>arctic,north,bluish,clean,elegant,theme,color-theme,__web_extension</Tags>
<Categories>Themes</Categories>
<GalleryFlags>Public</GalleryFlags>
<Badges><Badge Link="https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code" ImgUri="https://vsmarketplacebadge.apphb.com/version/arcticicestudio.nord-visual-studio-code.svg" Description="Extension version" /><Badge Link="https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code" ImgUri="https://vsmarketplacebadge.apphb.com/installs/arcticicestudio.nord-visual-studio-code.svg" Description="Extension installs" /><Badge Link="https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code" ImgUri="https://vsmarketplacebadge.apphb.com/rating/arcticicestudio.nord-visual-studio-code.svg" Description="Extension Rating" /></Badges>
<Properties>
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.12.0" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="ui,workspace,web" />
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="" />
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/arcticicestudio/nord-visual-studio-code.git" />
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/arcticicestudio/nord-visual-studio-code.git" />
<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/arcticicestudio/nord-visual-studio-code.git" />
<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="https://github.com/arcticicestudio/nord-visual-studio-code/issues" />
<Property Id="Microsoft.VisualStudio.Services.Links.Learn" Value="https://github.com/arcticicestudio/nord-visual-studio-code" />
<Property Id="Microsoft.VisualStudio.Services.Branding.Color" Value="#2E3440" />
<Property Id="Microsoft.VisualStudio.Services.Branding.Theme" Value="dark" />
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="true" />
</Properties>
<License>extension/LICENSE.txt</License>
<Icon>extension/assets/extension-marketplace-icon.png</Icon>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
</Installation>
<Dependencies/>
<Assets>
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.Changelog" Path="extension/CHANGELOG.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/assets/extension-marketplace-icon.png" Addressable="true" />
</Assets>
</PackageManifest>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
MIT License (MIT)
Copyright (C) 2017-present Arctic Ice Studio <development@arcticicestudio.com> (https://www.arcticicestudio.com)
Copyright (C) 2017-present Sven Greb <development@svengreb.de> (https://www.svengreb.de)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,95 @@
<p align="center"><a href="https://www.nordtheme.com/ports/visual-studio-code" target="_blank"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/ports/visual-studio-code/repository-hero.png" srcset="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/ports/visual-studio-code/repository-hero-2x.png 2x"/></a></p>
<p align="center"><a href="https://github.com/arcticicestudio/nord-visual-studio-code/releases/latest" target="_blank"><img src="https://img.shields.io/github/release/arcticicestudio/nord-visual-studio-code.svg?style=flat-square&label=Release&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a> <a href="https://www.nordtheme.com/docs/ports/visual-studio-code" target="_blank"><img src="https://img.shields.io/github/release/arcticicestudio/nord-visual-studio-code.svg?style=flat-square&label=Docs&colorA=4c566a&colorB=88c0d0&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI%2BCiAgICA8cGF0aCBmaWxsPSIjZDhkZWU5IiBkPSJNMTMuNzQ2IDIuODEzYS42Ny42NyAwIDAgMC0uNTU5LS4xMzNMOCAzLjg0OGwtNS4xODgtMS4xOGEuNjY5LjY2OSAwIDAgMC0uNTcuMTMzLjY3Ny42NzcgMCAwIDAtLjI0Mi41MzF2OC4xMzNjLS4wMDguMzIuMjEuNTk4LjUyLjY2OGw1LjMzMiAxLjE5OWguMjk2bDUuMzMyLTEuMmEuNjY4LjY2OCAwIDAgMCAuNTItLjY2N1YzLjMzMmEuNjU5LjY1OSAwIDAgMC0uMjU0LS41MnpNMy4zMzIgNC4xNjhsNCAuODk4djYuNzY2bC00LS44OTh6bTkuMzM2IDYuNzY2bC00IC44OThWNS4wNjZsNC0uODk4em0wIDAiLz4KPC9zdmc%2BCg%3D%3D"/></a> <a href="https://github.com/arcticicestudio/nord-visual-studio-code/blob/develop/CHANGELOG.md" target="_blank"><img src="https://img.shields.io/github/release/arcticicestudio/nord-visual-studio-code.svg?style=flat-square&label=Changelog&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a></p>
<p align="center"><a href="https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code" target="_blank"><img src="https://vsmarketplacebadge.apphb.com/version/arcticicestudio.nord-visual-studio-code.svg?style=flat-square&label=Extension%20Marketplace&logo=visual-studio-code&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a> <a href="https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code" target="_blank"><img src="https://vsmarketplacebadge.apphb.com/installs/arcticicestudio.nord-visual-studio-code.svg?style=flat-square&label=Installations&logo=visual-studio-code&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a> <a href="https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code" target="_blank"><img src="https://vsmarketplacebadge.apphb.com/rating-short/arcticicestudio.nord-visual-studio-code.svg?style=flat-square&label=Rating&logo=visual-studio-code&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a></p>
<p align="center"><a href="https://circleci.com/gh/arcticicestudio/nord-visual-studio-code" target="_blank"><img src="https://img.shields.io/circleci/project/github/arcticicestudio/nord-visual-studio-code/develop.svg?style=flat-square&label=Build&logo=circleci&logoColor=eceff4&colorA=4c566a"/></a> <a href="https://code.visualstudio.com/updates/v1_12" target="_blank"><img src="https://img.shields.io/static/v1.svg?style=flat-square&label=Compatibility&message=%3E%3D1.12.0&logo=visual-studio-code&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a></p>
<p align="center"><a href="https://github.com/arcticicestudio/styleguide-javascript/releases/latest" target="_blank"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-javascript.svg?style=flat-square&label=JavaScript%20Style%20Guide&logoColor=eceff4&colorA=4c566a&colorB=88c0d0&logo=javascript"/></a> <a href="https://github.com/arcticicestudio/styleguide-markdown/releases/latest" target="_blank"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-markdown.svg?style=flat-square&label=Markdown%20Style%20Guide&colorA=4c566a&colorB=88c0d0&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzOSIgaGVpZ2h0PSIzOSIgdmlld0JveD0iMCAwIDM5IDM5Ij48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNEOERFRTkiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMS41IDEuNWgzNnYzNmgtMzZ6Ii8%2BPHBhdGggZmlsbD0iI0Q4REVFOSIgZD0iTTIwLjY4MyAyNS42NTVsNS44NzItMTMuNDhoLjU2Nmw1Ljg3MyAxMy40OGgtMS45OTZsLTQuMTU5LTEwLjA1Ni00LjE2MSAxMC4wNTZoLTEuOTk1em0tMi42OTYgMGwtMTMuNDgtNS44NzJ2LS41NjZsMTMuNDgtNS44NzJ2MS45OTVMNy45MzEgMTkuNWwxMC4wNTYgNC4xNnoiLz48L3N2Zz4%3D"/></a> <a href="https://github.com/arcticicestudio/styleguide-git/releases/latest" target="_blank"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-git.svg?style=flat-square&label=Git%20Style%20Guide&logoColor=eceff4&colorA=4c566a&colorB=88c0d0&logo=git"/></a></p>
<p align="center">An arctic, north-bluish clean and elegant <a href="https://code.visualstudio.com" target="_blank">Visual Studio Code</a> theme.</p>
<p align="center">Designed for a fluent and clear workflow based on the <a href="https://www.nordtheme.com" target="_blank">Nord</a> color palette.</p>
<p align="center"><a href="https://www.nordtheme.com/ports/visual-studio-code" target="_blank"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/ports/visual-studio-code/ui-overview-jsx.png"/></a></p>
## Getting Started
Visit the [official website][nord-home] to learn all about the [syntax highlighting][nord-home#syntax] features, details and elements of the [UI and editor elements][nord-home#editor-details] and the [one-click setup][nord-home#setup].
Learn about the [installation and activation][nord-docs-home-install], how to [customize][nord-docs-home-custom] and [develop][nord-docs-home-develop] the theme from the [official documentations][nord-docs-home].
### Quick Start
Thanks to the official [VS Code Extension Marketplace][vscode-extmarket-home], _Nord Visual Studio Code_ can be installed with one click.
Open the [extension marketplace][vscode-docs-extmarket] by clicking on the _Extensions_ icon in the [_Activity Bar_][vscode-docs-ui-actbar]. Search for `Nord` and click on the <kbd>Install</kbd> button.
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/ports/visual-studio-code/ui-extension-marketplace.png"/></p>
See Nord Visual Studio Code's documentation for details about more installation options like a [manual import through a local VSIX extension file][nord-docs-home-install#local].
#### Activation
To activate the theme click on the gear icon in the _Activity Bar_ and select _Color Theme_. Search for `Nord` and confirm the color theme change with <kbd>Enter</kbd>.
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/ports/visual-studio-code/ui-color-theme-select.png"/></p>
See Nord Visual Studio Code's documentation for details about [more activation options][nord-docs-home-install#activation].
## Features
<div align="center"><p><strong>Your IDE. Your style.</strong></p><p>A unified UI and editor syntax element design provides a clutter-free and fluidly merging appearance.</p></div>
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/ports/visual-studio-code/ui-overview-go.png"/></p>
<div align="center"><p><strong>Beautiful code to keep focused.</strong></p><p>The editor color scheme supports a wide range of programming languages — From bundled definitions up to many popular third-party syntax extensions.</p></div>
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/ports/visual-studio-code/editor-syntax-go.png"/></p>
<div align="center"><p><strong>Small details with unobtrusive styles.</strong></p><p>Popular and common code editor features like search result marker and brace matching are designed to get out of your way with a visually attractive appearance.</p></div>
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/ports/visual-studio-code/editor-syntax-go-comments.png"/></p>
## Contributing
Nord is an open source project and we love to receive contributions from the [community][nord-comm]!
There are many ways to contribute, from [writing- and improving documentation and tutorials][nord-contrib-guide-docs], [reporting bugs][nord-contrib-guide-bugs], [submitting enhancement suggestions][nord-contrib-guide-enhance] that can be added to Nord by [submitting pull requests][nord-contrib-guide-pr].
Please take a moment to read Nord's full [contributing guide][nord-contrib-guide] to learn about the development process, the project's used [styleguides][nord-contrib-guide-styles], [branch organization][nord-contrib-guide-branching] and [versioning][nord-contrib-guide-versioning] model.
The guide also includes information about [minimal, complete, and verifiable examples][nord-contrib-guide-mcve] and other ways to contribute to the project like [improving existing issues][nord-contrib-guide-impr-issues] and [giving feedback on issues and pull requests][nord-contrib-guide-feedback].
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/nord/repository-footer-separator.png" srcset="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/nord/repository-footer-separator-2x.png 2x" /></p>
<p align="center">Copyright &copy; 2017-present <a href="https://www.arcticicestudio.com" target="_blank">Arctic Ice Studio</a> and <a href="https://www.svengreb.de" target="_blank">Sven Greb</a></p>
<p align="center"><a href="https://github.com/arcticicestudio/nord-visual-studio-code/blob/develop/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=flat-square&label=License&message=MIT&logoColor=eceff4&logo=github&colorA=4c566a&colorB=88c0d0"/></a></p>
[nord-comm]: https://www.nordtheme.com/community
[nord-contrib-guide-branching]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#branch-organization
[nord-contrib-guide-bugs]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#bug-reports
[nord-contrib-guide-docs]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#documentations
[nord-contrib-guide-enhance]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#enhancement-suggestions
[nord-contrib-guide-feedback]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#give-feedback-on-issues-and-pull-requests
[nord-contrib-guide-impr-issues]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#improve-issues
[nord-contrib-guide-mcve]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#mcve
[nord-contrib-guide-pr]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#pull-requests
[nord-contrib-guide-styles]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#styleguides
[nord-contrib-guide-versioning]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md#versioning
[nord-contrib-guide]: https://github.com/arcticicestudio/nord/blob/develop/CONTRIBUTING.md
[nord-docs-home-custom]: https://www.nordtheme.com/docs/ports/visual-studio-code/customization
[nord-docs-home-develop]: https://www.nordtheme.com/docs/ports/visual-studio-code/development
[nord-docs-home-install]: https://www.nordtheme.com/docs/ports/visual-studio-code/installation
[nord-docs-home-install#activation]: https://www.nordtheme.com/docs/ports/visual-studio-code/installation#activation
[nord-docs-home-install#local]: https://www.nordtheme.com/docs/ports/visual-studio-code/installation#local-installation
[nord-docs-home]: https://www.nordtheme.com/docs/ports/visual-studio-code
[nord-home]: https://www.nordtheme.com/ports/visual-studio-code
[nord-home#editor-details]: https://www.nordtheme.com/ports/visual-studio-code#editor-details
[nord-home#setup]: https://www.nordtheme.com/ports/visual-studio-code#setup
[nord-home#syntax]: https://www.nordtheme.com/ports/visual-studio-code#syntax
[vscode-docs-extmarket]: https://code.visualstudio.com/docs/editor/extension-gallery
[vscode-docs-ui-actbar]: https://code.visualstudio.com/docs/getstarted/userinterface#_activity-bar
[vscode-extmarket-home]: https://marketplace.visualstudio.com/items?itemName=arcticicestudio.nord-visual-studio-code

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -0,0 +1,107 @@
{
"name": "nord-visual-studio-code",
"displayName": "Nord",
"description": "An arctic, north-bluish clean and elegant Visual Studio Code theme.",
"version": "0.19.0",
"publisher": "arcticicestudio",
"author": {
"name": "Arctic Ice Studio",
"email": "development@arcticicestudio.com",
"url": "https://www.arcticicestudio.com"
},
"homepage": "https://github.com/arcticicestudio/nord-visual-studio-code",
"repository": {
"type": "git",
"url": "https://github.com/arcticicestudio/nord-visual-studio-code"
},
"bugs": {
"url": "https://github.com/arcticicestudio/nord-visual-studio-code/issues"
},
"license": "MIT",
"engines": {
"node": ">=15.13",
"npm": ">=7.7",
"vscode": "^1.12.0"
},
"galleryBanner": {
"color": "#2E3440",
"theme": "dark"
},
"icon": "assets/extension-marketplace-icon.png",
"markdown": "github",
"categories": [
"Themes"
],
"keywords": [
"arctic",
"north",
"bluish",
"clean",
"elegant"
],
"badges": [
{
"url": "https://vsmarketplacebadge.apphb.com/version/arcticicestudio.nord-visual-studio-code.svg",
"href": "https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code",
"description": "Extension version"
},
{
"url": "https://vsmarketplacebadge.apphb.com/installs/arcticicestudio.nord-visual-studio-code.svg",
"href": "https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code",
"description": "Extension installs"
},
{
"url": "https://vsmarketplacebadge.apphb.com/rating/arcticicestudio.nord-visual-studio-code.svg",
"href": "https://marketplace.visualstudio.com/items/arcticicestudio.nord-visual-studio-code",
"description": "Extension Rating"
}
],
"contributes": {
"themes": [
{
"label": "Nord",
"uiTheme": "vs-dark",
"path": "./themes/nord-color-theme.json"
}
]
},
"scripts": {
"build": "run-s clean package",
"clean": "del *.vsix",
"format": "run-s format:pretty format:fix",
"format:fix": "eslint --fix --ext .js,.json .",
"format:pretty": "prettier --write .",
"lint": "run-s lint:*",
"lint:ci:pretty": "prettier --loglevel silent --check .",
"lint:js": "eslint --ext .",
"lint:json": "eslint --ext .json .",
"lint:md": "remark --no-stdout . \".github/**/*.md\"",
"package": "vsce package",
"vsce:publish": "vsce publish",
"prepare:husky": "husky install",
"prepare": "run-s prepare:*"
},
"devDependencies": {
"@arcticicestudio/eslint-config-base": ">=0.11.0 <1.0.0",
"@arcticicestudio/remark-preset-lint": ">=0.4.0 <1.0.0",
"@babel/eslint-parser": "^7.15.7",
"del-cli": "^4.0.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsonc": "^1.7.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.2",
"lint-staged": "^11.1.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.4.1",
"remark-cli": "^9.0.0",
"vsce": "^1.100.0"
},
"__metadata": {
"id": "6f35c257-7fd5-4bc2-9cd1-01976589c17a",
"publisherId": "d6e09771-ef61-4944-9f28-44e338818618",
"publisherDisplayName": "arcticicestudio",
"installedTimestamp": 1632763322301
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [asvetliakov, theol0403]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View file

@ -0,0 +1,66 @@
name: Code Check & Test
on:
pull_request:
branches:
- master
jobs:
build:
name: Build & Test
strategy:
matrix:
# os: [macos-latest, ubuntu-latest, windows-latest]
# CI windows have some issues, i'm not sure why
os: [macos-latest, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "12"
- name: Install Neovim
uses: rhysd/action-setup-vim@v1
id: vim
with:
neovim: true
version: nightly
- name: Yarn install
run: yarn --silent --frozen-lockfile
- name: Build
run: yarn run test-compile
- name: Webpack
run: yarn run webpack
- name: Lint
run: yarn run lint
- name: Test
uses: GabrielBB/xvfb-action@v1.4
env:
NEOVIM_PATH: ${{ steps.vim.outputs.executable }}
NEOVIM_DEBUG: 1
NEOVIM_DEBUG_HOST: 127.0.0.1
NEOVIM_DEBUG_PORT: 4000
with:
run: yarn run test
create:
name: Create extension
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "12"
- name: Yarn install
run: yarn --silent --frozen-lockfile
- name: Install VSCE
run: yarn add vsce
- name: Create extension
run: yarn run vsce package -o vscode-neovim-${{github.sha}}.vsix
- name: Upload extension
if: runner.os == 'Linux'
uses: actions/upload-artifact@v2
with:
name: vscode-neovim
path: vscode-neovim-${{github.sha}}.vsix

View file

@ -0,0 +1,10 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 120,
tabWidth: 4,
singleQuote: false,
proseWrap: "always"
};

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Language="en-US" Id="vscode-neovim" Version="0.0.82" Publisher="asvetliakov"/>
<DisplayName>VSCode Neovim</DisplayName>
<Description xml:space="preserve">VSCode Neovim Integration</Description>
<Tags>keybindings,vi,vim,neovim</Tags>
<Categories>Other,Keymaps</Categories>
<GalleryFlags>Public</GalleryFlags>
<Badges></Badges>
<Properties>
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.54.0" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="ui" />
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="" />
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/asvetliakov/vscode-neovim" />
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/asvetliakov/vscode-neovim" />
<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/asvetliakov/vscode-neovim" />
<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="https://github.com/asvetliakov/vscode-neovim/issues" />
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="true" />
</Properties>
<License>extension/LICENSE.txt</License>
<Icon>extension/images/icon.png</Icon>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
</Installation>
<Dependencies/>
<Assets>
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.Changelog" Path="extension/CHANGELOG.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/images/icon.png" Addressable="true" />
</Assets>
</PackageManifest>

View file

@ -0,0 +1,278 @@
# Change Log
## [0.0.82]
- Big updates to keybindings ! ( [#513](https://github.com/asvetliakov/vscode-neovim/issues/513) , [#654](https://github.com/asvetliakov/vscode-neovim/issues/654) , [#557](https://github.com/asvetliakov/vscode-neovim/issues/557) , [#585](https://github.com/asvetliakov/vscode-neovim/issues/585) , [#655](https://github.com/asvetliakov/vscode-neovim/issues/655) )
## [0.0.81]
- Revert ( [#649](https://github.com/asvetliakov/vscode-neovim/issues/649) )
## [0.0.80]
- Improve cursor position behaviour ( [#649](https://github.com/asvetliakov/vscode-neovim/issues/649) )
## [0.0.79]
- Fix infinity file opened loop on recent neovim versions ( [#632](https://github.com/asvetliakov/vscode-neovim/issues/632) )
## [0.0.78]
- Fix init error with no workspace folders open ( [#526](https://github.com/asvetliakov/vscode-neovim/issues/526) )
- Update README.md ( [#527](https://github.com/asvetliakov/vscode-neovim/issues/527) )
## [0.0.77]
- Fix cursor with tab indentation ( [#516](https://github.com/asvetliakov/vscode-neovim/issues/516) , [#515](https://github.com/asvetliakov/vscode-neovim/issues/515) )
- Handle correctly WSL path with spaces ( [#509](https://github.com/asvetliakov/vscode-neovim/issues/509) )
## [0.0.76]
- Fix mutli-column character handling ( [#503](https://github.com/asvetliakov/vscode-neovim/issues/503) )
## [0.0.75]
- Improvements to cursor logic ( [#501](https://github.com/asvetliakov/vscode-neovim/issues/501) )
- Cancel current mode when switching editor ( [#156](https://github.com/asvetliakov/vscode-neovim/issues/156) )
## [0.0.74]
- Fix cursor logic ( [#467](https://github.com/asvetliakov/vscode-neovim/issues/467) , [#488](https://github.com/asvetliakov/vscode-neovim/issues/488) )
- Trigger matching word highlight after movement ( [#159](https://github.com/asvetliakov/vscode-neovim/issues/159) )
- VIM highlight adjustments ( [#482](https://github.com/asvetliakov/vscode-neovim/issues/482) )
## [0.0.73]
- Improve cursor reveailing logic ( [#479](https://github.com/asvetliakov/vscode-neovim/issues/479) )
- Hook g0 / g\$ ( [#455](https://github.com/asvetliakov/vscode-neovim/issues/455) )
## [0.0.72]
- Fix undo regression introduced in `0.0.70`
## [0.0.71]
- Fix `Unable to determine neovim windows id` error spam ( [#418](https://github.com/asvetliakov/vscode-neovim/issues/418) )
## [0.0.70]
- Use vscode jumplist actions instead of neovim
- Fix uppercase marks ( [#228](https://github.com/asvetliakov/vscode-neovim/issues/228) )
- Various cursor & buffer management fixes ( [#404](https://github.com/asvetliakov/vscode-neovim/issues/404) , [#392](https://github.com/asvetliakov/vscode-neovim/issues/392) , [#386](https://github.com/asvetliakov/vscode-neovim/issues/386) )
- Implement manageEditorHeight and manageEditorWidth ( [#444](https://github.com/asvetliakov/vscode-neovim/issues/444) )
- Fix `<C-a>` in insert mode ( [#283](https://github.com/asvetliakov/vscode-neovim/issues/283) )
- Set vim cwd as vscode workspace ( [#429](https://github.com/asvetliakov/vscode-neovim/issues/429) )
- Fix shell-agnostic WSL integration ( [#147](https://github.com/asvetliakov/vscode-neovim/issues/147) )
- Map :x to Wq ( [#396](https://github.com/asvetliakov/vscode-neovim/issues/396) )
- Various docs contributions
- Improve build ( [#378](https://github.com/asvetliakov/vscode-neovim/issues/378) )
## [0.0.63]
- Allow to put text decorations (usually EasyMotion ones) at top setting (`vscode-neovim.textDecorationsAtTop`) ( [#358](https://github.com/asvetliakov/vscode-neovim/issues/358) ), contributed by @jhgarner
- Fix incorrect `<C-w><C-w>/<C-w>w` mappings ( [#359](https://github.com/asvetliakov/vscode-neovim/issues/359) ), contributed by @tschaei
- Replace/modernize neovim vscode command line interop mappings by `<Cmd>call` ( [#362](https://github.com/asvetliakov/vscode-neovim/issues/362) ), contributed by @theol0403
- Fix incorrect `<C-w>gf` mapping ( [#365](https://github.com/asvetliakov/vscode-neovim/issues/365) ), contributed by @Yuuki77
- Fix applying vim HL (such as `MatchParen`) at end of a line ( [#371](https://github.com/asvetliakov/vscode-neovim/issues/371) )
- Fix incorrect cursor position when selecting next/prev search result ( [#366](https://github.com/asvetliakov/vscode-neovim/issues/366) )
- Fix/improve behavior of auto-accepting vim return prompt `Press enter to continue`. In some cases it was excess ( [#372](https://github.com/asvetliakov/vscode-neovim/issues/372) )
- Bundle extension by webpack ( [#377](https://github.com/asvetliakov/vscode-neovim/issues/377) )
## [0.0.62]
- Fix jumplist ( [#350](https://github.com/asvetliakov/vscode-neovim/issues/350) )
- Add `K` and `gO` mappings (mapped to `showHover` and `goToSymbol`) ( [#108](https://github.com/asvetliakov/vscode-neovim/issues/108) ) (@Shatur95)
- Fix images/icon (@Shatur95)
## [0.0.60/61]
Started from this version `neovim 0.5` nightly version is required
Many things have been refactored/changed internally in this release. So if you see any regression - please fill an issue
- Turn on VIM smartindenting/autoindenting and remove custom vscode bindings to `o`/`O` (so it uses VIM ones)
- New buffer,window and cursor management. This makes the extension finally work with git diff view, peek views, search editor views and even in output channels! ( [#53](https://github.com/asvetliakov/vscode-neovim/issues/53) , [#187](https://github.com/asvetliakov/vscode-neovim/issues/187) , [#220](https://github.com/asvetliakov/vscode-neovim/issues/220) , [#223](https://github.com/asvetliakov/vscode-neovim/issues/223), [#226](https://github.com/asvetliakov/vscode-neovim/issues/226))
- Implement multi-line messages pager. Things like `:registers`, `:changes`, `:jumps`, `:messages` are working correctly now ( [#202](https://github.com/asvetliakov/vscode-neovim/issues/202) , [#78](https://github.com/asvetliakov/vscode-neovim/issues/78) , [#296](https://github.com/asvetliakov/vscode-neovim/issues/296) )
- Fix tab indent problems and sync vscode tab settings with neovim ( [#275](https://github.com/asvetliakov/vscode-neovim/issues/275) , [#239](https://github.com/asvetliakov/vscode-neovim/issues/239) , [#264](https://github.com/asvetliakov/vscode-neovim/issues/264) , [#167](https://github.com/asvetliakov/vscode-neovim/issues/167) , [#100](https://github.com/asvetliakov/vscode-neovim/issues/100) , [#152](https://github.com/asvetliakov/vscode-neovim/issues/152) , [#289](https://github.com/asvetliakov/vscode-neovim/issues/289) )
- Fix few macro recording problems ( [#207](https://github.com/asvetliakov/vscode-neovim/issues/207) )
- Fix ghost keys after exiting insert mode ( [#324](https://github.com/asvetliakov/vscode-neovim/issues/324) ). For `jj` / `jk` users there are still few problems ( [#330](https://github.com/asvetliakov/vscode-neovim/issues/330) ) but they will be sorted in next releases
- Fix few command line problems ( [#155](https://github.com/asvetliakov/vscode-neovim/issues/155) , [#288](https://github.com/asvetliakov/vscode-neovim/issues/288) )
- Fix some buffer desync issues ( [#312](https://github.com/asvetliakov/vscode-neovim/issues/312) )
- Fix `<C-w>v/<C-w>s` split shortcuts ( [#331](https://github.com/asvetliakov/vscode-neovim/issues/331) )
- Fix brackets for substitute command ( [#300](https://github.com/asvetliakov/vscode-neovim/issues/300) )
- Add logger and log-related configuration to options
- Change some default code-actions mappings ( [#339](https://github.com/asvetliakov/vscode-neovim/issues/339) )
- Add extension icon. Many thanks to https://github.com/ngscheurich
## [0.0.52]
- Implement dot repeat (`.`) command ( [#209](https://github.com/asvetliakov/vscode-neovim/issues/209) , [#173](https://github.com/asvetliakov/vscode-neovim/issues/173) ). Also fixes `<count>` insert comamnds, like [#255](https://github.com/asvetliakov/vscode-neovim/issues/255) , [#249](https://github.com/asvetliakov/vscode-neovim/issues/249)
- Removed file name from statusbar ( [#291](https://github.com/asvetliakov/vscode-neovim/issues/291) , [#230](https://github.com/asvetliakov/vscode-neovim/issues/230) ), thanks @Shatur95
- Fix visual selection conversion ( [#233](https://github.com/asvetliakov/vscode-neovim/issues/233) ), thanks @Shatur95
- Fix wrong string comparsions ( [#308](https://github.com/asvetliakov/vscode-neovim/issues/308) ), thanks @Shatur95
- Make espace keys work only when editor has focus ( [#290](https://github.com/asvetliakov/vscode-neovim/issues/290) ) , thanks @David-Else
- Added some file name completion in commandline ( [#192](https://github.com/asvetliakov/vscode-neovim/issues/192) ), thanks @ppwwyyxx
- Fix missing `<C-w>c` mapping ( [#180](https://github.com/asvetliakov/vscode-neovim/issues/180) ), thanks @trkoch
- Add operating system dependent path settings ( [#137](https://github.com/asvetliakov/vscode-neovim/issues/137) ), thanks @3nuc
- bind gh to mousehover ( [#107](https://github.com/asvetliakov/vscode-neovim/issues/107) ), thanks @kwonoj
## [0.0.50]
- Fix cursor & extension hang for some cases ( [#153](https://github.com/asvetliakov/vscode-neovim/issues/153) )
## [0.0.49]
- Use command line completion only for command line originated via `:` command ( [#146](https://github.com/asvetliakov/vscode-neovim/issues/146) )
## [0.0.48]
- Fix incorrect cursor for multibyte single column width characters ( [#142](https://github.com/asvetliakov/vscode-neovim/issues/142) )
- Fix vim-easymotion decorators drifting when text has multi-byte characters ( [#144](https://github.com/asvetliakov/vscode-neovim/issues/144) )
- Disabled vim modeline processing
- Force vim folds to be always opened to prevent problems
- Fix vim-easymotion decorators drifting to the end of line ( [#60](https://github.com/asvetliakov/vscode-neovim/issues/60) )
- Fix incorrect cursor positions after commands/mappings such as `>gv` ( [#141](https://github.com/asvetliakov/vscode-neovim/issues/141) )
- Fix double command prompt ( [#120](https://github.com/asvetliakov/vscode-neovim/issues/120) )
## [0.0.47]
- Fix the problem when cursor/extension stucks for second+ editor columns ( [#126](https://github.com/asvetliakov/vscode-neovim/issues/126) )
## [0.0.46]
- Update `neovim-client` to latest version. This should eliminate delay between operations and generally improve the performance. Kudos to @kwonoj for impressive work here
- Fix cursor movement for 2-byte chars ( [#127](https://github.com/asvetliakov/vscode-neovim/issues/127) )
## [0.0.45]
- Fix VIM filetype detection ( [#115](https://github.com/asvetliakov/vscode-neovim/issues/115) ). This means `FileType` autocmd should work correctly now. Also fixes `vim-matchup` plugin. This may introduce some side effects from previously disabled filetype plugins - just fill an issue if something doesn't work
- Fix broken cursor position in insert mode for special keys (such as `del`/`backspace`/etc) if you had recorded a macro in insert mode previously
## [0.0.44]
- Hotfix broken `VSCodeCallRange` (commenting/formatting didn't work because of this)
## [0.0.43]
- Visual modes DON'T produce vscode selections right now. These were implemented through various workarounds, gave really small value and were constant origin of headache. Also this fixes few issues related to visual modes ( [#105](https://github.com/asvetliakov/vscode-neovim/issues/105), [#118](https://github.com/asvetliakov/vscode-neovim/issues/118) ). To round the corners, invoking vscode's command palette (by using default vscode hotkeys) from visual mode will convert neovim visual selection to vscode visual selection, this should cover most use cases. Also, there are `VScodeNotifyRange`/`VSCodeCallRange`/`VSCodeNotifyRangePos`/`VSCodeCallRangePos` vim functions if you need to call vscode command with selection. See [this for example](https://github.com/asvetliakov/vscode-neovim/blob/e61832119988bb1e73b81df72956878819426ce2/vim/vscode-code-actions.vim#L42-L54) and [mapping](https://github.com/asvetliakov/vscode-neovim/blob/e61832119988bb1e73b81df72956878819426ce2/vim/vscode-code-actions.vim#L98) if you're doing custom mappings and assuming there is some vscode selection exist. Use `VSCodeNotifyRange` when you don't need a column pos (e.g. for visual line mode) and `VSCodeNotifyRangePos` when you need them (e.g for visual mode).
- Refactored vscode<->neovim cursor syncrhonization
- Fix `ma`/`mi` not working when selecting lines upward ( [#117](https://github.com/asvetliakov/vscode-neovim/issues/117) )
- Changed `ma`/`mi` to skip empty lines. Added `mA`/`mI` for the previous behavior
- Macro recording fixes
- Refactored & optimized HL provider (highlight should be faster now)
- Override default keybindings only when neovim was initialized succesfully ( [#112](https://github.com/asvetliakov/vscode-neovim/issues/112) )
- Don't preselect `'<,'>` marks when invoking cmdline from visual line ( [#111](https://github.com/asvetliakov/vscode-neovim/issues/111) )
- Implemented commandline history ( [#88](https://github.com/asvetliakov/vscode-neovim/issues/88) )
- Add the option to start the visual mode with mouse selection ( [#94](https://github.com/asvetliakov/vscode-neovim/issues/94) )
## [0.0.42]
- Disabled jj/jk escape keys by default
## [0.0.40]
- Fix cursor/highlight not working with multi-byte width characters (Russian, Chinese, Japanese, etc...), i.e the extension should work normally with them (#68, [#91](https://github.com/asvetliakov/vscode-neovim/issues/91))
- Fix incorrect vim highlight when using tab indentation (#81)
- Removed multiple cursors by default from visual line/block modes (visual block mode still spawns cursors but they are pruly visual) (#59, [#61](https://github.com/asvetliakov/vscode-neovim/issues/61)). Previous behavior is still accessible by `mi` or `ma` keybindings while in visual line/block modes
- Allow to override keys/mappings set by extension (previously they have been set after user config loaded)
- Allow to identify if neovim is running through vscode extension by checking `if exists('g:vscode')` (#83)
- Added `<C-[>` and `Escape` as escape keys (#74)
- Added `<C-n>` and `<C-p>` to select next autocomplete suggestion/show next/prev parameter hint
- Added `jj` and `jk` as escape keys from the insert mode (#75)
- Pass `<C-/>` to neovim and call VSCodeCommentary (still recommended to bind it to own keys) (#89)
- Pass `<S-Tab>` to neovim
- Allow to pass additional ctrl keys to neovim (see Readme)
- Added workaround for `gk`/`gj` motions
- Corrected `gf`/`gF` keybindings. Add `<C-]>` as go-to-def (works in help too) (#77). Add `gd`/`gD` as secondary mappings to go-to-def/peek-def. Add `<C-w>gd` to reveal definition aside
## [0.0.39]
- Fix bug with incorrect buffer edits
- Fix cursor jumping after pressing something like `cw` and fast typing text in large file
## [0.0.38]
- Fix cursor position after deleting a line and possibly other operations
## [0.0.37]
- Fix performance of o/O. If you're using custom bindings for them, you might need to rebind them to call new action. See vscode-insert.vim
## [0.0.36]
- Fix macros with insert mode
- Big performance improvements, fix undo & macros performance
- Allow to use neovim installed in WSL. Tick useWSL conf checkbox and specify linux path to neovim
## [0.0.35]
- Use VIM jumplist for `<C-o>`/`<C-i>`/`<Tab>`
## [0.0.33-0.0.34]
- Fix extension for linux/macos users
- Fix buffer-vscode desynchornization after redo
## [0.0.32]
- Cmdline fixes/improvements (#50, [#51](https://github.com/asvetliakov/vscode-neovim/issues/51))
## [0.0.31]
- Fix crazy cursor jumping when having opened multiple editors panes
## [0.0.30]
- Implemented nvim's ext_multigrid support. This solves almost all problems with vim highlighting and potentially enables easymotion's overwin motions (they still don't work however). Window management still should be performed by vscode
- Removed vim-style cursor following on editor scrolling. This totally screwed vscode jumplist, so better to have working jumplist than such minor feature.
- Cursor position fixes
- `:e [filepath]` works again
## [0.0.29]
- Fix selection is being reset in visual mode after typing `vk$` (#48)
- Fix not cleaning incsearch highlight after canceling the incsearch (#46)
- Fix incorrect cursor after switching the editor to the same document but in different editor column (#49)
## [0.0.28]
- Use non-blocking rpc requests when communicatings with vscode for file management operations (closing, opening, etc...). Should eliminate the issue when vim is 'stuck' and doesn't respond anymore
- Fix incorrect cursor positions after opening `:help something` (#44)
- Fix visual block selection for single column in multiple rows (#42)
- Enable VIM syntax highlighting for help files and external buffers like `:PlugStatus`. It's slow and sometimes buggy but better than nothing in meantime
## [0.0.27]
- Fix incsearch and allow to use `<C-t>`/`<C-g>` with it
- Reworked/Refactored command line. Now with wildmenu completion support. Also keys like `<C-w>` or `<C-u>` are working fine now in cmdline now
## [0.0.26]
- Partially revert [#41](https://github.com/asvetliakov/vscode-neovim/issues/41)
## [0.0.25]
- Tab management commands & keys, like `gt` or `tabo[nly]`
- Window management commands & keys like `sp[lit]`/`vs[plit]` and `<C-w> j/k/l/h` keys
- Bind scroll commands in neovim instead of vscode extension ([#41](https://github.com/asvetliakov/vscode-neovim/issues/41))
## [0.0.24]
- File management commands, like `:w` or `:q` (bound to vscode actions)
- Fix [#40](https://github.com/asvetliakov/vscode-neovim/issues/40)
## [0.0.1-0.0.23]
- A bunch of development versions. 0.0.23 has the following features
- Correct editing and the cursor management
- Control keys in the insert & normal/visual modes
- Visual mode produces vscode selections
- Working VIM highlighting (most of a default VIM HL groups are ignored since they don't make sense in VSCode, but non standard groups are processed, so things like vim-easymotion or vim-highlight are working fine)
- Scrolling commands (scrolling is done by vscode so things are slighly different here)
- Special vim-easymotion fork to use vscode text decorators instead of replacing text (as original vim-easymotion does)
- Analogue of vim-commentary (original vim-commentary works fine too)
- Working external vim buffers, like `:help` or `:PlugStatus`
- Multiple cursors for visual line/visual block modes
## [0.0.1]
- Initial release

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Alexey Svetliakov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,593 @@
<h2 align="center"><img src="https://github.com/asvetliakov/vscode-neovim/raw/HEAD/./images/icon.png" height="128"><br>VSCode Neovim</h2>
<p align="center"><strong>VSCode Neovim Integration</strong></p>
<p align=center>
<a href="https://marketplace.visualstudio.com/items?itemName=asvetliakov.vscode-neovim"><img src="https://vsmarketplacebadge.apphb.com/version/asvetliakov.vscode-neovim.svg"></a>
<a href="https://github.com/asvetliakov/vscode-neovim/actions/workflows/build_test.yml"><img src="https://github.com/asvetliakov/vscode-neovim/workflows/Code%20Check%20&%20Test/badge.svg"></a>
<a href="https://gitter.im/vscode-neovim/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge"><img src="https://badges.gitter.im/vscode-neovim/community.svg"></a>
</p>
[Neovim](https://neovim.io/) is a fork of VIM to allow greater extensibility and integration. This extension uses a full
embedded Neovim instance, no more half-complete VIM emulation! VSCode's native functionality is used for insert mode and
editor commands, making the best use of both editors.
- 🎉 Almost fully feature-complete VIM integration by utilizing neovim as a backend.
- 🔧 Supports custom `init.vim` and many vim plugins.
- 🥇 First-class and lag-free insert mode, letting VSCode do what it does best.
- 🤝 Complete integration with VSCode features (lsp/autocompletion/snippets/multi-cursor/etc).
<details>
<summary><strong>Table of Contents</strong> (click to expand)</summary>
- [🧰 Installation](#-installation)
- [💡 Tips and Features](#-tips-and-features)
- [Important](#important)
- [VSCode specific differences](#vscode-specific-differences)
- [Performance problems](#performance-problems)
- [Conditional init.vim](#conditional-initvim)
- [Custom escape keys](#custom-escape-keys)
- [Jumplist](#jumplist)
- [Wildmenu completion](#wildmenu-completion)
- [Multiple cursors](#multiple-cursors)
- [Keyboard Quickfix](#keyboard-quickfix)
- [Invoking VSCode actions from neovim](#invoking-vscode-actions-from-neovim)
- [Examples](#examples)
- [⌨️ Bindings](#-bindings)
- [File management](#file-management)
- [Tab management](#tab-management)
- [Buffer/window management](#bufferwindow-management)
- [Insert mode special keys](#insert-mode-special-keys)
- [Normal mode control keys](#normal-mode-control-keys)
- [Cmdline special keys](#cmdline-special-keys)
- [VSCode specific bindings](#vscode-specific-bindings)
- [Editor command](#editor-command)
- [Explorer/list navigation](#explorerlist-navigation)
- [Explorer file manipulation](#explorer-file-manipulation)
- [Custom keybindings](#custom-keybindings)
- [🤝 Vim Plugins](#-vim-plugins)
- [vim-easymotion](#vim-easymotion)
- [vim-commentary](#vim-commentary)
- [quick-scope](#quick-scope)
- [📑 How it works](#-how-it-works)
- [❤️ Credits & External Resources](#-credits--external-resources)
</details>
## 🧰 Installation
- Install the [vscode-neovim](https://marketplace.visualstudio.com/items?itemName=asvetliakov.vscode-neovim)
extension.
- Install [Neovim](https://github.com/neovim/neovim/wiki/Installing-Neovim) **0.5.0 nightly** or greater.
- Set the neovim path in the extension settings. You must specify full path to neovim, like
"`C:\Neovim\bin\nvim.exe"` or "`/usr/local/bin/nvim`".
- The setting id is "`vscode-neovim.neovimExecutablePaths.win32/linux/darwin`", respective to your system.
- If you want to use neovim from WSL, set the `useWSL` configuration toggle and specify linux path to nvim binary.
`wsl.exe` windows binary and `wslpath` linux binary are required for this. `wslpath` must be available through
`$PATH` linux env setting. Use `wsl --list` to check for the correct default linux distribution.
> ❗ **Neovim 0.5.0 nightly** or greater is **required**. Any version lower than that won't work. Many linux
> distributions have an **old** version of neovim in their package repo - always check what version are you installing.
> You can install neovim separately, outside your system's package manager installation, for example using the appimage
> from the neovim releases page.
> 🐛 See the [issues section](https://github.com/asvetliakov/vscode-neovim/issues) for known issues.
## 💡 Tips and Features
### Important
- If you get "Unable to init vscode-neovim: command 'type' already exists" message, uninstall other VSCode extensions
that register the `type` command (like
[VSCodeVim](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim) or
[Overtype](https://marketplace.visualstudio.com/items?itemName=adammaras.overtype)).
- If you already have a big `init.vim` it is recommended to wrap existing settings & plugins with
[`if !exists('g:vscode')`](#conditional-initvim) to prevent potential conflicts. If you have any problems, try with
empty `init.vim` first.
- On a Mac, the <kbd>h</kbd>, <kbd>j</kbd>, <kbd>k</kbd> and <kbd>l</kbd> movement keys may not repeat when held, to
fix this open Terminal and execute the following command:
`defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false`.
- The extension works best if `editor.scrollBeyondLastLine` is disabled.
### VSCode specific differences
- File and editor management commands such as `:e`/`:w`/`:q`/`:vsplit`/`:tabnext`/etc are mapped to corresponding
vscode commands and behavior may be different ([see below](#-bindings)). **Do not** use vim commands like `:w` in
scripts/keybindings, they won't work. If you're using them in some custom commands/mappings, you might need to
rebind them to call vscode commands from neovim with `VSCodeCall/VSCodeNotify`
([see below](#invoking-vscode-actions-from-neovim)).
- Visual modes don't produce vscode selections, so any vscode commands expecting selection won't work. To round the
corners, invoking the VSCode command picker from visual mode through the default hotkeys
(<kbd>f1</kbd>/<kbd>ctrl/cmd+shift+p</kbd>) converts vim selection to real vscode selection. This conversion is also
done automatically for some commands like commenting and formatting. If you're using some custom mapping for calling
vscode commands that depends on real vscode selection, you can use `VSCodeNotifyRange`/`VSCodeNotifyRangePos` (the
first one linewise, the latter characterwise) which will convert vim visual mode selection to vscode selection
before calling the command ([see below](#invoking-vscode-actions-from-neovim)).
- When you type some commands they may be substituted for the another, like `:write` will be replaced by `:Write`.
This is normal.
- Scrolling is done by VSCode. <kbd>C-d</kbd>/<kbd>C-u</kbd>/etc are slightly different.
- Editor customization (relative line number, scrolloff, etc) is handled by VSCode.
- Dot-repeat (<kbd>.</kbd>) is slightly different - moving the cursor within a change range won't break the repeat
sequence. In neovim, if you type `abc<cursor>` in insert mode, then move cursor to `a<cursor>bc` and type `1` here
the repeat sequence would be `1`. However in vscode it would be `a1bc`. Another difference is that when you delete
some text in insert mode, dot repeat only works from right-to-left, meaning it will treat <kbd>Del</kbd> key as
<kbd>BS</kbd> keys when running dot repeat.
### Performance problems
If you have any performance problems (cursor jitter usually) make sure you're not using these kinds of extensions:
- Anything that renders decorators very often:
- Line number extensions (VSCode has built-in support for normal/relative line numbers)
- Indent guide extensions (VSCode has built-in indent guides)
- Brackets highlighter extensions (VSCode has built-in feature)
- VSCode extensions that delay the extension host like "Bracket Pair Colorizer"
- VIM plugins that increase latency and cause performance problems.
- Make sure to disable unneeded plugins, as many of them don't make sense with vscode and may cause problems.
- You don't need any code, highlighting, completion, lsp plugins as well any plugins that spawn windows/buffers
(nerdtree and similar), fuzzy-finders, etc.
- Many navigation/textobject/editing plugins should be fine.
If you're not sure, disable all other extensions, **reload vscode window**, and see if the problem persists before
reporting.
### Conditional init.vim
To determine if neovim is running in vscode, add to your init.vim:
```vim
if exists('g:vscode')
" VSCode extension
else
" ordinary neovim
endif
```
To conditionally activate plugins, `vim-plug` has a
[few solutions](https://github.com/junegunn/vim-plug/wiki/tips#conditional-activation). For example, using the `Cond`
helper, you can conditionally activate installed plugins
([source](https://github.com/asvetliakov/vscode-neovim/issues/415#issuecomment-715533865)):
```vim
" inside plug#begin:
" use normal easymotion when in vim mode
Plug 'easymotion/vim-easymotion', Cond(!exists('g:vscode'))
" use vscode easymotion when in vscode mode
Plug 'asvetliakov/vim-easymotion', Cond(exists('g:vscode'), { 'as': 'vsc-easymotion' })
```
### Custom escape keys
Since VSCode is responsible for insert mode, custom insert-mode vim mappings don't work. To map composite escape keys,
put into your keybindings.json:
for <kbd>jj</kbd>
```json
{
"command": "vscode-neovim.compositeEscape1",
"key": "j",
"when": "neovim.mode == insert && editorTextFocus",
"args": "j"
}
```
to enable <kbd>jk</kbd> add also:
```json
{
"command": "vscode-neovim.compositeEscape2",
"key": "k",
"when": "neovim.mode == insert && editorTextFocus",
"args": "k"
}
```
Currently, there is no way to map both `jk` and `kj`, or to map `jk` without also mapping `jj`.
### Jumplist
VSCode's jumplist is used instead of Neovim's. This is to make VSCode native navigation (mouse click, jump to
definition, ect) navigable through the jumplist.
Make sure to bind to `workbench.action.navigateBack` / `workbench.action.navigateForward` if you're using custom
mappings. Marks (both upper & lowercased) should work fine.
### Wildmenu completion
Command menu has the wildmenu completion on type. The completion options appear after 1.5s (to not bother you when you
write `:w` or `:noh`). <kbd>Up</kbd>/<kbd>Down</kbd> selects the option and <kbd>Tab</kbd> accepts it. See the gif:
![wildmenu](https://github.com/asvetliakov/vscode-neovim/raw/HEAD/images/wildmenu.gif)
### Multiple cursors
Multiple cursors work in:
1. Insert mode
2. Visual line mode
3. Visual block mode
To spawn multiple cursors from visual line/block modes type <kbd>ma</kbd>/<kbd>mA</kbd> or <kbd>mi</kbd>/<kbd>mI</kbd>
(by default). The effect differs:
- For visual line mode, <kbd>mi</kbd> will start insert mode on each selected line on the first non whitespace
character and <kbd>ma</kbd> will on the end of line.
- For visual block mode, <kbd>mi</kbd> will start insert on each selected line before the cursor block and
<kbd>ma</kbd> after.
- <kbd>mA</kbd>/<kbd>mI</kbd> versions accounts for empty lines (only for visual line mode, for visual block mode
they're same as <kbd>ma</kbd>/<kbd>mi</kbd>).
See gif in action:
![multicursors](https://github.com/asvetliakov/vscode-neovim/raw/HEAD/images/multicursor.gif)
### Keyboard Quickfix
By default, the quickfix menu can be opened using <kbd>z=</kbd> or <kbd>C-.</kbd>. However, it is currently
[not possible](https://github.com/microsoft/vscode/issues/55111) to add mappings to the quickfix menu, so it can only be
navigated with arrow keys. A
[workaround vscode extension](https://marketplace.visualstudio.com/items?itemName=pascalsenn.keyboard-quickfix) has been
made to use the quick open menu, which can be navigated with custom bindings.
To use, install the
[keyboard-quickfix](https://marketplace.visualstudio.com/items?itemName=pascalsenn.keyboard-quickfix) extension, and add
to your keybindings.json:
```jsonc
{
"key": "ctrl+.",
"command": "keyboard-quickfix.openQuickFix",
"when": "editorHasCodeActionsProvider && editorTextFocus && !editorReadonly"
},
```
and add to your init.vim:
```vim
nnoremap z= <Cmd>call VSCodeNotify('keyboard-quickfix.openQuickFix')<CR>
```
### Invoking VSCode actions from neovim
There are a
[few helper functions](https://github.com/asvetliakov/vscode-neovim/blob/master/vim/vscode-neovim.vim#L17-L39) that
could be used to invoke any vscode commands:
| Command | Description |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `VSCodeNotify(command, ...)` <br/> `VSCodeCall(command, ...)` | Invoke vscode command with optional arguments. |
| `VSCodeNotifyRange(command, line1, line2, leaveSelection ,...)` <br/> `VSCodeCallRange(command, line1, line2, leaveSelection, ...)` | Produce real linewise vscode selection from `line1` to `line2` and invoke vscode command. Put 1 for the `leaveSelection` argument to leave vscode selection after invoking the command. |
| `VSCodeNotifyRangePos(command, line1, line2, pos1, pos2, leaveSelection ,...)` <br/> `VSCodeCallRangePos(command, line1, line2, pos1, pos2, leaveSelection, ...)` | Produce real characterwise vscode selection from `line1.pos1` to `line2.pos2` and invoke vscode command. |
> 💡 Functions with `Notify` in their name are non-blocking, the ones with `Call` are blocking. Generally **use Notify**
> unless you really need a blocking call.
#### Examples
Produce linewise/characterwise selection and show vscode commands (default binding):
```vim
function! s:openVSCodeCommandsInVisualMode()
let mode = mode()
if mode ==# 'V'
let startLine = line('v')
let endLine = line('.')
call VSCodeNotifyRange('workbench.action.showCommands', startLine, endLine, 1)
else
let startPos = getpos('v')
let endPos = getpos('.')
call VSCodeNotifyRangePos('workbench.action.showCommands', startPos[1], endPos[1], startPos[2], endPos[2] + 1, 1)
endif
endfunction
xnoremap <C-P> <Cmd>call <SID>openVSCodeCommandsInVisualMode()<CR>
```
Open definition aside (default binding):
```vim
nnoremap <C-w>gd <Cmd>call VSCodeNotify('editor.action.revealDefinitionAside')<CR>
```
Run Find in files for word under cursor in vscode:
```vim
nnoremap ? <Cmd>call VSCodeNotify('workbench.action.findInFiles', { 'query': expand('<cword>')})<CR>
```
## ⌨️ Bindings
**Custom keymaps for scrolling/window/tab/etc management**
- See [vscode-scrolling.vim](https://github.com/asvetliakov/vscode-neovim/blob/HEAD/vim/vscode-scrolling.vim) for scrolling commands reference
- See [vscode-file-commands.vim](https://github.com/asvetliakov/vscode-neovim/blob/HEAD/vim/vscode-file-commands.vim) for file commands reference
- See [vscode-tab-commands.vim](https://github.com/asvetliakov/vscode-neovim/blob/HEAD/vim/vscode-tab-commands.vim) for tab commands reference
- See [vscode-window-commands.vim](https://github.com/asvetliakov/vscode-neovim/blob/HEAD/vim/vscode-window-commands.vim) for window commands reference
> 💡 "With bang" refers to adding a "!" to the end of a command.
### File management
| Command | Description |
| ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `e[dit]` / `ex` | Open quickopen. <br/> With filename, e.g. `:e $MYVIMRC`: open the file in new tab. The file must exist. <br/> With bang: revert file to last saved version. <br/> With filename and bang e.g. `:e! $MYVIMRC`: close current file (discard any changes) and open the file. The file must exist. |
| `ene[w]` | Create new untitled document in vscode. <br/> With bang: close current file (discard any changes) and create new document. |
| `fin[d]` | Open vscode's quick open window. Arguments and count are not supported. |
| `w[rite]` | Save current file. With bang: open 'save as' dialog. |
| `sav[eas]` | Open 'save as' dialog. |
| `wa[ll]` | Save all files. |
| `q[uit]` / <kbd>C-w</kbd> <kbd>q</kbd> / <kbd>C-w</kbd> <kbd>c</kbd> / <kbd>ZQ</kbd> | Close the active editor. With bang: revert changes and close the active editor. |
| `wq` / <kbd>ZZ</kbd> | Save and close the active editor. |
| `qa[ll]` | Close all editors, but don't quit vscode. Acts like `qall!`, so beware for nonsaved changes. |
| `wqa[ll]` / `xa[ll]` | Save all editors & close. |
### Tab management
| Command | Description |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `tabe[dit]` | Similar to `e[dit]`. Open quickopen. <br/> With argument: open the file in new tab. |
| `tabnew` | Open new untitled file. |
| `tabf[ind]` | Open quickopen window. |
| `tab`/`tabs` | Not supported. Doesn't make sense with vscode. |
| `tabc[lose]` | Close active editor (tab). |
| `tabo[nly]` | Close other tabs in vscode **group** (pane). This differs from vim where a `tab` is a like a new window, but doesn't make sense in vscode. |
| `tabn[ext]` / <kbd>gt</kbd> | Switch to next (or `count` tabs if argument is given) in the active vscode **group** (pane). |
| `tabp[revious]` / <kbd>gT</kbd> | Switch to previous (or `count` tabs if argument is given) in the active vscode **group** (pane). |
| `tabfir[st]` | Switch to the first tab in the active editor group. |
| `tabl[ast]` | Switch to the last tab in the active editor group. |
| `tabm[ove]` | Not supported yet. |
### Buffer/window management
| Command | Key | Description |
| ---------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sp[lit]` | <kbd>C-w</kbd> <kbd>s</kbd> | Split editor horizontally. <br/> With argument: open the specified file, e.g `:sp $MYVIMRC`. File must exist. |
| `vs[plit]` | <kbd>C-w</kbd> <kbd>v</kbd> | Split editor vertically. <br/> With argument: open the specified file. File must exist. |
| `new` | <kbd>C-w</kbd> <kbd>n</kbd> | Like `sp[lit]` but create new untitled file if no argument given. |
| `vne[w]` | | Like `vs[plit]` but create new untitled file if no argument given. |
| | <kbd>C-w</kbd> <kbd>=</kbd> | Align all editors to have the same width. |
| | <kbd>C-w</kbd> <kbd>\_</kbd> | Toggle maximized editor size. Pressing again will restore the size. |
| | <kbd>[count]</kbd> <kbd>C-w</kbd> <kbd>+</kbd> | Increase editor height by (optional) count. |
| | <kbd>[count]</kbd> <kbd>C-w</kbd> <kbd>-</kbd> | Decrease editor height by (optional) count. |
| | <kbd>[count]</kbd> <kbd>C-w</kbd> <kbd>></kbd> | Increase editor width by (optional) count. |
| | <kbd>[count]</kbd> <kbd>C-w</kbd> <kbd>\<</kbd> | Decrease editor width by (optional) count. |
| `on[ly]` | <kbd>C-w</kbd> <kbd>o</kbd> | Without bang: merge all editor groups into the one. Don't close editors. <br/> With bang: close all editors from all groups except current one. |
| | <kbd>C-w</kbd> <kbd>j/k/h/l</kbd> | Focus group below/above/left/right. |
| | <kbd>C-w</kbd> <kbd>C-j/i/h/l</kbd> | Move editor to group below/above/left/right. <br/> **Note**: <kbd>C-w</kbd> <kbd>C-i</kbd> moves editor up. Ideally it should be <kbd>C-w</kbd> <kbd>C-k</kbd> but vscode has many commands mapped to <kbd>C-k</kbd> <kbd>[key]</kbd> and doesn't allow to use <kbd>C-w</kbd> <kbd>C-k</kbd> without unbinding them first. |
| | <kbd>C-w</kbd> <kbd>J/K/H/L</kbd> | Move whole editor group below/above/left/right. |
| | <kbd>C-w</kbd> <kbd>w</kbd> or <kbd>C-w</kbd> <kbd>C-w</kbd> | Focus next group. The behavior may differ than in vim. |
| | <kbd>C-w</kbd> <kbd>W</kbd> or <kbd>C-w</kbd> <kbd>p</kbd> | Focus previous group. The behavior may differ than in vim. <kbd>C-w</kbd> <kbd>p</kbd> is completely different than in vim. |
| | <kbd>C-w</kbd> <kbd>b</kbd> | Focus last editor group (most bottom-right). |
| | <kbd>C-w</kbd> <kbd>r/R/x</kbd> | Not supported, use <kbd>C-w</kbd> <kbd>C-j</kbd> and similar to move editors. |
> 💡 Split size distribution is controlled by `workbench.editor.splitSizing` setting. By default, it's `distribute`,
> which is equal to vim's `equalalways` and `eadirection = 'both'` (default).
To use VSCode command 'Increase/decrease current view size' instead of separate bindings for width and height:
- `workbench.action.increaseViewSize`
- `workbench.action.decreaseViewSize`
<details>
<summary>Copy this into init.vim</summary>
function! s:manageEditorSize(...)
let count = a:1
let to = a:2
for i in range(1, count ? count : 1)
call VSCodeNotify(to ==# 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize')
endfor
endfunction
" Sample keybindings. Note these override default keybindings mentioned above.
nnoremap <C-w>> <Cmd>call <SID>manageEditorSize(v:count, 'increase')<CR>
xnoremap <C-w>> <Cmd>call <SID>manageEditorSize(v:count, 'increase')<CR>
nnoremap <C-w>+ <Cmd>call <SID>manageEditorSize(v:count, 'increase')<CR>
xnoremap <C-w>+ <Cmd>call <SID>manageEditorSize(v:count, 'increase')<CR>
nnoremap <C-w>< <Cmd>call <SID>manageEditorSize(v:count, 'decrease')<CR>
xnoremap <C-w>< <Cmd>call <SID>manageEditorSize(v:count, 'decrease')<CR>
nnoremap <C-w>- <Cmd>call <SID>manageEditorSize(v:count, 'decrease')<CR>
xnoremap <C-w>- <Cmd>call <SID>manageEditorSize(v:count, 'decrease')<CR>
</details>
### Insert mode special keys
Enabled by `useCtrlKeysForInsertMode` (default true).
| Key | Description | Status |
| ------------------------------------------- | ----------------------------------------------------------------- | --------------------------------- |
| <kbd>C-r</kbd> <kbd>[0-9a-z"%#*+:.-=]</kbd> | Paste from register. | Works |
| <kbd>C-a</kbd> | Paste previous inserted content. | Works |
| <kbd>C-o</kbd> | Switch to normal mode for a single command, then back. | Works |
| <kbd>C-u</kbd> | Delete all text till beginning of line. If empty, delete newline. | Bound to VSCode key |
| <kbd>C-w</kbd> | Delete word left. | Bound to VSCode key |
| <kbd>C-h</kbd> | Delete character left. | Bound to VSCode key |
| <kbd>C-t</kbd> | Indent lines right. | Bound to VSCode indent line |
| <kbd>C-d</kbd> | Indent lines left. | Bound to VSCode outindent line |
| <kbd>C-j</kbd> | Insert line. | Bound to VSCode insert line after |
| <kbd>C-c</kbd> | Escape. | Works |
Other keys are not supported in insert mode.
### Normal mode control keys
Enabled by `useCtrlKeysForNormalMode` (default true).
Refer to vim manual for their use.
- <kbd>C-a</kbd>
- <kbd>C-b</kbd>
- <kbd>C-c</kbd>
- <kbd>C-d</kbd>
- <kbd>C-e</kbd>
- <kbd>C-f</kbd>
- <kbd>C-i</kbd>
- <kbd>C-o</kbd> (to enable, see
[this issue](https://github.com/asvetliakov/vscode-neovim/issues/181#issuecomment-585264621))
- <kbd>C-r</kbd>
- <kbd>C-u</kbd>
- <kbd>C-v</kbd>
- <kbd>C-w</kbd>
- <kbd>C-x</kbd>
- <kbd>C-y</kbd>
- <kbd>C-]</kbd>
- <kbd>C-j</kbd>
- <kbd>C-k</kbd>
- <kbd>C-l</kbd>
- <kbd>C-h</kbd>
- <kbd>C-/</kbd>
### Cmdline special keys
Always enabled.
| Key | Desription |
| ------------------------------- | --------------------------------------------------------- |
| <kbd>C-h</kbd> | Delete one character left. |
| <kbd>C-w</kbd> | Delete word left. |
| <kbd>C-u</kbd> | Clear line. |
| <kbd>C-g</kbd> / <kbd>C-t</kbd> | In incsearch mode moves to next/previous result. |
| <kbd>C-l</kbd> | Add next character under the cursor to incsearch. |
| <kbd>C-n</kbd> / <kbd>C-p</kbd> | Go down/up history. |
| <kbd>Up</kbd> / <kbd>Down</kbd> | Select next/prev suggestion (cannot be used for history). |
| <kbd>Tab</kbd> | Select suggestion. |
### VSCode specific bindings
#### Editor command
| Key | VSCode Command |
| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| <kbd>=</kbd> / <kbd>==</kbd> | `editor.action.formatSelection` |
| <kbd>gh</kbd> / <kbd>K</kbd> | `editor.action.showHover` |
| <kbd>gd</kbd> / <kbd>C-]</kbd> | `editor.action.revealDefinition` <br/> Also works in vim help. |
| <kbd>gf</kbd> | `editor.action.revealDeclaration` |
| <kbd>gH</kbd> | `editor.action.referenceSearch.trigger` |
| <kbd>gO</kbd> | `workbench.action.gotoSymbol` |
| <kbd>C-w</kbd> <kbd>gd</kbd> / <kbd>C-w</kbd> <kbd>gf</kbd> | `editor.action.revealDefinitionAside` |
| <kbd>gD</kbd> | `editor.action.peekDefinition` |
| <kbd>gF</kbd> | `editor.action.peekDeclaration` |
| <kbd>Tab</kbd> | `togglePeekWidgetFocus` <br/> Switch between peek editor and reference list. |
| <kbd>C-n</kbd> / <kbd>C-p</kbd> | Navigate lists, parameter hints, suggestions, quick-open, cmdline history, peek reference list |
> 💡 To specify the default peek mode, modify `editor.peekWidgetDefaultFocus` in your settings.
#### Explorer/list navigation
| Key | VSCode Command |
| ---------------------------------- | ------------------------------- |
| <kbd>j</kbd> / <kbd>k</kbd> | `list.focusDown/Up` |
| <kbd>h</kbd> / <kbd>l</kbd> | `list.collapse/select` |
| <kbd>Enter</kbd> | `list.select` |
| <kbd>gg</kbd> | `list.focusFirst` |
| <kbd>G</kbd> | `list.focusLast` |
| <kbd>o</kbd> | `list.toggleExpand` |
| <kbd>C-u</kbd> / <kbd>C-d</kbd> | `list.focusPageUp/Down` |
| <kbd> / </kbd> / <kbd>Escape</kbd> | `list.toggleKeyboardNavigation` |
> 💡 To enable explorer list navigation, add `"workbench.list.automaticKeyboardNavigation": false` to your
> `settings.json`.
#### Explorer file manipulation
| Key | VSCode Command |
| ------------ | --------------------- |
| <kbd>r</kbd> | `renameFile` |
| <kbd>d</kbd> | `deleteFile` |
| <kbd>y</kbd> | `filesExplorer.copy` |
| <kbd>x</kbd> | `filesExplorer.cut` |
| <kbd>p</kbd> | `filesExplorer.paste` |
| <kbd>v</kbd> | `explorer.openToSide` |
| <kbd>a</kbd> | `explorer.newFile` |
| <kbd>A</kbd> | `explorer.newFolder` |
### Custom keybindings
Control keys which are not in the above tables are not sent to neovim by default. To pass additional ctrl keys to
neovim, for example <kbd>C-Tab</kbd>, add to your keybindings.json:
```jsonc
{
"command": "vscode-neovim.send",
// the key sequence to activate the binding
"key": "ctrl+tab",
// don't activate during insert mode
"when": "editorTextFocus && neovim.mode != insert",
// the input to send to neovim
"args": "<C-Tab>"
}
```
To disable existing an ctrl key sequence, for example <kbd>C-A</kbd> add to your keybindings.json:
```json
{
"command": "-vscode-neovim.send",
"key": "ctrl+a"
}
```
## 🤝 Vim Plugins
Most vim plugins will work out of the box, but certain plugins may require some fixes to work properly.
### vim-easymotion
While the original [vim-easymotion](https://github.com/easymotion/vim-easymotion) functions as expected, it works by
replacing your text with markers then restoring back, which leads to broken text and many errors reported in VSCode.
For this reason I created the special [vim-easymotion fork](https://github.com/asvetliakov/vim-easymotion) which doesn't
touch your text and instead use vscode text decorations. Just add my fork to your `vim-plug` block or by using your
favorite vim plugin installer and delete original vim-easymotion. Also overwin motions won't work (obviously) so don't
use them.
By default, text decorations will appear behind of the associated text as shown in the screenshot. To show the
decorations on top of the text, set `vscode-neovim.textDecorationsAtTop` to true.
Happy jumping!
![easymotion](https://github.com/asvetliakov/vscode-neovim/raw/HEAD/images/easy-motion-vscode.png)
### vim-commentary
You can use [vim-commentary](https://github.com/tpope/vim-commentary) if you like it. But vscode already has such
functionality so why don't use it? Add to your init.vim/init.nvim:
```vim
xmap gc <Plug>VSCodeCommentary
nmap gc <Plug>VSCodeCommentary
omap gc <Plug>VSCodeCommentary
nmap gcc <Plug>VSCodeCommentaryLine
```
Similar to vim-commentary, gcc is comment line (accept count), use gc with motion/in visual mode. `VSCodeCommentary` is
just a simple function which calls `editor.action.commentLine`.
### quick-scope
[quick-scope](https://github.com/unblevable/quick-scope) plugin uses default vim HL groups by default but they are
normally ignored. To fix, add
```vim
highlight QuickScopePrimary guifg='#afff5f' gui=underline ctermfg=155 cterm=underline
highlight QuickScopeSecondary guifg='#5fffff' gui=underline ctermfg=81 cterm=underline
```
to your init.vim. The underline color can be changed by the `guisp` tag.
## 📑 How it works
- VScode connects to neovim instance
- When opening a some file, a scratch buffer is created in nvim and being init with text content from vscode
- Normal/visual mode commands are being sent directly to neovim. The extension listens for buffer events and applies
edits from neovim
- When entering the insert mode, the extensions stops listen for keystroke events and delegates typing mode to vscode
(no neovim communication is being performed here)
- After pressing escape key from the insert mode, extension sends changes obtained from the insert mode to neovim
## ❤️ Credits & External Resources
- [vim-altercmd](https://github.com/kana/vim-altercmd) - Used for rebinding default commands to call vscode command
- [neovim nodejs client](https://github.com/neovim/node-client) - NodeJS library for communicating with Neovim
- [VSCodeVim](https://github.com/VSCodeVim/Vim) - Used for various inspiration

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 KiB

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,200 @@
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line

View file

@ -0,0 +1,200 @@
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line

View file

@ -0,0 +1,200 @@
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is lineThis is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line
This is line

View file

@ -0,0 +1,3 @@
.vim-flavor
Gemfile.lock
VimFlavor.lock

View file

@ -0,0 +1,4 @@
language: ruby
rvm:
- 2.1.5
script: rake ci

View file

@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'vim-flavor', '~> 2.0'

View file

@ -0,0 +1,11 @@
#!/usr/bin/env rake
task :ci => [:dump, :test]
task :dump do
sh 'vim --version'
end
task :test do
sh 'bundle exec vim-flavor test'
end

View file

@ -0,0 +1 @@
# No dependencies.

View file

@ -0,0 +1,62 @@
" altercmd - Alter built-in Ex commands by your own ones
" Version: 0.0.1
" Copyright (C) 2009-2015 Kana Natsuno <http://whileimautomaton.net/>
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be included
" in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
" Interface "{{{1
function! altercmd#define(...) "{{{2
let [buffer, original_name, alternate_name]
\ = (a:000[0] ==? '<buffer>' ? [] : ['']) + a:000
if original_name =~ '\['
let [original_name_head, original_name_tail] = split(original_name, '[')
let original_name_tail = substitute(original_name_tail, '\]', '', '')
else
let original_name_head = original_name
let original_name_tail = ''
endif
let original_name_tail = ' ' . original_name_tail
for i in range(len(original_name_tail))
let lhs = original_name_head . original_name_tail[1:i]
execute 'cnoreabbrev <expr>' buffer lhs
\ '(getcmdtype() == ":" && getcmdline() ==# "' . lhs . '")'
\ '?' ('"' . alternate_name . '"')
\ ':' ('"' . lhs . '"')
endfor
endfunction
function! altercmd#load() "{{{2
runtime plugin/altercmd.vim
endfunction
" __END__ "{{{1
" vim: foldmethod=marker

View file

@ -0,0 +1,134 @@
*altercmd.txt* Alter built-in Ex commands by your own ones
Version 0.0.1
Script ID: 2675
Copyright (C) 2009-2015 Kana Natsuno <http://whileimautomaton.net/>
License: MIT license {{{
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}}}
CONTENTS *altercmd-contents*
Introduction |altercmd-introduction|
Interface |altercmd-interface|
Commands |altercmd-commands|
Functions |altercmd-functions|
Bugs |altercmd-bugs|
Changelog |altercmd-changelog|
==============================================================================
INTRODUCTION *altercmd-introduction*
*altercmd* is a Vim plugin to provide an easy way to alternate built-in Ex
commands by user-defined Ex commands. This plugin provides |:AlterCommand|
for this purpose. For example, if you define :CD, a custom version of |:cd|,
add the following in your vimrc.
>
AlterCommand cd CD
<
With the above setting, you can use :cd as if it is :CD. It means that :CD
will be automatically inserted if you type :cd as an Ex command, so you don't
have to type :CD to use :cd and you'll never encounter mistyping :cd and :CD.
:AlterCommand also supports partial command names. For example, |:help| can
be invoked with :h, :he, :hel or :help.
>
AlterCommand h[elp] HELP
<
With the above setting, you can use :h, :he, :hel and :help as if they are
:HELP, your own version of :help.
Requirements:
- Vim 7.2 or later
Latest version:
https://github.com/kana/vim-altercmd
==============================================================================
INTERFACE *altercmd-interface*
------------------------------------------------------------------------------
COMMANDS *altercmd-commands*
*:AlterCommand*
:AlterCommand [<buffer>] {original} {alternative}
Declare to use {alternative} Ex command instead of
{original} Ex command.
If <buffer> is given, this declaration is only
available for the current buffer. Otherwise, this
declaration is available globally.
See also |altercmd-introduction| for examples.
Technically, this Ex command does just define some
|abbreviations| in Command-line mode.
------------------------------------------------------------------------------
FUNCTIONS *altercmd-functions*
altercmd#define({original}, {alternative}) *altercmd#define()*
altercmd#define('<buffer>', {original}, {alternative})
Function version of |:AlterCommand|.
altercmd#load() *altercmd#load()*
Load this plugin. You have to call this in your vimrc
if you want to use |:AlterCommand| in your vimrc.
==============================================================================
BUGS *altercmd-bugs*
- Not all cases are supported. For example:
- [range] is not supported yet. If [range] is given, altercmd doesn't work.
- If any argument is not given to an Ex command which has an alternative Ex
command, altercmd doesn't work.
- And there may be more cases where altercmd doesn't work well.
==============================================================================
CHANGELOG *altercmd-changelog*
0.0.1 2015-01-31T23:52:24+09:00
- Fix a bug that buffer-local |:AlterCommand| could not be defined.
0.0.0 2009-06-14T03:47:25+09:00
- Initial version.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:fen:fdl=0:fdm=marker:

View file

@ -0,0 +1,41 @@
" altercmd - Alter built-in Ex commands by your own ones
" Version: 0.0.1
" Copyright (C) 2009-2015 Kana Natsuno <http://whileimautomaton.net/>
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be included
" in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
if exists('g:loaded_altercmd')
finish
endif
command! -bar -complete=command -nargs=* AlterCommand
\ call altercmd#define(<f-args>)
let g:loaded_altercmd = 1
" __END__
" vim: foldmethod=marker

View file

@ -0,0 +1,45 @@
call altercmd#define('full', 'F-U-L-L')
call altercmd#define('ab[br]', 'A-B-B-R')
function! RecordTheCurrentCommandLine()
let g:cmdline = getcmdline()
return ''
endfunction
cnoremap <expr> {X} RecordTheCurrentCommandLine()
function! Test(lhs, rhs)
let g:cmdline = ''
silent execute 'normal' ":".a:lhs."\<C-]>{X}\<C-c>"
Expect g:cmdline ==# a:rhs
endfunction
describe 'altercmd#define'
it 'replaces a built-in command'
call Test('full', 'F-U-L-L')
end
it 'replaces all abbreviated names of a built-in command'
call Test('ab', 'A-B-B-R')
call Test('abb', 'A-B-B-R')
call Test('abbr', 'A-B-B-R')
end
it 'supports <buffer>'
silent edit 'test-A'
call altercmd#define('<buffer>', 'ctx', 'Axe')
silent edit 'test-B'
call altercmd#define('<buffer>', 'ctx', 'Bow')
silent edit 'test-C'
call altercmd#define('<buffer>', 'ctx', 'Club')
silent edit 'test-A'
call Test('full', 'F-U-L-L')
call Test('ctx', 'Axe')
silent edit 'test-B'
call Test('full', 'F-U-L-L')
call Test('ctx', 'Bow')
silent edit 'test-C'
call Test('full', 'F-U-L-L')
call Test('ctx', 'Club')
end
end

View file

@ -0,0 +1,96 @@
function! s:vscodeFormat(...) abort
if !a:0
let &operatorfunc = matchstr(expand('<sfile>'), '[^. ]*$')
return 'g@'
elseif a:0 > 1
let [line1, line2] = [a:1, a:2]
else
let [line1, line2] = [line("'["), line("']")]
endif
call VSCodeCallRange('editor.action.formatSelection', line1, line2, 0)
endfunction
function! s:vscodeCommentary(...) abort
if !a:0
let &operatorfunc = matchstr(expand('<sfile>'), '[^. ]*$')
return 'g@'
elseif a:0 > 1
let [line1, line2] = [a:1, a:2]
else
let [line1, line2] = [line("'["), line("']")]
endif
call VSCodeCallRange('editor.action.commentLine', line1, line2, 0)
endfunction
function! s:vscodeGoToDefinition(str)
if exists('b:vscode_controlled') && b:vscode_controlled
call VSCodeNotify('editor.action.reveal' . a:str)
else
" Allow to funcionar in help files
exe "normal! \<C-]>"
endif
endfunction
function! s:openVSCodeCommandsInVisualMode()
let mode = mode()
if mode ==# 'V'
let startLine = line('v')
let endLine = line('.')
call VSCodeNotifyRange('workbench.action.showCommands', startLine, endLine, 1)
else
let startPos = getpos('v')
let endPos = getpos('.')
call VSCodeNotifyRangePos('workbench.action.showCommands', startPos[1], endPos[1], startPos[2], endPos[2] + 1, 1)
endif
endfunction
command! -range -bar VSCodeCommentary call s:vscodeCommentary(<line1>, <line2>)
xnoremap <expr> <Plug>VSCodeCommentary <SID>vscodeCommentary()
nnoremap <expr> <Plug>VSCodeCommentary <SID>vscodeCommentary()
nnoremap <expr> <Plug>VSCodeCommentaryLine <SID>vscodeCommentary() . '_'
" Bind format to vscode format selection
xnoremap <expr> = <SID>vscodeFormat()
nnoremap <expr> = <SID>vscodeFormat()
nnoremap <expr> == <SID>vscodeFormat() . '_'
" gf/gF . Map to go to definition for now
nnoremap K <Cmd>call VSCodeNotify('editor.action.showHover')<CR>
nnoremap gh <Cmd>call VSCodeNotify('editor.action.showHover')<CR>
nnoremap gf <Cmd>call <SID>vscodeGoToDefinition("Declaration")<CR>
nnoremap gd <Cmd>call <SID>vscodeGoToDefinition("Definition")<CR>
nnoremap <C-]> <Cmd>call <SID>vscodeGoToDefinition("Definition")<CR>
nnoremap gO <Cmd>call VSCodeNotify('workbench.action.gotoSymbol')<CR>
nnoremap gF <Cmd>call VSCodeNotify('editor.action.peekDeclaration')<CR>
nnoremap gD <Cmd>call VSCodeNotify('editor.action.peekDefinition')<CR>
nnoremap gH <Cmd>call VSCodeNotify('editor.action.referenceSearch.trigger')<CR>
xnoremap K <Cmd>call VSCodeNotify('editor.action.showHover')<CR>
xnoremap gh <Cmd>call VSCodeNotify('editor.action.showHover')<CR>
xnoremap gf <Cmd>call <SID>vscodeGoToDefinition("Declaration")<CR>
xnoremap gd <Cmd>call <SID>vscodeGoToDefinition("Definition")<CR>
xnoremap <C-]> <Cmd>call <SID>vscodeGoToDefinition("Definition")<CR>
xnoremap gO <Cmd>call VSCodeNotify('workbench.action.gotoSymbol')<CR>
xnoremap gF <Cmd>call VSCodeNotify('editor.action.peekDeclaration')<CR>
xnoremap gD <Cmd>call VSCodeNotify('editor.action.peekDefinition')<CR>
xnoremap gH <Cmd>call VSCodeNotify('editor.action.referenceSearch.trigger')<CR>
" <C-w> gf opens definition on the side
nnoremap <C-w>gf <Cmd>call VSCodeNotify('editor.action.revealDefinitionAside')<CR>
nnoremap <C-w>gd <Cmd>call VSCodeNotify('editor.action.revealDefinitionAside')<CR>
xnoremap <C-w>gf <Cmd>call VSCodeNotify('editor.action.revealDefinitionAside')<CR>
xnoremap <C-w>gd <Cmd>call VSCodeNotify('editor.action.revealDefinitionAside')<CR>
" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors
xnoremap <expr> <C-/> <SID>vscodeCommentary()
nnoremap <expr> <C-/> <SID>vscodeCommentary() . '_'
" open quickfix menu for spelling corrections and refactoring
" only keyboard arrows can be used to navigate, for a solution, see https://github.com/asvetliakov/vscode-neovim#keyboard-quickfix
nnoremap z= <Cmd>call VSCodeNotify('editor.action.quickFix')<CR>
" workaround for calling command picker in visual mode
xnoremap <C-P> <Cmd>call <SID>openVSCodeCommandsInVisualMode()<CR>

View file

@ -0,0 +1,63 @@
function! s:editOrNew(...)
let file = a:1
let bang = a:2
if empty(file)
if bang ==# '!'
call VSCodeNotify('workbench.action.files.revert')
else
call VSCodeNotify('workbench.action.quickOpen')
endif
else
" Last arg is to close previous file, e.g. e! ~/blah.txt will open blah.txt instead the current file
call VSCodeExtensionNotify('open-file', expand(file), bang ==# '!' ? 1 : 0)
endif
endfunction
function! s:saveAndClose() abort
call VSCodeCall('workbench.action.files.save')
call VSCodeNotify('workbench.action.closeActiveEditor')
endfunction
function! s:saveAllAndClose() abort
call VSCodeCall('workbench.action.files.saveAll')
call VSCodeNotify('workbench.action.closeAllEditors')
endfunction
" command! -bang -nargs=? Edit call VSCodeCall('workbench.action.quickOpen')
command! -complete=file -bang -nargs=? Edit call <SID>editOrNew(<q-args>, <q-bang>)
command! -bang -nargs=? Ex call <SID>editOrNew(<q-args>, <q-bang>)
command! -bang Enew call <SID>editOrNew('__vscode_new__', <q-bang>)
command! -bang Find call VSCodeNotify('workbench.action.quickOpen')
command! -complete=file -bang Write if <q-bang> ==# '!' | call VSCodeNotify('workbench.action.files.saveAs') | else | call VSCodeNotify('workbench.action.files.save') | endif
command! -bang Saveas call VSCodeNotify('workbench.action.files.saveAs')
command! -bang Wall call VSCodeNotify('workbench.action.files.saveAll')
command! -bang Quit if <q-bang> ==# '!' | call VSCodeNotify('workbench.action.revertAndCloseActiveEditor') | else | call VSCodeNotify('workbench.action.closeActiveEditor') | endif
command! -bang Wq call <SID>saveAndClose()
command! -bang Xit call <SID>saveAndClose()
command! -bang Qall call VSCodeNotify('workbench.action.closeAllEditors')
command! -bang Wqall call <SID>saveAllAndClose()
command! -bang Xall call <SID>saveAllAndClose()
AlterCommand e[dit] Edit
AlterCommand ex Ex
AlterCommand ene[w] Enew
AlterCommand fin[d] Find
AlterCommand w[rite] Write
AlterCommand sav[eas] Saveas
AlterCommand wa[ll] Wall
AlterCommand q[uit] Quit
AlterCommand wq Wq
AlterCommand x[it] Xit
AlterCommand qa[ll] Qall
AlterCommand wqa[ll] Wqall
AlterCommand xa[ll] Xall
nnoremap ZZ <Cmd>Wq<CR>
nnoremap ZQ <Cmd>Quit!<CR>

View file

@ -0,0 +1,31 @@
function! s:vscodePrepareMultipleCursors(append, skipEmpty)
let m = mode()
if m ==# 'V' || m ==# "\<C-v>"
let b:notifyMultipleCursors = 1
let b:multipleCursorsVisualMode = m
let b:multipleCursorsAppend = a:append
let b:multipleCursorsSkipEmpty = a:skipEmpty
" We need to start insert, then spawn cursors otherwise they'll be destroyed
" using feedkeys() here because :startinsert is being delayed
call feedkeys("\<Esc>i", 'n')
endif
endfunction
function! s:vscodeNotifyMultipleCursors()
if exists('b:notifyMultipleCursors') && b:notifyMultipleCursors
let b:notifyMultipleCursors = 0
call VSCodeExtensionNotify('visual-edit', b:multipleCursorsAppend, b:multipleCursorsVisualMode, line("'<"), line("'>"), col("'>"), b:multipleCursorsSkipEmpty)
endif
endfunction
augroup MultipleCursors
autocmd!
autocmd InsertEnter * call <SID>vscodeNotifyMultipleCursors()
augroup END
" Multiple cursors support for visual line/block modes
xnoremap ma <Cmd>call <SID>vscodePrepareMultipleCursors(1, 1)<CR>
xnoremap mi <Cmd>call <SID>vscodePrepareMultipleCursors(0, 1)<CR>
xnoremap mA <Cmd>call <SID>vscodePrepareMultipleCursors(1, 0)<CR>
xnoremap mI <Cmd>call <SID>vscodePrepareMultipleCursors(0, 0)<CR>

View file

@ -0,0 +1,4 @@
nnoremap <C-o> <Cmd>call VSCodeNotify("workbench.action.navigateBack")<CR>
nnoremap <C-i> <Cmd>call VSCodeNotify("workbench.action.navigateForward")<CR>
nnoremap <Tab> <Cmd>call VSCodeNotify("workbench.action.navigateForward")<CR>

View file

@ -0,0 +1,16 @@
function! s:toFirstCharOfScreenLine()
call VSCodeNotify('cursorMove', { 'to': 'wrappedLineFirstNonWhitespaceCharacter' })
endfunction
function! s:toLastCharOfScreenLine()
call VSCodeNotify('cursorMove', { 'to': 'wrappedLineLastNonWhitespaceCharacter' })
" Offfset cursor moving to the right caused by calling VSCode command in Vim mode
call VSCodeNotify('cursorLeft')
endfunction
nnoremap g0 <Cmd>call <SID>toFirstCharOfScreenLine()<CR>
nnoremap g$ <Cmd>call <SID>toLastCharOfScreenLine()<CR>
" Note: Using these in macro will break it
nnoremap gk <Cmd>call VSCodeNotify('cursorMove', { 'to': 'up', 'by': 'wrappedLine', 'value': v:count ? v:count : 1 })<CR>
nnoremap gj <Cmd>call VSCodeNotify('cursorMove', { 'to': 'down', 'by': 'wrappedLine', 'value': v:count ? v:count : 1 })<CR>

View file

@ -0,0 +1,153 @@
" Set global flag to allow checking in custom user config
let g:vscode = 1
let s:currDir = fnamemodify(resolve(expand('<sfile>:p')), ':h')
" Adjust rtp path
let &runtimepath = &runtimepath . ',' . s:currDir . '/vim-altercmd'
" Used to execute vscode command
let s:vscodeCommandEventName = 'vscode-command'
" Used to execute vscode command with some range (the specified range will be selected and the command will be executed on this range)
let s:vscodeRangeCommandEventName = 'vscode-range-command'
" Used for externsion inter-communications
let s:vscodePluginEventName = 'vscode-neovim'
" RPC and global functions
function! VSCodeCall(cmd, ...) abort
call rpcrequest(g:vscode_channel, s:vscodeCommandEventName, a:cmd, a:000)
endfunction
function! VSCodeCallRange(cmd, line1, line2, leaveSelection, ...) abort
call rpcrequest(g:vscode_channel, s:vscodeRangeCommandEventName, a:cmd, a:line1, a:line2, 0, 0, a:leaveSelection, a:000)
endfunction
function! VSCodeCallRangePos(cmd, line1, line2, pos1, pos2, leaveSelection, ...) abort
call rpcrequest(g:vscode_channel, s:vscodeRangeCommandEventName, a:cmd, a:line1, a:line2, a:pos1, a:pos2, a:leaveSelection, a:000)
endfunction
function! VSCodeNotify(cmd, ...)
call rpcnotify(g:vscode_channel, s:vscodeCommandEventName, a:cmd, a:000)
endfunction
function! VSCodeNotifyRange(cmd, line1, line2, leaveSelection, ...)
call rpcnotify(g:vscode_channel, s:vscodeRangeCommandEventName, a:cmd, a:line1, a:line2, 0, 0, a:leaveSelection, a:000)
endfunction
function! VSCodeNotifyRangePos(cmd, line1, line2, pos1, pos2, leaveSelection, ...)
call rpcnotify(g:vscode_channel, s:vscodeRangeCommandEventName, a:cmd, a:line1, a:line2, a:pos1, a:pos2, a:leaveSelection, a:000)
endfunction
function! VSCodeExtensionCall(cmd, ...) abort
call rpcrequest(g:vscode_channel, s:vscodePluginEventName, a:cmd, a:000)
endfunction
function! VSCodeExtensionNotify(cmd, ...) abort
call rpcnotify(g:vscode_channel, s:vscodePluginEventName, a:cmd, a:000)
endfunction
" Called from extension when opening/creating new file in vscode to reset undo tree
function! VSCodeClearUndo(bufId)
let oldlevels = &undolevels
call nvim_buf_set_option(a:bufId, 'undolevels', -1)
call nvim_buf_set_lines(a:bufId, 0, 0, 0, [])
call nvim_buf_set_option(a:bufId, 'undolevels', oldlevels)
unlet oldlevels
endfunction
" Called from extension to align screen row in neovim after scrolling
" function! VSCodeAlignScreenRow(row)
" let currentRow = winline()
" let diff = abs(currentRow - a:row)
" if diff > 0
" if (a:row - currentRow) < 0
" if diff > 1
" silent! exe "normal! " . diff . "\<C-e>"
" else
" silent! exe "normal! \<C-e>"
" endif
" else
" if diff > 1
" silent! exe "normal! " . diff . "\<C-y>"
" else
" silent! exe "normal! \<C-y>"
" endif
" endif
" endif
" endfunction
" Set text decorations for given ranges. Used in easymotion
function! VSCodeSetTextDecorations(hlName, rowsCols)
call VSCodeExtensionNotify('text-decorations', a:hlName, a:rowsCols)
endfunction
" Used for ctrl-a insert keybinding
function! VSCodeGetLastInsertText()
let [lineStart, colStart] = getpos("'[")[1:2]
let [lineEnd, colEnd] = getpos("']")[1:2]
if (lineStart == 0)
return []
endif
let lines = getline(lineStart, lineEnd)
let lines[0] = lines[0][colStart - 1:]
let lines[-1] = lines[-1][:colEnd - 1]
return lines
endfunction
" Used for ctrl-r [reg] insert keybindings
function! VSCodeGetRegister(reg)
return getreg(a:reg)
endfunction
" This is called by extension when created new buffer
function! s:onBufEnter(name, id)
if exists('b:vscode_temp') && b:vscode_temp
return
endif
set conceallevel=0
let tabstop = &tabstop
let isJumping = 0
if exists('g:isJumping')
let isJumping = g:isJumping
endif
call VSCodeExtensionCall('external-buffer', a:name, a:id, 1, tabstop, isJumping)
endfunction
function! s:runFileTypeDetection()
doautocmd BufRead
if exists('b:vscode_controlled') && b:vscode_controlled
" make sure we disable syntax (global option seems doesn't take effect for 2nd+ windows)
setlocal syntax=off
endif
endfunction
function! s:onInsertEnter()
let reg = reg_recording()
if !empty(reg)
call VSCodeExtensionCall('notify-recording', reg)
endif
endfunction
" Load altercmd first
execute 'source ' . s:currDir . '/vim-altercmd/plugin/altercmd.vim'
execute 'source ' . s:currDir . '/vscode-insert.vim'
execute 'source ' . s:currDir . '/vscode-scrolling.vim'
execute 'source ' . s:currDir . '/vscode-jumplist.vim'
execute 'source ' . s:currDir . '/vscode-code-actions.vim'
execute 'source ' . s:currDir . '/vscode-file-commands.vim'
execute 'source ' . s:currDir . '/vscode-tab-commands.vim'
execute 'source ' . s:currDir . '/vscode-window-commands.vim'
execute 'source ' . s:currDir . '/vscode-motion.vim'
augroup VscodeGeneral
autocmd!
" autocmd BufWinEnter,WinNew,WinEnter * :only
autocmd BufWinEnter * call <SID>onBufEnter(expand('<afile>'), expand('<abuf>'))
" Help and other buffer types may explicitly disable line numbers - reenable them, !important - set nowrap since it may be overriden and this option is crucial for now
" autocmd FileType * :setlocal conceallevel=0 | :setlocal number | :setlocal numberwidth=8 | :setlocal nowrap | :setlocal nofoldenable
autocmd InsertEnter * call <SID>onInsertEnter()
autocmd BufAdd * call <SID>runFileTypeDetection()
" Looks like external windows are coming with "set wrap" set automatically, disable them
" autocmd WinNew,WinEnter * :set nowrap
augroup END

View file

@ -0,0 +1,86 @@
" This file used to force set neovim options which may break the extension. Loaded after user config
scriptencoding utf-8
set shortmess=filnxtToOFI
set nowrap
set mouse=a
set cmdheight=1
set wildmode=list
set wildchar=<C-e>
set nobackup
set nowb
set noswapfile
set noautoread
set scrolloff=100
set conceallevel=0
set nocursorline
" do not hide buffers
" set nohidden
set hidden
set bufhidden=hide
" do not attempt autowrite any buffers
set noautowrite
" Disable shada session storing
" set shada=
" set nonumber
set norelativenumber
" Render line number as "marker" of the visible top/bottom screen row
set nonumber
" up to 10 000 000
" set numberwidth=8
" Need to know tabs for HL
set listchars=tab:❥♥
set list
" Allow to use vim HL for external buffers, vscode buffers explicitly disable it
syntax on
set signcolumn=no
" Disable statusline and ruler since we don't need them anyway
set statusline=
set laststatus=0
set noruler
" Disable modeline processing. It's being used for tab related settings usually and we don't want to override ours
set nomodeline
set modelines=0
" Turn off auto-folding
set nofoldenable
set foldmethod=manual
" Turn on auto-indenting
set autoindent
set smartindent
" split/nosplit doesn't work currently, see https://github.com/asvetliakov/vscode-neovim/issues/329
set inccommand=
" lazyredraw breaks the movement
set nolazyredraw
function s:forceLocalOptions()
setlocal nowrap
setlocal conceallevel=0
setlocal scrolloff=100
setlocal hidden
setlocal bufhidden=hide
setlocal noautowrite
setlocal nonumber
setlocal norelativenumber
setlocal list
setlocal listchars=tab:❥♥
if exists('b:vscode_controlled') && b:vscode_controlled
setlocal syntax=off
endif
setlocal nofoldenable
setlocal foldmethod=manual
setlocal nolazyredraw
endfunction
augroup VscodeForceOptions
autocmd!
autocmd BufEnter,FileType * call <SID>forceLocalOptions()
augroup END

View file

@ -0,0 +1,46 @@
function s:reveal(direction, resetCursor)
call VSCodeExtensionNotify('reveal', a:direction, a:resetCursor)
endfunction
nnoremap z<CR> <Cmd>call <SID>reveal('top', 1)<CR>
xnoremap z<CR> <Cmd>call <SID>reveal('top', 1)<CR>
nnoremap zt <Cmd>call <SID>reveal('top', 0)<CR>
xnoremap zt <Cmd>call <SID>reveal('top', 0)<CR>
nnoremap z. <Cmd>call <SID>reveal('center', 1)<CR>
xnoremap z. <Cmd>call <SID>reveal('center', 1)<CR>
nnoremap zz <Cmd>call <SID>reveal('center', 0)<CR>
xnoremap zz <Cmd>call <SID>reveal('center', 0)<CR>
nnoremap z- <Cmd>call <SID>reveal('bottom', 1)<CR>
xnoremap z- <Cmd>call <SID>reveal('bottom', 1)<CR>
nnoremap zb <Cmd>call <SID>reveal('bottom', 0)<CR>
xnoremap zb <Cmd>call <SID>reveal('bottom', 0)<CR>
function s:moveCursor(to)
" Native VSCode commands don't register jumplist. Fix by registering jumplist in Vim e.g. for subsequent use of <C-o>
normal! m'
call VSCodeExtensionNotify('move-cursor', a:to)
endfunction
nnoremap H <Cmd>call <SID>moveCursor('top')<CR>
xnoremap H <Cmd>call <SID>moveCursor('top')<CR>
nnoremap M <Cmd>call <SID>moveCursor('middle')<CR>
xnoremap M <Cmd>call <SID>moveCursor('middle')<CR>
nnoremap L <Cmd>call <SID>moveCursor('bottom')<CR>
xnoremap L <Cmd>call <SID>moveCursor('bottom')<CR>
" Disabled due to scroll problems (the ext binds them directly)
" nnoremap <silent> <expr> <C-d> VSCodeExtensionCall('scroll', 'halfPage', 'down')
" xnoremap <silent> <expr> <C-d> VSCodeExtensionCall('scroll', 'halfPage', 'down')
" nnoremap <silent> <expr> <C-u> VSCodeExtensionCall('scroll', 'halfPage', 'up')
" xnoremap <silent> <expr> <C-u> VSCodeExtensionCall('scroll', 'halfPage', 'up')
" nnoremap <silent> <expr> <C-f> VSCodeExtensionCall('scroll', 'page', 'down')
" xnoremap <silent> <expr> <C-f> VSCodeExtensionCall('scroll', 'page', 'down')
" nnoremap <silent> <expr> <C-b> VSCodeExtensionCall('scroll', 'page', 'up')
" xnoremap <silent> <expr> <C-b> VSCodeExtensionCall('scroll', 'page', 'up')
" nnoremap <silent> <expr> <C-e> VSCodeExtensionNotify('scroll-line', 'down')
" xnoremap <silent> <expr> <C-e> VSCodeExtensionNotify('scroll-line', 'down')
" nnoremap <silent> <expr> <C-y> VSCodeExtensionNotify('scroll-line', 'up')
" xnoremap <silent> <expr> <C-y> VSCodeExtensionNotify('scroll-line', 'up')

View file

@ -0,0 +1,40 @@
function! s:switchEditor(...) abort
let count = a:1
let direction = a:2
for i in range(1, count ? count : 1)
call VSCodeCall(direction ==# 'next' ? 'workbench.action.nextEditorInGroup' : 'workbench.action.previousEditorInGroup')
endfor
endfunction
command! -complete=file -nargs=? Tabedit if empty(<q-args>) | call VSCodeNotify('workbench.action.quickOpen') | else | call VSCodeExtensionNotify('open-file', expand(<q-args>), 0) | endif
command! -complete=file Tabnew call VSCodeExtensionNotify('open-file', '__vscode_new__', 0)
command! Tabfind call VSCodeNotify('workbench.action.quickOpen')
command! Tab echoerr 'Not supported'
command! Tabs echoerr 'Not supported'
command! -bang Tabclose if <q-bang> ==# '!' | call VSCodeNotify('workbench.action.revertAndCloseActiveEditor') | else | call VSCodeNotify('workbench.action.closeActiveEditor') | endif
command! Tabonly call VSCodeNotify('workbench.action.closeOtherEditors')
command! -nargs=? Tabnext call <SID>switchEditor(<q-args>, 'next')
command! -nargs=? Tabprevious call <SID>switchEditor(<q-args>, 'prev')
command! Tabfirst call VSCodeNotify('workbench.action.firstEditorInGroup')
command! Tablast call VSCodeNotify('workbench.action.lastEditorInGroup')
command! Tabrewind call VSCodeNotify('workbench.action.firstEditorInGroup')
command! -nargs=? Tabmove echoerr 'Not supported yet'
AlterCommand tabe[dit] Tabedit
AlterCommand tabnew Tabnew
AlterCommand tabf[ind] Tabfind
AlterCommand tab Tab
AlterCommand tabs Tabs
AlterCommand tabc[lose] Tabclose
AlterCommand tabo[nly] Tabonly
AlterCommand tabn[ext] Tabnext
AlterCommand tabp[revious] Tabprevious
AlterCommand tabr[ewind] Tabrewind
AlterCommand tabfir[st] Tabfirst
AlterCommand tabl[ast] Tablast
AlterCommand tabm[ove] Tabmove
nnoremap gt <Cmd>call <SID>switchEditor(v:count, 'next')<CR>
xnoremap gt <Cmd>call <SID>switchEditor(v:count, 'next')<CR>
nnoremap gT <Cmd>call <SID>switchEditor(v:count, 'prev')<CR>
xnoremap gT <Cmd>call <SID>switchEditor(v:count, 'prev')<CR>

View file

@ -0,0 +1,158 @@
function! s:split(...) abort
let direction = a:1
let file = exists('a:2') ? a:2 : ''
call VSCodeCall(direction ==# 'h' ? 'workbench.action.splitEditorDown' : 'workbench.action.splitEditorRight')
if !empty(file)
call VSCodeExtensionNotify('open-file', expand(file), 'all')
endif
endfunction
function! s:splitNew(...)
let file = a:2
call s:split(a:1, empty(file) ? '__vscode_new__' : file)
endfunction
function! s:closeOtherEditors()
call VSCodeNotify('workbench.action.closeEditorsInOtherGroups')
call VSCodeNotify('workbench.action.closeOtherEditors')
endfunction
function! s:manageEditorHeight(...)
let count = a:1
let to = a:2
for i in range(1, count ? count : 1)
call VSCodeNotify(to ==# 'increase' ? 'workbench.action.increaseViewHeight' : 'workbench.action.decreaseViewHeight')
endfor
endfunction
function! s:manageEditorWidth(...)
let count = a:1
let to = a:2
for i in range(1, count ? count : 1)
call VSCodeNotify(to ==# 'increase' ? 'workbench.action.increaseViewWidth' : 'workbench.action.decreaseViewWidth')
endfor
endfunction
command! -complete=file -nargs=? Split call <SID>split('h', <q-args>)
command! -complete=file -nargs=? Vsplit call <SID>split('v', <q-args>)
command! -complete=file -nargs=? New call <SID>split('h', '__vscode_new__')
command! -complete=file -nargs=? Vnew call <SID>split('v', '__vscode_new__')
command! -bang Only if <q-bang> ==# '!' | call <SID>closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif
AlterCommand sp[lit] Split
AlterCommand vs[plit] Vsplit
AlterCommand new New
AlterCommand vne[w] Vnew
AlterCommand on[ly] Only
" buffer management
nnoremap <C-w>n <Cmd>call <SID>splitNew('h', '__vscode_new__')<CR>
xnoremap <C-w>n <Cmd>call <SID>splitNew('h', '__vscode_new__')<CR>
nnoremap <C-w>q <Cmd>call VSCodeNotify('workbench.action.closeActiveEditor')<CR>
xnoremap <C-w>q <Cmd>call VSCodeNotify('workbench.action.closeActiveEditor')<CR>
nnoremap <C-w>c <Cmd>call VSCodeNotify('workbench.action.closeActiveEditor')<CR>
xnoremap <C-w>c <Cmd>call VSCodeNotify('workbench.action.closeActiveEditor')<CR>
nnoremap <C-w><C-c> <Cmd>call VSCodeNotify('workbench.action.closeActiveEditor')<CR>
xnoremap <C-w><C-c> <Cmd>call VSCodeNotify('workbench.action.closeActiveEditor')<CR>
" window/splits management
nnoremap <C-w>s <Cmd>call <SID>split('h')<CR>
xnoremap <C-w>s <Cmd>call <SID>split('h')<CR>
nnoremap <C-w><C-s> <Cmd>call <SID>split('h')<CR>
xnoremap <C-w><C-s> <Cmd>call <SID>split('h')<CR>
nnoremap <C-w>v <Cmd>call <SID>split('v')<CR>
xnoremap <C-w>v <Cmd>call <SID>split('v')<CR>
nnoremap <C-w><C-v> <Cmd>call <SID>split('v')<CR>
xnoremap <C-w><C-v> <Cmd>call <SID>split('v')<CR>
nnoremap <C-w>= <Cmd>call VSCodeNotify('workbench.action.evenEditorWidths')<CR>
xnoremap <C-w>= <Cmd>call VSCodeNotify('workbench.action.evenEditorWidths')<CR>
nnoremap <C-w>_ <Cmd>call VSCodeNotify('workbench.action.toggleEditorWidths')<CR>
xnoremap <C-w>_ <Cmd>call VSCodeNotify('workbench.action.toggleEditorWidths')<CR>
nnoremap <C-w>+ <Cmd>call <SID>manageEditorHeight(v:count, 'increase')<CR>
xnoremap <C-w>+ <Cmd>call <SID>manageEditorHeight(v:count, 'increase')<CR>
nnoremap <C-w>- <Cmd>call <SID>manageEditorHeight(v:count, 'decrease')<CR>
xnoremap <C-w>- <Cmd>call <SID>manageEditorHeight(v:count, 'decrease')<CR>
nnoremap <C-w>> <Cmd>call <SID>manageEditorWidth(v:count, 'increase')<CR>
xnoremap <C-w>> <Cmd>call <SID>manageEditorWidth(v:count, 'increase')<CR>
nnoremap <C-w>< <Cmd>call <SID>manageEditorWidth(v:count, 'decrease')<CR>
xnoremap <C-w>< <Cmd>call <SID>manageEditorWidth(v:count, 'decrease')<CR>
nnoremap <C-w>o <Cmd>call VSCodeNotify('workbench.action.joinAllGroups')<CR>
xnoremap <C-w>o <Cmd>call VSCodeNotify('workbench.action.joinAllGroups')<CR>
nnoremap <C-w><C-o> <Cmd>call VSCodeNotify('workbench.action.joinAllGroups')<CR>
xnoremap <C-w><C-o> <Cmd>call VSCodeNotify('workbench.action.joinAllGroups')<CR>
" window navigation
nnoremap <C-w>j <Cmd>call VSCodeNotify('workbench.action.focusBelowGroup')<CR>
xnoremap <C-w>j <Cmd>call VSCodeNotify('workbench.action.focusBelowGroup')<CR>
nnoremap <C-w>k <Cmd>call VSCodeNotify('workbench.action.focusAboveGroup')<CR>
xnoremap <C-w>k <Cmd>call VSCodeNotify('workbench.action.focusAboveGroup')<CR>
nnoremap <C-w>h <Cmd>call VSCodeNotify('workbench.action.focusLeftGroup')<CR>
xnoremap <C-w>h <Cmd>call VSCodeNotify('workbench.action.focusLeftGroup')<CR>
nnoremap <C-w>l <Cmd>call VSCodeNotify('workbench.action.focusRightGroup')<CR>
xnoremap <C-w>l <Cmd>call VSCodeNotify('workbench.action.focusRightGroup')<CR>
nnoremap <C-w><Down> <Cmd>call VSCodeNotify('workbench.action.focusBelowGroup')<CR>
xnoremap <C-w><Down> <Cmd>call VSCodeNotify('workbench.action.focusBelowGroup')<CR>
nnoremap <C-w><Up> <Cmd>call VSCodeNotify('workbench.action.focusAboveGroup')<CR>
xnoremap <C-w><Up> <Cmd>call VSCodeNotify('workbench.action.focusAboveGroup')<CR>
nnoremap <C-w><Left> <Cmd>call VSCodeNotify('workbench.action.focusLeftGroup')<CR>
xnoremap <C-w><Left> <Cmd>call VSCodeNotify('workbench.action.focusLeftGroup')<CR>
nnoremap <C-w><Right> <Cmd>call VSCodeNotify('workbench.action.focusRightGroup')<CR>
xnoremap <C-w><Right> <Cmd>call VSCodeNotify('workbench.action.focusRightGroup')<CR>
nnoremap <C-w><C-j> <Cmd>call VSCodeNotify('workbench.action.moveEditorToBelowGroup')<CR>
xnoremap <C-w><C-j> <Cmd>call VSCodeNotify('workbench.action.moveEditorToBelowGroup')<CR>
nnoremap <C-w><C-i> <Cmd>call VSCodeNotify('workbench.action.moveEditorToAboveGroup')<CR>
xnoremap <C-w><C-i> <Cmd>call VSCodeNotify('workbench.action.moveEditorToAboveGroup')<CR>
nnoremap <C-w><C-h> <Cmd>call VSCodeNotify('workbench.action.moveEditorToLeftGroup')<CR>
xnoremap <C-w><C-h> <Cmd>call VSCodeNotify('workbench.action.moveEditorToLeftGroup')<CR>
nnoremap <C-w><C-l> <Cmd>call VSCodeNotify('workbench.action.moveEditorToRightGroup')<CR>
xnoremap <C-w><C-l> <Cmd>call VSCodeNotify('workbench.action.moveEditorToRightGroup')<CR>
nnoremap <C-w><C-Down> <Cmd>call VSCodeNotify('workbench.action.moveEditorToBelowGroup')<CR>
xnoremap <C-w><C-Down> <Cmd>call VSCodeNotify('workbench.action.moveEditorToBelowGroup')<CR>
nnoremap <C-w><C-Up> <Cmd>call VSCodeNotify('workbench.action.moveEditorToAboveGroup')<CR>
xnoremap <C-w><C-Up> <Cmd>call VSCodeNotify('workbench.action.moveEditorToAboveGroup')<CR>
nnoremap <C-w><C-Left> <Cmd>call VSCodeNotify('workbench.action.moveEditorToLeftGroup')<CR>
xnoremap <C-w><C-Left> <Cmd>call VSCodeNotify('workbench.action.moveEditorToLeftGroup')<CR>
nnoremap <C-w><C-Right> <Cmd>call VSCodeNotify('workbench.action.moveEditorToRightGroup')<CR>
xnoremap <C-w><C-Right> <Cmd>call VSCodeNotify('workbench.action.moveEditorToRightGroup')<CR>
nnoremap <C-w><S-j> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupDown')<CR>
xnoremap <C-w><S-j> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupDown')<CR>
nnoremap <C-w><S-k> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupUp')<CR>
xnoremap <C-w><S-k> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupUp')<CR>
nnoremap <C-w><S-h> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupLeft')<CR>
xnoremap <C-w><S-h> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupLeft')<CR>
nnoremap <C-w><S-l> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupRight')<CR>
xnoremap <C-w><S-l> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupRight')<CR>
nnoremap <C-w><S-Down> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupDown')<CR>
xnoremap <C-w><S-Down> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupDown')<CR>
nnoremap <C-w><S-Up> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupUp')<CR>
xnoremap <C-w><S-Up> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupUp')<CR>
nnoremap <C-w><S-Left> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupLeft')<CR>
xnoremap <C-w><S-Left> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupLeft')<CR>
nnoremap <C-w><S-Right> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupRight')<CR>
xnoremap <C-w><S-Right> <Cmd>call VSCodeNotify('workbench.action.moveActiveEditorGroupRight')<CR>
nnoremap <C-w>w <Cmd>call VSCodeNotify('workbench.action.focusNextGroup')<CR>
xnoremap <C-w>w <Cmd>call VSCodeNotify('workbench.action.focusNextGroup')<CR>
nnoremap <C-w><C-w> <Cmd>call VSCodeNotify('workbench.action.focusNextGroup')<CR>
xnoremap <C-w><C-w> <Cmd>call VSCodeNotify('workbench.action.focusNextGroup')<CR>
nnoremap <C-w>W <Cmd>call VSCodeNotify('workbench.action.focusPreviousGroup')<CR>
xnoremap <C-w>W <Cmd>call VSCodeNotify('workbench.action.focusPreviousGroup')<CR>
nnoremap <C-w>p <Cmd>call VSCodeNotify('workbench.action.focusPreviousGroup')<CR>
xnoremap <C-w>p <Cmd>call VSCodeNotify('workbench.action.focusPreviousGroup')<CR>
nnoremap <C-w>t <Cmd>call VSCodeNotify('workbench.action.focusFirstEditorGroup')<CR>
xnoremap <C-w>t <Cmd>call VSCodeNotify('workbench.action.focusFirstEditorGroup')<CR>
nnoremap <C-w>b <Cmd>call VSCodeNotify('workbench.action.focusLastEditorGroup')<CR>
xnoremap <C-w>b <Cmd>call VSCodeNotify('workbench.action.focusLastEditorGroup')<CR>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Language="en-US" Id="bracket-pair-colorizer-2" Version="0.2.1" Publisher="CoenraadS"/>
<DisplayName>Bracket Pair Colorizer 2</DisplayName>
<Description xml:space="preserve">A customizable extension for colorizing matching brackets</Description>
<Tags>bracket,brackets,pair,color,colour,multi-root ready</Tags>
<Categories>Other</Categories>
<GalleryFlags>Public</GalleryFlags>
<Badges></Badges>
<Properties>
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.45.0" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="ui,workspace" />
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="" />
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/CoenraadS/Bracket-Pair-Colorizer-2" />
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/CoenraadS/Bracket-Pair-Colorizer-2" />
<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/CoenraadS/Bracket-Pair-Colorizer-2" />
<Property Id="Microsoft.VisualStudio.Services.Branding.Color" Value="#1E1E1E" />
<Property Id="Microsoft.VisualStudio.Services.Branding.Theme" Value="dark" />
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="true" />
</Properties>
<License>extension/LICENSE.md</License>
<Icon>extension/images/icon.png</Icon>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
</Installation>
<Dependencies/>
<Assets>
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.Changelog" Path="extension/CHANGELOG.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/images/icon.png" Addressable="true" />
</Assets>
</PackageManifest>

View file

@ -0,0 +1,140 @@
---
Note:
This extension is unmaintained, check out these similar alternatives:
- [Highlight Matching Tag](https://marketplace.visualstudio.com/items?itemName=vincaslt.highlight-matching-tag)
- [Blockman](https://marketplace.visualstudio.com/items?itemName=leodevbro.blockman)
---
## Release Notes
### 0.2.1
Change activation event to `onStartupFinished` for better performance
### 0.1.5
Remove logging
### 0.1.3
Work with VSCode v1.45.0
### 0.0.29
Allow extension to work with remove development
### 0.0.28
Fix background opacity
### 0.0.27
Support VSCode Theme Colors (except in gutters)
e.g.
```
"bracket-pair-colorizer-2.scopeLineCSS": [
"borderStyle : dotted",
"borderWidth : 1px",
"borderColor : activityBarBadge.background",
]
```
### 0.0.26
Support new extensions being installed without reload
### 0.0.25
Fix regex to search for longest match first
### 0.0.24
Fix extension creating a regex that matches everything if no brackets were defined
### 0.0.23
Remove matching `<>` for all languages because too many false positives
### 0.0.22
Ensure that an extension that contributes brackets also contributes a grammar
### 0.0.21
Add unmatched bracket coloring
Restore option to use independent color groups
### 0.0.20
Support reading language configuration json files with comments
### 0.0.19
Restore only matching bracket scopes when inside of the scope
### 0.0.18
Be more aggresive with recoloring to prevent mismatches
### 0.0.17
Fix coloring offset being wrong following a string/comment/regex
### 0.0.16
Fix nested coloring being broken
### 0.0.13
Leverage VSCode for automagical bracket support
### 0.0.12
Fix colors sometimes being incorrect after text replacement [#3](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/issues/3)
### 0.0.11
Fix colors sometimes being incorrect after text replacement [#2](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/issues/2)
### 0.0.10
JSON with comments support
Go support
Fix colors sometimes being incorrect after text replacement
### 0.0.9
C# support hotfix
### 0.0.8
Fix gutter icons showing only closing brackets
### 0.0.7
Clojure support hotfix
### 0.0.6
Clojure support
### 0.0.5
PHP support
Fix switch statements breaking Typescript brackets
### 0.0.4
PowerShell support
### 0.0.3
Fix loading languages where file extension differs from language id
### 0.0.1
Initial release

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,130 @@
---
Note:
This extension is unmaintained, check out these similar alternatives:
- [Highlight Matching Tag](https://marketplace.visualstudio.com/items?itemName=vincaslt.highlight-matching-tag)
- [Blockman](https://marketplace.visualstudio.com/items?itemName=leodevbro.blockman)
---
# Bracket Pair Colorizer 2
This extension allows matching brackets to be identified with colours. The user can define which tokens to match, and which colours to use.
Screenshot:
![Screenshot](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/example.png "Bracket Pair Colorizer")
---
### F.A.Q.
- Differences between v1 and v2?
- v2 Uses the same bracket parsing engine as VSCode, greatly increasing speed and accuracy. A new version was released because settings were cleaned up, breaking backwards compatibility.
---
### [Release Notes](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/blob/HEAD/CHANGELOG.md)
---
## Settings
> `"bracket-pair-colorizer-2.colors"`
Define the colors used to colorize brackets. Accepts valid color names, hex codes, and `rgba()` values.
```json
"bracket-pair-colorizer-2.colors": [
"Gold",
"Orchid",
"LightSkyBlue"
]
```
> `"bracket-pair-colorizer-2.forceUniqueOpeningColor"`
![Disabled](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/forceUniqueOpeningColorDisabled.png "forceUniqueOpeningColor Disabled")
![Enabled](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/forceUniqueOpeningColorEnabled.png "forceUniqueOpeningColor Enabled")
> `"bracket-pair-colorizer-2.forceIterationColorCycle"`
![Enabled](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/forceIterationColorCycleEnabled.png "forceIterationColorCycle Enabled")
>`"bracket-pair-colorizer-2.colorMode"`
Consecutive brackets share a color pool for all bracket types
Independent brackets allow each bracket type to use its own color pool
![Consecutive](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/consecutiveExample.png "Consecutive Example")
![Independent](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/independentExample.png "Independent Example")
> `"bracket-pair-colorizer-2.highlightActiveScope"`
Should the currently scoped brackets always be highlighted?
> `"bracket-pair-colorizer-2.activeScopeCSS"`
Choose a border style to highlight the active scope. Use `{color}` to match the existing bracket color
It is recommended to disable the inbuilt `editor.matchBrackets` setting if using this feature
![BorderStyle](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/activeScopeBorder.png "Active Scope Border Example")
```json
"bracket-pair-colorizer-2.activeScopeCSS": [
"borderStyle : solid",
"borderWidth : 1px",
"borderColor : {color}",
"opacity: 0.5"
]
```
> `"bracket-pair-colorizer-2.showBracketsInGutter"`
> Show active scope brackets in the gutter
![Gutter](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/gutter.png "Gutter Brackets Example")
> `"bracket-pair-colorizer-2.showBracketsInRuler"`
> Show active scope brackets in the ruler
> `"bracket-pair-colorizer-2.rulerPosition"`
> Decoration position in the ruler
>`"bracket-pair-colorizer-2.showVerticalScopeLine"`
Show a vertical line between the brackets? Enabled by default
![Scope Line](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/no-extra.png "Gutter Brackets Example")
>`"bracket-pair-colorizer-2.showHorizontalScopeLine"`
Show a horizontal line between the brackets? Enabled by default
![Scope Line](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/extra.png "Gutter Brackets Example")
>`"bracket-pair-colorizer-2.scopeLineRelativePosition"`
Disable this to show the vertical line in column 0
![Scope Line](https://github.com/CoenraadS/Bracket-Pair-Colorizer-2/raw/HEAD/images/no-relative.png "Gutter Brackets Example")
>`"bracket-pair-colorizer-2.scopeLineCSS"`
Choose a border style to highlight the active scope. Use `{color}` to match the existing bracket color
```json
"bracket-pair-colorizer-2.scopeLineCSS": [
"borderStyle : solid",
"borderWidth : 1px",
"borderColor : {color}",
"opacity: 0.5"
]
```
>`"bracket-pair-colorizer-2.excludedLanguages"`
Exclude a language from being colorized
### Commands
These commands will expand/undo the cursor selection to the next scope
`"bracket-pair-colorizer-2.expandBracketSelection"`
`"bracket-pair-colorizer-2.undoBracketSelection"`
Quick-start:
```
{
"key": "shift+alt+right",
"command": "bracket-pair-colorizer-2.expandBracketSelection",
"when": "editorTextFocus"
},
{
"key": "shift+alt+left",
"command": "bracket-pair-colorizer-2.undoBracketSelection",
"when": "editorTextFocus"
}
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
width="128"
height="128"
viewBox="0 0 128 128"
id="svg2"
version="1.1">
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer2">
<rect
style="fill:#333333;fill-opacity:1"
id="rect4300"
width="128"
height="128"
x="0"
y="2.2617187e-005" />
</g>
<g
id="g3535">
<g
id="g3527">
<text
id="text3350"
y="92.075386"
x="48.020668"
style="font-style:normal;font-weight:normal;font-size:40.00056458px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"
transform="scale(1.0000162,0.9999838)"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Consolas;-inkscape-font-specification:Consolas;fill:#19a6ff;fill-opacity:1"
y="92.075386"
x="48.020668"
id="tspan3352">(</tspan></text>
<text
transform="scale(0.99999644,1.0000036)"
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="35.211063"
y="97.293411"
id="text3462"><tspan
id="tspan3464"
x="35.211063"
y="97.293411"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:60px;font-family:Consolas;-inkscape-font-specification:Consolas;fill:#fffc00;fill-opacity:1">(</tspan></text>
<text
transform="scale(1.0000021,0.9999979)"
id="text3466"
y="102.51353"
x="20.281208"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:80px;font-family:Consolas;-inkscape-font-specification:Consolas;fill:#b21212;fill-opacity:1"
y="102.51353"
x="20.281208"
id="tspan3468">(</tspan></text>
</g>
<g
id="g3519">
<text
id="text3350-8"
y="56.804874"
x="57.885876"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Consolas;-inkscape-font-specification:Consolas;fill:#19a6ff;fill-opacity:1"
y="56.804874"
x="57.885876"
id="tspan3352-6">)</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="59.695812"
y="62.024811"
id="text3462-4"><tspan
id="tspan3464-2"
x="59.695812"
y="62.024811"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:60px;font-family:Consolas;-inkscape-font-specification:Consolas;fill:#fffc00;fill-opacity:1">)</tspan></text>
<text
id="text3466-0"
y="67.244247"
x="63.584751"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:80px;font-family:Consolas;-inkscape-font-specification:Consolas;fill:#b21212;fill-opacity:1"
y="67.244247"
x="63.584751"
id="tspan3468-8">)</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IBracketManager.js.map

View file

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IExtensionGrammar.js.map

View file

@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Bracket {
constructor(token, color) {
this.token = token;
this.color = color;
}
}
exports.default = Bracket;
//# sourceMappingURL=bracket.js.map

View file

@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bracket_1 = require("./bracket");
class BracketClose extends bracket_1.default {
constructor(token, openBracket) {
super(token, openBracket.color);
this.openBracket = openBracket;
}
}
exports.default = BracketClose;
//# sourceMappingURL=bracketClose.js.map

View file

@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRegexForBrackets = void 0;
function getRegexForBrackets(input) {
const longestFirst = input.sort((a, b) => (b.open.length + b.close.length) - (a.open.length + a.close.length));
const pieces = [];
longestFirst.forEach((b) => {
pieces.push(b.open);
pieces.push(b.close);
});
return createBracketOrRegExp(pieces);
}
exports.getRegexForBrackets = getRegexForBrackets;
function createBracketOrRegExp(pieces) {
const regexStr = `(${pieces.map(prepareBracketForRegExp).join(")|(")})`;
return createRegExp(regexStr, true, { global: true });
}
function prepareBracketForRegExp(str) {
// This bracket pair uses letters like e.g. "begin" - "end"
const insertWordBoundaries = (/^[\w]+$/.test(str));
str = escapeRegExpCharacters(str);
return (insertWordBoundaries ? `\\b${str}\\b` : str);
}
function escapeRegExpCharacters(value) {
return value.replace(/[\-\\\{\}\*\+\?\|\^\$\.\[\]\(\)\#]/g, "\\$&");
}
function createRegExp(searchString, isRegex, options = {}) {
if (!searchString) {
throw new Error("Cannot create regex from empty string");
}
if (!isRegex) {
searchString = escapeRegExpCharacters(searchString);
}
if (options.wholeWord) {
if (!/\B/.test(searchString.charAt(0))) {
searchString = "\\b" + searchString;
}
if (!/\B/.test(searchString.charAt(searchString.length - 1))) {
searchString = searchString + "\\b";
}
}
let modifiers = "";
if (options.global) {
modifiers += "g";
}
if (!options.matchCase) {
modifiers += "i";
}
if (options.multiline) {
modifiers += "m";
}
return new RegExp(searchString, modifiers);
}
//# sourceMappingURL=bracketUtil.js.map

View file

@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ColorMode;
(function (ColorMode) {
ColorMode[ColorMode["Consecutive"] = 0] = "Consecutive";
ColorMode[ColorMode["Independent"] = 1] = "Independent";
})(ColorMode || (ColorMode = {}));
exports.default = ColorMode;
//# sourceMappingURL=colorMode.js.map

View file

@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class DefinitionAfterInheritance {
constructor(language, scopes) {
this.language = language;
this.scopes = scopes;
}
}
exports.default = DefinitionAfterInheritance;
//# sourceMappingURL=definitionAfterInheritance.js.map

View file

@ -0,0 +1,382 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vscode = require("vscode");
const lineState_1 = require("./lineState");
const textLine_1 = require("./textLine");
const vscodeFiles_1 = require("./vscodeFiles");
class DocumentDecoration {
constructor(document, config, settings) {
// This program caches lines, and will only analyze linenumbers including or above a modified line
this.lines = [];
this.scopeDecorations = [];
this.scopeSelectionHistory = [];
this.settings = settings;
this.document = document;
this.languageConfig = config;
}
dispose() {
this.disposeScopeDecorations();
}
onDidChangeTextDocument(contentChanges) {
if (contentChanges.length > 1 || !contentChanges[0].range.isSingleLine || contentChanges[0].text.length > 1) {
let minLineIndexToUpdate = 0;
for (const contentChange of contentChanges) {
minLineIndexToUpdate = Math.min(minLineIndexToUpdate, contentChange.range.start.line);
}
if (minLineIndexToUpdate === 0) {
this.lines = [];
}
else {
this.lines.splice(minLineIndexToUpdate);
}
this.tokenizeDocument();
return;
}
const change = contentChanges[0];
const lineNumber = change.range.start.line;
// Parse overlapped lines with goal to see if we can avoid document reparse
// By just moving existing brackets if the amount of brackets on a line didn't change
const newLine = this.tokenizeLine(lineNumber);
const currentLine = this.lines[lineNumber];
// Current line has new brackets which need to be colored
if (!currentLine.getRuleStack().equals(newLine.getRuleStack()) ||
currentLine.getBracketHash() !== newLine.getBracketHash()) {
this.lines[lineNumber] = newLine;
this.lines.splice(lineNumber + 1);
this.tokenizeDocument();
return;
}
const charOffset = change.text.length - change.rangeLength;
currentLine.offset(change.range.start.character, charOffset);
}
expandBracketSelection(editor) {
const newSelections = [];
editor.selections.forEach((selection) => {
if (this.scopeSelectionHistory.length === 0) {
this.scopeSelectionHistory.push(editor.selections);
}
const nextPos = this.document.validatePosition(selection.active.translate(0, 1));
const endBracket = this.searchScopeForwards(nextPos);
if (!endBracket) {
return;
}
const start = endBracket.openBracket.token.range.start.translate(0, 1);
const end = endBracket.token.range.end.translate(0, -1);
newSelections.push(new vscode.Selection(start, end));
});
if (newSelections.length > 0) {
this.scopeSelectionHistory.push(newSelections);
editor.selections = newSelections;
}
}
undoBracketSelection(editor) {
this.scopeSelectionHistory.pop();
if (this.scopeSelectionHistory.length === 0) {
return;
}
const scopes = this.scopeSelectionHistory[this.scopeSelectionHistory.length - 1];
editor.selections = scopes;
}
// Lines are stored in an array, if line is requested outside of array bounds
// add emptys lines until array is correctly sized
getLine(index, state) {
if (index < this.lines.length) {
return this.lines[index];
}
else {
if (this.lines.length === 0) {
this.lines.push(new textLine_1.default(state, new lineState_1.default(this.settings, this.languageConfig), 0));
}
if (index < this.lines.length) {
return this.lines[index];
}
if (index === this.lines.length) {
const previousLine = this.lines[this.lines.length - 1];
const newLine = new textLine_1.default(state, previousLine.cloneState(), index);
this.lines.push(newLine);
return newLine;
}
throw new Error("Cannot look more than one line ahead");
}
}
tokenizeDocument() {
// console.log("Tokenizing " + this.document.fileName);
// One document may be shared by multiple editors (side by side view)
const editors = vscode.window.visibleTextEditors.filter((e) => this.document === e.document);
if (editors.length === 0) {
// console.warn("No editors associated with document: " + this.document.fileName);
return;
}
// console.time("tokenizeDocument");
const lineIndex = this.lines.length;
const lineCount = this.document.lineCount;
if (lineIndex < lineCount) {
// console.log("Reparse from line: " + (lineIndex + 1));
for (let i = lineIndex; i < lineCount; i++) {
const newLine = this.tokenizeLine(i);
this.lines.push(newLine);
}
}
// console.log("Coloring document");
this.colorDecorations(editors);
// console.timeEnd("tokenizeDocument");
}
updateScopeDecorations(event) {
// console.time("updateScopeDecorations");
this.disposeScopeDecorations();
// For performance reasons we only do one selection for now.
// Simply wrap in foreach selection for multicursor, maybe put it behind an option?
const selection = event.textEditor.selection;
const closeBracket = this.searchScopeForwards(selection.active);
if (!closeBracket) {
return;
}
const openBracket = closeBracket.openBracket;
const beginRange = openBracket.token.range;
const endRange = closeBracket.token.range;
const startLineIndex = openBracket.token.range.start.line;
const endLineIndex = closeBracket.token.range.start.line;
if (this.settings.highlightActiveScope) {
const decoration = this.settings.createScopeBracketDecorations(closeBracket.color);
event.textEditor.setDecorations(decoration, [beginRange, endRange]);
this.scopeDecorations.push(decoration);
}
if (this.settings.showBracketsInGutter) {
if (startLineIndex === endLineIndex) {
const decoration = this.settings.createGutterBracketDecorations(closeBracket.color, openBracket.token.character + closeBracket.token.character);
event.textEditor.setDecorations(decoration, [beginRange, endRange]);
this.scopeDecorations.push(decoration);
}
else {
const decorationOpen = this.settings.createGutterBracketDecorations(openBracket.color, openBracket.token.character);
event.textEditor.setDecorations(decorationOpen, [beginRange]);
this.scopeDecorations.push(decorationOpen);
const decorationClose = this.settings.createGutterBracketDecorations(closeBracket.color, closeBracket.token.character);
event.textEditor.setDecorations(decorationClose, [endRange]);
this.scopeDecorations.push(decorationClose);
}
}
if (this.settings.showBracketsInRuler) {
const decoration = this.settings.createRulerBracketDecorations(closeBracket.color);
event.textEditor.setDecorations(decoration, [beginRange, endRange]);
this.scopeDecorations.push(decoration);
}
const lastWhiteSpaceCharacterIndex = this.document.lineAt(endRange.start).firstNonWhitespaceCharacterIndex;
const lastBracketStartIndex = endRange.start.character;
const lastBracketIsFirstCharacterOnLine = lastWhiteSpaceCharacterIndex === lastBracketStartIndex;
let leftBorderColumn = Infinity;
const tabSize = event.textEditor.options.tabSize;
const position = this.settings.scopeLineRelativePosition ?
Math.min(endRange.start.character, beginRange.start.character) : 0;
let leftBorderIndex = position;
const start = beginRange.start.line + 1;
const end = endRange.start.line;
// Start -1 because prefer draw line at current indent level
for (let lineIndex = start - 1; lineIndex <= end; lineIndex++) {
const line = this.document.lineAt(lineIndex);
if (!line.isEmptyOrWhitespace) {
const firstCharIndex = line.firstNonWhitespaceCharacterIndex;
leftBorderIndex = Math.min(leftBorderIndex, firstCharIndex);
leftBorderColumn = Math.min(leftBorderColumn, this.calculateColumnFromCharIndex(line.text, firstCharIndex, tabSize));
}
}
if (this.settings.showVerticalScopeLine) {
const verticalLineRanges = [];
const endOffset = lastBracketIsFirstCharacterOnLine ? end - 1 : end;
for (let lineIndex = start; lineIndex <= endOffset; lineIndex++) {
const line = this.document.lineAt(lineIndex);
const linePosition = new vscode.Position(lineIndex, this.calculateCharIndexFromColumn(line.text, leftBorderColumn, tabSize));
const range = new vscode.Range(linePosition, linePosition);
const valid = line.text.length >= leftBorderIndex;
verticalLineRanges.push({ range, valid });
}
const safeFallbackPosition = new vscode.Position(start - 1, leftBorderIndex);
this.setVerticalLineDecoration(closeBracket, event, safeFallbackPosition, verticalLineRanges);
}
if (this.settings.showHorizontalScopeLine) {
const underlineLineRanges = [];
const overlineLineRanges = [];
if (startLineIndex === endLineIndex) {
underlineLineRanges.push(new vscode.Range(beginRange.start, endRange.end));
}
else {
const startTextLine = this.document.lineAt(startLineIndex);
const endTextLine = this.document.lineAt(endLineIndex);
const leftStartPos = new vscode.Position(beginRange.start.line, this.calculateCharIndexFromColumn(startTextLine.text, leftBorderColumn, tabSize));
const leftEndPos = new vscode.Position(endRange.start.line, this.calculateCharIndexFromColumn(endTextLine.text, leftBorderColumn, tabSize));
underlineLineRanges.push(new vscode.Range(leftStartPos, beginRange.end));
if (lastBracketIsFirstCharacterOnLine) {
overlineLineRanges.push(new vscode.Range(leftEndPos, endRange.end));
}
else {
underlineLineRanges.push(new vscode.Range(leftEndPos, endRange.end));
}
}
if (underlineLineRanges) {
this.setUnderLineDecoration(closeBracket, event, underlineLineRanges);
}
if (overlineLineRanges) {
this.setOverLineDecoration(closeBracket, event, overlineLineRanges);
}
}
// console.timeEnd("updateScopeDecorations");
}
tokenizeLine(index) {
const newText = this.document.lineAt(index).text;
const previousLineRuleStack = index > 0 ?
this.lines[index - 1].getRuleStack() :
undefined;
const previousLineState = index > 0 ?
this.lines[index - 1].cloneState() :
new lineState_1.default(this.settings, this.languageConfig);
const tokenized = this.languageConfig.grammar.tokenizeLine2(newText, previousLineRuleStack);
const tokens = tokenized.tokens;
const lineTokens = new vscodeFiles_1.LineTokens(tokens, newText);
const matches = new Array();
const count = lineTokens.getCount();
for (let i = 0; i < count; i++) {
const tokenType = lineTokens.getStandardTokenType(i);
if (!vscodeFiles_1.ignoreBracketsInToken(tokenType)) {
const searchStartOffset = tokens[i * 2];
const searchEndOffset = i < count ? tokens[(i + 1) * 2] : newText.length;
const currentTokenText = newText.substring(searchStartOffset, searchEndOffset);
let result;
// tslint:disable-next-line:no-conditional-assignment
while ((result = this.languageConfig.regex.exec(currentTokenText)) !== null) {
matches.push({ content: result[0], index: result.index + searchStartOffset });
}
}
}
const newLine = new textLine_1.default(tokenized.ruleStack, previousLineState, index);
for (const match of matches) {
const lookup = this.languageConfig.bracketToId.get(match.content);
if (lookup) {
newLine.AddToken(match.content, match.index, lookup.key, lookup.open);
}
}
return newLine;
}
setOverLineDecoration(bracket, event, overlineLineRanges) {
const lineDecoration = this.settings.createScopeLineDecorations(bracket.color, true, false, false, false);
event.textEditor.setDecorations(lineDecoration, overlineLineRanges);
this.scopeDecorations.push(lineDecoration);
}
setUnderLineDecoration(bracket, event, underlineLineRanges) {
const lineDecoration = this.settings.createScopeLineDecorations(bracket.color, false, false, true, false);
event.textEditor.setDecorations(lineDecoration, underlineLineRanges);
this.scopeDecorations.push(lineDecoration);
}
setVerticalLineDecoration(bracket, event, fallBackPosition, verticalLineRanges) {
const offsets = [];
const normalDecoration = this.settings.createScopeLineDecorations(bracket.color, false, false, false, true);
if (verticalLineRanges.length === 0) {
return;
}
const normalRanges = verticalLineRanges.filter((e) => e.valid).map((e) => e.range);
// Get first valid range, if non fall-back to opening position
let aboveValidRange = new vscode.Range(fallBackPosition, fallBackPosition);
for (const lineRange of verticalLineRanges) {
if (lineRange.valid) {
aboveValidRange = lineRange.range;
break;
}
}
/* Keep updating last valid range to keep offset distance minimum
to prevent missing decorations when scrolling */
for (const lineRange of verticalLineRanges) {
if (lineRange.valid) {
aboveValidRange = lineRange.range;
}
else {
const offset = lineRange.range.start.line - aboveValidRange.start.line;
offsets.push({ range: aboveValidRange, downOffset: offset });
}
}
event.textEditor.setDecorations(normalDecoration, normalRanges);
this.scopeDecorations.push(normalDecoration);
offsets.forEach((offset) => {
const decoration = this.settings.createScopeLineDecorations(bracket.color, false, false, false, true, offset.downOffset);
event.textEditor.setDecorations(decoration, [offset.range]);
this.scopeDecorations.push(decoration);
});
}
disposeScopeDecorations() {
for (const decoration of this.scopeDecorations) {
decoration.dispose();
}
this.scopeDecorations = [];
}
searchScopeForwards(position) {
for (let i = position.line; i < this.lines.length; i++) {
const endBracket = this.lines[i].getClosingBracket(position);
if (endBracket) {
return endBracket;
}
}
}
colorDecorations(editors) {
// console.time("colorDecorations");
const colorMap = new Map();
// Reduce all the colors/ranges of the lines into a singular map
for (const line of this.lines) {
{
const brackets = line.getAllBrackets();
for (const bracket of brackets) {
const existingRanges = colorMap.get(bracket.color);
if (existingRanges !== undefined) {
existingRanges.push(bracket.token.range);
}
else {
colorMap.set(bracket.color, [bracket.token.range]);
}
}
}
}
for (const [color, decoration] of this.settings.bracketDecorations) {
if (color === "") {
continue;
}
const ranges = colorMap.get(color);
for (const editor of editors) {
if (ranges !== undefined) {
editor.setDecorations(decoration, ranges);
}
else {
// We must set non-used colors to an empty array
// or previous decorations will not be invalidated
editor.setDecorations(decoration, []);
}
}
}
// console.timeEnd("colorDecorations");
}
calculateColumnFromCharIndex(lineText, charIndex, tabSize) {
let spacing = 0;
for (let index = 0; index < charIndex; index++) {
if (lineText.charAt(index) === "\t") {
spacing += tabSize - spacing % tabSize;
}
else {
spacing++;
}
}
return spacing;
}
calculateCharIndexFromColumn(lineText, column, tabSize) {
let spacing = 0;
for (let index = 0; index <= column; index++) {
if (spacing >= column) {
return index;
}
if (lineText.charAt(index) === "\t") {
spacing += tabSize - spacing % tabSize;
}
else {
spacing++;
}
}
return spacing;
}
}
exports.default = DocumentDecoration;
//# sourceMappingURL=documentDecoration.js.map

View file

@ -0,0 +1,135 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vscode_1 = require("vscode");
const documentDecoration_1 = require("./documentDecoration");
const settings_1 = require("./settings");
class DocumentDecorationManager {
constructor() {
this.documents = new Map();
this.settings = new settings_1.default();
}
Dispose() {
this.documents.forEach((document, key) => {
document.dispose();
});
this.settings.dispose();
}
expandBracketSelection(editor) {
const documentDecoration = this.getDocumentDecorations(editor.document);
if (documentDecoration) {
documentDecoration.expandBracketSelection(editor);
}
}
undoBracketSelection(editor) {
const documentDecoration = this.getDocumentDecorations(editor.document);
if (documentDecoration) {
documentDecoration.undoBracketSelection(editor);
}
}
updateDocument(document) {
// console.log("updateDocument");
const documentDecoration = this.getDocumentDecorations(document);
if (documentDecoration) {
documentDecoration.tokenizeDocument();
}
}
onDidOpenTextDocument(document) {
// console.log("onDidOpenTextDocument");
const documentDecoration = this.getDocumentDecorations(document);
if (documentDecoration) {
documentDecoration.tokenizeDocument();
}
}
onDidChangeTextDocument(event) {
// console.log("onDidChangeTextDocument");
const documentDecoration = this.getDocumentDecorations(event.document);
if (documentDecoration) {
documentDecoration.onDidChangeTextDocument(event.contentChanges);
}
}
onDidCloseTextDocument(closedDocument) {
// console.log("onDidCloseTextDocument");
const uri = closedDocument.uri.toString();
const document = this.documents.get(uri);
if (document !== undefined) {
// console.log("Disposing " + uri);
document.dispose();
this.documents.delete(uri);
}
}
onDidChangeSelection(event) {
// console.log("onDidChangeSelection");
const documentDecoration = this.getDocumentDecorations(event.textEditor.document);
if (documentDecoration &&
(documentDecoration.settings.highlightActiveScope ||
documentDecoration.settings.showBracketsInGutter ||
documentDecoration.settings.showVerticalScopeLine ||
documentDecoration.settings.showHorizontalScopeLine)) {
documentDecoration.updateScopeDecorations(event);
}
}
updateAllDocuments() {
// console.log("updateAllDocuments");
for (const editor of vscode_1.window.visibleTextEditors) {
this.updateDocument(editor.document);
}
}
getDocumentDecorations(document) {
if (!this.isValidDocument(document)) {
return;
}
const uri = document.uri.toString();
// console.log("Looking for " + uri + " from cache");
let documentDecorations = this.documents.get(uri);
if (documentDecorations === undefined) {
const languageConfig = this.tryGetLanguageConfig(document.languageId);
if (!languageConfig) {
// console.log("Could not find tokenizer for " + document.languageId);
return;
}
if (languageConfig instanceof Promise) {
// console.log("Found Tokenizer promise for " + document.languageId);
languageConfig.then((grammar) => {
if (grammar) {
this.updateDocument(document);
}
});
return;
}
// console.log("Found Tokenizer for " + document.languageId);
documentDecorations = new documentDecoration_1.default(document, languageConfig, this.settings);
// console.log("Adding " + uri + " to cache");
this.documents.set(uri, documentDecorations);
}
// console.log("Retrieved " + uri + " from cache");
return documentDecorations;
}
tryGetLanguageConfig(languageID) {
return this.settings.TextMateLoader.tryGetLanguageConfig(languageID);
}
isValidDocument(document) {
if (document === undefined) {
// console.warn("Ignoring undefined document");
return false;
}
if (document.lineCount === 0) {
// console.warn("Ignoring document with 0 line counter");
return false;
}
if (document.uri.scheme === "vscode") {
// console.log("Ignoring document with 'vscode' uri");
return false;
}
if (document.uri.scheme === "output") {
// console.log("Ignoring document with 'output' uri");
return false;
}
if (this.settings.excludedLanguages.has(document.languageId)) {
// console.log("Ignoring document because language id was ignored in settings");
return false;
}
return true;
}
}
exports.default = DocumentDecorationManager;
//# sourceMappingURL=documentDecorationManager.js.map

View file

@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deactivate = exports.activate = void 0;
const vscode_1 = require("vscode");
const documentDecorationManager_1 = require("./documentDecorationManager");
function activate(context) {
let documentDecorationManager = new documentDecorationManager_1.default();
vscode_1.extensions.onDidChange(() => restart());
context.subscriptions.push(vscode_1.commands.registerCommand("bracket-pair-colorizer-2.expandBracketSelection", () => {
const editor = vscode_1.window.activeTextEditor;
if (!editor) {
return;
}
documentDecorationManager.expandBracketSelection(editor);
}), vscode_1.commands.registerCommand("bracket-pair-colorizer-2.undoBracketSelection", () => {
const editor = vscode_1.window.activeTextEditor;
if (!editor) {
return;
}
documentDecorationManager.undoBracketSelection(editor);
}), vscode_1.workspace.onDidChangeConfiguration((event) => {
if (event.affectsConfiguration("bracket-pair-colorizer-2") ||
event.affectsConfiguration("editor.lineHeight") ||
event.affectsConfiguration("editor.fontSize")) {
restart();
}
}), vscode_1.window.onDidChangeVisibleTextEditors(() => {
documentDecorationManager.updateAllDocuments();
}), vscode_1.workspace.onDidChangeTextDocument((event) => {
if (event.contentChanges.length > 0) {
documentDecorationManager.onDidChangeTextDocument(event);
}
}), vscode_1.workspace.onDidCloseTextDocument((event) => {
documentDecorationManager.onDidCloseTextDocument(event);
}), vscode_1.workspace.onDidOpenTextDocument((event) => {
documentDecorationManager.onDidOpenTextDocument(event);
}), vscode_1.window.onDidChangeTextEditorSelection((event) => {
documentDecorationManager.onDidChangeSelection(event);
}));
documentDecorationManager.updateAllDocuments();
function restart() {
documentDecorationManager.Dispose();
documentDecorationManager = new documentDecorationManager_1.default();
documentDecorationManager.updateAllDocuments();
}
}
exports.activate = activate;
// tslint:disable-next-line:no-empty
function deactivate() {
}
exports.deactivate = deactivate;
//# sourceMappingURL=extension.js.map

View file

@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class FoundBracket {
constructor(range, type) {
this.range = range;
this.character = type;
}
}
exports.default = FoundBracket;
//# sourceMappingURL=foundBracket.js.map

View file

@ -0,0 +1,91 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vscode_1 = require("vscode");
const umd_1 = require("vscode-uri/lib/umd");
class GutterIconManager {
constructor() {
this.escape = require("escape-html");
this.iconDict = new Map();
// tslint:disable-next-line:callable-types
this.disposables = new Array();
this.fontFamily = vscode_1.workspace.getConfiguration("editor").fontFamily;
this.readEditorLineHeight();
}
Dispose() {
this.disposables.forEach((callback) => {
callback();
});
this.disposables = [];
}
GetIconUri(bracket, color) {
const colorDict = this.iconDict.get(bracket);
if (colorDict) {
const uri = colorDict.get(color);
if (uri) {
return uri;
}
else {
const newUri = this.createIcon(color, bracket);
colorDict.set(color, newUri);
return newUri;
}
}
else {
const newUri = this.createIcon(color, bracket);
const dict = new Map();
dict.set(color, newUri);
this.iconDict.set(bracket, dict);
return newUri;
}
}
createIcon(color, bracket) {
const svg = `<svg xmlns="http://www.w3.org/2000/svg" height="${this.lineHeight}" width="${this.lineHeight}">` +
`<text x="50%" y="50%" fill="${color}" font-family="${this.fontFamily}" font-size="${this.fontSize}" ` +
`text-anchor="middle" dominant-baseline="middle">` +
`${this.escape(bracket)}` +
`</text>` +
`</svg>`;
const encodedSVG = encodeURIComponent(svg);
const URI = "data:image/svg+xml;utf8," + encodedSVG;
return umd_1.default.parse(URI);
}
readEditorLineHeight() {
const MINIMUM_LINE_HEIGHT = 8;
const MAXIMUM_LINE_HEIGHT = 150;
const GOLDEN_LINE_HEIGHT_RATIO = (process.platform === "darwin") ? 1.5 : 1.35;
const editorConfig = vscode_1.workspace.getConfiguration("editor", null);
const fontSize = editorConfig.get("fontSize");
const configuredLineHeight = editorConfig.get("lineHeight");
function clamp(n, min, max) {
if (n < min) {
return min;
}
if (n > max) {
return max;
}
return n;
}
function safeParseInt(n, defaultValue) {
if (typeof n === "number") {
return Math.round(n);
}
const r = parseInt(n, 10);
if (isNaN(r)) {
return defaultValue;
}
return r;
}
let lineHeight = safeParseInt(configuredLineHeight, 0);
lineHeight = clamp(lineHeight, 0, MAXIMUM_LINE_HEIGHT);
if (lineHeight === 0) {
lineHeight = Math.round(GOLDEN_LINE_HEIGHT_RATIO * fontSize);
}
else if (lineHeight < MINIMUM_LINE_HEIGHT) {
lineHeight = MINIMUM_LINE_HEIGHT;
}
this.lineHeight = lineHeight;
this.fontSize = Math.ceil(fontSize * (2 / 3));
}
}
exports.default = GutterIconManager;
//# sourceMappingURL=gutterIconManager.js.map

View file

@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class LanguageConfig {
constructor(grammar, regex, bracketToId) {
this.grammar = grammar;
this.regex = regex;
this.bracketToId = bracketToId;
}
}
exports.default = LanguageConfig;
//# sourceMappingURL=languageConfig.js.map

View file

@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class LanguageDefinition {
}
exports.default = LanguageDefinition;
//# sourceMappingURL=languageDefinition.js.map

View file

@ -0,0 +1,77 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const colorMode_1 = require("./colorMode");
const multipleIndexes_1 = require("./multipleIndexes");
const singularIndex_1 = require("./singularIndex");
const token_1 = require("./token");
class LineState {
constructor(settings, languageConfig, previousState) {
this.settings = settings;
this.languageConfig = languageConfig;
if (previousState !== undefined) {
this.bracketManager = previousState.colorIndexes;
this.previousBracketColor = previousState.previousBracketColor;
}
else {
switch (settings.colorMode) {
case colorMode_1.default.Consecutive:
this.bracketManager = new singularIndex_1.default(settings);
break;
case colorMode_1.default.Independent:
this.bracketManager = new multipleIndexes_1.default(settings, languageConfig);
break;
default: throw new RangeError("Not implemented enum value");
}
}
}
getBracketHash() {
return this.bracketManager.getHash();
}
cloneState() {
const clone = {
colorIndexes: this.bracketManager.copyCumulativeState(),
previousBracketColor: this.previousBracketColor,
};
return new LineState(this.settings, this.languageConfig, clone);
}
getClosingBracket(position) {
return this.bracketManager.getClosingBracket(position);
}
offset(startIndex, amount) {
this.bracketManager.offset(startIndex, amount);
}
addBracket(type, character, beginIndex, lineIndex, open) {
const token = new token_1.default(type, character, beginIndex, lineIndex);
if (open) {
this.addOpenBracket(token);
}
else {
this.addCloseBracket(token);
}
}
getAllBrackets() {
return this.bracketManager.getAllBrackets();
}
addOpenBracket(token) {
let colorIndex;
if (this.settings.forceIterationColorCycle) {
colorIndex = (this.bracketManager.getPreviousIndex(token.type) + 1) % this.settings.colors.length;
}
else {
colorIndex = this.bracketManager.GetAmountOfOpenBrackets(token.type) % this.settings.colors.length;
}
let color = this.settings.colors[colorIndex];
if (this.settings.forceUniqueOpeningColor && color === this.previousBracketColor) {
colorIndex = (colorIndex + 1) % this.settings.colors.length;
color = this.settings.colors[colorIndex];
}
this.previousBracketColor = color;
this.bracketManager.addOpenBracket(token, colorIndex);
}
;
addCloseBracket(token) {
this.bracketManager.addCloseBracket(token);
}
}
exports.default = LineState;
//# sourceMappingURL=lineState.js.map

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