reddit / emacs

Trying to emulate on company Vim behaviour

sicr0 · 2022-07-19 12:18
Hi, I'm making the switch from **Neovim** to **Emacs** for **Clojure** development. For the completion I'm used to `<Tab>` and `<S-Tab>` for cycling through suggestions, and the suggestions would be automatically placed in the buffer when selected so that `<Enter>` would only behave as a newline. This is what I got for now: ```elisp (use-package company :init (add-hook 'after-init-hook 'global-company-mode) :config (global-company-mode t) (setq company-minimum-prefix-length 1) (setq company-idle-delay 0.0) :bind (:map company-active-map ("TAB" . company-select-next) ("<backtab>" . company-select-previous) ("RET" . nil))) ``` Issues: 1. Now I don't have a way to autocomplete since when I select suggestions they don't get placed in the buffer 2. Placing `S-TAB` instead of `<backtab>` in the `:bind` section doesn't work 3. If I tap `<S-Tab>`, then pressing `<Enter>` becomes unresponsive Thanks! Any help is appreciated. :D (Also if you see some bad practice tell me please) EDIT: did I do something wrong? I see a 50% of downvoting rate
deaddyfreddy · 2022-07-19 13:03
> :init (add-hook 'after-init-hook 'global-company-mode) there's `:hook` keyword > setq some people prefer using `:custom` keyword instead also, to be sure the snippet works everywhere it's better to set `:ensure t`
yyoncho · 2022-07-19 13:06
FWIW there is company-tng
mauguro_ · 2022-07-19 14:45
what is that for?
yyoncho · 2022-07-19 15:23
https://github.com/company-mode/company-mode/blob/master/company-tng.el#L23
sicr0 · 2022-07-19 16:56
Thanks! I also have this line on `init.el` that I think handles that ```elisp (setq use-package-always-ensure 't) ``` Anyway nice tips. Thanks for helping :)
sicr0 · 2022-07-19 16:57
Thanks! I didn't know that. It's what I was looking for :D
Gallipo · 2022-07-19 17:06
Take a look a the customisation variables `company-insertion-on-trigger` and `company-insertion-triggers` [https://company-mode.github.io/manual/Customization.html#Customization](https://company-mode.github.io/manual/Customization.html#Customization) I didn't try it, but it seems helpful.