LUA and NIX support, company tweaks

This commit is contained in:
Curt Spark 2021-03-14 01:56:48 +00:00
parent a24de4a6cb
commit f001cb47cb
1 changed files with 37 additions and 4 deletions

View File

@ -340,6 +340,7 @@ it.
Install the package, enable it and ensure that it always is installed: Install the package, enable it and ensure that it always is installed:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package pdf-tools (use-package pdf-tools
:ensure t
:hook (pdf-tools-enabled . pdf-view-midnight-minor-mode) :hook (pdf-tools-enabled . pdf-view-midnight-minor-mode)
;;:hook (pdf-tools-enabled . hide-mode-line-mode) ;;:hook (pdf-tools-enabled . hide-mode-line-mode)
:init :init
@ -524,6 +525,18 @@ Install the package, enable it and ensure that it always is installed, and then
; Wrap around when suggestions reach bottom. ; Wrap around when suggestions reach bottom.
(setq company-selection-wrap-around t) (setq company-selection-wrap-around t)
(dolist (key '("<return>" "RET"))
;; Here we are using an advanced feature of define-key that lets
;; us pass an "extended menu item" instead of an interactive
;; function. Doing this allows RET to regain its usual
;; functionality when the user has not explicitly interacted with
;; Company.
(define-key company-active-map (kbd key)
`(menu-item nil company-complete
:filter ,(lambda (cmd)
(when (company-explicit-action-p)
cmd)))))
; Use tab key to cycle through suggestions. ; Use tab key to cycle through suggestions.
; ('tng' means 'tab and go') ; ('tng' means 'tab and go')
(company-tng-configure-default) (company-tng-configure-default)
@ -593,6 +606,23 @@ Install the package, enable it and ensure that it always is installed, and then
:init :init
(elcord-mode 1)) (elcord-mode 1))
#+END_SRC #+END_SRC
** Nix Mode
An Emacs major mode for editing Nix expressions. There is also a manual available at nix-mode.org.
#+BEGIN_SRC emacs-lisp
(use-package nix-mode
:ensure t
:mode "\\.nix\\'")
#+END_SRC
** LUA Mode
lua-mode is a major mode for editing Lua sources in Emacs.
#+BEGIN_SRC emacs-lisp
(use-package lua-mode
:ensure t)
#+END_SRC
** LSP Mode ** LSP Mode
LSP mode will give you IDE capabilities in Emacs, using Microsoft's LSP mode will give you IDE capabilities in Emacs, using Microsoft's
Universal Language Server Protocol. The same one that VSCode uses for Universal Language Server Protocol. The same one that VSCode uses for
@ -619,14 +649,17 @@ on how to install the Programming Language Servers that you want.
*** Configuration *** Configuration
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; optionally ;; optionally
(use-package lsp-ui :commands lsp-ui-mode (use-package lsp-ui
:ensure t) :commands lsp-ui-mode
(use-package company-lsp :commands company-lsp
:ensure t) :ensure t)
;; (use-package company-lsp
;; :commands company-lsp
;; :ensure t)
;; if you are helm user ;; if you are helm user
;;(use-package helm-lsp :commands helm-lsp-workspace-symbol) ;;(use-package helm-lsp :commands helm-lsp-workspace-symbol)
;; if you are ivy user ;; if you are ivy user
(use-package lsp-ivy :commands lsp-ivy-workspace-symbol (use-package lsp-ivy
:commands lsp-ivy-workspace-symbol
:ensure t) :ensure t)
;;(use-package lsp-treemacs :commands lsp-treemacs-errors-list ;;(use-package lsp-treemacs :commands lsp-treemacs-errors-list
;; :ensure t) ;; :ensure t)