代码拉取完成,页面将自动刷新
(use-package company
:homepage https://github.com/company-mode/company-mode
:ensure t
:custom
(company-idle-delay 0)
(company-minimum-prefix-length 3)
(company-show-numbers t)
:hook(after-init . global-company-mode)
)
(if (display-graphic-p)
(use-package company-posframe
:ensure t
:diminish
:hook (company-mode . company-posframe-mode))
)
需要安装tabnine
M-x company-tabnine-install-binary
(use-package company-tabnine
:ensure t
:config
(progn
(add-to-list 'company-backends #'company-tabnine)
;; workaround for company-transformers
(setq company-tabnine--disable-next-transform nil)
(defun my-company--transform-candidates (func &rest args)
(if (not company-tabnine--disable-next-transform)
(apply func args)
(setq company-tabnine--disable-next-transform nil)
(car args)))
(defun my-company-tabnine (func &rest args)
(when (eq (car args) 'candidates)
(setq company-tabnine--disable-next-transform t))
(apply func args))
(advice-add #'company--transform-candidates :around #'my-company--transform-candidates)
(advice-add #'company-tabnine :around #'my-company-tabnine)
;; ignore deep tabnine message
;; The free version of TabNine is good enough,
;; and below code is recommended that TabNine not always
;; prompt me to purchase a paid version in a large project.
(defadvice company-echo-show (around disable-tabnine-upgrade-message activate)
(let ((company-message-func (ad-get-arg 0)))
(when (and company-message-func
(stringp (funcall company-message-func)))
(unless (string-match "The free version of TabNine only indexes up to" (funcall company-message-func))
ad-do-it))))
))
(use-package yasnippet
:ensure t
:init (yas-global-mode 1)
:hook ((term-mode-hook) . (lambda () (yas-minor-mode -1)))
:config
(setq yas/root-directory '(
(concat custom/emacs-d-root "snippets")
)
)
)
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
(setq lsp-keymap-prefix "C-c l")
(use-package lsp-mode
:ensure t
:hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
;; if you want which-key integration
(lsp-mode . lsp-enable-which-key-integration))
:commands lsp)
;; optionally
(use-package lsp-ui
:ensure t
:commands lsp-ui-mode)
;; if you are ivy user
(use-package lsp-ivy
:ensure t
:commands lsp-ivy-workspace-symbol)
(use-package lsp-treemacs
:ensure t
:commands lsp-treemacs-errors-list)
;; optionally if you want to use debugger
(use-package dap-mode
:ensure t)
;; (use-package dap-LANGUAGE) to load the dap adapter for your language
(use-package ivy-xref
:ensure t
:init
;; xref initialization is different in Emacs 27 - there are two different
;; variables which can be set rather than just one
(when (>= emacs-major-version 27)
(setq xref-show-definitions-function #'ivy-xref-show-defs))
;; Necessary in Emacs <27. In Emacs 27 it will affect all xref-based
;; commands other than xref-find-definitions (e.g. project-find-regexp)
;; as well
(setq xref-show-xrefs-function #'ivy-xref-show-xrefs))
(use-package ccls
:ensure t
:hook ((c-mode c++-mode objc-mode cuda-mode) .
(lambda () (require 'ccls) (lsp)))
:config
(setq ccls-executable "/usr/bin/ccls"))
# 如果没有安装pypi
# > Archlinux
yay -S python-pip
emacs ~/.config/pip/pip.conf
# > 添加内容 更换国内源
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
# > 或
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip config set install.trusted mirrors.aliyun.com
# > 安装lsp
pip install cmake-language-server
## 为了方便更新,此处可以直接使用AUR来安装
yay -S cmake-language-server
# for vue --> vue-language-server
npm install -g vls
# for js/ts
npm install -g typescript-language-server
# for css
npm install -g vscode-css-languageserver-bin
# for html
npm install -g vscode-html-languageserver-bin
# for json
# it will automatically install
# perl language server
# > 先换源
#1. 终端执行 cpan 命令
$ cpan
#2. 增加源:
cpan[1]> o conf urllist push https://mirrors.aliyun.com/CPAN/
cpan[2]> o conf commit
# 还需要手动编辑 ~/.cpan/CPAN/MyConfig.pm 更换源的顺序
# 第一次进入 cpan 选择 sudo,否则无法正常安装
# 仅测试状况,需要重置cpan,直接删除~/.cpan
# 选用
cpan Term::Readline::Perl
cpan Log::Log4perl
# > 后安装lsp
cpan Perl::LanguageServer
## archlinux 可以直接安装 [现在不推荐,会携带许多不必要的包,部分依赖已经过期]
yay -S aur/perl-perl-languageserver-git
Archlinux 可以直接使用 AUR 安装,其他系统参考以下网址:
# Archlinux
yay -S aur/lua-language-server-git
(use-package lua-mode
:ensure t
)
# for bash
npm i -g bash-language-server
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。