;;; Code: ;; Backup files (setq backup-directory-alist `(("." . "~/.emacs_saves"))) (setq backup-by-copying t) (setq delete-old-versions t kept-new-versions 6 kept-old-versions 2 version-control t) ;; menu bars (menu-bar-mode -1) (toggle-scroll-bar -1) (tool-bar-mode -1) (setq mac-shift-modifier 'meta) ;; Default Values (setq-default indent-tabs-mode t) ; use spaces only if nil (setq-default tab-width 2) ; Assuming you want your tabs to be four spaces wide (set-face-attribute 'default nil :font "Source Code Pro-10") (set-fontset-font t '(?😊 . ?😎) "Segoe UI Emoji") ;;(set-face-attribute 'default nil :height 110 :family "Consolas") (set-language-environment "UTF-8") (set-default-coding-systems 'utf-8) ;; Cursor (setq-default cursor-type 'bar) (blink-cursor-mode 1) ;; Margin (global-linum-mode 1) (require 'minimap) (minimap-mode 1) (setq-default minimap-window-location "right") (setq-default minimap-highlight-line 1) (setq-default minimap-update-delay 0) (setq-default left-fringe-width 20) (setq-default right-fringe-width 20) (set-face-attribute 'fringe nil :background "white") ;; Initialization screen (setq inhibit-splash-screen t) (setq initial-scratch-message "") (setq initial-major-mode 'text-mode) ;; Projectile for project navigation (require 'projectile) (projectile-mode +1) (define-key projectile-mode-map (kbd "s-F") 'projectile-grep) (define-key projectile-mode-map [?\s-o] 'projectile-switch-project) (define-key projectile-mode-map [?\s-p] 'projectile-find-file) ;; Ido mode text matching (require 'ivy) (ivy-mode 1) ;; Tree (require 'neotree) (require 'evil) (setq neo-smart-open t) ;;(setq projectile-switch-project-action 'neotree-projectile-action) (setq neo-theme (if (display-graphic-p) 'icons 'arrow)) (evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter) (evil-define-key 'normal neotree-mode-map (kbd "SPC") 'neotree-quick-look) (evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide) (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter) (evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh) (evil-define-key 'normal neotree-mode-map (kbd "n") 'neotree-next-line) (evil-define-key 'normal neotree-mode-map (kbd "p") 'neotree-previous-line) (evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle) (evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle) ;; Smooth scroll (setq redisplay-dont-pause t scroll-margin 7 scroll-step 3 scroll-conservatively 10000 scroll-preserve-screen-position 1) ;; Line highlighting (global-hl-line-mode 1) (set-face-background 'hl-line "gray97") ;; Show flycheck always and after save (use-package flycheck :ensure t) (global-flycheck-mode) (add-hook 'after-init-hook #'global-flycheck-mode) ;; Emojis (use-package emojify :config (when (member "Segoe UI Emoji" (font-family-list)) (set-fontset-font t 'symbol (font-spec :family "Segoe UI Emoji") nil 'prepend)) (setq emojify-display-style 'unicode) (setq emojify-emoji-styles '(unicode)) (bind-key* (kbd "C-c e") #'emojify-insert-emoji)) ; override binding in any mode ;; Global key binds (require 'eglot) (bind-key* (kbd "") #'eglot-rename) (bind-key* (kbd "C-x C-f") 'counsel-find-file) (bind-key* (kbd "M-x") 'counsel-M-x) (bind-key* (kbd "C-;") 'neotree-toggle) (defun my-create-file () "Create a file and refresh neotree." (interactive) (call-interactively #'make-empty-file) (neotree-show) (neotree-refresh)) (bind-key* (kbd "M-n") 'my-create-file) (defun my-create-directory () "Create a directory and refresh neotree." (interactive) (call-interactively #'make-directory) (neotree-show) (neotree-refresh)) (bind-key* (kbd "M-N") 'my-create-directory) (defun my-delete-file () "Delete a file and refresh neotree." (interactive) (call-interactively #'delete-file) (neotree-show) (neotree-refresh)) (bind-key* (kbd "M-d") 'my-delete-file) (defun my-delete-directory () "Delete a file and refresh neotree." (interactive) (call-interactively #'delete-directory) (neotree-show) (neotree-refresh)) (bind-key* (kbd "M-D") 'my-delete-directory) (defun my-rename-file () "Rename a file and refresh neotree." (interactive) (call-interactively #'rename-file) (neotree-show) (neotree-refresh)) (bind-key* (kbd "M-r") 'my-rename-file) ;; Company mode for code completion (use-package company :ensure t :defer t :init (add-hook 'after-init-hook 'global-company-mode) :config ;; (use-package company-irony :ensure t :defer t) TODO: Do I need irony? (setq company-idle-delay 0 company-minimum-prefix-length 2 company-show-quick-access t company-tooltip-limit 20 company-dabbrev-downcase nil company-backends '((company-capf company-gtags company-elisp)) ; TODO: do i need company-irony here company-vscode-light-icons-margin 1 ) ) (provide 'general) ;;; general.el ends here