2010/02/02
cua-mode
Emacs で矩形選択と 連番挿入 - sakito - Emacsがすきすぎる - Emacsグループより
cua-modeをオンにしておくと連番の挿入が便利かも.あと,矩形選択した前後にタグを挿入したりするのに便利(C-xrtで代用できそうやけど)
この動画をみてわかったことを書いておく.
変なキーバインドを無効か
- (setq cua-enable-cua-keys nil)
- これをしとかないとC-xでkill-regionとかになって変な感じ
cua-enable-cua-keys is a variable defined in `cua-base.el'. Its value is t Documentation: *Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste. If the value is t, these mappings are always enabled. If the value is `shift', these keys are only enabled if the last region was marked with a shifted movement key. If the value is nil, these keys are never enabled. You can customize this variable.
矩形に対する挿入
- M-x cua-mode
- でcua-modeをenabledにして,C-enterで矩形の頭(左上)をマーク
- 矩形のお尻(右下)に移動してenterを押すとカーソルが頭に戻る
- その状態で
- とかタイプすると矩形の左側全ての行に
- が挿入される
- enterを押すと矩形の右上にカーソルが移動する
- とか入力すると矩形の右側全ての行に挿入される
class=...などを挿入する(C-xrt相当の動き)
- C-enterで左上をマークして,カーソルを下に移動して,class=を挿入したい位置まで移動(1文字×複数行をマークする)
- そのまま入力を始めるとマークされている範囲の左側に挿入される
- enterを押してから入力するとカーソルが一番上に動いて範囲の右側に挿入される
連番の挿入
- C-enterで左上をマークして,カーソルを下に移動して,連番を挿入したい位置まで移動(1文字×複数行をマークする)
- esc-nで数字入力のためのミニバッファにうつる
- 初期値,増加量(1行ごとに増える量),書式(-%d-とかすると-1- -2- ...となる)
- マークしている範囲が上書きされるので,空白を作っておく必要がある
他の機能
cua-modeをenableにして,describe-bindingsとか実行してキーバインドから調べてみようかな
トラックバック - http://d.hatena.ne.jp/peccu/20100202/1265088619
リンク元
- 483 http://e-arrows.sakura.ne.jp/2010/02/vim-to-emacs.html
- 112 http://www.google.co.jp/search?q=cua-mode&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ja:official&hl=ja&client=firefox-a
- 88 http://www.google.co.jp/url?sa=t&rct=j&q=cua-mode&source=web&cd=1&ved=0CDEQFjAA&url=http://d.hatena.ne.jp/peccu/20100202/1265088619&ei=RS6ETon-OuWOmQXD0azvDw&usg=AFQjCNF8ncdcLzuPRtDtyXxLC7c0r-R5DQ
- 82 http://www.google.co.jp/search?sourceid=chrome&ie=UTF-8&q=cua-mode
- 69 http://d.hatena.ne.jp/oh_cannot_angel/20101216/1292506110
- 25 http://www.google.com/search?client=ubuntu&channel=fs&q=cua-mode+矩形選択&ie=utf-8&oe=utf-8
- 21 http://www.google.co.jp/url?sa=t&source=web&cd=1&ved=0CBsQFjAA&url=http://d.hatena.ne.jp/peccu/20100202/1265088619&rct=j&q=cua-mode&ei=50W6TcjkJY64vgP4qY27Cw&usg=AFQjCNF8ncdcLzuPRtDtyXxLC7c0r-R5DQ&sig2=25SgyFax2s2SbGtXPL5KkQ
- 18 http://d.hatena.ne.jp/
- 17 http://d.hatena.ne.jp/kitokitoki/20110305/p2
- 16 http://webcache.googleusercontent.com/search?q=cache:vYvuVgC7IbQJ:e-arrows.sakura.ne.jp/2010/02/vim-to-emacs.html+emac+矩形 選択&cd=2&hl=ja&ct=clnk&gl=jp&client=firefox-a


