Skip to content

Instantly share code, notes, and snippets.

@bootleq
bootleq / zaw-in-zshrc.zsh
Created July 26, 2011 02:49
zaw 簡易設定例
# zaw 設定
# zaw - https://github.com/nakamuray/zaw
# 沒有 zaw.zsh 的話就跳過
# 所以要先 git clone git://github.com/nakamuray/zaw.git ~/repository
if [ -e ~/repository/zaw/zaw.zsh ]; then
source ~/repository/zaw/zaw.zsh
# 改 key binding,有需要再改啦
# bindkey ",ff" zaw
@bootleq
bootleq / gist:1149395
Created August 16, 2011 15:47
Right justify *keyword* in Vim help files.
" }}}2 help 檔案將 *keyword* 對齊到右端 {{{2
function! HelpHyperTextEntryJustify()
let save_isk = &l:iskeyword
let save_et = &l:expandtab
let &l:isk = '!-~,^*,^|,^",192-255'
let &l:expandtab = 1
.retab!
call setline(".",
\ substitute(
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Google 字典 Morebile</os:ShortName>
<os:Description>Google 字典 Morebile</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/gif;base64,R0lGODlhEAAQAPcAAP%2F%2F%2F%2F%2F%2FzP%2F%2Fmf%2F%2FZv%2F%2FM%2F%2F%2FAP%2FM%2F%2F%2FMzP%2FMmf%2FMZv%2FMM%2F%2FMAP%2BZ%2F%2F%2BZzP%2BZmf%2BZZv%2BZM%2F%2BZAP9m%2F%2F9mzP9mmf9mZv9mM%2F9mAP8z%2F%2F8zzP8zmf8zZv8zM%2F8zAP8A%2F%2F8AzP8Amf8AZv8AM%2F8AAMz%2F%2F8z%2FzMz%2Fmcz%2FZsz%2FM8z%2FAMzM%2F8zMzMzMmczMZszMM8zMAMyZ%2F8yZzMyZmcyZZsyZM8yZAMxm%2F8xmzMxmmcxmZsxmM8xmAMwz%2F8wzzMwzmcwzZswzM8wzAMwA%2F8wAzMwAmcwAZswAM8wAAJn%2F%2F5n%2FzJn%2FmZn%2FZpn%2FM5n%2FAJnM%2F5nMzJnMmZnMZpnMM5nMAJmZ%2F5mZzJmZmZmZZpmZM5mZAJlm%2F5lmzJlmmZlmZplmM5lmAJkz%2F5kzzJkzmZkzZpkzM5kzAJkA%2F5kAzJkAmZkAZpkAM5kAAGb%2F%2F2b%2FzGb%2FmWb%2FZmb%2FM2b%2FAGbM%2F2bMzGbMmWbMZmbMM2bMAGaZ%2F2aZzGaZmWaZZmaZM2aZAGZm%2F2ZmzGZmmWZmZmZmM2ZmAGYz%2F2YzzGYzm
@bootleq
bootleq / indent.rb
Created September 14, 2011 02:00
Test example for indent adjustment when leaving insert mode.
def
# vim: ft=ruby expandtab sts=2 sw=2
@bootleq
bootleq / gist:1242220
Created September 26, 2011 13:23
Old way to toggle words, I no longer use it.
" }}}2 ToggleTextOption {{{2
" http://vim.wikia.com/wiki/Toggling_yes-no
function! ToggleTextOption()
let w = expand("<cword>")
call RegStash(1, '"') | normal yl
let c = @" | call RegStash(0, '"')
let pairs = [
\ ["true", "false"],
@bootleq
bootleq / gist:1286366
Created October 14, 2011 06:04
ToggleTreeStyleTab for keyconfig
if (typeof gBrowser.treeStyleTab !== 'undefined') {
var ah = gBrowser.treeStyleTab.autoHide;
if (ah.expanded) {
ah.hide(ah.kSHOWN_BY_SHORTCUT);
} else {
ah.show(ah.kSHOWN_BY_SHORTCUT);
}
}
// issue: wrong splitter position when auto hide is not enabled.
@bootleq
bootleq / gist:1455020
Created December 10, 2011 12:15
Vim 陽春 google 字典,反正已經沒用了,google 停了這服務
nnoremap <silent> <LocalLeader>K :DictSearch<CR>
xnoremap <silent> <LocalLeader>K :<C-U>call SaveReg()<CR>gvy:let b:temp_reg=@"<CR>
\ :call RestoreReg()<CR>:call DictSearch(b:temp_reg)<CR>
command! -nargs=* DictSearch call DictSearch(<f-args>)
command! -nargs=0 DictSearchOff call <SID>dict_search_off()
function! DictSearch(...)
let save_isk = &l:iskeyword
let &l:iskeyword = '@'
let word = a:0 > 0 ? a:1 : expand('<cword>')
let mode = a:0 > 1 ? a:2 : ''
@bootleq
bootleq / gist:1489352
Created December 17, 2011 05:36
Vim 陽春 Dr.eye 字典,沒在用了,太慢
command! -nargs=* DictSearch call DictSearch(<f-args>)
" 來源:Dr.eye 字典 移動版
" 例: http://www.dreye.com/mws/dict.php?w=word&ua=dc_cont
let s:dict_search_modes = {
\ 'keys': ['cont', 'var', 'phra', 'diff', 'der' ],
\ 'values': ['字義', '變化', '片語', '辨析', '衍生']
\ }
function! DictSearch(...)
let word = a:0 > 0 ? a:1 : ''
@bootleq
bootleq / upgrade_vim.sh
Created April 4, 2012 03:24
Install/upgrade Vim from source
#!/bin/bash
# 安裝相依套件
apt-get install mercurial
apt-get install exuberant-ctags
# 取得 vim source
cd /usr/local/src
@bootleq
bootleq / upgrade_tig.sh
Created October 4, 2015 05:52
Install tig from source
#!/bin/bash
if which apt-get 2>&1 >/dev/null; then
[[ -z $(dpkg --get-selections | grep libncursesw5-dev) ]] && sudo apt-get install -y libncursesw5-dev
elif which brew 2>&1 >/dev/null; then
brew install tig --with-docs
exit
fi