alex / emacs-config / 90d4f4e vs. 8576856

Compare Hashes

HUNK
;;; init.el --- Initialization file for Emacs ;;; Commentary: ;; Emacs Startup File --- initialization for Emacs ;;; Code: (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/")) (package-initialize)
HUNK
(package-refresh-contents) (package-install 'use-package)) ;; Line numbers in modern emacs (when (version<= "26.0.50" emacs-version ) ;;; All Buffers ;; Show line numbers (when (version<= "26.0.50" emacs-version) (global-display-line-numbers-mode)) ;; powerline status bar
HUNK
:config (powerline-default-theme)) ;; evil mode for vim emulation ;; evil for vim emulation (use-package evil :ensure t :init (setq evil-want-integration nil) ;; required by evil-collection (setq evil-search-module 'evil-search) (setq evil-ex-complete-emacs-commands nil) (setq evil-vsplit-window-right t) ;; like vim's 'splitright' (setq evil-split-window-below t) ;; like vim's 'splitbelow' (setq evil-shift-round nil) (setq evil-want-C-u-scroll t) :config (evil-mode)) ;; lsp Language Server Interface Mode (use-package lsp-mode :ensure t) ;; flycheck for syntax checking (error squigglies) (use-package flycheck :ensure t :hook ((after-init . global-flycheck-mode))) ;; Company mode for autocomplete ;; company for autocomplete (use-package company :ensure t :config (add-hook 'after-init-hook 'global-company-mode)) :hook ((after-init . global-company-mode))) ;; yasnippet templating for autocomplete in company-mode (use-package yasnippet :ensure t :config (yas-global-mode 1)) ;;; GraphQL Editor (use-package graphql-mode :ensure t) (use-package company-quickhelp ;;; Typescript IDE ;; Add node_modules to PATH (use-package add-node-modules-path :ensure t :config (company-quickhelp-mode)) :hook ((typescript-mode . add-node-modules-path))) ; bind company-select-next to tab (eval-after-load 'company '(progn (define-key company-active-map (kbd "TAB") 'company-select-next) (define-key company-active-map [tab] 'company-select-next))) ;; (setq company-selection t) <-- this doesn't make sense -- Dmitry (setq company-idle-delay 0) (use-package flycheck ;; typescript-mode for typescript (use-package typescript-mode :ensure t :after (flycheck) :config (flycheck-add-mode 'javascript-eslint 'web-mode) ;; use eslint for jsx files (add-hook 'after-init-hook #'global-flycheck-mode)) ;; enable in all buffers (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode)) ) ;; Javascript IDE (use-package web-mode ;; tide for typescript (use-package tide :ensure t :after (typescript-mode company flycheck) :hook ((typescript-mode . tide-setup) (typescript-mode . tide-hl-identifier-mode) (before-save . tide-format-before-save)) :config (add-hook 'web-mode-hook 'lsp-deferred) ;; use lsp when in web-mode (add-to-list 'auto-mode-alist '("\\.jsx?$" . web-mode))) ;; auto-enable for js/jsx files (flycheck-add-next-checker 'typescript-tide 'javascript-eslint) ) (use-package prettier-js :ensure t :config (add-hook 'web-mode-hook 'prettier-js-mode)) ;; Backup files in separate directory (setq backup-by-copying t ; don't clobber symlinks backup-directory-alist '(("." . "~/.emacs/backups/")) ; don't litter my fs tree delete-old-versions t kept-new-versions 6 kept-old-versions 2 version-control t) ; use versioned backups (use-package add-node-modules-path ;; Fill Column Indicator (use-package fill-column-indicator :ensure t :after (typescript-mode) :hook ((typescript-mode . fci-mode)) :config (add-hook 'flycheck-mode-hook 'add-node-modules-path)) ;; use eslint from node_modules (setq fci-rule-width 1) (setq fci-rule-column 100) ) (defun web-mode-init-hook () "Hooks for Web mode. Adjust indent." (setq web-mode-markup-indent-offset 2)) (add-hook 'web-mode-hook 'web-mode-init-hook) ;; JSX syntax highlighting (setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))) ;; Golang IDE (use-package go-mode :ensure t :hook (flycheck-add-next-checker 'lsp-ui 'golangci-lint) :config (setq gofmt-command "goimports") ;; use goimports instead of gofmt (add-hook 'before-save-hook 'gofmt-before-save) (add-hook 'go-mode-hook 'lsp-deferred) ;; Use go-mode when loading a file with extension .go (add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode))) (use-package flycheck-golangci-lint :ensure t :hook (go-mode . flycheck-golangci-lint-setup) :config (setq flycheck-golangci-lint-enable-all t)) (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. '(company-selection-wrap-around t) '(custom-enabled-themes '(wombat)) '(inhibit-startup-screen t) '(package-selected-packages '(yaml-mode coverlay cov go-mode yasnippet which-key web-mode use-package prettier-js powerline neotree lsp-ui flycheck evil dumb-jump company add-node-modules-path))) '(package-selected-packages '(typescript-mode tide company evil powerline use-package)) '(warning-suppress-log-types '((comp)))) (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. ) (provide 'init) ;;; init.el ends here