2012年12月30日日曜日

iterm2で画面分割


iTerm2は、複数のセッションを複数の"ぺイン(窓枠)"にcmd+dやcmd+shift+dで分割表示する事ができます。ペイン間の移動は下記のショートカットになります。
  • cmd+opt+←:左のペインに移動
  • cmd+opt+→:左のペインに移動
  • cmd+opt+↑:上のペインに移動
  • cmd+opt+↓:下のペインに移動
  • cmd+[:前ペインに移動
  • cmd+]:次ペインに移動
ウィンドウを閉じるのは exit

2012年12月17日月曜日

メモ


{
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"theme": "Soda Dark.sublime-theme",
"font_face": "Monaco",
"font_size": 14.0,
// 改行でのフォーマットをしない(日本語変換の確定のため) for Emmet
"disable_formatted_linebreak": true,
"disable_tab_abbreviations": true
}

2012年12月14日金曜日

Sublime Text 2 Dropbox 同期 Script


Sublime Text 2 のパッケージを Dropbox において置く事で

例えば、仕事場で同期させた設定で家で使えるようにする

スクリプトを書いた。

githubのURL

git clone して使ってください。

git clone git@github.com:yanap/tools.git

git clone https://github.com/yanap/tools.git

./sublime-packages-sync-to-dropbox.sh

いけてないのは、ローカルからDropboxにパッケージをコピーするときに

いっぱいあると重い

2012年12月9日日曜日

sublime text2でコメント内で日本語入力ができなくなった

おかしいなと思ってたけど

// 改行でのフォーマットをしない(日本語変換の確定のため) for Emmet
"disable_formatted_linebreak": true

Emmetの設定やけど、これで、DocBlockr入れてても、コメント内で日本語うてる

と思ったけど

// ああああ
はいけるけど

/**
 * ああああ 
 */
は無理だわ。

2012年12月4日火曜日

mac キーリピート

システム環境設定 → キーボード


キーリピートの速さ 現在の設定を表示

defaults read NSGlobalDomain KeyRepeat 

キーリピート開始までの早さ 現在の設定を表示

defaults read NSGlobalDomain InitialKeyRepeat
キーリピートの速さ 1 に設定する(小さい程速い)

defaults write NSGlobalDomain KeyRepeat -int 1
キーリピート開始までの早さ 10 に設定する(小さい程早い)

defaults write NSGlobalDomain InitialKeyRepeat -int 10
キーリピート入力認識までの時間

git 補完 設定 (bash)

git 補完

やっと、gitのコマンドをうつときにターミナル(bash)で補完するするように設定した。

まず

home brew が使える前提で gitが入ってる前提で 使ってるPCがMacっていう前提で

brew install bash-completion

 /etc/bashrc に下記を追加
 # bash_completion                                                                                                                    
 BASH_COMPLETION=/usr/local/etc/bash_completion                                                                                                                  
 BASH_COMPLETION_DIR=/usr/local/etc/bash_completion.d                                                                                                                
 BASH_COMPLETION_COMPAT_DIR=/usr/local/etc/bash_completion.d                                                                                                                  
 if [ -f /usr/local/etc/bash_completion ]; then                                                                                                            
     . /usr/local/etc/bash_completion                                                                                                             
 fi
https://github.com/yanap/dotfiles/blob/master/.bashrc

git-completion.bashがなかった時


とってきて

sublime text2 設定

sublime text 2 設定


http://www.sublimetext.com/

package


package control を設定してsublime text2上で色々なパッケージをインストールできるようにする。

http://wbond.net/sublime_packages/package_control/installation

view -> show console



import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

をあれする。
http://wbond.net/sublime_packages/package_control/usage

そして、sublime text2を再起動する

そしたら、⌘+Shift+Pしてinstallを小窓に入力したら、パッケージインストール画面にいける。

short cut

Command PalletCommand + Shift + p
画面分割Command + alt + 1〜4
project内検索Command + P
ファイル内検索Command + F
regexCommand + alt + F で置換
フォルダを指定して search and regexCommand + Shift + F
タブ追加Command + t
タブ移動Command + alt + <- or ->
function searchCommand + R

不可視文字

デフォルトだと選択すると見えるようになる
常に見たいときは下記を設定する
 "draw_white_space": "all" 

文字コード

文字コードはデフォルト utf-8 だったので、変えなくていいはず

キーバインドをvimに

 "ignored_packages": []

DropBoxで同期しよう

※主にこれのために書いた

http://wheels.onebuttonapps.net/2012/04/use-dropbox-to-store-your-sublime-text-2-settings/


On OS X (Mac)

  1. First close Sublime Text 2
  2. In your Dropbox folder (usually it’s at “~/Dropbox/"), add a folder called “Sublime Text 2"
  3. Go to your Sublime Text 2 settings (this is usually at “~/Library/Application\ Support/Sublime\ Text\ 2/")
  4. Copy the following 3 folders into “~/Dropbox/Sublime\ Text\ 2/ "
    • "Installed Packages"
    • "Packages"
    • "Pristine Packages"
  5. Rename the 3 original folders in “~/Library/Application\ Support/Sublime\ Text\ 2/" or delete them.
  6. Next go back to Terminal
  7. From the command line type “cd ~/Library/Application\ Support/Sublime\ Text\ 2/" 
  8. "ln -s ~/Dropbox/Sublime\ Text\ 2/Installed\ Packages ./Installed\ Packages"
  9. "ln -s ~/Dropbox/Sublime\ Text\ 2/Packages ./Packages"
  10. "ln -s ~/Dropbox/Sublime\ Text\ 2/Pristine\ Packages ./Pristine\ Packages"
Start Sublime Text 2 and you’ll be linked to Dropbox.
On your other devices do
  • "mv ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User /tmp"
  • "ln -s ~/Dropbox/Sublime\ Text\ 2/Packages/User ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User"

要は終了してシンボリックリンク貼って起動して同期させるだけですわ。

Quit
  1. cd ~/Library/Application\ Support/Sublime\ Text\ 2/
  2. rm -rf Installed\ Packages Packages Pristine\ Packages
  3. ln -s ~/Dropbox/Sublime\ Text\ 2/Installed\ Packages ./Installed\ Packages
  4. ln -s ~/Dropbox/Sublime\ Text\ 2/Packages ./Packages
  5. ln -s ~/Dropbox/Sublime\ Text\ 2/Pristine\ Packages ./Pristine\ Packages
Start

1. git@github.com:yanap/tools.git

2. ./sublime-packages-sync-to-dropbox.sh

で、できるshellを書いた。

https://github.com/yanap/tools


2012年5月19日土曜日

memo

memo

"base
set nocompatible
set vb t_vb=

"search
set history=100

"color
colorscheme darkblue
syntax on

"display
set title
set number
set ruler
set showcmd
set laststatus=2
set hlsearch
set wildmenu
set textwidth=0
set tabstop=4
set shiftwidth=4

"encode
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,euc-jp,cp932,iso-2022-jp
set fileencodings+=,ucs-2le,ucs-2,utf-8

autocmd BufWrite *.php :call PHPLint()
function PHPLint()
        let result = system( &ft . ' -l ' . bufname(""))
        echo result
endfunction

2012年5月5日土曜日

Homebrewを使ってみた

Home brewを使ってみた

MacPortsと比べて依存関係でインストールされるソフトが少ないためか、パッケージ管理にHomebrewを使う人が増えているそうです。

MacPortsは、Macに最初から入っているソフトを無視してパッケージが依存するソフトを新規でインストールするという性質を持っていますが、Homebrewは極力Macに入っているものを使うように作られています。

このため、パッケージ導入時のシステムへの負担や、インストールにかかる時間が比較的少なくて済みます。

また、スーパーユーザー(sudo)でコマンドを実行する必要が無く、一般ユーザー権限で使うことが出来ます。

■インストール

■コマンド
$ brew doctor 
インストールされたか確認する、ちゃんとインストールされていないと、Errorがでる


$ brew -v
brewのバージョンを確認


$ man brew

ESSENTIAL COMMANDS (基本的なコマンド)

$ brew install パッケージ名

$brew remove パッケージ名

$ brew update
brew を最新版にする。バージョン管理にgitを使ってるので、入れておく

$ brew list
インストール済みを一覧表示

$ brew search 検索したいパッケージの文字列

基本こんだけ。

■インストールしてみる

$ brew install tree
treeコマンドをインストール

$ brew install wget
wgetコマンドをインストール



■用語解説
Homebrewではパッケージのことを「formula」、パッケージがインストールされる場所を「cellar」と言います。ちなみに日本語に訳すと以下のようになります。


Homebrew(ホームブリュー): 自家醸造酒、自家製ビール
formula(フォーミュラ): 調理法、製法
cellar(セラー):(食料、燃料、ワインの)地下貯蔵庫

macports更新とhomebrewインストール

Macports と homebrew

■概要


構築場所→Mac OS X Lion 10.7.3


■mac ports をアップデート


sudo port selfupdate


↑のコマンドを実行したんだけど、エラーがでるので


downloads for apple developer


↑でCommand Line Tools for Xcodeってのをダウンロードしてインストールしたら
mac ports 関連のがはいってて




sudo port selfupdate
sudo port sync


できました。

■homebrewのインストール

1. 古いXcodeのアンインストール
Xcode3系が入っていたので、アンインストールする。

$ sudo /Developer/Library/uninstall-devtools --mode=all


2.  新しいXcodeをインストール
downloads for apple developer
ダウンロードしてきて
/Applications/Xcode.app
を実行してインストールする。

3. homebrewをインストール
上記のgithubに記述されているように下記のコマンドをターミナルで叩く


/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"


4. homebrewがちゃんとインストールされているかチェック


$ brew doctor
Error: /Library/Frameworks/Mono.framework detected
This can be picked up by CMake's build system and likely cause the build to
fail. You may need to move this file out of the way to compile CMake. 
→ とりえあず、Mono.frameworkでぐぐる
http://www.mono-project.com/Mono:OSX
ここに書いてる


#!/bin/sh -x

#This script removes Mono from an OS X System.  It must be run as root

rm -r /Library/Frameworks/Mono.framework

rm -r /Library/Receipts/MonoFramework-*

for dir in /usr/bin /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man5; do
   (cd ${dir};
    for i in `ls -al | grep /Library/Frameworks/Mono.framework/ | awk '{print $9}'`; do
      rm ${i}
    done);
done
これを ~/bin/ に
vim uninstall_mono_mac.sh に書いて実行して消してみる


Error: You have Macports or Fink installed.
This can cause trouble. You don't have to uninstall them, but you may like to
try temporarily moving them away, eg. 
sudo mv /opt/local ~/macports 
→ sudo mv /opt/loacal ~/macportsを実行しろっていってる見たいなので実行


Error: Your pkg-config is not checking "/usr/X11/lib/pkgconfig" for packages.
Earlier versions of the pkg-config formula did not add this path
to the search path, which means that other formula may not be able
to find certain dependencies.


To resolve this issue, re-brew pkg-config with:
  brew rm pkg-config && brew install pkg-config
Error: You have a non-brew 'pkg-config' in your PATH:
  /opt/local/bin/pkg-config


`./configure` may have problems finding brew-installed packages using
this other pkg-config.
→ここはわからないけど、Mono消したらなくなった。


Error: Your Xcode is configured with an invalid path.
You should change it to the correct path. Please note that there is no correct
path at this time if you have *only* installed the Command Line Tools for Xcode.
If your Xcode is pre-4.3 or you installed the whole of Xcode 4.3 then one of
these is (probably) what you want:


    sudo xcode-select -switch /Developer
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer


DO NOT SET / OR EVERYTHING BREAKS!


→ ここは二つのsudoのコマンドをそのまま実行で消えた




yanap@~$brew doctor
Your system is raring to brew. → このメッセージがでたらパッケージをインストールできる状態みたいです。