nix-mode
nix-mode copied to clipboard
How to use nix-company.el
I cannot work out how to use the nix-company.el
file. It does not seem to make it into my installation.
.
├── nix-support
│ └── setup-hook
└── share
└── emacs
└── site-lisp
└── elpa
└── nix-mode-20190703.526
├── nix-build.el
├── nix-build.elc
├── nix-drv-mode.el
├── nix-edit.el
├── nix-edit.elc
├── nix.el
├── nix.elc
├── nix-format.el
├── nix-format.elc
├── nix-instantiate.el
├── nix-instantiate.elc
├── nix-log.el
├── nix-log.elc
├── nix-mode-autoloads.el
├── nix-mode.el
├── nix-mode.elc
├── nix-mode-pkg.el
├── nix-prettify-mode.el
├── nix-prettify-mode.elc
├── nix-repl.el
├── nix-repl.elc
├── nix-search.el
├── nix-search.elc
├── nix-shebang.el
├── nix-shebang.elc
├── nix-shell.el
├── nix-shell.elc
├── nix-store.el
└── nix-store.elc
6 directories, 30 files
I currently have nix-mode
installed by
(use-package nix-mode
:mode "\\.nix\\'"
:custom
(nix-indent-function 'nix-indent-line)
)
but company-nix
does not seem to be an available backend
I'm not sure why it is missing from the install.
I think it also may be broken currently. nix repl
was changed since company-nix was originally written. It was originally contributed by @ljli and hopefully we can rework it to support the newer nix repl. Something like this should configure it:
(use-package nix-company
:ensure nil
:commands nix-company
:hook (nix-mode . (lambda ()
(setq-local company-backends '(nix-company))))
)
But you also need to start a nix-repl buffer to work.
I have tried this and get
Cannot open load file: No such file or directory, nix-company
I currently have the configuration
(use-package nix-company
:commands (company-nix)
)
(use-package nix-drv-mode
:mode "\\.drv\\'"
)
(use-package nix-mode
:mode "\\.nix\\'"
:custom
(nix-indent-function 'nix-indent-line)
)
(use-package nix-repl
:commands (nix-repl)
)
(use-package nix-shell
:commands (nix-shell-unpack nix-shell-configure nix-shell-build)
)
(use-package nix-update
)
(use-package nixos-options
:defer t
)
as well as
(use-package company
:config
(progn
(add-hook 'LaTeX-mode
(lambda ()
(set (make-local-variable 'company-backends) '(company-auctex company-dabbrev company-bbdb company-oddmuse company-eclim company-semantic company-xcode company-cmake company-capf company-files (company-dabbrev-code company-gtags company-etags company-keywords)))))
(add-hook 'irony-mode-hook
(lambda ()
(set (make-local-variable 'company-backends) '(company-irony company-dabbrev company-bbdb company-oddmuse company-eclim company-semantic company-xcode company-cmake company-capf company-files (company-dabbrev-code company-gtags company-etags company-keywords)))))
(add-hook 'nix-mode-hook
(lambda ()
(set (make-local-variable 'company-backends) '(company-nixos-options company-nix company-dabbrev company-bbdb company-oddmuse company-eclim company-semantic company-xcode company-cmake company-capf company-files (company-dabbrev-code company-gtags company-etags company-keywords)))))
(global-company-mode 1)
)
:custom
(company-idle-delay 0.100000)
(company-minimum-prefix-length 2)
(company-seletcion-wrap-around t)
:diminish
company-mode
)
This is using nix-mode
obtained with nix
and using emacsWithPackages
Would it be easier if company-nix
was provided as a separate melpa package or would this cause problems with it relying on nix repl
@matthewbauer commented on Aug 31, 2019, 1:09 AM GMT+8:
I'm not sure why it is missing from the install.
The nix-company.el
is excluded in Melpa recipe:
(:exclude "nix-company.el" "nix-mode-mmm.el")))
Why did the nix-company.el
get excluded? Can someone explain this? 😕 Thanks!