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

6
emacs.d/.gitignore vendored
View File

@ -2,4 +2,8 @@ elpa/
eshell/
semanticdb/
transient/
recentf
recentf
.cache/
.lsp-session-v1
auto-save-list/
.mc-lists.el

View File

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

View File

@ -3,41 +3,222 @@
;; - All of the configuration is within `configuration.org`
;;; 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)
;; This loads the actual configuration in literate org-mode elisp
(defun load-config()
(load-file "~/.emacs.d/default.el")
(load-file "~/.emacs.d/packages.el")
(load-file "~/.emacs.d/custom.el")
(load-file "~/.emacs.d/keyboard-bindings.el")
(load-file "~/.emacs.d/autocomplete.el")
(load-file "~/.emacs.d/python.el")
(load-file "~/.emacs.d/rust.el")
;; (load-file "~/.emacs.d/lisp.el")
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
;; This is only needed once, near the top of the file
(eval-when-compile
(require 'use-package))
(use-package yasnippet
:ensure t)
(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
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; 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
(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)))
'(projectile-mode t nil (projectile)))
(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))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:height 120)))))
)
(put 'upcase-region 'disabled nil)

View File

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

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
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='emacs'
else
export EDITOR='emacs'
fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"