Skip to content

Instantly share code, notes, and snippets.

@mauriciocm9
Last active September 23, 2020 01:09
Show Gist options
  • Save mauriciocm9/13e8b2d967847590ece6a803b5a6743f to your computer and use it in GitHub Desktop.
Save mauriciocm9/13e8b2d967847590ece6a803b5a6743f to your computer and use it in GitHub Desktop.
init.el
(package-initialize)
(add-to-list 'package-archives
'("melpa-stable" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(load-theme 'monokai t)
(set-default-font "Hack 11")
(setq inhibit-startup-message t)
(setq-default frame-title-format "This is not VIM")
(desktop-save-mode 1)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(setq ring-bell-function 'ignore)
(line-number-mode -1)
;; create the autosave dir if necessary, since emacs won't.
(make-directory "~/.emacs.d/autosaves/" t)
(setq backup-directory-alist
`(("." . ,(concat user-emacs-directory "~/.emacs.d/autosaves/"))))
(when (version<= "26.0.50" emacs-version )
(global-display-line-numbers-mode))
;; Autocomplete
;; (ac-config-default)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(require 'neotree)
(add-hook 'neo-after-create-hook
(lambda (&rest _) (display-line-numbers-mode -1)))
(setq neo-theme 'ascii)
(setq neo-smart-open t)
(neotree-show)
(require 'multiple-cursors)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;; Magit
(global-set-key (kbd "C-x g") 'magit-status)
;; Projectile
(require 'projectile)
(projectile-mode +1)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
;; Automatically change buffers when files have changed on disk
(global-auto-revert-mode t)
;; Elpy
(elpy-enable)
(setq elpy-rpc-python-command "python3")
(setq python-shell-completion-native-enable nil)
;; JSON
(add-hook 'json-mode-hook
(lambda ()
(make-local-variable 'js-indent-level)
(setq js-indent-level 4)))
;; Javascript
(setq-default indent-tabs-mode t)
(setq js-indent-level 4)
(add-to-list 'auto-mode-alist '("components\\/.*\\.js\\'" . rjsx-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
;; Web-mode
(setq web-mode-markup-indent-offset 2)
;; Yaml
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
;; C++
(setq c-default-style "k&r"
c-basic-offset 4)
;; GoMode
(setq gofmt-command "goimports")
(defun gomode-install-save-hooks ()
(add-hook 'before-save-hook #'gofmt-before-save))
(add-hook 'go-mode-hook #'gomode-install-save-hooks)
;; Flycheck
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
;; Gopls
;; (use-package lsp-mode
;; :ensure t
;; :commands (lsp lsp-deferred)
;; :hook (go-mode . lsp-deferred))
;; Set up before-save hooks to format buffer and add/delete imports.
;; Make sure you don't have other gofmt/goimports hooks enabled.
;; (defun lsp-go-install-save-hooks ()
;; (add-hook 'before-save-hook #'lsp-format-buffer t t)
;; (add-hook 'before-save-hook #'lsp-organize-imports t t))
;; (add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
;; Optional - provides fancier overlays.
(use-package lsp-ui
:ensure t
:commands lsp-ui-mode)
;; Company mode is a standard completion package that works well with lsp-mode.
(use-package company
:ensure t
:config
;; Optionally enable completion-as-you-type behavior.
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 1))
;; company-lsp integrates company mode completion with lsp-mode.
;; completion-at-point also works out of the box but doesn't support snippets.
(use-package company-lsp
:ensure t
:commands company-lsp)
;; Optional - provides snippet support.
(use-package yasnippet
:ensure t
:commands yas-minor-mode
:hook (go-mode . yas-minor-mode))
(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.
)
(put 'downcase-region 'disabled nil)
(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.
'(custom-safe-themes
(quote
("5f27195e3f4b85ac50c1e2fac080f0dd6535440891c54fcfa62cdcefedf56b1b" default)))
'(package-selected-packages
(quote
(terraform-mode flycheck lsp-ui use-package spinner cmake-mode cmake-ide lsp-mode yaml-mode web-mode rjsx-mode projectile org-plus-contrib neotree multiple-cursors monokai-theme gotham-theme go-mode elpy)))
'(send-mail-function (quote mailclient-send-it)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment