Make emacs much more usable as an IDE
Fix C-u in evil Fix 'region theme Add editorconfig, flycheck, company, and lsp-mode
This commit is contained in:
		
							parent
							
								
									4ef985d7e6
								
							
						
					
					
						commit
						2c12aec78d
					
				
					 2 changed files with 70 additions and 1 deletions
				
			
		
							
								
								
									
										56
									
								
								init.el
									
										
									
									
									
								
							
							
						
						
									
										56
									
								
								init.el
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -34,7 +34,7 @@
 | 
			
		|||
      mouse-wheel-follow-mouse +1
 | 
			
		||||
      scroll-step 1) ;; C-n C-p scroll step
 | 
			
		||||
 | 
			
		||||
;;;; Tabs
 | 
			
		||||
;; Tabs
 | 
			
		||||
(setq custom-tab-width 2)
 | 
			
		||||
 | 
			
		||||
(defun disable-tabs ()
 | 
			
		||||
| 
						 | 
				
			
			@ -79,6 +79,11 @@
 | 
			
		|||
;; Rainbow-Mode (show hex strings in color)
 | 
			
		||||
(use-package rainbow-mode)
 | 
			
		||||
 | 
			
		||||
;; Editorconfig support
 | 
			
		||||
(use-package editorconfig
 | 
			
		||||
  :config
 | 
			
		||||
  (editorconfig-mode 1))
 | 
			
		||||
 | 
			
		||||
;; Treesitter
 | 
			
		||||
(use-package tree-sitter
 | 
			
		||||
  :config
 | 
			
		||||
| 
						 | 
				
			
			@ -94,6 +99,7 @@
 | 
			
		|||
;; Evil (Vim Emulation)
 | 
			
		||||
(use-package evil
 | 
			
		||||
  :init
 | 
			
		||||
  (setq evil-want-C-u-scroll t)
 | 
			
		||||
  (setq evil-mode-beyond-eol t)
 | 
			
		||||
  (setq evil-mode-fine-undo t)
 | 
			
		||||
  (setq evil-default-state 'emacs)
 | 
			
		||||
| 
						 | 
				
			
			@ -133,3 +139,51 @@
 | 
			
		|||
    ;; Define jumps with ] and [
 | 
			
		||||
    (funcall define-jumps "c" "class")
 | 
			
		||||
    (funcall define-jumps "f" "function")))
 | 
			
		||||
 | 
			
		||||
;; Explanations for keybindings
 | 
			
		||||
(use-package which-key
 | 
			
		||||
  :config
 | 
			
		||||
  (which-key-mode +1))
 | 
			
		||||
 | 
			
		||||
;; On the fly syntax checking
 | 
			
		||||
(use-package flycheck)
 | 
			
		||||
 | 
			
		||||
;; Completions
 | 
			
		||||
(use-package company
 | 
			
		||||
  :init
 | 
			
		||||
  (setq company-minimum-prefix-length 1)
 | 
			
		||||
  (setq company-idle-delay 0)
 | 
			
		||||
  (setq company-selection-wrap-around t)
 | 
			
		||||
  (setq company-tooltip-align-annotations t)
 | 
			
		||||
  (setq company-tooltip-flip-when-above t)
 | 
			
		||||
  (setq company-tooltip-margin 0)
 | 
			
		||||
  (setq company-show-quick-access 'right)
 | 
			
		||||
  :config
 | 
			
		||||
  (setq company-transformers '(delete-consecutive-dups
 | 
			
		||||
                               company-sort-prefer-same-case-prefix
 | 
			
		||||
                               company-sort-by-backend-importance
 | 
			
		||||
                               company-sort-by-occurrence))
 | 
			
		||||
  (define-key company-active-map (kbd "M-`") #'company-complete-selection)
 | 
			
		||||
  (define-key company-active-map (kbd "M-n") #'company-select-next)
 | 
			
		||||
  (define-key company-active-map (kbd "M-p") #'company-select-previous)
 | 
			
		||||
  (define-key company-active-map (kbd "M-j") #'company-select-next)
 | 
			
		||||
  (define-key company-active-map (kbd "M-k") #'company-select-previous)
 | 
			
		||||
  (global-company-mode +1))
 | 
			
		||||
 | 
			
		||||
;; Lsp
 | 
			
		||||
(use-package lsp-mode
 | 
			
		||||
  :init
 | 
			
		||||
  (setq lsp-headerline-breadcrumb-enable nil)
 | 
			
		||||
  (setq lsp-signature-auto-activate nil)
 | 
			
		||||
  (setq lsp-signature-doc-lines 0)
 | 
			
		||||
  (setq lsp-ui-doc-show-with-cursor t)
 | 
			
		||||
  (setq lsp-ui-doc-position 'top)
 | 
			
		||||
  (setq lsp-ui-doc-delay 0.5)
 | 
			
		||||
  :config
 | 
			
		||||
  (evil-define-key 'normal lsp-mode-map (kbd "SPC l") lsp-command-map)
 | 
			
		||||
  (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
 | 
			
		||||
  (add-hook 'evil-insert-state-entry-hook #'lsp-signature-activate)
 | 
			
		||||
  (add-hook 'evil-insert-state-exit-hook #'lsp-signature-stop))
 | 
			
		||||
(use-package lsp-ui)
 | 
			
		||||
(setq gc-cons-threshold (* 1024 1024 100))
 | 
			
		||||
(setq read-process-output-max (* 1024 1024))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,6 +61,9 @@
 | 
			
		|||
       (variable '("#6ec5b1" nil nil))
 | 
			
		||||
       (string '("#15e04a" nil nil))
 | 
			
		||||
       (type '("#17b343" nil nil))
 | 
			
		||||
 | 
			
		||||
       (lsp-hover-highlight (funcall brighten-first common-bg 0.05))
 | 
			
		||||
       (company-bg (funcall brighten-first common-bg 0.1))
 | 
			
		||||
       ;; Extra colors #1fa345
 | 
			
		||||
       ) 
 | 
			
		||||
  (custom-theme-set-faces
 | 
			
		||||
| 
						 | 
				
			
			@ -72,6 +75,7 @@
 | 
			
		|||
   (funcall face 'mode-line-inactive :bg (funcall darken-first common-bg 0.35) :fg common-fg)
 | 
			
		||||
   (funcall face 'mode-line :bg modeline :fg common-fg)
 | 
			
		||||
   (funcall face 'hl-line :bg (funcall darken-first common-bg 0.15))
 | 
			
		||||
   (funcall face 'region :bg (funcall brighten-first common-bg 0.15))
 | 
			
		||||
   (funcall face 'font-lock-comment-face :fg comment)
 | 
			
		||||
   (funcall face 'font-lock-doc-face :fg doc)
 | 
			
		||||
   (funcall face 'font-lock-keyword-face :fg keyword)
 | 
			
		||||
| 
						 | 
				
			
			@ -80,6 +84,17 @@
 | 
			
		|||
   (funcall face 'font-lock-variable-name-face :fg variable)
 | 
			
		||||
   (funcall face 'font-lock-string-face :fg string)
 | 
			
		||||
   (funcall face 'font-lock-type-face :fg type)
 | 
			
		||||
 | 
			
		||||
   ;; Lsp
 | 
			
		||||
   (funcall face 'lsp-face-highlight-textual :bg lsp-hover-highlight)
 | 
			
		||||
   (funcall face 'lsp-face-highlight-read :bg lsp-hover-highlight)
 | 
			
		||||
   (funcall face 'lsp-face-highlight-write :bg lsp-hover-highlight)
 | 
			
		||||
 | 
			
		||||
   ;; company
 | 
			
		||||
   (funcall face 'company-tooltip :bg company-bg)
 | 
			
		||||
   (funcall face 'company-tooltip-selection :bg (funcall brighten-first company-bg 0.15))
 | 
			
		||||
   (funcall face 'company-scrollbar-fg :bg (funcall brighten-first company-bg 0.3))
 | 
			
		||||
   (funcall face 'company-scrollbar-bg :bg (funcall brighten-first company-bg 0.15))
 | 
			
		||||
   ))
 | 
			
		||||
 | 
			
		||||
(provide-theme 'my-theme)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue