Advertisement
Guest User

init.el

a guest
Oct 21st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 4.91 KB | None | 0 0
  1. (require 'package)
  2. (setq package-enable-at-startup nil)
  3. (add-to-list 'package-archives
  4.          '("melpa" . "https://melpa.org/packages/"))
  5.  
  6. (package-initialize)
  7.  
  8. (unless (package-installed-p 'evil)
  9.   (package-refresh-contents)
  10.   (package-install 'evil))
  11. (require 'evil)
  12. (evil-mode 1)
  13. (unless (package-installed-p 'use-package)
  14.   (package-refresh-contents)
  15.   (package-install 'use-package))
  16. (unless (package-installed-p 'gruvbox-theme)
  17.   (package-refresh-contents)
  18.   (package-install 'use-package))
  19. (unless (package-installed-p 'flymake-python-pyflakes)
  20.   (package-refresh-contents)
  21.   (package-install 'use-package))
  22. (unless (package-installed-p 'auctex)
  23.   (package-refresh-contents)
  24.   (package-install 'use-package))
  25. (unless (package-installed-p 'auctex-latexmk)
  26.   (package-refresh-contents)
  27.   (package-install 'use-package))
  28. (unless (package-installed-p 'company)
  29.   (package-refresh-contents)
  30.   (package-install 'company))
  31. (unless (package-installed-p 'company-jedi)
  32.   (package-refresh-contents)
  33.   (package-install 'company-jedi))
  34. (unless (package-installed-p 'highlight)
  35.   (package-refresh-contents)
  36.   (package-install 'highlight))
  37. (unless (package-installed-p 'flycheck)
  38.   (package-refresh-contents)
  39.   (package-install 'flycheck))
  40.  
  41.  
  42.  
  43. (unless (package-installed-p 'rust-mode)
  44.   (package-refresh-contents)
  45.   (package-install 'rust-mode))
  46. (unless (package-installed-p 'cargo)
  47.   (package-refresh-contents)
  48.   (package-install 'cargo))
  49. (unless (package-installed-p 'lsp-mode)
  50.   (package-refresh-contents)
  51.   (package-install 'lsp-mode))
  52. (unless (package-installed-p 'lsp-rust)
  53.   (package-refresh-contents)
  54.   (package-install 'lsp-rust))
  55.  
  56.  
  57.  
  58. (defalias 'yes-or-no-p 'y-or-n-p)
  59.  
  60. (global-set-key (kbd "<s-return>") 'term)
  61. (setq scroll-conservatively 100)
  62. (setq ring-bell-function 'ignore)
  63.  
  64. (use-package which-key
  65.   :ensure t
  66.   :init
  67.   (which-key-mode))
  68. (use-package ycmd
  69.   :ensure t
  70.   :init)
  71. (use-package flymake-python-pyflakes
  72.   :ensure t
  73.   :init)
  74. (use-package auctex
  75.   :defer t
  76.   :ensure t
  77.   :init)
  78. (use-package auctex-latexmk
  79.   :ensure t
  80.   :init)
  81. (auctex-latexmk-setup)
  82. (use-package company
  83.   :ensure t
  84.   :init)
  85. (use-package company-jedi
  86.   :ensure t
  87.   :init)
  88. (use-package company-lsp
  89.   :ensure t
  90.   :init)
  91. (add-to-list 'company-backends 'company-jedi)
  92. (use-package highlight
  93.   :ensure t
  94.   :init)
  95.  
  96.  
  97. (use-package rust-mode
  98.   :ensure t
  99.   :init
  100.   (setq rust-format-on-save t))
  101. (use-package lsp-mode
  102.   :init)
  103. (use-package lsp-rust
  104.   :after lsp-mode)
  105. (use-package cargo
  106.   :ensure t
  107.   :init)
  108. (with-eval-after-load 'lsp-mode
  109.   (setq lsp-rust-rls-command '("rustup" "run" "nightly" "rls"))
  110.   (require 'lsp-rust))
  111.  
  112. (add-to-list 'load-path "/home/jordan/Documents/lsp-mode")
  113. (require 'lsp-mode)
  114.  
  115. (lsp-define-stdio-client
  116.  ;; This can be a symbol of your choosing. It will be used as a the
  117.  ;; prefix for a dynamically generated function "-enable"; in this
  118.  ;; case: lsp-prog-major-mode-enable
  119.  lsp-prog-major-mode
  120.  "rust"
  121.  ;; This will be used to report a project's root directory to the LSP
  122.  ;; server.
  123.  (lambda () default-directory)
  124.  ;; This is the command to start the LSP server. It may either be a
  125.  ;; string containing the path of the command, or a list wherein the
  126.  ;; car is a string containing the path of the command, and the cdr
  127.  ;; are arguments to that command.
  128.  '("rustup" "run" "nightly" "rls"))
  129.  
  130. ;; Here we'll add the function that was dynamically generated by the
  131. ;; call to lsp-define-stdio-client to the major-mode hook of the
  132. ;; language we want to run it under.
  133. ;;
  134. ;; This function will turn lsp-mode on and call the command given to
  135. ;; start the LSP server.
  136. (add-hook 'prog-major-mode #'lsp-prog-major-mode-enable)
  137. (lsp-define-stdio-client lsp-rust "rust" #'lsp-rust--get-root nil
  138.              :command-fn #'lsp-rust--rls-command
  139.              :initialize #'lsp-rust--initialize-client)
  140.  
  141.  
  142. (require 'company-lsp)
  143. (push 'company-lsp company-backends)
  144.  
  145.  
  146. (require 'lsp-ui)
  147. (add-hook 'lsp-mode-hook 'lsp-ui-mode)
  148. (add-hook 'rust-mode-hook 'flycheck-mode)
  149.  
  150.  
  151. (add-hook 'rust-mode-hook 'cargo-minor-mode)
  152. (setq racer-cmd "/home/jordan/.cargo/bin/racer")
  153. (setq racer-rust-src-path "/home/jordan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src")
  154. ;(add-hook 'rust-mode-hook 'racer-mode)
  155. (add-hook 'rust-mode-hook 'eldoc-mode)
  156. (add-hook 'rust-mode-hook 'company-mode)
  157. (add-hook 'rust-mode-hook 'lsp-mode)
  158. (add-hook 'rust-mode-hook #'lsp-rust-enable)
  159.  
  160.  
  161. (add-hook 'latex-mode-hook 'flyspell-mode)
  162. (add-hook 'after-init-hook 'global-company-mode)
  163.  
  164. (add-hook 'python-mode-hook 'flymake-python-pyflakes-load)
  165. (setq flymake-python-pyflakes-executable "flake8")
  166.  
  167. (setq company-idle-delay 0)
  168. (setq company-minimum-prefix-length 1)
  169. (setq company-selection-wrap-around 1)
  170. (setq completion-show-help 1)
  171. (setq company-tooltip-idle-delay 1)
  172.  
  173.  
  174.  
  175.  
  176.  
  177. (tool-bar-mode -1)
  178. (menu-bar-mode -1)
  179. (scroll-bar-mode -1)
  180. (setq inhibit-startup-message t)
  181. (global-linum-mode t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement