Skip to content

Instantly share code, notes, and snippets.

@hwada
Created September 9, 2022 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hwada/1fef3748f488b209b6275bf716eb5ec6 to your computer and use it in GitHub Desktop.
Save hwada/1fef3748f488b209b6275bf716eb5ec6 to your computer and use it in GitHub Desktop.
;キーバインド設定
(global-set-key #\Home 'beginning-of-virtual-line)
(global-set-key #\End 'end-of-virtual-line)
(global-set-key #\S-Home 'selection-beginning-of-virtual-line)
(global-set-key #\S-End 'selection-end-of-virtual-line)
(global-set-key #\C-Home 'beginning-of-buffer )
(global-set-key #\C-End 'end-of-buffer)
(global-set-key #\M-Right 'next-buffer)
(global-set-key #\M-Left 'previous-buffer)
;バッファ移動をツールバー表示順にする
(setq *next-buffer-in-tab-order* t)
;; shell-mode 設定
(load-library "shell-ext.l")
(setq *eshell* "cmd.exe")
;; 一発インデント
(defun indent-current-buffer ()
(interactive)
(indent-region (point-min) (point-max))
(message "indent buffer"))
; Ctrl + F8 で起動
(global-set-key #\C-F8 'indent-current-buffer)
;; C++ 設定
(setq c++-indent-level 4)
(setq c++-continued-statement-offset 4)
(setq c++-argdecl-indent 4)
(setq c++-brace-offset -4) ;; ブレース前には改行を入れるのでタブ分戻す
(setq c++-brace-imaginary-offset 0)
(setq c++-label-offset -4)
(setq c++-comment-indent 4)
(setq c++-tab-always-indent nil)
(setq c++-indent-tabs-mode nil)
(define-key ed::*c++-mode-map* #\TAB 'c-indent-line)
;; c+++-mode
;(load-library "cppp/cppp-mode")
;; 関数リストを表示
(global-set-key #\c-7 #'list-function) ;; Ctrl-7で起動
;;;;
;; コンパイル時のエラーメッセージを解析
;; BCB に対応
; ... 動かないのでいったん削除 ...
;; hoge.cpp で実行すると hoge.h を、
;; hoge.h で実行すると hoge.cpp が開くマクロ
(defun toggle-header-implementation-file ()
(interactive "*")
(let ((filepath nil))
(cond
((string-matchp "\\(.*\\.\\)h\\(pp\\)?" (get-buffer-file-name))
(setf filepath (string-replace-match (get-buffer-file-name) "\\1cpp"))
(if (file-exist-p filepath)
(find-file filepath)
(message "対応するソースファイルが見つからない。。。")))
((string-matchp "\\(.*\\.\\)cpp" (get-buffer-file-name))
(setf filepath (string-replace-match (get-buffer-file-name) "\\1hpp"))
(if (file-exist-p filepath)
(find-file filepath)
(progn
(setf filepath (string-right-trim "pP" filepath))
(if (file-exist-p filepath)
(find-file filepath)
(message "対応するヘッダーが見つからない。。。"))))))))
;; ↑をCtrl + F6 で起動する(BCB互換)
(global-set-key #\C-F6 'toggle-header-implementation-file)
;; switch-buffer
;; iswitch
(require "iswitchb")
;(defun switch-to-buffer-emacs ()
; (interactive)
; (let* ((default (buffer-name (other-buffer)))
; (prompt (format nil "Switch to buffer: (default ~A) " default))
; (name (read-buffer-name prompt :default "")))
; (if (equal name "")
; (switch-to-buffer default)
; (switch-to-buffer name))))
;(global-set-key '(#\C-x #\b) 'switch-to-buffer-emacs)
;; doxygen 用コメントの雛形
(setf (symbol-function 'doxygen)
"//===========================================================================
")
; Ctrl + j で起動
(global-set-key #\C-j 'doxygen)
;;; outline-mode
;(require "outline-np")
;; Shift-Return、Ctrl-Return を使うための設定。F21 を既に使っているなどの場合は適当に変えてください。
;(set-extended-key-translate-table exkey-S-return #\F11)
;(set-extended-key-translate-table exkey-C-return #\F12)
(pushnew (merge-pathnames "site-lisp/howm/" (si:system-root))
*load-path* :test #'string-equal)
(require "howm-wrap")
;; `howm-init.l' をコピーしてない場合、以下を有効に。
;; 日本語メニューを使う。
;(setq elisp-lib::howm-menu-lang 'elisp-lib::ja)
;; migemo
(require "isearch")
(require "migemo")
(migemo-toggle t)
;; ruby
(load-library "ruby")
(push '("\\.rb$" . ruby-mode) *auto-mode-alist*)
; インデント量を変える。nilの時はタブを挿入
(setq *ruby-indent-column* 2)
(load-library "ruby-lister")
; rtags.rbまでのパス
;(setq *ruby-lister-rtags-path* "C:/ruby/rtags.rb")
(load-library "ruby-debug") ;debugモードを使うなら
(load-library "ruby-doc") ;rdモードを使うなら
(load-library "ruby-misc") ;その他を使うなら
; ri.rbまでのパス
(setq *ruby-information-command* "C:/ruby/bin/ri")
;; NetInstaller
;(require "ni/setup")
;; 自動設定を利用する
;(ni-autoload)
;; PROXYを通す場合
;(setq ni::*http-proxy-host* "httpproxy.yoko.onosokki.co.jp") ; PROXY のホスト
;(setq ni::*http-proxy-port* 8080) ; PROXY のポート
;; セッションを開く
;; paren
(require "paren")
(turn-on-global-paren)
;; comment
(autoload 'comment-out-region "comment" t nil)
(global-set-key '(#\C-c #\q) 'comment-out-region)
;; region
(setq *rv-region-stay-on* t)
;; 範囲選択中ならシフト、それ以外ならタブ文字挿入
(defun tab-indent ()
(interactive)
(if (get-selection-type)
(shift-selection)
(insert "\t")))
;; insert_tab
(defun insert-space-like-tab ()
(interactive)
(let ((tab (tab-columns (selected-buffer))))
(insert " " (- tab (mod (current-column) tab)))))
(global-set-key #\C-2 'insert-space-like-tab)
;;chcolor
;;(load-library "chcolor/chcolor")
;;(add-hook 'ed::*ese-fortune-mode-hook*
;; #'(lambda ()(chcolor-specify-file "背景黒")))
;; outline
;(require "outline-tree/outline-tree")
;; extended-key-translate-table 設定
;;(set-extended-key-translate-table exkey-C-tab #\F23)
;;(set-extended-key-translate-table exkey-C-return #\F20)
;; Editor <-> TreeView
; Editor -> TreeView
;(require "treeview/setup")
;(global-set-key #\F23 'treeview::treeview-focus-treeview)
; TreeView (outline-tree) -> Editor
;(define-key outline-tree2::*outline-tree-map*
; #\F23 'treeview::treeview-focus-editor)
;; outline 更新
;(global-set-key #\F20 'outline-tree2::outline-tree-create-outline-and-select-node)
;(define-key outline-tree2::*outline-tree-map*
; #\F20 'outline-tree2::outline-tree-create-outline-and-select-node)
;; ndmacro
(defconstant *ndmacro-key* #\C-t)
(global-set-key *ndmacro-key* 'ndmacro-exec)
(autoload 'ndmacro-exec "ndmacro" t)
;; xml-mode
(require "xml/xml-mode")
(require "xml/relaxng")
(use-package 'xml)
;; changelog
(load-library "changelog")
(setq *changelog-user* "WADA Hiroaki <hwada@onosokki.co.jp>")
(setq *changelog-filename* "C:/home/ChangeLog")
;; kamail
(autoload 'kamail3 "kamail3/defs" t)
(autoload 'kamail3-toggle "kamail3/defs" t)
;; xml-http-request
;;(require "xml-http-request")
;; twitter
;(require "twitter-update")
;(global-set-key '(#\C-c #\t) 'twitter-update)
;(setf *twitter-user* "hwada")
;(setf *twitter-password* "b3k3p5vh")
;======================================================================
; for scheme-mode
;----------------------------------------------------------------------
(load-library "scheme-mode")
(push '(".scm$" . scheme-mode) *auto-mode-alist*)
; Gauche - directly
(setf *scheme-process-open-hook*
#'(lambda (buffer)
(if (buffer-process)
(buffer-process)
(progn
(set-buffer buffer)
(make-process
(format
nil "~A"
(map-slash-to-backslash
(merge-pathnames "C:/home/script/scheme/Gauche/bin/gosh.exe -i" (si:system-root)))))))))
;; hatena-haiku-mode
;(require "hatena-haiku-mode")
;; taskpaper.el
;;;;;;(load-library "taskpaper")
;; anything
(require :anything/anything)
(require :anything/sources)
(require :anything/menu)
(load "init-anything.l")
;;; calmemo
(require "calmemo/calmemo")
;;; html+-mode
(export 'ed::html+-mode "ed")
(autoload 'html+-mode "html+-mode" t)
(pushnew '("\\.s?html?$" . html+-mode) *auto-mode-alist* :test 'equal)
;;; javascript-mode
(load-library "javascript-mode")
(push '("\\.js$" . javascript-mode) *auto-mode-alist*)
;;; markdown-mode
(load-library "markdown-mode")
(push '("\\.md$" . markdown-mode) *auto-mode-alist*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment