Created
October 18, 2020 12:59
-
-
Save heeh/6285c08d286b31b81f4806002306ec16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'package) | |
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) | |
(package-initialize) | |
(setq pkgs | |
'(company | |
ido-vertical-mode | |
impatient-mode | |
use-package | |
yasnippet | |
flymake-google-cpplint | |
google-c-style | |
auto-dim-other-buffers | |
vscode-dark-plus-theme | |
flymake-cursor | |
)) | |
(defun my-check-install (pkg) | |
"Check and potentially install `PKG'." | |
(when (not (package-installed-p pkg)) | |
(when (not (require pkg nil t)) | |
(package-install pkg)))) | |
(defun my-packages-reset() | |
"Reset package manifest to the defined set." | |
(interactive) | |
(package-refresh-contents) | |
(mapc 'my-check-and-maybe-install my-useful-packages)) | |
(car pkgs) | |
(while pkgs | |
(my-check-install (car pkgs)) | |
(setq pkgs (cdr pkgs))) | |
(column-number-mode) | |
;; (require 'dashboard) | |
;; (dashboard-setup-startup-hook) | |
;; ;; Or if you use use-package | |
;; (use-package dashboard | |
;; :ensure t | |
;; :config | |
;; (dashboard-setup-startup-hook)) | |
;;////////////////////////////////////////////////////////////////////////////// | |
;; Testing | |
;; ////////////////////////////////////////////////////////////////////////////// | |
;;(cd "/Users/heeh/Projects/610/p10/src/MPC/") | |
(defvar ido-dont-ignore-buffer-names '("*grep*" "*eshell*")) | |
(defun ido-ignore-most-star-buffers (name) | |
(and | |
(string-match-p "^*" name) | |
(not (member name ido-dont-ignore-buffer-names)))) | |
(setq ido-ignore-buffers (list "\\` " #'ido-ignore-most-star-buffers)) | |
;;////////////////////////////////////////////////////////////////////////////// | |
;; Deployed | |
;;////////////////////////////////////////////////////////////////////////////// | |
;;(toggle-debug-on-error) | |
(defun my:flymake-google-init () | |
(interactive) | |
(require 'flymake-google-cpplint) | |
(setq flymake-google-cpplint-command "/Users/heeh/Library/Python/3.7/bin/cpplint") | |
(setq flymake-google-cpp | |
lint-verbose "--verbose=0") | |
(setq flymake-google-cpplint-filter "--filter=-build/include_subdir,-legal/copyright,-build/header_guard,-whitespace/line_length,-runtime/int,-whitespace/parens,-runtime/references,-build/namespaces") | |
(flymake-google-cpplint-load) | |
) | |
(add-hook 'c-mode-hook 'my:flymake-google-init) | |
(add-hook 'c++-mode-hook 'my:flymake-google-init) | |
(setq indent-tabs-mode nil) ; And force use of spaces | |
(setq inhibit-splash-screen t) ; hide welcome screen | |
(setq inhibit-startup-screen t) | |
(setq make-backup-files nil) | |
(setq path-to-ctags "/usr/local/bin/ctags") ;; <- your ctags path here | |
(defun create-tags (dir-name) | |
"Create tags file." | |
(interactive "DDirectory: ") | |
(shell-command | |
(format "%s -f TAGS -e -R %s" path-to-ctags (directory-file-name dir-name))) | |
) | |
;;(global-set-key (kbd "C-x C-z") nil) | |
(global-set-key (kbd "C-z") nil) | |
(require 'ido) | |
(require 'ido-vertical-mode) | |
(ido-mode 1) | |
(ido-vertical-mode 1) | |
(setq ido-enable-flex-matching t) | |
(setq ido-everywhere t) | |
(setq ido-vertical-define-keys 'C-n-and-C-p-only) | |
(electric-pair-mode 1) | |
;; Makes *scratch* empty. | |
(setq initial-scratch-message "") | |
;; Removes *scratch* from buffer after the mode has been set. | |
(defun remove-scratch-buffer () | |
(if (get-buffer "*scratch*") | |
(kill-buffer "*scratch*"))) | |
(add-hook 'after-change-major-mode-hook 'remove-scratch-buffer) | |
;;(kill-buffer "*Messages*") | |
;; Removes *messages* from the buffer. | |
;;(setq-default message-log-max nil) | |
;;(setq-default flymake-log nil) | |
;; Removes Warning log from the buffer. | |
(setq warning-minimum-log-level 100) | |
;;(kill-buffer "*Flymake log*") | |
(add-hook 'after-init-hook 'global-company-mode) | |
(setq company-dabbrev-downcase 0) | |
(setq company-idle-delay 0) | |
;; Removes *Completions* from buffer after you've opened a file. | |
(add-hook 'minibuffer-exit-hook | |
'(lambda () | |
(let ((buffer "*Completions*")) | |
(and (get-buffer buffer) | |
(kill-buffer buffer))))) | |
;; Don't show *Buffer list* when opening multiple files at the same time. | |
(setq inhibit-startup-buffer-menu t) | |
;; Show only one active window when opening multiple files at the same time. | |
;;(add-hook 'window-setup-hook 'delete-other-windows) | |
;; No more typing the whole yes or no. Just y or n will do. | |
(fset 'yes-or-no-p 'y-or-n-p) | |
(require 'impatient-mode) | |
(add-hook 'html-mode-hook #'impatient-mode) | |
(require 'use-package) | |
(use-package flymake-cursor | |
:load-path "~/.emacs.d/lisp/emacs-flymake-cursor" ;; cloned repo path | |
:config | |
(custom-set-variables | |
'(help-at-pt-timer-delay 0.9) | |
'(help-at-pt-display-when-idle '(flymake-overlay))) | |
(flymake-cursor-mode)) | |
(setq inhibit-startup-screen t | |
initial-buffer-choice nil) | |
(setq warning-minimum-level :emergency) | |
(global-hl-line-mode) | |
(setq-default cursor-type 'bar) | |
(blink-cursor-mode 0) | |
(defun halve-other-window-height () | |
"Expand current window to use half of the other window's lines." | |
(interactive) | |
(enlarge-window (/ (window-height (next-window)) 2))) | |
(global-set-key (kbd "C-c v") 'halve-other-window-height) | |
(require 'yasnippet) | |
(yas-global-mode 1) | |
(when window-system ; start speedbar if we're using a window system | |
(speedbar t)) | |
; /google-c-style/ and /flymake-google-cpplint/ style checker | |
(add-hook 'c-mode-common-hook 'flymake-keyboard-shortcuts) | |
;; (define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error) | |
;; (define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error) | |
(require 'flymake-google-cpplint) | |
(require 'google-c-style) | |
(add-hook 'c-mode-common-hook 'google-set-c-style) | |
(add-hook 'c-mode-common-hook 'google-make-newline-indent) | |
(add-hook 'c++-mode-common-hook 'google-set-c-style) | |
(add-hook 'c++-mode-common-hook 'google-make-newline-indent) | |
(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-enabled-themes nil) | |
'(custom-safe-themes | |
'("bb38670847b79d986a2cd21dfe1895a07d78fc67f16cb780253e23f1b40bdbd5" "950a9a6ca940ea1db61f7d220b01cddb77aec348d3c2524349a8683317d1dbb6" default)) | |
'(help-at-pt-display-when-idle '(flymake-overlay) nil (help-at-pt)) | |
'(help-at-pt-timer-delay 0.9) | |
'(package-selected-packages | |
'(flymake-cursor company-mode dashboard md4rd speed-type treemacs glsl-mode swift-mode yasnippet-snippets vscode-dark-plus-theme vs-dark-theme use-package sr-speedbar magit irony impatient-mode ido-vertical-mode google-c-style flymake-google-cpplint flymake-diagnostic-at-point company)) | |
'(save-place-mode t) | |
'(show-paren-mode t) | |
'(speedbar-update-flag nil) | |
'(sr-speedbar-default-width 30) | |
'(sr-speedbar-max-width 30) | |
'(treemacs-follow-mode nil)) | |
(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. | |
'(default ((t (:inherit nil :stipple nil :background "#1e1e1e" :foreground "#d4d4d4" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight light :height 180 :width normal :foundry "nil" :family "Roboto Mono")))) | |
'(auto-dim-other-buffers-face ((t (:background "#122" :foreground "brightblack"))))) | |
;;(define-minor-mode dvorak-minor-mode "Use english-dvorak input method." :lighter nil | |
;; (if | |
;; (not (string= " *Minibuf-0*" (buffer-name (current-buffer)))) | |
;; (if dvorak-minor-mode (set-input-method "english-dvorak")))) | |
;;(define-global-minor-mode global-dvorak-mode dvorak-minor-mode dvorak-minor-mode) | |
;;(global-dvorak-mode t) | |
;;(add-hook 'minibuffer-setup-hook (lambda () (set-input-method "english-dvorak"))) | |
(when (fboundp 'windmove-default-keybindings) | |
(windmove-default-keybindings)) | |
;; scroll one line at a time (less "jumpy" than defaults) | |
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time | |
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling | |
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse | |
(setq scroll-step 1) ;; keyboard scroll one line at a time | |
(autoload 'glsl-mode "glsl-mode" nil t) | |
(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode)) | |
(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode)) | |
(add-to-list 'auto-mode-alist '("\\.mm\\'" . objc-mode)) | |
(setq-local imenu-create-index-function #'ggtags-build-imenu-index) | |
;;(sr-speedbar-open) | |
;;(sr-speedbar-refresh-turn-off) | |
;; | |
(auto-dim-other-buffers-mode) | |
;;////////////////////////////////////////////////////////////////////////////// | |
;; Dvorak | |
;; ////////////////////////////////////////////////////////////////////////////// | |
;;(treemacs) | |
;; open bookmarks at startup | |
;; You have to inhibit-startup-screen on startup. See above. | |
(bookmark-bmenu-list) | |
(switch-to-buffer "*Bookmark List*") | |
(add-hook 'dired-mode-hook | |
(lambda () | |
(dired-hide-details-mode) | |
;; (dired-sort-toggle-or-edit) | |
) | |
) | |
;;(sr-speedbar-open) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment