BackToPlebbit69 · 2022-09-16 02:01
Hey there,
To preface this post, I am currently using Emacs within the terminal within VSCode, since I hate LSP mode in terms of how damn hard it is to configure something that even compares to VSCode. Trust me, I've been through most configs and setups, and nothing 'just works' and is a complete mess.
That being stated, I went ahead and thought to then just use Emacs in terminal anyway since I use it for Org Mode notes anyway for work and would rather use VS Code for web development projects with intellisense out of the box (React, vanilla JS, Ruby, etc).
​
**With This In Mind, I Have The Following Issues:**
1. Issue Using 'M-x RET' to launch 'vterm' on MacOS
So on MacOS, I do the following key combo swaps:
\- Swap Caps with Ctrl
\- Swap Option with Command
​
However, when I try to use my existing key combination on MacOS to launch 'vterm' with 'M-RET' that works already works on Linux (Manjaro), I get the following:
M-RET is undefined
A related snippet from my config can be found here:
[https://bpa.st/XLNQ](https://bpa.st/XLNQ)
​
2. Using 'M-w' quits out of VS Code
Anyone who uses Emacs knows that 'M-w' is used to copy a selected portion of the buffer into the copy and paste clipboard.
However, when I do this action, it quits out of VS Code.
Does anyone know how I can nuke this default behavior of VS Code to allow Emacs to just utilize it going forward?
​
3. Using 'M-f' and 'M-b' does not go back and forward
When I use this in VS Code, 'M-f' brings up the 'Find' search bar.
And 'M-b' toggles the ability to show and hide the Explorer window.
How can I adjust this so that Emacs is given the ability to use 'M-f' and 'M-b' normally?
​
Thanks!
jimehgeek · 2022-09-16 03:11
For vterm activation with `M-RET`, changing `"<A-return>"` in your config to `"M-<return>"` should fix it.
As for the various `M-w`, `M-f` and `M-b` keybindings not working and instead triggering VSCode behavior, it sounds like you’re pressing cmd (`s`) rather than option (`M`) on your Mac keyboard.
So I’d a assume your swapping of cmd and option hasn’t worked quite correctly, as the behaviors you’re describing is what happens when you press cmd along with each of those keys. Did you swap cmd and option keys in System Preferences’ Modifier Keys feature, or some other means?
As a side note about lsp-mode, it’s generally pretty damn good and doesn’t need much config in my experience. But it does vary between languages and language servers. I personally have no issues with Go, Ruby, YAML, JSON, and a few more. But with Terraform files it’s very laggy and hardly usable, though I’m inclined to put most of the blame on the language server rather than lsp-mode specifically.
BackToPlebbit69 · 2022-09-16 05:35
I use Karabiner to swap the keys mentioned above. They work like a charm on actual Emacs on MacOS and terminal. Maybe you're right in that VS Code just doesn't care for my actual keybindings in that case. Thanks for the idea to solve one of the problems regarding vterm, will add that to my configuration.
What does your LSP config look like btw? I ask because I have gone through the hassle of trying to set that up so many times but could never get anything that came close to an IDE experience on Emacs on Linux or MacOS. @jimehgeek
FitPandaFu · 2022-09-16 06:15
Don't torture yourself, use a real terminal ;)
BackToPlebbit69 · 2022-09-16 07:33
Yeah but I want my workflow to be in VS Code on MacOS. I don't think iTerm2 is all that great either since it has some awkward keybindings that clash with Emacs and normal Bash style keybindings of most normal Linux terminals. Again this is mostly for a Mac based work computer.
jimehgeek · 2022-09-16 08:48
Double check Karabiner settings. Some stuff will specifically exclude VSCode and other text editors, and have app specific settings you need to apply for VSCode and the like.
[Here](https://github.com/jimeh/.emacs.d/blob/master/modules/lsp/siren-lsp.el) is my config of lsp, it’s admittedly a bad example, cause it’s more verbose than it needs to be, and has some extra code that’s very much due to my own personal quirks.
Mostly though, the important stuff is also using `lsp-ui` along with something that’ll display/complete diagnostics. Personally I use `lsp-consult`.
Then for specific languages, I customize any relevant vars, and call `lsp-deferred` in a hook for the major mode. [Here](https://github.com/jimeh/.emacs.d/blob/06bf89af61413aaf610e7a293306c01e330f3302/modules/languages/siren-ruby.el#L87-L103) Is my setup for Ruby for example. Only important parts there is disabling the multi-root setting, and then adding the hook for ruby-mode.
RJCP · 2022-09-17 12:12
Remove all the keybinds, or just the ones that clash
I’d be very surprised if there were keybind conflicts with bash or zsh because those are the typical use-case for iTerm2 users
vscode’s terminal is great for doing things like git commits or running scripts, but you’re going to run into a world of issues if you push it like you are
iTerm2 is hands down the best terminal app on any platform I’ve ever used, and I wish it existed for Linux and Windows… but if you really hate it then you could always try Kitty/Alacritty
BackToPlebbit69 · 2022-09-18 05:07
I have never been able to get Emacs to be able to use all keybindings successfully in iTerm2. There's a ton of normal people type keybindings like ctrl f for find that just conflict with Emacs from from get go.
RJCP · 2022-09-18 13:08
You can disable or change every and any keybind in iterm2 with a very very minimal amount of effort straight from the preferences menu
chmouelb · 2022-09-20 20:18
kitty works pretty well on OSX btw,
but it seems you are remapping keys on OSX via karabiner so Iit may not work for you