Thank you for this video. I use elpy package which unfortunately isn't maintained/updated anymore. However it has autopep8 which automatically formats Python code to conform to the PEP 8 style guide. Does the package you suggest do the same based on PEP 8?
Around 13:51 I set up a keybinding for eglot-format, which uses the LSP to format the buffer. I'm not that familiar with the different formatting styles for python, but I see on the python-lsp-server github page that pylsp.plugins.autopep8.enable is enabled by default, so I think the short answer is yes! Here's the link if you need more information: github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
I'm not totally sure what you mean, but a few things you will need are: 1. company-mode active in python-mode (or python-ts-mode if you're following the video; I usually check this with C-h m) 2. A company backend that provides completions (I think eglot or lsp-mode should provide this automatically) 3. An LSP server for eglot or lsp-mode to connect to For point 1, it looks like I add a hook to python-ts-mode to activate company-mode at 5:28, and I install pylsp around 4:37 for point 3. Like I said, I think either of the main LSP packages will handle point 2 for you, but I used to have to mess with the company-backends variable before LSP servers were common. I hope this helps!
@bwestbro You were not able navigate up and down in the company-mode popup @6:36 . What was the reason for that? What did u do instead to get that gray, inline completion proposal?
I'm just not used to the default company-mode bindings! I think in my main config with evil-mode, I use C-n and C-p or Tab to navigate the completions, but the default bindings are M-n/M-p to navigate and Ret to accept. I'm actually not sure what I hit to accept that, but it might have been Tab to fill company's only suggestion, or I might have hit M-/, which is dabbrev-expand. It's a pretty handy binding to keep in mind for situations where you just want to complete a word in the current or other buffer without something like company-mode active.
Hello Brent, one thing that has kept me using neovim is the autocompletion. I wanted to configure company to show me lsp suggestions then followed by buffer suggestions ( words inside all the opened buffers). Couldn't get this kinda company setup
I think you can achieve this by modifying the company-backends variable. I think I've only ever used one at a time, but the documentation mentions "grouped" backends where the results from each one are merged together. If you could group the LSP and buffer suggestions, that should give you what you want! It also mentions a :separate keyword argument that will keep the two sets separate if that's what you want too. I was looking at the docs inside of Emacs, but this page also looks helpful: company-mode.github.io/manual/Backends.html
The last thing that keeps me stuck on nvim is that I still haven't found any working recipe for configuring tree-sitter support in multi-mode like vue-mode or svelte (web-mode/mmm-mode). Anyway, great video!
Oh that's a great question, I haven't looked into multi-mode stuff before! From a quick search, the mmm-mode repo suggests something like (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php) for adding php support to html-mode. Can you do something like this? (mmm-add-mode-ext-class 'html-ts-mode ...) Like I said, I haven't tried mmm-mode, and you might have already tried this, but I wanted to throw it out there. Thanks for the kind words!
This is really cool. I am doing something very wrong and do not seem to truly get any functionality out of eglot even though it proudly expresses in the mini buffer that it's connected to the LSP. Could you please paste your working config or the relevant Python Treesitter/Company sections of it somewhere online so I can inspect what I'm doing wrong? Thank you!
Great idea! I just put the whole config in this gist: gist.github.com/ntBre/a6e1f7933314c77eceef49cd844b5413 Hope it helps, let me know if you have any more questions.
Hi, I am new to emacs and I learn a lot from your videos. One question: when I compile a python file the compile buffer opens horizontally and not vertically as in your videos. How can I change that? Thank you very much!
I think Emacs tries to pick the "best" split for the current size of your frame, but I found the link below suggesting either (setq split-width-threshold nil) to prioritize a vertical split or (setq split-width-threshold 1) for a horizontal split. I always get vertical and horizontal mixed up, so I recommend trying both of those if making your frame larger doesn't fix it! stackoverflow.com/a/7998271/12935407
Of course I know about VSCode and have tried using it in the past. I vastly prefer Emacs for all of the other configuration options it gives me and the integration between different parts of my workflow. One of the points of these videos is to give other people, who may not want to spend 20 minutes setting up their editor, a config to paste in and be started in "1 minutes" just like VSCode.