Skip to content

Instantly share code, notes, and snippets.

@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(
@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 / space-ao.vim
Created July 3, 2011 03:17 — forked from ujihisa/space-ao.vim
See first comment
" Modified from kana's useful tab function {{{
function! s:move_window_into_tab_page(...)
" Move the current window into target_tabpagenr.
" a:1 - target_tabpagenr : if not set, move into new tab page.
" a:2 - open_relative : open new tab aside current tab (default 1).
let target_tabpagenr = a:0 > 0 ? a:1 : 0
let open_relative = a:0 > 1 ? a:2 : 1
if target_tabpagenr > tabpagenr('$')
let target_tabpagenr = tabpagenr('$')
@bootleq
bootleq / gist:1033680
Created June 19, 2011 02:30
非 bootleq 登入時,也能讀取 /etc/users/bootleq/ 下的 runtime files
" 非 bootleq 登入時,也能讀取 /etc/users/bootleq/ 下的 runtime files
if expand("<sfile>") == '/etc/users/bootleq/.vimrc'
\ && substitute(system("whoami"), '\n$', '', '') != 'bootleq'
\ && ! exists("did_bootleq_runtime")
set runtimepath+=/etc/users/bootleq/.vim
let did_bootleq_runtime = 1
runtime! plugin/*.vim ftdetect/*.vim after/**/*.vim
endif
@bootleq
bootleq / zh-TW.json
Created February 26, 2011 14:34
formcheck.js v.1.7 Traditional Chinese (zh-TW) locale.
{
"definitions" : {
"required" : "這個欄位必須填寫。",
"alpha" : "這個欄位只接受英文字母。",
"alphanum" : "這個欄位只接受英文或數字。",
"nodigit" : "不接受數字。",
"digit" : "請輸入有效的整數。",
"digitmin" : "數字必須大於 %0",
"digitltd" : "數值必須介於 %0 與 %1 之間",
"number" : "請輸入有效的數字。",
@bootleq
bootleq / jslint.js
Created December 25, 2010 07:49
Using JSLint command within Vim. See http://bootleq.blogspot.com/2010/12/jslint-vim.html
#!/bin/bash
RHINO_JAR_FILE="$HOME/scripts/rhino.jar"
RHINO_JAR_CLASS="org.mozilla.javascript.tools.shell.Main"
JSLINT_JS_FILE="$HOME/scripts/jslint.js"
java -cp $RHINO_JAR_FILE $RHINO_JAR_CLASS $JSLINT_JS_FILE $@
@bootleq
bootleq / gist:753121
Created December 23, 2010 15:30
按 <LocalLeader>cc 就能 toggle comment 的設定(使用 tComment plugin)
"「關閉這功能。我也忘記是幹嘛的了,既然如此,大概用不太到吧」
let g:tcommentMapLeaderOp1 = ''
let g:tcommentMapLeaderOp2 = ''
"「這個只要加在 vimrc 就能控制 comment 要不要縮排了!」——料理東西軍
let g:tc_option = ' col=1'
noremap <silent> <expr> <LocalLeader>cc ":TComment " . (exists('b:tc_option') ? b:tc_option : g:tc_option) . "<CR>"
noremap <silent> <expr> <LocalLeader>cb ":TCommentBlock " . (exists('b:tc_option') ? b:tc_option : g:tc_option) . "<CR>"
noremap <silent> <expr> <LocalLeader>ci ":TCommentInline " . (exists('b:tc_option') ? b:tc_option : g:tc_option) . "<CR>"
noremap <silent> <expr> <LocalLeader>c$ ":TCommentRight " . (exists('b:tc_option') ? b:tc_option : g:tc_option) . "<CR>"
@bootleq
bootleq / gist:738007
Created December 12, 2010 12:29
[vimrc] ShowMarks and wokmarks.vim
" }}}2 ShowMarks {{{2
let g:showmarks_include='abcdefghijklmnopqrstuvwxyz' . 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
let g:showmarks_ignore_type=""
let g:showmarks_textlower="\t"
let g:showmarks_textupper="\t"
let g:showmarks_textother="\t"
let g:showmarks_auto_toggle = 0
nnoremap <silent> mo :ShowMarksOn<CR>
nnoremap <silent> mt :ShowMarksToggle<CR>
@bootleq
bootleq / gist:675391
Created November 13, 2010 15:04
Add MooTools global variables to JSLint predef option.
predef: [
// for MooTools Core 1.3. Excluded of standard global objects and Slick.
"$", "$$", "typeOf", "instanceOf", "$A", "$H",
"Core", "Event", "Browser", "Class", "Chain", "Events", "Options",
"Element", "Fx", "Request", "Cookie", "JSON", "Swiff",
// for MooTools More 1.3
"More", "URI", "Hash", "Form", "OverText", "Drag", "Slider", "Sortables", "Assets", "Color",
"Group", "IframeShim", "HtmlTable", "Keyboard", "Mask", "Scroller", "Tips", "Spinner", "Locale",
" Most adopted from Bob Hiestand's vsccommand plugin
" http://www.vim.org/scripts/script.php?script_id=90
command! -nargs=? GitDiff cal GitDiff(<f-args>)
function! GitDiff(...)
let rev = "HEAD~" . (a:0 > 0 ? a:1 : 0)
let oldDir = getcwd()
let newDir = fnameescape(expand('%:p:h'))
let filetype = &filetype
let cdCommand = haslocaldir() ? 'lcd' : 'cd'