日暮途遠(Linux)

Just another WordPress.com site

Archive for 8月 2014

UbuntuでCapslockキーを無効にし、Emacsでキーマップとして利用する設定

leave a comment »

参考:xmodmapでキーバインド変更する方法 – Linux, Mac, Emacsについての設定、覚え書き http://d.hatena.ne.jp/kenbeese/20120214/title

% vi ~/.xmodmaprc

次の内容を書き込む

remove Lock = Caps_Lock
keycode 66 = Eisu_toggle

 

次のコマンドの実行で有効

% xmodmap ~/.xmodmaprc

起動時に有効にする場合は~/.profileに上記コマンドを書き込んでおく。

 

.emacsでの設定

;;キャップスキーのキーバインド
(let ((cmap (make-sparse-keymap)))      ;caps key
 (define-key cmap "a" 'move-beginning-of-line)
 (define-key cmap "b" 'backward-word)
;;  (define-key cmap "c"
 (define-key cmap "c"  'h-copy-line)
;;  (define-key cmap "d"
 (define-key cmap "e" 'move-end-of-line)
 (define-key cmap "f" 'forward-word)
;;  (define-key cmap "g"
 (define-key cmap "h" 'h-count-line)
 (define-key cmap "i" 'toggle-input-method)
 (define-key cmap "j" 'next-line-nomark)
 (define-key cmap "k" 'previous-line-nomark)
 (define-key cmap "l" 'forward-char-nomark)
 (define-key cmap "m" 'zap-to-char)
 (define-key cmap "n" 'backward-delete-char-untabify)
 (define-key cmap "o" 'h-insert-new-line)
 (define-key cmap "p" 'yank)
;;  (define-key cmap "q"
 (define-key cmap "r" 'isearch-backward)
 (define-key cmap "s" 'h-time-stamp-start)
 (define-key cmap "t" 'h-count-line)
 (define-key cmap "u" 'undo)
(define-key cmap "v" 'h-hirono_hideki-ruby-twit)
;;  (define-key cmap "w"
(define-key cmap "x" 'h-time-stamp-end)
;;  (define-key cmap "x"
 (define-key cmap "y" 'yank)
;;  (define-key cmap "z"
 (define-key cmap ";" 'toggle-input-method)
 (define-key cmap ":" 'h-jump-search-word)
 (define-key cmap "@" 'mark-sexp)
 (setq caps-key cmap))

(global-set-key [(eisu-toggle)] caps-key)

Written by 廣野秀樹

2014年8月25日 at 6:41 午後

カテゴリー: Emacs

Tagged with , ,

Twilogのデータを書式変換するスクリプト

leave a comment »

#!/bin/sh

if [ -p /dev/stdin ] ; then
    cat - | sed 's/"\(.*\)","\(..\)\(..\)\(..\) \(..\)\(..\)\(..\)","\(.*\)"/投稿日時:20\2年\3月\4日\5時\6分\7秒 リンクURL: https:\/\/twitter.com\/kk_hirono\/status\/\1\n\8\n/'
else
    echo "このコマンドの利用には、パイプを使い標準入力としてTwilogのデータを与えてください。"
fi 

Written by 廣野秀樹

2014年8月5日 at 9:30 午前

カテゴリー: スクリプト

Tagged with , ,