vscode-emacs-improved

March 2, 2018 · View on GitHub

This project is a fork of the popular Emacs Keymap by hiro-sun. That project is no longer active and my goal was to add meaningful additions to the project to make this extension behave more like an emacs emulator, instead of just a keymapper.

My improvements on the original project

S-expressions was the first major addition I made. This extensnion allows movement via s-expressions, and killing s-expressions. This is most effective when editing .lisp files or any LISP dialect like Clojure. Experience with other languages may vary.

Proper kill-ring: the support for kill-rings in hiro-sun's was inconsistent with the original emacs spec for the kill-ring. The kill-ring implemented in my extensnion can store the last 60 kills added to the ring. Yank-pop is also fully supported.

CUA Mode: this minor mode allows users to keep their traditional copy paste shortcuts on windows (C-c and C-v). Note that as per the spec for CUA mode, these clipboard actions are only available when a region is highlighted. Note that C-x for cut is not supported. This is because VSCode won't recognise C-x as it is the beginning of a chord (if this is wrong, feel free to make an issue on the github page).

Rectangle mode: though skeleton code exists on hiro-sun's to support rectangle mode, it was not finished. I've built on top of this solution and have implemented rectangle-kill and rectangle-yank.

Commands

Move command

CommandStatusDesc
C-fOKMove forward
C-bOKMove backward
C-nOKMove to the next line
C-pOKMove to the previous line
C-aOKMove to the beginning of line
C-eOKMove to the end of line
M-fOKMove forward by one word unit
M-bOKMove backward by one word unit
M->OKMove to the end of buffer
M-<OKMove to the beginning of buffer
C-vOKScroll down by one screen unit
M-vOKScroll up by one screen unit
C-x C-n-Set goal column
C-u C-x C-n-Deactivate C-x C-n
M-g gOKJump to line (command palette)

Search Command

CommandStatusDesc
C-sOKSearch forward
C-rOKSearch backward
C-M-nOKAdd selection to next find match
C-l-Use ext install keyboard-scroll to activate

Edit command

CommandStatusDesc
C-dOKDelete right (DEL)
C-hOKDelete left (BACKSPACE)
M-dOKDelete word
killOKKill to line end
C-wOKKill region
M-wOKCopy region to kill ring
C-yOKYank
C-jOKLine Feed
C-m-Carriage Return
C-i-Horizontal Tab
C-x C-oOKDelete blank lines around
C-x hOKSelect All
C-x u (undo)OKUndo
C-;Toggle line comment in and out
M-;Toggle region comment in and out

Other Command

CommandStatusDesc
abortCommandOKCancel
C-spaceOKSet mark
C-\-IME control
C-quoteOKIntelliSense Suggestion
C-doublequoteIntelliSense Parameter Hint
M-xOKOpen command palette
M-/(dabbrev)-Auto-completion
M-num command-Repeat command num times
C-M-SPCOKToggle SideBar visibility

File Command

CommandStatusDesc
C-oOKOpen a file
C-x bOKQuickOpen a file
C-x C-fOKOpen a working directory
C-x C-sOKSave
C-x C-wOKSave as
C-x i-Insert buffer from file
C-x C-d-Open Folder
C-x C-n-Open new window
C-x C-b-Create new file and open

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 shift+delete instead;
  • ctrl+k: editor.debug.action.showDebugHover, editor.action.trimTrailingWhitespace, editor.action.showHover, editor.action.removeCommentLine, editor.action.addCommentLine, editor.action.openDeclarationToTheSide;
  • 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.