This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" NOTE: limitations | |
" 1. Only test if first non-blank character is highlighted with "Comment". | |
" 2. Always linewise. | |
vnoremap <silent> ac :<C-U>call TxtObjComment()<CR> | |
onoremap <silent> ac :<C-U>call TxtObjComment()<CR> | |
fun! TxtObjComment() | |
if exists("g:syntax_on") | |
if ! IsInComment() | |
echomsg 'Not in a Comment region.' | |
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 暫存/復原 position {{{2 | |
" @params stash/pop | |
function PosStash(...) | |
let l:stash = a:0 > 0 ? a:1 : 0 | |
if l:stash | |
let s:stashCursor = getpos(".") | |
let g:stashCursor = s:stashCursor | |
else | |
call setpos('.', s:stashCursor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if which apt-get 2>&1 >/dev/null; then | |
sudo apt-get install -y libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev | |
fi | |
cd ~/src | |
[[ ! -d git ]] && git clone https://github.com/git/git --depth 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" }}}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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"「關閉這功能。我也忘記是幹嘛的了,既然如此,大概用不太到吧」 | |
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>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"definitions" : { | |
"required" : "這個欄位必須填寫。", | |
"alpha" : "這個欄位只接受英文字母。", | |
"alphanum" : "這個欄位只接受英文或數字。", | |
"nodigit" : "不接受數字。", | |
"digit" : "請輸入有效的整數。", | |
"digitmin" : "數字必須大於 %0", | |
"digitltd" : "數值必須介於 %0 與 %1 之間", | |
"number" : "請輸入有效的數字。", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 非 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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('$') |