commit 39327ef9ac860a4b4fe6da70cfb8b163fd7503cb Author: Brian Buller Date: Wed Jan 14 17:28:12 2015 -0600 Initial Commit diff --git a/home/.vim/.netrwhist b/home/.vim/.netrwhist new file mode 100644 index 0000000..7771a52 --- /dev/null +++ b/home/.vim/.netrwhist @@ -0,0 +1,2 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhist_cnt =0 diff --git a/home/.vim/autoload/gist.vim b/home/.vim/autoload/gist.vim new file mode 100644 index 0000000..810ade6 --- /dev/null +++ b/home/.vim/autoload/gist.vim @@ -0,0 +1,1006 @@ +"============================================================================= +" File: gist.vim +" Author: Yasuhiro Matsumoto +" Last Change: 15-Apr-2014. +" Version: 7.1 +" WebPage: http://github.com/mattn/gist-vim +" License: BSD + +let s:save_cpo = &cpo +set cpo&vim + +if exists('g:gist_disabled') && g:gist_disabled == 1 + function gist#Gist(...) + endfunction + finish +endif + +if !exists('g:github_user') && !executable('git') + echohl ErrorMsg | echomsg "Gist: require 'git' command" | echohl None + finish +endif + +if !executable('curl') + echohl ErrorMsg | echomsg "Gist: require 'curl' command" | echohl None + finish +endif + +if globpath(&rtp, 'autoload/webapi/http.vim') == '' + echohl ErrorMsg | echomsg "Gist: require 'webapi', install https://github.com/mattn/webapi-vim" | echohl None + finish +endif + +let s:gist_token_file = expand(get(g:, 'gist_token_file', '~/.gist-vim')) +let s:system = function(get(g:, 'webapi#system_function', 'system')) + +if !exists('g:github_user') + let g:github_user = substitute(s:system('git config --get github.user'), "\n", '', '') + if strlen(g:github_user) == 0 + let g:github_user = $GITHUB_USER + end +endif + +if !exists('g:gist_api_url') + let g:gist_api_url = substitute(s:system('git config --get github.apiurl'), "\n", '', '') + if strlen(g:gist_api_url) == 0 + let g:gist_api_url = 'https://api.github.com/' + end + if exists('g:github_api_url') && !exists('g:gist_shutup_issue154') + if matchstr(g:gist_api_url, 'https\?://\zs[^/]\+\ze') != matchstr(g:github_api_url, 'https\?://\zs[^/]\+\ze') + echohl WarningMsg + echo "--- Warning ---" + echo "It seems that you set different URIs for github_api_url/gist_api_url." + echo "If you want to remove this message: let g:gist_shutup_issue154 = 1" + echohl None + if confirm("Continue?", "&Yes\n&No") != 1 + let g:gist_disabled = 1 + finish + endif + redraw! + endif + endif +endif + +if !exists('g:gist_update_on_write') + let g:gist_update_on_write = 1 +endif + +function! s:get_browser_command() + let gist_browser_command = get(g:, 'gist_browser_command', '') + if gist_browser_command == '' + if has('win32') || has('win64') + let gist_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' + elseif has('mac') || has('macunix') || has('gui_macvim') || system('uname') =~? '^darwin' + let gist_browser_command = 'open %URL%' + elseif executable('xdg-open') + let gist_browser_command = 'xdg-open %URL%' + elseif executable('firefox') + let gist_browser_command = 'firefox %URL% &' + else + let gist_browser_command = '' + endif + endif + return gist_browser_command +endfunction + +function! s:open_browser(url) + let cmd = s:get_browser_command() + if len(cmd) == 0 + redraw + echohl WarningMsg + echo "It seems that you don't have general web browser. Open URL below." + echohl None + echo a:url + return + endif + if cmd =~ '^!' + let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g') + silent! exec cmd + elseif cmd =~ '^:[A-Z]' + let cmd = substitute(cmd, '%URL%', '\=a:url', 'g') + exec cmd + else + let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g') + call system(cmd) + endif +endfunction + +function! s:shellwords(str) + let words = split(a:str, '\%(\([^ \t\''"]\+\)\|''\([^\'']*\)''\|"\(\%([^\"\\]\|\\.\)*\)"\)\zs\s*\ze') + let words = map(words, 'substitute(v:val, ''\\\([\\ ]\)'', ''\1'', "g")') + let words = map(words, 'matchstr(v:val, ''^\%\("\zs\(.*\)\ze"\|''''\zs\(.*\)\ze''''\|.*\)$'')') + return words +endfunction + +function! s:format_gist(gist) + let files = sort(keys(a:gist.files)) + if empty(files) + return "" + endif + let file = a:gist.files[files[0]] + let name = file.filename + if has_key(file, "content") + let code = file.content + let code = "\n".join(map(split(code, "\n"), '" ".v:val'), "\n") + else + let code = "" + endif + let desc = type(a:gist.description)==0 || a:gist.description == "" ? "" : '('.a:gist.description.')' + let name = substitute(name, '[\r\n\t]', ' ', 'g') + let name = substitute(name, ' ', ' ', 'g') + let desc = substitute(desc, '[\r\n\t]', ' ', 'g') + let desc = substitute(desc, ' ', ' ', 'g') + return printf("gist: %s %s %s%s", a:gist.id, name, desc, code) +endfunction + +" Note: A colon in the file name has side effects on Windows due to NTFS Alternate Data Streams; avoid it. +let s:bufprefix = 'gist' . (has('unix') ? ':' : '_') +function! s:GistList(gistls, page) abort + if a:gistls == '-all' + let url = g:gist_api_url.'gists/public' + elseif get(g:, 'gist_show_privates', 0) && a:gistls == 'starred' + let url = g:gist_api_url.'gists/starred' + elseif get(g:, 'gist_show_privates') && a:gistls == 'mine' + let url = g:gist_api_url.'gists' + else + let url = g:gist_api_url.'users/'.a:gistls.'/gists' + endif + let winnum = bufwinnr(bufnr(s:bufprefix.a:gistls)) + if winnum != -1 + if winnum != bufwinnr('%') + exe winnum 'wincmd w' + endif + setlocal modifiable + else + if get(g:, 'gist_list_vsplit', 0) + exec 'silent noautocmd vsplit +set\ winfixwidth ' s:bufprefix.a:gistls + elseif get(g:, 'gist_list_rightbelow', 0) + exec 'silent noautocmd rightbelow 5 split +set\ winfixheight ' s:bufprefix.a:gistls + else + exec 'silent noautocmd split' s:bufprefix.a:gistls + endif + endif + if a:page > 1 + let oldlines = getline(0, line('$')) + let url = url . '?page=' . a:page + endif + + setlocal modifiable + let old_undolevels = &undolevels + let oldlines = [] + silent %d _ + + redraw | echon 'Listing gists... ' + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + bw! + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + let res = webapi#http#get(url, '', { "Authorization": auth }) + if v:shell_error != 0 + bw! + redraw + echohl ErrorMsg | echomsg 'Gists not found' | echohl None + return + endif + let content = webapi#json#decode(res.content) + if type(content) == 4 && has_key(content, 'message') && len(content.message) + bw! + redraw + echohl ErrorMsg | echomsg content.message | echohl None + if content.message == 'Bad credentials' + call delete(s:gist_token_file) + endif + return + endif + + let lines = map(filter(content, '!empty(v:val.files)'), 's:format_gist(v:val)') + call setline(1, split(join(lines, "\n"), "\n")) + + $put='more...' + + let b:gistls = a:gistls + let b:page = a:page + setlocal buftype=nofile bufhidden=hide noswapfile + setlocal nomodified + setlocal nomodifiable + syntax match SpecialKey /^gist:/he=e-1 + syntax match Title /^gist: \S\+/hs=s+5 contains=ALL + nnoremap :call GistListAction(0) + nnoremap :call GistListAction(1) + + cal cursor(1+len(oldlines),1) + nohlsearch + redraw | echo '' +endfunction + +function! gist#list(user, ...) + let page = get(a:000, 0, 0) + if a:user == '-all' + let url = g:gist_api_url.'gists/public' + elseif get(g:, 'gist_show_privates', 0) && a:user == 'starred' + let url = g:gist_api_url.'gists/starred' + elseif get(g:, 'gist_show_privates') && a:user == 'mine' + let url = g:gist_api_url.'gists' + else + let url = g:gist_api_url.'users/'.a:user.'/gists' + endif + + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + return [] + endif + let res = webapi#http#get(url, '', { "Authorization": auth }) + return webapi#json#decode(res.content) +endfunction + +function! s:GistGetFileName(gistid) abort + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + return '' + endif + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + let gist = webapi#json#decode(res.content) + if has_key(gist, 'files') + return sort(keys(gist.files))[0] + endif + return '' +endfunction + +function! s:GistDetectFiletype(gistid) abort + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + return '' + endif + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + let gist = webapi#json#decode(res.content) + let filename = sort(keys(gist.files))[0] + let ext = fnamemodify(filename, ':e') + if has_key(s:extmap, ext) + let type = s:extmap[ext] + else + let type = get(gist.files[filename], "type", "text") + endif + silent! exec "setlocal ft=".tolower(type) +endfunction + +function! s:GistWrite(fname) abort + if substitute(a:fname, '\\', '/', 'g') == expand("%:p:gs@\\@/@") + if g:gist_update_on_write != 2 || v:cmdbang + Gist -e + else + echohl ErrorMsg | echomsg 'Please type ":w!" to update a gist.' | echohl None + endif + else + exe "w".(v:cmdbang ? "!" : "") fnameescape(v:cmdarg) fnameescape(a:fname) + silent! exe "file" fnameescape(a:fname) + silent! au! BufWriteCmd + endif +endfunction + +function! s:GistGet(gistid, clipboard) abort + redraw | echon 'Getting gist... ' + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": s:GistGetAuthHeader() }) + if res.status =~ '^2' + try + let gist = webapi#json#decode(res.content) + catch + redraw + echohl ErrorMsg | echomsg 'Gist seems to be broken' | echohl None + return + endtry + if get(g:, 'gist_get_multiplefile', 0) != 0 + let num_file = len(keys(gist.files)) + else + let num_file = 1 + endif + redraw + if num_file > len(keys(gist.files)) + echohl ErrorMsg | echomsg 'Gist not found' | echohl None + return + endif + for n in range(num_file) + try + let old_undolevels = &undolevels + let filename = sort(keys(gist.files))[n] + + let winnum = bufwinnr(bufnr(s:bufprefix.a:gistid."/".filename)) + if winnum != -1 + if winnum != bufwinnr('%') + exe winnum 'wincmd w' + endif + setlocal modifiable + else + if num_file == 1 + silent only! + endif + if get(g:, 'gist_list_vsplit', 0) + exec 'silent noautocmd rightbelow vnew' + else + exec 'silent noautocmd rightbelow new' + endif + setlocal noswapfile + silent exec 'noautocmd file' s:bufprefix.a:gistid."/".fnameescape(filename) + endif + set undolevels=-1 + filetype detect + silent %d _ + + let content = gist.files[filename].content + call setline(1, split(content, "\n")) + let b:gist = { + \ "filename": filename, + \ "id": gist.id, + \ "description": gist.description, + \ "private": gist.public =~ 'true', + \} + catch + let &undolevels = old_undolevels + bw! + redraw + echohl ErrorMsg | echomsg 'Gist contains binary' | echohl None + return + endtry + let &undolevels = old_undolevels + setlocal buftype=acwrite bufhidden=delete noswapfile + setlocal nomodified + doau StdinReadPost,BufRead,BufReadPost + let gist_detect_filetype = get(g:, 'gist_detect_filetype', 0) + if (&ft == '' && gist_detect_filetype == 1) || gist_detect_filetype == 2 + call s:GistDetectFiletype(a:gistid) + endif + if a:clipboard + if exists('g:gist_clip_command') + exec 'silent w !'.g:gist_clip_command + elseif has('clipboard') + silent! %yank + + else + %yank + endif + endif + 1 + au! BufWriteCmd call s:GistWrite(expand("")) + endfor + else + bw! + redraw + echohl ErrorMsg | echomsg 'Gist not found' | echohl None + return + endif +endfunction + +function! s:GistListAction(shift) abort + let line = getline('.') + let mx = '^gist:\s*\zs\(\w\+\)\ze.*' + if line =~# mx + let gistid = matchstr(line, mx) + if a:shift + call s:open_browser("https://gist.github.com/" . gistid) + else + call s:GistGet(gistid, 0) + endif + return + endif + if line =~# '^more\.\.\.$' + call s:GistList(b:gistls, b:page+1) + return + endif +endfunction + +function! s:GistUpdate(content, gistid, gistnm, desc) abort + let gist = { "id": a:gistid, "files" : {}, "description": "","public": function('webapi#json#true') } + if exists('b:gist') + if has_key(b:gist, 'private') && b:gist.private | let gist["public"] = function('webapi#json#false') | endif + if has_key(b:gist, 'description') | let gist["description"] = b:gist.description | endif + if has_key(b:gist, 'filename') | let filename = b:gist.filename | endif + else + let filename = a:gistnm + if len(filename) == 0 | let filename = s:GistGetFileName(a:gistid) | endif + if len(filename) == 0 | let filename = s:get_current_filename(1) | endif + endif + + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + + " Update description + " If no new description specified, keep the old description + if a:desc != ' ' + let gist["description"] = a:desc + else + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + if res.status =~ '^2' + let old_gist = webapi#json#decode(res.content) + let gist["description"] = old_gist.description + endif + endif + + let gist.files[filename] = { "content": a:content, "filename": filename } + + redraw | echon 'Updating gist... ' + let res = webapi#http#post(g:gist_api_url.'gists/' . a:gistid, + \ webapi#json#encode(gist), { + \ "Authorization": auth, + \ "Content-Type": "application/json", + \}) + if res.status =~ '^2' + let obj = webapi#json#decode(res.content) + let loc = obj["html_url"] + redraw | echomsg 'Done: '.loc + let b:gist = {"id": a:gistid, "filename": filename} + setlocal nomodified + else + let loc = '' + echohl ErrorMsg | echomsg 'Post failed: ' . res.message | echohl None + endif + return loc +endfunction + +function! s:GistDelete(gistid) abort + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + + redraw | echon 'Deleting gist... ' + let res = webapi#http#post(g:gist_api_url.'gists/'.a:gistid, '', { + \ "Authorization": auth, + \ "Content-Type": "application/json", + \}, 'DELETE') + if res.status =~ '^2' + redraw | echomsg 'Done: ' + if exists('b:gist') + unlet b:gist + endif + else + echohl ErrorMsg | echomsg 'Delete failed: ' . res.message | echohl None + endif +endfunction + +function! s:get_current_filename(no) + let filename = expand('%:t') + if len(filename) == 0 && &ft != '' + let pair = filter(items(s:extmap), 'v:val[1] == &ft') + if len(pair) > 0 + let filename = printf('gistfile%d%s', a:no, pair[0][0]) + endif + endif + if filename == '' + let filename = printf('gistfile%d.txt', a:no) + endif + return filename +endfunction + +function! s:update_GistID(id) + let view = winsaveview() + normal! gg + let ret = 0 + if search('\:\s*$') + let line = getline('.') + let line = substitute(line, '\s\+$', '', 'g') + call setline('.', line . ' ' . a:id) + let ret = 1 + endif + call winrestview(view) + return ret +endfunction + +" GistPost function: +" Post new gist to github +" +" if there is an embedded gist url or gist id in your file, +" it will just update it. +" -- by c9s +" +" embedded gist id format: +" +" GistID: 123123 +" +function! s:GistPost(content, private, desc, anonymous) abort + let gist = { "files" : {}, "description": "","public": function('webapi#json#true') } + if a:desc != ' ' | let gist["description"] = a:desc | endif + if a:private | let gist["public"] = function('webapi#json#false') | endif + let filename = s:get_current_filename(1) + let gist.files[filename] = { "content": a:content, "filename": filename } + + let header = {"Content-Type": "application/json"} + if !a:anonymous + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + let header["Authorization"] = auth + endif + + redraw | echon 'Posting it to gist... ' + let res = webapi#http#post(g:gist_api_url.'gists', webapi#json#encode(gist), header) + if res.status =~ '^2' + let obj = webapi#json#decode(res.content) + let loc = obj["html_url"] + redraw | echomsg 'Done: '.loc + let b:gist = { + \ "filename": filename, + \ "id": matchstr(loc, '[^/]\+$'), + \ "description": gist['description'], + \ "private": a:private, + \} + if s:update_GistID(b:gist["id"]) + Gist -e + endif + else + let loc = '' + echohl ErrorMsg | echomsg 'Post failed: '. res.message | echohl None + endif + return loc +endfunction + +function! s:GistPostBuffers(private, desc, anonymous) abort + let bufnrs = range(1, bufnr("$")) + let bn = bufnr('%') + let query = [] + + let gist = { "files" : {}, "description": "","public": function('webapi#json#true') } + if a:desc != ' ' | let gist["description"] = a:desc | endif + if a:private | let gist["public"] = function('webapi#json#false') | endif + + let index = 1 + for bufnr in bufnrs + if !bufexists(bufnr) || buflisted(bufnr) == 0 + continue + endif + echo "Creating gist content".index."... " + silent! exec "buffer!" bufnr + let content = join(getline(1, line('$')), "\n") + let filename = s:get_current_filename(index) + let gist.files[filename] = { "content": content, "filename": filename } + let index = index + 1 + endfor + silent! exec "buffer!" bn + + let header = {"Content-Type": "application/json"} + if !a:anonymous + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + let header["Authorization"] = auth + endif + + redraw | echon 'Posting it to gist... ' + let res = webapi#http#post(g:gist_api_url.'gists', webapi#json#encode(gist), header) + if res.status =~ '^2' + let obj = webapi#json#decode(res.content) + let loc = obj["html_url"] + redraw | echomsg 'Done: '.loc + let b:gist = { + \ "filename": filename, + \ "id": matchstr(loc, '[^/]\+$'), + \ "description": gist['description'], + \ "private": a:private, + \} + if s:update_GistID(b:gist["id"]) + Gist -e + endif + else + let loc = '' + echohl ErrorMsg | echomsg 'Post failed: ' . res.message | echohl None + endif + return loc +endfunction + +function! gist#Gist(count, line1, line2, ...) abort + redraw + if strlen(g:github_user) == 0 + echohl ErrorMsg | echomsg "You don't have github account. read ':help gist-vim-setup'." | echohl None + return + endif + let bufname = bufname("%") + " find GistID: in content , then we should just update + let gistid = '' + let gistls = '' + let gistnm = '' + let gistdesc = ' ' + let private = get(g:, 'gist_post_private', 0) + let multibuffer = 0 + let clipboard = 0 + let deletepost = 0 + let editpost = 0 + let anonymous = 0 + let listmx = '^\%(-l\|--list\)\s*\([^\s]\+\)\?$' + let bufnamemx = '^' . s:bufprefix .'\(\zs[0-9a-f]\+\ze\|\zs[0-9a-f]\+\ze[/\\].*\)$' + if bufname =~ bufnamemx + let gistidbuf = matchstr(bufname, bufnamemx) + elseif exists('b:gist') && has_key(b:gist, 'id') + let gistidbuf = b:gist['id'] + else + let gistidbuf = matchstr(join(getline(a:line1, a:line2), "\n"), 'GistID:\s*\zs\w\+') + endif + + let args = (a:0 > 0) ? s:shellwords(a:1) : [] + for arg in args + if arg =~ '^\(-h\|--help\)$\C' + help :Gist + return + elseif arg =~ '^\(-g\|--git\)$\C' && gistidbuf != '' && g:gist_api_url == 'https://api.github.com/' && has_key(b:, 'gist') && has_key(b:gist, 'id') + echo printf('git clone git@github.com:%s', b:gist['id']) + return + elseif arg =~ '^\(-G\|--gitclone\)$\C' && gistidbuf != '' && g:gist_api_url == 'https://api.github.com/' && has_key(b:, 'gist') && has_key(b:gist, 'id') + exe '!' printf('git clone git@github.com:%s', b:gist['id']) + return + elseif arg =~ '^\(-la\|--listall\)$\C' + let gistls = '-all' + elseif arg =~ '^\(-ls\|--liststar\)$\C' + let gistls = 'starred' + elseif arg =~ '^\(-l\|--list\)$\C' + if get(g:, 'gist_show_privates') + let gistls = 'mine' + else + let gistls = g:github_user + endif + elseif arg =~ '^\(-m\|--multibuffer\)$\C' + let multibuffer = 1 + elseif arg =~ '^\(-p\|--private\)$\C' + let private = 1 + elseif arg =~ '^\(-P\|--public\)$\C' + let private = 0 + elseif arg =~ '^\(-a\|--anonymous\)$\C' + let anonymous = 1 + elseif arg =~ '^\(-s\|--description\)$\C' + let gistdesc = '' + elseif arg =~ '^\(-c\|--clipboard\)$\C' + let clipboard = 1 + elseif arg =~ '^--rawurl$\C' && gistidbuf != '' && g:gist_api_url == 'https://api.github.com/' + let gistid = gistidbuf + echo 'https://gist.github.com/raw/'.gistid + return + elseif arg =~ '^\(-d\|--delete\)$\C' && gistidbuf != '' + let gistid = gistidbuf + let deletepost = 1 + elseif arg =~ '^\(-e\|--edit\)$\C' && gistidbuf != '' + let gistid = gistidbuf + let editpost = 1 + elseif arg =~ '^\(+1\|--star\)$\C' && gistidbuf != '' + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + echohl ErrorMsg | echomsg v:errmsg | echohl None + else + let gistid = gistidbuf + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/star', '', { "Authorization": auth }, 'PUT') + if res.status =~ '^2' + echomsg "Stared" gistid + else + echohl ErrorMsg | echomsg 'Star failed' | echohl None + endif + endif + return + elseif arg =~ '^\(-1\|--unstar\)$\C' && gistidbuf != '' + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + echohl ErrorMsg | echomsg v:errmsg | echohl None + else + let gistid = gistidbuf + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/star', '', { "Authorization": auth }, 'DELETE') + if res.status =~ '^2' + echomsg "Unstared" gistid + else + echohl ErrorMsg | echomsg 'Unstar failed' | echohl None + endif + endif + return + elseif arg =~ '^\(-f\|--fork\)$\C' && gistidbuf != '' + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + else + let gistid = gistidbuf + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/fork', '', { "Authorization": auth }) + if res.status =~ '^2' + let obj = webapi#json#decode(res.content) + let gistid = obj["id"] + else + echohl ErrorMsg | echomsg 'Fork failed' | echohl None + return + endif + endif + elseif arg !~ '^-' && len(gistnm) == 0 + if gistdesc != ' ' + let gistdesc = matchstr(arg, '^\s*\zs.*\ze\s*$') + elseif editpost == 1 || deletepost == 1 + let gistnm = arg + elseif len(gistls) > 0 && arg != '^\w\+$\C' + let gistls = arg + elseif arg =~ '^[0-9a-z]\+$\C' + let gistid = arg + else + echohl ErrorMsg | echomsg 'Invalid arguments: '.arg | echohl None + unlet args + return 0 + endif + elseif len(arg) > 0 + echohl ErrorMsg | echomsg 'Invalid arguments: '.arg | echohl None + unlet args + return 0 + endif + endfor + unlet args + "echo "gistid=".gistid + "echo "gistls=".gistls + "echo "gistnm=".gistnm + "echo "gistdesc=".gistdesc + "echo "private=".private + "echo "clipboard=".clipboard + "echo "editpost=".editpost + "echo "deletepost=".deletepost + + if gistidbuf != '' && gistid == '' && editpost == 0 && deletepost == 0 + let editpost = 1 + let gistid = gistidbuf + endif + + if len(gistls) > 0 + call s:GistList(gistls, 1) + elseif len(gistid) > 0 && editpost == 0 && deletepost == 0 + call s:GistGet(gistid, clipboard) + else + let url = '' + if multibuffer == 1 + let url = s:GistPostBuffers(private, gistdesc, anonymous) + else + if a:count < 1 + let content = join(getline(a:line1, a:line2), "\n") + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvy + let content = @" + call setreg('"', save_regcont, save_regtype) + endif + if editpost == 1 + let url = s:GistUpdate(content, gistid, gistnm, gistdesc) + elseif deletepost == 1 + call s:GistDelete(gistid) + else + let url = s:GistPost(content, private, gistdesc, anonymous) + endif + if a:count >= 1 && get(g:, 'gist_keep_selection', 0) == 1 + silent! normal! gv + endif + endif + if len(url) > 0 + if get(g:, 'gist_open_browser_after_post', 0) == 1 + call s:open_browser(url) + endif + let gist_put_url_to_clipboard_after_post = get(g:, 'gist_put_url_to_clipboard_after_post', 1) + if gist_put_url_to_clipboard_after_post > 0 || clipboard + if gist_put_url_to_clipboard_after_post == 2 + let url = url . "\n" + endif + if exists('g:gist_clip_command') + call system(g:gist_clip_command, url) + elseif has('unix') && !has('xterm_clipboard') + let @" = url + else + let @+ = url + endif + endif + endif + endif + return 1 +endfunction + +function! s:GistGetAuthHeader() abort + if get(g:, 'gist_use_password_in_gitconfig', 0) != 0 + let password = substitute(system('git config --get github.password'), "\n", '', '') + if password =~ '^!' | let password = system(password[1:]) | endif + return printf("basic %s", webapi#base64#b64encode(g:github_user.":".password)) + endif + let auth = "" + if filereadable(s:gist_token_file) + let str = join(readfile(s:gist_token_file), "") + if type(str) == 1 + let auth = str + endif + endif + if len(auth) > 0 + return auth + endif + + redraw + echohl WarningMsg + echo 'Gist.vim requires authorization to use the GitHub API. These settings are stored in "~/.gist-vim". If you want to revoke, do "rm ~/.gist-vim".' + echohl None + let password = inputsecret("GitHub Password for ".g:github_user.":") + if len(password) == 0 + let v:errmsg = 'Canceled' + return '' + endif + let insecureSecret = printf("basic %s", webapi#base64#b64encode(g:github_user.":".password)) + let res = webapi#http#post(g:gist_api_url.'authorizations', webapi#json#encode({ + \ "scopes" : ["gist"], + \ "note" : "Gist.vim on ".hostname(), + \ "note_url" : "http://www.vim.org/scripts/script.php?script_id=2423" + \}), { + \ "Content-Type" : "application/json", + \ "Authorization" : insecureSecret, + \}) + let h = filter(res.header, 'stridx(v:val, "X-GitHub-OTP:") == 0') + if len(h) + let otp = inputsecret("OTP:") + if len(otp) == 0 + let v:errmsg = 'Canceled' + return '' + endif + let res = webapi#http#post(g:gist_api_url.'authorizations', webapi#json#encode({ + \ "scopes" : ["gist"], + \ "note" : "Gist.vim on ".hostname(), + \ "note_url" : "http://www.vim.org/scripts/script.php?script_id=2423" + \}), { + \ "Content-Type" : "application/json", + \ "Authorization" : insecureSecret, + \ "X-GitHub-OTP" : otp, + \}) + endif + let authorization = webapi#json#decode(res.content) + if has_key(authorization, 'token') + let secret = printf("token %s", authorization.token) + call writefile([secret], s:gist_token_file) + if !(has('win32') || has('win64')) + call system("chmod go= ".s:gist_token_file) + endif + elseif has_key(authorization, 'message') + let secret = '' + let v:errmsg = authorization.message + endif + return secret +endfunction + +let s:extmap = { +\".adb": "ada", +\".ahk": "ahk", +\".arc": "arc", +\".as": "actionscript", +\".asm": "asm", +\".asp": "asp", +\".aw": "php", +\".b": "b", +\".bat": "bat", +\".befunge": "befunge", +\".bmx": "bmx", +\".boo": "boo", +\".c-objdump": "c-objdump", +\".c": "c", +\".cfg": "cfg", +\".cfm": "cfm", +\".ck": "ck", +\".cl": "cl", +\".clj": "clj", +\".cmake": "cmake", +\".coffee": "coffee", +\".cpp": "cpp", +\".cppobjdump": "cppobjdump", +\".cs": "csharp", +\".css": "css", +\".cw": "cw", +\".d-objdump": "d-objdump", +\".d": "d", +\".darcspatch": "darcspatch", +\".diff": "diff", +\".duby": "duby", +\".dylan": "dylan", +\".e": "e", +\".ebuild": "ebuild", +\".eclass": "eclass", +\".el": "lisp", +\".erb": "erb", +\".erl": "erlang", +\".f90": "f90", +\".factor": "factor", +\".feature": "feature", +\".fs": "fs", +\".fy": "fy", +\".go": "go", +\".groovy": "groovy", +\".gs": "gs", +\".gsp": "gsp", +\".haml": "haml", +\".hs": "haskell", +\".html": "html", +\".hx": "hx", +\".ik": "ik", +\".ino": "ino", +\".io": "io", +\".j": "j", +\".java": "java", +\".js": "javascript", +\".json": "json", +\".jsp": "jsp", +\".kid": "kid", +\".lhs": "lhs", +\".lisp": "lisp", +\".ll": "ll", +\".lua": "lua", +\".ly": "ly", +\".m": "objc", +\".mak": "mak", +\".man": "man", +\".mao": "mao", +\".matlab": "matlab", +\".md": "markdown", +\".minid": "minid", +\".ml": "ml", +\".moo": "moo", +\".mu": "mu", +\".mustache": "mustache", +\".mxt": "mxt", +\".myt": "myt", +\".n": "n", +\".nim": "nim", +\".nu": "nu", +\".numpy": "numpy", +\".objdump": "objdump", +\".ooc": "ooc", +\".parrot": "parrot", +\".pas": "pas", +\".pasm": "pasm", +\".pd": "pd", +\".phtml": "phtml", +\".pir": "pir", +\".pl": "perl", +\".po": "po", +\".py": "python", +\".pytb": "pytb", +\".pyx": "pyx", +\".r": "r", +\".raw": "raw", +\".rb": "ruby", +\".rhtml": "rhtml", +\".rkt": "rkt", +\".rs": "rs", +\".rst": "rst", +\".s": "s", +\".sass": "sass", +\".sc": "sc", +\".scala": "scala", +\".scm": "scheme", +\".scpt": "scpt", +\".scss": "scss", +\".self": "self", +\".sh": "sh", +\".sml": "sml", +\".sql": "sql", +\".st": "smalltalk", +\".tcl": "tcl", +\".tcsh": "tcsh", +\".tex": "tex", +\".textile": "textile", +\".tpl": "smarty", +\".twig": "twig", +\".txt" : "text", +\".v": "verilog", +\".vala": "vala", +\".vb": "vbnet", +\".vhd": "vhdl", +\".vim": "vim", +\".weechatlog": "weechatlog", +\".xml": "xml", +\".xq": "xquery", +\".xs": "xs", +\".yml": "yaml", +\} + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:set et: diff --git a/home/.vim/autoload/pathogen.vim b/home/.vim/autoload/pathogen.vim new file mode 100644 index 0000000..4071992 --- /dev/null +++ b/home/.vim/autoload/pathogen.vim @@ -0,0 +1,250 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" Version: 2.0 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc +" prior to `filetype plugin indent on` is the only other setup necessary. +" +" The API is documented inline below. For maximum ease of reading, +" :set foldmethod=marker + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +" Point of entry for basic default usage. Give a directory name to invoke +" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path +" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards, +" pathogen#cycle_filetype() is invoked. +function! pathogen#infect(...) abort " {{{1 + let source_path = a:0 ? a:1 : 'bundle' + if source_path =~# '[\\/]' + call pathogen#runtime_prepend_subdirectories(source_path) + else + call pathogen#runtime_append_all_bundles(source_path) + endif + call pathogen#cycle_filetype() +endfunction " }}}1 + +" Split a path into a list. +function! pathogen#split(path) abort " {{{1 + if type(a:path) == type([]) | return a:path | endif + let split = split(a:path,'\\\@"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags')) + helptags `=dir.'/doc'` + endif + endfor +endfunction " }}}1 + +command! -bar Helptags :call pathogen#helptags() + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) "{{{1 + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction " }}}1 + +" Backport of fnameescape(). +function! pathogen#fnameescape(string) " {{{1 + if exists('*fnameescape') + return fnameescape(a:string) + elseif a:string ==# '-' + return '\-' + else + return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','') + endif +endfunction " }}}1 + +function! s:find(count,cmd,file,lcd) " {{{1 + let rtp = pathogen#join(1,pathogen#split(&runtimepath)) + let file = pathogen#runtime_findfile(a:file,a:count) + if file ==# '' + return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" + elseif a:lcd + let path = file[0:-strlen(a:file)-2] + execute 'lcd `=path`' + return a:cmd.' '.pathogen#fnameescape(a:file) + else + return a:cmd.' '.pathogen#fnameescape(file) + endif +endfunction " }}}1 + +function! s:Findcomplete(A,L,P) " {{{1 + let sep = pathogen#separator() + let cheats = { + \'a': 'autoload', + \'d': 'doc', + \'f': 'ftplugin', + \'i': 'indent', + \'p': 'plugin', + \'s': 'syntax'} + if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) + let request = cheats[a:A[0]].a:A[1:-1] + else + let request = a:A + endif + let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' + let found = {} + for path in pathogen#split(&runtimepath) + let path = expand(path, ':p') + let matches = split(glob(path.sep.pattern),"\n") + call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') + call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') + for match in matches + let found[match] = 1 + endfor + endfor + return sort(keys(found)) +endfunction " }}}1 + +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) + +" vim:set ft=vim ts=8 sw=2 sts=2: diff --git a/home/.vim/autoload/recover.vim b/home/.vim/autoload/recover.vim new file mode 100644 index 0000000..47deedf --- /dev/null +++ b/home/.vim/autoload/recover.vim @@ -0,0 +1,435 @@ +" Vim plugin for diffing when swap file was found +" --------------------------------------------------------------- +" Author: Christian Brabandt +" Version: 0.18 +" Last Change: Wed, 14 Aug 2013 22:39:13 +0200 +" Script: http://www.vim.org/scripts/script.php?script_id=3068 +" License: VIM License +" GetLatestVimScripts: 3068 18 :AutoInstall: recover.vim +" +fu! recover#Recover(on) "{{{1 + if a:on + call s:ModifySTL(1) + if !exists("s:old_vsc") + let s:old_vsc = v:swapchoice + endif + augroup Swap + au! + au SwapExists * nested :call recover#ConfirmSwapDiff() + au BufWinEnter,InsertEnter,InsertLeave,FocusGained * + \ call CheckSwapFileExists() + augroup END + else + augroup Swap + au! + augroup end + if exists("s:old_vsc") + let v:swapchoice=s:old_vsc + endif + endif +endfu + +fu! s:Swapname() "{{{1 + " Use sil! so a failing redir (e.g. recursive redir call) + " won't hurt. (https://github.com/chrisbra/Recover.vim/pull/8) + sil! redir => a |sil swapname|redir end + if a[1:] == 'No swap file' + return '' + else + return a[1:] + endif +endfu + +fu! s:CheckSwapFileExists() "{{{1 + if !&swapfile + return + endif + + let swap = s:Swapname() + if !empty(swap) && !filereadable(swap) + " previous SwapExists autocommand deleted our swapfile, + " recreate it and avoid E325 Message + call s:SetSwapfile() + endif +endfu + +fu! s:CheckRecover() "{{{1 + if exists("b:swapname") && !exists("b:did_recovery") + let t = tempname() + " Doing manual recovery, otherwise, BufRead autocmd seems to + " get into the way of the recovery + try + exe 'recover' fnameescape(expand('%:p')) + catch /^Vim\%((\a\+)\)\=:E/ + " Prevent any recovery error from disrupting the diff-split. + endtry + exe ':sil w' t + call system('diff '. shellescape(expand('%:p'),1). + \ ' '. shellescape(t,1)) + call delete(t) + if !v:shell_error + call inputsave() + redraw! " prevent overwriting of 'Select File to use for recovery dialog' + let p = confirm("No differences: Delete old swap file '".b:swapname."'?", + \ "&No\n&Yes", 2) + call inputrestore() + if p == 2 + " Workaround for E305 error + let v:swapchoice='' + call delete(b:swapname) + " can trigger SwapExists autocommands again! + call s:SetSwapfile() + endif + call recover#AutoCmdBRP(0) + else + echo "Found Swapfile '". b:swapname. "', showing diff!" + call recover#DiffRecoveredFile() + " Not sure, why this needs feedkeys + " Sometimes cursor is wrong, I hate when this happens + " Cursor is wrong only when there is a single buffer open, a simple + " workaround for that is to check if bufnr('') is 1 and total number + " of windows in current tab is less than 3 (i.e. no windows were + " autoopen): in this case ':wincmd l\n:0\n' must be fed to + " feedkeys + if bufnr('') == 1 && winnr('$') < 3 + call feedkeys(":wincmd l\", 't') + endif + if !(v:version > 703 || (v:version == 703 && has("patch708"))) + call feedkeys(":0\", 't') + endif + endif + let b:did_recovery = 1 + if get(s:, 'fencview_autodetect', 0) + setl buftype= + endif + " Don't delete the auto command yet. + "call recover#AutoCmdBRP(0) + endif +endfun + +fu! recover#ConfirmSwapDiff() "{{{1 + if exists("b:swapchoice") + let v:swapchoice = b:swapchoice + return + endif + let delete = 0 + let do_modification_check = exists("g:RecoverPlugin_Edit_Unmodified") ? g:RecoverPlugin_Edit_Unmodified : 0 + let not_modified = 0 + let msg = "" + let bufname = s:isWin() ? fnamemodify(expand('%'), ':p:8') : shellescape(expand('%')) + let tfile = tempname() + if executable('vim') && !s:isWin() + " Doesn't work on windows (system() won't be able to fetch the output) + " Capture E325 Warning message + " Leave English output, so parsing will be easier + " TODO: make it work on windows. + if s:isWin() + let wincmd = printf('-c "redir > %s|1d|:q!" ', tfile) + let wincmd = printf('-c "call feedkeys(\"o\n\e:q!\n\")"') + endif + let cmd = printf("%svim -u NONE -es -V %s %s", + \ (s:isWin() ? '' : 'TERM=vt100 LC_ALL=C '), + \ (s:isWin() ? wincmd : ''), + \ bufname) + let msg = system(cmd) + let msg = substitute(msg, '.*\(E325.*process ID:.\{-}\)\%x0d.*', '\1', '') + let msg = substitute(msg, "\e\\[\\d\\+C", "", "g") + if do_modification_check + let not_modified = (match(msg, "modified: no") > -1) + endif + endif + if has("unix") && !empty(msg) && system("uname") =~? "linux" + " try to get process name from pid + " This is Linux specific. + " TODO Is there a portable way to retrive this info for at least unix? + let pid_pat = 'process ID:\s*\zs\d\+' + let pid = matchstr(msg, pid_pat)+0 + if !empty(pid) && isdirectory('/proc') + let pname = 'not existing' + let proc = '/proc/'. pid. '/status' + if filereadable(proc) + let pname = matchstr(readfile(proc)[0], '^Name:\s*\zs.*') + endif + let msg = substitute(msg, pid_pat, '& ['.pname."]\n", '') + if not_modified && pname !~? 'vim' + let not_modified = 0 + endif + endif + endif + if executable('vim') && executable('diff') "&& s:isWin() + " Check, whether the files differ issue #7 + " doesn't work on Windows? (cmd is ok, should be executable) + if s:isWin() + let tfile = substitute(tfile, '/', '\\', 'g') + endif + let cmd = printf("vim -u NONE -N %s -r %s -c \":w %s|:q!\" %s diff %s %s", + \ (s:isWin() ? '' : '-es'), + \ (s:isWin() ? fnamemodify(v:swapname, ':p:8') : shellescape(v:swapname)), + \ tfile, (s:isWin() ? '&' : '&&'), + \ bufname, tfile) + call system(cmd) + " if return code of diff is zero, files are identical + let delete = !v:shell_error + if !do_modification_check + echo msg + endif + endif + call delete(tfile) + if delete && !do_modification_check + echomsg "Swap and on-disk file seem to be identical" + endif + let cmd = printf("D&iff\n&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort%s", + \ ( (delete || !empty(msg)) ? "\n&Delete" : "")) + if !empty(msg) + let info = 'Please choose: ' + else + let info = "Swap File '". v:swapname. "' found: " + endif +" if has("gui_running") && &go !~ 'c' +" call inputsave() +" let p = confirm(info, cmd, (modified ? 3 : delete ? 7 : 1), 'I') +" else +" echo info +" call s:Output(cmd) + if not_modified + let p = 3 + else + call inputsave() + let p = confirm(info, cmd, (delete ? 7 : 1), 'I') + " endif + call inputrestore() + endif + let b:swapname=v:swapname + if p == 1 || p == 3 + " Diff or Edit Anyway + call s:SwapChoice('e') + " postpone recovering until later, for now, we are opening anyways... + " (this is done by s:CheckRecover() + " in an BufReadPost autocommand + if (p == 1) + call recover#AutoCmdBRP(1) + endif + " disable fencview (issue #23) + " This is a hack, fencview doesn't allow to selectively disable it :( + let s:fencview_autodetect = get(g:, 'fencview_autodetect', 0) + if s:fencview_autodetect + setl buftype=help + endif + elseif p == 2 + " Open Read-Only + " Don't show the Recovery dialog + let v:swapchoice='o' + call EchoMsg("Found SwapFile, opening file readonly!") + sleep 2 + elseif p == 4 + " Recover + let v:swapchoice='r' + elseif p == 5 + " Quit + let v:swapchoice='q' + elseif p == 6 + " Abort + let v:swapchoice='a' + elseif p == 7 + " Delete Swap file, if not different + call s:SwapChoice('d') + call EchoMsg("Found SwapFile, deleting...") + " might trigger SwapExists again! + call s:SetSwapfile() + else + " Show default menu from vim + return + endif +endfun + +fu! s:Output(msg) "{{{1 + " Display as one string, without linebreaks + let msg = substitute(a:msg, '\n', '/', 'g') + for item in split(msg, '&') + echohl WarningMsg + echon item[0] + echohl Normal + echon item[1:] + endfor +endfun + +fu! s:SwapChoice(char) "{{{1 + let v:swapchoice = a:char + let b:swapchoice = a:char +endfu + +fu! recover#DiffRecoveredFile() "{{{1 + " recovered version + diffthis + let b:mod='recovered version' + let l:filetype = &ft + if has("balloon_eval") + set ballooneval + setl bexpr=recover#BalloonExprRecover() + endif + " saved version + let curspr = &spr + set nospr + noa vert new + let &l:spr = curspr + if !empty(glob(fnameescape(expand('#')))) + 0r # + $d _ + endif + if l:filetype != "" + exe "setl filetype=".l:filetype + endif + exe "f! " . escape(expand("")," ") . + \ escape(' (on-disk version)', ' ') + diffthis + setl noswapfile buftype=nowrite bufhidden=delete nobuflisted + let b:mod='unmodified version on-disk' + let swapbufnr=bufnr('') + if has("balloon_eval") + set ballooneval + setl bexpr=recover#BalloonExprRecover() + endif + noa wincmd l + let b:swapbufnr = swapbufnr + command! -buffer RecoverPluginFinish :FinishRecovery + command! -buffer FinishRecovery :call recover#RecoverFinish() + setl modified +endfu + +fu! recover#Help() "{{{1 + echohl Title + echo "Diff key mappings\n". + \ "-----------------\n" + echo "Normal mode commands:\n" + echohl Normal + echo "]c - next diff\n". + \ "[c - prev diff\n". + \ "do - diff obtain - get change from other window\n". + \ "dp - diff put - put change into other window\n" + echohl Title + echo "Ex-commands:\n" + echohl Normal + echo ":[range]diffget - get changes from other window\n". + \ ":[range]diffput - put changes into other window\n". + \ ":RecoverPluginDisable - DisablePlugin\n". + \ ":RecoverPluginEnable - EnablePlugin\n". + \ ":RecoverPluginHelp - this help" + if exists(":RecoverPluginFinish") + echo ":RecoverPluginFinish - finish recovery" + endif +endfun + + + +fu! s:EchoMsg(msg) "{{{1 + echohl WarningMsg + uns echomsg a:msg + echohl Normal +endfu + +fu! s:ModifySTL(enable) "{{{1 + if a:enable + " Inject some info into the statusline + let s:ostl = &stl + let s:nstl = substitute(&stl, '%f', + \ "\\0 %{exists('b:mod')?('['.b:mod.']') : ''}", 'g') + let &l:stl = s:nstl + else + " Restore old statusline setting + if exists("s:ostl") && s:nstl == &stl + let &stl=s:ostl + endif + endif +endfu + +fu! s:SetSwapfile() "{{{1 + if &l:swf + " Reset swapfile to use .swp extension + sil setl noswapfile swapfile + endif +endfu + +fu! s:isWin() "{{{1 + return has("win32") || has("win16") || has("win64") +endfu +fu! recover#BalloonExprRecover() "{{{1 + " Set up a balloon expr. + if exists("b:swapbufnr") && v:beval_bufnr!=?b:swapbufnr + return "This buffer shows the recovered and modified version of your file" + else + return "This buffer shows the unmodified version of your file as it is stored on disk" + endif +endfun + +fu! recover#RecoverFinish() abort "{{{1 + let swapname = b:swapname + let curbufnr = bufnr('') + delcommand FinishRecovery + exe bufwinnr(b:swapbufnr) " wincmd w" + diffoff + bd! + call delete(swapname) + diffoff + call s:ModifySTL(0) + exe bufwinnr(curbufnr) " wincmd w" + call s:SetSwapfile() + unlet! b:swapname b:did_recovery b:swapbufnr b:swapchoice +endfun + +fu! recover#AutoCmdBRP(on) "{{{1 + if a:on && !exists("#SwapBRP") + augroup SwapBRP + au! + au BufNewFile,BufReadPost :call s:CheckRecover() + augroup END + elseif !a:on && exists('#SwapBRP') + augroup SwapBRP + au! + augroup END + augroup! SwapBRP + endif +endfu +" Old functions, not used anymore "{{{1 +finish + +fu! recover#DiffRecoveredFileOld() "{{{2 + " For some reason, this only works with feedkeys. + " I am not sure why. + let histnr = histnr('cmd')+1 + call feedkeys(":diffthis\n", 't') + call feedkeys(":setl modified\n", 't') + call feedkeys(":let b:mod='recovered version'\n", 't') + call feedkeys(":let g:recover_bufnr=bufnr('%')\n", 't') + let l:filetype = &ft + call feedkeys(":vert new\n", 't') + call feedkeys(":0r #\n", 't') + call feedkeys(":$delete _\n", 't') + if l:filetype != "" + call feedkeys(":setl filetype=".l:filetype."\n", 't') + endif + call feedkeys(":f! " . escape(expand("")," ") . "\\ (on-disk\\ version)\n", 't') + call feedkeys(":let swapbufnr = bufnr('')\n", 't') + call feedkeys(":diffthis\n", 't') + call feedkeys(":setl noswapfile buftype=nowrite bufhidden=delete nobuflisted\n", 't') + call feedkeys(":let b:mod='unmodified version on-disk'\n", 't') + call feedkeys(":exe bufwinnr(g:recover_bufnr) ' wincmd w'"."\n", 't') + call feedkeys(":let b:swapbufnr=swapbufnr\n", 't') + "call feedkeys(":command! -buffer DeleteSwapFile :call delete(b:swapname)|delcommand DeleteSwapFile\n", 't') + call feedkeys(":command! -buffer RecoverPluginFinish :FinishRecovery\n", 't') + call feedkeys(":command! -buffer FinishRecovery :call recover#RecoverFinish()\n", 't') + call feedkeys(":0\n", 't') + if has("balloon_eval") + "call feedkeys(':if has("balloon_eval")|:set ballooneval|setl bexpr=recover#BalloonExprRecover()|endif'."\n", 't') + call feedkeys(":set ballooneval|setl bexpr=recover#BalloonExprRecover()\n", 't') + endif + "call feedkeys(":redraw!\n", 't') + call feedkeys(":for i in range(".histnr.", histnr('cmd'), 1)|:call histdel('cmd',i)|:endfor\n",'t') + call feedkeys(":echo 'Found Swapfile '.b:swapname . ', showing diff!'\n", 'm') + " Delete Autocommand + call recover#AutoCmdBRP(0) + "endif +endfu + + +" Modeline "{{{1 +" vim:fdl=0 diff --git a/home/.vim/bundle/vim-go b/home/.vim/bundle/vim-go new file mode 160000 index 0000000..7aaded1 --- /dev/null +++ b/home/.vim/bundle/vim-go @@ -0,0 +1 @@ +Subproject commit 7aaded14ff2a175a6e57adb0d9e5e90a33924a0c diff --git a/home/.vim/bundle/vimwiki b/home/.vim/bundle/vimwiki new file mode 160000 index 0000000..2c03d82 --- /dev/null +++ b/home/.vim/bundle/vimwiki @@ -0,0 +1 @@ +Subproject commit 2c03d82a0e4662adf1e347487d73a9bf4bf6fdac diff --git a/home/.vim/colors/vividchalk.vim b/home/.vim/colors/vividchalk.vim new file mode 100644 index 0000000..d5d4499 --- /dev/null +++ b/home/.vim/colors/vividchalk.vim @@ -0,0 +1,192 @@ +" Vim color scheme +" Name: vividchalk.vim +" Author: Tim Pope +" Version: 2.0 +" GetLatestVimScripts: 1891 1 :AutoInstall: vividchalk.vim + +" Based on the Vibrank Ink theme for TextMate +" Distributable under the same terms as Vim itself (see :help license) + +if has("gui_running") + set background=dark +endif +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "vividchalk" + +" First two functions adapted from inkpot.vim + +" map a urxvt cube number to an xterm-256 cube number +fun! s:M(a) + return strpart("0245", a:a, 1) + 0 +endfun + +" map a urxvt colour to an xterm-256 colour +fun! s:X(a) + if &t_Co == 88 + return a:a + else + if a:a == 8 + return 237 + elseif a:a < 16 + return a:a + elseif a:a > 79 + return 232 + (3 * (a:a - 80)) + else + let l:b = a:a - 16 + let l:x = l:b % 4 + let l:y = (l:b / 4) % 4 + let l:z = (l:b / 16) + return 16 + s:M(l:x) + (6 * s:M(l:y)) + (36 * s:M(l:z)) + endif + endif +endfun + +function! E2T(a) + return s:X(a:a) +endfunction + +function! s:choose(mediocre,good) + if &t_Co != 88 && &t_Co != 256 + return a:mediocre + else + return s:X(a:good) + endif +endfunction + +function! s:hifg(group,guifg,first,second,...) + if a:0 && &t_Co == 256 + let ctermfg = a:1 + else + let ctermfg = s:choose(a:first,a:second) + endif + exe "highlight ".a:group." guifg=".a:guifg." ctermfg=".ctermfg +endfunction + +function! s:hibg(group,guibg,first,second) + let ctermbg = s:choose(a:first,a:second) + exe "highlight ".a:group." guibg=".a:guibg." ctermbg=".ctermbg +endfunction + +hi link railsMethod PreProc +hi link rubyDefine Keyword +hi link rubySymbol Constant +hi link rubyAccess rubyMethod +hi link rubyAttribute rubyMethod +hi link rubyEval rubyMethod +hi link rubyException rubyMethod +hi link rubyInclude rubyMethod +hi link rubyStringDelimiter rubyString +hi link rubyRegexp Regexp +hi link rubyRegexpDelimiter rubyRegexp +"hi link rubyConstant Variable +"hi link rubyGlobalVariable Variable +"hi link rubyClassVariable Variable +"hi link rubyInstanceVariable Variable +hi link javascriptRegexpString Regexp +hi link javascriptNumber Number +hi link javascriptNull Constant +highlight link diffAdded String +highlight link diffRemoved Statement +highlight link diffLine PreProc +highlight link diffSubname Comment + +call s:hifg("Normal","#EEEEEE","White",87) +if &background == "light" || has("gui_running") + hi Normal guibg=Black ctermbg=Black +else + hi Normal guibg=Black ctermbg=NONE +endif +highlight StatusLine guifg=Black guibg=#aabbee gui=bold ctermfg=Black ctermbg=White cterm=bold +highlight StatusLineNC guifg=#444444 guibg=#aaaaaa gui=none ctermfg=Black ctermbg=Grey cterm=none +"if &t_Co == 256 + "highlight StatusLine ctermbg=117 +"else + "highlight StatusLine ctermbg=43 +"endif + +highlight Ignore ctermfg=Black +highlight WildMenu guifg=Black guibg=#ffff00 gui=bold ctermfg=Black ctermbg=Yellow cterm=bold +highlight Cursor guifg=Black guibg=White ctermfg=Black ctermbg=White +call s:hibg("ColorColumn","#333333","DarkGrey",81) +call s:hibg("CursorLine","#333333","DarkGrey",81) +call s:hibg("CursorColumn","#333333","DarkGrey",81) +highlight NonText guifg=#404040 ctermfg=8 +highlight SpecialKey guifg=#404040 ctermfg=8 +highlight Directory none +high link Directory Identifier +highlight ErrorMsg guibg=Red ctermbg=DarkRed guifg=NONE ctermfg=NONE +highlight Search guifg=NONE ctermfg=NONE gui=none cterm=none +call s:hibg("Search" ,"#555555","DarkBlue",81) +highlight IncSearch guifg=White guibg=Black ctermfg=White ctermbg=Black +highlight MoreMsg guifg=#00AA00 ctermfg=Green +highlight LineNr guifg=#DDEEFF ctermfg=White +call s:hibg("LineNr" ,"#222222","DarkBlue",80) +highlight Question none +high link Question MoreMsg +highlight Title guifg=Magenta ctermfg=Magenta +highlight VisualNOS gui=none cterm=none +call s:hibg("Visual" ,"#555577","LightBlue",83) +call s:hibg("VisualNOS" ,"#444444","DarkBlue",81) +call s:hibg("MatchParen","#1100AA","DarkBlue",18) +highlight WarningMsg guifg=Red ctermfg=Red +highlight Error ctermbg=DarkRed +highlight SpellBad ctermbg=DarkRed +" FIXME: Comments +highlight SpellRare ctermbg=DarkMagenta +highlight SpellCap ctermbg=DarkBlue +highlight SpellLocal ctermbg=DarkCyan + +call s:hibg("Folded" ,"#110077","DarkBlue",17) +call s:hifg("Folded" ,"#aaddee","LightCyan",63) +highlight FoldColumn none +high link FoldColumn Folded +highlight DiffAdd ctermbg=4 guibg=DarkBlue +highlight DiffChange ctermbg=5 guibg=DarkMagenta +highlight DiffDelete ctermfg=12 ctermbg=6 gui=bold guifg=Blue guibg=DarkCyan +highlight DiffText ctermbg=DarkRed +highlight DiffText cterm=bold ctermbg=9 gui=bold guibg=Red + +highlight Pmenu guifg=White ctermfg=White gui=bold cterm=bold +highlight PmenuSel guifg=White ctermfg=White gui=bold cterm=bold +call s:hibg("Pmenu" ,"#000099","Blue",18) +call s:hibg("PmenuSel" ,"#5555ff","DarkCyan",39) +highlight PmenuSbar guibg=Grey ctermbg=Grey +highlight PmenuThumb guibg=White ctermbg=White +highlight TabLine gui=underline cterm=underline +call s:hifg("TabLine" ,"#bbbbbb","LightGrey",85) +call s:hibg("TabLine" ,"#333333","DarkGrey",80) +highlight TabLineSel guifg=White guibg=Black ctermfg=White ctermbg=Black +highlight TabLineFill gui=underline cterm=underline +call s:hifg("TabLineFill","#bbbbbb","LightGrey",85) +call s:hibg("TabLineFill","#808080","Grey",83) + +hi Type gui=none +hi Statement gui=none +if !has("gui_mac") + " Mac GUI degrades italics to ugly underlining. + hi Comment gui=italic + hi railsUserClass gui=italic + hi railsUserMethod gui=italic +endif +hi Identifier cterm=none +" Commented numbers at the end are *old* 256 color values +"highlight PreProc guifg=#EDF8F9 +call s:hifg("Comment" ,"#9933CC","DarkMagenta",34) " 92 +" 26 instead? +call s:hifg("Constant" ,"#339999","DarkCyan",21) " 30 +call s:hifg("rubyNumber" ,"#CCFF33","Yellow",60) " 190 +call s:hifg("String" ,"#66FF00","LightGreen",44,82) " 82 +call s:hifg("Identifier" ,"#FFCC00","Yellow",72) " 220 +call s:hifg("Statement" ,"#FF6600","Brown",68) " 202 +call s:hifg("PreProc" ,"#AAFFFF","LightCyan",47) " 213 +call s:hifg("railsUserMethod","#AACCFF","LightCyan",27) +call s:hifg("Type" ,"#AAAA77","Grey",57) " 101 +call s:hifg("railsUserClass" ,"#AAAAAA","Grey",7) " 101 +call s:hifg("Special" ,"#33AA00","DarkGreen",24) " 7 +call s:hifg("Regexp" ,"#44B4CC","DarkCyan",21) " 74 +call s:hifg("rubyMethod" ,"#DDE93D","Yellow",77) " 191 +"highlight railsMethod guifg=#EE1122 ctermfg=1 diff --git a/home/.vim/colors/wombat256.vim b/home/.vim/colors/wombat256.vim new file mode 100644 index 0000000..b22e5ba --- /dev/null +++ b/home/.vim/colors/wombat256.vim @@ -0,0 +1,64 @@ +" Vim color file +" Original Maintainer: Lars H. Nielsen (dengmao@gmail.com) +" Last Change: 2010-07-23 +" +" Converting for 256-color terminals by +" Danila Bespalov (danila.bespalov@gmail.com) +" with great help of tool by Wolfgang Frisch (xororand@frexx.de) +" inspired by David Liang's version (bmdavll@gmail.com) + +set background=dark + +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name = "wombat256" + + +" General colors +hi Normal ctermfg=254 ctermbg=234 cterm=none guifg=#f6f3e8 guibg=#242424 gui=none +hi Cursor ctermfg=none ctermbg=241 cterm=none guifg=NONE guibg=#656565 gui=none +hi Visual ctermfg=7 ctermbg=238 cterm=none guifg=#f6f3e8 guibg=#444444 gui=none +" hi VisualNOS +" hi Search +hi Folded ctermfg=103 ctermbg=238 cterm=none guifg=#a0a8b0 guibg=#384048 gui=none +hi Title ctermfg=7 ctermbg=none cterm=bold guifg=#f6f3e8 guibg=NONE gui=bold +hi StatusLine ctermfg=7 ctermbg=238 cterm=none guifg=#f6f3e8 guibg=#444444 gui=italic +hi VertSplit ctermfg=238 ctermbg=238 cterm=none guifg=#444444 guibg=#444444 gui=none +hi StatusLineNC ctermfg=243 ctermbg=238 cterm=none guifg=#857b6f guibg=#444444 gui=none +hi LineNr ctermfg=243 ctermbg=0 cterm=none guifg=#857b6f guibg=#000000 gui=none +hi SpecialKey ctermfg=244 ctermbg=236 cterm=none guifg=#808080 guibg=#343434 gui=none +hi NonText ctermfg=244 ctermbg=236 cterm=none guifg=#808080 guibg=#303030 gui=none + +" Vim >= 7.0 specific colors +if version >= 700 +hi CursorLine ctermbg=236 cterm=none guibg=#2d2d2d +hi MatchParen ctermfg=7 ctermbg=243 cterm=bold guifg=#f6f3e8 guibg=#857b6f gui=bold +hi Pmenu ctermfg=7 ctermbg=238 guifg=#f6f3e8 guibg=#444444 +hi PmenuSel ctermfg=0 ctermbg=192 guifg=#000000 guibg=#cae682 +endif + + +" Syntax highlighting +hi Keyword ctermfg=111 cterm=none guifg=#8ac6f2 gui=none +hi Statement ctermfg=111 cterm=none guifg=#8ac6f2 gui=none +hi Constant ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Number ctermfg=173 cterm=none guifg=#e5786d gui=none +hi PreProc ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Function ctermfg=192 cterm=none guifg=#cae682 gui=none +hi Identifier ctermfg=192 cterm=none guifg=#cae682 gui=none +hi Type ctermfg=192 cterm=none guifg=#cae682 gui=none +hi Special ctermfg=194 cterm=none guifg=#e7f6da gui=none +hi String ctermfg=113 cterm=none guifg=#95e454 gui=italic +hi Comment ctermfg=246 cterm=none guifg=#99968b gui=italic +hi Todo ctermfg=245 cterm=none guifg=#8f8f8f gui=italic + + +" Links +hi! link FoldColumn Folded +hi! link CursorColumn CursorLine + +" vim:set ts=4 sw=4 noet: diff --git a/home/.vim/colors/wombat256mod.vim b/home/.vim/colors/wombat256mod.vim new file mode 100644 index 0000000..1137eb8 --- /dev/null +++ b/home/.vim/colors/wombat256mod.vim @@ -0,0 +1,96 @@ +" Vim color file +" Original Maintainer: Lars H. Nielsen (dengmao@gmail.com) +" Last Change: 2010-07-23 +" +" Modified version of wombat for 256-color terminals by +" David Liang (bmdavll@gmail.com) +" based on version by +" Danila Bespalov (danila.bespalov@gmail.com) + +set background=dark + +if version > 580 + hi clear + if exists("syntax_on") + syntax reset + endif +endif + +let colors_name = "wombat256mod" + + +" General colors +hi Normal ctermfg=252 ctermbg=234 cterm=none guifg=#e3e0d7 guibg=#242424 gui=none +hi Cursor ctermfg=234 ctermbg=228 cterm=none guifg=#242424 guibg=#eae788 gui=none +hi Visual ctermfg=251 ctermbg=239 cterm=none guifg=#c3c6ca guibg=#554d4b gui=none +hi VisualNOS ctermfg=251 ctermbg=236 cterm=none guifg=#c3c6ca guibg=#303030 gui=none +hi Search ctermfg=177 ctermbg=241 cterm=none guifg=#d787ff guibg=#636066 gui=none +hi Folded ctermfg=103 ctermbg=237 cterm=none guifg=#a0a8b0 guibg=#3a4046 gui=none +hi Title ctermfg=230 cterm=bold guifg=#ffffd7 gui=bold +hi StatusLine ctermfg=230 ctermbg=238 cterm=none guifg=#ffffd7 guibg=#444444 gui=italic +hi VertSplit ctermfg=238 ctermbg=238 cterm=none guifg=#444444 guibg=#444444 gui=none +hi StatusLineNC ctermfg=241 ctermbg=238 cterm=none guifg=#857b6f guibg=#444444 gui=none +hi LineNr ctermfg=241 ctermbg=232 cterm=none guifg=#857b6f guibg=#080808 gui=none +hi SpecialKey ctermfg=241 ctermbg=235 cterm=none guifg=#626262 guibg=#2b2b2b gui=none +hi WarningMsg ctermfg=203 guifg=#ff5f55 +hi ErrorMsg ctermfg=196 ctermbg=236 cterm=bold guifg=#ff2026 guibg=#3a3a3a gui=bold + +" Vim >= 7.0 specific colors +if version >= 700 +hi CursorLine ctermbg=236 cterm=none guibg=#32322f +hi MatchParen ctermfg=228 ctermbg=101 cterm=bold guifg=#eae788 guibg=#857b6f gui=bold +hi Pmenu ctermfg=230 ctermbg=238 guifg=#ffffd7 guibg=#444444 +hi PmenuSel ctermfg=232 ctermbg=192 guifg=#080808 guibg=#cae982 +endif + +" Diff highlighting +hi DiffAdd ctermbg=17 guibg=#2a0d6a +hi DiffDelete ctermfg=234 ctermbg=60 cterm=none guifg=#242424 guibg=#3e3969 gui=none +hi DiffText ctermbg=53 cterm=none guibg=#73186e gui=none +hi DiffChange ctermbg=237 guibg=#382a37 + +"hi CursorIM +"hi Directory +"hi IncSearch +"hi Menu +"hi ModeMsg +"hi MoreMsg +"hi PmenuSbar +"hi PmenuThumb +"hi Question +"hi Scrollbar +"hi SignColumn +"hi SpellBad +"hi SpellCap +"hi SpellLocal +"hi SpellRare +"hi TabLine +"hi TabLineFill +"hi TabLineSel +"hi Tooltip +"hi User1 +"hi User9 +"hi WildMenu + + +" Syntax highlighting +hi Keyword ctermfg=111 cterm=none guifg=#88b8f6 gui=none +hi Statement ctermfg=111 cterm=none guifg=#88b8f6 gui=none +hi Constant ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Number ctermfg=173 cterm=none guifg=#e5786d gui=none +hi PreProc ctermfg=173 cterm=none guifg=#e5786d gui=none +hi Function ctermfg=192 cterm=none guifg=#cae982 gui=none +hi Identifier ctermfg=192 cterm=none guifg=#cae982 gui=none +hi Type ctermfg=186 cterm=none guifg=#d4d987 gui=none +hi Special ctermfg=229 cterm=none guifg=#eadead gui=none +hi String ctermfg=113 cterm=none guifg=#95e454 gui=italic +hi Comment ctermfg=246 cterm=none guifg=#9c998e gui=italic +hi Todo ctermfg=101 cterm=none guifg=#857b6f gui=italic + + +" Links +hi! link FoldColumn Folded +hi! link CursorColumn CursorLine +hi! link NonText LineNr + +" vim:set ts=4 sw=4 noet: diff --git a/home/.vim/colors/xoria256.vim b/home/.vim/colors/xoria256.vim new file mode 100644 index 0000000..7d1010b --- /dev/null +++ b/home/.vim/colors/xoria256.vim @@ -0,0 +1,142 @@ +" Vim color file +" +" Name: xoria256.vim +" Version: 1.5 +" Maintainer: Dmitriy Y. Zotikov (xio) +" +" Should work in recent 256 color terminals. 88-color terms like urxvt are +" NOT supported. +" +" Don't forget to install 'ncurses-term' and set TERM to xterm-256color or +" similar value. +" +" Color numbers (0-255) see: +" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html +" +" For a specific filetype highlighting rules issue :syntax list when a file of +" that type is opened. + +" Initialization {{{ +if &t_Co != 256 && ! has("gui_running") + echomsg "" + echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)" + echomsg "" + finish +endif + +set background=dark + +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name = "xoria256" +"}}} +" Colours {{{1 +"" General {{{2 +hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none +hi Cursor ctermbg=214 guibg=#ffaf00 +hi CursorColumn ctermbg=238 guibg=#444444 +hi CursorLine ctermbg=237 guibg=#3a3a3a cterm=none gui=none +hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000 +hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000 +hi FoldColumn ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 +hi Folded ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87 +hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none +hi LineNr ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 +hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold +" TODO +" hi MoreMsg +hi NonText ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold +hi Pmenu ctermfg=0 guifg=#000000 ctermbg=250 guibg=#bcbcbc +hi PmenuSel ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676 +hi PmenuSbar ctermbg=252 guibg=#d0d0d0 +hi PmenuThumb ctermfg=243 guifg=#767676 +hi Search ctermfg=0 guifg=#000000 ctermbg=149 guibg=#afdf5f +hi SignColumn ctermfg=248 guifg=#a8a8a8 +hi SpecialKey ctermfg=77 guifg=#5fdf5f +hi SpellBad ctermfg=160 guifg=fg ctermbg=bg cterm=underline guisp=#df0000 +hi SpellCap ctermfg=189 guifg=#dfdfff ctermbg=bg guibg=bg cterm=underline gui=underline +hi SpellRare ctermfg=168 guifg=#df5f87 ctermbg=bg guibg=bg cterm=underline gui=underline +hi SpellLocal ctermfg=98 guifg=#875fdf ctermbg=bg guibg=bg cterm=underline gui=underline +hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold +hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none +hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=none gui=none +hi TabLineFill ctermfg=fg guifg=fg ctermbg=237 guibg=#3a3a3a cterm=none gui=none +" FIXME +hi Title ctermfg=225 guifg=#ffdfff +hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00 +hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline +hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none +" hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none +" hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff +hi Visual ctermfg=255 guifg=#eeeeee ctermbg=96 guibg=#875f87 +" hi Visual ctermfg=255 guifg=#eeeeee ctermbg=24 guibg=#005f87 +hi VisualNOS ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87 +hi WildMenu ctermfg=0 guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold + +"" Syntax highlighting {{{2 +hi Comment ctermfg=244 guifg=#808080 +hi Constant ctermfg=229 guifg=#ffffaf +hi Identifier ctermfg=182 guifg=#dfafdf cterm=none +hi Ignore ctermfg=238 guifg=#444444 +hi Number ctermfg=180 guifg=#dfaf87 +hi PreProc ctermfg=150 guifg=#afdf87 +hi Special ctermfg=174 guifg=#df8787 +hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none +hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none + +"" Special {{{2 +""" .diff {{{3 +hi diffAdded ctermfg=150 guifg=#afdf87 +hi diffRemoved ctermfg=174 guifg=#df8787 +""" vimdiff {{{3 +hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf +"hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none +hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none +hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf +hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none +""" HTML {{{3 +" hi htmlTag ctermfg=146 guifg=#afafdf +" hi htmlEndTag ctermfg=146 guifg=#afafdf +hi htmlTag ctermfg=244 +hi htmlEndTag ctermfg=244 +hi htmlArg ctermfg=182 guifg=#dfafdf +hi htmlValue ctermfg=187 guifg=#dfdfaf +hi htmlTitle ctermfg=254 ctermbg=95 +" hi htmlArg ctermfg=146 +" hi htmlTagName ctermfg=146 +" hi htmlString ctermfg=187 +""" django {{{3 +hi djangoVarBlock ctermfg=180 +hi djangoTagBlock ctermfg=150 +hi djangoStatement ctermfg=146 +hi djangoFilter ctermfg=174 +""" python {{{3 +hi pythonExceptions ctermfg=174 +""" NERDTree {{{3 +hi Directory ctermfg=110 guifg=#87afdf +hi treeCWD ctermfg=180 guifg=#dfaf87 +hi treeClosable ctermfg=174 guifg=#df8787 +hi treeOpenable ctermfg=150 guifg=#afdf87 +hi treePart ctermfg=244 guifg=#808080 +hi treeDirSlash ctermfg=244 guifg=#808080 +hi treeLink ctermfg=182 guifg=#dfafdf + +""" VimDebug {{{3 +" FIXME +" you may want to set SignColumn highlight in your .vimrc +" :help sign +" :help SignColumn + +" hi currentLine term=reverse cterm=reverse gui=reverse +" hi breakPoint term=NONE cterm=NONE gui=NONE +" hi empty term=NONE cterm=NONE gui=NONE + +" sign define currentLine linehl=currentLine +" sign define breakPoint linehl=breakPoint text=>> +" sign define both linehl=currentLine text=>> +" sign define empty linehl=empty + diff --git a/home/.vim/doc/gist-vim.txt b/home/.vim/doc/gist-vim.txt new file mode 100644 index 0000000..07311d0 --- /dev/null +++ b/home/.vim/doc/gist-vim.txt @@ -0,0 +1,294 @@ +*Gist.vim* Vimscript for creating gists (http://gist.github.com) + +Usage |gist-vim-usage| +Tips |gist-vim-tips| +License |gist-vim-license| +Install |gist-vim-install| +Requirements |gist-vim-requirements| +Setup |gist-vim-setup| +FAQ |gist-vim-faq| + +This is a vimscript for creating gists (http://gist.github.com) + +For the latest version please see https://github.com/mattn/gist-vim. + +============================================================================== +USAGE *:Gist* *gist-vim-usage* + +- Post current buffer to gist, using default privacy option. > + + :Gist +< +- Post selected text to gist, using default privacy option. + This applies to all permutations listed below (except multi). > + + :'<,'>Gist +< +- Create a private gist. > + + :Gist -p +< +- Create a public gist. + (Only relevant if you've set gists to be private by default.) > + + :Gist -P +< +- Post whole text to gist as public. + This is only relevant if you've set gists to be private by default. +> + :Gist -P +< +- Create a gist anonymously. > + + :Gist -a +< +- Create a gist with all open buffers. > + + :Gist -m +< +- Edit the gist (you need to have opened the gist buffer first). + You can update the gist with the {:w} command within the gist buffer. > + + :Gist -e +< +- Edit the gist with name "foo.js" (you need to have opened the gist buffer + first). > + + :Gist -e foo.js +< +- Post/Edit with the description " (you need to have opened the gist buffer + first). > + + :Gist -s something + :Gist -e -s something +< +- Delete the gist (you need to have opened the gist buffer first). + Password authentication is needed. > + + :Gist -d +< +- Fork the gist (you need to have opened the gist buffer first). + Password authentication is needed. > + + :Gist -f +< +- Star the gist (you need to have opened the gist buffer first). + Password authentication is needed. +> + :Gist +1 +< +- Unstar the gist (you need to have opened the gist buffer first). + Password authentication is needed. +> + :Gist -1 +< +- Get gist XXXXX. > + + :Gist XXXXX +< +- Get gist XXXXX and add to clipboard. > + + :Gist -c XXXXX +< +- List your public gists. > + + :Gist -l +< +- List gists from user "mattn". > + + :Gist -l mattn +< +- List everyone's gists. > + + :Gist -la +< +- List gists from your starred gists. +> + :Gist -ls +< +============================================================================== +TIPS *gist-vim-tips* + +If you set "g:gist_clip_command", gist.vim will copy the gist code with option +"-c". + + - Mac: > + let g:gist_clip_command = 'pbcopy' +< + - Linux: > + let g:gist_clip_command = 'xclip -selection clipboard' +< + - Others (cygwin?): > + let g:gist_clip_command = 'putclip' +< +If you want to detect filetype from the filename: > + + let g:gist_detect_filetype = 1 +< +If you want to open the browser after the post: > + + let g:gist_open_browser_after_post = 1 +< +If you want to change the browser: > + + let g:gist_browser_command = 'w3m %URL%' +< +or: > + + let g:gist_browser_command = 'opera %URL% &' +< +On windows, this should work with your user settings. + +If you want to show your private gists with ":Gist -l": > + + let g:gist_show_privates = 1 +< +If you want your gist to be private by default: > + + let g:gist_post_private = 1 + +< +If you want to edit all files for gists containing more than one: > + + let g:gist_get_multiplefile = 1 +< + +If you want to use on GitHub Enterprise: > + + let g:gist_api_url = 'http://your-github-enterprise-domain/api/v3' +< + +If you want to update a gist, embed > + + GistID: xxxxx +> +in your local file, then call > + + :Gist +> + +If you want to update a gist when only |:w!|: > + + " :w and :w! update a gist. + let g:gist_update_on_write = 1 + + " Only :w! updates a gist. + let g:gist_update_on_write = 2 +> +All other values are treated as 1. +This variable's value is 1 by default. + +============================================================================== +LICENSE *gist-vim-license* + + + Copyright 2010 by Yasuhiro Matsumoto + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +============================================================================== +INSTALL *gist-vim-install* + +Copy following files into your plugin directory. + +rtp: + - autoload/gist.vim + - plugin/gist.vim + +If you want to uninstall gist.vim, remember to also remove `~/.gist-vim`. + +You need to install webapi-vim also: + + http://www.vim.org/scripts/script.php?script_id=4019 + +If you want to use latest one: + + https://github.com/mattn/webapi-vim + +============================================================================== +REQUIREMENTS *gist-vim-requirements* + + - curl command (http://curl.haxx.se/) + - webapi-vim (https://github.com/mattn/webapi-vim) + - and, if you want to use your git profile, the git command-line client. + +============================================================================== +SETUP *gist-vim-setup* + +This plugin uses GitHub API v3. Setting value is stored in `~/.gist-vim`. +gist-vim have two ways to access APIs. + +First, you need to set your GitHub username in global git config: +> + $ git config --global github.user Username +< +Then, gist.vim will ask for your password to create an authorization when you +first use it. The password is not stored and only the OAuth access token will +be kept for later use. You can revoke the token at any time from the list of +"Authorized applications" on GitHub's "Account Settings" page. +(https://github.com/settings/applications) + +If you have two-factor authentication enabled on GitHub, you'll see the message +"Must specify two-factor authentication OTP code." In this case, you need to +create a "Personal Access Token" on GitHub's "Account Settings" page +(https://github.com/settings/applications) and place it in a file +named ~/.gist-vim like this: +> + token xxxxx +< +If you happen to have your password already written in ~/.gitconfig like +below: +> + [github] + password = xxxxx +< +Then, add following into your ~/.vimrc +> + let g:gist_use_password_in_gitconfig = 1 +< +This is not secure at all, so strongly discouraged. + +============================================================================== +FAQ *gist-vim-faq* + +Q. :Gist give Forbidden error +A. Try to delete ~/.gist-vim. And authenticate again. + +============================================================================== +THANKS *gist-vim-thanks* + + AD7six + Bruno Bigras + c9s + Daniel Bretoi + Jeremy Michael Cantrell + Kien N + kongo2002 + MATSUU Takuto + Matthew Weier O'Phinney + ornicar + Roland Schilter + steve + tyru + Will Gray + netj + + vim:tw=78:ts=8:ft=help:norl: diff --git a/home/.vim/doc/recoverPlugin.txt b/home/.vim/doc/recoverPlugin.txt new file mode 100644 index 0000000..cc3b27e --- /dev/null +++ b/home/.vim/doc/recoverPlugin.txt @@ -0,0 +1,260 @@ +*recover.vim* Show differences for recovered files + +Author: Christian Brabandt +Version: 0.18 Wed, 14 Aug 2013 22:39:13 +0200 +Copyright: (c) 2009, 2010, 2011, 2012, 2013 by Christian Brabandt + The VIM LICENSE applies to recoverPlugin.vim and recoverPlugin.txt + (see |copyright|) except use recoverPlugin instead of "Vim". + NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK. + + +============================================================================== +1. Contents *RecoverPlugin* + + 1. Contents.....................................: |recoverPlugin| + 2. recover Manual...............................: |recover-manual| + 3. recover Feedback.............................: |recover-feedback| + 4. recover History..............................: |recover-history| + +============================================================================== + *RecoverPlugin-manual* +2. RecoverPlugin Manual *recover-manual* + +Functionality + +When using |recovery|, it is hard to tell, what has been changed between the +recovered file and the actual on disk version. The aim of this plugin is, to +have an easy way to see differences, between the recovered files and the files +stored on disk. + +Therefore this plugin sets up an auto command, that will create a diff buffer +between the recovered file and the on-disk version of the same file. You can +easily see, what has been changed and save your recovered work back to the +file on disk. + +By default this plugin is enabled. To disable it, use > + :RecoverPluginDisable +< +To enable this plugin again, use > + :RecoverPluginEnable +< +When you open a file and vim detects, that an |swap-file| already exists for a +buffer, the plugin presents the default Swap-Exists dialog from Vim adding one +additional option for Diffing (but leaves out the lengthy explanation about +handling Swapfiles that Vim by default shows): > + + Found a swap file by the name "test/normal/.testfile.swp" + owned by: chrisbra dated: Wed Nov 28 16:26:42 2012 + file name: ~chrisbra/code/git/vim/Recover/test/normal/testfile + modified: YES + user name: chrisbra host name: R500 + process ID: 4878 [not existing] + While opening file "test/normal/testfile" + dated: Tue Nov 6 20:11:55 2012 + Please choose: + D[i]ff, (O)pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort, (D)elete: + + +(Note, that additionally, it shows in the process ID row the name of the +process that has the process id or [not existing] if that process doesn't +exist.) Simply use the key, that is highlighted to chose the option. If you +press Ctrl-C, the default dialog of Vim will be shown. + +If you have said 'Diff', the plugin opens a new vertical splitt buffer. On the +left side, you'll find the file as it is stored on disk and the right side +will contain your recovered version of the file (using the found swap file). + +You can now use the |merge| commands to copy the contents to the buffer that +holds your recovered version. If you are finished, you can close the diff +version and close the window, by issuing |:diffoff!| and |:close| in the +window, that contains the on-disk version of the file. Be sure to save the +recovered version of you file and afterwards you can safely remove the swap +file. + *RecoverPluginFinish* *FinishRecovery* +In the recovered window, the command > + :FinishRecovery +< +deletes the swapfile closes the diff window and finishes everything up. + +Alternatively you can also use the command > + :RecoveryPluginFinish +< + *RecoverPluginHelp* +The command > + :RecoverPluginHelp +< +show a small message, on what keys can be used to move to the next different +region and how to merge the changes from one windo into the other. + + *RecovePlugin-config* +If you want Vim to automatically edit any file that is open in another Vim +instance but is unmodified there, you need to set the configuration variable: +g:RecoverPlugin_Edit_Unmodified to 1 like this in your |.vimrc| > + + :let g:RecoverPlugin_Edit_Unmodified = 1 +< +Note: This only works on Linux. + + *RecoverPlugin-misc* +If your Vim was built with |+balloon_eval|, recover.vim will also set up an +balloon expression, that shows you, which buffer contains the recovered +version of your file and which buffer contains the unmodified on-disk version +of your file, if you move the mouse of the buffer. (See |balloon-eval|). + +If you have setup your 'statusline', recover.vim will also inject some info +(which buffer contains the on-disk version and which buffer contains the +modified, recovered version). Additionally the buffer that is read-only, will +have a filename (|:f|) of something like 'original file (on disk-version)'. If +you want to save that version, use |:saveas|. + +============================================================================== +3. Plugin Feedback *recover-feedback* + +Feedback is always welcome. If you like the plugin, please rate it at the +vim-page: +http://www.vim.org/scripts/script.php?script_id=3068 + +You can also follow the development of the plugin at github: +http://github.com/chrisbra/Recover.vim + +Please don't hesitate to report any bugs to the maintainer, mentioned in the +third line of this document. + +============================================================================== +4. recover History *recover-history* + +0.18: Aug 14, 2013 "{{{1 + +- fix issue 19 (https://github.com/chrisbra/Recover.vim/issues/19, by + replacing feedkeys("...\n") by feedkeys("...\", reported by vlmarek, + thanks!) +- fix issue 20 (https://github.com/chrisbra/Recover.vim/issues/20, + (let vim automatically edit a file, that is unmodified in another vim + instance, suggested by rking, thanks!) +- merge issue 21 (https://github.com/chrisbra/Recover.vim/pull/21, create more + usefule README.md file, contribted by Shubham Rao, thanks!) +- merge issue 22 (https://github.com/chrisbra/Recover.vim/pull/22, delete BufReadPost autocommand + contributed by Marcin Szamotulski, thanks!) + +0.17: Feb 16, 2013 "{{{1 + +- fix issue 17 (https://github.com/chrisbra/Recover.vim/issues/17 patch by + lyokha, thanks!) +- Use default key combinations in the dialog of the normal Vim dialog (adding + only the Diff option) +- Make sure, the process ID is shown + +0.16: Nov 21, 2012 "{{{1 + +- Recovery did not work, when original file did not exists (issue 11 + https://github.com/chrisbra/Recover.vim/issues/11 + reported by Rking, thanks!) +- By default, delete swapfile, if no differences found (issue 15 + https://github.com/chrisbra/Recover.vim/issues/15 + reported by Rking, thanks!) +- reset 'swapfile' option, so that Vim by default creates .swp files + (idea and patch by Marcin Szamotulski, thanks!) +- capture and display |E325| message (and also try to figure out the name of + the pid (issue 12 https://github.com/chrisbra/Recover.vim/issues/12) + +0.15: Aug 20, 2012 "{{{1 + +- fix issue 5 (https://github.com/chrisbra/Recover.vim/issues/5 patch by + lyokha, thanks!) +- CheckSwapFileExists() hangs, when a swap file was not found, make sure, + s:Swapname() returns a valid file name +- fix issue 6 (https://github.com/chrisbra/Recover.vim/issues/6 patch by + lyokha, thanks!) +- Avoid recursive :redir call (https://github.com/chrisbra/Recover.vim/pull/8 + patch by Ingo Karkat, thanks!) +- Do not set 'bexpr' for unrelated buffers ( + https://github.com/chrisbra/Recover.vim/pull/9 patch by Ingo Karkat, + thanks!) +- Avoid aborting the diff (https://github.com/chrisbra/Recover.vim/pull/10 + patch by Ingo Karkat, thanks!) +- Allow to directly delete the swapfile ( + https://github.com/chrisbra/Recover.vim/issues/7 suggested by jgandt, + thanks!) + +0.14: Mar 31, 2012 "{{{1 + +- still some problems with issue #4 + +0.13: Mar 29, 2012 "{{{1 + +- fix issue 3 (https://github.com/chrisbra/Recover.vim/issues/3 reported by + lyokha, thanks!) +- Ask the user to delete the swapfile (issue + https://github.com/chrisbra/Recover.vim/issues/4 reported by lyokha, + thanks!) + +0.12: Mar 25, 2012 "{{{1 + +- minor documentation update +- delete swap files, if no difference found (issue + https://github.com/chrisbra/Recover.vim/issues/1 reported by y, thanks!) +- fix some small issues, that prevented the development versions from working + (https://github.com/chrisbra/Recover.vim/issues/2 reported by Rahul Kumar, + thanks!) + +0.11: Oct 19, 2010 "{{{1 + +- use confirm() instead of inputdialog() (suggested by D.Fishburn, thanks!) + +0.9: Jun 02, 2010 "{{{1 + +- use feedkeys(...,'t') instead of feedkeys() (this works more reliable, + although it pollutes the history), so delete those spurious history entries +- |RecoverPluginHelp| shows a small help message, about diff commands + (suggested by David Fishburn, thanks!) +- |RecoverPluginFinish| is a shortcut for |FinishRecovery| + +0.8: Jun 01, 2010 "{{{1 + +- make :FinishRecovery more robust + +0.7: Jun 01, 2010 "{{{1 + +- |FinishRecovery| closes the diff-window and cleans everything up (suggestion + by David Fishburn) +- DeleteSwapFile is not needed anymore + +0.6: May 31, 2010 "{{{1 + +- |recover-feedback| +- Ask to really open a diff buffer for a file (suggestion: David Fishburn, + thanks!) +- DeleteSwapFile to delete the swap file, that was used to create the diff + buffer +- change feedkeys(...,'t') to feedkeys('..') so that not every command appears + in the history. + +0.5: May 04, 2010 "{{{1 + +- 0r command in recover plugin adds extra \n + Patch by Sergey Khorev (Thanks!) +- generate help file with 'et' set, so the README at github looks prettier + +0.4: Apr 26, 2010 "{{{1 + +- handle Windows and Unix path differently +- Code cleanup +- Enabled |:GLVS| + +0.3: Apr 20, 2010 "{{{1 + +- first public verion +- put plugin on a public repository + (http://github.com/chrisbra/Recover.vim) + +0.2: Apr 18, 2010 "{{{1 + +- Internal version, some cleanup, bugfixes for windows + +0.1: Apr 17, 2010 "{{{1 + +- Internal version, First working version, using simple commands + +============================================================================== +Modeline: "{{{1 +vim:tw=78:ts=8:ft=help:et:fdm=marker:fdl=0:norl diff --git a/home/.vim/doc/tags b/home/.vim/doc/tags new file mode 100644 index 0000000..7c1fef7 --- /dev/null +++ b/home/.vim/doc/tags @@ -0,0 +1,40 @@ +FinishRecovery recoverPlugin.txt /*FinishRecovery* +RecovePlugin-config recoverPlugin.txt /*RecovePlugin-config* +RecoverPlugin recoverPlugin.txt /*RecoverPlugin* +RecoverPlugin-manual recoverPlugin.txt /*RecoverPlugin-manual* +RecoverPlugin-misc recoverPlugin.txt /*RecoverPlugin-misc* +RecoverPluginFinish recoverPlugin.txt /*RecoverPluginFinish* +RecoverPluginHelp recoverPlugin.txt /*RecoverPluginHelp* +bufexplorer bufexplorer.txt /*bufexplorer* +bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog* +bufexplorer-copyright bufexplorer.txt /*bufexplorer-copyright* +bufexplorer-credits bufexplorer.txt /*bufexplorer-credits* +bufexplorer-customization bufexplorer.txt /*bufexplorer-customization* +bufexplorer-installation bufexplorer.txt /*bufexplorer-installation* +bufexplorer-todo bufexplorer.txt /*bufexplorer-todo* +bufexplorer-usage bufexplorer.txt /*bufexplorer-usage* +bufexplorer-windowlayout bufexplorer.txt /*bufexplorer-windowlayout* +bufexplorer.txt bufexplorer.txt /*bufexplorer.txt* +buffer-explorer bufexplorer.txt /*buffer-explorer* +g:bufExplorerChgWin bufexplorer.txt /*g:bufExplorerChgWin* +g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp* +g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp* +g:bufExplorerDisableDefaultKeyMapping bufexplorer.txt /*g:bufExplorerDisableDefaultKeyMapping* +g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive* +g:bufExplorerFuncRef bufexplorer.txt /*g:bufExplorerFuncRef* +g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort* +g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories* +g:bufExplorerShowNoName bufexplorer.txt /*g:bufExplorerShowNoName* +g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath* +g:bufExplorerShowTabBuffer bufexplorer.txt /*g:bufExplorerShowTabBuffer* +g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted* +g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy* +g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow* +g:bufExplorerSplitHorzSize bufexplorer.txt /*g:bufExplorerSplitHorzSize* +g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName* +g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight* +g:bufExplorerSplitVertSize bufexplorer.txt /*g:bufExplorerSplitVertSize* +recover-feedback recoverPlugin.txt /*recover-feedback* +recover-history recoverPlugin.txt /*recover-history* +recover-manual recoverPlugin.txt /*recover-manual* +recover.vim recoverPlugin.txt /*recover.vim* diff --git a/home/.vim/ftdetect/markdown.vim b/home/.vim/ftdetect/markdown.vim new file mode 100644 index 0000000..3c6560c --- /dev/null +++ b/home/.vim/ftdetect/markdown.vim @@ -0,0 +1,6 @@ +autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn + \ if &ft =~# '^\%(conf\|modula2\)$' | + \ set ft=markdown | + \ else | + \ setf markdown | + \ endif \ No newline at end of file diff --git a/home/.vim/ftplugin/markdown.vim b/home/.vim/ftplugin/markdown.vim new file mode 100644 index 0000000..4e99141 --- /dev/null +++ b/home/.vim/ftplugin/markdown.vim @@ -0,0 +1,22 @@ +" Vim filetype plugin +" Language: Markdown +" Maintainer: Tim Pope +" Last Change: 2013 May 30 + +if exists("b:did_ftplugin") + finish +endif + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim + +setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s +setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+ + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= "|setl cms< com< fo< flp<" +else + let b:undo_ftplugin = "setl cms< com< fo< flp<" +endif + +" vim:set sw=2: \ No newline at end of file diff --git a/home/.vim/plugin/gist.vim b/home/.vim/plugin/gist.vim new file mode 100644 index 0000000..7e53cd1 --- /dev/null +++ b/home/.vim/plugin/gist.vim @@ -0,0 +1,23 @@ +"============================================================================= +" File: gist.vim +" Author: Yasuhiro Matsumoto +" WebPage: http://github.com/mattn/gist-vim +" License: BSD +" GetLatestVimScripts: 2423 1 :AutoInstall: gist.vim +" script type: plugin + +if &cp || (exists('g:loaded_gist_vim') && g:loaded_gist_vim) + finish +endif +let g:loaded_gist_vim = 1 + +function! s:CompleteArgs(arg_lead,cmdline,cursor_pos) + return ["-p", "-P", "-a", "-m", "-e", "-s", "-d", "+1", "-1", "-f", "-c", "-l", "-la", "-ls", + \ "--listall", "--liststar", "--list", "--multibuffer", "--private", "--public", "--anonymous", "--description", "--clipboard", + \ "--rawurl", "--delete", "--edit", "--star", "--unstar", "--fork" + \ ] +endfunction + +command! -nargs=? -range=% -complete=customlist,s:CompleteArgs Gist :call gist#Gist(, , , ) + +" vim:set et: diff --git a/home/.vim/plugin/recover.vim b/home/.vim/plugin/recover.vim new file mode 100644 index 0000000..8bcf8c6 --- /dev/null +++ b/home/.vim/plugin/recover.vim @@ -0,0 +1,34 @@ +" Vim plugin for diffing when swap file was found +" Last Change: Wed, 14 Aug 2013 22:39:13 +0200 +" Version: 0.18 +" Author: Christian Brabandt +" Script: http://www.vim.org/scripts/script.php?script_id=3068 +" License: VIM License +" GetLatestVimScripts: 3068 17 :AutoInstall: recover.vim +" Documentation: see :h recoverPlugin.txt + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if exists("g:loaded_recover") || &cp + finish +endif +let g:loaded_recover = 1"}}} +let s:keepcpo = &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Public Interface {{{1 +" Define User-Commands and Autocommand "{{{ +call recover#Recover(1) + +com! RecoverPluginEnable :call recover#Recover(1) +com! RecoverPluginDisable :call recover#Recover(0) +com! RecoverPluginHelp :call recover#Help() + +" ===================================================================== +" Restoration And Modelines: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo + +" Modeline {{{1 +" vim: fdm=marker sw=2 sts=2 ts=8 fdl=0 diff --git a/home/.vim/plugin/tasklist.vim b/home/.vim/plugin/tasklist.vim new file mode 100644 index 0000000..25e9e73 --- /dev/null +++ b/home/.vim/plugin/tasklist.vim @@ -0,0 +1,375 @@ +"------------------------------------------------------------------------------ +" Name Of File: tasklist.vim +" +" Description: Vim plugin to search for a list of tokens and display a +" window with matches. +" +" Author: Juan Frias (juandfrias at gmail.com) +" +" Last Change: 2009 Apr 11 +" Version: 1.0.1 +" +" Copyright: Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this header +" is included with it. +" +" This script is to be distributed freely in the hope that it +" will be useful, but is provided 'as is' and without warranties +" as to performance of merchantability or any other warranties +" whether expressed or implied. Because of the various hardware +" and software environments into which this script may be put, +" no warranty of fitness for a particular purpose is offered. +" +" GOOD DATA PROCESSING PROCEDURE DICTATES THAT ANY SCRIPT BE +" THOROUGHLY TESTED WITH NON-CRITICAL DATA BEFORE RELYING ON IT. +" +" THE USER MUST ASSUME THE ENTIRE RISK OF USING THE SCRIPT. +" +" The author does not retain any liability on any damage caused +" through the use of this script. +" +" Install: 1. Read the section titled 'Options' +" 2. Setup any variables need in your vimrc file +" 3. Copy 'tasklist.vim' to your plugin directory. +" +" Mapped Keys: t Display list. +" +" Usage: Start the script with the mapped key, a new window appears +" with the matches found, moving around the window will also +" update the position of the current document. +" +" The following keys are mapped to the results window: +" +" q - Quit, and restore original cursor position. +" +" e - Exit, and keep results window open note that +" movements on the result window will no longer be +" updated. +" +" - Quit and place the cursor on the selected line. +" +" Aknowledgments: Many thanks to Zhang Shuhan for taking the time to beta +" test and suggest many of the improvements and features +" found in the script. I don't think I would have +" implemented it wihout his help. Thanks! +" +"------------------------------------------------------------------------------ +" Please send me any bugs you find, so I can keep the script up to date. +"------------------------------------------------------------------------------ + +" History: {{{1 +"------------------------------------------------------------------------------ +" +" 1.00 Initial version. +" +" User Options: {{{1 +"------------------------------------------------------------------------------ +" +" t +" This is the default key map to view the task list. +" to overwrite use something like: +" map v TaskList +" in your vimrc file +" +" g:tlWindowPosition +" This is specifies the position of the window to be opened. By +" default it will open at on top. To overwrite use: +" let g:tlWindowPosition = 1 +" in your vimrc file, options are as follows: +" 0 = Open on top +" 1 = Open on the bottom +" +" g:tlTokenList +" This is the list of tokens to search for default is +" 'FIXME TODO XXX'. The results are groupped and displayed in the +" order that they appear. to overwrite use: +" let g:tlTokenList = ['TOKEN1', 'TOKEN2', 'TOKEN3'] +" in your vimrc file +" +" g:tlRememberPosition +" If this is set to 1 then the script will try to get back to the +" position where it last was closed. By default it will find the line +" closest to the current cursor position. +" to overwrite use: +" let g:tlRememberPosition = 1 +" in your vimrc file +" + +" Global variables: {{{1 +"------------------------------------------------------------------------------ + +" Load script once +"------------------------------------------------------------------------------ +if exists("g:loaded_tasklist") || &cp + finish +endif +let g:loaded_tasklist = 1 + +" Set where the window opens +"------------------------------------------------------------------------------ +if !exists('g:tlWindowPosition') +" 0 = Open at top + let g:tlWindowPosition = 0 +endif + +" Set the token list +"------------------------------------------------------------------------------ +if !exists('g:tlTokenList') +" default list of tokens + let g:tlTokenList = ["FIXME", "TODO", "XXX"] +endif + +" Remember position +"------------------------------------------------------------------------------ +if !exists('g:tlRememberPosition') +" 0 = Donot remember, find closest match + let g:tlRememberPosition = 0 +endif + +" Script variables: {{{1 +"------------------------------------------------------------------------------ + +" Function: Open Window {{{1 +"-------------------------------------------------------------------------- +function! s:OpenWindow(buffnr, lineno) + " Open results window and place items there. + if g:tlWindowPosition == 0 + execute 'sp -TaskList_'.a:buffnr.'-' + else + execute 'botright sp -TaskList_'.a:buffnr.'-' + endif + + let b:original_buffnr = a:buffnr + let b:original_line = a:lineno + + set noswapfile + set modifiable + normal! "zPGddgg + set fde=getline(v:lnum)[0]=='L' + set foldmethod=expr + set foldlevel=0 + normal! zR + + " Resize line if too big. + let l:hits = line("$") + if l:hits < winheight(0) + sil! exe "resize ".l:hits + endif + + " Clean up. + let @z = "" + set nomodified +endfunction + +" Function: Search file {{{1 +"-------------------------------------------------------------------------- +function! s:SearchFile(hits, word) + " Search at the beginning and keep adding them to the register + let l:match_count = 0 + normal! gg0 + let l:max = strlen(line('$')) + let l:last_match = -1 + let l:div = 0 + while search(a:word, "Wc") > 0 + let l:curr_line = line('.') + if l:last_match == l:curr_line + if l:curr_line == line('$') + break + endif + normal! j0 + continue + endif + let l:last_match = l:curr_line + if foldlevel(l:curr_line) != 0 + normal! 99zo + endif + if l:div == 0 + if a:hits != 0 + let @z = @z."\n" + endif + let l:div = 1 + endif + normal! 0 + let l:lineno = ' '.l:curr_line + let @z = @z.'Ln '.strpart(l:lineno, strlen(l:lineno) - l:max).': ' + let l:text = getline(".") + let @z = @z.strpart(l:text, stridx(l:text, a:word)) + let @z = @z."\n" + normal! $ + let l:match_count = l:match_count + 1 + endwhile + return l:match_count +endfunction + +" Function: Get line number {{{1 +"-------------------------------------------------------------------------- +function! s:LineNumber() + let l:text = getline(".") + if strpart(l:text, 0, 5) == "File:" + return 0 + endif + if strlen(l:text) == 0 + return -1 + endif + let l:num = matchstr(l:text, '[0-9]\+') + if l:num == '' + return -1 + endif + return l:num +endfunction + +" Function: Update document position {{{1 +"-------------------------------------------------------------------------- +function! s:UpdateDoc() + let l:line_hit = LineNumber() + + match none + if l:line_hit == -1 + redraw + return + endif + + let l:buffnr = b:original_buffnr + exe 'match Search /\%'.line(".").'l.*/' + if line(".") < (line("$") - (winheight(0) / 2)) + 1 + normal! zz + endif + execute bufwinnr(l:buffnr)." wincmd w" + match none + if l:line_hit == 0 + normal! 1G + else + exe "normal! ".l:line_hit."Gzz" + exe 'match Search /\%'.line(".").'l.*/' + endif + execute bufwinnr('-TaskList_'.l:buffnr.'-')." wincmd w" + redraw +endfunction + +" Function: Clean up on exit {{{1 +"-------------------------------------------------------------------------- +function! s:Exit(key) + + call UpdateDoc() + match none + + let l:original_line = b:original_line + let l:last_position = line('.') + + if a:key == -1 + nunmap e + nunmap q + nunmap + execute bufwinnr(b:original_buffnr)." wincmd w" + else + bd! + endif + + let b:last_position = l:last_position + + if a:key == 0 + exe "normal! ".l:original_line."G" + endif + + match none + normal! zz + + execute "set updatetime=".s:old_updatetime +endfunction + +" Function: Check for screen update {{{1 +"-------------------------------------------------------------------------- +function! s:CheckForUpdate() + if stridx(expand("%:t"), '-TaskList_') == -1 + return + endif + if b:selected_line != line(".") + call UpdateDoc() + let b:selected_line = line(".") + endif +endfunction + +" Function: Start the search. {{{1 +"-------------------------------------------------------------------------- +function! s:TaskList() + let l:original_buffnr = bufnr('%') + let l:original_line = line(".") + + " last position + if !exists('b:last_position') + let b:last_position = 1 + endif + let l:last_position = b:last_position + + + " get file name + let @z = "File:".expand("%:p")."\n\n" + + " search file + let l:index = 0 + let l:count = 0 + let l:hits = 0 + while l:index < len(g:tlTokenList) + let l:search_word = g:tlTokenList[l:index] + let l:hits = s:SearchFile(l:hits, l:search_word) + let l:count = l:count + l:hits + let l:index = l:index + 1 + endwhile + + " Make sure we at least have one hit. + if l:count == 0 + echohl Search + echo "tasklist.vim: No task information found." + echohl None + execute 'normal! '.l:original_line.'G' + return + endif + + " display window + call s:OpenWindow(l:original_buffnr, l:original_line) + + " restore the cursor position + if g:tlRememberPosition != 0 + exec 'normal! '.l:last_position.'G' + else + normal! gg + endif + + " Map exit keys + nnoremap q :call Exit(0) + nnoremap :call Exit(1) + nnoremap e :call Exit(-1) + + " Setup syntax highlight {{{ + syntax match tasklistFileDivider /^File:.*$/ + syntax match tasklistLineNumber /^Ln\s\+\d\+:/ + + highlight def link tasklistFileDivider Title + highlight def link tasklistLineNumber LineNr + highlight def link tasklistSearchWord Search + " }}} + + " Save globals and change updatetime + let b:selected_line = line(".") + let s:old_updatetime = &updatetime + set updatetime=350 + + " update the doc and hook the CheckForUpdate function. + call UpdateDoc() + au! CursorHold nested call CheckForUpdate() + +endfunction +"}}} + +" Command +command! TaskList call s:TaskList() + +" Default key map +if !hasmapto('TaskList') + map t TaskList +endif + +" Key map to Command +nnoremap