Skip to content

Instantly share code, notes, and snippets.

@sgur
sgur / .tmux.conf
Created April 17, 2014 07:34
.tmux.conf
set-option -g prefix C-z
unbind-key C-b
bind-key C-z send-prefix
set-option -g default-terminal screen-256color
set -g terminal-overrides 'xterm:colors=256'
bind r source-file ~/.tmux.conf
set-window-option -g mode-keys vi
@sgur
sgur / codic-complete.vim
Last active August 29, 2015 14:04
Completion using codic-vim
inoremap <silent> <C-x><C-t> <C-R>=<SID>codic_complete()<CR>
function! s:codic_complete()
let line = getline('.')
let start = match(line, '\k\+$')
let cand = s:codic_candidates(line[start :])
call complete(start +1, cand)
return ''
endfunction
function! s:codic_candidates(arglead)
let cand = codic#search(a:arglead, 30)
@sgur
sgur / hi-c.vim
Created July 31, 2014 03:16
カーソル行下のハイライトを行う (https://github.com/osyo-manga/vim-brightest) が出るまでの暫定版もしくは1ファイルのお手軽・計量版
" HI-C.vim (HIghlight-Cword)
" Version: 0.0.2
" Author: sgur
" License: MIT
if exists('g:loaded_hi_c') && g:loaded_hi_c
finish
endif
let g:loaded_hi_c = 1
@sgur
sgur / guard.vim
Last active August 29, 2015 14:05
source したときに autoload 末尾でエラーを防ぐ (うろ覚え)
let s:save_cpo = &cpo
set cpo&vim
" なんかコード
if expand("%:p") == expand("<sfile>:p")
finish
endif
let &cpo = s:save_cpo
unlet s:save_cpo
@sgur
sgur / fcitx_ctrl.vim
Last active August 29, 2015 14:05
Vimからfcitxの制御をする簡単な設定
set iminsert=2
set imsearch=2
set imcmdline
set imactivatefunc=ImActivate
function! ImActivate(active)
if a:active
call system('fcitx-remote -o')
else
call system('fcitx-remote -c')
endif
" indent
set vsvim_useeditordefaults
" Options
set clipboard=unnamed
set ignorecase
set incsearch
set hlsearch
" Jump
@sgur
sgur / codic_test.vim
Last active August 29, 2015 14:22
Codic Ver.3 の API (Ver.1) のサンプル
let s:access_token = 'so0RiFwQJIfvHFBdVDJa2fUyxtAwpAgTS'
let s:host = 'https://api.codic.jp'
let s:resourece = '/v1/user_projects.json'
unlet! s:resp
let s:resp = eval(webapi#http#get(s:host . s:resourece,
\ {},
\ {
\ 'Authorization' : 'Bearer ' . s:access_token
@sgur
sgur / 2015-06-26-160406.vim
Last active August 29, 2015 14:23
webapi を使って WebDriver を叩くサンプル
" Naviaget webdriver via vimscript
" https://code.google.com/p/selenium/wiki/JsonWireProtocol
scriptencoding utf-8
let s:webdriver_path = expand('chromedriver.exe', 1)
function! s:webdriver_start(port)
" execute printf('!start %s --port=%d', s:webdriver_path, a:port)
return vimproc#popen3(printf('%s --port=%d', tr(s:webdriver_path, '\', '/'), a:port))
endfunction

title: msysgit で guilt を利用する

Vimのリポジトリも code.google.com での mercurial ベースの運用から、github へリポジトリを移してきていて、 そろそろ hg + mq によるパッチ管理から、git + guilt へ移行してこなきゃな、という事で、guiltを導入してみます。

Linux であれば大した問題でもないので、今回は Windows で msysgit を使う場合です。

stable の Ver.1.9.5 では確認していません。 Fifth release candidate of Git for Windowsを利用しています。

noremap <expr> j <SID>cast('j')
noremap <expr> k <SID>cast('k')
noremap <expr> h <SID>cast('h')
noremap <expr> l <SID>cast('l')
function! s:cast(key) "{{{
return repeat('gs', !v:count) . a:key
endfunction "}}}