Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Emacsとその周辺 / Emacs and CLI tools

Emacsとその周辺 / Emacs and CLI tools

社内勉強会の資料です

FUJIWARA Shunichiro

June 16, 2017
Tweet

More Decks by FUJIWARA Shunichiro

Other Decks in Technology

Transcript

  1. ͳͥ Emacs Λ࢖͍ͬͯΔͷ͔ 1. େֶͰ࠷ॳʹ࢖Θ͞Εͨͷ͕ Mule ͩͬͨ(1994೥) Emacs → Nemacs(೔ຊޠԽ)

    → Mule(ଟݴޠԽ) → ຊମʹ੒ՌऔΓࠐΈ(Emacs 20,21) 2. ͦͷޙ JED Λ Emacs ΩʔόΠϯυͰ࢖ͬͯͨ(2000೥) www.jedsoft.org/jed/ 3. Emacs ʹ໭͖ͬͯͨ (200?೥)
  2. emacsclient ىಈ͍ͯ͠Δ Emacs ʹରͯ͠ϑΝΠϧΛ։͔ͤΔίϚϯυ ;; .emacs (server-start) # .zshrc alias

    ec='emacsclient -n' $ ec ϑΝΠϧ໊ Ͱىಈ͍ͯ͠Δ Emacs ͰϑΝΠϧΛ։͚Δ
  3. peco github.com/peco/peco Ctrl-R ͰώετϦΛ peco ͰḷΔ # .zshrc function peco_select_history()

    { BUFFER=$(fc -l -n 1 | gtac | peco --query "$LBUFFER") CURSOR=$#BUFFER # move cursor zle -R -c # refresh } zle -N peco_select_history bindkey '^R' peco_select_history
  4. ghq + peco github.com/motemen/ghq GoͷϦϙδτϦϨΠΞ΢τͰશͯͷ git repo Λ഑ஔ͢Δౕ peco Ͱબ୒ͯ͠

    cd ͢Δ function peco-src () { local selected_dir=$(ghq list | peco --query "$LBUFFER") if [ -n "$selected_dir" ]; then BUFFER="cd $HOME/src/${selected_dir}" zle accept-line fi zle clear-screen } zle -N peco-src bindkey '^]' peco-src
  5. direnv github.com/direnv/direnv # .envrc export AWS_PROFILE=someproject-assumerole export AWS_REGION=ap-northeast-1 $ cd

    /Users/fujiwara/src/github.com/fujiwara/someproject direnv: loading .envrc direnv: export +AWS_PROFILE +AWS_REGION ϓϩδΣΫτʹԠͨ͡؀ڥม਺Λઃఆ
  6. ag + peco + ec github.com/ggreer/the_silver_searcher/ ཁ͢Δʹ͍͢͝ grep # .zshrc

    agec () { emacsclient -n $(ag $@ | peco --query "$LBUFFER" | awk -F: '{print "+" $2, $1}') } ag Ͱ grep ͨ݁͠ՌΛ peco Ͱબ୒ "ϑΝΠϧ໊:ߦ൪߸:ߦͷ಺༰" → awk Ͱ "+ߦ൪߸ ϑΝΠϧ໊" emacsclient -n +10 foo.txt (foo.txt Λ Emacs Ͱ։͍ͯ10ߦ໨ʹҠಈ)