Skip to content

Instantly share code, notes, and snippets.

@saitoha
saitoha / screen-osc-utf8.diff
Created July 19, 2012 13:31
Unicode(UTF-8) support for GNU Screen's OSC/AKA/hardstatus.
diff --git a/src/ansi.c b/src/ansi.c
index d88e153..fc42a0a 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -1493,8 +1493,24 @@ int c;
{
if (curr->w_stringp >= curr->w_string + MAXSTR - 1)
curr->w_state = LIT;
+# ifdef UTF8
+ else if (c < 0x80)
fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
@saitoha
saitoha / gist:3606583
Created September 3, 2012 03:36
iTerm2 Remote Clipboard Copy
function! s:ITerm2Copy() range
let l:tmp = @@
silent normal gvy
let l:selected = @@
let l:i = 0
let l:len = strlen(l:selected)
let l:escaped = ''
while l:i < l:len
let l:c = strpart(l:selected, l:i, 1)
let l:escaped .= printf("\\u%04x", char2nr(l:c))
@sh2
sh2 / fio_summarize.pl
Created September 5, 2012 05:59
fio test/summarize script
#!/usr/bin/perl
use strict;
use warnings;
my (%sequential, %random);
my ($type, $blocksize, $ratio, $iodepth, $header);
while (my $line = <STDIN>) {
@ttdoda
ttdoda / TERATERM-Solarized.INI
Created November 1, 2012 14:23
Tera Term Solarized color setting
ANSIColor=0,7,54,66, 1,203,75,22, 2,88,110,117, 3,101,123,131, 4,131,148,150, 5,108,113,196, 6,147,161,161, 7,253,246,227, 8,0,43,54, ,220,50,47, 10,133,153,0, 11,181,137,0, 12,38,139,210, 13,211,54,130, 14,42,161,152, 15,238,232,213
; Solarized Dark
VTColor=131,148,150,0,43,54
VTBoldColor=147,161,161,7,54,66
VTBlinkColor=133,153,0,0,43,54
;VTReverseColor=0,43,54,131,148,150
VTReverseColor=101,123,131,253,246,227
URLColor=181,137,0,0,43,54
@mollifier
mollifier / file0.sh
Created December 11, 2012 00:08
zsh の vcs\_info に独自の処理を追加して stash 数とか push していない件数とか何でも表示する ref: http://qiita.com/items/8d5a627d773758dd8078
# vcs_info 設定
RPROMPT=""
autoload -Uz vcs_info
autoload -Uz add-zsh-hook
autoload -Uz is-at-least
autoload -Uz colors
# 以下の3つのメッセージをエクスポートする
#!/usr/bin/env perl
foreach (<stdin>) {
# DCS/OSC/SOS/PM/APC
$_ =~ s/\x1b[P\]X\^_].*(\x07|\x1b\\)//g;
# CSI
$_ =~ s/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]//g;
# single shift
@saitoha
saitoha / vim-detect-ambiguous-state
Last active December 12, 2015 01:38
Detect east-asian-ambiguous-width state of the terminal automatically (vim).
diff -cr vim.ba8835947b8b/runtime/doc/options.txt vim/runtime/doc/options.txt
*** vim.ba8835947b8b/runtime/doc/options.txt 2013-02-10 14:03:58.000000000 +0900
--- vim/runtime/doc/options.txt 2013-02-10 14:03:58.000000000 +0900
***************
*** 699,704 ****
--- 699,709 ----
when the system locale is set to one of CJK locales. See Unicode
Standard Annex #11 (http://www.unicode.org/reports/tr11).
+ Vim may set this option automatically at the startup time.
@saitoha
saitoha / screen-ttymouse.diff
Created May 20, 2013 15:05
vim ttymouse auto detection for GNU Screen/tmux
diff -r e56bf2af53c0 src/os_unix.c
--- a/src/os_unix.c Wed May 15 23:13:10 2013 +0200
+++ b/src/os_unix.c Tue May 21 00:04:11 2013 +0900
@@ -2190,6 +2190,7 @@
|| STRNICMP(name, "kterm", 5) == 0
|| STRNICMP(name, "mlterm", 6) == 0
|| STRNICMP(name, "rxvt", 4) == 0
+ || STRNICMP(name, "screen", 6) == 0
|| STRCMP(name, "builtin_xterm") == 0);
}
@saitoha
saitoha / left-right-margin.vim
Created June 12, 2013 16:10
Accelerate vim vsplit scrolling on pangoterm/xterm/tanasinn/RLogin.
let &t_ti = &t_ti . "\e[?6h\e[?69h"
let &t_te = "\e[?69l\e[?6l" . &t_te
let &t_CV = "\e[%i%p1%d;%p2%ds"
let &t_CS = "y"