Тёмный

Python Configuration for Emacs 29 

Brent Westbrook
Подписаться 1,8 тыс.
Просмотров 8 тыс.
50% 1

Опубликовано:

 

11 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 30   
@deedend
@deedend 2 месяца назад
This video is really what I was looking for... Thank you very much!!
@VorpalForceField
@VorpalForceField 24 дня назад
Cool Deal .. Thank You for sharing .. Cheers :)
@DangerSepp
@DangerSepp Год назад
Highly appreciated, thank you!
@myyouaccounttube1024
@myyouaccounttube1024 9 месяцев назад
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?
@bwestbro
@bwestbro 9 месяцев назад
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
@vivaneret1249
@vivaneret1249 Год назад
Excellent!
@dpassen1
@dpassen1 Год назад
You should be able to use `eglot-managed-mode-hook` to turn on company
@bwestbro
@bwestbro Год назад
Ahhh, thank you! I looked in the docs, but only noticed `eglot-connect-hook`. I'll give this a try!
@batuurdor
@batuurdor 4 месяца назад
Hey brent, how did you get your company work out-of-box with python ?
@bwestbro
@bwestbro 4 месяца назад
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!
@0netom
@0netom Год назад
@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?
@bwestbro
@bwestbro Год назад
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.
@shubhampawar7921
@shubhampawar7921 8 месяцев назад
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
@bwestbro
@bwestbro 8 месяцев назад
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
@PE4ENAROBOTV
@PE4ENAROBOTV 11 месяцев назад
thanks a lot
@angry-penguin
@angry-penguin Год назад
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!
@bwestbro
@bwestbro Год назад
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!
@HarishNarayanan
@HarishNarayanan 11 месяцев назад
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!
@bwestbro
@bwestbro 11 месяцев назад
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.
@HarishNarayanan
@HarishNarayanan 11 месяцев назад
@@bwestbroThank you so much, I will try it out and let you know.
@vivaneret1249
@vivaneret1249 11 месяцев назад
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!
@bwestbro
@bwestbro 11 месяцев назад
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
@vivaneret1249
@vivaneret1249 11 месяцев назад
@@bwestbro Thanks! I will try both!
@vivaneret1249
@vivaneret1249 11 месяцев назад
@@bwestbroI used (setq split-width-threshold 1 ) and it works perfect, the buffer looks like in your videos. Thank you!
@rikhardfsoss
@rikhardfsoss Год назад
what happen to the sound, is sooooooooooooooo low.
@bwestbro
@bwestbro Год назад
Oh no! The whole video or specific parts? I just clicked through, and it sounded okay for me :(
@rikhardfsoss
@rikhardfsoss Год назад
@@bwestbro well at least for me it's the entire video, it's audible, but compared to other videos is quite low.
@bwestbro
@bwestbro Год назад
Thanks for the feedback, I'll try to increase the volume in future videos!
@cycomkid
@cycomkid Год назад
Bro just use vscode, everything that you did in 2 videos, can be done in vscode in 1 minutes
@bwestbro
@bwestbro Год назад
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.
Далее
Emacs 29 released!
12:29
Просмотров 10 тыс.
Every LLM in Emacs, with gptel
17:56
Просмотров 11 тыс.
Что думаете?
00:54
Просмотров 790 тыс.
Emacs IDE - Python Development Configuration
1:05:50
Просмотров 56 тыс.
My Python Emacs Workflow
19:07
Просмотров 3,8 тыс.
Learn Emacs Lisp in 30 Minutes
30:22
Просмотров 9 тыс.
Why I Prefer Emacs Over VSCode and vim
8:23
Просмотров 119 тыс.
Emacs: ediff basics
15:49
Просмотров 6 тыс.