Skip to content

Instantly share code, notes, and snippets.

@leotada
Last active November 23, 2021 18:53
Show Gist options
  • Save leotada/92a392da4fe0eb735ba551d4511bc394 to your computer and use it in GitHub Desktop.
Save leotada/92a392da4fe0eb735ba551d4511bc394 to your computer and use it in GitHub Desktop.
Emacs config file
;; Melpa
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
;; backup in one place. flat, no tree structure
(setq backup-directory-alist '(("" . "~/.emacs.d/backup")))
;; Display lines number
(global-display-line-numbers-mode)
;; Neotree
(require 'all-the-icons) ;; icons
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
(add-to-list 'load-path "~/Projetos")
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
(neotree-hide)
;; Disable line-numbers minor mode for neotree
(add-hook 'neo-after-create-hook
(lambda (&rest _) (display-line-numbers-mode -1)))
;; Elpy
(elpy-enable)
;; M-. (elpy-goto-definition)
;; Theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'spacemacs-dark t)
;; Configuration
(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.
'(column-number-mode t)
'(delete-selection-mode t)
'(global-display-line-numbers-mode t)
'(inhibit-startup-screen t)
'(package-selected-packages
'(markdown-preview-mode meson-mode yaml-mode dockerfile-mode fzf rubocopfmt robe auto-highlight-symbol flycheck rubocop rspec-mode gdscript-mode vue-mode company omnisharp d-mode csproj-mode csharp-mode flycheck-mypy all-the-icons elpy spacemacs-theme neotree))
'(show-paren-mode t)
'(xterm-mouse-mode t))
(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.
)
;; remove trailing spaces on save
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; pure custom keybinds
(global-set-key (kbd "C-<tab>") 'other-window)
(global-set-key (kbd "C-S-k") 'kill-whole-line)
;; omnisharp
(add-hook 'csharp-mode-hook 'omnisharp-mode)
;;(add-hook 'csharp-mode-hook 'omnisharp-start-omnisharp-server)
(eval-after-load
'company
'(add-to-list 'company-backends 'company-omnisharp))
(add-hook 'csharp-mode-hook #'company-mode)
;; c# flycheck
;;(add-hook 'csharp-mode-hook #'flycheck-mode)
;; D mode config
(defun my-d-mode-setup ()
(setq indent-tabs-mode nil)
(setq c-syntactic-indentation t)
(c-set-style "linux")
(setq c-basic-offset 4)
(setq truncate-lines t)
(setq tab-width 4)
(setq evil-shift-width 4))
(add-hook 'd-mode-hook 'my-d-mode-setup t)
;; Auto highlight symbol
(global-auto-highlight-symbol-mode)
;; Flycheck global
(add-hook 'after-init-hook #'global-flycheck-mode)
;; Fzf git keybinding
(global-set-key (kbd "C-t") 'fzf-git)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment