Skip to content

Instantly share code, notes, and snippets.

@m-mizutani
Created August 22, 2016 06:30
Show Gist options
  • Save m-mizutani/97990934618af83456af91d681eaac63 to your computer and use it in GitHub Desktop.
Save m-mizutani/97990934618af83456af91d681eaac63 to your computer and use it in GitHub Desktop.
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(set-language-environment 'Japanese)
(prefer-coding-system 'utf-8)
; C-h
(global-set-key "\C-h" 'backward-delete-char)
(setq tramp-shell-prompt-pattern "^.*[#$%>] *")
; バックアップ作成無効化
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq inhibit-startup-message t)
(transient-mark-mode 1)
(setq default-tab-width 2)
(set-face-foreground 'font-lock-comment-face "darkolivegreen3")
(set-face-foreground 'font-lock-string-face "coral")
(set-face-foreground 'font-lock-keyword-face "green")
(set-face-foreground 'font-lock-function-name-face "cyan")
(set-face-foreground 'font-lock-type-face "skyblue1")
(set-face-foreground 'font-lock-warning-face "yellow")
(set-face-foreground 'font-lock-builtin-face "goldenrod")
(set-face-background 'highlight "yellow")
(set-face-foreground 'highlight "black")
(set-face-background 'region "lightgoldenrod2")
(set-face-foreground 'region "black")
; Company
(require 'company)
(global-company-mode) ; 全バッファで有効にする
(setq company-idle-delay 0) ; デフォルトは0.5
(setq company-minimum-prefix-length 2) ; デフォルトは4
(setq company-selection-wrap-around t) ; 候補の一番下でさらに下に行こうとすると一番上に戻る
(define-key company-active-map (kbd "M-n") nil)
(define-key company-active-map (kbd "M-p") nil)
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-p") 'company-select-previous)
(define-key company-active-map (kbd "C-h") nil)
;(define-key company-active-map (kbd "C-i") 'company--insert-candidate2)
(define-key company-active-map (kbd "C-s") 'company-filter-candidates)
; auto-insert
(auto-insert-mode)
(setq auto-insert-directory "~/.emacs.d/insert/")
(define-auto-insert "\\.py$" "template.py")
(setq c-tab-always-indent nil)
(add-hook 'c-mode-hook
(lambda ()
(setq tab-width 2)
(setq indent-tabs-mode nil)
(setq c-basic-offset 2)
))
(add-hook 'c++-mode-hook
(lambda ()
(setq tab-width 2)
(setq indent-tabs-mode nil)
(setq c-basic-offset 2)
;;(local-set-key "\t" '(lambda() (interactive)(insert "\t")))
))
(require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-hook 'js2-mode-hook
#'(lambda ()
(require 'js)
(setq js-indent-level 2
js-expr-indent-offset 2
c-basic-offset 2
indent-tabs-mode nil)
(set (make-local-variable 'indent-line-function) 'js-indent-line)))
;; (cperl-set-style "PerlStyle")
(autoload 'cperl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(add-to-list 'auto-mode-alist '("\.\([pP][Llm]\|al\|t\|cgi\)\'" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
;;; cperl-mode is preferred to perl-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.
'(cperl-close-paren-offset -2)
'(cperl-indent-parens-as-block t)
'(cperl-indent-subs-specially nil)
'(safe-local-variable-values (quote ((encoding . utf-8)))))
(setq cperl-tab-always-indent nil)
(add-hook 'cperl-mode-hook
'(lambda ()
(progn
(setq indent-tabs-mode nil)
(setq tab-width nil)
)
)
)
(setq auto-mode-alist
(append
(list (cons "\\.[bB][aA][tT]$" 'bat-mode))
;; For DOS init files
(list (cons "CONFIG\\." 'bat-mode))
(list (cons "AUTOEXEC\\." 'bat-mode))
auto-mode-alist))
(autoload 'bat-mode "bat-mode"
"DOS and Windows BAT files" t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment