From 7967a36522189f0910d4c9606f39f9ba0315df05 Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 16 Nov 2018 17:37:29 -0600 Subject: [PATCH] Added vimrc and vim config directory. --- vim/.netrwhist | 11 + vim/after/syntax/blah.vim | 3 + vim/autoload/taskpaper.vim | 561 ++++++++++++++++++++ vim/colors/xterm16.vim | 811 +++++++++++++++++++++++++++++ vim/doc/example.taskpaper | 10 + vim/doc/tags | 9 + vim/doc/taskpaper.txt | 310 +++++++++++ vim/doc/taskpaper_hacking.txt | 8 + vim/doc/taskpaper_licence.txt | 339 ++++++++++++ vim/ftdetect/pug.vim | 5 + vim/ftdetect/taskpaper.vim | 9 + vim/ftdetect/tex.vim | 2 + vim/ftplugin/jade.vim | 57 ++ vim/ftplugin/pug.vim | 57 ++ vim/ftplugin/taskpaper.vim | 117 +++++ vim/indent/jade.vim | 70 +++ vim/indent/pug.vim | 70 +++ vim/rename_this_to_plugin/ctab.vim | 349 +++++++++++++ vim/spell/en.utf-8.add | 117 +++++ vim/spell/en.utf-8.add.spl | Bin 0 -> 1568 bytes vim/syntax/jade.vim | 104 ++++ vim/syntax/pug.vim | 110 ++++ vim/syntax/taskpaper.vim | 48 ++ vimrc | 95 ++++ 24 files changed, 3272 insertions(+) create mode 100644 vim/.netrwhist create mode 100644 vim/after/syntax/blah.vim create mode 100644 vim/autoload/taskpaper.vim create mode 100644 vim/colors/xterm16.vim create mode 100644 vim/doc/example.taskpaper create mode 100644 vim/doc/tags create mode 100644 vim/doc/taskpaper.txt create mode 100644 vim/doc/taskpaper_hacking.txt create mode 100644 vim/doc/taskpaper_licence.txt create mode 100644 vim/ftdetect/pug.vim create mode 100644 vim/ftdetect/taskpaper.vim create mode 100644 vim/ftdetect/tex.vim create mode 100644 vim/ftplugin/jade.vim create mode 100644 vim/ftplugin/pug.vim create mode 100644 vim/ftplugin/taskpaper.vim create mode 100644 vim/indent/jade.vim create mode 100644 vim/indent/pug.vim create mode 100644 vim/rename_this_to_plugin/ctab.vim create mode 100644 vim/spell/en.utf-8.add create mode 100644 vim/spell/en.utf-8.add.spl create mode 100644 vim/syntax/jade.vim create mode 100644 vim/syntax/pug.vim create mode 100644 vim/syntax/taskpaper.vim create mode 100644 vimrc diff --git a/vim/.netrwhist b/vim/.netrwhist new file mode 100644 index 0000000..8582669 --- /dev/null +++ b/vim/.netrwhist @@ -0,0 +1,11 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhist_cnt =9 +let g:netrw_dirhist_1='/home/djsissom/Projects/Web/openquestion.io/src/blog' +let g:netrw_dirhist_2='/home/djsissom/Projects/Web/openquestion.io/.git' +let g:netrw_dirhist_3='/home/djsissom/Projects/Web/openquestion.io/.gitignores' +let g:netrw_dirhist_4='/home/djsissom/Projects/Web/openquestion.io/src/blog' +let g:netrw_dirhist_5='/home/djsissom/Projects/GitHub/Paper/style' +let g:netrw_dirhist_6='/home/djsissom/Projects/GitHub/MLPredict/analysis' +let g:netrw_dirhist_7='/home/djsissom/Projects/Programs/Analysis/Mesh' +let g:netrw_dirhist_8='/home/djsissom/Projects/Programs/Analysis/Astro/ttow' +let g:netrw_dirhist_9='/home/djsissom/.vim' diff --git a/vim/after/syntax/blah.vim b/vim/after/syntax/blah.vim new file mode 100644 index 0000000..a1b230d --- /dev/null +++ b/vim/after/syntax/blah.vim @@ -0,0 +1,3 @@ +syntax spell toplevel +syn sync maxlines=2000 +syn sync minlines=500 diff --git a/vim/autoload/taskpaper.vim b/vim/autoload/taskpaper.vim new file mode 100644 index 0000000..d9b7a93 --- /dev/null +++ b/vim/autoload/taskpaper.vim @@ -0,0 +1,561 @@ +" plugin to handle the TaskPaper to-do list format +" Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper) +" Maintainer: David O'Callaghan +" URL: https://github.com/davidoc/taskpaper.vim +" Last Change: 2012-03-07 + +let s:save_cpo = &cpo +set cpo&vim + +function! s:add_delete_tag(tag, value, add) + let cur_line = getline(".") + + let tag = " @" . a:tag + if a:value != '' + let tag .= "(" . a:value . ")" + endif + + " Add tag + if a:add + let new_line = cur_line . tag + call setline(".", new_line) + return 1 + endif + + " Delete tag + if cur_line =~# '\V' . tag + if a:value != '' + let new_line = substitute(cur_line, '\V' . tag, "", "g") + else + let new_line = substitute(cur_line, '\V' . tag . '\v(\([^)]*\))?', + \ "", "g") + endif + + call setline(".", new_line) + return 1 + endif + return 0 +endfunction + +function! taskpaper#add_tag(tag, ...) + let value = a:0 > 0 ? a:1 : input('Value: ') + return s:add_delete_tag(a:tag, value, 1) +endfunction + +function! taskpaper#delete_tag(tag, ...) + let value = a:0 > 0 ? a:1 : '' + return s:add_delete_tag(a:tag, value, 0) +endfunction + +function! taskpaper#swap_tag(oldtag, newtag) + call taskpaper#delete_tag(a:oldtag) + call taskpaper#add_tag(a:newtag, '') +endfunction + +function! taskpaper#swap_tags(oldtags, newtags) + for oldtag in a:oldtags + call taskpaper#delete_tag(oldtag) + endfor + for newtag in a:newtags + call taskpaper#add_tag(newtag, '') + endfor +endfunction + +function! taskpaper#toggle_tag(tag, ...) + if !taskpaper#delete_tag(a:tag, '') + let args = a:0 > 0 ? [a:tag, a:1] : [a:tag] + call call("taskpaper#add_tag", args) + endif +endfunction + +function! taskpaper#has_tag(tag) + let cur_line = getline(".") + let m = matchstr(cur_line, '@'.a:tag) + if m != '' + return 1 + else + return 0 +endfunction + +function! taskpaper#cycle_tags(...) + let tags_index = 0 + let tag_list = a:000 + let tag_added = 0 + for tag_name in tag_list + let tags_index = tags_index + 1 + if tags_index == len(tag_list) + let tags_index = 0 + endif + let has_tag = taskpaper#has_tag(tag_name) + if has_tag == 1 + let tag_added = 1 + call taskpaper#delete_tag(tag_name) + let new_tag = tag_list[tags_index] + if new_tag != '' + call taskpaper#add_tag(new_tag, '') + endif + break + endif + endfor + if tag_added == 0 + call taskpaper#add_tag(tag_list[0], '') + endif +endfunction + +function! taskpaper#update_tag(tag, ...) + call taskpaper#delete_tag(a:tag, '') + let args = a:0 > 0 ? [a:tag, a:1] : [a:tag] + call call("taskpaper#add_tag", args) +endfunction + +function! taskpaper#date() + return strftime(g:task_paper_date_format, localtime()) +endfunction + +function! taskpaper#complete_project(lead, cmdline, pos) + let lnum = 1 + let list = [] + let stack = [''] + let depth = 0 + + while lnum <= line('$') + let line = getline(lnum) + let ml = matchlist(line, '\v\C^\t*(.+):(\s+\@[^ \t(]+(\([^)]*\))?)*$') + + if !empty(ml) + let d = len(matchstr(line, '^\t*')) + + while d < depth + call remove(stack, -1) + let depth -= 1 + endwhile + + while d > depth + call add(stack, '') + let depth += 1 + endwhile + + let stack[d] = ml[1] + + let candidate = join(stack, ':') + if candidate =~ '^' . a:lead + call add(list, join(stack, ':')) + endif + endif + + let lnum += 1 + endwhile + + return list +endfunction + +function! taskpaper#go_to_project() + let res = input('Project: ', '', 'customlist,taskpaper#complete_project') + + if res != '' + call taskpaper#search_project(split(res, ':')) + endif +endfunction + +function! taskpaper#next_project() + return search('^\t*\zs.\+:\(\s\+@[^\s(]\+\(([^)]*)\)\?\)*$', 'w') +endfunction + +function! taskpaper#previous_project() + return search('^\t*\zs.\+:\(\s\+@[^\s(]\+\(([^)]*)\)\?\)*$', 'bw') +endfunction + +function! s:search_project(project, depth, begin, end) + call cursor(a:begin, 1) + return search('\v^\t{' . a:depth . '}\V' . a:project . ':', 'c', a:end) +endfunction + +function! taskpaper#search_project(projects) + if empty(a:projects) + return 0 + endif + + let save_pos = getpos('.') + + let begin = 1 + let end = line('$') + let depth = 0 + + for project in a:projects + if !s:search_project(project, depth, begin, end) + call setpos('.', save_pos) + return 0 + endif + + let begin = line('.') + let end = taskpaper#search_end_of_item(begin) + let depth += 1 + endfor + + call cursor(begin, 1) + normal! ^ + + return begin +endfunction + +function! taskpaper#search_end_of_item(...) + let lnum = a:0 > 0 ? a:1 : line('.') + let flags = a:0 > 1 ? a:2 : '' + + let depth = len(matchstr(getline(lnum), '^\t*')) + + let end = lnum + let lnum += 1 + while lnum <= line('$') + let line = getline(lnum) + + if line =~ '^\s*$' + " Do nothing + elseif depth < len(matchstr(line, '^\t*')) + let end = lnum + else + break + endif + + let lnum += 1 + endwhile + + if flags !~# 'n' + call cursor(end, 0) + normal! ^ + endif + + return end +endfunction + +function! taskpaper#delete(...) + let start = a:0 > 0 ? a:1 : line('.') + let reg = a:0 > 1 ? a:2 : '"' + let kill_indent = a:0 > 2 ? a:3 : 0 + + let reg_save = '' + if kill_indent && reg =~# '\u' + let reg = tolower(reg) + let reg_save = getreg(reg) + endif + + let save_fen = &l:foldenable + setlocal nofoldenable + + let depth = len(matchstr(getline(start), '^\t*')) + + let end = taskpaper#search_end_of_item(start) + silent execute start . ',' . end . 'delete ' . reg + + let &l:foldenable = save_fen + + if kill_indent + let pat = '\(^\|\n\)\t\{' . depth . '\}' + let content = substitute(getreg(reg), pat, '\1', 'g') + if reg_save != '' + let content = reg_save . content + endif + call setreg(reg, content) + endif + + return end - start + 1 +endfunction + +function! taskpaper#put(...) + let projects = a:0 > 0 ? a:1 : [] + let reg = a:0 > 1 ? a:2 : '"' + let indent = a:0 > 2 ? a:3 : 0 + + let save_fen = &l:foldenable + setlocal nofoldenable + + if !empty(projects) && !taskpaper#search_project(projects) + let &l:foldenable = save_fen + return 0 + endif + + if indent > 0 + let project_depth = len(matchstr(getline('.'), '^\t*')) + let tabs = repeat("\t", project_depth + indent) + else + let tabs = '' + endif + + execute 'put' reg + silent execute "'[,']" . 's/^\ze./' . tabs + + let &l:foldenable = save_fen + + return line("']") - line("'[") + 1 +endfunction + +function! taskpaper#move(projects, ...) + let lnum = a:0 > 0 ? a:1 : line('.') + + let save_fen = &l:foldenable + setlocal nofoldenable + + if !taskpaper#search_project(a:projects) + let &l:foldenable = save_fen + return 0 + endif + + let reg = 'a' + let save_reg = [getreg(reg), getregtype(reg)] + + let nlines = taskpaper#delete(lnum, reg, 1) + call taskpaper#put(a:projects, reg, 1) + + let &l:foldenable = save_fen + call setreg(reg, save_reg[0], save_reg[1]) + if g:task_paper_follow_move == 0 + execute lnum + endif + return nlines +endfunction + +function! taskpaper#move_to_project() + let res = input('Project: ', '', 'customlist,taskpaper#complete_project') + call taskpaper#move(split(res, ':')) +endfunction + +function! taskpaper#update_project() + let indent = matchstr(getline("."), '^\t*') + let depth = len(indent) + + let projects = [] + + for linenr in range(line('.'), 1, -1) + let line = getline(linenr) + let ml = matchlist(line, '\v^\t{0,' . depth . '}([^\t:]+):') + if empty(ml) + continue + endif + + let project = ml[1] + if project != "" + call add(projects, project) + + let indent = matchstr(line, '^\t*') + let depth = len(indent) - 1 + + if depth < 0 + break + endif + endif + endfor + + call taskpaper#update_tag('project', join(reverse(projects), ' / ')) +endfunction + +function! taskpaper#archive_done() + let archive_start = search('^' . g:task_paper_archive_project . ':', 'cw') + if archive_start == 0 + call append('$', g:task_paper_archive_project . ':') + let archive_start = line('$') + let archive_end = 0 + else + let archive_end = search('^\S\+:', 'W') + endif + + let save_fen = &l:foldenable + let save_reg = [getreg('a'), getregtype('a')] + setlocal nofoldenable + call setreg('a', '') + + call cursor(1, 1) + let deleted = 0 + + while 1 + let lnum = search('@done', 'W', archive_start - deleted) + if lnum == 0 + break + endif + + call taskpaper#update_project() + let deleted += taskpaper#delete(lnum, 'A', 1) + endwhile + + if archive_end != 0 + call cursor(archive_end, 1) + + while 1 + let lnum = search('@done', 'W') + if lnum == 0 + break + endif + + call taskpaper#update_project() + let deleted += taskpaper#delete(lnum, 'A', 1) + endwhile + endif + + if deleted != 0 + call taskpaper#put([g:task_paper_archive_project], 'a', 1) + else + echo 'No done items.' + endif + + let &l:foldenable = save_fen + call setreg('a', save_reg[0], save_reg[1]) + + return deleted +endfunction + +function! taskpaper#fold(lnum, pat, ipat) + let line = getline(a:lnum) + let level = foldlevel(a:lnum) + + if line =~? a:pat && (a:ipat == '' || line !~? a:ipat) + return 0 + elseif synIDattr(synID(a:lnum, 1, 1), "name") != 'taskpaperProject' + return 1 + elseif level != -1 + return level + endif + + let depth = len(matchstr(getline(a:lnum), '^\t*')) + + for lnum in range(a:lnum + 1, line('$')) + let line = getline(lnum) + + if depth >= len(matchstr(line, '^\t*')) + break + endif + + if line =~? a:pat && (a:ipat == '' || line !~? a:ipat) + return 0 + endif + endfor + return 1 +endfunction + +function! taskpaper#search(...) + let pat = a:0 > 0 ? a:1 : input('Search: ') + let ipat = a:0 > 1 ? a:2 : '' + if pat == '' + return + endif + + setlocal foldexpr=taskpaper#fold(v:lnum,pat,ipat) + setlocal foldminlines=0 foldtext='' + setlocal foldmethod=expr foldlevel=0 foldenable +endfunction + +function! taskpaper#fold_except_range(lnum, begin, end) + if a:lnum > a:end + return 1 + elseif a:lnum >= a:begin + return 0 + elseif synIDattr(synID(a:lnum, 1, 1), "name") != 'taskpaperProject' + return 1 + elseif level != -1 + return level + endif + + if a:end <= taskpaper#search_end_of_item(a:lnum, 'n') + return 0 + endif + + return 1 +endfunction + +function! taskpaper#focus_project() + let pos = getpos('.') + + normal! $ + let begin = taskpaper#previous_project() + if begin == 0 + call setpos('.', pos) + return + endif + + let end = taskpaper#search_end_of_item(begin, 'n') + + " Go to the top level project + while taskpaper#previous_project() + if getline('.') =~ '^[^\t]' + break + endif + endwhile + + setlocal foldexpr=taskpaper#fold_except_range(v:lnum,begin,end) + setlocal foldminlines=0 foldtext='' + setlocal foldmethod=expr foldlevel=0 foldenable +endfunction + +function! taskpaper#search_tag(...) + if a:0 > 0 + let tag = a:1 + else + let cword = expand('') + let tag = input('Tag: ', cword =~ '@\k\+' ? cword[1:] : '') + endif + + if tag != '' + let ipat = (g:task_paper_search_hide_done == 1)?'\<@done\>':'' + call taskpaper#search('\<@' . tag . '\>', ipat) + endif +endfunction + +function! taskpaper#_fold_projects(lnum) + if synIDattr(synID(a:lnum, 1, 1), "name") != 'taskpaperProject' + return '=' + endif + + let line = getline(a:lnum) + let depth = len(matchstr(line, '^\t*')) + return '>' . (depth + 1) +endfunction + +function! taskpaper#fold_projects() + setlocal foldexpr=taskpaper#_fold_projects(v:lnum) + setlocal foldminlines=0 foldtext=foldtext() + setlocal foldmethod=expr foldlevel=0 foldenable +endfunction + +function! taskpaper#newline() + let lnum = line('.') + let line = getline('.') + + if lnum == 1 || line !~ '^\s*$' || + \ synIDattr(synID(lnum - 1, 1, 1), "name") != 'taskpaperProject' + return '' + endif + + let pline = getline(lnum - 1) + let depth = len(matchstr(pline, '^\t*')) + call setline(lnum, repeat("\t", depth + 1) . '- ') + + return "\" +endfunction + + +function! taskpaper#tag_style(...) + if a:0 > 0 + let tag_name = a:1 + endif + + if a:0 > 1 + let tag_style = a:2 + let tag_style_name = 'taskpaperAutoStyle_' . tag_name + execute 'syn match' tag_style_name '/\s\zs@'.tag_name.'\(([^)]*)\)\?/' + execute 'hi' tag_style_name tag_style + if version < 508 + execute 'hi link' tag_style_name tag_style_name + else + execute 'hi def link' tag_style_name tag_style_name + endif + else + echo "No style specified." + return '' + endif +endfunction + +function! taskpaper#tag_style_dict(tsd) + for tag_name in keys(a:tsd) + call taskpaper#tag_style(tag_name,a:tsd[tag_name]) + endfor +endfunction + +let &cpo = s:save_cpo diff --git a/vim/colors/xterm16.vim b/vim/colors/xterm16.vim new file mode 100644 index 0000000..098e288 --- /dev/null +++ b/vim/colors/xterm16.vim @@ -0,0 +1,811 @@ +" xterm16-v2.43: Vim color scheme file +" Maintainer: Gautam Iyer +" Created: Thu 16 Oct 2003 06:17:47 PM CDT +" Modified: Tue 12 Sep 2006 11:19:35 AM PDT +" +" Adjustable color scheme for GUI/Terminal vim. + +let s:cpo_save = &cpo +set cpo&vim " line continuation is used + +hi clear + +if exists('syntax_on') + syntax reset +endif +let colors_name = 'xterm16' + +" {{{1 Local function definitions +" {{{2 tohex(n): Convert a number to a 2 digit hex +let s:hex = '0123456789abcdef' +function s:tohex( n) + return a:n > 255 ? 'ff' : s:hex[a:n / 16] . s:hex[a:n % 16] +endfunction + +" {{{2 extractRGB( string): Extract r,g,b components from string into s:c1,2,3 +function s:extractRGB( string) + if a:string =~ '^#[0-9a-f]\{6\}$' + " Colors in hex values + let s:c1 = '0x' . strpart(a:string, 1, 2) + let s:c2 = '0x' . strpart(a:string, 3, 2) + let s:c3 = '0x' . strpart(a:string, 5, 2) + + elseif a:string =~ '^\d\{3\}$' + " Colors in cterm values + let s:c1 = s:guilevel( a:string[0]) + let s:c2 = s:guilevel( a:string[1]) + let s:c3 = s:guilevel( a:string[2]) + + elseif a:string =~ '^[lmh][0-9]\{6\}' + " Colors in propotions of low / med / high + if exists('s:'.a:string[0]) + let l:level = s:{a:string[0]} + let s:c1 = l:level * strpart(a:string, 1, 2) / 50 + let s:c2 = l:level * strpart(a:string, 3, 2) / 50 + let s:c3 = l:level * strpart(a:string, 5, 2) / 50 + else + throw 'xterm16 Error: Use of propotional intensities before absolute intensities' + endif + else + throw 'xterm16 Error: Brightness / color "'. a:string . '" badly formed.' + endif +endfunction + +" {{{2 guilevel(n) : Get the gui intensity of a given cterm intensity +function s:guilevel( n) + return '0x'.s:ccube[2*a:n].s:ccube[2*a:n + 1] +endfunction + +" {{{2 ctermlevel(n) : Get the cterm intensity of a given gui intensity +function s:ctermlevel( n) + " Xterm color cube intensities: 00, 5f, 87, af, d7, ff + " Rxvt color cube: 00, 2a, 55, 7f, aa, d4 + + " cinterval should have the terminal intervals. + let l:terml = 0 + while l:terml < 5 + if a:n < '0x'.s:cinterval[2 * l:terml].s:cinterval[2 * l:terml + 1] + return l:terml + endif + + let l:terml = l:terml + 1 + endwhile + return 5 +endfunction + +" {{{2 guicolor( r, g, b): Return the gui color with intensities r,g,b +function s:guicolor( r, g, b) + return '#' . s:tohex(a:r) . s:tohex(a:g) . s:tohex(a:b) +endfunction + +" {{{2 ctermcolor( r, g, b): Return the xterm-256 color with intensities r, g, b +function s:ctermcolor( r, g, b) + if a:r == a:g && a:r == a:b + " Use the greyscale ramp. The greyscale ramp starts from color 232 + " with grey 8, and procedes in increments of 10 upto grey 238 (0xee) + if a:r <= 4 + return 16 + elseif a:r <= 243 + return (a:r - 4) / 10 + 232 + else + " Let's check if the last color in ccube is large enough. + " return (s:termtype == 'xterm' && a:r > 247) ? 231 : 255 + let l:l5 = s:guilevel(5) + return ( l:l5 > 0xee && a:r > (l:l5 + 0xee)/2 ) ? 231 : 255 + endif + else + " Use the rgb cube. + return s:ctermlevel(a:r) * 36 + s:ctermlevel(a:g) * 6 + s:ctermlevel(a:b) + 16 + endif +endfunction + +" {{{2 setcolor( name, r, g, b): Set the script variables gui_name and cterm_name +function s:setcolor( name, r, g, b) + if exists('g:xterm16_'.a:name) + " Use user-defined color settings (from global variable) + call s:extractRGB( g:xterm16_{a:name}) + + let s:gui_{a:name} = s:guicolor( s:c1, s:c2, s:c3) + let s:cterm_{a:name} = s:ctermcolor( s:c1, s:c2, s:c3) + else + " Set the GUI / cterm color from r,g,b + let s:gui_{a:name} = s:guicolor( a:r, a:g, a:b) + let s:cterm_{a:name} = ( &t_Co == 256 || has('gui_running') ) + \ ? s:ctermcolor( a:r, a:g, a:b) : a:name + endif + + " Add the color to palette + let g:xterm16_palette = g:xterm16_palette . "\n" . s:gui_{a:name} . ', cterm ' . s:cterm_{a:name} . ' : ' . a:name +endfunction + +" {{{2 getcolor( group, globalvar, colorname): if globvar exists, returns that +" color. if not returns the color in cname +function s:getcolor( globvar, cname) + " hopefully someone set ctype before getting here. ctype should either be + " "gui" or "cterm" + + if exists( a:globvar) + if exists( 's:'.s:ctype.'_'.{a:globvar}) + return s:{s:ctype}_{{a:globvar}} + else + call s:extractRGB( {a:globvar}) + return s:{s:ctype}color( s:c1, s:c2, s:c3) + endif + else + return s:{s:ctype}_{a:cname} + endif +endfunction + +" {{{2 use_guiattr( nattrs, n ): Should s:hi use the n'th attr for GUI hl. +function s:use_guiattr( nattrs, n ) + " If guisp is specified in vim6, then don't use any GUI attributes. + " Otherwise use GUI attributes if GUI is running and they are specified. + if !has('gui_running') || + \ a:nattrs < a:n || + \ ( v:version < 700 && a:nattrs >= 4 ) + " Don't use GUI attributes + return 0 + else + " Use GUI attributes + return 1 + endif +endfunction + +" {{{2 hi( group, attr, fg, bg): Set the gui/cterm highlighting groups +" +" group - groupname. +" attr - attributes. +" fg/bg color name. +" +" Optionally can call it as +" +" hi( group, attr, fg, bg, guiattr, guifg, guibg, guisp ) +" +" where all the gui options are optional. If provided, they override the term +" colors. +function s:hi( group, attr, fg, bg, ...) + if has('gui_running') || &t_Co == 256 + " For gui's and 256 color terminals + let l:fg = s:getcolor( 'g:xterm16fg_'.a:group, + \ s:use_guiattr( a:0, 2) ? a:2 : a:fg) + let l:bg = s:getcolor( 'g:xterm16bg_'.a:group, + \ s:use_guiattr( a:0, 3) ? a:3 : a:bg) + + if exists('g:xterm16attr_' . a:group) + let l:attr = g:xterm16attr_{a:group} + else + let l:attr = s:use_guiattr( a:0, 1) ? a:1 : a:attr + endif + + exec 'hi' a:group + \ s:ctype.'='.l:attr + \ s:ctype.'fg='.l:fg + \ s:ctype.'bg='.l:bg + + " Define guisp if specified for the gui (Vim7 upwards only). + if v:version >= 700 && has('gui_running') && a:0 >= 4 + let l:sp = s:getcolor( 'g:xterm16sp_'.a:group, a:4 ) + exec 'hi' a:group s:ctype.'sp='.l:sp + endif + else + " for consoles / 16 color junkies + exec 'hi' a:group 'cterm='.a:attr 'ctermfg='.a:fg 'ctermbg='.a:bg + endif +endfunction + +" {{{2 set_brightness( default): Set s:brightness based on default +function s:set_brightness( default) + let s:brightness = ( exists('g:xterm16_brightness') + \ && g:xterm16_brightness != 'default') ? + \ g:xterm16_brightness : a:default + if s:colormap == 'allblue' + if s:brightness == 'high' + let s:brightness = '#afafff' " 335 + elseif s:brightness == 'med' + let s:brightness = '#8787d7' " 224 + elseif s:brightness == 'low' + let s:brightness = '#5f5faf' " 113 + endif + elseif s:colormap == 'softlight' + if s:brightness == 'high' + let s:brightness = '#ff87af' " 523 + elseif s:brightness == 'med' + let s:brightness = '#d75f87' " 412 + elseif s:brightness == 'low' + let s:brightness = '#af5f87' " 312 + endif + else + if s:brightness == 'high' + let s:brightness = '#afd7ff' " 345 + elseif s:brightness == 'med' + let s:brightness = '#87afd7' " 234 + elseif s:brightness == 'low' + let s:brightness = '#5f87af' " 123 + endif + endif +endfunction + +" {{{1 Global functions and initialisations. +command! -nargs=* Brightness + \ if Brightness() + \ colo xterm16 + \ endif + +" {{{2 Brightness( brightness, colormap) +function! Brightness(...) + if a:0 == 0 + echo "Brightness: ".s:brightness.", Colormap: ".s:colormap + return 0 + elseif a:0 > 2 + echoerr 'Too many arguements.' + return 0 + endif + + let g:xterm16_brightness = a:1 + if a:0 == 2 + let g:xterm16_colormap = a:2 + endif + + return 1 +endfunction +" }}}1 + +try + " {{{1 Setup defaults + " {{{2 set ctype (to cterm / gui) to be the color type + let s:ctype = has('gui_running') ? 'gui' : 'cterm' + " {{{2 Obtain intensity levels of the 6 terminal colors in s:ccube + " The 2ith and 2i+1th charecters in ccube are the hex digits of the + " intensity of the ith (0-5) term level. xterm and rxvt set up the default + " color cube differently, so we have to consider them separately. + + " First check for a user specified color cube. + if exists('g:xterm16_ccube') + let s:ccube = g:xterm16_ccube + + " No user specified color cube given. Try and guess from xterm16_termtype + elseif ( exists('g:xterm16_termtype') && g:xterm16_termtype == 'rxvt') || + \ ( !exists('g:xterm16_termtype') + \ && &term =~ '^rxvt' + \ && $MRXVT_TABTITLE == "" ) + " color cube for "rxvt". Make sure we're not running mrxvt (by + " checking that the MRXVT_TABTITLE variable is empty). + let s:ccube = "002a557faad4" + else + " default to xterm if nothing else is specified. + let s:ccube ="005f87afd7ff" + endif + + " s:cinterval will be the intervals of intensities which get mapped to + " term color i. i.e. colors between 0 -- cinterval(0) have level 0. + " between cinterval(0) -- cinterval(1) have level 1, etc. max level is 5, + " so anything higher than cinterval(4) has level 5. + let s:cinterval = "" + let s:lower = "00" + let s:i = 1 + while s:i < 6 + let s:upper = s:ccube[2*s:i] . s:ccube[2*s:i + 1] + let s:cinterval = s:cinterval . s:tohex( (('0x'.s:lower) + ('0x'.s:upper))/2 ) + let s:lower = s:upper + let s:i = s:i + 1 + endwhile + + " {{{2 Get colormap defaults in "s:colormap" + " On a terminal (without 256 colors), use "standard" colormap. Otherwise + " use value from "g:xterm16_colormap" if exists, or "soft" as default. + if !has('gui_running') && &t_Co != 256 + let s:colormap = 'standard' + elseif exists('g:xterm16_colormap') + let s:colormap = g:xterm16_colormap + else + " "soft" used to be the default, but "allblue" is much better. + let s:colormap = 'allblue' + endif + + " {{{2 Redefine a few colors for CRT monitors and set brightness + if s:colormap == 'allblue' + call s:set_brightness( '#8787d7' ) " 224 + elseif s:colormap == 'softlight' + call s:set_brightness( '#d75f87' ) " 412 + elseif exists('g:xterm16_CRTColors') + " "standard" or "soft" colormaps + if s:colormap == 'standard' + let g:xterm16_darkblue = 'h000050' + let g:xterm16_blue = 'h002550' + let g:xterm16_grey = 'm474747' + + unlet! g:xterm16_skyblue g:xterm16_green g:xterm16_bluegreen + + " give the original xterm16 feel + call s:set_brightness( '#80cdff') + else + " "soft" colormap + let g:xterm16_skyblue = 'h003850' + let g:xterm16_green = 'm315000' + let g:xterm16_bluegreen = 'm005031' + + unlet! g:xterm16_darkblue g:xterm16_blue g:xterm16_grey + + " call s:set_brightness ( '245') + " call s:set_brightness('high') + call s:set_brightness('#87d7ff') " 245 + endif + else + " "standard" or "soft" colormaps with LCD colors + call s:set_brightness( '#5fafd7') " 134 + endif + + unlet! s:c1 s:c2 s:c3 + call s:extractRGB(s:brightness) + let s:l = s:c1 + let s:m = s:c2 + let s:h = s:c3 + + " {{{2 Set a bright green cursor on all colormaps except softlight + if !exists('g:xterm16bg_Cursor') + if s:colormap == 'softlight' + let g:xterm16fg_Cursor = '#ffffff' + else + let g:xterm16bg_Cursor = '#00ff00' + endif + endif + + " {{{2 Set the current pallete: + let g:xterm16_palette = 'Current palette (Brightness: '.s:brightness. ', Colormap: '.s:colormap.')' + + " {{{1 Define colors and highlighting groups based on "s:colormap" + let s:cterm_none = 'NONE' + let s:gui_none = 'NONE' + + " Set the background based on the colormap. 'softlight' is the only + " colormap with a light background + if s:colormap == 'softlight' + set bg=light + else + set bg=dark + endif + + if s:colormap == 'standard' + " {{{2 Original colormap. 8 standard colors, and 8 brighter ones. + call s:setcolor( 'black', 0 , 0 , 0 ) + call s:setcolor( 'darkred', s:m , 0 , 0 ) + call s:setcolor( 'darkgreen', 0 , s:m , 0 ) + call s:setcolor( 'darkyellow', s:m , s:m , 0 ) + call s:setcolor( 'darkblue', 0 , 0 , s:m ) + call s:setcolor( 'darkmagenta', s:m , 0 , s:m ) + call s:setcolor( 'darkcyan', 0 , s:m , s:m ) + call s:setcolor( 'grey', s:m*44/50, s:m*44/50, s:m*44/50) + + call s:setcolor( 'darkgrey', s:l , s:l , s:l ) + call s:setcolor( 'red', s:h , 0 , 0 ) + call s:setcolor( 'green', 0 , s:h , 0 ) + call s:setcolor( 'yellow', s:h , s:h , 0 ) + call s:setcolor( 'blue', 0 , 0 , s:h ) + call s:setcolor( 'magenta', s:h , 0 , s:h ) + call s:setcolor( 'cyan', 0 , s:h , s:h ) + call s:setcolor( 'white', s:h , s:h , s:h ) + + " {{{2 Highlighting groups for standard colors + call s:hi( 'Normal' , 'none' , 'grey' , 'black' ) + + call s:hi( 'Cursor' , 'none' , 'black' , 'green' ) + call s:hi( 'CursorColumn', 'none' , 'none' , 'darkgrey' ) + call s:hi( 'CursorLine' , 'none' , 'none' , 'darkgrey' ) + call s:hi( 'DiffAdd' , 'none' , 'darkblue' , 'darkgreen' ) + call s:hi( 'DiffChange' , 'none' , 'black' , 'darkyellow') + call s:hi( 'DiffDelete' , 'none' , 'darkblue' , 'none' ) + call s:hi( 'DiffText' , 'none' , 'darkred' , 'darkyellow') + call s:hi( 'Directory' , 'none' , 'cyan' , 'none' ) + call s:hi( 'ErrorMsg' , 'none' , 'white' , 'darkred' ) + call s:hi( 'FoldColumn' , 'none' , 'yellow' , 'darkblue' ) + call s:hi( 'Folded' , 'none' , 'yellow' , 'darkblue' ) + call s:hi( 'IncSearch' , 'none' , 'grey' , 'darkblue' ) + call s:hi( 'LineNr' , 'none' , 'yellow' , 'none' ) + call s:hi( 'MatchParen' , 'bold' , 'none' , 'none' ) + call s:hi( 'MoreMsg' , 'bold' , 'green' , 'none' ) + call s:hi( 'NonText' , 'none' , 'blue' , 'none' ) + call s:hi( 'Pmenu' , 'none' , 'black' , 'grey' ) + call s:hi( 'PmenuSel' , 'none' , 'none' , 'darkblue' ) + call s:hi( 'PmenuSbar' , 'none' , 'none' , 'darkgrey' ) + call s:hi( 'PmenuThumb' , 'none' , 'none' , 'white' ) + call s:hi( 'Question' , 'none' , 'green' , 'none' ) + call s:hi( 'Search' , 'none' , 'black' , 'darkcyan' ) + call s:hi( 'SignColumn' , 'none' , 'darkmagenta', 'darkgrey' ) + call s:hi( 'SpecialKey' , 'none' , 'blue' , 'none' ) + call s:hi( 'StatusLine' , 'none' , 'darkblue' , 'grey' ) + call s:hi( 'StatusLineNC', 'reverse', 'none' , 'none' ) + call s:hi( 'TabLineFill' , 'none' , 'black' , 'darkgrey' ) + call s:hi( 'TabLine' , 'none' , 'black' , 'darkgrey' ) + call s:hi( 'TabLineSel' , 'bold' , 'none' , 'none' ) + call s:hi( 'Title' , 'none' , 'magenta' , 'none' ) + call s:hi( 'Visual' , 'none' , 'none' , 'darkblue' ) + call s:hi( 'VisualNOS' , 'none' , 'none' , 'darkgrey' ) + call s:hi( 'WarningMsg' , 'bold' , 'red' , 'none' ) + call s:hi( 'WildMenu' , 'none' , 'darkmagenta', 'darkyellow') + + call s:hi( 'Comment' , 'none' , 'darkred' , 'none' ) + call s:hi( 'Constant' , 'none' , 'darkyellow' , 'none' ) + call s:hi( 'Error' , 'none' , 'white' , 'red' ) + call s:hi( 'Identifier' , 'none' , 'darkcyan' , 'none' ) + call s:hi( 'Ignore' , 'none' , 'darkgrey' , 'none' ) + call s:hi( 'PreProc' , 'none' , 'blue' , 'none' ) + call s:hi( 'Special' , 'none' , 'darkgreen' , 'none' ) + call s:hi( 'Statement' , 'none' , 'cyan' , 'none' ) + call s:hi( 'Todo' , 'none' , 'black' , 'yellow' ) + call s:hi( 'Type' , 'none' , 'green' , 'none' ) + call s:hi( 'Underlined' , 'none' , 'darkmagenta', 'none' ) + + " {{{2 Spelling highlighting groups. + call s:hi( 'SpellBad' , 'bold,underline', 'none', 'none' , + \ 'undercurl' , 'none', 'none' , + \ 'darkred' ) + call s:hi( 'SpellCap' , 'bold' , 'none', 'none' , + \ 'undercurl' , 'none', 'none' , + \ 'blue' ) + call s:hi( 'SpellLocal', 'underline' , 'none', 'none' , + \ 'undercurl' , 'none', 'none' , + \ 'cyan' ) + call s:hi( 'SpellRare' ,'underline' , 'none', 'none' , + \ 'undercurl' , 'none', 'none' , + \ 'darkyellow' ) + + " {{{2 Define html highlighting groups for standard colors. + if !exists("g:xterm16_NoHtmlColors") + call s:hi( 'htmlBold', 'none', 'white', 'none', 'bold', 'none') + call s:hi( 'htmlItalic', 'none', 'yellow', 'none', 'italic', 'none') + call s:hi( 'htmlUnderline', 'none', 'darkmagenta', 'none', 'underline', 'none') + call s:hi( 'htmlBoldItalic', 'bold', 'yellow', 'none', 'bold,italic', 'none') + call s:hi( 'htmlBoldUnderline', 'bold', 'magenta', 'none', 'bold,underline', 'none') + call s:hi( 'htmlUnderlineItalic', 'none', 'magenta', 'none', 'underline,italic', 'none') + call s:hi( 'htmlBoldUnderlineItalic', 'bold', 'white', 'none', 'bold,underline,italic', 'none') + + hi! link htmlLink PreProc + endif + " {{{2 Remap darkblue on linux consoles + if !exists("g:xterm16_NoRemap") && &term =~# (exists("g:xterm16_TermRegexp") ? xterm16_TermRegexp : "linux") + hi! link PreProc Underlined + endif + " }}}2 + elseif s:colormap == 'soft' || s:colormap == 'softlight' + " {{{2 "soft" / "softlight" colormap. + " Mix and use similar intensity colors. Only drawback is a slightly + " gaudy appearance (which is why I switched to the "allblue" + " colormap). + " + " The "softlight" colormap is a colormap with a whiteish background + " for web hosting or when there's a strong glare ... + + " Background colors common to softlight / soft colormaps + call s:setcolor( 'black' , 0 , 0 , 0 ) + + " call s:setcolor( 'grey' , s:l/2 , s:l/2 , s:l/2 ) + " call s:setcolor( 'lightgrey' , 2*s:l/3 , 2*s:l/3 , 2*s:l/3 ) + + " Foreground colors common to softlight / soft colormaps + call s:setcolor( 'lightbrown' , s:h , s:h/2 , 0 ) + call s:setcolor( 'magenta' , s:h*3/4 , 0 , s:h ) + call s:setcolor( 'red' , s:h , 0 , 0 ) + call s:setcolor( 'yellow' , s:m , s:m , 0 ) + + if s:colormap == "soft" + " Background colors for colormap with a dark background + call s:setcolor( 'darkblue' , 0 , 0 , s:l ) + call s:setcolor( 'darkcyan' , 0 , s:l , s:l ) + call s:setcolor( 'darkred' , s:l , 0 , 0 ) + call s:setcolor( 'darkyellow', s:l , s:l , 0 ) + call s:setcolor( 'darkgrey' , s:l/3 , s:l/3 , s:l/3 ) + call s:setcolor( 'grey' , s:l/2 , s:l/2 , s:l/2 ) + call s:setcolor( 'lightgrey' , s:l , s:l , s:l ) + + " Foreground colors for colormap with a dark background + call s:setcolor( 'bluegreen' , 0 , s:m , s:m*38/50 ) + call s:setcolor( 'cyan' , 0 , s:m , s:m ) + call s:setcolor( 'green' , s:m*38/50 , s:m , 0 ) + call s:setcolor( 'purple' , s:h*27/50 , s:h*27/50 , s:h ) + call s:setcolor( 'skyblue' , 0 , s:h*27/50 , s:h ) + call s:setcolor( 'white' , s:m*44/50 , s:m*44/50 , s:m*44/50 ) + else + " Background colors for colormap with a light background + call s:setcolor( 'darkblue' , s:l*27/50 , s:l*27/50 , s:l ) + call s:setcolor( 'darkcyan' , s:l*27/50 , s:l*38/50 , s:l ) + call s:setcolor( 'darkred' , s:l , s:l*27/50 , s:l*27/50 ) + call s:setcolor( 'darkyellow', s:l , s:l , s:l*27/50 ) + call s:setcolor( 'darkgrey' , s:l*40/50 , s:l*40/50 , s:l*40/50 ) + call s:setcolor( 'grey' , s:l*35/50 , s:l*35/50 , s:l*35/50 ) + call s:setcolor( 'lightgrey' , s:l*30/50 , s:l*30/50 , s:l*30/50 ) + + call s:setcolor( 'white' , s:l*45/50 , s:l*45/50 , s:l*45/50 ) + + " Foreground colors for colormap with a light background + call s:setcolor( 'bluegreen' , 0 , s:h , 0 ) + call s:setcolor( 'cyan' , 0 , s:h*38/50 , s:h ) + call s:setcolor( 'green' , 0 , s:m , 0 ) + call s:setcolor( 'purple' , s:h*38/50 , 0 , s:h ) + call s:setcolor( 'skyblue' , 0 , 0 , s:h ) + endif + + " {{{2 Highlighting groups for "soft" / "softlight" colors. + if s:colormap == 'soft' + " Highlighting groups for dark background + call s:hi( 'Normal' , 'none', 'white' , 'black' ) + + call s:hi( 'Cursor' , 'none', 'black' , 'green' ) + call s:hi( 'DiffText' , 'none', 'darkred' , 'darkyellow') + call s:hi( 'Error' , 'none', 'white' , 'darkred' ) + call s:hi( 'ErrorMsg' , 'none', 'white' , 'darkred' ) + call s:hi( 'FoldColumn' , 'none', 'purple' , 'darkgrey' ) + call s:hi( 'Folded' , 'none', 'purple' , 'darkgrey' ) + call s:hi( 'IncSearch' , 'none', 'yellow' , 'darkblue' ) + call s:hi( 'StatusLine' , 'none', 'darkblue' , 'lightgrey' ) + call s:hi( 'VisualNOS' , 'none', 'black' , 'darkgrey' ) + else + " Highlighting groups for light background + call s:hi( 'Normal' , 'none', 'black' , 'white' ) + + call s:hi( 'Cursor' , 'none', 'white' , 'bluegreen' ) + call s:hi( 'DiffText' , 'none', 'red' , 'darkyellow') + call s:hi( 'Error' , 'none', 'black' , 'darkred' ) + call s:hi( 'ErrorMsg' , 'none', 'white' , 'red' ) + call s:hi( 'FoldColumn' , 'none', 'lightgrey', 'darkgrey' ) + call s:hi( 'Folded' , 'none', 'black' , 'darkgrey' ) + call s:hi( 'IncSearch' , 'none', 'black' , 'darkblue' ) + call s:hi( 'StatusLine' , 'none', 'skyblue' , 'lightgrey' ) + call s:hi( 'VisualNOS' , 'none', 'white' , 'darkgrey' ) + endif + + " Highlighting groups for light / dark background. + call s:hi( 'CursorColumn', 'none', 'none' , 'grey' ) + call s:hi( 'CursorLine' , 'none', 'none' , 'grey' ) + call s:hi( 'DiffAdd' , 'none', 'lightbrown', 'darkblue' ) + call s:hi( 'DiffChange' , 'none', 'black' , 'darkyellow') + call s:hi( 'DiffDelete' , 'none', 'purple' , 'darkblue' ) + call s:hi( 'Directory' , 'none', 'cyan' , 'none' ) + call s:hi( 'LineNr' , 'none', 'yellow' , 'none' ) + call s:hi( 'MatchParen' , 'bold', 'none' , 'none' ) + call s:hi( 'MoreMsg' , 'none', 'green' , 'none' ) + call s:hi( 'NonText' , 'none', 'yellow' , 'none' ) + call s:hi( 'Pmenu' , 'none', 'none' , 'grey' ) + call s:hi( 'PmenuSbar' , 'none', 'none' , 'darkgrey' ) + call s:hi( 'PmenuSel' , 'none', 'none' , 'darkblue' ) + call s:hi( 'PmenuThumb' , 'none', 'none' , 'lightgrey' ) + call s:hi( 'Question' , 'none', 'green' , 'none' ) + call s:hi( 'Search' , 'none', 'black' , 'darkcyan' ) + call s:hi( 'SignColumn' , 'none', 'yellow' , 'darkgrey' ) + call s:hi( 'SpecialKey' , 'none', 'yellow' , 'none' ) + call s:hi( 'StatusLineNC', 'none', 'black' , 'grey' ) + call s:hi( 'TabLineFill' , 'none', 'none' , 'grey' ) + call s:hi( 'TabLine' , 'none', 'none' , 'grey' ) + call s:hi( 'TabLineSel' , 'bold', 'none' , 'none' ) + call s:hi( 'Title' , 'none', 'yellow' , 'none' ) + call s:hi( 'VertSplit' , 'none', 'darkgrey' , 'darkgrey' ) + call s:hi( 'Visual' , 'none', 'none' , 'darkblue' ) + call s:hi( 'WarningMsg' , 'none', 'red' , 'none' ) + call s:hi( 'WildMenu' , 'none', 'yellow' , 'none' ) + + call s:hi( 'Comment' , 'none', 'red' , 'none' ) + call s:hi( 'Constant' , 'none', 'lightbrown', 'none' ) + call s:hi( 'Identifier' , 'none', 'cyan' , 'none' ) + call s:hi( 'Ignore' , 'none', 'darkgrey' , 'none' ) + call s:hi( 'PreProc' , 'none', 'purple' , 'none' ) + call s:hi( 'Special' , 'none', 'green' , 'none' ) + call s:hi( 'Statement' , 'none', 'skyblue' , 'none' ) + call s:hi( 'Todo' , 'none', 'black' , 'darkyellow') + call s:hi( 'Type' , 'none', 'bluegreen' , 'none' ) + call s:hi( 'Underlined' , 'none', 'magenta' , 'none' ) + + " {{{2 Spelling highlighting groups. + call s:hi( 'SpellBad' , 'bold,underline', 'none', 'darkgrey', + \ 'undercurl' , 'none', 'none' , + \ 'red' ) + call s:hi( 'SpellCap' , 'bold' , 'none', 'darkgrey', + \ 'undercurl' , 'none', 'none' , + \ 'skyblue' ) + call s:hi( 'SpellLocal', 'underline' , 'none', 'darkgrey', + \ 'undercurl' , 'none', 'none' , + \ 'cyan' ) + call s:hi( 'SpellRare' ,'underline' , 'none', 'none' , + \ 'undercurl' , 'none', 'none' , + \ 'yellow' ) + + " {{{2 Define html highlighting groups for soft colors. + if !exists("g:xterm16_NoHtmlColors") + call s:hi( 'htmlBold', 'none', 'yellow', 'none', + \ 'bold', 'none') + call s:hi( 'htmlItalic', 'none', 'yellow', 'none', + \ 'italic', 'none') + call s:hi( 'htmlUnderline', 'none', 'magenta', 'none', + \ 'underline', 'none') + call s:hi( 'htmlBoldItalic', 'bold', 'yellow', 'none', + \ 'bold,italic', 'none') + call s:hi( 'htmlBoldUnderline', 'bold', 'magenta', 'none', + \ 'bold,underline', 'none') + call s:hi( 'htmlUnderlineItalic', 'bold', 'magenta', 'none', + \ 'underline,italic', 'none') + call s:hi( 'htmlBoldUnderlineItalic', 'bold', 'white', 'none', + \ 'bold,underline,italic', 'none') + endif + " }}}2 + elseif s:colormap == 'allblue' + " {{{2 "allblue" colormap. All shades of blue. + " Background colors + call s:setcolor( 'black' , 0 , 0 , 0 ) + call s:setcolor( 'darkred' , s:l , 0 , 0 ) + call s:setcolor( 'darkcyan' , 0 , s:l , s:l ) + call s:setcolor( 'darkblue' , 0 , 0 , s:l ) + call s:setcolor( 'darkyellow' , s:l , s:l , 0 ) + + " cterm's can do grey's with better accuracy, so use many shades of + " grey for backgrounds instead of the gaudy yellow's etc. + call s:setcolor( 'grey1' , s:l/8 , s:l/8 , s:l/8 ) + call s:setcolor( 'grey2' , 2*s:l/8 , 2*s:l/8 , 2*s:l/8 ) + call s:setcolor( 'grey3' , 3*s:l/8 , 3*s:l/8 , 3*s:l/8 ) + call s:setcolor( 'grey4' , 4*s:l/8 , 4*s:l/8 , 4*s:l/8 ) + call s:setcolor( 'grey5' , 5*s:l/8 , 5*s:l/8 , 5*s:l/8 ) + " call s:setcolor( 'grey6' , 6*s:l/8 , 6*s:l/8 , 6*s:l/8 ) + " call s:setcolor( 'grey7' , 7*s:l/8 , 7*s:l/8 , 7*s:l/8 ) + call s:setcolor( 'grey' , s:l , s:l , s:l ) + + " Foreground colors: + " + " s:m -- lowest intensity level for fg colors + " s:h -- highest intensity level. + " s:M -- medium intensity (average of the above two) + + let s:M = (s:m + s:h) / 2 + + call s:setcolor( 'red' , s:h , 0 , 0 ) + call s:setcolor( 'lightbrown' , s:M , s:m , 0 ) + call s:setcolor( 'yellow' , s:M , s:M , s:m ) + call s:setcolor( 'dirtygreen' , s:m , s:m , 0 ) + call s:setcolor( 'green' , s:m , s:M , s:m ) + call s:setcolor( 'bluegreen' , 0 , s:M , s:m ) + call s:setcolor( 'yellowgreen', s:m , s:M , 0 ) + call s:setcolor( 'skyblue' , 0 , s:m , s:M ) + call s:setcolor( 'lightblue' , 0 , s:m , s:h ) + call s:setcolor( 'cyan' , 0 , s:M , s:M ) + call s:setcolor( 'lightcyan' , s:m , s:M , s:M ) + call s:setcolor( 'darkpurple' , s:m , 0 , s:h ) + call s:setcolor( 'purple' , s:m , s:m , s:M ) + + " Unused colors that are pretty reasonable + " call s:setcolor( 'lightred' , s:M , s:m , s:m ) + " call s:setcolor( 'bluewhite' , s:M , s:M , s:h ) + " call s:setcolor( 'lightpurple', s:m , s:m , s:h ) + + " Greys can be done with better accurcy on cterms! + call s:setcolor( 'white' , 48*s:M/50 , 48*s:M/50 , 48*s:M/50 ) + call s:setcolor( 'white1' , 40*s:M/50 , 40*s:M/50 , 40*s:M/ 50 ) + + unlet s:M + + " {{{2 Highlighting groups for "allblue" colors. + call s:hi( 'Normal' , 'none' , 'white' , 'black' ) + + call s:hi( 'Cursor' , 'none' , 'black' , 'green' ) + call s:hi( 'CursorColumn' , 'none' , 'none' , 'grey4' ) + call s:hi( 'CursorLine' , 'none' , 'none' , 'grey4' ) + call s:hi( 'DiffAdd' , 'none' , 'lightbrown' , 'grey2' ) + call s:hi( 'DiffChange' , 'none' , 'yellow' , 'grey2' ) + call s:hi( 'DiffDelete' , 'none' , 'dirtygreen' , 'grey2' ) + call s:hi( 'DiffText' , 'none' , 'yellowgreen' , 'grey2' ) + call s:hi( 'Directory' , 'none' , 'lightblue' , 'none' ) + call s:hi( 'ErrorMsg' , 'none' , 'white' , 'darkred' ) + call s:hi( 'FoldColumn' , 'none' , 'grey4' , 'none' ) + call s:hi( 'Folded' , 'none' , 'white1' , 'grey2' ) + call s:hi( 'IncSearch' , 'none' , 'white' , 'darkblue' ) + call s:hi( 'LineNr' , 'none' , 'yellow' , 'none' ) + call s:hi( 'MatchParen' , 'bold' , 'none' , 'none' ) + call s:hi( 'ModeMsg' , 'bold' , 'none' , 'none' ) + call s:hi( 'MoreMsg' , 'none' , 'green' , 'none' ) + call s:hi( 'NonText' , 'none' , 'lightbrown' , 'none' ) + call s:hi( 'Pmenu' , 'none' , 'none' , 'grey3' ) + call s:hi( 'PmenuSel' , 'none' , 'none' , 'darkblue' ) + call s:hi( 'PmenuSbar' , 'none' , 'none' , 'grey2' ) + call s:hi( 'PmenuThumb' , 'none' , 'none' , 'grey4' ) + call s:hi( 'Question' , 'none' , 'green' , 'none' ) + call s:hi( 'Search' , 'none' , 'black' , 'darkcyan' ) + call s:hi( 'SignColumn' , 'none' , 'yellow' , 'grey1' ) + call s:hi( 'SpecialKey' , 'none' , 'yellow' , 'none' ) + call s:hi( 'StatusLineNC' , 'none' , 'grey' , 'grey3' ) + call s:hi( 'StatusLine' , 'none' , 'white' , 'grey5' ) + call s:hi( 'TabLine' , 'none' , 'none' , 'grey3' ) + call s:hi( 'TabLineFill' , 'none' , 'none' , 'grey3' ) + call s:hi( 'TabLineSel' , 'bold' , 'none' , 'none' ) + call s:hi( 'Title' , 'none' , 'yellow' , 'none' ) + call s:hi( 'VertSplit' , 'none' , 'grey3' , 'grey3' ) + call s:hi( 'Visual' , 'none' , 'none' , 'darkblue' ) + call s:hi( 'VisualNOS' , 'none' , 'none' , 'grey2' ) + call s:hi( 'WarningMsg' , 'none' , 'red' , 'none' ) + call s:hi( 'WildMenu' , 'none' , 'yellow' , 'none' ) + + call s:hi( 'Comment' , 'none' , 'purple' , 'none' ) + call s:hi( 'Constant' , 'none' , 'lightcyan' , 'none' ) + call s:hi( 'Error' , 'none' , 'red' , 'none' ) + call s:hi( 'Identifier' , 'none' , 'cyan' , 'none' ) + call s:hi( 'Ignore' , 'none' , 'grey3' , 'none' ) + call s:hi( 'PreProc' , 'none' , 'darkpurple' , 'none' ) + call s:hi( 'Special' , 'none' , 'bluegreen' , 'none' ) + call s:hi( 'Statement' , 'none' , 'skyblue' , 'none' ) + call s:hi( 'Todo' , 'none' , 'lightbrown' , 'none' ) + call s:hi( 'Type' , 'none' , 'green' , 'none' ) + call s:hi( 'Underlined' , 'none' , 'darkpurple' , 'none' ) + + " {{{2 Spelling highlighting groups. + " + " The undercurl looks great in gui, so let's use that. For cterm use + " some crappy grey background + bold / etc. Not something that stands + " out too much because there are invariably numerous spelling mistakes + " highlighted in most code. + " + call s:hi( 'SpellBad' , 'bold,underline' , 'none', 'grey2', + \ 'undercurl' , 'none', 'none' , 'red' ) + call s:hi( 'SpellCap' , 'bold' , 'none', 'grey2', + \ 'undercurl' , 'none', 'none' , 'skyblue' ) + call s:hi( 'SpellLocal' , 'underline' , 'none', 'grey2', + \ 'undercurl' , 'none', 'none' , 'lightcyan' ) + call s:hi( 'SpellRare' , 'underline' , 'none', 'none' , + \ 'undercurl' , 'none', 'none' , 'yellow' ) + + " {{{2 Highlighting groups for email. + " + " mailURL links to Constant, which is light cyan. This does not stand + " out well in quoted emails (which is cyan), or regular text. Better + " to use light brown (like the soft colormap). + hi link mailURL Todo + + " {{{2 Define html highlighting groups for "allblue" colors + if !exists("g:xterm16_NoHtmlColors") + call s:hi( 'htmlBold', 'none', 'yellow', 'none', 'bold', 'none') + call s:hi( 'htmlItalic', 'none', 'yellow', 'none', 'italic', 'none') + call s:hi( 'htmlUnderline', 'none', 'darkpurple', 'none', 'underline', 'none') + call s:hi( 'htmlBoldItalic', 'bold', 'yellow', 'none', 'bold,italic', 'none') + call s:hi( 'htmlBoldUnderline', 'bold', 'darkpurple', 'none', 'bold,underline', 'none') + call s:hi( 'htmlUnderlineItalic', 'bold', 'darkpurple', 'none', 'underline,italic', 'none') + call s:hi( 'htmlBoldUnderlineItalic', 'bold', 'white', 'none', 'bold,underline,italic', 'none') + endif + " }}}2 + else + throw 'xterm16 Error: Unrecognised colormap "' . s:colormap . '"' + endif + " }}}1 +catch /^xterm16 Error:/ + " {{{1 Handle internal exceptions. + unlet colors_name + + echohl ErrorMsg + echomsg v:exception + echohl None + " }}}1 +finally + " {{{1 Unlet script variables and functions + " Restore compatibility options + let &cpo = s:cpo_save + unlet! s:c1 s:c2 s:c3 + unlet! s:i s:lower s:upper s:ccube s:cinterval + unlet! s:cpo_save s:hex s:l s:m s:h s:cterm_none s:gui_none + + " Delete colors of "standard" colormap + unlet! s:gui_black s:gui_darkred s:gui_darkgreen s:gui_darkyellow s:gui_darkblue s:gui_darkmagenta s:gui_darkcyan s:gui_grey s:gui_darkgrey s:gui_red s:gui_green s:gui_yellow s:gui_blue s:gui_magenta s:gui_cyan s:gui_white + unlet! s:cterm_black s:cterm_darkred s:cterm_darkgreen s:cterm_darkyellow s:cterm_darkblue s:cterm_darkmagenta s:cterm_darkcyan s:cterm_grey s:cterm_darkgrey s:cterm_red s:cterm_green s:cterm_yellow s:cterm_blue s:cterm_magenta s:cterm_cyan s:cterm_white + + " Delete extra colors of "soft" colormap + unlet! s:gui_lightbrown s:gui_bluegreen s:gui_skyblue s:gui_purple + unlet! s:cterm_lightbrown s:cterm_bluegreen s:cterm_skyblue s:cterm_purple + + " Delete extra colors from "allblue" colormap + unlet! s:gui_darkcyan s:gui_darkblue s:gui_grey1 s:gui_grey2 s:gui_grey3 s:gui_grey4 s:gui_grey5 s:gui_white1 s:gui_dirtygreen s:gui_yellowgreen s:gui_lightblue s:gui_lightcyan s:gui_darkpurple + unlet! s:cterm_darkcyan s:cterm_darkblue s:cterm_grey1 s:cterm_grey2 s:cterm_grey3 s:cterm_grey4 s:cterm_grey5 s:cterm_white1 s:cterm_dirtygreen s:cterm_yellowgreen s:cterm_lightblue s:cterm_lightcyan s:cterm_darkpurple + + delfunction s:tohex + delfunction s:extractRGB + delfunction s:guilevel + delfunction s:ctermlevel + delfunction s:guicolor + delfunction s:ctermcolor + delfunction s:setcolor + delfunction s:getcolor + delfunction s:use_guiattr + delfunction s:hi + delfunction s:set_brightness + " }}}1 +endtry diff --git a/vim/doc/example.taskpaper b/vim/doc/example.taskpaper new file mode 100644 index 0000000..c72b188 --- /dev/null +++ b/vim/doc/example.taskpaper @@ -0,0 +1,10 @@ +Example Project: + - Start example project file @computer @done + - Brainstorm project with colleagues @work + - Email Joan about project @email + Sub Project: + - Sub task + +Next Project: + - Draft ideas for next project @anywhere + - Email Bob to arrange meeting @email diff --git a/vim/doc/tags b/vim/doc/tags new file mode 100644 index 0000000..494483f --- /dev/null +++ b/vim/doc/tags @@ -0,0 +1,9 @@ +taskpaper taskpaper.txt /*taskpaper* +taskpaper-config taskpaper.txt /*taskpaper-config* +taskpaper-customize taskpaper.txt /*taskpaper-customize* +taskpaper-install taskpaper.txt /*taskpaper-install* +taskpaper-licence taskpaper.txt /*taskpaper-licence* +taskpaper-mappings taskpaper.txt /*taskpaper-mappings* +taskpaper-plugin taskpaper.txt /*taskpaper-plugin* +taskpaper-syntax taskpaper.txt /*taskpaper-syntax* +taskpaper.txt taskpaper.txt /*taskpaper.txt* diff --git a/vim/doc/taskpaper.txt b/vim/doc/taskpaper.txt new file mode 100644 index 0000000..8993019 --- /dev/null +++ b/vim/doc/taskpaper.txt @@ -0,0 +1,310 @@ +*taskpaper.txt* For Vim version 6.0 Last change: 2012 March 13 + +David O'Callaghan + +13th March 2012 + +Introduction +============= +*taskpaper* + +*Latest version from https://github.com/davidoc/taskpaper.vim* + +From the TaskPaper website (): + +"TaskPaper is a simple to-do list application that helps you stay +organized. Unlike competing applications, TaskPaper is based on plain text +files which offer you paper-like simplicity and ease of use." + +TaskPaper is a to-do list application for Mac OS X based on the "Getting +Things Done" approach of David Allen (). It supports +the GTD notions of projects, tasks and contexts. + +This package contains a syntax file and a file-type plugin for the simple +format used by the TaskPaper application. It is intended for Mac users who +want to edit their TaskPaper lists in Vim from time to time (for example, in +a SSH session, or on a non-Mac system) and for anyone who is looking for a +simple to-do list format. + +Installation +============= +*taskpaper-install* + +It should be safe to simply unpack the package into your .vim directory. +It contains the following files: + + autoload/taskpaper.vim + doc/example.taskpaper + doc/taskpaper.txt + doc/taskpaper_licence.txt + ftdetect/taskpaper.vim + ftplugin/taskpaper.vim + syntax/taskpaper.vim + +To access this help file from within Vim you must first update your help +tags: + + :helptags ~/.vim/doc + +The path may need to be modified depending on where you install to. Once +you have done this you can access the help with this command: + + :help taskpaper + +Syntax +======= +*taskpaper-syntax* + +The syntax file highlights project headings and task contexts (tags), and +"greys out" completed tasks. The exact style of the displayed file depends +on your Vim colour scheme. + +A project heading is a piece of text ending in a colon. + +A task is a line beginning with a hyphen '-' and can have zero or more +context tags. + +A context tag has the form "@tag". + +Other text is considered as a "note" and is displayed as a Vim comment. + +File-type Plugin +================= +*taskpaper-plugin* + +The file-type plugin tries to make editing TaskPaper files in Vim more +comfortable. + +Vim can complete context names after the '@' using the keyword completion +commands (e.g. Ctrl-X Ctrl-N). + +*taskpaper-mappings* +The plugin defines some new mappings: + + \td Mark task as done + \tx Mark task as cancelled + \tt Mark task as today + \tD Archive @done items + \tX Show tasks marked as cancelled + \tT Show tasks marked as today + \t/ Search for items including keyword + \ts Search for items including tag + \tp Fold all projects + \t. Fold all notes + \tP Focus on the current project + \tj Go to next project + \tk Go to previous project + \tg Go to specified project + \tm Move task to specified project + +Note: if `` has been changed (e.g. `:let mapleader=",,"`) +then its value should be used instead of `\` in the mappings. + +Marking a task as done will add the "@done" context tag to the end of the +task, and it will be greyed out by the syntax file. + +To show all tasks with a particular context tag, type `\ts` and a tag name to +search. If you use the `\ts` command over the desired context tag, the tag +name is set as default value. This will fold all the irrelevant tasks leaving +only the tasks in the current context visible. + +To fold all top-level projects leaving only the headings visible use the `\tp` +command. Standard fold commands can be used to open (`zo`) and close (`zc`) +individual projects. + +To show all projects and tasks use the `zR` command. This disables folding so +that the entire file is expanded. + +To go to next or previous project use the `\tj` command or `\tk` command. To +go to a project you specify use the `\tg` command. You can complete project +names with on prompt. + +Configuration +============== +*taskpaper-config* + +The plugin supports a number of configuration variables, which can be set in +your .vimrc file. + +To change the default date format string used when marking a task complete, +define the `task_paper_date_format` variable. The format matches your system's +`strftime()` function. + +For example, to include the date and time in ISO8601 format: + + let g:task_paper_date_format = "%Y-%m-%dT%H:%M:%S%z" + +To change the default archive project name, define the +`task_paper_archive_project` variable. The default value is "Archive". + + let g:task_paper_archive_project = "Archive" + +By default, when you move a task, the cursor will follow that task to its new +location. To make the cursor stay in it's current location, change the +`task_paper_follow_move` variable. + + let g:task_paper_follow_move = 0 + +If you want to hide done tasks when searching you can change the +`task_paper_search_hide_done` variable. + + let g:task_paper_search_hide_done = 1 + +To set a custom style (colour, bold, etc.) for tags task_paper_styles variable, +which is a dictionary. + + let g:task_paper_styles={'wait': 'ctermfg=Blue guifg=Blue', 'FAIL': +'ctermbg=Red guibg=Red'} + +See |highlight-args| for a full description of the syntax. + + +File-type Detection +==================== + +This package also contains a script to automatically use the TaskPaper file +type for all files with the ".taskpaper" extension. + +Customize +========== +*taskpaper-customize* + +You can create your own shortcut for tagging. To define your own shortcut, +write settings in ~/.vim/ftplugin/taskpaper.vim or ~/.vimrc. If you use the +.vimrc file, define settings like: + + function! s:taskpaper_setup() + " Your settings + nnoremap tn + \ :call taskpaper#toggle_tag('next', '') + endfunction + + augroup vimrc-taskpaper + autocmd! + autocmd FileType taskpaper call s:taskpaper_setup() + augroup END + +To add a tag without argument: + + nnoremap tn + \ :call taskpaper#add_tag('next', '') + +To delete a tag: + + nnoremap tN + \ :call taskpaper#delete_tag('next', '') + +To toggle a tag: + + nnoremap tn + \ :call taskpaper#toggle_tag('next', '') + +To add a tag with an argument: + + nnoremap tq + \ :call taskpaper#add_tag('priority') + +You can specify the priority value on prompt. + +To delete the priority tag with any argument: + + nnoremap tQ + \ :call taskpaper#delete_tag('priority', '') + +To delete only the level 1 of priority tag: + + nnoremap tQ + \ :call taskpaper#delete_tag('priority', '1') + +To toggle a tag with an argument: + + nnoremap tq + \ :call taskpaper#toggle_tag('priority') + +To update a tag (not delete if the tag exists): + + nnoremap tq + \ :call taskpaper#update_tag('priority') + +Licence +======== +*taskpaper-licence* + +Copyright (C) 2007--2012 by David O'Callaghan + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Acknowledgements +================= + +The initial version of the ToggleDone() function was based on SwitchBox() +from the VimOutliner Checkboxes script written by Noel Henson (available +from ). + +Context folding expression was based on a snippet from Vim Tip 282 +(). + +Thanks are due to a number of contributors who have supplied suggestions +or patches to improve TaskPaper.vim: + + * Alexander Wodniok + - hint to allow this file to be used as a help file + * Ben Armstron + - various fixes that make the scripts more robust + - fix to show only complete tag matches + - include `_` in contexts + * Huahai Yang + - fixed handling of indented tasks + * Steve Audette + - suggested change to folding + * Andreas Kühntopf + - display non-tasks as comments + * Julien Blanchard (https://github.com/julienXX) + - added ToggleCancelled + * Robert James Kaes (https://github.com/rjkaes) + - added task_paper_date_format + * Adriano Castro (https://github.com/adrianocastro) + - use tabs not spaces (noexpandtab) + * Morgan Sutherland (https://github.com/msutherl) + - Use rather than + - Start new task after + * Matt Sacks (https://github.com/mattsa) + - Optional (date) syntax for @done tasks + - Add Tag command for add/removing tag + - Fix lagging space after removing a tag + - Better syntax + * Anyakichi (https://github.com/anyakichi) + - Add useful functions for users to define his own mappings easily + - Add, delete, toggle, and update tags + - Go previous or next project + - Move projects, tasks and notes to another project + - Search for keywords or tags with regexp + - More compatible with HogBaySoftware's TaskPaper + - Tag to projects and notes not only tasks + - Shortcut to @today tag + - Archiving done support + - Multi-level folding of projects work perfectly + - Add a new feature to fold only notes + + + +Contact +======== + +The author of these Vim scripts is David O'Callaghan +. + +For all information regarding the TaskPaper application itself please visit +. diff --git a/vim/doc/taskpaper_hacking.txt b/vim/doc/taskpaper_hacking.txt new file mode 100644 index 0000000..706fb4a --- /dev/null +++ b/vim/doc/taskpaper_hacking.txt @@ -0,0 +1,8 @@ +Version Control +---------------- + +github (http://github.com) is used for version control. The main +repository is at . + +To start working on the source code you should create an account on github, +fork taskpaper.vim and checkout your fork. diff --git a/vim/doc/taskpaper_licence.txt b/vim/doc/taskpaper_licence.txt new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/vim/doc/taskpaper_licence.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/vim/ftdetect/pug.vim b/vim/ftdetect/pug.vim new file mode 100644 index 0000000..e438be3 --- /dev/null +++ b/vim/ftdetect/pug.vim @@ -0,0 +1,5 @@ +" Pug +autocmd BufNewFile,BufReadPost *.pug set filetype=pug + +" Jade +autocmd BufNewFile,BufReadPost *.jade set filetype=pug diff --git a/vim/ftdetect/taskpaper.vim b/vim/ftdetect/taskpaper.vim new file mode 100644 index 0000000..56f88fb --- /dev/null +++ b/vim/ftdetect/taskpaper.vim @@ -0,0 +1,9 @@ +" Vim filetype detection file +" Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper) +" Maintainer: David O'Callaghan +" URL: https://github.com/davidoc/taskpaper.vim +" Last Change: 2011-03-28 +" +augroup taskpaper + au! BufRead,BufNewFile *.taskpaper setfiletype taskpaper +augroup END diff --git a/vim/ftdetect/tex.vim b/vim/ftdetect/tex.vim new file mode 100644 index 0000000..1605a05 --- /dev/null +++ b/vim/ftdetect/tex.vim @@ -0,0 +1,2 @@ +" TeX and LaTeX +autocmd BufNewFile,BufReadPost *.tex set filetype=tex diff --git a/vim/ftplugin/jade.vim b/vim/ftplugin/jade.vim new file mode 100644 index 0000000..577f554 --- /dev/null +++ b/vim/ftplugin/jade.vim @@ -0,0 +1,57 @@ +" Vim filetype plugin +" Language: Jade +" Maintainer: Joshua Borton +" Credits: Tim Pope + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +let s:save_cpo = &cpo +set cpo-=C + +setlocal iskeyword+=- + +" Define some defaults in case the included ftplugins don't set them. +let s:undo_ftplugin = "" +let s:browsefilter = "All Files (*.*)\t*.*\n" +let s:match_words = "" + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +unlet! b:did_ftplugin + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter + unlet b:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words + unlet b:match_words +endif + +" Change the browse dialog on Win32 to show mainly Haml-related files +if has("gui_win32") + let b:browsefilter="Jade Files (*.jade)\t*.jade\n" . s:browsefilter +endif + +" Load the combined list of match_words for matchit.vim +if exists("loaded_matchit") + let b:match_words = s:match_words +endif + +setlocal comments=://-,:// commentstring=//\ %s + +setlocal suffixesadd+=.jade + +let b:undo_ftplugin = "setl cms< com< " + \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + +let &cpo = s:save_cpo + +" vim:set sw=2: diff --git a/vim/ftplugin/pug.vim b/vim/ftplugin/pug.vim new file mode 100644 index 0000000..db071fa --- /dev/null +++ b/vim/ftplugin/pug.vim @@ -0,0 +1,57 @@ +" Vim filetype plugin +" Language: Pug +" Maintainer: Joshua Borton +" Credits: Tim Pope + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +let s:save_cpo = &cpo +set cpo-=C + +setlocal iskeyword+=- + +" Define some defaults in case the included ftplugins don't set them. +let s:undo_ftplugin = "" +let s:browsefilter = "All Files (*.*)\t*.*\n" +let s:match_words = "" + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +unlet! b:did_ftplugin + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin +endif +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter + unlet b:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words + unlet b:match_words +endif + +" Change the browse dialog on Win32 to show mainly Haml-related files +if has("gui_win32") + let b:browsefilter="Pug Files (*.pug)\t*.pug\n" . s:browsefilter +endif + +" Load the combined list of match_words for matchit.vim +if exists("loaded_matchit") + let b:match_words = s:match_words +endif + +setlocal comments=://-,:// commentstring=//\ %s + +setlocal suffixesadd+=.pug + +let b:undo_ftplugin = "setl cms< com< " + \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + +let &cpo = s:save_cpo + +" vim:set sw=2: diff --git a/vim/ftplugin/taskpaper.vim b/vim/ftplugin/taskpaper.vim new file mode 100644 index 0000000..ea66fcb --- /dev/null +++ b/vim/ftplugin/taskpaper.vim @@ -0,0 +1,117 @@ +" plugin to handle the TaskPaper to-do list format +" Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper) +" Maintainer: David O'Callaghan +" URL: https://github.com/davidoc/taskpaper.vim +" Last Change: 2012-02-20 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +" Define a default date format +if !exists('g:task_paper_date_format') + let g:task_paper_date_format = "%Y-%m-%d" +endif + +" Define a default archive project name +if !exists('g:task_paper_archive_project') + let g:task_paper_archive_project = "Archive" +endif + +" When moving a task, should the cursor follow or stay in the same place +" (default: follow) +if !exists('g:task_paper_follow_move') + let g:task_paper_follow_move = 1 +endif + +" Hide @done tasks when searching tags +if !exists('g:task_paper_search_hide_done') + let g:task_paper_search_hide_done = 0 +endif + +" Add '@' to keyword character set so that we can complete contexts as keywords +setlocal iskeyword+=@-@ + +" Tab character has special meaning on TaskPaper +setlocal noexpandtab + +" Change 'comments' and 'formatoptions' to continue to write a task item +setlocal comments=b:- +setlocal fo-=c fo+=rol + +" Set 'autoindent' to maintain indent level +setlocal autoindent + +" Set up mappings +if !exists("no_plugin_maps") && !exists("no_taskpaper_maps") + nnoremap TaskPaperFoldProjects + \ :call taskpaper#fold_projects() + nnoremap TaskPaperFoldNotes + \ :call taskpaper#search('\v^(\s*\|\t+-\s+.*\|.+:)$') + nnoremap TaskPaperFocusProject + \ :call taskpaper#focus_project() + + nnoremap TaskPaperSearchKeyword + \ :call taskpaper#search() + nnoremap TaskPaperSearchTag + \ :call taskpaper#search_tag() + + nnoremap TaskPaperGoToProject + \ :call taskpaper#go_to_project() + nnoremap TaskPaperNextProject + \ :call taskpaper#next_project() + nnoremap TaskPaperPreviousProject + \ :call taskpaper#previous_project() + + nnoremap TaskPaperArchiveDone + \ :call taskpaper#archive_done() + nnoremap TaskPaperShowToday + \ :call taskpaper#search_tag('today') + nnoremap TaskPaperShowCancelled + \ :call taskpaper#search_tag('cancelled') + nnoremap TaskPaperToggleCancelled + \ :call taskpaper#toggle_tag('cancelled', taskpaper#date()) + nnoremap TaskPaperToggleDone + \ :call taskpaper#toggle_tag('done', taskpaper#date()) + nnoremap TaskPaperToggleToday + \ :call taskpaper#toggle_tag('today', '') + nnoremap TaskPaperMoveToProject + \ :call taskpaper#move_to_project() + + nnoremap TaskPaperNewline + \ o=taskpaper#newline() + inoremap TaskPaperNewline + \ =taskpaper#newline() + + nmap tp TaskPaperFoldProjects + nmap t. TaskPaperFoldNotes + nmap tP TaskPaperFocusProject + + nmap t/ TaskPaperSearchKeyword + nmap ts TaskPaperSearchTag + + nmap tg TaskPaperGoToProject + nmap tj TaskPaperNextProject + nmap tk TaskPaperPreviousProject + + nmap tD TaskPaperArchiveDone + nmap tT TaskPaperShowToday + nmap tX TaskPaperShowCancelled + nmap td TaskPaperToggleDone + nmap tt TaskPaperToggleToday + nmap tx TaskPaperToggleCancelled + nmap tm TaskPaperMoveToProject + + if mapcheck("o", "n") == '' + nmap o TaskPaperNewline + endif + if mapcheck("\", "i") == '' + imap TaskPaperNewline + endif +endif + +let &cpo = s:save_cpo diff --git a/vim/indent/jade.vim b/vim/indent/jade.vim new file mode 100644 index 0000000..8cfa656 --- /dev/null +++ b/vim/indent/jade.vim @@ -0,0 +1,70 @@ +" Vim indent file +" Language: Jade +" Maintainer: Joshua Borton +" Credits: Tim Pope (vim-jade) +" Last Change: 2010 Sep 22 + +if exists("b:did_indent") + finish +endif + +unlet! b:did_indent +let b:did_indent = 1 + +setlocal autoindent +setlocal indentexpr=GetJadeIndent() +setlocal indentkeys=o,O,*,},],0),!^F + +" Only define the function once. +if exists("*GetJadeIndent") + finish +endif + +let s:attributes = '\%((.\{-\})\)' +let s:tag = '\([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*' + +if !exists('g:jade_self_closing_tags') + let g:jade_self_closing_tags = 'meta|link|img|hr|br|input' +endif + +setlocal formatoptions+=r +setlocal comments+=n:\| + +function! GetJadeIndent() + let lnum = prevnonblank(v:lnum-1) + if lnum == 0 + return 0 + endif + let line = substitute(getline(lnum),'\s\+$','','') + let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') + let lastcol = strlen(line) + let line = substitute(line,'^\s\+','','') + let indent = indent(lnum) + let cindent = indent(v:lnum) + let increase = indent + &sw + if indent == indent(lnum) + let indent = cindent <= indent ? -1 : increase + endif + + let group = synIDattr(synID(lnum,lastcol,1),'name') + + if line =~ '^!!!' + return indent + elseif line =~ '^/\%(\[[^]]*\]\)\=$' + return increase + elseif line =~ '^\%(if\|else\|unless\|for\|each\|block\|mixin\|append\|case\|when\)' + return increase + elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$' + return increase + elseif line == '-#' + return increase + elseif line =~? '^\v%('.g:jade_self_closing_tags.')>' + return indent + elseif group =~? '\v^%(jadeAttributesDelimiter|jadeClass|jadeId|htmlTagName|htmlSpecialTagName|jadeFilter|jadeTagBlockChar)$' + return increase + else + return indent + endif +endfunction + +" vim:set sw=2: diff --git a/vim/indent/pug.vim b/vim/indent/pug.vim new file mode 100644 index 0000000..bc7f2b4 --- /dev/null +++ b/vim/indent/pug.vim @@ -0,0 +1,70 @@ +" Vim indent file +" Language: Pug +" Maintainer: Joshua Borton +" Credits: Tim Pope (vim-pug) +" Last Change: 2010 Sep 22 + +if exists("b:did_indent") + finish +endif + +unlet! b:did_indent +let b:did_indent = 1 + +setlocal autoindent +setlocal indentexpr=GetPugIndent() +setlocal indentkeys=o,O,*,},],0),!^F + +" Only define the function once. +if exists("*GetPugIndent") + finish +endif + +let s:attributes = '\%((.\{-\})\)' +let s:tag = '\([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*' + +if !exists('g:pug_self_closing_tags') + let g:pug_self_closing_tags = 'meta|link|img|hr|br|input' +endif + +setlocal formatoptions+=r +setlocal comments+=n:\| + +function! GetPugIndent() + let lnum = prevnonblank(v:lnum-1) + if lnum == 0 + return 0 + endif + let line = substitute(getline(lnum),'\s\+$','','') + let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') + let lastcol = strlen(line) + let line = substitute(line,'^\s\+','','') + let indent = indent(lnum) + let cindent = indent(v:lnum) + let increase = indent + &sw + if indent == indent(lnum) + let indent = cindent <= indent ? -1 : increase + endif + + let group = synIDattr(synID(lnum,lastcol,1),'name') + + if line =~ '^!!!' + return indent + elseif line =~ '^/\%(\[[^]]*\]\)\=$' + return increase + elseif line =~ '^\%(if\|else\|unless\|for\|each\|block\|mixin\|append\|case\|when\)' + return increase + elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$' + return increase + elseif line == '-#' + return increase + elseif line =~? '^\v%('.g:pug_self_closing_tags.')>' + return indent + elseif group =~? '\v^%(pugAttributesDelimiter|pugClass|pugId|htmlTagName|htmlSpecialTagName|pugFilter|pugTagBlockChar)$' + return increase + else + return indent + endif +endfunction + +" vim:set sw=2: diff --git a/vim/rename_this_to_plugin/ctab.vim b/vim/rename_this_to_plugin/ctab.vim new file mode 100644 index 0000000..4b105f6 --- /dev/null +++ b/vim/rename_this_to_plugin/ctab.vim @@ -0,0 +1,349 @@ +" Intelligent Indent +" Author: Michael Geddes < vimmer at frog dot wheelycreek dot net > +" Version: 2.6 +" Last Modified: December 2010 +" +" Histroy: +" 1.0: - Added RetabIndent command - similar to :retab, but doesn't cause +" internal tabs to be modified. +" 1.1: - Added support for backspacing over spaced tabs 'smarttab' style +" - Clean up the look of it by blanking the :call +" - No longer a 'filetype' plugin by default. +" 1.2: - Interactions with 'smarttab' were causing problems. Now fall back to +" vim's 'smarttab' setting when inserting 'indent' tabs. +" - Fixed compat with digraphs (which were getting swallowed) +" - Made mapping work with the 'filetype' plugin mode. +" - Make CTabAlignTo() public. +" 1.3: - Fix removing trailing spaces with RetabIndent! which was causing +" initial indents to disappear. +" 1.4: - Fixed Backspace tab being off by 1 +" 2.0: - Add support for alignment whitespace for mismatched brackets to be spaces. +" 2.1: - Fix = operator +" 2.3: - Fix (Gene Smith) for error with non C files +" - Add option for filetype maps +" - Allow for lisp indentation +" 2.4: - Fix bug in Retab +" 2.5: - Fix issue with not aligning +" 2.6: - Fix issue with alignment not disappearing. + +" This is designed as a filetype plugin (originally a 'Buffoptions.vim' script). +" +" The aim of this script is to be able to handle the mode of tab usage which +" distinguishes 'indent' from 'alignment'. The idea is to use +" characters only at the beginning of lines. +" +" This means that an individual can use their own 'tabstop' settings for the +" indent level, while not affecting alignment. +" +" The one caveat with this method of tabs is that you need to follow the rule +" that you never 'align' elements that have different 'indent' levels. +" +" :RetabIndent[!] [tabstop] +" This is similar to the :retab command, with the exception that it +" affects all and only whitespace at the start of the line, changing it to +" suit your current (or new) tabstop and expandtab setting. +" With the bang (!) at the end, the command also strips trailing +" whitespace. +" +" CTabAlignTo(n) +" 'Tab' to the n'th column from the start of the indent. + +" g:ctab_filetype_maps +" set this to true if script used as a filetype plugin +" g:ctab_disable_checkalign +" set this to true to disable re-check of alignment +" g:ctab_enable_default_filetype_maps +" disable the filetype specific maps +" g:ctab_disable_tab_maps +" disable the (original) tab mappings + +if exists('g:ctab_filetype_maps') && g:ctab_filetype_maps + let s:buff_map=' ' +else + let s:buff_map='' +endif + +if exists('g:ctab_enable_default_filetype_maps') && ctab_enable_default_filetype_maps + if s:buff_map != '' + if (&filetype =~ '^\(cpp\|idl\)$' ) + imap CTabAlignTo(20).'//' + imap CTabAlignTo(30).'//' + imap º + elseif &filetype == 'c' + imap CTabAlignTo(10).'/* */' + endif + else + au FileType cpp,idl imap CTabAlignTo(20).'//' + au FileType cpp,idl imap CTabAlignTo(30).'//' + au FileType c imap CTabAlignTo(10).'/* */' + endif +endif + +if !exists('g:ctab_disable_tab_maps') || ! g:ctab_disable_tab_maps + exe 'imap '.s:buff_map.' InsertSmartTab()' + exe 'inoremap '.s:buff_map.' DoSmartDelete()."\"' +endif + +"exe 'imap '.s:buff_map.' KeepDelLine()."\" + +" MRG: TODO +"exe 'imap '.s:buff_map.' :call SmartDeleteTab()' +"exe 'imap '.s:buff_map.' SmartInsertTab()' +" fun! s:SmartDeleteTab() +" let curcol=col('.')-&sw +" let origtxt=getline('.') +" let repl=matchstr(origtxt,'^\s\{-}\%'.(&sw+2)."v') +" if repl == '' then +" return "\".':s/ *\zs /'.repeat(' ',(&ts-&sw)).'/'."\\".curcol.'|' +" else +" return "\".':s/^\s\{-}\%'.(&sw+1)."v//\\".curcol."|" +" end +" +" endfun + +" Insert a smart tab. +fun! s:InsertSmartTab() + " Clear the status + echo '' + if strpart(getline('.'),0,col('.')-1) =~'^\s*$' + if exists('b:ctab_hook') && b:ctab_hook != '' + exe 'return '.b:ctab_hook + elseif exists('g:ctab_hook') && g:ctab_hook != '' + exe 'return '.g:ctab_hook + endif + return "\" + endif + + let sts=exists("b:insidetabs")?(b:insidetabs):((&sts==0)?&sw:&sts) + let sp=(virtcol('.') % sts) + if sp==0 | let sp=sts | endif + return strpart(" ",0,1+sts-sp) +endfun + +fun! s:CheckLeaveLine(line) + if ('cpo' !~ 'I') && exists('b:ctab_lastalign') && (a:line == b:ctab_lastalign) + s/^\s*$//e + endif +endfun + +" Check on blanks +aug Ctab +au! InsertLeave * call CheckLeaveLine(line('.')) +aug END + + +" Do a smart delete. +" The is included at the end so that deleting back over line ends +" works as expected. +fun! s:DoSmartDelete() + " Clear the status + "echo '' + let uptohere=strpart(getline('.'),0,col('.')-1) + " If at the first part of the line, fall back on defaults... or if the + " preceding character is a , then similarly fall back on defaults. + " + let lastchar=matchstr(uptohere,'.$') + if lastchar == "\" || uptohere =~ '^\s*$' | return '' | endif " Simple cases + if lastchar != ' ' | return ((&digraph)?("\".lastchar): '') | endif " Delete non space at end / Maintain digraphs + + " Work out how many tabs to use + let sts=(exists("b:insidetabs")?(b:insidetabs):((&sts==0)?(&sw):(&sts))) + + let ovc=virtcol('.') " Find where we are + let sp=(ovc % sts) " How many virtual characters to delete + if sp==0 | let sp=sts | endif " At least delete a whole tabstop + let vc=ovc-sp " Work out the new virtual column + " Find how many characters we need to delete (using \%v to do virtual column + " matching, and making sure we don't pass an invalid value to vc) + let uthlen=strlen(uptohere) + let bs= uthlen-((vc<1)?0:( match(uptohere,'\%'.(vc-1).'v'))) + let uthlen=uthlen-bs + " echo 'ovc = '.ovc.' sp = '.sp.' vc = '.vc.' bs = '.bs.' uthlen='.uthlen + if bs <= 0 | return '' | endif + + " Delete the specifed number of whitespace characters up to the first non-whitespace + let ret='' + let bs=bs-1 + if uptohere[uthlen+bs] !~ '\s'| return '' | endif + while bs>=-1 + let bs=bs-1 + if uptohere[uthlen+bs] !~ '\s' | break | endif + let ret=ret."\" + endwhile + return ret +endfun + +fun! s:Column(line) + let c=0 + let i=0 + let len=strlen(a:line) + while i< len + if a:line[i]=="\" + let c=(c+&tabstop) + let c=c-(c%&tabstop) + else + let c=c+1 + endif + let i=i+1 + endwhile + return c +endfun +fun! s:StartColumn(lineNo) + return s:Column(matchstr(getline(a:lineNo),'^\s*')) +endfun + +fun! CTabAlignTo(n) + let co=virtcol('.') + let ico=s:StartColumn('.')+a:n + if co>ico + let ico=co + endif + let spaces=ico-co + let spc='' + while spaces > 0 + let spc=spc." " + let spaces=spaces-1 + endwhile + return spc +endfun + +if ! exists('g:ctab_disable_checkalign') || g:ctab_disable_checkalign==0 + " Check the alignment of line. + " Used in the case where some alignment whitespace is required .. like for unmatched brackets. + fun! s:CheckAlign(line) + if &expandtab || !(&autoindent || &indentexpr || &cindent) + return '' + endif + + let tskeep=&ts + let swkeep=&sw + try + if a:line == line('.') + let b:ctab_lastalign=a:line + else + unlet b:ctab_lastalign + endif + set ts=50 + set sw=50 + if &indentexpr != '' + let v:lnum=a:line + sandbox exe 'let inda='.&indentexpr + if inda == -1 + let inda=indent(a:line-1) + endif + elseif &cindent + let inda=cindent(a:line) + elseif &lisp + let inda=lispindent(a:line) + elseif &autoindent + let inda=indent(a:line) + elseif &smarttab + return '' + else + let inda=0 + endif + finally + let &ts=tskeep + let &sw=swkeep + endtry + let indatabs=inda / 50 + let indaspace=inda % 50 + let indb=indent(a:line) + if indatabs*&tabstop + indaspace == indb + let txtindent=repeat("\",indatabs).repeat(' ',indaspace) + call setline(a:line, substitute(getline(a:line),'^\s*',txtindent,'')) + endif + return '' + endfun + fun! s:SID() + return matchstr(expand(''), '\zs\d\+\ze_SID$') + endfun + " Get the spaces at the end of the indent correct. + " This is trickier than it should be, but this seems to work. + fun! s:CheckCR() + " echo 'SID:'.s:SID() + if getline('.') =~ '^\s*$' + if ('cpo' !~ 'I') && exists('b:ctab_lastalign') && (line('.') == b:ctab_lastalign) + return "^\\" + endif + return "\" + else + return "\\=".s:SID().'_CheckAlign(line(''.''))'."\\" + endif + endfun + + "exe 'inoremap '.s:buff_map.' =CheckAlign(line(''.''))."\END>"' + exe 'inoremap '.s:buff_map.' CheckCR()' + exe 'nnoremap '.s:buff_map.' o o=CheckAlign(line(''.''))."\END>"' + exe 'nnoremap '.s:buff_map.' O O=CheckAlign(line(''.''))."\END>"' + + " Ok.. now re-evaluate the = re-indented section + + " The only way I can think to do this is to remap the = + " so that it calls the original, then checks all the indents. + exe 'map '.s:buff_map.' = SetupEqual()' + fun! s:SetupEqual() + set operatorfunc=CtabRedoIndent + " Call the operator func so we get the range + return 'g@' + endfun + + fun! CtabRedoIndent(type,...) + set operatorfunc= + let ln=line("'[") + let lnto=line("']") + " Do the original equals + norm! '[='] + + if ! &et + " Then check the alignment. + while ln <= lnto + silent call s:CheckAlign(ln) + let ln+=1 + endwhile + endif + endfun +endif + +" Retab the indent of a file - ie only the first nonspace +fun! s:RetabIndent( bang, firstl, lastl, tab ) + let checkspace=((!&expandtab)? "^\* ": "^ *\") + let l = a:firstl + let force= a:tab != '' && a:tab != 0 && (a:tab != &tabstop) + let checkalign = ( &expandtab || !(&autoindent || &indentexpr || &cindent)) && (!exists('g:ctab_disable_checkalign') || g:ctab_disable_checkalign==0) + let newtabstop = (force?(a:tab):(&tabstop)) + while l <= a:lastl + let txt=getline(l) + let store=0 + if a:bang == '!' && txt =~ '\s\+$' + let txt=substitute(txt,'\s\+$','','') + let store=1 + endif + if force || txt =~ checkspace + let i=indent(l) + let tabs= (&expandtab ? (0) : (i / newtabstop)) + let spaces=(&expandtab ? (i) : (i % newtabstop)) + let txtindent=repeat("\",tabs).repeat(' ',spaces) + let store = 1 + let txt=substitute(txt,'^\s*',txtindent,'') + endif + if store + call setline(l, txt ) + if checkalign + call s:CheckAlign(l) + endif + endif + + let l=l+1 + endwhile + if newtabstop != &tabstop | let &tabstop = newtabstop | endif +endfun + + +" Retab the indent of a file - ie only the first nonspace. +" Optional argument specified the value of the new tabstops +" Bang (!) causes trailing whitespace to be gobbled. +com! -nargs=? -range=% -bang -bar RetabIndent call RetabIndent(,, , ) + + +" vim: sts=2 sw=2 et diff --git a/vim/spell/en.utf-8.add b/vim/spell/en.utf-8.add new file mode 100644 index 0000000..324e129 --- /dev/null +++ b/vim/spell/en.utf-8.add @@ -0,0 +1,117 @@ +supermassive +reionization +Zel'dovich +nbody +overdensity +blockchain +bitcoin +Leatherman +paracord +glowstick +timesteps +overplotted +subhalo +virialized +virial +timestep +subhalos +comoving +minima +BGC2 +grey +collisionless +multipole +octants +symplectic +interparticle +overdensities +perturbative +rms +baryonic +outlier +uncaptured +accrete +infall +Sissom +meshnet +cappella +acknowledgement +acknowledgements +meshnets +anonymize +anonymized +anonymizing +anonymizes +telecom +gigabit +affordability +online +username +Skype +rollout +ISP +ISPs +Comcast +Verizon +Hyperboria +CJDNS +VPN +BGP +GHz +incentivize +incentivized +VPNs +downlink +circulator +astro +LaTeX +preprocessors +CSS +customizable +Crieve +cryptocurrency +subpackage +preprocessing +subpackages +dataframes +rescale +rescaling +verifiers +equilibria +disincentivize +timestamp +arclet +amongst +incentivizes +toplevel +nonces +unspendable +malignment +untestable +neurochemical +mistruth +photoreceptors +planarian +incentivizing +cryptocurrencies +incentivization +uncensorable +arclets +unbacked +verifiably +uptime +deduplicating +uploader +downloader +downloaders +uploaders +deduplication +decrypt +deterministicly +trustless +blockchain's +discretize +discretized +unintuitive +discretization +cryptographic diff --git a/vim/spell/en.utf-8.add.spl b/vim/spell/en.utf-8.add.spl new file mode 100644 index 0000000000000000000000000000000000000000..b532acdd417076214496a1951ee2759e622fc88c GIT binary patch literal 1568 zcmXX`J*(6}6rDTCYGb8fX|=2fud=X|MFka96h*~uGRfN=H<`ptc6GN9e}J9sLoEFh zuN7N=g7EMs*y=fV9wA}oe&2h}&C7?6)6lf-&40#}&#t)2*Uf4j+Aj9Pn5OOSaKRsU zaZJ{4WRylGyhft*@?Kh;Ygysj;f*p`BgQO}978=q<)o4Tvj8`0_K-(7B)v^~+rv4? z!8V~#?>dKwYO)d!cSvqC^Qf}EbgR(flA{F`dg}+dDfW}t5|$pJvx1d++2CEHoFLJf z>*|p%y70Ci(^dvN4bo_$g+pX7TihH1^=ivr(Dkio+YX9=27(sP381=DjHicvf`_%T zqih#!*h9^W%o^lCH0xIgJ>ucKybWx2uOS);9jqYvvgY?|(s+HI4|El!^R{$N=n>3e z%ydEcqpt8Z=cA$AfE7kz_SU7%&_G!dZWqzQ=22ldLp z)~s18r^OC0l=B0a5T&&!DucE`(i&z^E=PHXVloFR1c&TbC_ykio*Y1i^Tr$}`d(XR zT=|j9YS0tm8PPsTrMj83F%|xpWCZOXWHE;VZr>bIjNm8$KMdr(JJDf}TV>AO@i!A6r^3&Jp6)>5jQ=88+KJBdI`Uow8Xj54IZY zn&2szOD-BW+5rqiTIvWeL9QRtUr0EU{ph8|?7`AIG5*N%>siYv1HO;3N%Uvu7NyT}Fgx]\|&[^=~ ]\)\@!" nextgroup=jadeTag,jadeClassChar,jadeIdChar,jadePlainChar,jadeJavascript,jadeScriptConditional,jadeScriptStatement,jadePipedText +syn match jadeTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@jadeComponent +syn cluster jadeComponent contains=jadeAttributes,jadeIdChar,jadeBlockExpansionChar,jadeClassChar,jadePlainChar,jadeJavascript,jadeTagBlockChar,jadeTagInlineText +syn match jadeComment '\s*\/\/.*$' +syn region jadeCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" keepend +syn region jadeHtmlConditionalComment start="" +syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent +syn match jadeClassChar "\." contained nextgroup=jadeClass +syn match jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag,jadeClassChar,jadeIdChar +syn match jadeIdChar "#[[{]\@!" contained nextgroup=jadeId +syn match jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent +syn match jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent +syn region jadeDocType start="^\s*\(!!!\|doctype\)" end="$" +" Unless I'm mistaken, syntax/html.vim requires +" that the = sign be present for these matches. +" This adds the matches back for jade. +syn keyword jadeHtmlArg contained href title + +syn match jadePlainChar "\\" contained +syn region jadeInterpolation matchgroup=jadeInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript +syn match jadeInterpolationEscape "\\\@[?!]\@!" +syn match jadeScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!" +syn region jadeScriptLoopRegion start="^\s*\(for \)" end="$" contains=jadeScriptLoopKeywords +syn keyword jadeScriptLoopKeywords for in contained + +syn region jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag,jadeCoffeescriptFilter keepend + +syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained +syn region jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag +syn region jadeCssBlock start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend + +syn match jadeError "\$" contained + +hi def link jadePlainChar Special +hi def link jadeScriptConditional PreProc +hi def link jadeScriptLoopKeywords PreProc +hi def link jadeScriptStatement PreProc +hi def link jadeHtmlArg htmlArg +hi def link jadeAttributeString String +hi def link jadeAttributesDelimiter Identifier +hi def link jadeIdChar Special +hi def link jadeClassChar Special +hi def link jadeBlockExpansionChar Special +hi def link jadePipeChar Special +hi def link jadeTagBlockChar Special +hi def link jadeId Identifier +hi def link jadeClass Type +hi def link jadeInterpolationDelimiter Delimiter +hi def link jadeInlineDelimiter Delimiter +hi def link jadeFilter PreProc +hi def link jadeDocType PreProc +hi def link jadeComment Comment +hi def link jadeCommentBlock Comment +hi def link jadeHtmlConditionalComment jadeComment + +let b:current_syntax = "jade" + +if main_syntax == "jade" + unlet main_syntax +endif diff --git a/vim/syntax/pug.vim b/vim/syntax/pug.vim new file mode 100644 index 0000000..7b0f1c3 --- /dev/null +++ b/vim/syntax/pug.vim @@ -0,0 +1,110 @@ +" Vim syntax file +" Language: Pug +" Maintainer: Joshua Borton +" Credits: Tim Pope +" Filenames: *.pug + +if exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'pug' +endif + +silent! syntax include @htmlCoffeescript syntax/coffee.vim +unlet! b:current_syntax +silent! syntax include @htmlStylus syntax/stylus.vim +unlet! b:current_syntax +silent! syntax include @htmlCss syntax/css.vim +unlet! b:current_syntax +silent! syntax include @htmlMarkdown syntax/markdown.vim +unlet! b:current_syntax + +syn case match + +syn region javascriptParenthesisBlock start="(" end=")" contains=@htmlJavascript contained keepend +syn cluster htmlJavascript add=javascriptParenthesisBlock + +syn region pugJavascript matchgroup=pugJavascriptOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend +syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend +syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript +syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText +syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent +syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText +syntax keyword pugCommentTodo contained TODO FIXME XXX TBD +syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell +syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend +syn region pugHtmlConditionalComment start="" contains=pugCommentTodo,@Spell +syn region pugAngular2 start="(" end=")" contains=htmlEvent +syn region pugJavascriptString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contained +syn region pugJavascriptString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contained +syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=pugJavascriptString,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent +syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass +syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar +syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId +syn match pugClass "\%(\w\|-\)\+" contained nextgroup=@pugComponent +syn match pugId "\%(\w\|-\)\+" contained nextgroup=@pugComponent +syn region pugDocType start="^\s*\(!!!\|doctype\)" end="$" +" Unless I'm mistaken, syntax/html.vim requires +" that the = sign be present for these matches. +" This adds the matches back for pug. +syn keyword pugHtmlArg contained href title + +syn match pugPlainChar "\\" contained +syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript +syn match pugInterpolationEscape "\\\@[?!]\@!" +syn match pugScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!" +syn region pugScriptLoopRegion start="^\s*\(for \)" end="$" contains=pugScriptLoopKeywords +syn keyword pugScriptLoopKeywords for in contained + +syn region pugJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,pugJavascriptTag,pugCoffeescriptFilter keepend + +syn region pugCoffeescriptFilter matchgroup=pugFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained +syn region pugJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=pugBegin,pugTag +syn region pugCssBlock start="^\z(\s*\)style" nextgroup=@pugComponent,pugError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend + +syn match pugError "\$" contained + +hi def link pugPlainChar Special +hi def link pugScriptConditional PreProc +hi def link pugScriptLoopKeywords PreProc +hi def link pugScriptStatement PreProc +hi def link pugHtmlArg htmlArg +hi def link pugAttributeString String +hi def link pugAttributesDelimiter Identifier +hi def link pugIdChar Special +hi def link pugClassChar Special +hi def link pugBlockExpansionChar Special +hi def link pugPipeChar Special +hi def link pugTagBlockChar Special +hi def link pugId Identifier +hi def link pugClass Type +hi def link pugInterpolationDelimiter Delimiter +hi def link pugInlineDelimiter Delimiter +hi def link pugFilter PreProc +hi def link pugDocType PreProc +hi def link pugCommentTodo Todo +hi def link pugComment Comment +hi def link pugCommentBlock Comment +hi def link pugHtmlConditionalComment pugComment +hi def link pugJavascriptString String + +let b:current_syntax = "pug" + +if main_syntax == "pug" + unlet main_syntax +endif diff --git a/vim/syntax/taskpaper.vim b/vim/syntax/taskpaper.vim new file mode 100644 index 0000000..6be06d1 --- /dev/null +++ b/vim/syntax/taskpaper.vim @@ -0,0 +1,48 @@ +" Vim syntax file +" Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper) +" Maintainer: David O'Callaghan +" URL: https://github.com/davidoc/taskpaper.vim +" Last Change: 2012-03-07 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +if version < 508 + command! -nargs=+ HiLink hi link +else + command! -nargs=+ HiLink hi def link +endif + +" Define tag styles +if !exists('g:task_paper_styles') + let g:task_paper_styles = {'FAIL': 'guibg=Red guifg=White'} +endif + +syn case ignore + +syn match taskpaperComment /^.*$/ contains=taskpaperContext +syn match taskpaperProject /^.\+:\(\s\+@[^ \t(]\+\(([^)]*)\)\?\)*$/ contains=taskpaperContext +syn match taskpaperListItem /^\t*-\s\+/ +syn match taskpaperContext /\s\zs@[^ \t(]\+\(([^)]*)\)\?/ +syn match taskpaperDone /^.*\s@done\(\(\s\|([^)]*)\).*\)\?$/ +syn match taskpaperCancelled /^.*\s@cancelled\(\(\s\|([^)]*)\).*\)\?$/ + +syn sync fromstart + +"highlighting for Taskpaper groups +HiLink taskpaperListItem Identifier +HiLink taskpaperContext Identifier +HiLink taskpaperProject Title +HiLink taskpaperDone NonText +HiLink taskpaperCancelled NonText +HiLink taskpaperComment Comment + +call taskpaper#tag_style_dict(g:task_paper_styles) + +let b:current_syntax = "taskpaper" + +delcommand HiLink +" vim: ts=8 diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..cfdd4db --- /dev/null +++ b/vimrc @@ -0,0 +1,95 @@ +" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just +" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime +" you can find below. If you wish to change any of those settings, you should +" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten +" everytime an upgrade of the vim packages is performed. It is recommended to +" make changes after sourcing debian.vim since it alters the value of the +" 'compatible' option. + +" Uncomment the next line to make Vim more Vi-compatible +" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous +" options, so any other options should be set AFTER setting 'compatible'. +"set compatible + +" Vim5 and later versions support syntax highlighting. Uncommenting the +" following enables syntax highlighting by default. +if has("syntax") + set t_Co=256 + syntax on + " Uncomment the following 'let' lines if using xter16 color scheme + " Select colormap: 'soft', 'softlight', 'standard', or 'allblue' + let xterm16_colormap = 'allblue' + " Select brightness: 'low', 'med', 'high', 'default', or custom levels + let xterm16_brightness = 'high' + "Other override options: + let xterm16fg_Cursor = '555' + let xterm16bg_Normal = 'none' + "Set color scheme + colorscheme xterm16 +endif + +" If using a dark background within the editing area and syntax highlighting +" turn on this option as well +set background=dark + +" Uncomment the following to have Vim jump to the last position when +" reopening a file +if has("autocmd") + au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif +endif + +" Uncomment the following to have Vim load indentation rules and plugins +" according to the detected filetype. +if has("autocmd") + filetype plugin indent on +endif + +" The following are commented out as they cause vim to behave a lot +" differently from regular Vi. They are highly recommended though. +set showcmd " Show (partial) command in status line. +set showmatch " Show matching brackets. +set ignorecase " Do case insensitive matching +set smartcase " Do smart case matching +"set incsearch " Incremental search +"set autowrite " Automatically save before commands like :next and :make +"set hidden " Hide buffers when they are abandoned +set mouse=a " Enable mouse usage (all modes) +set nohlsearch " Turn off search highlighting +"set expandtab " Turn tabs to spaces +set shiftwidth=4 " Auto-indent amount when using cindent, <<, >>, etc. +set softtabstop=4 " How many spaces represent a tab +set tabstop=4 " Real tab size +set autoindent " Indent level of new line set by previous line +"set smartindent " Attempt to intelligently guess level of indent for new line +set cindent " Attempt to intelligently guess level of indent for new line +set cinkeys-=0# " Don't un-indent comments +set indentkeys-=0# " Don't un-indent comments +set nf=octal,hex,alpha " additional ctrl-a increments +set spell spelllang=en_us " Set spell check language +set scrolloff=5 " Add visible lines beyond cursor at top or bottom of window + +noremap n nzz +noremap N Nzz +noremap * *zz +noremap # #zz +noremap g* g*zz +noremap g# g#zz + +autocmd FileType plaintex,tex,latex syntax spell toplevel +autocmd FileType plaintex,tex,latex set tw=80 +autocmd FileType pug,jade set tw=80 + +au BufNewFile,BufRead *.cu set filetype=c +au BufNewFile,BufRead *.tp set filetype=taskpaper + +aug python + " to override ftype/python.vim + au FileType python setlocal ts=4 sts=4 sw=4 noexpandtab +aug end + +" Source a global configuration file if available +if filereadable("/etc/vim/vimrc.local") + source /etc/vim/vimrc.local +endif + +syntax spell toplevel