Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mickey-happygolucky/2f340cb88462ee4e786881f56f0210a5 to your computer and use it in GitHub Desktop.
Save mickey-happygolucky/2f340cb88462ee4e786881f56f0210a5 to your computer and use it in GitHub Desktop.
dot emacs
;; ricty font
(set-default-font "Ricty Diminished-10.5")
(set-fontset-font nil 'japanese-jisx0208 (font-spec :family "Ricty Diminished" :size 10.5))
(add-to-list 'default-frame-alist '(font . "Ricty Diminished-10.5"))
;; the additional load paths
(add-to-list 'load-path "~/.emacs.d/site-lisp")
;; package
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(package-initialize)
;; use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile (require 'use-package))
;; key bindings
;;(global-set-key "\M-t" nil)
;;(global-set-key "\M-r" nil)
(use-package bind-key
:bind (("C-h" . backward-delete-char)
("C-c C-@" . rectangle-mark-mode)))
;; raise the frame to front
(add-hook 'server-switch-hook 'raise-frame)
;; show the colunn of cursor
(column-number-mode t)
;; hide the toolbar
(tool-bar-mode 0)
;; enable up/downcase-region
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
;; moccur
(require 'moccur-edit)
(use-package color-moccur
:ensure t
:bind (("C-x j" . moccur-grep-find)
("C-c j" . moccur)))
;; color theme
(use-package color-theme-modern
:ensure t
:init (load-theme 'misterioso t))
;; mozc
(use-package mozc
:ensure t
:init (setq default-input-method "japanese-mozc"))
;; company mode
(use-package company
:ensure t
:init
(global-company-mode)
:config
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2)
(setq company-selection-wrap-around t)
(setq company-dabbrev-downcase nil)
(setq company-backends '((company-dabbrev-code company-capf company-files)
))
:bind (("C-M-i" . company-complete)
:map company-active-map
("C-n" . company-select-next)
("C-p" . company-select-previous)
("C-h" . nil)
("<tab>" . company-complete-common-or-cycle)
:map company-search-map
("C-n" . company-select-next)
("C-p" . company-select-previous)))
;; Smart parens
(use-package smartparens
:ensure t
:init (smartparens-global-mode t)
:config
(sp-with-modes '(emacs-lisp-mode)
(sp-local-pair "'" nil :actions nil)
(sp-local-pair "`" nil :actions nil))
)
;; GNU Global
;; (require 'gtags)
;; (bind-keys ("\M-t" . gtags-find-tag)
;; ("\M-r" . gtags-find-rtag)
;; ("\M-s" . gtags-find-symbol)
;; ("\C-t" . gtags-pop-stack))
;; Markdown mode
(use-package markdown-mode
:ensure t
:init
(add-to-list 'auto-mode-alist '("\\.md$" . gfm-mode))
(add-hook 'gfm-mode-hook (lambda() (smartparens-mode -1)))
:config
(set-face-attribute 'markdown-code-face nil :inherit 'default)
(setq markdown-fontify-code-blocks-natively t)
(setq markdown-gfm-use-electric-backquote nil)
:commands gfm-mode)
;; c++ mode
(add-to-list 'auto-mode-alist '("\\.h" . c++-mode))
(add-hook 'c++-mode-hook (lambda()
(c-set-style "stroustrup")
(setq indent-tabs-mode nil)))
;; c mode
(add-hook 'c-mode-hook (lambda()
(c-set-style "linux")
(setq indent-tabs-mode nil)))
;; lsp mode
(use-package lsp-mode
:ensure t
:hook (c++-mode . lsp)
:init (add-hook 'c++-mode-hook (lambda() (setq lsp-enable-indentation nil)))
:bind (("M-t" . xref-find-definitions)
("M-r" . xref-find-references)
("C-t" . xref-pop-marker-stack))
:commands lsp)
;; cmake
(use-package cmake-mode
:ensure t
:init
(add-to-list 'auto-mode-alist '("^CMakeLists\\.txt$" . cmake-mode))
(add-to-list 'auto-mode-alist '("\\.cmake$" . cmake-mode)))
;; eshell
(add-hook 'eshell-mode-hook (lambda()
(company-mode -1)
(setenv "GIT_PAGER" "nkf -w|colordiff")))
;; QML
(use-package qml-mode
:ensure t
:init (add-to-list 'auto-mode-alist '("\\.qml$" . qml-mode))
:commands qml-mode)
;; qrc(Qt Resource) uses xml-mode
(add-to-list 'auto-mode-alist '("\\.qrc" . xml-mode))
(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.
'(package-selected-packages
(quote
(mozc cmake-mode lsp-mode markdown-mode smartparens company color-theme-modern moccur-edit color-moccur use-package))))
(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment