自分用「.emacs」

Googleで .emacs とか検索する場合ダブルクオーテーションで括れば良かったんだねぇ。タイトルと関係ないけどちょっと独り言。

と、いうわけで".emacs"ですが、最近はバッファをいちいち切り替えるよりもTab端末をバシバシ立ち上げて"-nw"オプション付きで立ち上げてvi感覚でその時々で使い分けてます。

Linuxのviはデフォルトでかなりいい感じですが、emacsはいまいちで結構カスタマイズしなければなりません。とりあえずデフォルトのものに少し追加してみました。


;; .emacs
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)

;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
(global-font-lock-mode t))

(set-background-color "#333366")
(set-foreground-color "#ffffff")

;; enable visual feedback on selections
;(setq transient-mark-mode t)

;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" (system-name)))

;; default to unified diffs
(setq diff-switches "-u")

;; always end a file with a newline
;(setq require-final-newline 'query)

; Set load path of own lisp
(setq load-path
(append
(list (expand-file-name "~/mylisp")) load-path))

; Window size
(setq initial-frame-alist
(append '((top . 30) ; x point of frame
(left . 30) ; y point of frame
(width . 120) ; x width
(height . 60) ; y width
) initial-frame-alist))

; Key bind
(global-set-key "\C-h" 'delete-backward-char)
(global-set-key "\C-z" 'undo)
(global-set-key "\C-c" 'copy-region-as-kill)
(global-set-key "\C-w" 'kill-region)
(global-set-key "\C-y" 'yank)
(global-set-key "\C-b" 'kill-rectangle)
(global-set-key "\C-v" 'yank-rectangle)
(global-set-key "\C-s" 'isearch-forward-regexp)
(global-set-key "\C-r" 'isearch-backward-regexp)
(global-set-key "\C-f" 'query-replace-regexp)

(global-set-key [end] 'end-of-line)
(global-set-key [home] 'beginning-of-line)

(global-set-key "\C-j" 'end-of-buffer)
(global-set-key "\C-k" 'beginning-of-buffer)

; Not make save file
(setq backup-inhibited t)

; Delete backup file
(setq delete-auto-save-files t)

; Cursor type
(add-to-list 'default-frame-alist '(cursor-type . bar))

; Select color
(setq transient-mark-mode t)

; Tab width
(setq default-tab-width 4)

; UTF-8 setting
(set-language-environment 'Japanese)
(set-terminal-coding-system 'utf-8)
(setq file-name-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(setq coding-system-for-read 'mule-utf-8-unix)
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8-unix)

; Verilog-Mode Setting
;; Load verilog mode only when needed
(autoload 'verilog-mode "verilog-mode" "Verilog mode" t )
;; Any files that end in .v should be in verilog mode
(setq auto-mode-alist (cons '("\\.v\\'" . verilog-mode) auto-mode-alist))
;; Any files in verilog mode should have their keywords colorized
(add-hook 'verilog-mode-hook '(lambda () (font-lock-mode 1)))


テーマ : Linux
ジャンル : コンピュータ

2010-08-06 : Editor : コメント : 0 : トラックバック : 0
Pagetop

emacsのキーボードマクロ

テキストファイルを編集中に同じ操作を繰り返す場合はキーボードマクロを使います。ここではemacsのキーボードマクロの使い方についてまとめておきます。

まず、
Ctrl+x (
を入力した後、繰り返す動作を入力します。入力が終了したら、
Ctrl+x )
を入力します。

キーボードマクロを使用する際には、
Ctrl+x e
を入力します。

テーマ : UNIX/Linux
ジャンル : コンピュータ

2007-08-16 : Editor : コメント : 0 : トラックバック : 0
Pagetop

emacsで必要最低限のコマンド

リファレンスはたくさんあるかと思いますが、本当に必要なものに絞ってまとめます。
基本的にエディタを立ち上げ、そこからファイルをオープン、クローズしながら使います。

・起動
emacs &

・フォント調整
Shift+マウス右クリック

・ファイルオープン
Ctrl+x Ctrl+f

・2画面
Ctrl+x 2

・1画面
Ctrl+x 1

・画面切り替え
Ctrl+x o

・カット
Ctrl+@でマークし、カーソルを移動した後、Ctrl+w

・ペースト
Ctrl+y

・ファイル切り替え
Ctrl+x b

・ファイルクローズ
Ctrl+x k

・終了
Ctrl+x Ctrl+c

テーマ : UNIX/Linux
ジャンル : コンピュータ

2007-08-02 : Editor : コメント : 0 : トラックバック : 0
Pagetop

emacsのインストール

標準で Fedora Core6 をインストールした場合、emacsが無いですので、rootでインストールします。

yum install emacs emacs-common emacs-common-muse emacs-el emacs-muse emacs-muse-el

また、このままだとコードを編集する際に色が表示されないため、.emacsを以下のように設定しておきます。


;
; 色付けの設定
;

; 色を付ける
(global-font-lock-mode 1)

; 対応する括弧に色付けする
(show-paren-mode 1)

; 選択した領域に色付け
(transient-mark-mode 1)

テーマ : Linux
ジャンル : コンピュータ

2007-07-21 : Editor : コメント : 0 : トラックバック : 0
Pagetop
ホーム  次のページ »

プロフィール

Author:zive
大阪在住、男

ブログ検索

FC2カウンター

By FC2ブログ

今すぐブログを作ろう!

Powered By FC2ブログ