Skip to content

Instantly share code, notes, and snippets.

@saitoha
saitoha / result.txt
Created November 14, 2012 10:11
wcwidth.js from tanasinn test
> node wcwidth_test_tanasinn.js
test: 8097ms
@saitoha
saitoha / origLICENSE.txt
Created November 14, 2012 10:30
wcwidth.js (https://npmjs.org/package/wcwidth.js) without underscore.js
wcwidth.js: JavaScript Portng of Markus Kuhn's wcwidth() Implementation
=======================================================================
Copyright (C) 2012 by Jun Woong.
This package is a JavaScript porting of Markus Kuhn's wcwidth()
implementation distributed on http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@saitoha
saitoha / tanasinnrc
Created November 15, 2012 16:34
Use <F10> instead of <2-Shift> ($HOME/.tanasinn/tanasinnrc or %USERPROFILE%¥.tanasinn¥tanasinnrc
nmap <F10> <cmode>
cmap <F10> <nmode>
nmap <2-Shift> <F50>
cmap <2-Shift> <F50>
@saitoha
saitoha / fix-termresponse.diff
Created November 24, 2012 05:29
Vim - Fix termresponse's auto-recognization issue (caused by patch 7.3.699 https://groups.google.com/forum/#!topic/vim_dev/u7c-Ad4xKrU)
diff -r fcca64585e2a src/term.c
--- a/src/term.c Fri Nov 23 21:54:48 2012 +0100
+++ b/src/term.c Sat Nov 24 14:25:45 2012 +0900
@@ -4081,7 +4081,7 @@
{
/* Only set 'ttymouse' automatically if it was not set
* by the user already. */
- if (!option_was_set((char_u *)"ttym"))
+ if (ttym_flags == TTYM_XTERM || !option_was_set((char_u *)"ttym"))
{
@saitoha
saitoha / xtermdump.py
Created December 5, 2012 10:24
screen dump on xterm#286
#!/usr/bin/env python
import sys, os, termios, select
def readcell(y, x):
import sys
sys.stdout.write("\x1b[;1;%d;%d;%d;%d*y" % (y, x, y, x))
sys.stdout.flush()
rfd, wfd, xfd = select.select([0], [], [], 2)
@saitoha
saitoha / openinw3m.js
Created December 18, 2012 10:47
[tanasinn plugin] Open a link in w3m. Put it to "{$HOME,$USERPROFILE}/.tanasinn/modules/desktop_components/".
/**
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
@saitoha
saitoha / gist:4327368
Created December 18, 2012 11:53
[sentimental-skk] vim integration (version 0.0.34 or later) http://pypi.python.org/pypi/sentimental-skk
let &t_ti = &t_ti . "\e[?8861h"
let &t_te = "\e[?8861l" . &t_te
map <special> <Esc>[8850~ <Nop>
imap <special> <Esc>[8850~ <Nop>
cmap <special> <Esc>[8850~ <Nop>
vmap <special> <Esc>[8850~ <Nop>
map <special> <Esc>[8851~ i
imap <special> <Esc>[8851~ <Nop>
@saitoha
saitoha / vtutil.vim
Created December 19, 2012 11:59
Check DA2/CPR response from vimscript
function! l:addchar(c)
let s:param .= a:c
return ''
endfunction
function! l:completeDA2()
unmap 0
unmap 1
unmap 2
unmap 3
@saitoha
saitoha / vtutil.el
Created December 19, 2012 12:27
Get DA2/CPR response from emacs-lisp
(defun get-da2 ()
(let ((str ""))
(send-string-to-terminal "\e[>c")
(while (not (equal (setq chr (read-event nil nil 2)) 99))
(setq str (concat str (string chr))))
(if (string-match ">\\([0-9;]+\\)$" str)
(setq params (match-string 1 str)))))
(defun get-cpr ()
(let ((str ""))
@saitoha
saitoha / iTerm2-title-stacking.diff
Created December 31, 2012 13:08
Support xterm's title stacking (iTerm2)
diff --git a/PTYSession.h b/PTYSession.h
index 1a24cfc..8c9caad 100644
--- a/PTYSession.h
+++ b/PTYSession.h
@@ -88,6 +88,12 @@ typedef enum {
// The window title that should be used when this session is current. Otherwise defaultName
// should be used.
NSString* windowTitle;
+
+ // The window title stack