Git Product home page Git Product logo

vscode-emacs-friendly's Introduction

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.

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
C-x r

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.

vscode-emacs-friendly's People

Contributors

anticrisis avatar brother avatar cleemesser avatar ggilmore avatar gizak avatar hara-y avatar hiro-sun avatar itiut avatar kpping avatar kyleboyle avatar modeverv avatar nicksnyder avatar okia avatar sammy44nts avatar sebastianzaha avatar soruma avatar trezm avatar whitphx 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  avatar  avatar  avatar

vscode-emacs-friendly's Issues

The mark

I often get tripped up by how the mark works in vscode. I think there are two main things:

In emacs, when a region is marked and I start typing, the mark disappears (is deactivated), no text is deleted and new characters appear that the cursor. In vscode, the marked text is deleted. Furthermore, the mark stays active, thus if I, say, navigate down with the cursor then it starts marking text again.

Any idea on how to change this?

Typing latency doubled by this extension

I'm currently trying out VScode to see whether it could (partially) replace emacs. Naturally I was interested to compare typing latency (time between key-press and character showing on screen), see here. I used typometer as in that blog post and found that on my system enabling this extension doubled the latency.

Here a screenshot with all my extension disabled:
vscode-emacs
Shows average latency of 16.9ms, max 33.1ms and std-dev 2.8ms.

Here with all my extension disabled except vscode-emacs-friendly:
vscode-no-emacs
Shows average latency of 32.7ms, max 49.8ms and std-dev 4.1ms.

Is there anything which could be done about this?

Edit: See also microsoft/vscode#27378

M-y does not cycle through the kill ring after a yank

I'm not sure if this functionality is actually present, but the kill ring is mentioned in the extension's docs ("M-w | Copy region to kill ring"). So I was anticipating being able to cycle through different strings in the kill ring by the usual "M-y" after performing a yank (C-y), per the conventional Emacs behavior.

If C-y M-y kill ring yanking isn't currently supported, consider this a feature request!

(probably not an issue) What is meta?

Hi hi - I'm on a Mac with a touch bar, & having trouble figuring out what meta is. In regular emacs / command line, it's still the (touch bar) escape key. That doesn't seem to work here - what is it? If it's supposed to still be esc, but that isn't working, how can I fix it? Thank you -

CMD+a for select all not working in file search or search within file

Repro steps:

  1. Find file (CTRL+x CTRL+f) or find within file (CTRL+s)
  2. Start typing a few letters
  3. Type CMD+a

Nothing happens. In the code window, it selects all. With the extension disabled, it selects all. What's special about this little search box that the emacs extension breaks?

Incremental search w/ mark selection

One emacs editing workflow is to set a mark & then perform an incremental search to set the end of the selection. I notice that the mark works fine with ctrl+p/n/f/b, but the mark is lost once I start an incremental search.

Split screen not working.

Split screen involving:

C-x 1 | Close editors in other (split) group.
C-x 2 | Split editor
C-x 3 | Toggle split layout (vertical to horizontal)
C-x o | Focus other split editor

are not working.

C-k is incomplete

In emacs, if the point is in a line where point to end of line contains only whitespace (or nothing), the whitespace and the newline will be deleted. That is, C-a C-k C-k will remove the current line entirely, and if a line contains "abc# ", and a next line "def" where # is the cursor, and C-k is hit, the result will be "abcdef" with point on the d.

vscode-emacs had.. something.. at some point, e.g.

but it also wasn't quite correct.

Correct split key map

The default split window key mappings does not the default emacs mappings as it looks.

C-x 2 does a split right when it really should do split down.
C-x 3 toggle the split direction (nice feature!) but should rather do a split right.

C-x 1 and C-x 0 does what I would consider default.

Kill line is slow

Can something be done here to speed it up, like make it comparable to Emacs?

M-a / M-e : jump sentences (code chunks)

Wondering if there is an omission here that could be added in a future update - I use the M-a/M-e motion controls a lot to jump to the beginning/end of code chunks, respectively. For example:

my_code <- function(x, y, z) {
  return(x + y + z)
}

If my cursor is located at the beginning of line 1, it would jump to the end of line 3 with M-e, and from the end of line 3 it would jump to the beginning of line 1 with M-a. Same outcomes for when the cursor is anywhere in the middle.

Just wondering if this could be added into the keybindings - thanks!

Support of Alt-u / Alt-l / Alt-c

Alt-u to switch a word to the end to UPPERCASE
or ALT-l lowercase or Alt-C toggles the first char to upper caserest to lowercase

Would be cool.

C-y not working in Visual Studio Online

Recently, Microsoft released Visual Studio Online which enables people to use VSCode on the cloud. I've tried it out and install vscode-emacs-friendly plugin the second I opened it.

Things are mostly working as expected, like M-w copies the content into system's clipboard, however, C-y is not working. I can do M-w then Cmd + V in mac to yank the selected content, but C-y seems like not doing anything. I checked the keymap and made sure there is no issues.

Could you please help what's happening, or where can I find some logs to upload here?

Kill ring commands not working

Whenever I run a command that relating to the kill ring (ctrl-space, m-w, etc), I get an error like "Running the contributed command:'emacs.enterMarkMode' failed.". This seems to have been happening for about a week, without any changes to my visual studio. I tried a fresh install of visual studio and the problem persists.

Scroll down by one screen unit

I noticed that ctrl-v doesn't seem to work as expected. On emacs the cursor when you move down by one screen unit stays on top whereas on vs code it jumps on the last line of the current visible unit. Also it doesn't scroll down when your starting position is the first line (it just moves the cursor to the end of the visible screen unit).

make c-w cut the word when text without selected

I don't know how to wirte extension, but I find the "cut" function in editor.js. It should be

let selection = this.getSelection();
if (selection.isEmpty) {
    vscode.commands.executeCommand("MARK FROM currentPos to the CURRENT WORD start")
}
let selectText = this.getSelectionText();
if (appendClipboard) {
  clip.writeSync(clip.readSync() + selectText);
} else {
  clip.writeSync(selectText);
}
let t = Editor.delete(this.getSelectionRange());
vscode.commands.executeCommand("emacs.exitMarkMode");
return t

and can you help me to let keymap Alt+D save killed TEXT to clipboard too

can not C-k when use remote-extension

I start to use vscode with remote-extension,
when connect to ubuntu(on virtual box) from windows,
I can not C-k.

official site says that cause is using clipboardby library.
https://code.visualstudio.com/docs/remote/troubleshooting#_clipboard-does-not-work
https://code.visualstudio.com/api/advanced-topics/remote-extensions#using-the-clipboard
I've made a temporary fix in my environment.

I will work with this problem from this night..

@remote-sever ~/.vscode-server/extensions/lfs.vscode-emacs-friendly-0.8.2/out/src/editor.js
    copy() {
        //clip.writeSync(this.getSelectionText());                                                                                     
        vscode.env.clipboard.writeText(this.getSelectionText());
        vscode.commands.executeCommand("emacs.exitMarkMode");
    }
    cut(appendClipboard) {
        if (appendClipboard) {
            //clip.writeSync(clip.readSync() + this.getSelectionText());  
            vscode.env.clipboard.writeText(vscode.env.clipboard.readText() + this.getSelectionText());
        }
        else {
            //clip.writeSync(this.getSelectionText());                                                                                 
            vscode.env.clipboard.writeText(this.getSelectionText());
            
        }
        let t = Editor.delete(this.getSelectionRange());
        vscode.commands.executeCommand("emacs.exitMarkMode");
        return t;

closeFindWidget on cursor movement?

I would like to close the findWidget automatically when moving the cursor. This duplicates the way emacs works. For example, I will often do a search with a few ctrl+s's, and then alt+< to return to the top of the file. In emacs, this cancels the search operation. But with this extension, the findWidget is still open, which causes some confusion with other commands.

Would this be as straightforward as adding this snippet to the each cursor movement command? Is there a smarter way to do this?

            {
                "key": "ctrl+g",  // change to for example alt+<, alt+>, etc.
                "command": "closeFindWidget",
                "when": "editorFocus && findWidgetVisible"
            },

Return does not complete incremental search

In emacs, an incremental search is completed with , and the cursor is left at the current location. In this extension, has the same behavior as ctrl-s, performing a forward incremental search.

alt-shift-5 doesn't work

alt-shift-5 is supposed to startFindReplaceAction but it does nothing for me.

If I edit it to ctrl-shift-5 it works but never alt-shift-5; not sure if there's some system conflict on Windows or what.

Is it possible to implement "Paste from kill menu" (M-y)?

As described in tutorial:

What do you do if you have some text you want to yank back, and then
you kill something else?  C-y would yank the more recent kill.  But
the previous text is not lost.  You can get back to it using the M-y
command.  After you have done C-y to get the most recent kill, typing
M-y replaces that yanked text with the previous kill.  Typing M-y
again and again brings in earlier and earlier kills.  When you have
reached the text you are looking for, you do not have to do anything to
keep it.  Just go on with your editing, leaving the yanked text where
it is.

If you M-y enough times, you come back to the starting point (the most
recent kill)."

ctrl-o open-line

In emacs I use ctrl-o to open a new line reflexively and the lack of that keybinding causes me no end of frustration in trying to use vscode.

I've added this emacs keybinding in pull request #56 and it fixes my particular problem.
(this is my first time trying to add to an extension, so be warned)

`C-k` does not work

Status line shows (Ctrl+K) was pressed. Waiting for second key of chord...
VS Code 1.16.0/Windows

Mark mode no longer works?

If i do ctrl+space, then ctrl+f, the character is not selected. but if i press the right arrow instead, it is selected.

Please remap ^+R Open Recent

By default VS code maps Open Recent files to ^+R, which is very useful and convenient, but reverse search is binded to ^+R in vscode-emacs-friendly. Please remap Open Recent to another shortcut, for example ^+x f r, or ^+x r.

some functionalities "lose" after setting the mark

Hello:

After using ctrl-space set a mark, what i want to do is then using ctrl-e to jump to the end of line and selecting the whole line(mark the whole line). But now what it does is after setting the mark, if you press ctrl-e you just quit the mark mode and directly jump to the end of line without selecting anything. Not sure if this is right behaviour for emacs. Also only ctrl-b, ctrl-f, ctrl-p and ctrl-n works fine with the mark mode.

Cheers!

Consistently takes 100% CPU?

When I kill it ("Code Helper") in Activity Monitor, VSCode shows a message saying the extension host was killed. When I don't choose to restart host, and I hit the arrow keys, I get this:

image

Why does everything close the find widget?

This is more of a question than an issue, but is there a reason why you made so many commands close the search window? For example, I often want to paste something into it (particularly when I'm replacing), and all of the paste commands are set to closeFindWidget (along with like a million other commands...). Ctrl + G and some of the navigation commands make sense ofc...

<delete> and <backspace> not leaving the MarkMode after removing the selected text.

I am opening this issue because for me this is an important feature of Emacs.

It is common to select some text as to desire to delete it. We can use the cut command (C-w) but this will override the clipboard. When we just want to remove the selection it's common to press <delete>. In Emacs when <delete> is pressed it removes the text and leave the MarkMode. However this plugin doesn't leave the MarkMode and I think this is an issue (and a very bothering one, because sometimes when typing fast I will delete some characters which were in the persistent selection mode).

I have fork the project, and I wish to contribute, I added some few little lines of code to implement this behavior. Please consider merging as it will not affect the original code and could add a better experience for the next users that will use this plugin.

c-u not supported

Is it an oversight that c-u (command-prefix) isn't supported?

That's a nearly 40-year-old finger habit I find hard to break.

Any idea if it's even possible to implement?

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.