This file contains hidden or 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 &rtp = expand('<sfile>:p:h') . ',' . &rtp . ',' . expand('<sfile>:p:h') . '/after' | |
set bs=2 |
This file contains hidden or 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
function! CleanScreen() | |
if &go ~=# 'm' | |
" Set options for clean screen. | |
else | |
" Set options back to normal. | |
endif | |
endfunction | |
nore <F2> :<C-U>call CleanScreen()<CR> |
This file contains hidden or 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
" Toggle Comment | |
augroup toggle_comment | |
au FileType vim let b:comment_leader = '" ' | |
au FileType c,cpp,java let b:comment_leader = '// ' | |
au FileType sh,make,python let b:comment_leader = '# ' | |
au FileType text let b:comment_leader = '% ' | |
augroup END | |
function! ToggleComment() range | |
let cl = b:comment_leader; | |
for linenr in range(a:firstline, a:lastline) |
This file contains hidden or 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
comm! -range=% -nargs=* RSearch /\%(\%><line1>l\%<<line2>l\)\&\%(<args>\) |
This file contains hidden or 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
func! Inc(...) | |
if a:0 | |
let g:inc = 0 | |
else | |
let g:inc += 1 | |
endif | |
return g:inc | |
endf | |
call Inc(1) | |
%s/regex/\=Inc()/ |
This file contains hidden or 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
normal! ggdG | |
Let lines = ["# Please wait for prove to run...", | |
\"# Files:"] | |
let lines = lines + map(split(l:files, '\v\s'), '"# * " . v:val') | |
call setline(1, lines) |
This file contains hidden or 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
function! TabMappings() | |
if &ft == 'c' | |
return "\<C-X>\<C-U>" | |
elseif &ft == 'c++' | |
return "\<C-X>\<C-U>" | |
elseif &ft == 'objc' | |
return "\<C-X>\<C-U>" | |
elseif &ft == 'objcpp' | |
return "\<C-X>\<C-U>" | |
elseif neocomplcache#sources#snippets_complete#expandable() |
This file contains hidden or 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
" bairui's code, just too good to let it pass. | |
function! SplitListByCount(list, count) | |
return map(filter(range(len(a:list)), 'v:val % '.a:count.' == 0'), | |
\ 'a:list[v:val : v:val + a:count - 1]') | |
endfunction | |
function! SplitListInNPieces(list, number) | |
let ratio = len(a:list)/a:number | |
return !empty(a:list) && len(a:list) % a:number == 0 | |
\ ? map(range(a:number), |
This file contains hidden or 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
function! Count(s, e) | |
let s = type(a:s) == type({}) ? values(a:s) : a:s | |
let ccount = 0 | |
for i in s | |
if type(i) != type([]) && type(i) != type({}) | |
let ccount += (type(i) == type(a:e) && i == a:e) ? 1 : 0 | |
else | |
let ccount += Count(i, a:e) | |
endif | |
unlet i |