Update to use lsp and consolidate everything to one file

This commit is contained in:
Grant Hunter 2020-01-02 10:07:22 -07:00
parent f83634dce0
commit 00fdc7f7ff
6 changed files with 249 additions and 68 deletions

4
emacs.d/.gitignore vendored
View File

@ -3,3 +3,7 @@ eshell/
semanticdb/ semanticdb/
transient/ transient/
recentf recentf
.cache/
.lsp-session-v1
auto-save-list/
.mc-lists.el

View File

@ -65,3 +65,6 @@
;;add path ;;add path
(add-to-list 'exec-path "/usr/local/bin") (add-to-list 'exec-path "/usr/local/bin")
(add-to-list 'exec-path "~/.local/bin") (add-to-list 'exec-path "~/.local/bin")
`

View File

@ -3,41 +3,222 @@
;; - All of the configuration is within `configuration.org` ;; - All of the configuration is within `configuration.org`
;;; Code: ;;; Code:
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize) (package-initialize)
;; This loads the actual configuration in literate org-mode elisp (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
(defun load-config() ("melpa" . "https://melpa.org/packages/")))
(load-file "~/.emacs.d/default.el") ;; This is only needed once, near the top of the file
(load-file "~/.emacs.d/packages.el") (eval-when-compile
(load-file "~/.emacs.d/custom.el") (require 'use-package))
(load-file "~/.emacs.d/keyboard-bindings.el")
(load-file "~/.emacs.d/autocomplete.el") (use-package yasnippet
(load-file "~/.emacs.d/python.el") :ensure t)
(load-file "~/.emacs.d/rust.el")
;; (load-file "~/.emacs.d/lisp.el") (use-package lsp-mode
:ensure t
:hook (js-mode . lsp-deffered)
:hook (python-mode . lsp-deferred)
:hook (rust-mode . lsp-deferred)
:commands lsp)
(use-package lsp-ui
:ensure t
:commands lsp-ui-mode)
(use-package company-lsp
:ensure t
:commands company-lsp
:hook (after-init-hook . global-flycheck-mode)
:init
(setq company-dabbrev-downcase nil)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 1)
(global-company-mode)
)
(use-package helm-lsp
:ensure t
:commands helm-lsp-workspace-symbol
:bind(("M-x" . helm-M-x)
("C-x b" . helm-mini)
("C-x C-b" . helm-buffers-list)
("C-x C-f" . helm-find-files)
("C-x C-r" . helm-recentf)
("M-y" . helm-show-kill-ring))
:config
(helm-autoresize-mode 1)
)
(use-package lsp-treemacs
:ensure t
:commands lsp-treemacs
:bind (("C-/" . treemacs)))
(use-package semantic
:ensure t
:config
(semantic-mode 1)
(global-semantic-stickyfunc-mode 1)
) )
;; (use-package helm-lsp
;; :ensure t
;; :init
;; (setq helm-split-window-in-side-p t)
;; (setq-default indent-tabs-mode nil)
;; (setq helm-grep-ag-command "rg --color=always --colors 'match:fg:black' --colors 'match:bg:yellow' --smart-case --no-heading --line-number %s %s %s")
;; (setq helm-grep-ag-pipe-cmd-switches '("--colors 'match:fg:black'" "--colors 'match:bg:yellow'"))
;; :config
;; (helm-mode 1)
;; (helm-autoresize-mode 1)
;; :bind(("M-x" . helm-M-x)
;; ("C-x b" . helm-mini)
;; ("C-x C-b" . helm-buffers-list)
;; ("C-x C-f" . helm-find-files)
;; ("C-x C-r" . helm-recentf))
;; )
(use-package material-theme
:ensure t)
(use-package multiple-cursors
:ensure t
:bind(
("C-}" . mc/mark-next-like-this)
("C-{" . mc/mark-previous-like-this)
("C-|" . mc/mark-all-like-this)
))
(load-config)
(use-package powerline
:ensure t)
(use-package projectile
:ensure t)
(use-package flycheck
:ensure t)
(use-package rainbow-delimiters
:ensure t)
(use-package magit
:ensure t
:bind (("C-c m" . magit-status)))
(use-package toml-mode
:ensure t)
(use-package rust-mode
:ensure t)
(use-package terraform-mode
:ensure t)
(use-package company-terraform
:ensure t)
(use-package jinja2-mode
:ensure t)
(use-package json-mode
:ensure t)
(use-package yaml-mode
:ensure t)
(require 'uniquify)
(setq inhibit-splash-screen t)
(setq inhibit-startup-message t)
(setq frame-title-format "%F %b ")
(setq uniquify-buffer-name-style 'forward)
(show-paren-mode)
(defun disable-menu-bar (&optional frame)
(interactive)
(when window-system
(set-frame-size frame 100 30)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
))
(add-hook 'after-make-frame-functions 'disable-menu-bar)
(global-auto-revert-mode t)
(global-linum-mode)
(global-whitespace-mode)
(put 'narrow-to-region 'disabled nil)
(put 'dired-find-alternate-file 'disabled nil)
(setq gc-cons-threshold 20000000)
(setq make-backup-files nil)
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
(setq vc-follow-symlinks t)
(setq confirm-kill-emacs 'y-or-n-p)
(setq ring-bell-function 'ignore)
(setq lazy-highlight-cleanup nil)
(setq whitespace-line-column 500)
(setq-default indent-tabs-mode
nil)
(fset 'yes-or-no-p 'y-or-n-p)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
(load-theme 'material t)))
(load-theme 'material t))
(add-hook 'eww-mode-hook 'scroll-lock-mode)
;;cleanup buffers
(setq clean-buffer-list-delay-special 900)
(defvar clean-buffer-list-timer nil)
(setq clean-buffer-list-timer (run-at-time t 7200 'clean-buffer-list))
;; kill everything, clean-buffer-list is very intelligent at not killing
;; unsaved buffer.
(setq clean-buffer-list-kill-regexps '("^.*$"))
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
;;Enable powerline
(powerline-center-theme)
(setq powerline-default-separator 'slant)
;keybindings
(global-set-key (kbd "C--") 'undo)
(global-set-key (kbd "C-x p") 'previous-multiframe-window)
;;; init.el ends here ;;; init.el ends here
(custom-set-variables (custom-set-variables
;; custom-set-variables was added by Custom. ;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(elpy-rpc-python-command "/c/docker_data/docker_python.sh")
'(flycheck-checker-error-threshold 100000)
'(package-selected-packages '(package-selected-packages
(quote (quote
(js-format elpy csv-mode markdown-mode helm-rg dumb-jump writegood-mode crux rainbow-delimiters powerline py-autopep8 csharp-mode toml-mode importmagic exec-path-from-shell flycheck helm-projectile projectile company racer company-terraform terraform-mode json-mode jinja2-mode yaml-mode rust-mode magit material-theme neotree multiple-cursors helm))) (yasnippet lsp-treemacs lsp-ui uniquify lsp-helm lsp-company yaml-mode use-package toml-mode rust-mode rainbow-delimiters projectile powerline neotree multiple-cursors material-theme magit lsp-mode json-mode jinja2-mode gnu-elpa-keyring-update flycheck company-terraform))))
'(projectile-mode t nil (projectile)))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(default ((t (:height 120))))) )
(put 'upcase-region 'disabled nil) (put 'upcase-region 'disabled nil)

View File

@ -2,42 +2,42 @@
;;; Commentary: ;;; Commentary:
;;; Code: ;;; Code:
(require 'package)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
("marmalade" . "https://marmalade-repo.org/packages/") ;; This is only needed once, near the top of the file
("melpa" . "https://melpa.org/packages/"))) (eval-when-compile
(defvar my-packages '( (require 'use-package))
company
company-terraform (use-package lsp-mode
crux :config
dumb-jump (add-hook 'js-mode-hook #'lsp)
elpy (add-hook 'python-mode-hook #'lsp)
exec-path-from-shell (add-hook 'rust-mode-hook #'lsp))
flycheck
helm-projectile (use-package lsp-company)
importmagic (use-package lsp-helm)
jinja2-mode (use-package material-theme)
json-mode (use-package multiple-cursors)
magit (use-package neotree)
material-theme (use-package powerline)
multiple-cursors (use-package projectile)
neotree (use-package flycheck)
powerline (use-package rainbow-delimiters)
projectile (use-package magit)
racer
rainbow-delimiters
rust-mode
terraform-mode
toml-mode (use-package toml-mode)
writegood-mode (use-package rust-mode)
yaml-mode (use-package terraform-mode)
helm (use-package company-terraform)
)) (use-package jinja2-mode)
(use-package json-mode)
(use-package yaml-mode)
(dolist (p my-packages)
(unless (package-installed-p p)
(package-refresh-contents)
(package-install p))
(add-to-list 'package-selected-packages p))
;;; packages.el ends here ;;; packages.el ends here

View File

@ -1,7 +0,0 @@
(elpy-enable)
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
(add-hook 'python-mode-hook 'importmagic-mode)

12
zshrc
View File

@ -79,12 +79,12 @@ source $ZSH/oh-my-zsh.sh
# You may need to manually set your language environment # You may need to manually set your language environment
# export LANG=en_US.UTF-8 # export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim' export EDITOR='emacs'
# else else
# export EDITOR='mvim' export EDITOR='emacs'
# fi fi
# Compilation flags # Compilation flags
# export ARCHFLAGS="-arch x86_64" # export ARCHFLAGS="-arch x86_64"