├── .gitmodules ├── README.mkdn ├── bin ├── aws-ip-check ├── biggest.sh ├── cpan-module-list ├── cpan-package-list ├── cpanm-no-mirror ├── git-clone-with-cache ├── git-fix-username ├── git-issues ├── git-merge-back ├── git-pull-req ├── git-url ├── god ├── hankaku2zenkaku ├── json-diff ├── jwt ├── peco-do ├── perl-module-list ├── projectile-root-exec ├── projectile-root-perl ├── setup-anyenv ├── setup-connect ├── setup-ipcalc ├── setup-lltsv ├── setup-mergepbx ├── setup-mysql-build ├── setup-peco ├── tempdir ├── tempfile ├── tsv2csv.pl ├── upgrade-anyenv ├── webalize ├── xgrep └── zenkaku2hankaku ├── extlib └── bin │ ├── diff-highlight │ └── ostype ├── git └── config ├── iterm2 ├── com.googlecode.iterm2.plist └── default.json ├── osx └── setup.sh ├── perltidy └── rc ├── prove └── rc ├── screen └── rc ├── setup.pl ├── tmux └── conf ├── vim └── rc └── zsh ├── concat.pl ├── rc.sh └── src ├── alias.sh ├── common.sh ├── completion.sh ├── finalize.sh ├── function.sh ├── misc.sh └── prompt.sh /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "emacs"] 2 | path = emacs 3 | url = git@github.com:karupanerura/.emacs.d.git 4 | -------------------------------------------------------------------------------- /README.mkdn: -------------------------------------------------------------------------------- 1 | # what is this? 2 | 3 | おれおれdotfiles 4 | なぜだかわからないけどたくさんstarが付くdotfilesです 5 | 6 | # dotfiles 7 | * .zshrc 8 | * .perltidyrc 9 | * .proverc 10 | * .gitconfig 11 | * .tmux.conf 12 | * .screenrc 13 | * .vimrc 14 | * .emacs.d 15 | 16 | # usage 17 | ## fullbuild and install 18 | 1. ./setup.pl build 19 | 2. ./setup.pl install 20 | 21 | ## single build and install 22 | 1. ./setup.pl zshrc 23 | 2. ./setup.pl install 24 | 25 | # FAQ 26 | Q. バナナはおやつに入りますか? 27 | A. 君がそれを望むならば 28 | -------------------------------------------------------------------------------- /bin/aws-ip-check: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use feature qw/say/; 5 | 6 | use constant { 7 | AWS_IP_RANGE_URL => 'https://ip-ranges.amazonaws.com/ip-ranges.json', 8 | CACHE_PATH => (glob '~/.aws-ip-check-cache/'), 9 | 10 | CACHE_EXPIRATION_FOR_REVALIDATE => 10, # seconds 11 | }; 12 | 13 | use HTTP::Tiny; 14 | use HTTP::Date; 15 | use Net::SSLeay 1.49 (); # required to use TLS request by HTTP::Tiny 16 | use IO::Socket::SSL 1.42 (); # required to use TLS request by HTTP::Tiny 17 | use JSON::PP qw/encode_json decode_json/; 18 | use Net::IP::Match::Trie; 19 | 20 | my $matcher = Net::IP::Match::Trie->new(); 21 | { 22 | my $ip_range = get_aws_ip_range(); 23 | 24 | for my $def (@{ $ip_range->{prefixes} }) { 25 | next if $def->{service} eq 'AMAZON'; 26 | $matcher->add($def->{service} => [$def->{ip_prefix}]); 27 | } 28 | for my $def (@{ $ip_range->{prefixes} }) { 29 | next if $def->{service} ne 'AMAZON'; 30 | next if $matcher->match_ip($def->{ip_prefix} =~ s!/[0-9]+$!!r); 31 | $matcher->add($def->{service} => [$def->{ip_prefix}]); 32 | } 33 | } 34 | 35 | for my $ip (@ARGV) { 36 | my $result = $matcher->match_ip($ip) || 'non AWS service'; 37 | say "$result\t$ip"; 38 | } 39 | 40 | sub get_aws_ip_range { 41 | my $cache_info = CACHE_PATH.'ip-ranges.cache'; 42 | my $cache_data = CACHE_PATH.'ip-ranges.json'; 43 | 44 | my $read_from_cache = sub { 45 | open my $fh, '<', $cache_data 46 | or return; 47 | 48 | local $/; 49 | return decode_json(<$fh>); 50 | }; 51 | 52 | my $update_cache = sub { 53 | my $res = shift; 54 | 55 | my $fh; 56 | open $fh, '>', "$cache_data.tmp" or return; 57 | print $fh $res->{content}; 58 | close $fh or return; 59 | 60 | open $fh, '>', "$cache_info.tmp" or return; 61 | print $fh encode_json({ 62 | last_modified => $res->{headers}->{'last-modified'}, 63 | etag => $res->{headers}->{'etag'}, 64 | }); 65 | close $fh or return; 66 | 67 | rename "$cache_data.tmp", $cache_data; 68 | rename "$cache_info.tmp", $cache_info; 69 | }; 70 | 71 | my %headers; 72 | if (-f $cache_info && -f $cache_data) { 73 | open my $fh, '<', $cache_info; 74 | 75 | local $/; 76 | my $info = decode_json(<$fh>); 77 | $headers{'If-Modified-Since'} = $info->{last_modified} if $info->{last_modified}; 78 | $headers{'If-None-Match'} = $info->{etag} if $info->{etag}; 79 | } 80 | 81 | my $ua = HTTP::Tiny->new( 82 | timeout => 3, 83 | agent => 'aws-ip-check.pl', 84 | ); 85 | 86 | my $res = $ua->get(AWS_IP_RANGE_URL, { 87 | headers => \%headers, 88 | }); 89 | if ($res->{status} == 304) { 90 | my $data = $read_from_cache->(); 91 | return $data if $data; 92 | } elsif ($res->{status} != 200) { 93 | my $data = $read_from_cache->(); 94 | if ($data) { 95 | warn '[WARN] AWS IP Ranges API is unavailable, cached ip range is used.'; 96 | return $data; 97 | } 98 | require Data::Dumper; 99 | warn Data::Dumper::Dumper($res); 100 | die "[CRIT] AWS IP Ranges API is unavailable"; 101 | } 102 | 103 | $update_cache->($res); 104 | 105 | my $content = $res->{content}; 106 | return decode_json($content); 107 | } 108 | -------------------------------------------------------------------------------- /bin/biggest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #set -x 3 | set -e 4 | 5 | echo $1; 6 | if [ [!$1] -o ! -d $1 ]; then 7 | echo "Usage: $0 dir" &>2 8 | fi 9 | 10 | find_large_file () { 11 | BASEDIR=$1 12 | METADIR=$(perl -e 'print quotemeta($ARGV[0])' $BASEDIR) 13 | RESULT=$(du -s $BASEDIR/* | sort -nr | awk "\$2 !~ /^$METADIR\$/ { print \$0 }" | head -n 1) 14 | if [[ $RESULT ]]; then 15 | echo $RESULT 16 | DIR=$(echo $RESULT | awk '{print $2}') 17 | [ -d $DIR ] && find_large_file $DIR 18 | fi 19 | } 20 | 21 | find_large_file $1; 22 | -------------------------------------------------------------------------------- /bin/cpan-module-list: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | if [[ -f ~/.minicpan/modules/02packages.details.txt.gz ]]; then 3 | gunzip -c ~/.minicpan/modules/02packages.details.txt.gz | tail -n +10 | cut -d' ' -f1 4 | else 5 | echo 'this script required CPAN::Mini.' > /dev/stderr 6 | fi 7 | -------------------------------------------------------------------------------- /bin/cpan-package-list: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | if [[ -f ~/.minicpan/modules/02packages.details.txt.gz ]]; then 3 | gunzip -c ~/.minicpan/modules/02packages.details.txt.gz | tail -n +10 | awk '{print $3}' | cut -d/ -f4 | cut -d. -f1 | perl -pe 's/-v?[0-9]$//;s/-/::/g' | sort | uniq 4 | else 5 | echo 'this script required CPAN::Mini.' > /dev/stderr 6 | fi 7 | -------------------------------------------------------------------------------- /bin/cpanm-no-mirror: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | 5 | my $env = $ENV{PERL_CPANM_OPT}; 6 | $env =~ s/--mirror(?:\s+(?!file:)\S+|=(?:'(? @ARGV; 14 | -------------------------------------------------------------------------------- /bin/git-clone-with-cache: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | set -e 3 | # set -x 4 | 5 | URL=$1 6 | OUT=$2 7 | CACHE_DIR="/tmp/git-repo-cache/$( echo $URL | perl -pe 's{^(?:https?|git):}{}; tr{:}{/}; s{/+}{/}g' )" 8 | 9 | [[ -z $OUT ]] && OUT=`basename $URL | sed -e 's/\.git$//'` 10 | [[ -d $CACHE_DIR ]] || git clone --bare $URL $CACHE_DIR 11 | 12 | git --git-dir=$CACHE_DIR fetch 13 | git clone $CACHE_DIR $OUT 14 | git --git-dir=$OUT/.git remote set-url origin $URL 15 | -------------------------------------------------------------------------------- /bin/git-fix-username: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | 5 | use Getopt::Long qw/:config posix_default no_ignore_case bundling/; 6 | 7 | GetOptions( 8 | 'i|inplace' => \my $inplace_mode, 9 | ) or die "Usage: $0 [-i]"; 10 | if ($inplace_mode) { 11 | exec $^X, '-i', $0, @ARGV; 12 | die $!; 13 | } 14 | 15 | chomp(my $global_name = `git config --global --includes --get user.name`); 16 | chomp(my $global_email = `git config --global --includes --get user.email`); 17 | chomp(my $local_name = `git config --local --includes --get user.name`); 18 | chomp(my $local_email = `git config --local --includes --get user.email`); 19 | 20 | while (defined($_ = )) { 21 | if ($global_name ne $local_name) { 22 | s/\Q$global_name\E/$local_name/og; 23 | } 24 | if ($global_email ne $local_email) { 25 | s/\Q$global_email\E/$local_email/og; 26 | } 27 | } continue { 28 | print; 29 | } 30 | 31 | unless (defined $^I) { 32 | print $/ for 1..3; 33 | print '================ HINT ===================', $/; 34 | print 'To replace source document, run it with -i option :)', $/; 35 | print '=========================================', $/; 36 | print $/ for 1..3; 37 | } 38 | -------------------------------------------------------------------------------- /bin/git-issues: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | use 5.14.0; 6 | use File::Spec; 7 | use URI; 8 | use URI::Escape qw/uri_escape/; 9 | 10 | my $target_branch = shift @ARGV || 'master'; 11 | 12 | sub slurp { 13 | my $file = shift; 14 | open my $fh, '<:encoding(utf-8)', $file; 15 | local $/; 16 | return <$fh>; 17 | } 18 | 19 | sub hosts { 20 | my @url = map s/\s+$//sr, ; 21 | my $local = File::Spec->catfile(glob('~'), '.pull-req-able.local'); 22 | push @url => split /\n/, slurp($local) if -f $local; 23 | return @url; 24 | } 25 | 26 | sub remote { 27 | chomp(my $remote = `git config --get remote.origin.url`); 28 | return URI->new($remote); 29 | } 30 | 31 | my $remote = remote(); 32 | $remote = URI->new('ssh://'.($remote =~ s!:!/!r)) unless defined $remote->scheme; 33 | if (grep { $remote->host eq $_ } hosts()) { 34 | my $url = sprintf 'http://%s%s/issues', $remote->host, $remote->path =~ s/\.git$//r; 35 | say "Open: $url"; 36 | system open => $url if $^O eq 'darwin'; 37 | } 38 | 39 | __DATA__ 40 | github.com 41 | -------------------------------------------------------------------------------- /bin/git-merge-back: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | # set -x 4 | 5 | in_tree=`git rev-parse --is-inside-work-tree`; 6 | if [ "$in_tree" = "true" ]; then 7 | gitdir=`git rev-parse --git-dir` 8 | if [ -d $gitdir ]; then 9 | logfile=$gitdir/info/.branch.log 10 | test -d $gitdir/info || mkdir $gitdir/info 11 | if [ -f $logfile ]; then 12 | branch_name=`tail -n2 $logfile | head -n1` 13 | current_branch_name=`cat $gitdir/HEAD | cut -d/ -f 3-` 14 | echo "Merge branch '$branch_name' into $current_branch_name"; 15 | while true; do 16 | echo -n "ok? (y/n)> " 17 | read answer 18 | case $answer in 19 | [Yy]|[Yy][Ee][Ss]) 20 | break ;; 21 | [Nn]|[Nn][Oo]) 22 | exit ;; 23 | *) 24 | continue ;; 25 | esac 26 | done 27 | git merge $branch_name 28 | fi 29 | fi 30 | fi 31 | -------------------------------------------------------------------------------- /bin/git-pull-req: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | use 5.14.0; 6 | use File::Spec; 7 | use URI; 8 | use URI::Escape qw/uri_escape/; 9 | 10 | my $target_branch = shift @ARGV || 'master'; 11 | 12 | sub slurp { 13 | my $file = shift; 14 | open my $fh, '<:encoding(utf-8)', $file; 15 | local $/; 16 | return <$fh>; 17 | } 18 | 19 | sub hosts { 20 | my @url = map s/\s+$//sr, ; 21 | my $local = File::Spec->catfile(glob('~'), '.pull-req-able.local'); 22 | push @url => split /\n/, slurp($local) if -f $local; 23 | return @url; 24 | } 25 | 26 | sub remote { 27 | chomp(my $remote = `git config --get remote.origin.url`); 28 | return URI->new($remote); 29 | } 30 | 31 | sub current_branch { 32 | chomp(my $branch = `git rev-parse --abbrev-ref HEAD`); 33 | return $branch; 34 | } 35 | 36 | my $remote = remote(); 37 | $remote = URI->new('ssh://'.($remote =~ s!:!/!r)) unless defined $remote->scheme; 38 | if (grep { $remote->host eq $_ } hosts()) { 39 | my $url = sprintf 'http://%s%s/compare/%s...%s', $remote->host, $remote->path =~ s/\.git$//r, uri_escape($target_branch), uri_escape(current_branch()); 40 | say "Open: $url"; 41 | system open => $url if $^O eq 'darwin'; 42 | } 43 | 44 | __DATA__ 45 | github.com 46 | -------------------------------------------------------------------------------- /bin/git-url: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | use 5.14.0; 6 | use File::Spec; 7 | use URI; 8 | use URI::Escape qw/uri_escape/; 9 | 10 | my $remote = remote(); 11 | $remote = URI->new('ssh://'.($remote =~ s!:!/!r)) unless defined $remote->scheme; 12 | if (!grep { $remote->host eq $_ } hosts()) { 13 | warn 'Unknown remote host: '.$remote->host; 14 | exit 1; 15 | } 16 | 17 | my $target = shift @ARGV || 'HEAD'; 18 | if (-e $target) { 19 | my $target_file = $target; 20 | chomp(my $branch = `git symbolic-ref HEAD --short`); 21 | my $url = sprintf 'http://%s%s/tree/%s/%s', $remote->host, $remote->path =~ s/\.git//r, $branch, $target_file; 22 | system open => $url if $^O eq 'darwin'; 23 | say "$url"; 24 | } else { 25 | my $target_commit = $target; 26 | my $url = sprintf 'http://%s%s/commit/%s', $remote->host, $remote->path =~ s/\.git//r, commit_ref($target_commit); 27 | system open => $url if $^O eq 'darwin'; 28 | say "$url"; 29 | } 30 | exit 0; 31 | 32 | sub slurp { 33 | my $file = shift; 34 | open my $fh, '<:encoding(utf-8)', $file; 35 | local $/; 36 | return <$fh>; 37 | } 38 | 39 | sub hosts { 40 | my @url = map s/\s+$//sr, ; 41 | my $local = File::Spec->catfile(glob('~'), '.pull-req-able.local'); 42 | push @url => split /\n/, slurp($local) if -f $local; 43 | return @url; 44 | } 45 | 46 | sub remote { 47 | chomp(my $remote = `git config --get remote.origin.url`); 48 | return URI->new($remote); 49 | } 50 | 51 | sub commit_ref { 52 | my $commit = shift; 53 | chomp(my $ref = `git rev-parse $commit`); 54 | return $ref; 55 | } 56 | 57 | __DATA__ 58 | github.com 59 | -------------------------------------------------------------------------------- /bin/god: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "I am god." 3 | if [ "$1" = "status" ]; then 4 | echo "I'm as good as pie." 5 | exit 6 | fi 7 | sleep 1 8 | exec git "$@" 9 | -------------------------------------------------------------------------------- /bin/hankaku2zenkaku: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | use open ':std', ':encoding(utf-8)'; 6 | use Lingua::JA::Regular::Unicode qw/alnum_h2z space_h2z katakana_h2z/; 7 | $|=1; 8 | print+alnum_h2z+space_h2z+katakana_h2z($_) while <>; 9 | -------------------------------------------------------------------------------- /bin/json-diff: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | 6 | use Encode qw/encode_utf8/; 7 | use JSON::PP qw/decode_json/; 8 | use Scalar::Util qw/looks_like_number/; 9 | use File::Temp qw/tempfile/; 10 | use IO::Pipe; 11 | 12 | if (@ARGV != 2) { 13 | die "Usage: json-diff a.json b.json"; 14 | } 15 | 16 | my ($file_a, $file_b) = @ARGV; 17 | 18 | my $json_a = load_json($file_a); 19 | my $json_b = load_json($file_b); 20 | 21 | my $data_a = stringify_data_with_path($json_a); 22 | my $temp_a = File::Temp->new(); 23 | print $temp_a encode_utf8($data_a); 24 | 25 | my $data_b = stringify_data_with_path($json_b); 26 | my $temp_b = File::Temp->new(); 27 | print $temp_b encode_utf8($data_b); 28 | 29 | my $diff_cmd = which('colordiff'); 30 | $diff_cmd = which('diff') unless $diff_cmd; 31 | 32 | 33 | my $diff_pipe = IO::Pipe->new(); 34 | $diff_pipe->reader($diff_cmd, '-u', $temp_a->filename, $temp_b->filename); 35 | 36 | my $highlight_pipe = \*STDOUT; 37 | if (my $dhl = which('diff-highlight')) { 38 | $highlight_pipe = IO::Pipe->new(); 39 | $highlight_pipe->writer($dhl); 40 | } 41 | 42 | while (defined($_ = <$diff_pipe>)) { 43 | print $highlight_pipe $_; 44 | } 45 | 46 | $temp_a->close(); 47 | $temp_b->close(); 48 | 49 | exit; 50 | 51 | sub which { 52 | my $cmd = shift; 53 | my $path = `which $cmd`; 54 | chomp $path; 55 | return $path; 56 | } 57 | 58 | sub load_json { 59 | my $file = shift; 60 | open my $fh, '<', $file 61 | or die $!; 62 | 63 | local $/; 64 | return decode_json <$fh>; 65 | } 66 | 67 | sub stringify_data_with_path { 68 | my $d = shift; 69 | return _stringify_data_with_path('', $d); 70 | } 71 | 72 | sub _stringify_data_with_path { 73 | my ($path, $d) = @_; 74 | 75 | if (ref $d eq 'HASH') { 76 | my $r = ''; 77 | for my $k (sort keys %$d) { 78 | $r .= _stringify_data_with_path("$path/$k", $d->{$k}); 79 | } 80 | return $r; 81 | } elsif (ref $d eq 'ARRAY') { 82 | my $r = ''; 83 | for my $i (keys @$d) { 84 | $r .= _stringify_data_with_path("$path/$i", $d->[$i]); 85 | } 86 | return $r; 87 | } elsif (not defined $d) { 88 | return "$path\tnull\n"; 89 | } elsif (JSON::PP::is_bool($d)) { 90 | my $s = $d ? 'true' : 'false'; 91 | return "$path\t$s\n"; 92 | } elsif (looks_like_number($d)) { 93 | return "$path\t$d\n"; 94 | } else { 95 | my $s = qq!"$d"!; 96 | return "$path\t$s\n"; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /bin/jwt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | use feature qw/say/; 6 | 7 | use JSON::PP qw/decode_json/; 8 | use MIME::Base64 qw/decode_base64url/; 9 | 10 | my $JSON = JSON::PP->new->utf8->pretty->canonical; 11 | 12 | if (-p STDIN) { 13 | until (eof STDIN) { 14 | chomp($_ = ); 15 | if (/^[-a-zA-Z0-9_]+\.[-a-zA-Z0-9_]+\.[-a-zA-Z0-9_]+/) { 16 | print for map $JSON->encode($_), parse_jwt($_); 17 | } else { 18 | print; 19 | print $/; 20 | } 21 | } 22 | } else { 23 | print for map $JSON->encode($_), map parse_jwt($_), map try_slurp($_), @ARGV; 24 | } 25 | 26 | exit; 27 | 28 | sub parse_jwt { 29 | my $jwt = shift; 30 | my ($header, $payload, $signature) = split /\./, $jwt; 31 | return ( 32 | decode_json(decode_base64url($header)), 33 | decode_json(decode_base64url($payload)), 34 | { signature => $signature }, 35 | ); 36 | } 37 | 38 | sub try_slurp { 39 | my $target = shift; 40 | return $target unless -f $target; 41 | 42 | my $file = $target; 43 | open my $fh, '<', $file 44 | or die $!; 45 | 46 | local $/; 47 | return <$fh>; 48 | } 49 | -------------------------------------------------------------------------------- /bin/peco-do: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | CMD=`perl -E 'say for @ARGV' $commands | xargs basename | peco` 3 | vared -p "> $CMD " -c ARGS 4 | exec $CMD $ARGS 5 | -------------------------------------------------------------------------------- /bin/perl-module-list: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use feature qw/say/; 5 | 6 | use File::Find qw/find/; 7 | use File::Spec; 8 | 9 | my @inc = map { File::Spec->canonpath($_) } grep { -d && $_ ne '.' } @INC; 10 | my %inc = map { $_ => 1 } @inc; 11 | 12 | my %modules; 13 | for my $path (@inc) { 14 | find +{ 15 | wanted => sub { 16 | $File::Find::prune = 1 if -d && $inc{$_} && $_ ne $path; 17 | return if -d; 18 | return unless s/\.pm\z//; 19 | 20 | $_ = File::Spec->abs2rel($_, $path); 21 | my $module = join '::', File::Spec->splitdir($_); 22 | say $module unless $modules{$module}++; 23 | }, 24 | no_chdir => 1, 25 | follow => 1, 26 | follow_skip => 2, 27 | } => $path; 28 | } 29 | -------------------------------------------------------------------------------- /bin/projectile-root-exec: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd `emacsclient -e '(cond ((projectile-project-p) (projectile-project-root)) (t "."))' | sed -e 's/^"//; s!/*"$!!'` 3 | exec "$@" 4 | -------------------------------------------------------------------------------- /bin/projectile-root-perl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec projectile-root-exec perl -I$PWD -I$PWD/lib -I$PWD/site_perl -Mblib -Mlib=$PWD/local/lib/perl5 "$@" 3 | -------------------------------------------------------------------------------- /bin/setup-anyenv: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | 5 | if [ ! -d ~/.anyenv ]; then 6 | git clone https://github.com/riywo/anyenv ~/.anyenv 7 | echo '# anyenv' >> ~/.zprofile 8 | echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.zprofile 9 | echo 'eval "$(anyenv init -)"' >> ~/.zprofile 10 | 11 | export PATH="$HOME/.anyenv/bin:$PATH" 12 | eval "$(anyenv init -)" 13 | fi 14 | 15 | for env in $@; do 16 | if [ -d "$HOME/.anyenv/envs/$env" ]; then 17 | echo "already installed: $env" 18 | else 19 | anyenv install $env 20 | fi 21 | done 22 | -------------------------------------------------------------------------------- /bin/setup-connect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | set -ue 3 | tempdir=`tempfile` 4 | rm $tempdir 5 | mkdir $tempdir 6 | cd $tempdir 7 | 8 | wget -q ftp://ftp.st.ryukoku.ac.jp/pub/security/tool/openssh-supports/connect.c 9 | mkdir -p ~/local/bin 10 | clang connect.c -o $HOME/local/bin/connect -lresolv -O2 11 | 12 | cd - 13 | rm $tempdir 14 | -------------------------------------------------------------------------------- /bin/setup-ipcalc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | 5 | VERSION=0.41 6 | curl -fsSL -o $HOME/local/bin/ipcalc http://jodies.de/ipcalc-archive/ipcalc-$VERSION/ipcalc 7 | chmod +x $HOME/local/bin/ipcalc 8 | -------------------------------------------------------------------------------- /bin/setup-lltsv: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ue 3 | 4 | version=v0.6.1 5 | os=$(uname -s | perl -pe '$_=lc$_') 6 | arch=amd64 7 | 8 | curl -sfL https://github.com/sonots/lltsv/releases/download/${version}/lltsv_${os}_${arch} -o ~/local/bin/lltsv 9 | chmod +x ~/local/bin/lltsv 10 | -------------------------------------------------------------------------------- /bin/setup-mergepbx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | 5 | PYENV_VERSION=2.7.9 6 | pyenv version 7 | 8 | if [ ! -d ~/.mergepbx ]; then 9 | git clone https://github.com/simonwagner/mergepbx ~/.mergepbx 10 | cd ~/.mergepbx 11 | else 12 | cd ~/.mergepbx 13 | git reset --hard 14 | git clean -dxf 15 | git pull 16 | fi 17 | 18 | ./build.py 19 | chmod +x mergepbx 20 | cp mergepbx $HOME/local/bin 21 | -------------------------------------------------------------------------------- /bin/setup-mysql-build: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | git clone git://github.com/kamipo/mysql-build.git $HOME/.mysql-build 5 | mkdir -p $HOME/local/bin 6 | ln -fs $HOME/.mysql-build/bin/* $HOME/local/bin 7 | -------------------------------------------------------------------------------- /bin/setup-peco: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | 5 | VERSION=v0.5.1 6 | 7 | eval `go tool dist env` 8 | tempdir=`tempdir` 9 | curl -fsSL -o $tempdir/peco.tar.gz https://github.com/peco/peco/releases/download/$VERSION/peco_${GOOS}_${GOARCH}.tar.gz 10 | 11 | cd $tempdir 12 | tar zxf peco.tar.gz 13 | mv peco_*/peco $HOME/local/bin/peco 14 | chmod +x $HOME/local/bin/peco 15 | cd $HOME 16 | 17 | rm -rf $tempdir 18 | -------------------------------------------------------------------------------- /bin/tempdir: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use File::Temp qw/tempdir/; 5 | 6 | my $dirname = tempdir(CLEANUP => 0); 7 | print $dirname, $/; 8 | -------------------------------------------------------------------------------- /bin/tempfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use File::Temp qw/tempfile/; 5 | 6 | my (undef, $filename) = tempfile(CLEANUP => 0); 7 | print $filename, $/; 8 | -------------------------------------------------------------------------------- /bin/tsv2csv.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | 6 | use Encode; 7 | use Text::CSV_XS qw/csv/; 8 | 9 | my $file = shift; 10 | open my $fh, '<', $file 11 | or die $!; 12 | 13 | my $csv = Text::CSV_XS->new({ binary => 1, auto_diag => 1, escape_char => "\\" }); 14 | until (eof $fh) { 15 | my $line = <$fh>; 16 | chomp $line; 17 | 18 | my @row = split /\t/, $line; 19 | $csv->say(*STDOUT, \@row); 20 | } 21 | -------------------------------------------------------------------------------- /bin/upgrade-anyenv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | set -e 3 | set -u 4 | 5 | function upgrade { 6 | cd $1 7 | echo "### upgrade $1 ..." 8 | git fetch -qp 9 | git pull -q origin master 10 | if [[ -d plugins ]]; then 11 | for plugin in `find plugins -maxdepth 1 -type d`; do 12 | [[ $plugin != 'plugins' ]] && upgrade $plugin & 13 | done 14 | wait 15 | fi 16 | cd - 17 | } 18 | 19 | cd $HOME 20 | upgrade .anyenv & 21 | 22 | cd .anyenv 23 | for dir in `anyenv envs`; do 24 | upgrade envs/$dir & 25 | done 26 | wait 27 | -------------------------------------------------------------------------------- /bin/webalize: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | use feature qw/say/; 6 | 7 | use Getopt::Long ':config' => qw/posix_default no_ignore_case bundling/; 8 | use Net::EmptyPort qw/empty_port/; 9 | use Plack::Loader; 10 | use Cwd qw/realpath/; 11 | 12 | Plack::MIME->add_type(".wasm" => "application/wasm"); 13 | 14 | GetOptions( 15 | 'h|host=s' => \my $host, 16 | 'p|port=i' => \my $port, 17 | ) or exit 1; 18 | $host = '0.0.0.0' unless $host; 19 | $port = empty_port() unless $port; 20 | 21 | my $root = realpath(shift @ARGV || '.'); 22 | system 'open', "http://$host:$port/" if $^O eq 'darwin'; 23 | say "HTTP::Server::PSGI: Accepting connections at http://$host:$port/"; 24 | say "mount: $root"; 25 | 26 | package My::Plack::App::Directory { 27 | use parent qw/Plack::App::Directory/; 28 | use File::Spec::Functions; 29 | 30 | sub serve_path { 31 | my($self, $env, $dir, $fullpath) = @_; 32 | 33 | if (-f $dir) { 34 | return $self->SUPER::serve_path($env, $dir, $fullpath); 35 | } 36 | 37 | if ($env->{PATH_INFO} =~ m{/$}) { 38 | for my $index_file (qw/index.html/) { 39 | my $f = catfile($dir, $index_file); 40 | return $self->SUPER::serve_path($env, $f, $fullpath) if -f $f; 41 | } 42 | } 43 | 44 | return $self->SUPER::serve_path($env, $dir, $fullpath); 45 | } 46 | }; 47 | 48 | my $app = My::Plack::App::Directory->new(root => $root)->to_app; 49 | Plack::Loader->auto(host => $host, port => $port)->run($app); 50 | -------------------------------------------------------------------------------- /bin/xgrep: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | use feature 'say'; 6 | 7 | use HTML::TreeBuilder::XPath; 8 | use File::Slurp qw/read_file read_dir/; 9 | use File::Spec::Functions qw/catfile/; 10 | use Getopt::Long (); 11 | use Pod::Usage; 12 | use Try::Tiny; 13 | 14 | my %OPTS; 15 | main(@ARGV); 16 | exit; 17 | 18 | sub getopt_spec { 19 | return ( 20 | 'verbose', 21 | 'help', 22 | 'recursive|r' 23 | ); 24 | } 25 | 26 | sub main { 27 | local @ARGV = @_; 28 | 29 | my %opts; 30 | my $success = Getopt::Long::Parser->new( 31 | config => [qw( 32 | no_ignore_case 33 | bundling 34 | no_auto_abbrev 35 | )], 36 | )->getoptions(\%opts => getopt_spec()); 37 | 38 | if (not $success or $opts{help}) { 39 | pod2usage($success ? 0 : 1); 40 | } 41 | 42 | run(\%opts, @ARGV); 43 | } 44 | 45 | sub run { 46 | my ($opts, $xpath, @files) = @_; 47 | push @files => \*STDIN unless @files; 48 | 49 | my $to_key = sub { ref($_) eq 'GLOB' ? fh2path($_) : $_ }; 50 | my %file_map = map { 51 | $to_key->($_) => scalar read_file($_, binmode => ':raw') 52 | } map { 53 | (not(ref $_) and $opts->{recursive} and -d $_) ? read_dir_recursive($_) : $_; 54 | } @files; 55 | 56 | for my $filepath (keys %file_map) { 57 | my $text = $file_map{$filepath}; 58 | 59 | try { 60 | my $tree = HTML::TreeBuilder::XPath->new; 61 | $tree->parse($text); 62 | $tree->eof; 63 | 64 | my @nodes = $tree->findnodes($xpath); 65 | say "$filepath: ", $_ for dump_nodes(@nodes); 66 | 67 | $tree->delete; 68 | } 69 | catch { 70 | warn "skip: $filepath"; 71 | warn $_ if $opts->{verbose}; 72 | }; 73 | } 74 | } 75 | 76 | sub read_dir_recursive { 77 | my $dir = shift; 78 | 79 | my @matches = map { catfile $dir, $_ } read_dir($dir); 80 | my @files = grep { -f $_ } @matches; 81 | my @dirs = grep { -d $_ } @matches; 82 | 83 | return (@files, map { read_dir_recursive($_) } @dirs); 84 | } 85 | 86 | sub fh2path { 87 | my $fh = shift; 88 | return readlink sprintf('/proc/%d/fd/%d', $$, fileno($fh)); 89 | } 90 | 91 | sub dump_nodes { 92 | my @text; 93 | for my $node (@_) { 94 | push @text => dump_node($node); 95 | } 96 | return @text; 97 | } 98 | 99 | sub dump_node { 100 | my $node = shift; 101 | if ($node->isa('HTML::Element')) { 102 | return split /[\r\n]+/, $node->as_HTML(); 103 | } 104 | elsif ($node->isa('HTML::TreeBuilder::XPath::Node')) { 105 | # ???: return split /[\r\n]+/, map { $_->as_HTML() } $node->getChildNodes(); 106 | die "HTML::TreeBuilder::XPath::Node is not supported. TODO."; 107 | } 108 | else { 109 | die "unknown node: @{[ ref $node || $node ]}"; 110 | } 111 | } 112 | 113 | __END__ 114 | 115 | =head1 NAME 116 | 117 | xgrep - grep with xpath 118 | 119 | =head1 SYNOPSIS 120 | 121 | xgrep '//a[href="/"]' **/*.xml 122 | 123 | Options: 124 | --help brief help message 125 | --verbose verbose output 126 | 127 | =head1 DESCRIPTION 128 | 129 | xpathでxml/htmlを絞り込む君。夜食のお供に。 130 | 131 | =cut 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /bin/zenkaku2hankaku: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | use open ':std', ':encoding(utf-8)'; 6 | use Lingua::JA::Regular::Unicode qw/alnum_z2h space_z2h katakana_z2h/; 7 | $|=1; 8 | print+alnum_z2h+space_z2h+katakana_z2h($_) while <>; 9 | -------------------------------------------------------------------------------- /extlib/bin/diff-highlight: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use warnings FATAL => 'all'; 4 | use strict; 5 | 6 | # Highlight by reversing foreground and background. You could do 7 | # other things like bold or underline if you prefer. 8 | my $HIGHLIGHT = "\x1b[7m"; 9 | my $UNHIGHLIGHT = "\x1b[27m"; 10 | my $COLOR = qr/\x1b\[[0-9;]*m/; 11 | my $BORING = qr/$COLOR|\s/; 12 | 13 | my @removed; 14 | my @added; 15 | my $in_hunk; 16 | 17 | while (<>) { 18 | if (!$in_hunk) { 19 | print; 20 | $in_hunk = /^$COLOR*\@/; 21 | } 22 | elsif (/^$COLOR*-/) { 23 | push @removed, $_; 24 | } 25 | elsif (/^$COLOR*\+/) { 26 | push @added, $_; 27 | } 28 | else { 29 | show_hunk(\@removed, \@added); 30 | @removed = (); 31 | @added = (); 32 | 33 | print; 34 | $in_hunk = /^$COLOR*[\@ ]/; 35 | } 36 | 37 | # Most of the time there is enough output to keep things streaming, 38 | # but for something like "git log -Sfoo", you can get one early 39 | # commit and then many seconds of nothing. We want to show 40 | # that one commit as soon as possible. 41 | # 42 | # Since we can receive arbitrary input, there's no optimal 43 | # place to flush. Flushing on a blank line is a heuristic that 44 | # happens to match git-log output. 45 | if (!length) { 46 | local $| = 1; 47 | } 48 | } 49 | 50 | # Flush any queued hunk (this can happen when there is no trailing context in 51 | # the final diff of the input). 52 | show_hunk(\@removed, \@added); 53 | 54 | exit 0; 55 | 56 | sub show_hunk { 57 | my ($a, $b) = @_; 58 | 59 | # If one side is empty, then there is nothing to compare or highlight. 60 | if (!@$a || !@$b) { 61 | print @$a, @$b; 62 | return; 63 | } 64 | 65 | # If we have mismatched numbers of lines on each side, we could try to 66 | # be clever and match up similar lines. But for now we are simple and 67 | # stupid, and only handle multi-line hunks that remove and add the same 68 | # number of lines. 69 | if (@$a != @$b) { 70 | print @$a, @$b; 71 | return; 72 | } 73 | 74 | my @queue; 75 | for (my $i = 0; $i < @$a; $i++) { 76 | my ($rm, $add) = highlight_pair($a->[$i], $b->[$i]); 77 | print $rm; 78 | push @queue, $add; 79 | } 80 | print @queue; 81 | } 82 | 83 | sub highlight_pair { 84 | my @a = split_line(shift); 85 | my @b = split_line(shift); 86 | 87 | # Find common prefix, taking care to skip any ansi 88 | # color codes. 89 | my $seen_plusminus; 90 | my ($pa, $pb) = (0, 0); 91 | while ($pa < @a && $pb < @b) { 92 | if ($a[$pa] =~ /$COLOR/) { 93 | $pa++; 94 | } 95 | elsif ($b[$pb] =~ /$COLOR/) { 96 | $pb++; 97 | } 98 | elsif ($a[$pa] eq $b[$pb]) { 99 | $pa++; 100 | $pb++; 101 | } 102 | elsif (!$seen_plusminus && $a[$pa] eq '-' && $b[$pb] eq '+') { 103 | $seen_plusminus = 1; 104 | $pa++; 105 | $pb++; 106 | } 107 | else { 108 | last; 109 | } 110 | } 111 | 112 | # Find common suffix, ignoring colors. 113 | my ($sa, $sb) = ($#a, $#b); 114 | while ($sa >= $pa && $sb >= $pb) { 115 | if ($a[$sa] =~ /$COLOR/) { 116 | $sa--; 117 | } 118 | elsif ($b[$sb] =~ /$COLOR/) { 119 | $sb--; 120 | } 121 | elsif ($a[$sa] eq $b[$sb]) { 122 | $sa--; 123 | $sb--; 124 | } 125 | else { 126 | last; 127 | } 128 | } 129 | 130 | if (is_pair_interesting(\@a, $pa, $sa, \@b, $pb, $sb)) { 131 | return highlight_line(\@a, $pa, $sa), 132 | highlight_line(\@b, $pb, $sb); 133 | } 134 | else { 135 | return join('', @a), 136 | join('', @b); 137 | } 138 | } 139 | 140 | sub split_line { 141 | local $_ = shift; 142 | return map { /$COLOR/ ? $_ : (split //) } 143 | split /($COLOR*)/; 144 | } 145 | 146 | sub highlight_line { 147 | my ($line, $prefix, $suffix) = @_; 148 | 149 | return join('', 150 | @{$line}[0..($prefix-1)], 151 | $HIGHLIGHT, 152 | @{$line}[$prefix..$suffix], 153 | $UNHIGHLIGHT, 154 | @{$line}[($suffix+1)..$#$line] 155 | ); 156 | } 157 | 158 | # Pairs are interesting to highlight only if we are going to end up 159 | # highlighting a subset (i.e., not the whole line). Otherwise, the highlighting 160 | # is just useless noise. We can detect this by finding either a matching prefix 161 | # or suffix (disregarding boring bits like whitespace and colorization). 162 | sub is_pair_interesting { 163 | my ($a, $pa, $sa, $b, $pb, $sb) = @_; 164 | my $prefix_a = join('', @$a[0..($pa-1)]); 165 | my $prefix_b = join('', @$b[0..($pb-1)]); 166 | my $suffix_a = join('', @$a[($sa+1)..$#$a]); 167 | my $suffix_b = join('', @$b[($sb+1)..$#$b]); 168 | 169 | return $prefix_a !~ /^$COLOR*-$BORING*$/ || 170 | $prefix_b !~ /^$COLOR*\+$BORING*$/ || 171 | $suffix_a !~ /^$BORING*$/ || 172 | $suffix_b !~ /^$BORING*$/; 173 | } 174 | -------------------------------------------------------------------------------- /extlib/bin/ostype: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### copied from App::llenv 3 | ### Author: riywo 4 | ### https://github.com/riywo/App-llenv 5 | [ -r /etc/lsb-release ] && . /etc/lsb-release 6 | if [ "$OSTYPE" = "linux-gnu" ]; then 7 | LSB_ID=`lsb_release -i | cut -f2 -d:` 8 | LSB_VERSION=`lsb_release -r | cut -f2 -d:` 9 | OS_VERSION=`echo $LSB_ID-$LSB_VERSION | sed -e "s/ //g"` 10 | MACHINE_TYPE=`uname -m` 11 | echo $OS_VERSION-$MACHINE_TYPE 12 | else 13 | echo `uname -rsm | sed -e "s/ /-/g"` 14 | fi 15 | -------------------------------------------------------------------------------- /git/config: -------------------------------------------------------------------------------- 1 | [include] 2 | path = .gitconfig.local 3 | [includeIf "gitdir:~/.go/src/github.com/"] 4 | path = ~/.gitconfig.public 5 | [includeIf "gitdir:~/src/github.com/"] 6 | path = ~/.gitconfig.public 7 | [core] 8 | editor = vim 9 | pager = less 10 | whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol 11 | excludesfile = ~/.gitignore 12 | [color] 13 | ui = always 14 | branch = auto 15 | diff = auto 16 | status = auto 17 | interactive = auto 18 | grep = auto 19 | [color "branch"] 20 | current = yellow reverse 21 | local = yellow 22 | remote = green 23 | [color "diff"] 24 | meta = yellow bold 25 | frag = magenta bold 26 | old = red bold 27 | new = green bold 28 | [color "status"] 29 | added = yellow 30 | changed = green 31 | untracked = cyan 32 | [column] 33 | ui = auto 34 | [branch] 35 | autosetupmerge = false 36 | autosetuprebase = always 37 | sort = -committerdate 38 | [tag] 39 | sort = version:refname 40 | [diff] 41 | algorithm = histogram 42 | colorMoved = plain 43 | mnemonicPrefix = true 44 | renames = true 45 | [commit] 46 | verbose = true 47 | [rebase] 48 | stat = true 49 | autoSquash = true 50 | autoStash = true 51 | updateRefs = true 52 | [merge] 53 | stat = true 54 | ff = false 55 | [merge "mergepbx"] 56 | name = XCode project files merger 57 | driver = ~/local/bin/mergepbx %O %A %B 58 | [alias] 59 | enable-fs-monitor = "!git config core.fsmonitor true && git config core.untrackedCache true" 60 | list-alias = "!git config --list | perl -F\\\\. -ane 'printf \"%-20s%s\", split \"=\", join(\".\", @F[1..@F-1]), 2 if $F[0] eq \"alias\"'" 61 | st = status 62 | ci = commit 63 | br = branch 64 | co = checkout 65 | cor = checkout-recursive 66 | checkout-recursive = "git checkout \"$@\" && git submodule update --init --recursive" 67 | clean-untracked = "!git ls-files --others --exclude-standard | xargs rm" 68 | co-hist-peco = "!git checkout `git history -n50 | sort | uniq -c | sort -nr | awk '{print $2}' | peco`" 69 | co-peco = "!f () { cd `git rev-parse --git-dir`; find refs/heads -type f | cut -d/ -f 3- | peco; }; git switch `f`" 70 | co-peco-by-remote = "!f () { cd `git rev-parse --git-dir`; git branch -r --list | awk '$1 != \"origin/HEAD\" {print $1}' | cut -d/ -f2- | peco; }; branch=`f`; git switch -t origin/$branch || git switch $branch" 71 | df = diff 72 | dfc = diff --cached 73 | dw = diff -w --word-diff 74 | dwc = diff -w --word-diff --cached 75 | lg = log -p 76 | url = config --get remote.origin.url 77 | tree = log --graph --pretty='format:%C(yellow)%h%Creset %s %Cgreen(%an)%Creset %Cred%d%Creset' 78 | wt = whatchanged --stat 79 | ck = "!git --no-pager diff --diff-filter=ACMRX --name-only --no-color HEAD | egrep '\\.(t|p([lm]|sgi))$' | xargs -n 1 -P2 perl -wc" 80 | fetch-pulls = fetch origin +refs/pull/*:refs/remotes/pull/* 81 | branch-name = symbolic-ref --short HEAD 82 | cv = "!f() { git cherry \"$@\" | perl -ane 'print $F[0], \" \", `git --no-pager show --date=short --no-notes --pretty=\"%h %Cgreen%cd %Cblue%cn%x09%Creset%s\" -s $F[1]`' ; }; f" 83 | history = "!f() { git --no-pager reflog | awk '$3 == \"checkout:\" && /moving from/ {print $8}' | uniq | head \"$@\"; }; f \"$@\"" 84 | log-ticket-id = "!f() { git log --format=%s \"$@\" | perl -ne 'print if /refs #([0-9]+)/ && $tid != $1 and $tid = $1' | head -n10 ; }; f \"$@\"" 85 | rollback-typechange = "!git diff --name-only --diff-filter=T \"$@\" | xargs git co --" 86 | force-unlock = "!git rev-parse --is-inside-work-tree > /dev/null && rm -i `git rev-parse --git-dir`/index.lock" 87 | log-quarter = "!f() { git log --no-merges --format='%h %ai (%aN) %s' --author=$USER --author=karupanerura --author=\"`git config --get --includes user.name`\" --after=`ruby -rdate -e 'now = Time.now; month = [3,6,9,12][((now.month - 1) / 3)]; dt = Date.new(now.year, month, 1) << 3; puts dt'` --before=`ruby -rdate -e 'now = Time.now; month = [3,6,9,12][((now.month - 1) / 3)]; dt = (Date.new(now.year, month, 1) >> 1) - 1; puts dt'` \"$@\" ; }; f \"$@\"" 88 | wild = "!echo get wild" 89 | [fetch] 90 | prune = true 91 | pruneTags = true 92 | all = true 93 | [push] 94 | default = simple 95 | autoSetupRemote = true 96 | followTags = true 97 | [pull] 98 | rebase = true 99 | [rerere] 100 | enabled = true 101 | autoupdate = true 102 | [grep] 103 | lineNumber = true 104 | [help] 105 | autocorrect = prompt 106 | [github] 107 | user = karupanerura 108 | [pager] 109 | log = diff-highlight | less 110 | show = diff-highlight | less 111 | diff = diff-highlight | less 112 | [filter "lfs"] 113 | process = git-lfs filter-process 114 | required = true 115 | clean = git-lfs clean -- %f 116 | smudge = git-lfs smudge -- %f 117 | [lfs "https://github.com"] 118 | locksverify = true 119 | [ghq] 120 | root = "~/src" 121 | [init] 122 | defaultBranch = main 123 | -------------------------------------------------------------------------------- /iterm2/com.googlecode.iterm2.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AdjustWindowForFontSizeChange 6 | 7 | AllowClipboardAccess 8 | 9 | AlternateMouseScroll 10 | 11 | AnimateDimming 12 | 13 | AppleAntiAliasingThreshold 14 | 1 15 | AppleScrollAnimationEnabled 16 | 0 17 | AppleSmoothFixedFontsSizeThreshold 18 | 1 19 | AppleWindowTabbingMode 20 | manual 21 | AutoHideTmuxClientSession 22 | 23 | CheckTestRelease 24 | 25 | ClosingHotkeySwitchesSpaces 26 | 27 | CommandSelection 28 | 29 | Control 30 | 1 31 | CopyLastNewline 32 | 33 | CopySelection 34 | 35 | Default Bookmark Guid 36 | 2B9C0B52-CE92-4896-96A8-0DF92283C316 37 | DimBackgroundWindows 38 | 39 | DimInactiveSplitPanes 40 | 41 | DimOnlyText 42 | 43 | DisableFullscreenTransparency 44 | 45 | DoubleClickPerformsSmartSelection 46 | 47 | EnableRendezvous 48 | 49 | FocusFollowsMouse 50 | 51 | FsTabDelay 52 | 1 53 | HapticFeedbackForEsc 54 | 55 | HiddenAFRStrokeThickness 56 | 0.0 57 | HiddenAdvancedFontRendering 58 | 59 | HideActivityIndicator 60 | 61 | HideMenuBarInFullscreen 62 | 63 | HideScrollbar 64 | 65 | HideTab 66 | 67 | HighlightTabLabels 68 | 69 | HotKeyBookmark 70 | 2B9C0B52-CE92-4896-96A8-0DF92283C316 71 | HotKeyTogglesWindow 72 | 73 | Hotkey 74 | 75 | HotkeyChar 76 | 0 77 | HotkeyCode 78 | 0 79 | HotkeyMigratedFromSingleToMulti 80 | 81 | HotkeyModifiers 82 | 0 83 | IRMemory 84 | 4 85 | JobName 86 | 87 | LeftCommand 88 | 7 89 | LeftOption 90 | 2 91 | LoadPrefsFromCustomFolder 92 | 93 | MaxVertically 94 | 95 | NSNavLastRootDirectory 96 | ~/dotfiles/iterm2 97 | NSNavPanelExpandedSizeForOpenMode 98 | {712, 448} 99 | NSQuotedKeystrokeBinding 100 | 101 | NSRepeatCountBinding 102 | 103 | NSScrollAnimationEnabled 104 | 105 | NSScrollViewShouldScrollUnderTitlebar 106 | 107 | NSSplitView Subview Frames NSColorPanelSplitView 108 | 109 | 0.000000, 0.000000, 224.000000, 258.000000, NO, NO 110 | 0.000000, 259.000000, 224.000000, 48.000000, NO, NO 111 | 112 | NSTableView Columns v2 KeyBingingTable 113 | 114 | YnBsaXN0MDDUAQIDBAUGNjdYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 115 | AAGGoK4HCA8aGxwdHh8gJjAxMlUkbnVsbNIJCgsOWk5TLm9iamVjdHNWJGNsYXNzogwN 116 | gAKACoAN0xAJChEVGVdOUy5rZXlzoxITFIADgASABaMWFxiABoAHgAiACVpJZGVudGlm 117 | aWVyVVdpZHRoVkhpZGRlblEwI0BowAAAAAAACNIhIiMkWiRjbGFzc25hbWVYJGNsYXNz 118 | ZXNcTlNEaWN0aW9uYXJ5oiMlWE5TT2JqZWN00xAJCicrGaMSExSAA4AEgAWjLC0YgAuA 119 | DIAIgAlRMSNAdKGdsi0OVtIhIjM0Xk5TTXV0YWJsZUFycmF5ozM1JVdOU0FycmF5XxAP 120 | TlNLZXllZEFyY2hpdmVy0Tg5VUFycmF5gAEACAARABoAIwAtADIANwBGAEwAUQBcAGMA 121 | ZgBoAGoAbABzAHsAfwCBAIMAhQCJAIsAjQCPAJEAnACiAKkAqwC0ALUAugDFAM4A2wDe 122 | AOcA7gDyAPQA9gD4APwA/gEAAQIBBAEGAQ8BFAEjAScBLwFBAUQBSgAAAAAAAAIBAAAA 123 | AAAAADoAAAAAAAAAAAAAAAAAAAFM 124 | 125 | NSTableView Sort Ordering v2 KeyBingingTable 126 | 127 | YnBsaXN0MDDUAQIDBAUGFBVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 128 | AAGGoKMHCA1VJG51bGzSCQoLDFpOUy5vYmplY3RzViRjbGFzc6CAAtIODxARWiRjbGFz 129 | c25hbWVYJGNsYXNzZXNeTlNNdXRhYmxlQXJyYXmjEBITV05TQXJyYXlYTlNPYmplY3Rf 130 | EA9OU0tleWVkQXJjaGl2ZXLRFhdVQXJyYXmAAQgRGiMtMjc7QUZRWFlbYGt0g4ePmKqt 131 | swAAAAAAAAEBAAAAAAAAABgAAAAAAAAAAAAAAAAAAAC1 132 | 133 | NSTableView Supports v2 KeyBingingTable 134 | 135 | NSToolbar Configuration com.apple.NSColorPanel 136 | 137 | TB Is Shown 138 | 1 139 | 140 | NSWindow Frame iTerm Window 0 141 | 0 -1 1920 1177 0 0 1920 1177 142 | New Bookmarks 143 | 144 | 145 | ASCII Anti Aliased 146 | 147 | AWDS Pane Directory 148 | 149 | AWDS Pane Option 150 | No 151 | AWDS Tab Directory 152 | 153 | AWDS Tab Option 154 | No 155 | AWDS Window Directory 156 | 157 | AWDS Window Option 158 | No 159 | Allow Title Reporting 160 | 161 | Ambiguous Double Width 162 | 163 | Ansi 0 Color 164 | 165 | Blue Component 166 | 0.0 167 | Green Component 168 | 0.0 169 | Red Component 170 | 0.0 171 | 172 | Ansi 1 Color 173 | 174 | Blue Component 175 | 0.0 176 | Green Component 177 | 0.0 178 | Red Component 179 | 0.73333334922790527 180 | 181 | Ansi 10 Color 182 | 183 | Blue Component 184 | 0.3333333432674408 185 | Green Component 186 | 1 187 | Red Component 188 | 0.3333333432674408 189 | 190 | Ansi 11 Color 191 | 192 | Blue Component 193 | 0.3333333432674408 194 | Green Component 195 | 1 196 | Red Component 197 | 1 198 | 199 | Ansi 12 Color 200 | 201 | Blue Component 202 | 1 203 | Green Component 204 | 0.3333333432674408 205 | Red Component 206 | 0.3333333432674408 207 | 208 | Ansi 13 Color 209 | 210 | Blue Component 211 | 1 212 | Green Component 213 | 0.3333333432674408 214 | Red Component 215 | 1 216 | 217 | Ansi 14 Color 218 | 219 | Blue Component 220 | 1 221 | Green Component 222 | 1 223 | Red Component 224 | 0.3333333432674408 225 | 226 | Ansi 15 Color 227 | 228 | Blue Component 229 | 1 230 | Green Component 231 | 1 232 | Red Component 233 | 1 234 | 235 | Ansi 2 Color 236 | 237 | Blue Component 238 | 0.0 239 | Green Component 240 | 0.73333334922790527 241 | Red Component 242 | 0.0 243 | 244 | Ansi 3 Color 245 | 246 | Blue Component 247 | 0.0 248 | Green Component 249 | 0.73333334922790527 250 | Red Component 251 | 0.73333334922790527 252 | 253 | Ansi 4 Color 254 | 255 | Blue Component 256 | 0.73333334922790527 257 | Green Component 258 | 0.0 259 | Red Component 260 | 0.0 261 | 262 | Ansi 5 Color 263 | 264 | Blue Component 265 | 0.73333334922790527 266 | Green Component 267 | 0.0 268 | Red Component 269 | 0.73333334922790527 270 | 271 | Ansi 6 Color 272 | 273 | Blue Component 274 | 0.73333334922790527 275 | Green Component 276 | 0.73333334922790527 277 | Red Component 278 | 0.0 279 | 280 | Ansi 7 Color 281 | 282 | Blue Component 283 | 0.73333334922790527 284 | Green Component 285 | 0.73333334922790527 286 | Red Component 287 | 0.73333334922790527 288 | 289 | Ansi 8 Color 290 | 291 | Blue Component 292 | 0.3333333432674408 293 | Green Component 294 | 0.3333333432674408 295 | Red Component 296 | 0.3333333432674408 297 | 298 | Ansi 9 Color 299 | 300 | Blue Component 301 | 0.3333333432674408 302 | Green Component 303 | 0.3333333432674408 304 | Red Component 305 | 1 306 | 307 | Automatically Log 308 | 309 | BM Growl 310 | 311 | Background Color 312 | 313 | Blue Component 314 | 0.0 315 | Green Component 316 | 0.0 317 | Red Component 318 | 0.0 319 | 320 | Background Image Is Tiled 321 | 322 | Background Image Location 323 | 324 | Blend 325 | 0.30000001192092896 326 | Blink Allowed 327 | 328 | Blinking Cursor 329 | 330 | Blur 331 | 332 | Blur Radius 333 | 8.0741329193115234 334 | Bold Color 335 | 336 | Blue Component 337 | 1 338 | Green Component 339 | 1 340 | Red Component 341 | 1 342 | 343 | Character Encoding 344 | 4 345 | Close Sessions On End 346 | 347 | Columns 348 | 80 349 | Command 350 | 351 | Cursor Color 352 | 353 | Blue Component 354 | 0.73333334922790527 355 | Green Component 356 | 0.73333334922790527 357 | Red Component 358 | 0.73333334922790527 359 | 360 | Cursor Text Color 361 | 362 | Blue Component 363 | 1 364 | Green Component 365 | 1 366 | Red Component 367 | 1 368 | 369 | Cursor Type 370 | 2 371 | Custom Command 372 | No 373 | Custom Directory 374 | No 375 | Default Bookmark 376 | No 377 | Disable Printing 378 | 379 | Disable Smcup Rmcup 380 | 381 | Disable Window Resizing 382 | 383 | Draw Powerline Glyphs 384 | 385 | Flashing Bell 386 | 387 | Foreground Color 388 | 389 | Blue Component 390 | 0.73333334922790527 391 | Green Component 392 | 0.73333334922790527 393 | Red Component 394 | 0.73333334922790527 395 | 396 | Guid 397 | 2B9C0B52-CE92-4896-96A8-0DF92283C316 398 | Hide After Opening 399 | 400 | Horizontal Spacing 401 | 1 402 | Icon 403 | 1 404 | Idle Code 405 | 0 406 | Initial Text 407 | 408 | Jobs to Ignore 409 | 410 | rlogin 411 | ssh 412 | slogin 413 | telnet 414 | 415 | Keyboard Map 416 | 417 | 0x2d-0x40000 418 | 419 | Action 420 | 11 421 | Text 422 | 0x1f 423 | 424 | 0x32-0x40000 425 | 426 | Action 427 | 11 428 | Text 429 | 0x00 430 | 431 | 0x33-0x40000 432 | 433 | Action 434 | 11 435 | Text 436 | 0x1b 437 | 438 | 0x34-0x40000 439 | 440 | Action 441 | 11 442 | Text 443 | 0x1c 444 | 445 | 0x35-0x40000 446 | 447 | Action 448 | 11 449 | Text 450 | 0x1d 451 | 452 | 0x36-0x40000 453 | 454 | Action 455 | 11 456 | Text 457 | 0x1e 458 | 459 | 0x37-0x40000 460 | 461 | Action 462 | 11 463 | Text 464 | 0x1f 465 | 466 | 0x38-0x40000 467 | 468 | Action 469 | 11 470 | Text 471 | 0x7f 472 | 473 | 0xf700-0x220000 474 | 475 | Action 476 | 10 477 | Text 478 | [1;2A 479 | 480 | 0xf700-0x240000 481 | 482 | Action 483 | 10 484 | Text 485 | [1;5A 486 | 487 | 0xf700-0x260000 488 | 489 | Action 490 | 10 491 | Text 492 | [1;6A 493 | 494 | 0xf700-0x280000 495 | 496 | Action 497 | 11 498 | Text 499 | 0x1b 0x1b 0x5b 0x41 500 | 501 | 0xf701-0x220000 502 | 503 | Action 504 | 10 505 | Text 506 | [1;2B 507 | 508 | 0xf701-0x240000 509 | 510 | Action 511 | 10 512 | Text 513 | [1;5B 514 | 515 | 0xf701-0x260000 516 | 517 | Action 518 | 10 519 | Text 520 | [1;6B 521 | 522 | 0xf701-0x280000 523 | 524 | Action 525 | 11 526 | Text 527 | 0x1b 0x1b 0x5b 0x42 528 | 529 | 0xf702-0x220000 530 | 531 | Action 532 | 10 533 | Text 534 | [1;2D 535 | 536 | 0xf702-0x240000 537 | 538 | Action 539 | 10 540 | Text 541 | [1;5D 542 | 543 | 0xf702-0x260000 544 | 545 | Action 546 | 10 547 | Text 548 | [1;6D 549 | 550 | 0xf702-0x280000 551 | 552 | Action 553 | 11 554 | Text 555 | 0x1b 0x1b 0x5b 0x44 556 | 557 | 0xf703-0x220000 558 | 559 | Action 560 | 10 561 | Text 562 | [1;2C 563 | 564 | 0xf703-0x240000 565 | 566 | Action 567 | 10 568 | Text 569 | [1;5C 570 | 571 | 0xf703-0x260000 572 | 573 | Action 574 | 10 575 | Text 576 | [1;6C 577 | 578 | 0xf703-0x280000 579 | 580 | Action 581 | 11 582 | Text 583 | 0x1b 0x1b 0x5b 0x43 584 | 585 | 0xf704-0x20000 586 | 587 | Action 588 | 10 589 | Text 590 | [1;2P 591 | 592 | 0xf705-0x20000 593 | 594 | Action 595 | 10 596 | Text 597 | [1;2Q 598 | 599 | 0xf706-0x20000 600 | 601 | Action 602 | 10 603 | Text 604 | [1;2R 605 | 606 | 0xf707-0x20000 607 | 608 | Action 609 | 10 610 | Text 611 | [1;2S 612 | 613 | 0xf708-0x20000 614 | 615 | Action 616 | 10 617 | Text 618 | [15;2~ 619 | 620 | 0xf709-0x20000 621 | 622 | Action 623 | 10 624 | Text 625 | [17;2~ 626 | 627 | 0xf70a-0x20000 628 | 629 | Action 630 | 10 631 | Text 632 | [18;2~ 633 | 634 | 0xf70b-0x20000 635 | 636 | Action 637 | 10 638 | Text 639 | [19;2~ 640 | 641 | 0xf70c-0x20000 642 | 643 | Action 644 | 10 645 | Text 646 | [20;2~ 647 | 648 | 0xf70d-0x20000 649 | 650 | Action 651 | 10 652 | Text 653 | [21;2~ 654 | 655 | 0xf70e-0x20000 656 | 657 | Action 658 | 10 659 | Text 660 | [23;2~ 661 | 662 | 0xf70f-0x20000 663 | 664 | Action 665 | 10 666 | Text 667 | [24;2~ 668 | 669 | 0xf729-0x20000 670 | 671 | Action 672 | 10 673 | Text 674 | [1;2H 675 | 676 | 0xf729-0x40000 677 | 678 | Action 679 | 10 680 | Text 681 | [1;5H 682 | 683 | 0xf72b-0x20000 684 | 685 | Action 686 | 10 687 | Text 688 | [1;2F 689 | 690 | 0xf72b-0x40000 691 | 692 | Action 693 | 10 694 | Text 695 | [1;5F 696 | 697 | 698 | Log Directory 699 | 700 | Minimum Contrast 701 | 0.40086563063573233 702 | Mouse Reporting 703 | 704 | Name 705 | Default 706 | Non Ascii Font 707 | Ricty-Regular 18 708 | Non-ASCII Anti Aliased 709 | 710 | Normal Font 711 | Ricty-Regular 18 712 | Open Toolbelt 713 | 714 | Option Key Sends 715 | 0 716 | Prevent Opening in a Tab 717 | 718 | Prompt Before Closing 2 719 | 0 720 | Right Option Key Sends 721 | 0 722 | Rows 723 | 25 724 | Screen 725 | -1 726 | Scrollback Lines 727 | 10000 728 | Scrollback With Status Bar 729 | 730 | Scrollback in Alternate Screen 731 | 732 | Selected Text Color 733 | 734 | Blue Component 735 | 0.0 736 | Green Component 737 | 0.0 738 | Red Component 739 | 0.0 740 | 741 | Selection Color 742 | 743 | Blue Component 744 | 1 745 | Green Component 746 | 0.8353000283241272 747 | Red Component 748 | 0.70980000495910645 749 | 750 | Semantic History 751 | 752 | action 753 | best editor 754 | editor 755 | com.sublimetext.3 756 | text 757 | 758 | 759 | Send Code When Idle 760 | 761 | Set Local Environment Vars 762 | 763 | Shortcut 764 | 765 | Show Status Bar 766 | 767 | Silence Bell 768 | 769 | Smart Cursor Color 770 | 771 | Smart Selection Rules 772 | 773 | 774 | notes 775 | Word bounded by whitespace 776 | precision 777 | low 778 | regex 779 | \S+ 780 | 781 | 782 | notes 783 | C++ namespace::identifier 784 | precision 785 | normal 786 | regex 787 | ([a-zA-Z0-9_]+::)+[a-zA-Z0-9_]+ 788 | 789 | 790 | notes 791 | Paths 792 | precision 793 | normal 794 | regex 795 | \~?/?([[:letter:][:number:]._-]+/+)+[[:letter:][:number:]._-]+/? 796 | 797 | 798 | notes 799 | Quoted string 800 | precision 801 | normal 802 | regex 803 | @?"(?:[^"\\]|\\.)*" 804 | 805 | 806 | notes 807 | Java/Python include paths 808 | precision 809 | normal 810 | regex 811 | ([[:letter:][:number:]._]+\.)+[[:letter:][:number:]._]+ 812 | 813 | 814 | notes 815 | mailto URL 816 | precision 817 | normal 818 | regex 819 | \bmailto:([a-z0-9A-Z_]+@)?([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\b 820 | 821 | 822 | notes 823 | Obj-C selector 824 | precision 825 | high 826 | regex 827 | @selector\([^)]+\) 828 | 829 | 830 | notes 831 | email address 832 | precision 833 | high 834 | regex 835 | \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b 836 | 837 | 838 | notes 839 | HTTP URL 840 | precision 841 | very_high 842 | regex 843 | https?://([a-z0-9A-Z]+(:[a-zA-Z0-9]+)?@)?[a-z0-9A-Z]+(\.[a-z0-9A-Z]+)*((:[0-9]+)?)(/[a-zA-Z0-9;/\.\-_+%~?&@=#\(\)]*)? 844 | 845 | 846 | notes 847 | SSH URL 848 | precision 849 | very_high 850 | regex 851 | \bssh:([a-z0-9A-Z_]+@)?([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\b 852 | 853 | 854 | notes 855 | Telnet URL 856 | precision 857 | very_high 858 | regex 859 | \btelnet:([a-z0-9A-Z_]+@)?([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\b 860 | 861 | 862 | Space 863 | 0 864 | Status Bar Layout 865 | 866 | advanced configuration 867 | 868 | algorithm 869 | 0 870 | font 871 | .AppleSystemUIFont 12 872 | 873 | components 874 | 875 | 876 | class 877 | iTermStatusBarBatteryComponent 878 | configuration 879 | 880 | knobs 881 | 882 | base: compression resistance 883 | 1 884 | base: priority 885 | 5 886 | shared text color 887 | 888 | Alpha Component 889 | 1 890 | Blue Component 891 | 0.63 892 | Color Space 893 | sRGB 894 | Green Component 895 | 0.63 896 | Red Component 897 | 0.90000000000000002 898 | 899 | 900 | layout advanced configuration dictionary value 901 | 902 | algorithm 903 | 0 904 | 905 | 906 | 907 | 908 | class 909 | iTermStatusBarCPUUtilizationComponent 910 | configuration 911 | 912 | knobs 913 | 914 | base: compression resistance 915 | 1 916 | base: priority 917 | 5 918 | shared text color 919 | 920 | Alpha Component 921 | 1 922 | Blue Component 923 | 0.63 924 | Color Space 925 | sRGB 926 | Green Component 927 | 0.90000000000000002 928 | Red Component 929 | 0.90000000000000002 930 | 931 | 932 | layout advanced configuration dictionary value 933 | 934 | algorithm 935 | 0 936 | 937 | 938 | 939 | 940 | class 941 | iTermStatusBarMemoryUtilizationComponent 942 | configuration 943 | 944 | knobs 945 | 946 | base: compression resistance 947 | 1 948 | base: priority 949 | 5 950 | shared text color 951 | 952 | Alpha Component 953 | 1 954 | Blue Component 955 | 0.63 956 | Color Space 957 | sRGB 958 | Green Component 959 | 0.90000000000000002 960 | Red Component 961 | 0.63 962 | 963 | 964 | layout advanced configuration dictionary value 965 | 966 | algorithm 967 | 0 968 | 969 | 970 | 971 | 972 | class 973 | iTermStatusBarNetworkUtilizationComponent 974 | configuration 975 | 976 | knobs 977 | 978 | base: compression resistance 979 | 1 980 | base: priority 981 | 5 982 | shared text color 983 | 984 | Alpha Component 985 | 1 986 | Blue Component 987 | 0.90000000000000002 988 | Color Space 989 | sRGB 990 | Green Component 991 | 0.90000000000000002 992 | Red Component 993 | 0.63 994 | 995 | 996 | layout advanced configuration dictionary value 997 | 998 | algorithm 999 | 0 1000 | 1001 | 1002 | 1003 | 1004 | class 1005 | iTermStatusBarGitComponent 1006 | configuration 1007 | 1008 | knobs 1009 | 1010 | base: compression resistance 1011 | 1 1012 | base: priority 1013 | 5 1014 | iTermStatusBarGitComponentPollingIntervalKey 1015 | 2 1016 | maxwidth 1017 | +infinity 1018 | minwidth 1019 | 0 1020 | shared text color 1021 | 1022 | Alpha Component 1023 | 1 1024 | Blue Component 1025 | 0.90000000000000002 1026 | Color Space 1027 | sRGB 1028 | Green Component 1029 | 0.63 1030 | Red Component 1031 | 0.63 1032 | 1033 | 1034 | layout advanced configuration dictionary value 1035 | 1036 | algorithm 1037 | 0 1038 | 1039 | 1040 | 1041 | 1042 | class 1043 | iTermStatusBarWorkingDirectoryComponent 1044 | configuration 1045 | 1046 | knobs 1047 | 1048 | base: compression resistance 1049 | 1 1050 | base: priority 1051 | 5 1052 | maxwidth 1053 | +infinity 1054 | minwidth 1055 | 0 1056 | path 1057 | path 1058 | shared text color 1059 | 1060 | Alpha Component 1061 | 1 1062 | Blue Component 1063 | 0.90000000000000002 1064 | Color Space 1065 | sRGB 1066 | Green Component 1067 | 0.63 1068 | Red Component 1069 | 0.90000000000000002 1070 | 1071 | 1072 | layout advanced configuration dictionary value 1073 | 1074 | algorithm 1075 | 0 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | Sync Title 1082 | 1083 | Tags 1084 | 1085 | Terminal Type 1086 | xterm-256color 1087 | Title Components 1088 | 6 1089 | Transparency 1090 | 0.19348418712615967 1091 | Triggers 1092 | 1093 | 1094 | action 1095 | HighlightTrigger 1096 | parameter 1097 | 0 1098 | regex 1099 | karupanerura 1100 | 1101 | 1102 | action 1103 | HighlightTrigger 1104 | parameter 1105 | 0 1106 | regex 1107 | (warn|WARN)(ings?|INGS?)? 1108 | 1109 | 1110 | action 1111 | HighlightTrigger 1112 | parameter 1113 | 5 1114 | regex 1115 | (critical|CRITICAL|CRIT|crit|ERRORS?|emergency|emerg|EMERGENCY) 1116 | 1117 | 1118 | Unlimited Scrollback 1119 | 1120 | Use Bold Font 1121 | 1122 | Use Bright Bold 1123 | 1124 | Use Canonical Parser 1125 | 1126 | Use Custom Window Title 1127 | 1128 | Use HFS Plus Mapping 1129 | 1130 | Use Italic Font 1131 | 1132 | Vertical Spacing 1133 | 1 1134 | Visual Bell 1135 | 1136 | Window Type 1137 | 12 1138 | 1139 | 1140 | NoSyncAllAppVersions 1141 | 1142 | 3.3.3 1143 | 1144 | NoSyncCommandHistoryHasEverBeenUsed 1145 | 1146 | NoSyncFrame_SharedPreferences 1147 | 1148 | screenFrame 1149 | {{0, 0}, {1920, 1200}} 1150 | topLeft 1151 | {760, 917} 1152 | 1153 | NoSyncInstallationId 1154 | 89D720A4-05F1-4278-AD01-FEE60387FC45 1155 | NoSyncLaunchExperienceControllerRunCount 1156 | 3 1157 | NoSyncNeverRemindPrefsChangesLostForFile 1158 | 1159 | NoSyncNeverRemindPrefsChangesLostForFile_selection 1160 | 0 1161 | NoSyncNextAnnoyanceTime 1162 | 590144268.90581703 1163 | NoSyncOnboardingWindowHasBeenShown 1164 | 1165 | NoSyncRecordedVariables 1166 | 1167 | 0 1168 | 1169 | 1170 | isTerminal 1171 | 1172 | name 1173 | 1174 | nonterminalContext 1175 | 0 1176 | 1177 | 1178 | 1 1179 | 1180 | 1181 | isTerminal 1182 | 1183 | name 1184 | presentationName 1185 | nonterminalContext 1186 | 0 1187 | 1188 | 1189 | isTerminal 1190 | 1191 | name 1192 | tmuxRole 1193 | nonterminalContext 1194 | 0 1195 | 1196 | 1197 | isTerminal 1198 | 1199 | name 1200 | lastCommand 1201 | nonterminalContext 1202 | 0 1203 | 1204 | 1205 | isTerminal 1206 | 1207 | name 1208 | profileName 1209 | nonterminalContext 1210 | 0 1211 | 1212 | 1213 | isTerminal 1214 | 1215 | name 1216 | termid 1217 | nonterminalContext 1218 | 0 1219 | 1220 | 1221 | isTerminal 1222 | 1223 | name 1224 | id 1225 | nonterminalContext 1226 | 0 1227 | 1228 | 1229 | isTerminal 1230 | 1231 | name 1232 | jobName 1233 | nonterminalContext 1234 | 0 1235 | 1236 | 1237 | isTerminal 1238 | 1239 | name 1240 | columns 1241 | nonterminalContext 1242 | 0 1243 | 1244 | 1245 | isTerminal 1246 | 1247 | name 1248 | tab.tmuxWindowTitle 1249 | nonterminalContext 1250 | 0 1251 | 1252 | 1253 | isTerminal 1254 | 1255 | name 1256 | hostname 1257 | nonterminalContext 1258 | 0 1259 | 1260 | 1261 | isTerminal 1262 | 1263 | name 1264 | tmuxClientName 1265 | nonterminalContext 1266 | 0 1267 | 1268 | 1269 | isTerminal 1270 | 1271 | name 1272 | path 1273 | nonterminalContext 1274 | 0 1275 | 1276 | 1277 | isTerminal 1278 | 1279 | name 1280 | triggerName 1281 | nonterminalContext 1282 | 0 1283 | 1284 | 1285 | isTerminal 1286 | 1287 | name 1288 | terminalIconName 1289 | nonterminalContext 1290 | 0 1291 | 1292 | 1293 | isTerminal 1294 | 1295 | name 1296 | tmuxWindowPane 1297 | nonterminalContext 1298 | 0 1299 | 1300 | 1301 | isTerminal 1302 | 1303 | name 1304 | tmuxStatusRight 1305 | nonterminalContext 1306 | 0 1307 | 1308 | 1309 | isTerminal 1310 | 1311 | name 1312 | mouseReportingMode 1313 | nonterminalContext 1314 | 0 1315 | 1316 | 1317 | isTerminal 1318 | 1319 | name 1320 | iterm2 1321 | nonterminalContext 1322 | 4 1323 | 1324 | 1325 | isTerminal 1326 | 1327 | name 1328 | name 1329 | nonterminalContext 1330 | 0 1331 | 1332 | 1333 | isTerminal 1334 | 1335 | name 1336 | tmuxPaneTitle 1337 | nonterminalContext 1338 | 0 1339 | 1340 | 1341 | isTerminal 1342 | 1343 | name 1344 | rows 1345 | nonterminalContext 1346 | 0 1347 | 1348 | 1349 | isTerminal 1350 | 1351 | name 1352 | username 1353 | nonterminalContext 1354 | 0 1355 | 1356 | 1357 | isTerminal 1358 | 1359 | name 1360 | tty 1361 | nonterminalContext 1362 | 0 1363 | 1364 | 1365 | isTerminal 1366 | 1367 | name 1368 | autoLogId 1369 | nonterminalContext 1370 | 0 1371 | 1372 | 1373 | isTerminal 1374 | 1375 | name 1376 | badge 1377 | nonterminalContext 1378 | 0 1379 | 1380 | 1381 | isTerminal 1382 | 1383 | name 1384 | tab.tmuxWindowName 1385 | nonterminalContext 1386 | 0 1387 | 1388 | 1389 | isTerminal 1390 | 1391 | name 1392 | tab 1393 | nonterminalContext 1394 | 2 1395 | 1396 | 1397 | isTerminal 1398 | 1399 | name 1400 | tmuxStatusLeft 1401 | nonterminalContext 1402 | 0 1403 | 1404 | 1405 | isTerminal 1406 | 1407 | name 1408 | autoNameFormat 1409 | nonterminalContext 1410 | 0 1411 | 1412 | 1413 | isTerminal 1414 | 1415 | name 1416 | autoName 1417 | nonterminalContext 1418 | 0 1419 | 1420 | 1421 | isTerminal 1422 | 1423 | name 1424 | terminalWindowName 1425 | nonterminalContext 1426 | 0 1427 | 1428 | 1429 | isTerminal 1430 | 1431 | name 1432 | creationTimeString 1433 | nonterminalContext 1434 | 0 1435 | 1436 | 1437 | isTerminal 1438 | 1439 | name 1440 | commandLine 1441 | nonterminalContext 1442 | 0 1443 | 1444 | 1445 | isTerminal 1446 | 1447 | name 1448 | jobPid 1449 | nonterminalContext 1450 | 0 1451 | 1452 | 1453 | isTerminal 1454 | 1455 | name 1456 | pid 1457 | nonterminalContext 1458 | 0 1459 | 1460 | 1461 | 16 1462 | 1463 | 1464 | isTerminal 1465 | 1466 | name 1467 | currentTab.currentSession.presentationName 1468 | nonterminalContext 1469 | 0 1470 | 1471 | 1472 | isTerminal 1473 | 1474 | name 1475 | currentTab.iterm2.localhostName 1476 | nonterminalContext 1477 | 0 1478 | 1479 | 1480 | isTerminal 1481 | 1482 | name 1483 | style 1484 | nonterminalContext 1485 | 0 1486 | 1487 | 1488 | isTerminal 1489 | 1490 | name 1491 | frame 1492 | nonterminalContext 1493 | 0 1494 | 1495 | 1496 | isTerminal 1497 | 1498 | name 1499 | currentTab.currentSession.pid 1500 | nonterminalContext 1501 | 0 1502 | 1503 | 1504 | isTerminal 1505 | 1506 | name 1507 | currentTab.currentSession.termid 1508 | nonterminalContext 1509 | 0 1510 | 1511 | 1512 | isTerminal 1513 | 1514 | name 1515 | currentTab.currentSession.terminalWindowName 1516 | nonterminalContext 1517 | 0 1518 | 1519 | 1520 | isTerminal 1521 | 1522 | name 1523 | currentTab.currentSession.lastCommand 1524 | nonterminalContext 1525 | 0 1526 | 1527 | 1528 | isTerminal 1529 | 1530 | name 1531 | currentTab 1532 | nonterminalContext 1533 | 2 1534 | 1535 | 1536 | isTerminal 1537 | 1538 | name 1539 | currentTab.currentSession 1540 | nonterminalContext 1541 | 0 1542 | 1543 | 1544 | isTerminal 1545 | 1546 | name 1547 | currentTab.window 1548 | nonterminalContext 1549 | 0 1550 | 1551 | 1552 | isTerminal 1553 | 1554 | name 1555 | id 1556 | nonterminalContext 1557 | 0 1558 | 1559 | 1560 | isTerminal 1561 | 1562 | name 1563 | currentTab.currentSession.name 1564 | nonterminalContext 1565 | 0 1566 | 1567 | 1568 | isTerminal 1569 | 1570 | name 1571 | titleOverride 1572 | nonterminalContext 1573 | 0 1574 | 1575 | 1576 | isTerminal 1577 | 1578 | name 1579 | number 1580 | nonterminalContext 1581 | 0 1582 | 1583 | 1584 | isTerminal 1585 | 1586 | name 1587 | currentTab.currentSession.path 1588 | nonterminalContext 1589 | 0 1590 | 1591 | 1592 | isTerminal 1593 | 1594 | name 1595 | currentTab.currentSession.commandLine 1596 | nonterminalContext 1597 | 0 1598 | 1599 | 1600 | isTerminal 1601 | 1602 | name 1603 | currentTab.currentSession.hostname 1604 | nonterminalContext 1605 | 0 1606 | 1607 | 1608 | isTerminal 1609 | 1610 | name 1611 | currentTab.currentSession.tty 1612 | nonterminalContext 1613 | 0 1614 | 1615 | 1616 | isTerminal 1617 | 1618 | name 1619 | currentTab.currentSession.username 1620 | nonterminalContext 1621 | 0 1622 | 1623 | 1624 | isTerminal 1625 | 1626 | name 1627 | iterm2 1628 | nonterminalContext 1629 | 4 1630 | 1631 | 1632 | isTerminal 1633 | 1634 | name 1635 | titleOverrideFormat 1636 | nonterminalContext 1637 | 0 1638 | 1639 | 1640 | isTerminal 1641 | 1642 | name 1643 | currentTab.currentSession.jobName 1644 | nonterminalContext 1645 | 0 1646 | 1647 | 1648 | 2 1649 | 1650 | 1651 | isTerminal 1652 | 1653 | name 1654 | currentSession.commandLine 1655 | nonterminalContext 1656 | 0 1657 | 1658 | 1659 | isTerminal 1660 | 1661 | name 1662 | tmuxWindowTitle 1663 | nonterminalContext 1664 | 0 1665 | 1666 | 1667 | isTerminal 1668 | 1669 | name 1670 | currentSession.presentationName 1671 | nonterminalContext 1672 | 0 1673 | 1674 | 1675 | isTerminal 1676 | 1677 | name 1678 | iterm2.localhostName 1679 | nonterminalContext 1680 | 0 1681 | 1682 | 1683 | isTerminal 1684 | 1685 | name 1686 | tmuxWindowName 1687 | nonterminalContext 1688 | 0 1689 | 1690 | 1691 | isTerminal 1692 | 1693 | name 1694 | window 1695 | nonterminalContext 1696 | 16 1697 | 1698 | 1699 | isTerminal 1700 | 1701 | name 1702 | currentSession.tty 1703 | nonterminalContext 1704 | 0 1705 | 1706 | 1707 | isTerminal 1708 | 1709 | name 1710 | currentSession.jobName 1711 | nonterminalContext 1712 | 0 1713 | 1714 | 1715 | isTerminal 1716 | 1717 | name 1718 | currentSession.name 1719 | nonterminalContext 1720 | 0 1721 | 1722 | 1723 | isTerminal 1724 | 1725 | name 1726 | window 1727 | nonterminalContext 1728 | 0 1729 | 1730 | 1731 | isTerminal 1732 | 1733 | name 1734 | id 1735 | nonterminalContext 1736 | 0 1737 | 1738 | 1739 | isTerminal 1740 | 1741 | name 1742 | titleOverride 1743 | nonterminalContext 1744 | 0 1745 | 1746 | 1747 | isTerminal 1748 | 1749 | name 1750 | currentSession.username 1751 | nonterminalContext 1752 | 0 1753 | 1754 | 1755 | isTerminal 1756 | 1757 | name 1758 | currentSession.termid 1759 | nonterminalContext 1760 | 0 1761 | 1762 | 1763 | isTerminal 1764 | 1765 | name 1766 | iterm2 1767 | nonterminalContext 1768 | 4 1769 | 1770 | 1771 | isTerminal 1772 | 1773 | name 1774 | titleOverrideFormat 1775 | nonterminalContext 1776 | 0 1777 | 1778 | 1779 | isTerminal 1780 | 1781 | name 1782 | currentSession.hostname 1783 | nonterminalContext 1784 | 0 1785 | 1786 | 1787 | isTerminal 1788 | 1789 | name 1790 | currentSession.pid 1791 | nonterminalContext 1792 | 0 1793 | 1794 | 1795 | isTerminal 1796 | 1797 | name 1798 | currentSession.path 1799 | nonterminalContext 1800 | 0 1801 | 1802 | 1803 | isTerminal 1804 | 1805 | name 1806 | tmuxWindow 1807 | nonterminalContext 1808 | 0 1809 | 1810 | 1811 | isTerminal 1812 | 1813 | name 1814 | currentSession 1815 | nonterminalContext 1816 | 1 1817 | 1818 | 1819 | isTerminal 1820 | 1821 | name 1822 | currentSession 1823 | nonterminalContext 1824 | 0 1825 | 1826 | 1827 | 4 1828 | 1829 | 1830 | isTerminal 1831 | 1832 | name 1833 | pid 1834 | nonterminalContext 1835 | 0 1836 | 1837 | 1838 | isTerminal 1839 | 1840 | name 1841 | localhostName 1842 | nonterminalContext 1843 | 0 1844 | 1845 | 1846 | isTerminal 1847 | 1848 | name 1849 | effectiveTheme 1850 | nonterminalContext 1851 | 0 1852 | 1853 | 1854 | 1855 | NoSyncTipOfTheDayEligibilityBeganTime 1856 | 589971468.90554404 1857 | OnlyWhenMoreTabs 1858 | 1859 | OpenArrangementAtStartup 1860 | 1861 | OpenBookmark 1862 | 1863 | OpenTmuxWindowsIn 1864 | 1 1865 | PassOnControlClick 1866 | 1867 | PasteFromClipboard 1868 | 1869 | PointerActions 1870 | 1871 | PromptOnQuit 1872 | 1873 | QuitWhenAllWindowsClosed 1874 | 1875 | RightCommand 1876 | 8 1877 | RightOption 1878 | 3 1879 | SUEnableAutomaticChecks 1880 | 1881 | SUFeedAlternateAppNameKey 1882 | iTerm 1883 | SUFeedURL 1884 | https://iterm2.com/appcasts/final_new.xml?shard=7 1885 | SUHasLaunchedBefore 1886 | 1887 | SULastCheckTime 1888 | 2019-09-12T13:28:35Z 1889 | SUSendProfileInfo 1890 | 1891 | SavePasteHistory 1892 | 1893 | ShowBookmarkName 1894 | 1895 | ShowMetalFPSmeter 1896 | 1897 | ShowPaneTitles 1898 | 1899 | SmartPlacement 1900 | 1901 | SoundForEsc 1902 | 1903 | SplitPaneDimmingAmount 1904 | 0.40000000596046448 1905 | SwitchTabModifier 1906 | 4 1907 | SwitchWindowModifier 1908 | 6 1909 | TabViewType 1910 | 0 1911 | ThreeFingerEmulates 1912 | 1913 | TmuxDashboardLimit 1914 | 10 1915 | TripleClickSelectsFullWrappedLines 1916 | 1917 | URLHandlersByGuid 1918 | 1919 | UseBorder 1920 | 1921 | UseCompactLabel 1922 | 1923 | UseLionStyleFullscreen 1924 | 1925 | VisualIndicatorForEsc 1926 | 1927 | WebKitDefaultFontSize 1928 | 11 1929 | WebKitStandardFont 1930 | .AppleSystemUIFont 1931 | WindowNumber 1932 | 1933 | WindowStyle 1934 | 0 1935 | WordCharacters 1936 | /-+\~_. 1937 | findIgnoreCase_iTerm 1938 | 1939 | findRegex_iTerm 1940 | 1941 | iTerm Version 1942 | 3.3.3 1943 | 1944 | 1945 | -------------------------------------------------------------------------------- /iterm2/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "ASCII Anti Aliased": true, 3 | "Ambiguous Double Width": false, 4 | "Ansi 0 Color": { 5 | "Blue Component": "0", 6 | "Green Component": "0", 7 | "Red Component": "0" 8 | }, 9 | "Ansi 1 Color": { 10 | "Blue Component": "0", 11 | "Green Component": "0", 12 | "Red Component": "0.8" 13 | }, 14 | "Ansi 10 Color": { 15 | "Blue Component": "0.2039216", 16 | "Green Component": "0.8862745", 17 | "Red Component": "0.5411764999999999" 18 | }, 19 | "Ansi 11 Color": { 20 | "Blue Component": "0.3098039", 21 | "Green Component": "0.9137255", 22 | "Red Component": "0.9882353" 23 | }, 24 | "Ansi 12 Color": { 25 | "Blue Component": "0.8117647", 26 | "Green Component": "0.6235294", 27 | "Red Component": "0.4470588" 28 | }, 29 | "Ansi 13 Color": { 30 | "Blue Component": "0.6588235", 31 | "Green Component": "0.4980392", 32 | "Red Component": "0.6784314" 33 | }, 34 | "Ansi 14 Color": { 35 | "Blue Component": "0.8862745", 36 | "Green Component": "0.8862745", 37 | "Red Component": "0.2039216" 38 | }, 39 | "Ansi 15 Color": { 40 | "Blue Component": "0.9254902", 41 | "Green Component": "0.9333333", 42 | "Red Component": "0.9333333" 43 | }, 44 | "Ansi 2 Color": { 45 | "Blue Component": "0.02352941", 46 | "Green Component": "0.6039215999999999", 47 | "Red Component": "0.3058824" 48 | }, 49 | "Ansi 3 Color": { 50 | "Blue Component": "0", 51 | "Green Component": "0.627451", 52 | "Red Component": "0.7686275" 53 | }, 54 | "Ansi 4 Color": { 55 | "Blue Component": "0.6431373", 56 | "Green Component": "0.3960784", 57 | "Red Component": "0.2039216" 58 | }, 59 | "Ansi 5 Color": { 60 | "Blue Component": "0.4823529", 61 | "Green Component": "0.3137255", 62 | "Red Component": "0.4588235" 63 | }, 64 | "Ansi 6 Color": { 65 | "Blue Component": "0.6039215999999999", 66 | "Green Component": "0.5960785", 67 | "Red Component": "0.02352941" 68 | }, 69 | "Ansi 7 Color": { 70 | "Blue Component": "0.8117647", 71 | "Green Component": "0.8431373", 72 | "Red Component": "0.827451" 73 | }, 74 | "Ansi 8 Color": { 75 | "Blue Component": "0.3254902", 76 | "Green Component": "0.3411765", 77 | "Red Component": "0.3333333" 78 | }, 79 | "Ansi 9 Color": { 80 | "Blue Component": "0.1607843", 81 | "Green Component": "0.1607843", 82 | "Red Component": "0.9372549" 83 | }, 84 | "BM Growl": true, 85 | "Background Color": { 86 | "Blue Component": "0", 87 | "Green Component": "0", 88 | "Red Component": "0" 89 | }, 90 | "Background Image Location": "", 91 | "Badge Color": { 92 | "Alpha Component": 0.5, 93 | "Blue Component": 0, 94 | "Color Space": "sRGB", 95 | "Green Component": 0.14910027384757996, 96 | "Red Component": 1 97 | }, 98 | "Blink Allowed": false, 99 | "Blinking Cursor": false, 100 | "Blur": true, 101 | "Blur Radius": 9.918459109042553, 102 | "Bold Color": { 103 | "Blue Component": "1", 104 | "Green Component": "1", 105 | "Red Component": "1" 106 | }, 107 | "Character Encoding": 4, 108 | "Close Sessions On End": true, 109 | "Columns": 80, 110 | "Command": "", 111 | "Cursor Color": { 112 | "Blue Component": "1", 113 | "Green Component": "1", 114 | "Red Component": "1" 115 | }, 116 | "Cursor Guide Color": { 117 | "Alpha Component": 0.25, 118 | "Blue Component": 1, 119 | "Color Space": "sRGB", 120 | "Green Component": 0.9268137812614441, 121 | "Red Component": 0.7021402716636658 122 | }, 123 | "Cursor Text Color": { 124 | "Blue Component": "0", 125 | "Green Component": "0", 126 | "Red Component": "0" 127 | }, 128 | "Custom Command": "No", 129 | "Custom Directory": "No", 130 | "Default Bookmark": "No", 131 | "Description": "Default", 132 | "Disable Window Resizing": true, 133 | "Flashing Bell": false, 134 | "Foreground Color": { 135 | "Blue Component": "1", 136 | "Green Component": "1", 137 | "Red Component": "1" 138 | }, 139 | "Guid": "14ED3A9F-6723-4BA5-9876-C34174F282DB", 140 | "Horizontal Spacing": 1, 141 | "Idle Code": 0, 142 | "Jobs to Ignore": [ 143 | "rlogin", 144 | "ssh", 145 | "slogin", 146 | "telnet" 147 | ], 148 | "Keyboard Map": { 149 | "0x2d-0x40000": { 150 | "Action": 11, 151 | "Text": "0x1f" 152 | }, 153 | "0x32-0x40000": { 154 | "Action": 11, 155 | "Text": "0x00" 156 | }, 157 | "0x33-0x40000": { 158 | "Action": 11, 159 | "Text": "0x1b" 160 | }, 161 | "0x34-0x40000": { 162 | "Action": 11, 163 | "Text": "0x1c" 164 | }, 165 | "0x35-0x40000": { 166 | "Action": 11, 167 | "Text": "0x1d" 168 | }, 169 | "0x36-0x40000": { 170 | "Action": 11, 171 | "Text": "0x1e" 172 | }, 173 | "0x37-0x40000": { 174 | "Action": 11, 175 | "Text": "0x1f" 176 | }, 177 | "0x38-0x40000": { 178 | "Action": 11, 179 | "Text": "0x7f" 180 | }, 181 | "0xf700-0x220000": { 182 | "Action": 10, 183 | "Text": "[1;2A" 184 | }, 185 | "0xf700-0x240000": { 186 | "Action": 10, 187 | "Text": "[1;5A" 188 | }, 189 | "0xf700-0x260000": { 190 | "Action": 10, 191 | "Text": "[1;6A" 192 | }, 193 | "0xf700-0x280000": { 194 | "Action": 11, 195 | "Text": "0x1b 0x1b 0x5b 0x41" 196 | }, 197 | "0xf701-0x220000": { 198 | "Action": 10, 199 | "Text": "[1;2B" 200 | }, 201 | "0xf701-0x240000": { 202 | "Action": 10, 203 | "Text": "[1;5B" 204 | }, 205 | "0xf701-0x260000": { 206 | "Action": 10, 207 | "Text": "[1;6B" 208 | }, 209 | "0xf701-0x280000": { 210 | "Action": 11, 211 | "Text": "0x1b 0x1b 0x5b 0x42" 212 | }, 213 | "0xf702-0x220000": { 214 | "Action": 10, 215 | "Text": "[1;2D" 216 | }, 217 | "0xf702-0x240000": { 218 | "Action": 10, 219 | "Text": "[1;5D" 220 | }, 221 | "0xf702-0x260000": { 222 | "Action": 10, 223 | "Text": "[1;6D" 224 | }, 225 | "0xf702-0x280000": { 226 | "Action": 11, 227 | "Text": "0x1b 0x1b 0x5b 0x44" 228 | }, 229 | "0xf703-0x220000": { 230 | "Action": 10, 231 | "Text": "[1;2C" 232 | }, 233 | "0xf703-0x240000": { 234 | "Action": 10, 235 | "Text": "[1;5C" 236 | }, 237 | "0xf703-0x260000": { 238 | "Action": 10, 239 | "Text": "[1;6C" 240 | }, 241 | "0xf703-0x280000": { 242 | "Action": 11, 243 | "Text": "0x1b 0x1b 0x5b 0x43" 244 | }, 245 | "0xf704-0x20000": { 246 | "Action": 10, 247 | "Text": "[1;2P" 248 | }, 249 | "0xf705-0x20000": { 250 | "Action": 10, 251 | "Text": "[1;2Q" 252 | }, 253 | "0xf706-0x20000": { 254 | "Action": 10, 255 | "Text": "[1;2R" 256 | }, 257 | "0xf707-0x20000": { 258 | "Action": 10, 259 | "Text": "[1;2S" 260 | }, 261 | "0xf708-0x20000": { 262 | "Action": 10, 263 | "Text": "[15;2~" 264 | }, 265 | "0xf709-0x20000": { 266 | "Action": 10, 267 | "Text": "[17;2~" 268 | }, 269 | "0xf70a-0x20000": { 270 | "Action": 10, 271 | "Text": "[18;2~" 272 | }, 273 | "0xf70b-0x20000": { 274 | "Action": 10, 275 | "Text": "[19;2~" 276 | }, 277 | "0xf70c-0x20000": { 278 | "Action": 10, 279 | "Text": "[20;2~" 280 | }, 281 | "0xf70d-0x20000": { 282 | "Action": 10, 283 | "Text": "[21;2~" 284 | }, 285 | "0xf70e-0x20000": { 286 | "Action": 10, 287 | "Text": "[23;2~" 288 | }, 289 | "0xf70f-0x20000": { 290 | "Action": 10, 291 | "Text": "[24;2~" 292 | }, 293 | "0xf729-0x20000": { 294 | "Action": 10, 295 | "Text": "[1;2H" 296 | }, 297 | "0xf729-0x40000": { 298 | "Action": 10, 299 | "Text": "[1;5H" 300 | }, 301 | "0xf72b-0x20000": { 302 | "Action": 10, 303 | "Text": "[1;2F" 304 | }, 305 | "0xf72b-0x40000": { 306 | "Action": 10, 307 | "Text": "[1;5F" 308 | } 309 | }, 310 | "Link Color": { 311 | "Alpha Component": 1, 312 | "Blue Component": 0.7342271208763123, 313 | "Color Space": "sRGB", 314 | "Green Component": 0.35915297269821167, 315 | "Red Component": 0 316 | }, 317 | "Mouse Reporting": true, 318 | "Name": "Default", 319 | "Non Ascii Font": "Monaco 12", 320 | "Non-ASCII Anti Aliased": true, 321 | "Normal Font": "RictyDiminished-Regular 18", 322 | "Only The Default BG Color Uses Transparency": false, 323 | "Option Key Sends": 0, 324 | "Prompt Before Closing 2": false, 325 | "Right Option Key Sends": 0, 326 | "Rows": 25, 327 | "Screen": -1, 328 | "Scrollback Lines": 1000, 329 | "Selected Text Color": { 330 | "Blue Component": "0", 331 | "Green Component": "0", 332 | "Red Component": "0" 333 | }, 334 | "Selection Color": { 335 | "Blue Component": "1", 336 | "Green Component": "0.8353", 337 | "Red Component": "0.7098" 338 | }, 339 | "Send Code When Idle": false, 340 | "Shortcut": "", 341 | "Silence Bell": false, 342 | "Sync Title": false, 343 | "Tags": [], 344 | "Terminal Type": "xterm-256color", 345 | "Transparency": 0.09696642287234042, 346 | "Unicode Normalization": 0, 347 | "Unlimited Scrollback": false, 348 | "Use Bold Font": true, 349 | "Use Bright Bold": true, 350 | "Use Italic Font": true, 351 | "Use Non-ASCII Font": false, 352 | "Vertical Spacing": 1, 353 | "Visual Bell": true, 354 | "Window Type": 0, 355 | "Working Directory": "/Users/karupanerura" 356 | } 357 | -------------------------------------------------------------------------------- /osx/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -uex 3 | 4 | brew tap homebrew/cask-fonts 5 | brew tap microsoft/git 6 | brew install asdf colordiff curl coreutils emacs gh ghq git gnu-units go gojq ipcalc jq peco sqlite vim watch wrk zsh zsh-completions 7 | brew install --cask font-myricam git-credential-manager-core 8 | chmod -R go-w /opt/homebrew/share -------------------------------------------------------------------------------- /perltidy/rc: -------------------------------------------------------------------------------- 1 | -bar # To force the opening brace to always be on the right 2 | -nsfs # no --space-for-semicolon 3 | -otr # --opening-token-right 4 | -ndws # no --delete-old-whitespace 5 | -boc # try to break at all old commas 6 | -kis # --keep-interior-semicolons 7 | -cab=1 # break at all commas after => if container is open 8 | -kbl=2 # keep all old blank lines 9 | -pt=2 # White space 10 | -l=128 # Max line width is 128 cols 11 | -i=4 # Indent level is 4 cols 12 | -wbb="% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= //= |= >>= ||= .= %= ^= x=" -------------------------------------------------------------------------------- /prove/rc: -------------------------------------------------------------------------------- 1 | --color 2 | --merge 3 | --timer 4 | --lib 5 | --blib 6 | --recurse 7 | --failures 8 | -w -------------------------------------------------------------------------------- /screen/rc: -------------------------------------------------------------------------------- 1 | source defaults 2 | # 現在のウィンドウに対して可視ベルの設定します。 3 | vbell off 4 | # ハングアップしたときにscreenは自動的にデタッチ 5 | autodetach on 6 | # 起動時に著作権表示 7 | startup_message off 8 | # スクロールバックバッファの大きさ 9 | defscrollback 10000 10 | # ターミナル 11 | term xterm-256color 12 | 13 | # 文字コードまわり 14 | export LANG=ja_JP.UTF-8 15 | export JLESSCHARSET=japanese 16 | 17 | defutf8 on 18 | defkanji utf-8 19 | encoding utf-8 utf-8 20 | defencoding utf-8 21 | cjkwidth on 22 | 23 | # status line 24 | hardstatus ignore "%w | %h" 25 | hardstatus alwayslastline " %`%-w%{=b bw}%n %t%{-}%+w" 26 | caption always "%{= wk} %-w%{=bu dr}%n %t%{-}%+w %= %{=b wb}%y/%m/%d %{=b wb}%c" 27 | 28 | escape ^]a 29 | 30 | # caption 31 | caption always "%{=r dd}%`%-w%{+b WK}%n %t%{-}%+w %= [%02c]" 32 | sorendition "+rb .G" 33 | 34 | # ログ取る 35 | logfile ”/home/bk-sato/lg/screen-%Y%m%d-%n.log” 36 | log on 37 | deflog on -------------------------------------------------------------------------------- /setup.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | package MyDotfiles::Builder; 3 | use strict; 4 | use warnings; 5 | use utf8; 6 | use autodie; 7 | 8 | use constant DRY_RUN => $ENV{DRY_RUN}; 9 | 10 | BEGIN {## hack for echo 11 | use File::Spec; 12 | 13 | *CORE::GLOBAL::system = sub { 14 | print(join(' ', @_), "\n"); 15 | return if DRY_RUN; 16 | CORE::system(@_); 17 | }; 18 | *CORE::GLOBAL::mkdir = sub ($;$) { 19 | print(join(' ', 'mkdir', @_), "\n"); 20 | return if DRY_RUN; 21 | if (@_ == 2) { 22 | CORE::mkdir($_[0], $_[1]); 23 | } 24 | else { 25 | CORE::mkdir($_[0]); 26 | } 27 | }; 28 | *CORE::GLOBAL::symlink = sub ($$) {## no critic 29 | my($src, $dest) = @_; 30 | $src = File::Spec->rel2abs($src); 31 | $dest = File::Spec->rel2abs($dest); 32 | 33 | print( join(' ', 'ln', '-s', $src, $dest), "\n" ); 34 | return if DRY_RUN; 35 | CORE::symlink $src, $dest; 36 | }; 37 | 38 | { 39 | no warnings 'redefine'; 40 | require File::Path; 41 | *File::Path::mkpath = do { 42 | use warnings 'redefine'; 43 | my $super = \&File::Path::mkpath; 44 | sub { 45 | print(join(' ', 'mkdir', '-p', @_), "\n"); 46 | return if DRY_RUN; 47 | $super->(@_); 48 | }; 49 | }; 50 | } 51 | 52 | { 53 | no warnings 'redefine'; 54 | require File::Copy; 55 | *File::Copy::move = do { 56 | use warnings 'redefine'; 57 | my $super = \&File::Copy::move; 58 | sub { 59 | print(join(' ', 'mv', @_), "\n"); 60 | return if DRY_RUN; 61 | $super->(@_); 62 | }; 63 | }; 64 | } 65 | 66 | *CORE::GLOBAL::open = sub ($$;$) {# no critic 67 | print(join(' ', '[open]', @_[1..$#_]), "\n"); 68 | if (DRY_RUN) { 69 | $_[0] = $_[1] eq '>' ? \*STDOUT : \*STDIN; 70 | return 1; 71 | } 72 | return CORE::open($_[0], $_[1], $_[2]); 73 | }; 74 | 75 | *CORE::GLOBAL::close = sub ($) { 76 | print "\n" if DRY_RUN; 77 | print "[close]\n"; 78 | return if DRY_RUN; 79 | CORE::close($_[0]); 80 | }; 81 | } 82 | 83 | use Carp qw/croak/; 84 | use Cwd qw/chdir/; 85 | use File::Basename qw/dirname/; 86 | use File::Spec::Functions qw/rel2abs catfile/; 87 | 88 | our $TEMP = '.home'; 89 | our $HOME; 90 | if (do { local $@; eval { require File::HomeDir; 1 } }) { 91 | $HOME = File::HomeDir->my_home; 92 | } 93 | elsif ($ENV{HOME}) { 94 | $HOME = $ENV{HOME}; 95 | } 96 | else { 97 | die "File::HomeDir required."; 98 | } 99 | 100 | sub new { 101 | my $class = shift; 102 | 103 | my $cwd = rel2abs(dirname(__FILE__)); 104 | chdir($cwd); 105 | 106 | mkdir $TEMP; 107 | return bless +{ 108 | bin_dir => catfile($cwd, 'bin'), 109 | zshrc_src => catfile($cwd, 'zsh', 'rc.sh'), 110 | gitconfig_src => catfile($cwd, 'git', 'config'), 111 | proverc_src => catfile($cwd, 'prove', 'rc'), 112 | perltidyrc_src => catfile($cwd, 'perltidy', 'rc'), 113 | tmuxconf_src => catfile($cwd, 'tmux', 'conf'), 114 | screenrc_src => catfile($cwd, 'screen', 'rc'), 115 | vimrc_src => catfile($cwd, 'vim', 'rc'), 116 | emacsd_src => catfile($cwd, 'emacs'), 117 | } => $class; 118 | } 119 | 120 | sub can { 121 | my $invocant = shift; 122 | MyDotfiles::Builder::Command->can(@_) 123 | } 124 | 125 | our $AUTOLOAD; 126 | sub AUTOLOAD { 127 | my $self = shift; 128 | my($method) = $AUTOLOAD =~ /::([^:]+)$/; 129 | 130 | if (my $code = $self->can($method)) { 131 | $self->$code(@_); 132 | } 133 | else { 134 | my $pkg = ref($self) || $self; 135 | croak qq{Can't locate object method "${method}" via package "MyDotfiles::Builder::Command"}; 136 | } 137 | } 138 | 139 | sub DESTROY {} 140 | 141 | package MyDotfiles::Builder::Command; 142 | use strict; 143 | use warnings; 144 | use utf8; 145 | 146 | use File::Spec::Functions qw/catfile/; 147 | use File::Path qw/mkpath/; 148 | use File::Copy qw/move/; 149 | 150 | sub build { 151 | my $self = shift; 152 | 153 | # dependency 154 | my @dependency = qw/bin zsh git prove perltidy screenrc tmuxconf vimrc emacs/; 155 | push @dependency => 'osx' if $^O eq 'darwin'; 156 | $self->$_ for @dependency; 157 | } 158 | 159 | sub install { 160 | my $self = shift; 161 | 162 | my $_install = sub { 163 | my ($self, $name) = @_; 164 | 165 | # hooks 166 | if ($name eq '.vimrc') { 167 | mkpath(catfile($HOME, '.vim', 'bundle')) unless -d catfile($HOME, '.vim', 'bundle'); 168 | mkpath(catfile($HOME, '.vim', 'tmp', 'swap')) unless -d catfile($HOME, '.vim', 'tmp', 'swap'); 169 | mkpath(catfile($HOME, '.vim', 'tmp', 'backup')) unless -d catfile($HOME, '.vim', 'tmp', 'backup'); 170 | mkpath(catfile($HOME, '.vim', 'tmp', 'undo')) unless -d catfile($HOME, '.vim', 'tmp', 'undo'); 171 | } 172 | 173 | move(catfile($HOME, $name), catfile($HOME, "${name}.bak")) if -e catfile($HOME, $name); 174 | move(catfile($TEMP, $name), catfile($HOME, $name)); 175 | }; 176 | 177 | # zshrc 178 | $self->$_install('.zshrc'); 179 | 180 | # git 181 | $self->$_install('.gitconfig'); 182 | 183 | # proverc 184 | $self->$_install('.proverc'); 185 | 186 | # perltidy 187 | $self->$_install('.perltidyrc'); 188 | 189 | # tmuxconf 190 | # $self->$_install('.tmux.conf'); 191 | 192 | # screenrc 193 | # $self->$_install('.screenrc'); 194 | 195 | # vimrc 196 | # $self->$_install('.vimrc'); 197 | 198 | # emacs 199 | $self->$_install('.emacs.d'); 200 | 201 | # bin 202 | $self->$_install('bin'); 203 | } 204 | 205 | sub zsh { 206 | my $self = shift; 207 | 208 | return if -f catfile($TEMP, '.zshrc'); 209 | open my $fh, '>', catfile($TEMP, '.zshrc') or die $!; 210 | print $fh "source $self->{zshrc_src}"; 211 | close $fh; 212 | } 213 | 214 | sub osx { 215 | system q{$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"}; 216 | system q{./osx/setup.sh}; 217 | system q{echo $(brew --prefix)/bin/zsh | sudo tee -a /etc/shells'}; 218 | system q{sudo chsh -s $(brew --prefix)/bin/zsh $USER}; 219 | } 220 | 221 | sub git { 222 | my $self = shift; 223 | 224 | symlink $self->{gitconfig_src}, catfile($TEMP, '.gitconfig') unless -f catfile($TEMP, '.gitconfig'); 225 | } 226 | 227 | sub perl { 228 | my $self = shift; 229 | 230 | # dependency 231 | my @dependency = qw/prove perltidy/; 232 | $self->$_ for @dependency; 233 | } 234 | 235 | sub prove { 236 | my $self = shift; 237 | 238 | symlink $self->{proverc_src}, catfile($TEMP, '.proverc') unless -f catfile($TEMP, '.proverc'); 239 | } 240 | 241 | sub perltidy { 242 | my $self = shift; 243 | 244 | symlink $self->{perltidyrc_src}, catfile($TEMP, '.perltidyrc') unless -f catfile($TEMP, '.perltidyrc'); 245 | } 246 | 247 | sub tmuxconf { 248 | my $self = shift; 249 | 250 | symlink $self->{tmuxconf_src}, catfile($TEMP, '.tmux.conf') unless -f catfile($TEMP, '.tmux.conf'); 251 | } 252 | 253 | sub screenrc { 254 | my $self = shift; 255 | 256 | symlink $self->{screenrc_src}, catfile($TEMP, '.screenrc') unless -f catfile($TEMP, '.screenrc'); 257 | } 258 | 259 | sub vimrc { 260 | my $self = shift; 261 | 262 | symlink $self->{vimrc_src}, catfile($TEMP, '.vimrc') unless -f catfile($TEMP, '.vimrc'); 263 | # system 'git', 'clone', 'git://github.com/Shougo/neobundle.vim', catfile($HOME, '.vim', 'bundle', 'neobundle.vim'); 264 | } 265 | 266 | sub emacs { 267 | my $self = shift; 268 | 269 | return if -f catfile($TEMP, '.emacs.d'); 270 | system 'git', 'submodule', 'init'; 271 | system 'git', 'submodule', 'update'; 272 | symlink $self->{emacsd_src}, catfile($TEMP, '.emacs.d'); 273 | } 274 | 275 | sub bin { 276 | my $self = shift; 277 | 278 | symlink $self->{bin_dir}, catfile($TEMP, 'bin') unless -f catfile($TEMP, 'bin'); 279 | } 280 | 281 | sub clean { 282 | my $self = shift; 283 | system 'rm', '-rf', $TEMP; 284 | } 285 | 286 | package main; 287 | use strict; 288 | use warnings; 289 | use utf8; 290 | 291 | die "Usage $0 build install clean" unless @ARGV; 292 | 293 | my $builder = MyDotfiles::Builder->new; 294 | $builder->$_ for grep { $builder->can($_) } @ARGV; 295 | -------------------------------------------------------------------------------- /tmux/conf: -------------------------------------------------------------------------------- 1 | set-option -g prefix C-] 2 | unbind-key C-b 3 | bind-key C-] send-prefix 4 | 5 | set-window-option -g utf8 on 6 | 7 | # View 8 | # ステータスライン更新間隔(秒) 9 | set -g status-interval 5 10 | set -g status-left-length 100 11 | set -g status-right-length 50 12 | 13 | # www1.hoge.com -> www1のみ表示。 14 | set-option -g set-titles-string "@#(hostname | sed 's/\\\\..*//')" 15 | 16 | # ステータスラインカスタム関連 17 | set -g status-bg black 18 | set -g status-fg white 19 | set -g status-attr dim 20 | # 左部:whoami@hostname 21 | set -g status-left '#[fg=green,bold][#20(whoami)@#H]#[default]' 22 | # 右部:[2011/03/06(Sun)20:21] 23 | set -g status-right '#[fg=green,bold][%Y/%m/%d(%a)%H:%M]#[default]' 24 | set -g message-attr bold 25 | set -g message-fg white 26 | set -g message-bg red 27 | 28 | set -g pane-active-border-fg white 29 | set -g pane-active-border-bg black 30 | 31 | set-window-option -g mode-bg white 32 | set-window-option -g mode-fg black 33 | set-window-option -g window-status-bg black 34 | set-window-option -g window-status-fg white 35 | set-window-option -g window-status-current-bg green 36 | set-window-option -g window-status-current-fg black 37 | set-window-option -g window-status-current-attr bold 38 | 39 | # KeyBindings 40 | # 直前のウィンドウ 41 | bind C-q last-window 42 | # 設定リロード 43 | bind r source-file ~/.tmux.conf 44 | # ウィンドウ選択画面 45 | bind Space choose-window 46 | # 新ウィンドウ作成 47 | bind c new-window 48 | # 分割していたペインそれぞれをWindowに 49 | bind b break-pane 50 | # ペインの縦分割 51 | bind h split-window -v -c '#{pane_current_path}' 52 | # ペインの横分割 53 | bind v split-window -h -c '#{pane_current_path}' 54 | 55 | # ペイン終了 56 | bind k kill-pane 57 | # ウィンドウ終了 58 | bind K kill-window 59 | # ペイン番号表示 60 | bind i display-panes -------------------------------------------------------------------------------- /vim/rc: -------------------------------------------------------------------------------- 1 | " .vimrcのエンコーディング指定 2 | scriptencoding utf-8 3 | 4 | " 非互換モード 5 | set nocompatible 6 | 7 | " バックアップファイルやスワップファイルをtmp以下に 8 | set directory=~/.vim/tmp/swap 9 | set backupdir=~/.vim/tmp/backup 10 | 11 | " アンドゥ履歴をファイルに保存。tmp以下に 12 | if has('persistent_undo') 13 | set undodir=~/.vim/tmp/undo 14 | set undofile 15 | endif 16 | 17 | " 文字コードの自動認識 18 | set encoding=utf-8 19 | set fileencodings=ucs-bom,iso-2022-jp-3,iso-2022-jp,eucjp-ms,euc-jisx0213,euc-jp,sjis,cp932,utf-8 20 | 21 | " 改行コードの自動認識 22 | set fileformats=unix,dos,mac 23 | 24 | " □とか○の文字があってもカーソル位置がずれないようにする 25 | if exists('&ambiwidth') 26 | set ambiwidth=double 27 | endif 28 | 29 | " display 30 | " ---------------------- 31 | set autochdir 32 | set number 33 | set cursorline 34 | highlight LineNr ctermfg=darkgrey 35 | set ruler 36 | set cmdheight=2 37 | set laststatus=2 38 | 39 | " statusline 40 | set statusline=%<%f\ %m%r%h%w%y%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%4v\ %l/%L 41 | set title 42 | set linespace=0 43 | set shiftwidth=4 44 | set shiftround 45 | set tabstop=4 46 | set expandtab 47 | set showmatch 48 | set showmode 49 | set wildmenu 50 | set showcmd 51 | "set textwidth=78 52 | "set columns=100 53 | "set lines=150 54 | " --------------------- 55 | syntax on 56 | colorscheme ron 57 | filetype on 58 | filetype plugin on 59 | filetype indent on 60 | 61 | " .psgiや.tもperlと見なす 62 | au BufNewFile,BufRead *.psgi set filetype=perl 63 | au BufNewFile,BufRead *.t set filetype=perl 64 | 65 | " コマンドライン補完。最長共通部分を補完しつつ候補をstatuslineに表示した後、 66 | " 候補を順に回る 67 | set wildmenu 68 | set wildmode=longest:full,full 69 | 70 | " タブを可視化 71 | set list 72 | set listchars=tab:>\ 73 | 74 | " 全角スペースとタブ文字の可視化 75 | highlight JpSpace cterm=underline ctermfg=Blue guifg=Blue 76 | au BufRead,BufNew * match JpSpace \  \ 77 | 78 | " ウィンドウ分割で上や左にではなく右や下に開くように 79 | set splitright 80 | set splitbelow 81 | 82 | " NeoBundle 83 | 84 | " Note: Skip initialization for vim-tiny or vim-small. 85 | if 0 | endif 86 | 87 | if has('vim_starting') 88 | if &compatible 89 | set nocompatible " Be iMproved 90 | endif 91 | 92 | " Required: 93 | set runtimepath+=~/.vim/bundle/neobundle.vim/ 94 | endif 95 | 96 | " Required: 97 | call neobundle#begin(expand('~/.vim/bundle/')) 98 | 99 | NeoBundleFetch 'Shougo/neobundle.vim' 100 | NeoBundle 'rhysd/vim-crystal' 101 | 102 | call neobundle#end() 103 | filetype plugin indent on 104 | NeoBundleCheck 105 | -------------------------------------------------------------------------------- /zsh/concat.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use utf8; 5 | 6 | use FindBin; 7 | use File::Spec::Functions qw/catfile/; 8 | 9 | open my $fh, '<', catfile($FindBin::Bin, 'rc.sh') 10 | or die $!; 11 | 12 | my @files; 13 | until (eof $fh) { 14 | chomp(my $line = <$fh>); 15 | if ($line =~ /^source/) { 16 | my ($file) = $line =~ m!src/([^.]+\.sh)$!; 17 | push @files => $file; 18 | } 19 | } 20 | 21 | close $fh; 22 | 23 | for my $file (@files) { 24 | my $path = catfile($FindBin::Bin, src => $file); 25 | 26 | # header 27 | print '#' x 64, $/; 28 | print "# $file", $/; 29 | print '#' x 64, $/; 30 | print $/; 31 | 32 | # body 33 | open my $fh, '<', $path or die $!; 34 | until (eof $fh) { 35 | my $line = <$fh>; 36 | print $line; 37 | } 38 | 39 | # sep 40 | my $is_last = $files[-1] eq $file; 41 | print $/ unless $is_last; 42 | } 43 | -------------------------------------------------------------------------------- /zsh/rc.sh: -------------------------------------------------------------------------------- 1 | if [[ -e $0 ]]; then 2 | SELF_PATH=$0 3 | else 4 | SELF_PATH=$(stat -f '%Y' $0); 5 | fi 6 | ZSHRC_BASEDIR=$(dirname $SELF_PATH); 7 | DOTFILES_BASEDIR=$(dirname $ZSHRC_BASEDIR); 8 | DOTFILES_EXTLIB=$DOTFILES_BASEDIR/extlib; 9 | 10 | source $ZSHRC_BASEDIR/src/common.sh 11 | source $ZSHRC_BASEDIR/src/completion.sh 12 | source $ZSHRC_BASEDIR/src/function.sh 13 | source $ZSHRC_BASEDIR/src/prompt.sh 14 | 15 | if [[ -f ~/.zshrc.local ]]; then 16 | source ~/.zshrc.local 17 | fi 18 | 19 | source $ZSHRC_BASEDIR/src/alias.sh 20 | source $ZSHRC_BASEDIR/src/finalize.sh 21 | -------------------------------------------------------------------------------- /zsh/src/alias.sh: -------------------------------------------------------------------------------- 1 | # minicpan 2 | if type minicpan > /dev/null 2>&1; then 3 | if ! which minicpan-update > /dev/null 2>&1; then 4 | alias minicpan-update="minicpan -l ~/.minicpan -r http://cpan.metacpan.org/" 5 | fi 6 | fi 7 | 8 | # VSCode 9 | if [ -d "/Applications/Visual Studio Code.app" ]; then 10 | alias code="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code" 11 | fi 12 | 13 | # os別alias 14 | case $( $DOTFILES_EXTLIB/bin/ostype ) in 15 | FreeBSD*|Darwin*) 16 | alias eject="drutil tray eject" 17 | ;; 18 | *) 19 | alias crontab="crontab -i" 20 | ;; 21 | esac 22 | 23 | # osバージョン別alias 24 | case $( $DOTFILES_EXTLIB/bin/ostype ) in 25 | Darwin-1[56]*) 26 | alias lockscreen="open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app" 27 | ;; 28 | Darwin*) 29 | alias lockscreen="open /System/Library/CoreServices/ScreenSaverEngine.app" 30 | ;; 31 | *) 32 | ;; 33 | esac 34 | 35 | ## その他alias 36 | alias tmux="tmux -2 -L karupas_dev" 37 | alias scp="scp -C" 38 | alias gi="git" 39 | alias sudo="sudo -i" 40 | alias random-string='perl -MSession::Token -E '"'"'say+Session::Token->new(length=>$ARGV[0]||10)->get'"'"'' 41 | alias sync='sudo sync && sudo sync && sudo sync' 42 | alias shutdown='sudo sync && sudo shutdown' 43 | alias reboot='sudo sync && sudo reboot' 44 | alias halt='sudo sync && sudo halt' 45 | alias rot13='tr a-mn-zA-MN-Z0-45-9 n-za-mN-ZA-M5-90-4' 46 | alias strings='strings -a' # CVE-2014-8485 47 | alias uri-escape="perl -MURI::Escape=uri_escape -pe '\$_ = uri_escape \$_'" 48 | alias uri-unescape="perl -MURI::Escape=uri_unescape -pe '\$_ = uri_unescape \$_'" 49 | alias whitespace-fix="perl -i -pe 's/\s+$/\n/'" 50 | alias perldoc-peco='perldoc `perl-module-list | peco`' 51 | alias cpandoc-peco='cpandoc `cpan-module-list | peco`' 52 | alias cpanm-peco='cpanm `cpan-module-list | peco`' 53 | alias edit-peco='emacs `if [ -d .git ]; then; git ls-files | peco; else; find . -type f | peco; fi`' 54 | alias project-peco='cd ~/project/`\ls ~/project | peco` && edit-peco' 55 | alias gocd='cd $GOPATH/src/`find $GOPATH/src -name .git -type d -maxdepth 4 -exec dirname {} \; | perl -pe "s{^$GOPATH/src/}{}" | peco`' 56 | alias sumup='perl -nE '"'"'$c+=$_}{say$c'"'"'' 57 | alias local2jst='perl -MTime::Piece -MPOSIX=tzset -E '"'"'$dt=localtime->strptime(join(" ", @ARGV), "%Y-%m-%d %H:%M:%S");$ENV{TZ}="Asia/Tokyo";tzset();say+localtime($dt->epoch)->strftime("%F %T")'"'"'' 58 | alias gmt2jst='perl -MTime::Piece -MPOSIX=tzset -E '"'"'$dt=Time::Piece->strptime(join(" ", @ARGV), "%Y-%m-%d %H:%M:%S");$ENV{TZ}="Asia/Tokyo";tzset();say+localtime($dt->epoch)->strftime("%F %T")'"'"'' 59 | alias jst2local='perl -MTime::Piece -MPOSIX=tzset -E '"'"'$ENV{TZ}="Asia/Tokyo";tzset();$dt=localtime->strptime(join(" ", @ARGV), "%Y-%m-%d %H:%M:%S");delete $ENV{TZ};tzset();say+localtime($dt->epoch)->strftime("%F %T")'"'"'' 60 | alias jst2gmt='perl -MTime::Piece -MPOSIX=tzset -E '"'"'$ENV{TZ}="Asia/Tokyo";tzset();$dt=localtime->strptime(join(" ", @ARGV), "%Y-%m-%d %H:%M:%S");delete $ENV{TZ};tzset();say+gmtime($dt->epoch)->strftime("%F %T")'"'"'' 61 | alias incr-t-index='perl -E '"'"'/^(.*\/)(0*)([0-9]+)(_.*)$/ && rename($_, $3 < 9 ? $1.$2.($3+1).$4 : $1.substr($2, 0, length($2) - 1).($3+1).$4) for @ARGV'"'"'' 62 | alias tz-env-peco='env TZ=`find /usr/share/zoneinfo -type f -mindepth 2 | cut -d/ -f 5- | peco`' 63 | alias gcd='(cd `ghq root`/`ghq list | peco` && $SHELL -l)' 64 | 65 | # anonymity for pbcopy 66 | alias anonimity-filter="perl -pe 's{\\Q$HOME}{\\\$HOME}g;s{\\Q$USER}{\\\$USER}g'" 67 | alias pbcopy-raw="`which pbcopy`" 68 | alias pbcopy="anonimity-filter | pbcopy" 69 | 70 | # docker 71 | alias docker-cleanup='docker ps -a -f "status=exited" -f "status=dead" --format "{{.ID}}" | xargs docker rm' 72 | alias docker-cleanup-image='docker images -f "dangling=true" --format "{{.ID}}" | xargs docker rmi' 73 | -------------------------------------------------------------------------------- /zsh/src/common.sh: -------------------------------------------------------------------------------- 1 | # 文字コードの設定 2 | export LANG=ja_JP.UTF-8 3 | export LC_CTYPE="ja_JP.UTF-8" 4 | export LC_NUMERIC="ja_JP.UTF-8" 5 | export LC_TIME="ja_JP.UTF-8" 6 | export LC_COLLATE="ja_JP.UTF-8" 7 | export LC_MONETARY="ja_JP.UTF-8" 8 | export LC_MESSAGES="ja_JP.UTF-8" 9 | export LC_PAPER="ja_JP.UTF-8" 10 | export LC_NAME="ja_JP.UTF-8" 11 | export LC_ADDRESS="ja_JP.UTF-8" 12 | export LC_TELEPHONE="ja_JP.UTF-8" 13 | export LC_MEASUREMENT="ja_JP.UTF-8" 14 | export LC_IDENTIFICATION="ja_JP.UTF-8" 15 | 16 | # ヒストリの設定 17 | export HISTFILE=~/.histfile 18 | export HISTSIZE=10000 19 | export SAVEHIST=10000 20 | 21 | # bin&extlib/binをPATHに追加 22 | typeset -U path 23 | path=( 24 | $HOME/bin 25 | $HOME/local/bin 26 | $DOTFILES_EXTLIB/bin 27 | $HOME/Library/Application\ Support/JetBrains/Toolbox/scripts 28 | $path 29 | ) 30 | 31 | # OS X 32 | if type brew &>/dev/null; then 33 | path=( 34 | $path 35 | $(brew --prefix)/share/git-core/contrib/diff-highlight 36 | $(brew --prefix)/share/git-core/contrib/git-jump 37 | $(brew --prefix)/share/git-core/contrib/stats 38 | $(brew --prefix)/share/git-core/contrib/subtree 39 | ) 40 | fi 41 | 42 | # 履歴ファイルに時刻を記録 43 | setopt extended_history 44 | 45 | ## jobsでプロセスIDも出力する。 46 | setopt long_list_jobs 47 | 48 | ## 全てのユーザのログイン・ログアウトを監視する。 49 | watch="all" 50 | 51 | ## ^Dでログアウトしないようにする。 52 | setopt ignore_eof 53 | 54 | ## ログイン時にはすぐに表示する。 55 | if eval 'builtin log' > /dev/null 2>&1; then 56 | builtin log 57 | fi 58 | 59 | ## ^Dでログアウトしないようにする。 60 | setopt ignore_eof 61 | 62 | ## 「/」も単語区切りとみなす。 63 | WORDCHARS=${WORDCHARS:s,/,,} 64 | 65 | ## 辞書順ではなく数字順に並べる。 66 | setopt numeric_glob_sort 67 | 68 | # コマンド訂正 69 | setopt correct 70 | 71 | # 複数の zsh を同時に使う時など history ファイルに上書きせず追加 72 | setopt append_history 73 | 74 | ## ヒストリを保存するファイル 75 | export HISTFILE=~/.zsh_history 76 | 77 | ## メモリ上のヒストリ数。 78 | ## 大きな数を指定してすべてのヒストリを保存するようにしている。 79 | export HISTSIZE=10000000 80 | 81 | ## 保存するヒストリ数 82 | export SAVEHIST=$HISTSIZE 83 | 84 | ## zshプロセス間でヒストリを共有する。 85 | setopt share_history 86 | 87 | ## C-sでのヒストリ検索が潰されてしまうため、出力停止・開始用にC-s/C-qを使わない。 88 | setopt no_flow_control 89 | 90 | # 直前と同じコマンドラインはヒストリに追加しない 91 | setopt hist_ignore_dups 92 | 93 | # ヒストリにhistoryコマンドを記録しない 94 | setopt hist_no_store 95 | 96 | ## スペースで始まるコマンドラインはヒストリに追加しない。 97 | setopt hist_ignore_space 98 | 99 | ## すぐにヒストリファイルに追記する。 100 | setopt inc_append_history 101 | 102 | ## Emacsキーバインドを使う。 103 | bindkey -e 104 | 105 | ## ディレクトリが変わったらディレクトリスタックを表示。 106 | chpwd_functions=($chpwd_functions dirs) 107 | 108 | ## cdで移動してもpushdと同じようにディレクトリスタックに追加する。 109 | setopt auto_pushd 110 | 111 | ## コマンド履歴の絞り込み 112 | autoload history-search-end 113 | zle -N history-beginning-search-backward-end history-search-end 114 | zle -N history-beginning-search-forward-end history-search-end 115 | bindkey '^P' history-beginning-search-backward-end 116 | bindkey '\e[A' history-beginning-search-backward-end 117 | bindkey '^N' history-beginning-search-forward-end 118 | bindkey '\e[B' history-beginning-search-forward-end 119 | 120 | ## 操作を確認する 121 | alias rm="rm -i" 122 | alias cp="cp -i" 123 | alias mv="mv -i" 124 | 125 | # ls系alias 126 | case $( $DOTFILES_EXTLIB/bin/ostype ) in 127 | FreeBSD*|Darwin*) 128 | alias ls="ls -G" 129 | alias la="ls -Ga" 130 | alias ll="ls -GlA" 131 | ;; 132 | *) 133 | alias ls="ls -hbF --color=auto" 134 | alias la="ls -hbaF --color=auto" 135 | alias ll="ls -hblaF --color=auto" 136 | ;; 137 | esac 138 | 139 | ## GNU grepがあったら優先して使う。 140 | if type ggrep > /dev/null 2>&1; then 141 | alias grep=ggrep 142 | fi 143 | 144 | ## emacsを使う。(emacs) 145 | export EDITOR="emacs" 146 | export VISUAL="emacs" 147 | ## emacsがなくてもemacsでvimを起動する。 148 | if ! type emacs > /dev/null 2>&1; then 149 | alias emacs="vim" 150 | fi 151 | 152 | if type colordiff > /dev/null 2>&1; then 153 | ## colordiffを優先する。 154 | alias diff="colordiff" 155 | fi 156 | 157 | # less 158 | if type less > /dev/null 2>&1; then 159 | export LESSCHARSET=utf-8 160 | fi 161 | 162 | # cpanm 163 | if type cpanm > /dev/null 2>&1; then 164 | export PERL_CPANM_OPT="--prompt --cascade-search --mirror http://ftp.ring.gr.jp/pub/lang/perl/CPAN/ --mirror http://cpan.metacpan.org/" 165 | fi 166 | 167 | # minicpan 168 | if type minicpan > /dev/null 2>&1; then 169 | export PERL_CPANM_OPT="--mirror file://$HOME/.minicpan $PERL_CPANM_OPT" 170 | fi 171 | 172 | # golang 173 | if type go > /dev/null 2>&1; then 174 | export GOROOT=`go env GOROOT` 175 | export GOPATH=$HOME/.go 176 | path=( 177 | $path 178 | $GOROOT/bin 179 | $GOPATH/bin 180 | ) 181 | fi 182 | -------------------------------------------------------------------------------- /zsh/src/completion.sh: -------------------------------------------------------------------------------- 1 | # 補完機能ON 2 | if type brew &>/dev/null; then 3 | fpath=($(brew --prefix)/share/zsh-completions $fpath) 4 | else 5 | fpath=(/usr/local/share/zsh-completions $fpath) 6 | fi 7 | autoload -Uz compinit 8 | compinit 9 | 10 | # 補完するかの質問は画面を超える時にのみに行う。 11 | LISTMAX=0 12 | 13 | ## 補完方法毎にグループ化する。 14 | ### 補完方法の表示方法 15 | ### %B...%b: 「...」を太字にする。 16 | ### %d: 補完方法のラベル 17 | zstyle ':completion:*' format '%B%d%b' 18 | zstyle ':completion:*' group-name '' 19 | 20 | ## 補完候補に色を付ける。 21 | ### "": 空文字列はデフォルト値を使うという意味。 22 | zstyle ':completion:*:default' list-colors "" 23 | 24 | ## --prefix=~/localというように「=」の後でも 25 | ## 「~」や「=コマンド」などのファイル名展開を行う。 26 | setopt magic_equal_subst 27 | 28 | ## globでパスを生成したときに、パスがディレクトリだったら最後に「/」をつける。 29 | setopt mark_dirs 30 | 31 | ## カーソル位置で補完する。 32 | setopt complete_in_word 33 | 34 | ## 補完時にヒストリを自動的に展開する。 35 | setopt hist_expand 36 | 37 | ## 補完候補がないときなどにビープ音を鳴らさない。 38 | setopt no_beep 39 | 40 | # sudo でも補完の対象 41 | zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin 42 | 43 | # 大文字小文字を区別せずに補完する 44 | zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 45 | 46 | # 補完候補が複数ある時に、一覧表示 47 | setopt auto_list 48 | 49 | # 補完結果をできるだけ詰める 50 | setopt list_packed 51 | 52 | # 補完キー(Tab, Ctrl+I) を連打するだけで順に補完候補を自動で補完 53 | setopt auto_menu 54 | 55 | # カッコの対応などを自動的に補完 56 | setopt auto_param_keys 57 | 58 | # ディレクトリ名の補完で末尾の / を自動的に付加し、次の補完に備える 59 | setopt auto_param_slash 60 | -------------------------------------------------------------------------------- /zsh/src/finalize.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karupanerura/dotfiles/4818048c9fbd0068d5adb93004b57f24f6b15472/zsh/src/finalize.sh -------------------------------------------------------------------------------- /zsh/src/function.sh: -------------------------------------------------------------------------------- 1 | function perlv { 2 | perl -M$1 -E "say \$$1::VERSION" 3 | } 4 | 5 | function runcpp { 6 | local bin=`tempfile` 7 | g++ -O2 $1 -o $bin; shift 8 | $bin $* 9 | rm -f $bin 10 | } 11 | 12 | function rungcc { 13 | local bin=`tempfile` 14 | gcc -O2 $1 -o $bin; shift 15 | $bin $* 16 | rm -f $bin 17 | } 18 | 19 | function runjava { 20 | JAVA_SRC=$1; shift; 21 | javac $JAVA_SRC 22 | java `echo $JAVA_SRC | sed -e 's/\.java$//'` $* 23 | } 24 | 25 | function google() { 26 | case $( $DOTFILES_EXTLIB/bin/ostype ) in 27 | Darwin*) 28 | open https://www.google.co.jp'/search?q='`echo -n "$@" | uri-escape` 29 | ;; 30 | *) 31 | echo https://www.google.co.jp'/search?q='`echo -n "$@" | uri-escape` 32 | ;; 33 | esac 34 | } 35 | 36 | function plenv-perl-version { 37 | # for asdf 38 | if [[ -n $ASDF_DIR ]]; then 39 | [[ -n $ASDF_PERL_VERSION ]] && { echo $ASDF_PERL_VERSION; return } 40 | 41 | local dir=$PWD 42 | while [[ -n $dir && $dir != "/" && $dir != "." ]]; do 43 | if [[ -f "$dir/.tool-versions" ]] && grep '^perl[[:space:]]' "$dir/.tool-versions" > /dev/null 2>&1; then 44 | grep '^perl[[:space:]]' "$dir/.tool-versions" | cut -d' ' -f2 45 | return 46 | fi 47 | dir=$dir:h 48 | done 49 | 50 | if [[ -f "$HOME/.tool-versions" ]] && grep '^perl[[:space:]]' "$HOME/.tool-versions" > /dev/null 2>&1; then 51 | grep '^perl[[:space:]]' "$HOME/.tool-versions" | cut -d' ' -f2 52 | return 53 | fi 54 | 55 | echo 'system' 56 | return 57 | fi 58 | 59 | # for plenv 60 | if [[ -d $HOME/.plenv ]]; then 61 | [[ -n $PLENV_VERSION ]] && { echo $PLENV_VERSION; return } 62 | 63 | local dir=$PWD 64 | while [[ -n $dir && $dir != "/" && $dir != "." ]]; do 65 | if [[ -f "$dir/.perl-version" ]]; then 66 | head -n 1 "$dir/.perl-version" 67 | return 68 | fi 69 | dir=$dir:h 70 | done 71 | 72 | local plenv_home=$PLENV_HOME 73 | [[ -z $PLENV_HOME && -n $HOME ]] && plenv_home="$HOME/.plenv" 74 | 75 | if [[ -f "$plenv_home/version" ]]; then 76 | head -n 1 "$plenv_home/version" 77 | fi 78 | fi 79 | 80 | # fallback to system perl 81 | echo 'system' 82 | return 83 | } 84 | 85 | function epoch2jst { 86 | local epoch=$1; shift 87 | TZ=Asia/Tokyo date -r $epoch +"%Y-%m-%dT%H:%M:%S%z" 88 | } 89 | 90 | function epoch2gmt { 91 | local epoch=$1; shift 92 | TZ=GMT date -r $epoch +"%Y-%m-%dT%H:%M:%S%z" 93 | } 94 | 95 | function dataurl() { 96 | local mimeType=$(file -b --mime-type "$1"); 97 | if [[ $mimeType == text/* ]]; then 98 | mimeType="${mimeType};charset=utf-8"; 99 | fi 100 | echo "data:${mimeType};base64,$(base64 $1 | tr '/+' '_-' | tr -d '=')"; 101 | } 102 | 103 | function seminar-mode { 104 | export PROMPT="${PROMPT:s/%%/ 105 | %%}" 106 | } 107 | 108 | function normal-mode { 109 | export PROMPT="${PROMPT:s/ 110 | %%/%%}" 111 | } 112 | 113 | ## tmuxで新しいペインで実行したいとき用 114 | nw(){ 115 | local CMDNAME split_opts spawn_command 116 | CMDNAME=`basename $0` 117 | 118 | while getopts dhvPp:l:t:b: OPT 119 | do 120 | case $OPT in 121 | "d" | "h" | "v" | "P" ) 122 | split_opts="$split_opts -$OPT";; 123 | "p" | "l" | "t" ) 124 | split_opts="$split_opts -$OPT $OPTARG";; 125 | * ) echo "Usage: $CMDNAME [-dhvP]" \ 126 | "[-p percentage|-l size] [-t target-pane] [command]" 1>&2 127 | return 1;; 128 | esac 129 | done 130 | shift `expr $OPTIND - 1` 131 | 132 | spawn_command=$@ 133 | [[ -z $spawn_command ]] && spawn_command=$SHELL 134 | 135 | tmux split-window `echo -n $split_opts` "cd $PWD ; $spawn_command" 136 | } 137 | 138 | _nw(){ 139 | local args 140 | args=( 141 | '-d[do not make the new window become the active one]' 142 | '-h[split horizontally]' 143 | '-v[split vertically]' 144 | '-l[define new pane'\''s size]: :_guard "[0-9]#" "numeric value"' 145 | '-p[define new pane'\''s size in percent]: :_guard "[0-9]#" "numeric value"' 146 | '-t[choose target pane]: :_guard "[0-9]#" "numeric value"' 147 | '*:: :_normal' 148 | ) 149 | _arguments ${args} && return 150 | } 151 | 152 | compdef _nw nw 153 | -------------------------------------------------------------------------------- /zsh/src/misc.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karupanerura/dotfiles/4818048c9fbd0068d5adb93004b57f24f6b15472/zsh/src/misc.sh -------------------------------------------------------------------------------- /zsh/src/prompt.sh: -------------------------------------------------------------------------------- 1 | # プロンプトの設定 2 | autoload -U colors; colors; 3 | 4 | #PROMPT='[%n@%M %~]$ ' 5 | PROMPT_BASE="%{$fg[blue]%}|%D{%Y-%m-%d %H:%M:%S}|%{${reset_color}%} %{$fg[green]%}[%~]%{${reset_color}%} %{$fg[red]%}%(!.#.%%)%{%}%{${reset_color}%} " 6 | 7 | PROMPT_BG_DANGER="${bg[red]}" 8 | function _update_prompt { 9 | if [ `whoami` = 'root' ]; then 10 | PROMPT="$PROMPT_BG_DANGER$PROMPT_BASE" 11 | else 12 | PROMPT=$PROMPT_BASE 13 | fi 14 | } 15 | 16 | function _update_rprompt { 17 | RPROMPT="%{$fg[blue]%}%{%}%n@%m%{${reset_color}%} [%{$fg[green]%}perl:$( plenv-perl-version )%{${reset_color}%}] $( git_prompt )"; 18 | } 19 | 20 | function _set_env_git_current_branch { 21 | GIT_CURRENT_BRANCH=$([[ -d .git ]] && cat .git/HEAD | cut -d/ -f 3-); 22 | } 23 | 24 | # ここの部分を作る 25 | # [branch:master](modified)(untracked) 26 | GIT_PROMPT_COLOR_DIRTY="%{$fg[red]%}" 27 | GIT_PROMPT_COLOR_CLEAN="%{$fg[green]%}" 28 | function git_prompt { 29 | # ブランチ名が取れなければ何もしないよ 30 | if [ $GIT_CURRENT_BRANCH ]; then 31 | # ステータスの取得 32 | GIT_CURRENT_STATUS=$( git_status ); 33 | 34 | # レポジトリが綺麗ならグリーン、汚ければレッドに色づけするよ 35 | GIT_PROMPT_COLOR=''; 36 | if [ $GIT_CURRENT_STATUS ]; then 37 | GIT_PROMPT_COLOR=$GIT_PROMPT_COLOR_DIRTY; 38 | else 39 | GIT_PROMPT_COLOR=$GIT_PROMPT_COLOR_CLEAN; 40 | fi 41 | 42 | # 色付けと出力 43 | GIT_BRANCH="${GIT_PROMPT_COLOR}$PROMPT_PAREN[1]branch:${GIT_CURRENT_BRANCH}$PROMPT_PAREN[2]%{${reset_color}%}" 44 | GIT_CURRENT_STATUS="%{$fg[yellow]%}${GIT_CURRENT_STATUS}%{${reset_color}%}" 45 | echo "[${GIT_BRANCH}]${GIT_CURRENT_STATUS}" 46 | fi 47 | } 48 | 49 | # レポジトリの状態によって右プロンプトの表示が長くなってくる君。 50 | # "(modified)(untracked)" の部分を作ってくれる。 51 | GIT_PROMPT_ADDED="(added)" 52 | GIT_PROMPT_MODIFIED="(modified)" 53 | GIT_PROMPT_DELETED="(deleted)" 54 | GIT_PROMPT_RENAMED="(renamed)" 55 | GIT_PROMPT_UNMERGED="(unmerged)" 56 | GIT_PROMPT_UNTRACKED="(untracked)" 57 | GIT_PROMPT_UNKNOWN="(unknown)" 58 | function git_status { 59 | GIT_STATUS_ADDED=0 60 | GIT_STATUS_MODIFIED=0 61 | GIT_STATUS_DELETED=0 62 | GIT_STATUS_RENAMED=0 63 | GIT_STATUS_UNMERGED=0 64 | GIT_STATUS_UNTRACKED=0 65 | GIT_STATUS_UNKNOWN=0 66 | for ST in $(git status --porcelain 2> /dev/null | cut -b -2 | tr ' ' S | uniq); do 67 | case $ST in 68 | '??') 69 | GIT_STATUS_UNTRACKED=1 70 | ;; 71 | AS|MS) 72 | GIT_STATUS_ADDED=1 73 | ;; 74 | AM|SM|ST|MM) 75 | GIT_STATUS_MODIFIED=1 76 | ;; 77 | SR) 78 | GIT_STATUS_RENAMED=1 79 | ;; 80 | AD|SD) 81 | GIT_STATUS_DELETED=1 82 | ;; 83 | UU) 84 | GIT_STATUS_UNMERGED=1 85 | ;; 86 | *) 87 | GIT_STATUS_UNKNOWN=1 88 | ;; 89 | esac 90 | done 91 | 92 | GIT_STATUS='' 93 | if [ $GIT_STATUS_UNTRACKED = 1 ]; then 94 | GIT_STATUS="$GIT_PROMPT_UNTRACKED$GIT_STATUS" 95 | fi 96 | if [ $GIT_STATUS_ADDED = 1 ]; then 97 | GIT_STATUS="$GIT_PROMPT_ADDED$GIT_STATUS" 98 | fi 99 | if [ $GIT_STATUS_MODIFIED = 1 ]; then 100 | GIT_STATUS="$GIT_PROMPT_MODIFIED$GIT_STATUS" 101 | fi 102 | if [ $GIT_STATUS_RENAMED = 1 ]; then 103 | GIT_STATUS="$GIT_PROMPT_RENAMED$GIT_STATUS" 104 | fi 105 | if [ $GIT_STATUS_DELETED = 1 ]; then 106 | GIT_STATUS="$GIT_PROMPT_DELETED$GIT_STATUS" 107 | fi 108 | if [ $GIT_STATUS_UNMERGED = 1 ]; then 109 | GIT_STATUS="$GIT_PROMPT_UNMERGED$GIT_STATUS" 110 | fi 111 | if [ $GIT_STATUS_UNKNOWN = 1 ]; then 112 | GIT_STATUS="$GIT_PROMPT_UNKNOWN$GIT_STATUS" 113 | fi 114 | 115 | echo $GIT_STATUS 116 | } 117 | 118 | precmd () { 119 | _set_env_git_current_branch 120 | _update_rprompt 121 | } 122 | 123 | chpwd () { 124 | _set_env_git_current_branch 125 | _update_rprompt 126 | ls 127 | } 128 | 129 | _set_env_git_current_branch 130 | _update_prompt 131 | _update_rprompt 132 | --------------------------------------------------------------------------------