Coder Social home page Coder Social logo

whitphx / vscode-emacs-mcx Goto Github PK

View Code? Open in Web Editor NEW
365.0 8.0 63.0 4.35 MB

Awesome Emacs Keymap - VSCode emacs keybinding with multi cursor support

Home Page: https://marketplace.visualstudio.com/items?itemName=tuttieee.emacs-mcx

License: Other

TypeScript 98.50% JavaScript 1.09% Shell 0.41%
emacs vscode-extension hacktoberfest vscode

vscode-emacs-mcx's Introduction

Awesome Emacs Keymap (emacs-mcx)

Test, Build, and Publish

Visual Studio Marketplace Version Visual Studio Marketplace Installs - Azure DevOps Extension Visual Studio Marketplace Rating

Open VSX Version Open VSX Downloads Open VSX Rating

Support me on Ko-fi

Buy Me A Coffee

GitHub Sponsors

This Visual Studio Code extension provides Emacs-like keybindings and operations. This is inspired by the great VSCcode extension by hiro-sun and its forks such as vscode-emacs-friendly by Sebastian Zaha, vscode-emacs-improved by rkwan94, and vscode-emacs-neon by NotKyon.

Though there were such great extensions, this extension is written from scratch because it was hard to achieve the goals listed below by extending the existing codebase.

This extension aims

  • to provide Emacs-like keybindings
  • to be fully compatible with multi cursor
  • to support kill-ring integrated with the system clipboard
  • to support mark-ring
  • to support prefix argument
  • to support sexp
  • to fix some bugs in the existing extensions such as
    • mark-mode states are shared among all editors

This extension makes use of code in the existent extensions listed above and, in addition, VSCode and VSCode Vim extension. Thanks for all these great works. Mainly, almost all keybinding settings are derived from vscode-emacs-friendly by Sebastian Zaha.

FAQ

The cursor cannot be moved on the find widget as the widget closes with movement keys.

It's an intended design that simulates the original Emacs' behavior. You can disable it with emacs-mcx.cursorMoveOnFindWidget option described below. See #137 for the details about this topic.

i-search (C-s) is initialized with the currently selected string and the previous search is removed.

This is VSCode's design that an extension cannot control. To disable it, you should set editor.find.seedSearchStringFromSelection VSCode setting as "never". It makes the find widget work similarly to Emacs.

Refs:

The extension has been broken!

Try the Developer: Reinstall Extension... command from the command palette to reinstall the extension. I fixed a problem by this way somehow.

I find a bug. I want a feature X to be implemented. I have a question.

Post a bug report or a feature request to GitHub Issues.

Extension settings

This extension has some custom settings named with a prefix emacs-mcx. You can configure those settings. (See this page to know how to change the settings.)

Configurable options of this extension are the followings.

emacs-mcx.strictEmacsMove

If set as true, the original emacs's cursor movements are strictly simulated. If set as false, the VSCode's native cursor movements are preserved. For example, if set as true, when you type C-a, the cursor moves to the beginning of the line (Emacs' original behavior). If set as false, on the other hand, the cursor move to the first non-empty character in the line (VSCode's native behavior of Home key).

emacs-mcx.emacsLikeTab

If set as true, tab key works as the Emacs' tab-to-tab-stop command.

emacs-mcx.useMetaPrefixEscape

If set as true, Escape key works as the Meta prefix like original Emacs. If set as false, Escape key works as cancel, the VSCode's native behavior. For example, if set as true, M-f (forward-word) can be issued by both alt+f and escape f.

The only exception is the commands which begin with M-g (M-g g, M-g n, M-g p). It is because VSCode can handle only up to two key strokes as the key bindings. So, as the special case, Escape g works as follows.

Command Desc
Escape g Jump to line (command palette)

emacs-mcx.useMetaPrefixCtrlLeftBracket

If set as true, ctrl+[ works as the Meta prefix like original Emacs.

emacs-mcx.useMetaPrefixMacCmd

If set as true, Command (⌘) key works as the Meta prefix like original Emacs on macOS. This option only works on macOS.

emacs-mcx.killRingMax

Configures the maximum number of kill ring entries. The default is 60.

emacs-mcx.killWholeLine

This simulates the original Emacs' kill-whole-line variable. The default is false.

emacs-mcx.cursorMoveOnFindWidget

If set to true, cursor move commands of this extension (C-f, C-b, C-p, C-n, C-a, C-e, M-f, M-b, and M-m) are disabled when the find widget is focused, to allow the widget to keep open and the cursor to move on it.

emacs-mcx.enableOverridingTypeCommand

Prefix arguments do not work on character inputs with IMEs by default and you can set this config to true in order to enable it. Note that this config makes use of VSCode API's type command under the hood and can cause problems in some cases.

  • If you are using IME, text input may sometimes fail.
  • If another extension that also uses the type command is installed, an error occurs (See microsoft/vscode#13441).

emacs-mcx.enableDigitArgument

Indicates whether M-<digit> (the emacs-mcx.digitArgument command) is enabled. Set false when M-<digit> conflicts with some other necessary commands. See #1208 for the background.

emacs-mcx.lineMoveVisual

When true, line-move moves point by visual lines (same as an Emacs variable line-move-visual).

emacs-mcx.paredit.parentheses

Key-value pairs of parentheses like the following example to be used in the ParEdit commands.

{
  "[": "]",
  "(": ")",
  "{": "}"
}

emacs-mcx.debug.*

Configurations for debugging.

'when' clause context

This extension provides some contexts that you can refer to in "when" clauses of your keybindings.json.

emacs-mcx.inMarkMode

boolean

This indicates whether mark-mode is enabled.

emacs-mcx.acceptingArgument

boolean

This indicates the editor is accepting argument input following C-u.

emacs-mcx.prefixArgumentExists (experimental)

boolean

This indicates if a prefix argument exists. Use this boolean context to check the existence of a prefix argument, instead of using emacs-mcx.prefixArgument with null check.

emacs-mcx.prefixArgument (experimental)

number | undefined

This is a currently input prefix argument.

Keymaps

Alt key is mapped to the Meta prefix (M) by default and you can configure for Escape, ctrl+[, or Command (⌘) key (macOS only) to work as it with the settings above.

Move commands

Command Prefix argument Desc
C-f Move forward (forward-char)
C-b Move backward (backward-char)
C-n Move to the next line (next-line)
C-p Move to the previous line (previous-line)
C-a Move to the beginning of line (move-beginning-of-line)
C-e Move to the end of line (move-end-of-line)
M-f Move forward by one word unit (forward-word)
M-b Move backward by one word unit (backward-word)
C-<right>, M-<right> This command (right-word) behaves like M-f
C-<left>, M-<left> This command (left-word) behaves like M-b
M-m Move (forward or back) to the first non-whitespace character on the current line (back-to-indentation)
C-v Scroll down by one screen unit (scroll-up-command)
M-v Scroll up by one screen unit (scroll-down-command)
M-S-[ (M-{ with US keyboard), C-<up> Move back to previous paragraph beginning (backward-paragraph)
M-S-] (M-} with US keyboard), C-<down> Move forward to next paragraph end (forward-paragraph)
M-S-, (M-< with US keyboard) Move to the top of the buffer (beginning-of-buffer)
M-S-. (M-> with US keyboard) Move to the end of the buffer (end-of-buffer)
M-g g (M-g M-g) Jump to line (command palette)
M-g n (M-g M-n, C-x ` ) Jump to next error
M-g p (M-g M-p) Jump to previous error
C-l Center screen on current line (recenter-top-bottom)

Search Commands

Command Desc
C-s Incremental search forward (isearch-forward).
C-r Incremental search backward (isearch-backward).
C-M-s Begin incremental regexp search (isearch-forward-regexp).
C-M-r Begin reverse incremental regexp search (isearch-backward-regexp).
M-S-5 (M-% with US keyboard) Replace (query-replace)
C-M-S-5 (C-M-% with US keyboard) Replace with regexp (query-replace-regexp)
C-M-n Add selection to next find match
C-M-p Add selection to previous find match
M-s o Open Quick Search, which is like Emacs' occur command.

Edit commands

Command Prefix argument Desc
C-d Delete right (DEL)
C-h Delete left (BACKSPACE)
M-\ Delete spaces and tabs around point (delete-horizontal-space).
C-x C-o Delete blank lines around (delete-blank-lines)
M-S-6 (M-^ with US keyboard) join two lines cleanly (delete-indentation)
M-d Kill word (kill-word)
M-Bksp Kill word left (backward-kill-word)
C-k Kill from the current cursor to the end of line (kill-line)
C-S-Bksp Kill whole line (kill-whole-line)
C-w Kill region
M-w Copy region to kill ring
C-y Yank
M-y Yank pop
C-o Open line
C-j New line
C-m New line
C-x h Select All
C-x u, C-/, C-S-- (C-_ with US keyboard) Undo
C-; Toggle line comment in and out
M-; Toggle region comment in and out
C-x C-l (M-l) Convert to lower case (On the Emacs' original behavior, C-x C-l and M-l are assigned to the different functionalities. However, this extension assigns these keys to the same emacs-mcx.transformToLowercase command which calls editor.action.transformToLowercase command internally and works similarly to both the original Emacs' functionalities based on the context. Upper case and title case (below) are same)
C-x C-u (M-u) Convert to upper case
M-c Convert to title case

Mark Commands

Command Desc
C-SPC, C-S-2 (C-@ with US keyboard) Set the mark at point, and activate it (set-mark-command).
C-SPC C-SPC Set the mark, pushing it onto the mark ring, without activating it.
C-u C-SPC Move point to where the mark was, and restore the mark from the ring of former marks.
C-x C-x Set the mark at point, and activate it; then move point where the mark used to be (exchange-point-and-mark).

See this page and this page about the mark and the mark ring.

Text registers

Command Desc
C-x r s r Copy region into register r (copy-to-register).
C-x r i r Insert text from register r (insert-register).

See this page about the text registers.

Rectangles

Command Desc
C-x r k Kill the text of the region-rectangle, saving its contents as the last killed rectangle (kill-rectangle).
C-x r M-w Save the text of the region-rectangle as the last killed rectangle (copy-rectangle-as-kill).
C-x r d Delete the text of the region-rectangle (delete-rectangle).
C-x r y Yank the last killed rectangle with its upper left corner at point (yank-rectangle).
C-x r p Replace last kill ring to each line of rectangle if the kill ring top only contains one line.
C-x r o Insert blank space to fill the space of the region-rectangle (open-rectangle).
C-x r c Clear the region-rectangle by replacing all of its contents with spaces (clear-rectangle).
C-x r t Replace rectangle contents with string on each line (string-rectangle).
C-x SPC Toggle Rectangle Mark mode (rectangle-mark-mode).

Other Commands

Command Desc
C-g (ESC) Cancel
C-' (M-/) IntelliSense Suggestion
M-x Open command palette
C-M-SPC Toggle SideBar visibility
C-x z Toggle Zen Mode
C-x C-c Close window (save-buffers-kill-terminal)

File Commands

Command Desc
C-x C-f QuickOpen a file (Tips: This extension assigns C-x C-f to the VSCode's native quick file navigation. If you prefer more Emacs-like behavior, The "File Browser" extension by Bodil Stokke (bodil.file-browser) may help.)
C-x C-s Save
C-x C-w Save as
C-x s Save all files
C-x C-n Open new window

Tab / Buffer Manipulation Commands

Command Desc
C-x b Switch to another open buffer
C-x k Close current tab (buffer)
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
C-x LEFT Select the previous tab (previous-buffer).
C-x RIGHT Select the next tab (next-buffer).

Prefix argument

See https://www.gnu.org/software/emacs/manual/html_node/emacs/Arguments.html for detail

Command Desc
C-u universal-argument
M-<number> digit-argument
M-- negative-argument

sexp

Command Prefix argument Desc
C-M-f Move forward over a balanced expression (forward-sexp)
C-M-b Move backward over a balanced expression (backward-sexp)
C-M-S-2 (C-M-@ with US keyboard) Set mark after end of following balanced expression (mark-sexp). This does not move point.
C-M-k Kill balanced expression forward (kill-sexp)
C-M-Bksp Kill balanced expression backward (backward-kill-sexp)
C-S-k Kill a line as if with kill-line, but respecting delimiters. (paredit-kill)

This extension makes use of paredit.js to provide sexp functionalities. Thank you for this great library.

Other commands

emacs-mcx.executeCommandWithPrefixArgument

This command calls another command with the prefix argument. This is mainly for extension developers who want to make the extensions collaborative with this extension's prefix argument. See the issue #1146 for the discussion about it.

For example, if you define the keybinding below,

  • C-x e will call the command foo with the argument {}.
  • C-u C-x e will call the command foo with the argument { prefixArgument: 4 }.
{
  "key": "ctrl+x e",
  "command": "emacs-mcx.executeCommandWithPrefixArgument",
  "args": {
    "command": "foo"
  }
}

You can pass the arguments to the target command as below. In this case,

  • C-x e will call the command foo with the argument { baz: 42 }.
  • C-u C-x e will call the command foo with the argument { prefixArgument: 4, baz: 42 }.
{
  "key": "ctrl+x e",
  "command": "emacs-mcx.executeCommandWithPrefixArgument",
  "args": {
    "command": "foo",
    "args": {
      "baz": 42
    }
  }
}

You can change the key name of the prefix argument.

{
  "key": "ctrl+x e",
  "command": "emacs-mcx.executeCommandWithPrefixArgument",
  "args": {
    "command": "foo",
    "prefixArgumentKey": "repeat"
  }
}
  • C-x e will call the command foo with the argument {}.
  • C-u C-x e will call the command foo with the argument { repeat: 4 }.

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+j: workbench.action.togglePanel => Use ctrl+x j 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.openFileFolder;

Contributions/Development

Your contributions are very welcome!

Please see DEVELOPMENT.md about development of this extension.

vscode-emacs-mcx's People

Contributors

a-stewart avatar aki77 avatar clearfeld avatar dandavison avatar dependabot-preview[bot] avatar dependabot[bot] avatar drsckawamoto avatar flindeberg avatar ganaware avatar gregorybl avatar guyshane avatar icub3d avatar jedbrown avatar joeshaw avatar justinhopkins avatar limon avatar loadx avatar sandy081 avatar shengofsun avatar vaelen avatar whitphx avatar youyuanwu avatar yunkya2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-emacs-mcx's Issues

Backward/Forward word delete does not respect word separators

Steps to Reproduce

  1. Modify settings.json to add new separators (e.g., underscore):
    "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?_"
  1. Observe that move-forward-word and move-backward-word honor underscore as word boundary.
  2. Press M-d (backward-kill-word) or M-backspace (backward-kill-word) and note that it does not respect underscore as a word separator.

Versions

Version: 1.33.1
Awesome Emacs Keymap: 0.11.2
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:20:22.771Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.19.27-gentoo-r1

C-m must reveal the cursor

For example,

(so long line)|

Then type C-m, cursor moves to the next line

(so long line)
|

but it is out of view.

Please dont clear multi-cursor regions after C-M-n

単語の上で C-M-n を複数回入力すると、その単語と同じ単語上に次々と Multi-cursor が増え、その単語が選択状態になります。その後、カーソル移動キーを入力すると、これらの複数の選択範囲が解除されてしまいます。

できれば、選択範囲が解除されるのではなく、カーソル移動にあわせて選択範囲が拡大/縮小するほうが便利だと思うのですがいかがでしょうか?

Tiny Emacs https://marketplace.visualstudio.com/items?itemName=aki77.tiny-emacs では (カーソルを増やすために使用するキーは C-M-n ではなく C-d ですが)、カーソル移動にあわせて選択範囲が拡大/縮小してくれるので便利だと思います。

Extension stopped unexpectedly

When using this extension it suddenly crashed while I don't know this is because of this extension or VSCode itself.

Output in developer tool:

Extension Host
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3114 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper[4682]: ../../vendor/node/src/spawn_sync.cc:458:void node::SyncProcessRunner::TryInitializeAndRunLoop(Local<v8::Value>): Assertion `(uv_loop_init(uv_loop_)) == (0)' failed.
 1: node::Abort() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
 2: node::Assert(char const* const (*) [4]) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
 3: node::SyncProcessRunner::TryInitializeAndRunLoop(v8::Local<v8::Value>) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
 4: node::SyncProcessRunner::Run(v8::Local<v8::Value>) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
 5: node::SyncProcessRunner::Spawn(v8::FunctionCallbackInfo<v8::Value> const&) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
 6: v8::internal::VirtualMemory::TakeControl(v8::internal::VirtualMemory*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
 7: v8::internal::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, v8::internal::BasicBlockProfiler const&) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
 8: v8::internal::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, v8::internal::BasicBlockProfiler const&) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
 9: 0xf88d08431d
10: 0xf88d094557
11: 0xf88d094557

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3257 Extension host terminated unexpectedly. Code:  null  Signal:  SIGABRT
_onExtensionHostCrashed @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3257
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2330 Extension host terminated unexpectedly.
onDidNotificationChange @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2330

Fix ctrl+m behaviour

When type ctrl+m in this situation with JavaScript+React language setting,

    render() {
        return (
            <select>
                {this.labels.map(label =>|)}
            </select>
        )
    }

the cursor should be placed here (actually it does if Enter key is pressed)

    render() {
        return (
            <select>
                {this.labels.map(label =>
                    |)}
            </select>
        )
    }

But currently, the cursor is placed at the end of line ignoring intelligent behavior of vscode at placing the cursor with line break.

    render() {
        return (
            <select>
                {this.labels.map(label =>
                    )}|
            </select>
        )
    }

Bug of yank with empty kill

When empty string ('') is included in the kill ring entries, yank does not work well.
It is because yank uses undo to remove previous yanked text.

Workaround for text boxes

概要

  • VSCode のテキストボックスのキーバインドはカスタマイズができません
  • そのため、テキストボックスで Emacs 的な操作をすると思わぬ結果になります
  • 思わぬ結果になるよりは、何も起こらないように無効にしておいたほうが良いのではないかと思います。

VSCode のテキストボックスの現状

VSCode では、現在のところテキストボックスでのキーバインディングのカスタマイズはほとんどできません。

そのため、テキストボックスでのキーバインディングはほとんどデフォルトの動作をします。

  • Windows ではデフォルトのキーバインディングは Emacs とは割と異なります
  • macOS での事情はわかりませんが、おそらく割と Emacs と似ているのではないかと思います
  • Linux での事情もわかりません

このような事情なので、Windows 特有の問題といえると思います。

Windows での例

例えば Search View (メニューの View ⇒ Search) を開いて、
左上の検索文字列を入力する欄に文字を入力している際に、

  • C-b を押すと
    • 期待すること: カーソルが左へ動く
    • 実際に起こること: Search View が閉じる
  • C-f を押すと
    • 期待すること: カーソルが右へ動く
    • 実際に起こること: Find Widget が表示される

といった、期待とはかけ離れたことが起こります。

Workaround

期待とはかけ離れたことが起こるよりは、何も起こらない方が都合が良いと思います。

そこで、テキストボックスで自然と行ってしまいがちな Emacs 的操作について、Windows では動作しないような設定をすると良いのではないでしょうか?

[
    {
        "key": "ctrl+f",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "ctrl+b",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "ctrl+a",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "ctrl+e",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "alt+f",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "alt+b",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "ctrl+d",
        "when": "isWindows && inputFocus && !textInputFocus",
    },
    {
        "key": "ctrl+h",
        "when": "isWindows && inputFocus && !textInputFocus",
    },
    {
        "key": "alt+d",
        "when": "isWindows && inputFocus && !textInputFocus",
    },
    {
        "key": "ctrl+k",
        "when": "isWindows && inputFocus && !textInputFocus",
    },
    {
        "key": "ctrl+w",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "alt+w",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "ctrl+y",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "alt+y",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "ctrl+m",
        "when": "isWindows && inputFocus && !textInputFocus",
    },
    {
        "key": "ctrl+j",
        "when": "isWindows && inputFocus && !textInputFocus && !findWidgetVisible",
    },
    {
        "key": "alt+l",
        "when": "isWindows && inputFocus && !textInputFocus",
    },
    {
        "key": "alt+u",
        "when": "isWindows && inputFocus && !textInputFocus",
    },
    {
        "key": "alt+backspace",
        "when": "isWindows && inputFocus && !textInputFocus",
    }
]

Don't respect Lisp comments on forwardSexp and backwardSexp when we are editing non-Lisp documents

The current implementations of forwardSexp and backwardSexp seem to be always respecting Lisp comments: ';'.

For example, C# code is here:

bool Foo { get { return bar != default(Baz); } }

When a forwardSexp is executed on the second '{', it should move the cursor to the next to the first '}'.
But it moves the cursor to the end of the document.
This is beacuse it respects the lisp comment ';' before the first '}'.

So, please don't respect Lisp comments when we are editing non-Lisp documents.

Write tests

  • yank works with multi cursor
  • killLine works with multi cursor

Context for mark mode ?

Could you provide context for mark mode which is available in when clause ?

For example, say, in a case when we want to do define per-paragraph jump with Space Block Jumpter package, we need context like inMarkMode below available in when clause.

keybindings.json

/* Enable per-paragraph jump */
{
    "key": "ctrl+b",
    "command": "spaceBlockJumper.moveDown"
},
{
    "key": "ctrl+b",
    "command": "spaceBlockJumper.selectDown",
    "when": "inMarkMode && editorTextFocus"
}

This can be done to some extent with default when: "editorHasSelection" context, but it just works only when we have selection, not at the very start of mark mode...

Please support C-M-f, C-M-b

Please support C-M-f, C-M-b:

https://www.gnu.org/software/emacs/manual/html_node/emacs/Expressions.html

  • C-M-f
    • Move forward over a balanced expression (forward-sexp).
  • C-M-b
    • Move backward over a balanced expression (backward-sexp).

この2つの動作は Emacs の動作を完全に真似しようとするとかなり大変なのですが、いくつかの拡張では導入されています。

個人的には、これらの動作をS式中での移動目的で使用したことはなく、対応する括弧へジャンプする機能としてのみ使用しています。ですので、そのような動作をしてくれるだけでもありがたいです。

Thanks

This extension is really awesome!

Thanks!

please support c-u as a command-prefix

40 years of Emacs finger habits make losing c-u (command prefix for # of executions) very hard.

Any chance this could be added?

(BTW, I greatly appreciate your work on this extension!)

Add message to yank-pop

"Previous command was not a yank" should be shown when yank-pop is invoked not after yank

kill-ring improvements

  • to make the maximum length of kill ring configurable
  • to make it configurable to turn on or off kill-ring integration with clipboard

Some of keybindings stop to work after some time

First of all, thank you for the best Emacs keybinding for VSCode!

I am a Linux (Ubuntu) user and I am facing "random" issues when a certain group of key shortcuts stops working (after some time). Most noticeable are alt+backspace, alt+k or alt+d... I expect to be some issue with another extension (and Linux or Window Manager). It is a bit painfull so any advice (even on how to effectively debug this issue as I am happy to provide patch) is much appreciated.

Keep up great (well awesome 😃 ) work

Yank Pop is not working in windows

Yank Pop is not working in windows. When invoke the "emacs-mcx.yank-pop", nothing happened.

No shortcut conflict for the command "emacs-mcx.yank-pop".

Kill line (C-k) has lag only on locked down corporate PC

I have been using this extension on my personal PC and also on my work PC.
On my personal PC everything is flawless - I simply could not use VS Code without this extension, and I think it should be integrated (in large part) into the core build.

However, on my work computer there is a serious and noticable lag when performing certain operations (I think) involving the kill ring, but particularly when using kill-line C-k.
After pressing C-k there is maybe a 0.5 second lag before the line is killed, this makes it not possible to perform the standard operation of C-k C-y to copy a line into the kill ring ready to be yanked elsewhere.
If you try to do this, you will just paste the last yank onto the end of the current line, and the kill won't be registered.

I noticed in the source code, and through discussion on github elsewhere a month ago or so, that this extension occassionally calls some windows built-in executable which handles copying and pasting into the system clipboard (I think?).
My idea so far is that when I am using the extension on a (heavily) locked down corporate pc, any time a program calls another executable the signature is scanned by some other program - I believe that every program I run on my pc is logged & monitored in some way.

I am uncertain of how I could test this idea, I did have a go at running the built-in profiler to see which commands were taking up time in VS Code, but I was slightly unsuccessful.
Do you have any idea of how I could test what is going on, or if you're aware of any others having a related issue?

Many thanks,

C-m put the cursor at correct position when auto complete works

For example, in java script mode and writing jsdoc:

When the cursor is here:

/**
 * |
 */
def foo() {

}

if Enter is pressed, the next comment line is insert and the cursor is located like this:

/**
 *
 * |
 */
def foo() {

}

However, if C-m is pressed, the cursor is located like this:

/**
 *
 |* 
 */
def foo() {

}

Related: #21

Resuming incremental search replaces old search with word at current location

Steps to Reproduce

  1. Search for word (C-s).
  2. Exit incremental search through movement (e.g., C-a, jump to front of line).
  3. Assuming a different word is now under the cursor, resuming the incremental search (pressing C-s again) will instead search for the current word instead of resuming previous search.

Expected Behavior

Emacs would resume the previous incremental search, instead of starting a new search with the word under the cursor.

Versions

Awesome Emacs Keymap: 0.11.2
VSCode Version: 1.33.1
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:20:22.771Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.19.27-gentoo-r1

C-y does not yank what I killed after repeated C-k

連続した C-k の動作が、Emacs の動作とは異なるようです。
C-k を連続して複数回行った後に C-y を押すと、

  • Emacs では、最初の C-k から kill したものが全て繋がったものがペーストされる
  • Awesome Emacs Keymap では最後の C-k で kill したものだけがペーストされる

となっていました。

https://www.gnu.org/software/emacs/manual/html_node/emacs/Killing-by-Lines.html

このあたりの動作は SebastianZaha のものでは期待通りに動作しています。

Resuming incremental search requires two presses of C-s

Steps to Reproduce:

  1. Search for some word using C-s.
  2. Move to blank line or some space without a word under the cursor, so incremental search history is preserved (see #107).
  3. Resume incremental search (C-s).
  4. Note that previous search is recalled and matches are hightlighted. However, searching has not begun.
  5. Press C-s again to jump to the next match.

Expected Behavior

Resuming incremental search would have immediately resumed the search and jumped to the next match from current cursor location.

Versions

Awesome Emacs Keymap: 0.11.2
VSCode Version: 1.33.1
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:20:22.771Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.19.27-gentoo-r1

Write command-level or keybinding-level tests

Currently the tests are only for EmacsEmulator and other classes around it, and these are more like unit tests.
To test the functionalities with command and keybindings, higher level test like integration test are necessary.

TODO:


Ref:

Escape key cannot close parameter hints

Escape key cannot close parameter hints.

"Parameter hints" is this popup list:
2019-01-14 1

I think the following settings in the package.json:

{
	"key": "escape",
	"command": "emacs-mcx.cancel",
	"when": "editorTextFocus"
},

override VSCode default settings:

{ "key": "escape",                "command": "closeParameterHints",
                                     "when": "editorTextFocus && parameterHintsVisible" },
{ "key": "escape",                "command": "leaveSnippet",
                                     "when": "editorTextFocus && inSnippetMode" },

Do not clear selections when C-M-b, C-M-f

The original emacs doesn’t clear a mark when moving the cursor.

But in 0.4.0 of the Awesome Emacs Keymap, C-M-b (sexp.moveBackward) and C-M-f (sexp.moveForward) clear selections.

Don't clear selections, please.

Stopping incremental search should deselect

Steps to reproduce:

  1. Perform incremental search (C-s).
  2. After finding a match, exit/cancel search (C-g).
  3. Begin typing. 😄 Because last search is selected, it will be unexpectedly deleted and replaced with what you are typing now.

This requires extra C-g to deselect, which is different than Emacs. (It does not automatically select searches. It merely highlights them.)

It's a small thing, but I frequently type over the very thing I was searching, which I then have to first realize, then calm down, then undo, and then do whatever I really wanted. 😄 It's an minor annoyance that makes me want to switch back to Emacs.

Thanks for the great plug-in. It's my favorite!

Please support M-g M-g

In addition to M-g g, please add M-g M-g for same function.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Moving-Point.html

  • M-g M-g
  • M-g g
    • Read a number n and move point to the beginning of line number n (goto-line). Line 1 is the beginning of the buffer. If point is on or just after a number in the buffer, that is the default for n. Just type in the minibuffer to use it. You can also specify n by giving M-g M-g a numeric prefix argument. See Select Buffer, for the behavior of M-g M-g when you give it a plain prefix argument.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.