Skip to content

Instantly share code, notes, and snippets.

View ttdoda's full-sized avatar

IWAMOTO Kouichi ttdoda

  • Kanagawa, Japan
View GitHub Profile
@ttdoda
ttdoda / multisend.ttl
Created July 31, 2017 02:23
サーバに接続した状態で別のサーバにコマンドを送るサンプル
server_b="server-b mcast"
prompt="%"
connect "server-b"
wait prompt
setmulticastname server_b
unlink
connect "server-a"
wait prompt
@ttdoda
ttdoda / broadcast-test.ttl
Created July 27, 2017 14:07
Tera Termを250枚開くマクロ
total=250
xcount=20
xdelta=50
ydelta=50
for i 1 total
call opentt
unlink
next
@ttdoda
ttdoda / vim-lrm-il-fix.diff
Created July 19, 2017 15:14
左右マージン(垂直スクロールリージョン)使用時のカーソル位置修正
diff --git a/src/screen.c b/src/screen.c
index 0ec9ea2..01ea728 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -9732,6 +9732,7 @@ screen_ins_lines(
int j;
unsigned temp;
int cursor_row;
+ int cursor_col = 0;
int type;
@ttdoda
ttdoda / vim-lrm-req.diff
Created July 19, 2017 15:05
VimでのDECRQMによる左右マージン利用自動判定
diff --git a/src/main.c b/src/main.c
index 268c256..04edcad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -825,6 +825,7 @@ vim_main2(void)
may_req_termresponse();
may_req_bg_color();
+ may_req_lrm_status();
#endif
@ttdoda
ttdoda / resize.rb
Last active November 19, 2023 16:06
xterm付属のresizeコマンドの手抜き再実装
#!/usr/bin/env ruby
#encoding: ASCII-8BIT
#
# resize.rb -- resize コマンドの手抜き実装
#
# xterm の付属コマンド resize[1] の機能の内、端末(エミュレータ)の現在の
# サイズを調べて TTY の設定を合わせる機能の実装例です。
#
# 原理:
# カーソル位置を 9999 行目 9999 桁目に移動する命令を送信し、実際に移動した
% uname -a
FreeBSD mizup 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
% printf "abaaaaaaaaaaaaaaabaaaa" | hexdump -C
00000000 61 62 61 61 61 61 61 61 61 61 61 61 61 61 61 61 |abaaaaaaaaaaaaaa|
*
00000010
########
% uname -a
@ttdoda
ttdoda / .vimrc
Last active November 28, 2019 03:50
tmux使用時のvimでのBracketed Paste Mode有効化
if has('patch-8.0.0238')
if &term =~ "screen"
let &t_BE = "\e[?2004h"
let &t_BD = "\e[?2004l"
exec "set t_PS=\e[200~"
exec "set t_PE=\e[201~"
endif
else
if has('patch-8.0.0210')
set t_BE=
@ttdoda
ttdoda / gist:eeb3431f68b4d23c349eaa5ae90b437b
Last active January 6, 2017 04:41
PATHに : を含められるか。zshの場合
sue@mizup% echo $PATH
/bin:/usr/bin
sue@mizup% echo $path
/bin /usr/bin
sue@mizup% cat /home/sue/path:test/path-test
#!/bin/sh
echo $0 test
sue@mizup% path-test
zsh: command not found: path-test
sue@mizup% path=($path /home/sue/path:test)
@ttdoda
ttdoda / zm-delescape.diff
Created June 20, 2016 16:26
lsz -e でDEL(0x7f)および0xFFもエスケープさせるパッチ
--- src/zm.c.orig 1998-12-30 01:48:38.000000000 +0900
+++ src/zm.c 2016-06-21 01:18:04.721707000 +0900
@@ -262,7 +262,17 @@
break;
case 1:
xsendline(ZDLE);
- c ^= 0100;
+ switch (c) {
+ case 0177:
+ c = ZRUB0;
@ttdoda
ttdoda / kcodecheck.rb
Last active March 31, 2017 02:45
端末の漢字コード設定の判別
#!/usr/bin/env ruby
# encoding: ascii-8bit
#
# 端末の漢字コード設定判別のサンプルスクリプト
#
# コンセプトとしてはUTF-8, EUC-JP, Shift_JISのどれと解釈しても正しい、
# しかしどのエンコーディングとして解釈したかで端末での表示幅が変わる
# バイト列を送信し、その時のカーソル位置で端末がどのエンコーディング
# として解釈したかを判別する。
#