master 660a61021037 cached
17 files
58.0 KB
13.7k tokens
30 symbols
1 requests
Download .txt
Repository: SebastianZaha/vscode-emacs-friendly
Branch: master
Commit: 660a61021037
Files: 17
Total size: 58.0 KB

Directory structure:
gitextract_z56tht5z/

├── .gitignore
├── .vscode/
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
├── .vscodeignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── package.json
├── src/
│   ├── editor.ts
│   ├── extension.ts
│   └── operation.ts
├── test/
│   ├── c-k.test.ts
│   ├── index.ts
│   └── utils.ts
├── tsconfig.json
└── tslint.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.DS_Store
out
node_modules

================================================
FILE: .vscode/launch.json
================================================
// A launch configuration that compiles the extension and then opens it inside a new window
{
    "version": "0.1.0",
    "configurations": [
        {
            "name": "Launch Extension",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
            "stopOnEntry": false,
            "sourceMaps": true,
            "outFiles": ["${workspaceRoot}/out/src/**/*.js"],
            "preLaunchTask": "npm"
        },
        {
            "name": "Extension Tests",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": [
				"--extensionDevelopmentPath=${workspaceRoot}", 
				"--extensionTestsPath=${workspaceRoot}/out/test" ],
            "stopOnEntry": false,
            "sourceMaps": true,
            "outFiles": [
				"${workspaceRoot}/out/src/**/*.js", 
				"${workspaceRoot}/out/test/**/*.js"],
            "preLaunchTask": "npm"
        }
    ]
}


================================================
FILE: .vscode/settings.json
================================================
// Place your settings in this file to overwrite default and user settings.
{
    "files.exclude": {
        "out": false // set this to true to hide the "out" folder with the compiled JS files
    },
    "search.exclude": {
        "out": true // set this to false to include "out" folder in search results
    },
    "typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
}

================================================
FILE: .vscode/tasks.json
================================================
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process

// A task runner that calls a custom npm script that compiles the extension.
{
    "version": "0.1.0",

    // we want to run npm
    "command": "npm",

    // the command is a shell script
    "isShellCommand": true,

    // show the output window only if unrecognized errors occur.
    "showOutput": "silent",

    // we run the custom script "compile" as defined in package.json
    "args": ["run", "compile", "--loglevel", "silent"],

    // The tsc compiler is started in background mode
    "isBackground": true,

    // use the standard tsc in watch mode problem matcher to find compile problems in the output.
    "problemMatcher": "$tsc-watch"
}

================================================
FILE: .vscodeignore
================================================
.vscode/**
.vscode-test/**
out/test/**
test/**
src/**
**/*.map
.gitignore
tsconfig.json
vsc-extension-quickstart.md


================================================
FILE: CHANGELOG.md
================================================
## 0.9.0 (2019-05-06)
- Fixed focus and movement keys interaction when find widget is open
- Fixed movement keys in terminal
- Bound Ctrl-o to insert line before
- Fixed multi-cursor handling and Ctrl-g
- Fixed remote development issues caused by clipboardy
- Added C-_ as undo
- Added C-x r as open recent (was C-r and overridden)
- Fixed split window behavior to better resemble emacs

## 0.8.2 (2017-10-09)
- Fix replaceOne shortcut to correctly only replace the currently selected match

## 0.8.1 (2017-10-09)
- Do not close search widgtet on horizontal movement
- Add shortcut for replace.
- Add shortcuts for jump-to-next-error and jump-to-previous-error
- Fix precondition for deleteWordLeft

## 0.8.0 (2017-08-11)
- Removed register mode, it was introducing too much typing latency
- Extend C-l to also position cursor at top / center / bottom of viewport
- Fix C-f to work in integrated terminal

## 0.7.0 (2017-07-15)
- Change C-j to behave as similar as possible as ENTER
- Add C-m as a C-j alias (in early emacs versions C-m breaks the line, not C-j)
- Add missing M-backspace shortcut to delete left word
- Fix C-p and C-e shortcuts to work on the integrated terminal, instead of opening the command palette

## 0.6.1 (2017-06-27)
- Fix cut to end of line operation when on the last line of a file

## 0.6.0 (2017-06-26)
- Continuous kills from the same cursor position will augment clipboard
- Killing removes end of line character when only whitespace is left on line
- Bind toggle zen mode to C-x z, the default was conflicting
- Close search widget on many cursor moves & other editor actions

## 0.5.0 (2017-03-25)
- Added bindings to manipulate window splitting and joining

## 0.4.0 (2017-03-16)
- Using clipboardy for system clipboard access, old dependency does not work on linux.

## 0.3.2 (2017-03-10)
- Added icon

## 0.3.0 (2017-03-09)
- Repackaged and republished for ease of access on vscode marketplace.

## 0.2.0 (2017-01-14)
- Forked and merged various pull requests and fixes
- The clipboard handling is simplified by the removal of the emacs-only kill ring (which was also an unfinished implementation in the original). Copy, Cut, Yank and C-K work with the system clipboard now.
- C+x k to close tab, C+x C-k all tabs
- C+l centers screen on the cursor line
- C+x C+f bound to quick open file
- yank overwrites selection

## 0.1.1 (2016-11-04)
- Fix #24: C-g does not cancel suggestions and prompts
- Update vscode engine

## 0.1.0
- Fix: IntelliSense Suggestion.
- Add C-x b.

## 0.0.10 (2016-08-29)
- Fix #18: Add Esc to step out from mark mode.
- Add C-x C-o.
- Fix: do not enter automatically in Mark Mode after Yanking. 

## 0.0.9 (2016-07-24)
- Add Kill-ring.
- Alt-x show commands palette.

All changes written by gizak, sammy44nts. Thanks

## 0.0.7 (2016-07-14)
- bug fix for C-k. **Thanks trezm.**
- C-x C-f execute "workbench.action.files.openFile".

Thanks sammy44nts.

## 0.0.6
- C-p and C-n can be used in other panels such as Suggestion and Hint.
- Fix bug C-x C-f won't open file explorer.
- Add one more undo operation C-/
- Add redo operation C-x z
- Fix incorrect column moving after using C-a and C-e

These commands and bug fixes were coding by kpping. Thanks. :)

## 0.0.5
- Change the processing of C-u, C-h.
- Change the processing of C-x C-f, C-x C-w, C-x C-s.

## 0.0.4
- Modify the search operation.

## 0.0.3
- Fixed a bug that occurred when you start from the command line.


================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.md
================================================
# vscode-emacs-friendly

This plugin provides emacs keybindings and workflow for Visual Studio Code and is a fork of the great vscode extension by [hiro-sun](https://github.com/hiro-sun/vscode-emacs).

It merges some of the pull requests in the original and other external helpers that make the extension a little less an exact copy of emacs behavior, and a little more friendly in interacting with the system clipboard and normal vscode interactions.

The following are some of the changes and enhancements from the original:

* The clipboard handling is simplified by the removal of the emacs-only kill ring (which was also an unfinished implementation in the original). Copy, Cut, Yank and C-K work with the system clipboard now.
* C+x k to close tab, C+x C-k all tabs
* C+l centers screen on the cursor line
* C+x C+f bound to quick open file
* yank overwrites selection


### Move commands
|Command | Desc |
|--------|------|
| `C-f` | Move forward |
| `C-b` | Move backward |
| `C-n` | Move to the next line |
| `C-p` | Move to the previous line |
| `C-a` | Move to the beginning of line |
| `C-e` | Move to the end of line |
| `M-f` | Move forward by one word unit |
| `M-b` | Move backward by one word unit |
| `M->` | Move to the end of buffer |
| `M-<` | Move to the beginning of buffer |
| `C-v` | Scroll down by one screen unit |
| `M-v` | Scroll up by one screen unit |
| `M-g g` | Jump to line (command palette) |
| `M-g n` | Jump to next error |
| `M-g p` | Jump to previous error |
| `C-l` |  Center screen on current line |


### Search Commands
|Command | Desc |
|--------|------|
| `C-s` | Search forward |
| `C-r` | Search backward |
| `A-%` | Replace |
| `C-Enter` | Replace One Match (In replace dialog) |
| `C-M-n` | Add selection to next find match |


### Edit commands
|Command | Desc |
|--------|------|
| `C-d` | Delete right (DEL) |
| `C-h` | Delete left (BACKSPACE) |
| `M-d` | Delete word |
| `M-Bksp` | Delete word left |
| `C-k` | Kill to line end |
| `C-S-Bksp` | Kill entire line |
| `C-o` | open-line |
| `C-w` | Kill region |
| `M-w` | Copy region to kill ring |
| `C-y` | Yank |
| `C-j` | Enter |
| `C-m` | Enter |
| `C-x C-o` | Delete blank lines around |
| `C-x h` | Select All |
| `C-x u` (`C-/`, `C-_`)| Undo |
| `C-;` | Toggle line comment in and out |
| `M-;` | Toggle region comment in and out |
| `C-x C-l` | Convert to lower case |
| `C-x C-u` | Convert to upper case |

### Other Commands
|Command | Desc |
|--------|------|
| `C-g` | Cancel |
| `C-space` | Set mark |
| `C-quote` | IntelliSense Suggestion |
| `M-x` | Open command palette |
| `C-M-SPC` | Toggle SideBar visibility |
| `C-x z` | | Toggle Zen Mode |
| `C-x r` | | Open Recent |

### File Commands
|Command | Desc |
|--------|------|
| `C-x C-s` | Save |
| `C-x C-w` | Save as |
| `C-x C-n` | Open new window |

### Tab / Buffer Manipulation Commands
|Command | Desc |
|--------|------|
| `C-x b` | Switch to another open buffer |
| `C-x C-f` | QuickOpen a file |
| `C-x k` | Close current tab (buffer) |
| `C-x C-k` | Close all tabs |
| `C-x 0` | Close editors in the current group.  |
| `C-x 1` | Close editors in other (split) group.  |
| `C-x 2` | Split editor horizontal |
| `C-x 3` | Split editor vertical |
| `C-x 4` | Toggle split layout (vertical to horizontal) |
| `C-x o` | Focus other split editor |

## Conflicts with default key bindings
- `ctrl+d`: editor.action.addSelectionToNextFindMatch => **Use `ctrl+alt+n` instead**;
- `ctrl+g`: workbench.action.gotoLine => **Use `alt+g g` instead**;
- `ctrl+b`: workbench.action.toggleSidebarVisibility => **Use `ctrl+alt+space` instead**;
- `ctrl+space`: toggleSuggestionDetails, editor.action.triggerSuggest => **Use `ctrl+'` instead**;
- `ctrl+x`: editor.action.clipboardCutAction => **Use `ctrl+w` instead**;
- `ctrl+v`: editor.action.clipboardPasteAction => **Use `ctrl+y` instead**;
- `ctrl+k`: editor.debug.action.showDebugHover, editor.action.trimTrailingWhitespace, editor.action.showHover, editor.action.removeCommentLine, editor.action.addCommentLine, editor.action.openDeclarationToTheSide;
- `ctrl+k z`: workbench.action.toggleZenMode => **Use `ctrl+x z` instead**;
- `ctrl+y`: redo;
- `ctrl+m`: editor.action.toggleTabFocusMode;
- `ctrl+/`: editor.action.commentLine => **Use `ctrl+;` instead**;
- `ctrl+p` & `ctrl+e`: workbench.action.quickOpen => **Use `ctrl+x b` instead**;
- `ctrl+p`: workbench.action.quickOpenNavigateNext => **Use `ctrl+n` instead**.
- `ctrl+o`: workbench.action.files.openFile => **Use `ctrl+x ctrl+f` instead**.
- `ctrl+r`: workbench.action.openRecent => **Use `ctrl+x r` instead**.

# More information

The logo is from the great [Pacifica Icon Set](http://bokehlicia.deviantart.com/art/Pacifica-Icons-402508559).


================================================
FILE: package.json
================================================
{
    "name": "vscode-emacs-friendly",
    "displayName": "Emacs Friendly Keymap",
    "description": "Emacs keybindings and selection, friendly interaction with the system clipboard.",
    "icon": "emacs_pacifica.png",
    "version": "0.9.0",
    "publisher": "lfs",
    "homepage": "https://github.com/SebastianZaha/vscode-emacs-friendly",
    "repository": {
        "type": "git",
        "url": "https://github.com/SebastianZaha/vscode-emacs-friendly"
    },
    "bugs": "https://github.com/SebastianZaha/vscode-emacs-friendly/issues",
    "engines": {
        "vscode": "^1.30.0"
    },
    "categories": [
        "Other",
        "Keymaps"
    ],
    "keywords": [
        "emacs",
        "shortcuts",
        "keybindings",
        "behavior",
        "selection"
    ],
    "activationEvents": [
        "*"
    ],
    "main": "./out/src/extension",
    "contributes": {
        "keybindings": [
            {
                "key": "right",
                "command": "emacs.cursorRight",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+f",
                "command": "emacs.cursorRight",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+f",
                "command": "emacs.cursorRight",
                "when": "terminalFocus"
            },
            {
                "key": "ctrl+f",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "left",
                "command": "emacs.cursorLeft",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+b",
                "command": "emacs.cursorLeft",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+b",
                "command": "emacs.cursorLeft",
                "when": "terminalFocus"
            },
            {
                "key": "ctrl+b",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "up",
                "command": "emacs.cursorUp",
                "when": "editorTextFocus && !suggestWidgetVisible"
            },
            {
                "key": "up",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+p",
                "command": "emacs.cursorUp",
                "when": "editorTextFocus && !suggestWidgetVisible"
            },
            {
                "key": "ctrl+p",
                "command": "emacs.cursorUp",
                "when": "terminalFocus"
            },
            {
                "key": "ctrl+p",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "down",
                "command": "emacs.cursorDown",
                "when": "editorTextFocus && !suggestWidgetVisible"
            },
            {
                "key": "down",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+n",
                "command": "emacs.cursorDown",
                "when": "editorTextFocus && !suggestWidgetVisible"
            },
            {
                "key": "ctrl+n",
                "command": "emacs.cursorDown",
                "when": "terminalFocus"
            },
            {
                "key": "ctrl+n",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "home",
                "command": "emacs.cursorHome",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+a",
                "command": "emacs.cursorHome",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+a",
                "command": "emacs.cursorHome",
                "when": "terminalFocus"
            },
            {
                "key": "ctrl+a",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "end",
                "command": "emacs.cursorEnd",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+e",
                "command": "emacs.cursorEnd",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+e",
                "command": "emacs.cursorEnd",
                "when": "terminalFocus"
            },
            {
                "key": "ctrl+e",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "alt+f",
                "command": "emacs.cursorWordRight",
                "when": "editorTextFocus"
            },
            {
                "key": "alt+b",
                "command": "emacs.cursorWordLeft",
                "when": "editorTextFocus"
            },
            {
                "key": "pagedown",
                "command": "emacs.cursorPageDown",
                "when": "editorTextFocus && !suggestWidgetVisible"
            },
            {
                "key": "pagedown",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+v",
                "command": "emacs.cursorPageDown",
                "when": "editorTextFocus && !suggestWidgetVisible"
            },
            {
                "key": "ctrl+v",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "pageup",
                "command": "emacs.cursorPageUp",
                "when": "editorTextFocus && !suggestWidgetVisible"
            },
            {
                "key": "pageup",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "alt+v",
                "command": "emacs.cursorPageUp",
                "when": "editorTextFocus && !suggestWidgetVisible"
            },
            {
                "key": "alt+v",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "alt+shift+.",
                "command": "emacs.cursorBottom",
                "when": "editorTextFocus"
            },
            {
                "key": "alt+shift+.",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "alt+shift+,",
                "command": "emacs.cursorTop",
                "when": "editorTextFocus"
            },
            {
                "key": "alt+shift+,",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "alt+g g",
                "command": "workbench.action.gotoLine"
            },
            {
                "key": "alt+g n",
                "command": "editor.action.marker.next"
            },
            {
                "key": "alt+g p",
                "command": "editor.action.marker.prev"
            },
            {
                "key": "alt+g g",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+s",
                "command": "actions.find",
                "when": "!findWidgetVisible"
            },
            {
                "key": "alt+shift+5",
                "command": "editor.action.startFindReplaceAction",
                "when": "editorFocus"
            },
            {
                "command": "editor.action.replaceOne",
                "key": "ctrl+enter",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+s",
                "command": "actions.find",
                "when": "textInputFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+s",
                "command": "editor.action.nextMatchFindAction",
                "when": "findWidgetVisible"
            },
            {
                "key": "ctrl+r",
                "command": "actions.find",
                "when": "!findWidgetVisible"
            },
            {
                "key": "ctrl+r",
                "command": "actions.find",
                "when": "textInputFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+r",
                "command": "editor.action.previousMatchFindAction",
                "when": "findWidgetVisible"
            },
            {
                "key": "ctrl+alt+n",
                "command": "editor.action.addSelectionToNextFindMatch",
                "when": "editorFocus"
            },
            {
                "key": "ctrl+d",
                "command": "deleteRight",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+h",
                "command": "deleteLeft",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "alt+d",
                "command": "deleteWordRight",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+k",
                "command": "emacs.C-k",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+w",
                "command": "emacs.C-w",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+w",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "alt+w",
                "command": "emacs.M-w",
                "when": "editorTextFocus"
            },
            {
                "key": "alt+w",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+y",
                "command": "emacs.C-y",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+y",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+m",
                "command": "emacs.C-j",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+j",
                "command": "emacs.C-j",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+j",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+o",
                "command": "editor.action.insertLineBefore",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+x ctrl+o",
                "command": "emacs.C-x_C-o",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+x ctrl+o",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+x h",
                "command": "editor.action.selectAll",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+x h",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+x u",
                "command": "emacs.C-/",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+x u",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+/",
                "command": "emacs.C-/",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+/",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+shift+-",
                "command": "emacs.C-/",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+_",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+x r",
                "command": "workbench.action.openRecent"
            },
			{
                "key": "ctrl+x z",
                "command": "workbench.action.toggleZenMode"
            },
            {
                "key": "ctrl+;",
                "command": "editor.action.commentLine",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+;",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "alt+;",
                "command": "editor.action.blockComment",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "alt+;",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+l",
                "command": "emacs.C-l",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+g",
                "command": "emacs.C-g",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+g",
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },
            {
                "key": "ctrl+g",
                "command": "emacs.exitMarkMode",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+g",
                "command": "closeReferenceSearchEditor",
                "when": "inReferenceSearchEditor && !config.editor.stablePeek"
            },
            {
                "key": "ctrl+g",
                "command": "closeReferenceSearch",
                "when": "referenceSearchVisible && !config.editor.stablePeek"
            },
            {
                "key": "ctrl+g",
                "command": "closeBreakpointWidget",
                "when": "breakpointWidgetVisible && editorFocus"
            },
            {
                "key": "ctrl+g",
                "command": "leaveSnippet",
                "when": "editorTextFocus && inSnippetMode"
            },
            {
                "key": "ctrl+g",
                "command": "closeMarkersNavigation",
                "when": "editorFocus && markersNavigationVisible"
            },
            {
                "key": "ctrl+g",
                "command": "closeParameterHints",
                "when": "editorTextFocus && parameterHintsVisible"
            },
            {
                "key": "ctrl+g",
                "command": "hideSuggestWidget",
                "when": "editorTextFocus && suggestWidgetVisible"
            },
            {
                "key": "ctrl+g",
                "command": "cancelRenameInput",
                "when": "editorFocus && renameInputVisible"
            },
            {
                "key": "ctrl+g",
                "command": "closeAccessibilityHelp",
                "when": "accessibilityHelpWidgetVisible && editorFocus"
            },
            {
                "key": "ctrl+g",
                "command": "closeReplaceInFilesWidget",
                "when": "replaceInputBoxFocus && searchViewletVisible"
            },
            {
                "key": "ctrl+g",
                "command": "workbench.action.closeMessages",
                "when": "globalMessageVisible"
            },
            {
                "key": "ctrl+g",
                "command": "workbench.action.closeQuickOpen",
                "when": "inQuickOpen"
            },
            {
                "key": "ctrl+space",
                "command": "emacs.enterMarkMode",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+x ctrl+f",
                "command": "workbench.action.quickOpen"
            },
            {
                "key": "ctrl+x ctrl+s",
                "command": "workbench.action.files.save",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+x ctrl+w",
                "command": "workbench.action.files.saveAs",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+x k",
                "command": "workbench.action.closeActiveEditor"
            },
            {
                "key": "ctrl+x ctrl-k",
                "command": "workbench.action.closeAllEditors"
            },
            {
                "key": "ctrl+x k",
                "command": "workbench.action.closeWindow",
                "when": "!editorIsOpen"
            },
            {
                "key": "ctrl+x ctrl+n",
                "command": "workbench.action.newWindow"
            },
            {
                "key": "ctrl+x 0",
                "command": "workbench.action.closeEditorsInGroup"
            },
            {
                "key": "ctrl+x 1",
                "command": "workbench.action.closeEditorsInOtherGroups"
            },
            {
                "key": "ctrl+x 2",
                "command": "workbench.action.splitEditorDown"
            },
            {
                "key": "ctrl+x 3",
                "command": "workbench.action.splitEditorRight"
            },
            {
                "key": "ctrl+x 4",
                "command": "workbench.action.toggleEditorGroupLayout"
            },
            {
                "key": "ctrl+x o",
                "command": "workbench.action.navigateEditorGroups"
            },
            {
                "key": "ctrl+p",
                "command": "showPrevParameterHint",
                "when": "editorTextFocus && parameterHintsVisible"
            },
            {
                "key": "ctrl+n",
                "command": "showNextParameterHint",
                "when": "editorTextFocus && parameterHintsVisible"
            },
            {
                "key": "ctrl+p",
                "command": "selectPrevQuickFix",
                "when": "editorFocus && quickFixWidgetVisible"
            },
            {
                "key": "ctrl+n",
                "command": "selectNextQuickFix",
                "when": "editorFocus && quickFixWidgetVisible"
            },
            {
                "key": "ctrl+p",
                "command": "selectPrevSuggestion",
                "when": "editorTextFocus && suggestWidgetVisible"
            },
            {
                "key": "ctrl+n",
                "command": "selectNextSuggestion",
                "when": "editorTextFocus && suggestWidgetVisible"
            },
            {
                "key": "ctrl+p",
                "command": "workbench.action.quickOpenNavigatePrevious",
                "when": "inQuickOpen"
            },
            {
                "key": "ctrl+n",
                "command": "workbench.action.quickOpenNavigateNext",
                "when": "inQuickOpen"
            },
            {
                "key": "ctrl+'",
                "command": "editor.action.triggerSuggest",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+'",
                "command": "toggleSuggestionDetails",
                "when": "editorTextFocus && suggestWidgetVisible"
            },
            {
                "key": "ctrl+shift+'",
                "command": "editor.action.triggerParameterHints",
                "when": "editorTextFocus"
            },
            {
                "key": "alt+x",
                "command": "workbench.action.showCommands"
            },
            {
                "key": "ctrl+alt+space",
                "command": "workbench.action.toggleSidebarVisibility"
            },
            {
                "key": "ctrl+x b",
                "command": "workbench.action.showAllEditors"
            },
            {
                "key": "ctrl+shift+backspace",
                "command": "emacs.C-S_bs",
                "when": "editorTextFocus"
            },
            {
                "key": "ctrl+x ctrl+l",
                "command": "editor.action.transformToLowercase",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "ctrl+x ctrl+u",
                "command": "editor.action.transformToUppercase",
                "when": "editorTextFocus && !editorReadonly"
            },
            {
                "key": "alt+backspace",
                "command": "deleteWordLeft",
                "when": "editorTextFocus && !editorReadonly"
            }
        ]
    },
    "scripts": {
        "vscode:prepublish": "tsc -p ./",
        "compile": "tsc -watch -p ./",
        "postinstall": "node ./node_modules/vscode/bin/install",
        "lint": "tslint -p tslint.json --type-check **/*.ts"
    },
    "devDependencies": {
        "@types/mocha": "^2.2.41",
        "@types/node": "^6.0.81",
        "mocha": "^6.1.4",
        "typescript": "^2.4.1",
        "vscode": "^1.1.34"
    },
    "dependencies": {}
}


================================================
FILE: src/editor.ts
================================================
import * as vscode from 'vscode';

// Possible positions when C-l is invoked consequtively
enum RecenterPosition {
  Middle,
  Top,
  Bottom
};

export class Editor {
	private lastKill: vscode.Position // if kill position stays the same, append to clipboard
	private justDidKill: boolean
	private centerState: RecenterPosition

	constructor() {
		this.justDidKill = false
		this.lastKill = null
		this.centerState = RecenterPosition.Middle

		vscode.window.onDidChangeActiveTextEditor(event => {
			this.lastKill = null
		})
		vscode.workspace.onDidChangeTextDocument(event => {
			if (!this.justDidKill) {
				this.lastKill = null
			}
			this.justDidKill = false
		})
		vscode.window.onDidChangeTextEditorSelection(event => {
			this.centerState = RecenterPosition.Middle
		})
	}

	static isOnLastLine(): boolean {
		return vscode.window.activeTextEditor.selection.active.line == vscode.window.activeTextEditor.document.lineCount - 1
	}

	setStatusBarMessage(text: string): vscode.Disposable {
		return vscode.window.setStatusBarMessage(text, 1000);
	}

	setStatusBarPermanentMessage(text: string): vscode.Disposable {
		return vscode.window.setStatusBarMessage(text);
	}

	getSelectionRange(): vscode.Range {
		let selection = vscode.window.activeTextEditor.selection,
			start = selection.start,
			end = selection.end;

		return (start.character !== end.character || start.line !== end.line) ? new vscode.Range(start, end) : null;
	}

	getSelection(): vscode.Selection {
		return vscode.window.activeTextEditor.selection;
	}

	getSelectionText(): string {
		let r = this.getSelectionRange()
		return r ? vscode.window.activeTextEditor.document.getText(r) : ''
	}

	setSelection(start: vscode.Position, end: vscode.Position): void {
		let editor = vscode.window.activeTextEditor;
		editor.selection = new vscode.Selection(start, end);
	}

	getCurrentPos(): vscode.Position {
		return vscode.window.activeTextEditor.selection.active
	}

	// Kill to end of line
	async kill(): Promise<boolean> {
		// Ignore whatever we have selected before
		await vscode.commands.executeCommand("emacs.exitMarkMode")

		let startPos = this.getCurrentPos(),
			isOnLastLine = Editor.isOnLastLine()

		// Move down an entire line (not just the wrapped part), and to the beginning.
		await vscode.commands.executeCommand("cursorMove", { to: "down", by: "line", select: false })
		if (!isOnLastLine) {
			await vscode.commands.executeCommand("cursorMove", { to: "wrappedLineStart" })
		}

		let endPos = this.getCurrentPos(),
			range = new vscode.Range(startPos, endPos),
			txt = vscode.window.activeTextEditor.document.getText(range)

		// If there is something other than whitespace in the selection, we do not cut the EOL too
		if (!isOnLastLine && !txt.match(/^\s*$/)) {
			await vscode.commands.executeCommand("cursorMove", {to: "left", by: "character"})
			endPos = this.getCurrentPos()
		}

		// Select it now, cut the selection, remember the position in case of multiple cuts from same spot
		this.setSelection(startPos, endPos)
		let promise = this.cut(this.lastKill != null && startPos.isEqual(this.lastKill))

		promise.then(() => {
			this.justDidKill = true
			this.lastKill = startPos
		})

		return promise
	}

	copy(): void {
		vscode.env.clipboard.writeText(this.getSelectionText())
		vscode.commands.executeCommand("emacs.exitMarkMode")
	}

	async cut(appendClipboard?: boolean): Promise<boolean> {
		if (appendClipboard) {
			const text = await vscode.env.clipboard.readText();
			vscode.env.clipboard.writeText(text + this.getSelectionText())
		} else {
			vscode.env.clipboard.writeText(this.getSelectionText())
		}
		let t = Editor.delete(this.getSelectionRange());
		vscode.commands.executeCommand("emacs.exitMarkMode");
		return t
	}

	yank(): Thenable<{}> {
		this.justDidKill = false
		return Promise.all([
			vscode.commands.executeCommand("editor.action.clipboardPasteAction"),
			vscode.commands.executeCommand("emacs.exitMarkMode")])
	}

	undo(): void {
		vscode.commands.executeCommand("undo");
	}

	private getFirstBlankLine(range: vscode.Range): vscode.Range {
		let doc = vscode.window.activeTextEditor.document;

		if (range.start.line === 0) {
			return range;
		}
		range = doc.lineAt(range.start.line - 1).range;
		while (range.start.line > 0 && range.isEmpty) {
			range = doc.lineAt(range.start.line - 1).range;
		}
		if (range.isEmpty) {
			return range;
		} else {
			return doc.lineAt(range.start.line + 1).range;
		}
	}

	async deleteBlankLines() {
		let selection = this.getSelection(),
			anchor = selection.anchor,
			doc = vscode.window.activeTextEditor.document,
			range = doc.lineAt(selection.start.line).range,
			nextLine: vscode.Position;

		if (range.isEmpty) {
			range = this.getFirstBlankLine(range);
			anchor = range.start;
			nextLine = range.start;
		} else {
			nextLine = range.start.translate(1, 0);
		}
		selection = new vscode.Selection(nextLine, nextLine);
		vscode.window.activeTextEditor.selection = selection;

		for (let line = selection.start.line;
				line < doc.lineCount - 1  && doc.lineAt(line).range.isEmpty;
		    	++line) {

			await vscode.commands.executeCommand("deleteRight")
		}
		vscode.window.activeTextEditor.selection = new vscode.Selection(anchor, anchor)
	}

	static delete(range: vscode.Range = null): Thenable<boolean> {
		if (range) {
			return vscode.window.activeTextEditor.edit(editBuilder => {
				editBuilder.delete(range);
			});
		}
	}

	deleteLine() : void {
		vscode.commands.executeCommand("emacs.exitMarkMode"); // emulate Emacs
		vscode.commands.executeCommand("editor.action.deleteLines");
	}

	scrollLineToCenterTopBottom = () => {
		const editor = vscode.window.activeTextEditor
		const selection = editor.selection

		switch (this.centerState) {
			case RecenterPosition.Middle:
				this.centerState = RecenterPosition.Top;
				editor.revealRange(selection, vscode.TextEditorRevealType.InCenter);
				break;
			case RecenterPosition.Top:
				this.centerState = RecenterPosition.Bottom;
				editor.revealRange(selection, vscode.TextEditorRevealType.AtTop);
				break;
			case RecenterPosition.Bottom:
				this.centerState = RecenterPosition.Middle;
				// There is no AtBottom, so instead scroll a page up (without moving cursor).
				// The current line then ends up as the last line of the window (more or less)
				vscode.commands.executeCommand("scrollPageUp");
				break;
		}
	}

	breakLine() {
		vscode.commands.executeCommand("lineBreakInsert");
		vscode.commands.executeCommand("emacs.cursorHome");
		vscode.commands.executeCommand("emacs.cursorDown");
	}
}


================================================
FILE: src/extension.ts
================================================
import * as vscode from 'vscode';
import {Operation} from './operation';

var inMarkMode: boolean = false;
var markHasMoved: boolean = false;
export function activate(context: vscode.ExtensionContext): void {
    let op = new Operation(),
        commandList: string[] = [
            "C-g",

            // Edit
            "C-k", "C-w", "M-w", "C-y", "C-x_C-o",
            "C-/", "C-j", "C-S_bs",

            // Navigation
            "C-l",
        ],
        cursorMoves: string[] = [
            "cursorUp", "cursorDown", "cursorLeft", "cursorRight",
            "cursorHome", "cursorEnd",
            "cursorWordLeft", "cursorWordRight",
            "cursorPageDown", "cursorPageUp",
            "cursorTop", "cursorBottom"
        ];

    commandList.forEach(commandName => {
        context.subscriptions.push(registerCommand(commandName, op));
    });

    cursorMoves.forEach(element => {
        context.subscriptions.push(vscode.commands.registerCommand(
            "emacs."+element, () => {
                if (inMarkMode) {
                    markHasMoved  = true;
                }
                vscode.commands.executeCommand(
                    inMarkMode ?
                    element+"Select" :
                    element
                );
            })
        )
    });

    initMarkMode(context);
}

export function deactivate(): void {
}

function initMarkMode(context: vscode.ExtensionContext): void {
    context.subscriptions.push(vscode.commands.registerCommand(
        'emacs.enterMarkMode', () => {
            if (inMarkMode && !markHasMoved) {
                inMarkMode = false;
            } else {
                initSelection();
                inMarkMode = true;
                markHasMoved = false;
            }
        })
    );

    context.subscriptions.push(vscode.commands.registerCommand(
        'emacs.exitMarkMode', () => {
            const selections = vscode.window.activeTextEditor.selections;
            const hasMultipleSelecitons = selections.length > 1;
            if (hasMultipleSelecitons) {
                const allSelectionsAreEmpty = selections.every(selection => selection.isEmpty);
                if (allSelectionsAreEmpty) {
                    vscode.commands.executeCommand("removeSecondaryCursors");
                } else {
                    // initSelection() is used here instead of `executeCommand("cancelSelection")`
                    // because `cancelSelection` command not only cancels selection state
                    // but also removes secondary cursors though these should remain in this case.
                    initSelection();
                }
            } else {
                // This `executeCommand("cancelSelection")` may be able to be replaced with `initSelection()`,
                // however, the core command is used here to follow its updates with ease.
                vscode.commands.executeCommand("cancelSelection");
            }

            if (inMarkMode) {
                inMarkMode = false;
            }
        })
    );
}

function registerCommand(commandName: string, op: Operation): vscode.Disposable {
    return vscode.commands.registerCommand("emacs." + commandName, op.getCommand(commandName));
}

function initSelection(): void {
    // Set new `anchor` and `active` values to all selections so that these are initialized to be empty.
    vscode.window.activeTextEditor.selections = vscode.window.activeTextEditor.selections.map(selection => {
        const currentPosition: vscode.Position = selection.active;
        return new vscode.Selection(currentPosition, currentPosition);
    });
}


================================================
FILE: src/operation.ts
================================================
import {Editor} from './editor';

export class Operation {
    private editor: Editor;
    private commandList: { [key: string]: (...args: any[]) => any, thisArgs?: any } = {};

    constructor() {
        this.editor = new Editor();
        this.commandList = {
            'C-k': () => {
                this.editor.kill();
            },
            'C-w': () => {
                this.editor.cut()
            },
            'M-w': () => {
                this.editor.copy()
            },
            'C-y': () => {
                this.editor.yank()
            },
            "C-x_C-o": () => {
                this.editor.deleteBlankLines();
            },
            "C-/": () => {
                this.editor.undo();
                this.editor.setStatusBarMessage("Undo!");
            },
            'C-j': () => {
                this.editor.breakLine();
            },
            'C-g': () => {
                this.editor.setStatusBarMessage("Quit");
            },
            "C-S_bs": () => {
                this.editor.deleteLine();
            },
            'C-l': () => {
                this.editor.scrollLineToCenterTopBottom()
            }
        };
    }

    getCommand(commandName: string): (...args: any[]) => any {
        return this.commandList[commandName];
    }
}


================================================
FILE: test/c-k.test.ts
================================================
import * as assert from 'assert'
import * as vscode from 'vscode'

import * as utils from './utils'
import {Editor} from '../src/editor'

suite("C-K functionality", () => {

    test("EOL behavior", async () => {

        let c = "line 1\nline 2\nline 3\n",
            e = new Editor()

        let doc = await vscode.workspace.openTextDocument({content: c, language: 'text'})
        await vscode.window.showTextDocument(doc)

        await e.kill()
        await e.kill()
        await e.kill()
        assert.equal(doc.getText(), "\nline 3\n")
        await e.yank()
        assert.equal(doc.getText(), c)

        await utils.moveCursorToBeginning()
        
        await e.kill()
        assert.equal(doc.getText(), "\nline 2\nline 3\n")
        await e.yank()
        assert.equal(doc.getText(), c)
        
        await utils.moveCursorToBeginning()

        await e.kill()
        await e.kill()
        assert.equal(doc.getText(), "line 2\nline 3\n")
        await e.yank()
        assert.equal(doc.getText(), c)

        await utils.moveCursorToBeginning()

        await e.kill()
        await e.kill()
        await e.kill()
        await e.kill()
        assert.equal(doc.getText(), "line 3\n")
        await e.yank()
        assert.equal(doc.getText(), c)
    });
});


================================================
FILE: test/index.ts
================================================
//
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
//
// This file is providing the test runner to use when running extension tests.
// By default the test runner in use is Mocha based.
//
// You can provide your own test runner if you want to override it by exporting
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
// host can call to run the tests. The test runner is expected to use console.log
// to report the results back to the caller. When the tests are finished, return
// a possible error to the callback or null if none.

var testRunner = require('vscode/lib/testrunner');

// You can directly control Mocha options by uncommenting the following lines
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({
    ui: 'tdd', 		// the TDD UI is being used in extension.test.ts (suite, test, etc.)
    useColors: true // colored output from test results
});

module.exports = testRunner;

================================================
FILE: test/utils.ts
================================================
import * as vscode from 'vscode'

export function moveCursorToBeginning(): Thenable<{}> {
    vscode.commands.executeCommand("cursorMove", {to: "wrappedLineStart", select: false})
    return vscode.commands.executeCommand("cursorMove", {to: "up", by: "line", select: false, value: Number.MAX_VALUE})
}


================================================
FILE: tsconfig.json
================================================
{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6",
        "outDir": "out",
        "lib": [
            "es6",
            "esnext.asynciterable"
        ],
        "sourceMap": true,
        "rootDir": ".",
		"noUnusedLocals": true
    },
    "exclude": [
        "node_modules",
        ".vscode-test"
    ]
}


================================================
FILE: tslint.json
================================================
{
	"rules": {
		"no-unused-expression": true,
		"no-duplicate-variable": true,
		"no-unused-variable": true,
		"curly": false,
		"class-name": true,
		"semicolon": ["never"],
		"triple-equals": false
	}
}
Download .txt
gitextract_z56tht5z/

├── .gitignore
├── .vscode/
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
├── .vscodeignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── package.json
├── src/
│   ├── editor.ts
│   ├── extension.ts
│   └── operation.ts
├── test/
│   ├── c-k.test.ts
│   ├── index.ts
│   └── utils.ts
├── tsconfig.json
└── tslint.json
Download .txt
SYMBOL INDEX (30 symbols across 4 files)

FILE: src/editor.ts
  type RecenterPosition (line 4) | enum RecenterPosition {
  class Editor (line 10) | class Editor {
    method constructor (line 15) | constructor() {
    method isOnLastLine (line 34) | static isOnLastLine(): boolean {
    method setStatusBarMessage (line 38) | setStatusBarMessage(text: string): vscode.Disposable {
    method setStatusBarPermanentMessage (line 42) | setStatusBarPermanentMessage(text: string): vscode.Disposable {
    method getSelectionRange (line 46) | getSelectionRange(): vscode.Range {
    method getSelection (line 54) | getSelection(): vscode.Selection {
    method getSelectionText (line 58) | getSelectionText(): string {
    method setSelection (line 63) | setSelection(start: vscode.Position, end: vscode.Position): void {
    method getCurrentPos (line 68) | getCurrentPos(): vscode.Position {
    method kill (line 73) | async kill(): Promise<boolean> {
    method copy (line 108) | copy(): void {
    method cut (line 113) | async cut(appendClipboard?: boolean): Promise<boolean> {
    method yank (line 125) | yank(): Thenable<{}> {
    method undo (line 132) | undo(): void {
    method getFirstBlankLine (line 136) | private getFirstBlankLine(range: vscode.Range): vscode.Range {
    method deleteBlankLines (line 153) | async deleteBlankLines() {
    method delete (line 179) | static delete(range: vscode.Range = null): Thenable<boolean> {
    method deleteLine (line 187) | deleteLine() : void {
    method breakLine (line 214) | breakLine() {

FILE: src/extension.ts
  function activate (line 6) | function activate(context: vscode.ExtensionContext): void {
  function deactivate (line 48) | function deactivate(): void {
  function initMarkMode (line 51) | function initMarkMode(context: vscode.ExtensionContext): void {
  function registerCommand (line 91) | function registerCommand(commandName: string, op: Operation): vscode.Dis...
  function initSelection (line 95) | function initSelection(): void {

FILE: src/operation.ts
  class Operation (line 3) | class Operation {
    method constructor (line 7) | constructor() {
    method getCommand (line 44) | getCommand(commandName: string): (...args: any[]) => any {

FILE: test/utils.ts
  function moveCursorToBeginning (line 3) | function moveCursorToBeginning(): Thenable<{}> {
Condensed preview — 17 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (64K chars).
[
  {
    "path": ".gitignore",
    "chars": 26,
    "preview": ".DS_Store\nout\nnode_modules"
  },
  {
    "path": ".vscode/launch.json",
    "chars": 1079,
    "preview": "// A launch configuration that compiles the extension and then opens it inside a new window\n{\n    \"version\": \"0.1.0\",\n  "
  },
  {
    "path": ".vscode/settings.json",
    "chars": 455,
    "preview": "// Place your settings in this file to overwrite default and user settings.\n{\n    \"files.exclude\": {\n        \"out\": fals"
  },
  {
    "path": ".vscode/tasks.json",
    "chars": 1027,
    "preview": "// Available variables which can be used inside of strings.\n// ${workspaceRoot}: the root folder of the team\n// ${file}:"
  },
  {
    "path": ".vscodeignore",
    "chars": 116,
    "preview": ".vscode/**\n.vscode-test/**\nout/test/**\ntest/**\nsrc/**\n**/*.map\n.gitignore\ntsconfig.json\nvsc-extension-quickstart.md\n"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 3436,
    "preview": "## 0.9.0 (2019-05-06)\n- Fixed focus and movement keys interaction when find widget is open\n- Fixed movement keys in term"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "README.md",
    "chars": 4724,
    "preview": "# vscode-emacs-friendly\n\nThis plugin provides emacs keybindings and workflow for Visual Studio Code and is a fork of the"
  },
  {
    "path": "package.json",
    "chars": 22523,
    "preview": "{\n    \"name\": \"vscode-emacs-friendly\",\n    \"displayName\": \"Emacs Friendly Keymap\",\n    \"description\": \"Emacs keybindings"
  },
  {
    "path": "src/editor.ts",
    "chars": 6560,
    "preview": "import * as vscode from 'vscode';\n\n// Possible positions when C-l is invoked consequtively\nenum RecenterPosition {\n  Mid"
  },
  {
    "path": "src/extension.ts",
    "chars": 3633,
    "preview": "import * as vscode from 'vscode';\nimport {Operation} from './operation';\n\nvar inMarkMode: boolean = false;\nvar markHasMo"
  },
  {
    "path": "src/operation.ts",
    "chars": 1304,
    "preview": "import {Editor} from './editor';\n\nexport class Operation {\n    private editor: Editor;\n    private commandList: { [key: "
  },
  {
    "path": "test/c-k.test.ts",
    "chars": 1285,
    "preview": "import * as assert from 'assert'\nimport * as vscode from 'vscode'\n\nimport * as utils from './utils'\nimport {Editor} from"
  },
  {
    "path": "test/index.ts",
    "chars": 1017,
    "preview": "//\n// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING\n//\n// This file is providing the test runner to u"
  },
  {
    "path": "test/utils.ts",
    "chars": 302,
    "preview": "import * as vscode from 'vscode'\n\nexport function moveCursorToBeginning(): Thenable<{}> {\n    vscode.commands.executeCom"
  },
  {
    "path": "tsconfig.json",
    "chars": 344,
    "preview": "{\n    \"compilerOptions\": {\n        \"module\": \"commonjs\",\n        \"target\": \"es6\",\n        \"outDir\": \"out\",\n        \"lib\""
  },
  {
    "path": "tslint.json",
    "chars": 204,
    "preview": "{\n\t\"rules\": {\n\t\t\"no-unused-expression\": true,\n\t\t\"no-duplicate-variable\": true,\n\t\t\"no-unused-variable\": true,\n\t\t\"curly\": "
  }
]

About this extraction

This page contains the full source code of the SebastianZaha/vscode-emacs-friendly GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 17 files (58.0 KB), approximately 13.7k tokens, and a symbol index with 30 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!