From dd479da78a3280c8739ed77bdc2ce3d138f56be6 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Sun, 28 Oct 2012 11:18:25 -0500 Subject: [PATCH 01/17] Added Tomorrow theme to project, other updates + Added tomorrow theme + added spectrum.zsh + added zsh/lib directory + updated prompt + updated colors + set vim theme to Tomorrow-Night-Bright + moved some zsh files to zsh/lib --- .../colors/Tomorrow-Night-Blue.vim | 347 +++++++++++++++++ .../colors/Tomorrow-Night-Bright.vim | 347 +++++++++++++++++ .../colors/Tomorrow-Night-Eighties.vim | 347 +++++++++++++++++ vim/vim.symlink/colors/Tomorrow-Night.vim | 362 ++++++++++++++++++ vim/vim.symlink/colors/Tomorrow.vim | 347 +++++++++++++++++ vim/vimrc.symlink | 2 +- zsh/colors.zsh | 1 + zsh/{ => lib}/aliases.zsh | 0 zsh/{ => lib}/completion.zsh | 0 zsh/lib/spectrum.zsh | 28 ++ zsh/prompt.zsh | 2 +- 11 files changed, 1781 insertions(+), 2 deletions(-) create mode 100644 vim/vim.symlink/colors/Tomorrow-Night-Blue.vim create mode 100644 vim/vim.symlink/colors/Tomorrow-Night-Bright.vim create mode 100644 vim/vim.symlink/colors/Tomorrow-Night-Eighties.vim create mode 100644 vim/vim.symlink/colors/Tomorrow-Night.vim create mode 100644 vim/vim.symlink/colors/Tomorrow.vim rename zsh/{ => lib}/aliases.zsh (100%) rename zsh/{ => lib}/completion.zsh (100%) create mode 100644 zsh/lib/spectrum.zsh diff --git a/vim/vim.symlink/colors/Tomorrow-Night-Blue.vim b/vim/vim.symlink/colors/Tomorrow-Night-Blue.vim new file mode 100644 index 0000000..911c99d --- /dev/null +++ b/vim/vim.symlink/colors/Tomorrow-Night-Blue.vim @@ -0,0 +1,347 @@ +" Tomorrow Night Blue - Full Colour and 256 Colour +" http://chriskempson.com +" +" Hex colour conversion functions borrowed from the theme "Desert256"" + +" Default GUI Colours +let s:foreground = "ffffff" +let s:background = "002451" +let s:selection = "003f8e" +let s:line = "00346e" +let s:comment = "7285b7" +let s:red = "ff9da4" +let s:orange = "ffc58f" +let s:yellow = "ffeead" +let s:green = "d1f1a9" +let s:aqua = "99ffff" +let s:blue = "bbdaff" +let s:purple = "ebbbff" +let s:window = "4d5057" + +set background=dark +hi clear +syntax reset + +let g:colors_name = "Tomorrow-Night-Blue" + +if has("gui_running") || &t_Co == 88 || &t_Co == 256 + " Returns an approximate grey index for the given grey level + fun grey_number(x) + if &t_Co == 88 + if a:x < 23 + return 0 + elseif a:x < 69 + return 1 + elseif a:x < 103 + return 2 + elseif a:x < 127 + return 3 + elseif a:x < 150 + return 4 + elseif a:x < 173 + return 5 + elseif a:x < 196 + return 6 + elseif a:x < 219 + return 7 + elseif a:x < 243 + return 8 + else + return 9 + endif + else + if a:x < 14 + return 0 + else + let l:n = (a:x - 8) / 10 + let l:m = (a:x - 8) % 10 + if l:m < 5 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual grey level represented by the grey index + fun grey_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 46 + elseif a:n == 2 + return 92 + elseif a:n == 3 + return 115 + elseif a:n == 4 + return 139 + elseif a:n == 5 + return 162 + elseif a:n == 6 + return 185 + elseif a:n == 7 + return 208 + elseif a:n == 8 + return 231 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 8 + (a:n * 10) + endif + endif + endfun + + " Returns the palette index for the given grey index + fun grey_colour(n) + if &t_Co == 88 + if a:n == 0 + return 16 + elseif a:n == 9 + return 79 + else + return 79 + a:n + endif + else + if a:n == 0 + return 16 + elseif a:n == 25 + return 231 + else + return 231 + a:n + endif + endif + endfun + + " Returns an approximate colour index for the given colour level + fun rgb_number(x) + if &t_Co == 88 + if a:x < 69 + return 0 + elseif a:x < 172 + return 1 + elseif a:x < 230 + return 2 + else + return 3 + endif + else + if a:x < 75 + return 0 + else + let l:n = (a:x - 55) / 40 + let l:m = (a:x - 55) % 40 + if l:m < 20 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual colour level for the given colour index + fun rgb_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 139 + elseif a:n == 2 + return 205 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 55 + (a:n * 40) + endif + endif + endfun + + " Returns the palette index for the given R/G/B colour indices + fun rgb_colour(x, y, z) + if &t_Co == 88 + return 16 + (a:x * 16) + (a:y * 4) + a:z + else + return 16 + (a:x * 36) + (a:y * 6) + a:z + endif + endfun + + " Returns the palette index to approximate the given R/G/B colour levels + fun colour(r, g, b) + " Get the closest grey + let l:gx = grey_number(a:r) + let l:gy = grey_number(a:g) + let l:gz = grey_number(a:b) + + " Get the closest colour + let l:x = rgb_number(a:r) + let l:y = rgb_number(a:g) + let l:z = rgb_number(a:b) + + if l:gx == l:gy && l:gy == l:gz + " There are two possibilities + let l:dgr = grey_level(l:gx) - a:r + let l:dgg = grey_level(l:gy) - a:g + let l:dgb = grey_level(l:gz) - a:b + let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) + let l:dr = rgb_level(l:gx) - a:r + let l:dg = rgb_level(l:gy) - a:g + let l:db = rgb_level(l:gz) - a:b + let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) + if l:dgrey < l:drgb + " Use the grey + return grey_colour(l:gx) + else + " Use the colour + return rgb_colour(l:x, l:y, l:z) + endif + else + " Only one possibility + return rgb_colour(l:x, l:y, l:z) + endif + endfun + + " Returns the palette index to approximate the 'rrggbb' hex string + fun rgb(rgb) + let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 + let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 + let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 + + return colour(l:r, l:g, l:b) + endfun + + " Sets the highlighting for the given group + fun X(group, fg, bg, attr) + if a:fg != "" + exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) + endif + if a:bg != "" + exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) + endif + if a:attr != "" + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + endif + endfun + + " Vim Highlighting + call X("Normal", s:foreground, s:background, "") + call X("LineNr", s:selection, "", "") + call X("NonText", s:selection, "", "") + call X("SpecialKey", s:selection, "", "") + call X("Search", s:background, s:yellow, "") + call X("TabLine", s:foreground, s:background, "reverse") + call X("StatusLine", s:window, s:yellow, "reverse") + call X("StatusLineNC", s:window, s:foreground, "reverse") + call X("VertSplit", s:window, s:window, "none") + call X("Visual", "", s:selection, "") + call X("Directory", s:blue, "", "") + call X("ModeMsg", s:green, "", "") + call X("MoreMsg", s:green, "", "") + call X("Question", s:green, "", "") + call X("WarningMsg", s:red, "", "") + call X("MatchParen", "", s:selection, "") + call X("Folded", s:comment, s:background, "") + call X("FoldColumn", "", s:background, "") + if version >= 700 + call X("CursorLine", "", s:line, "none") + call X("CursorColumn", "", s:line, "none") + call X("PMenu", s:foreground, s:selection, "none") + call X("PMenuSel", s:foreground, s:selection, "reverse") + end + if version >= 703 + call X("ColorColumn", "", s:line, "none") + end + + " Standard Highlighting + call X("Comment", s:comment, "", "") + call X("Todo", s:comment, s:background, "") + call X("Title", s:comment, "", "") + call X("Identifier", s:red, "", "none") + call X("Statement", s:foreground, "", "") + call X("Conditional", s:foreground, "", "") + call X("Repeat", s:foreground, "", "") + call X("Structure", s:purple, "", "") + call X("Function", s:blue, "", "") + call X("Constant", s:orange, "", "") + call X("String", s:green, "", "") + call X("Special", s:foreground, "", "") + call X("PreProc", s:purple, "", "") + call X("Operator", s:aqua, "", "none") + call X("Type", s:blue, "", "none") + call X("Define", s:purple, "", "none") + call X("Include", s:blue, "", "") + "call X("Ignore", "666666", "", "") + + " Vim Highlighting + call X("vimCommand", s:red, "", "none") + + " C Highlighting + call X("cType", s:yellow, "", "") + call X("cStorageClass", s:purple, "", "") + call X("cConditional", s:purple, "", "") + call X("cRepeat", s:purple, "", "") + + " PHP Highlighting + call X("phpVarSelector", s:red, "", "") + call X("phpKeyword", s:purple, "", "") + call X("phpRepeat", s:purple, "", "") + call X("phpConditional", s:purple, "", "") + call X("phpStatement", s:purple, "", "") + call X("phpMemberSelector", s:foreground, "", "") + + " Ruby Highlighting + call X("rubySymbol", s:green, "", "") + call X("rubyConstant", s:yellow, "", "") + call X("rubyAttribute", s:blue, "", "") + call X("rubyInclude", s:blue, "", "") + call X("rubyLocalVariableOrMethod", s:orange, "", "") + call X("rubyCurlyBlock", s:orange, "", "") + call X("rubyStringDelimiter", s:green, "", "") + call X("rubyInterpolationDelimiter", s:orange, "", "") + call X("rubyConditional", s:purple, "", "") + call X("rubyRepeat", s:purple, "", "") + + " Python Highlighting + call X("pythonInclude", s:purple, "", "") + call X("pythonStatement", s:purple, "", "") + call X("pythonConditional", s:purple, "", "") + call X("pythonFunction", s:blue, "", "") + + " JavaScript Highlighting + call X("javaScriptBraces", s:foreground, "", "") + call X("javaScriptFunction", s:purple, "", "") + call X("javaScriptConditional", s:purple, "", "") + call X("javaScriptRepeat", s:purple, "", "") + call X("javaScriptNumber", s:orange, "", "") + call X("javaScriptMember", s:orange, "", "") + + " HTML Highlighting + call X("htmlTag", s:red, "", "") + call X("htmlTagName", s:red, "", "") + call X("htmlArg", s:red, "", "") + call X("htmlScriptTag", s:red, "", "") + + " Diff Highlighting + call X("diffAdded", s:green, "", "") + call X("diffRemoved", s:red, "", "") + + " Delete Functions + delf X + delf rgb + delf colour + delf rgb_colour + delf rgb_level + delf rgb_number + delf grey_colour + delf grey_level + delf grey_number +endif diff --git a/vim/vim.symlink/colors/Tomorrow-Night-Bright.vim b/vim/vim.symlink/colors/Tomorrow-Night-Bright.vim new file mode 100644 index 0000000..c222f4e --- /dev/null +++ b/vim/vim.symlink/colors/Tomorrow-Night-Bright.vim @@ -0,0 +1,347 @@ +" Tomorrow Night Bright - Full Colour and 256 Colour +" http://chriskempson.com +" +" Hex colour conversion functions borrowed from the theme "Desert256"" + +" Default GUI Colours +let s:foreground = "eaeaea" +let s:background = "000000" +let s:selection = "424242" +let s:line = "2a2a2a" +let s:comment = "969896" +let s:red = "d54e53" +let s:orange = "e78c45" +let s:yellow = "e7c547" +let s:green = "b9ca4a" +let s:aqua = "70c0b1" +let s:blue = "7aa6da" +let s:purple = "c397d8" +let s:window = "4d5057" + +set background=dark +hi clear +syntax reset + +let g:colors_name = "Tomorrow-Night-Bright" + +if has("gui_running") || &t_Co == 88 || &t_Co == 256 + " Returns an approximate grey index for the given grey level + fun grey_number(x) + if &t_Co == 88 + if a:x < 23 + return 0 + elseif a:x < 69 + return 1 + elseif a:x < 103 + return 2 + elseif a:x < 127 + return 3 + elseif a:x < 150 + return 4 + elseif a:x < 173 + return 5 + elseif a:x < 196 + return 6 + elseif a:x < 219 + return 7 + elseif a:x < 243 + return 8 + else + return 9 + endif + else + if a:x < 14 + return 0 + else + let l:n = (a:x - 8) / 10 + let l:m = (a:x - 8) % 10 + if l:m < 5 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual grey level represented by the grey index + fun grey_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 46 + elseif a:n == 2 + return 92 + elseif a:n == 3 + return 115 + elseif a:n == 4 + return 139 + elseif a:n == 5 + return 162 + elseif a:n == 6 + return 185 + elseif a:n == 7 + return 208 + elseif a:n == 8 + return 231 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 8 + (a:n * 10) + endif + endif + endfun + + " Returns the palette index for the given grey index + fun grey_colour(n) + if &t_Co == 88 + if a:n == 0 + return 16 + elseif a:n == 9 + return 79 + else + return 79 + a:n + endif + else + if a:n == 0 + return 16 + elseif a:n == 25 + return 231 + else + return 231 + a:n + endif + endif + endfun + + " Returns an approximate colour index for the given colour level + fun rgb_number(x) + if &t_Co == 88 + if a:x < 69 + return 0 + elseif a:x < 172 + return 1 + elseif a:x < 230 + return 2 + else + return 3 + endif + else + if a:x < 75 + return 0 + else + let l:n = (a:x - 55) / 40 + let l:m = (a:x - 55) % 40 + if l:m < 20 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual colour level for the given colour index + fun rgb_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 139 + elseif a:n == 2 + return 205 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 55 + (a:n * 40) + endif + endif + endfun + + " Returns the palette index for the given R/G/B colour indices + fun rgb_colour(x, y, z) + if &t_Co == 88 + return 16 + (a:x * 16) + (a:y * 4) + a:z + else + return 16 + (a:x * 36) + (a:y * 6) + a:z + endif + endfun + + " Returns the palette index to approximate the given R/G/B colour levels + fun colour(r, g, b) + " Get the closest grey + let l:gx = grey_number(a:r) + let l:gy = grey_number(a:g) + let l:gz = grey_number(a:b) + + " Get the closest colour + let l:x = rgb_number(a:r) + let l:y = rgb_number(a:g) + let l:z = rgb_number(a:b) + + if l:gx == l:gy && l:gy == l:gz + " There are two possibilities + let l:dgr = grey_level(l:gx) - a:r + let l:dgg = grey_level(l:gy) - a:g + let l:dgb = grey_level(l:gz) - a:b + let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) + let l:dr = rgb_level(l:gx) - a:r + let l:dg = rgb_level(l:gy) - a:g + let l:db = rgb_level(l:gz) - a:b + let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) + if l:dgrey < l:drgb + " Use the grey + return grey_colour(l:gx) + else + " Use the colour + return rgb_colour(l:x, l:y, l:z) + endif + else + " Only one possibility + return rgb_colour(l:x, l:y, l:z) + endif + endfun + + " Returns the palette index to approximate the 'rrggbb' hex string + fun rgb(rgb) + let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 + let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 + let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 + + return colour(l:r, l:g, l:b) + endfun + + " Sets the highlighting for the given group + fun X(group, fg, bg, attr) + if a:fg != "" + exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) + endif + if a:bg != "" + exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) + endif + if a:attr != "" + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + endif + endfun + + " Vim Highlighting + call X("Normal", s:foreground, s:background, "") + call X("LineNr", s:selection, "", "") + call X("NonText", s:selection, "", "") + call X("SpecialKey", s:selection, "", "") + call X("Search", s:background, s:yellow, "") + call X("TabLine", s:foreground, s:background, "reverse") + call X("StatusLine", s:window, s:yellow, "reverse") + call X("StatusLineNC", s:window, s:foreground, "reverse") + call X("VertSplit", s:window, s:window, "none") + call X("Visual", "", s:selection, "") + call X("Directory", s:blue, "", "") + call X("ModeMsg", s:green, "", "") + call X("MoreMsg", s:green, "", "") + call X("Question", s:green, "", "") + call X("WarningMsg", s:red, "", "") + call X("MatchParen", "", s:selection, "") + call X("Folded", s:comment, s:background, "") + call X("FoldColumn", "", s:background, "") + if version >= 700 + call X("CursorLine", "", s:line, "none") + call X("CursorColumn", "", s:line, "none") + call X("PMenu", s:foreground, s:selection, "none") + call X("PMenuSel", s:foreground, s:selection, "reverse") + end + if version >= 703 + call X("ColorColumn", "", s:line, "none") + end + + " Standard Highlighting + call X("Comment", s:comment, "", "") + call X("Todo", s:comment, s:background, "") + call X("Title", s:comment, "", "") + call X("Identifier", s:red, "", "none") + call X("Statement", s:foreground, "", "") + call X("Conditional", s:foreground, "", "") + call X("Repeat", s:foreground, "", "") + call X("Structure", s:purple, "", "") + call X("Function", s:blue, "", "") + call X("Constant", s:orange, "", "") + call X("String", s:green, "", "") + call X("Special", s:foreground, "", "") + call X("PreProc", s:purple, "", "") + call X("Operator", s:aqua, "", "none") + call X("Type", s:blue, "", "none") + call X("Define", s:purple, "", "none") + call X("Include", s:blue, "", "") + "call X("Ignore", "666666", "", "") + + " Vim Highlighting + call X("vimCommand", s:red, "", "none") + + " C Highlighting + call X("cType", s:yellow, "", "") + call X("cStorageClass", s:purple, "", "") + call X("cConditional", s:purple, "", "") + call X("cRepeat", s:purple, "", "") + + " PHP Highlighting + call X("phpVarSelector", s:red, "", "") + call X("phpKeyword", s:purple, "", "") + call X("phpRepeat", s:purple, "", "") + call X("phpConditional", s:purple, "", "") + call X("phpStatement", s:purple, "", "") + call X("phpMemberSelector", s:foreground, "", "") + + " Ruby Highlighting + call X("rubySymbol", s:green, "", "") + call X("rubyConstant", s:yellow, "", "") + call X("rubyAttribute", s:blue, "", "") + call X("rubyInclude", s:blue, "", "") + call X("rubyLocalVariableOrMethod", s:orange, "", "") + call X("rubyCurlyBlock", s:orange, "", "") + call X("rubyStringDelimiter", s:green, "", "") + call X("rubyInterpolationDelimiter", s:orange, "", "") + call X("rubyConditional", s:purple, "", "") + call X("rubyRepeat", s:purple, "", "") + + " Python Highlighting + call X("pythonInclude", s:purple, "", "") + call X("pythonStatement", s:purple, "", "") + call X("pythonConditional", s:purple, "", "") + call X("pythonFunction", s:blue, "", "") + + " JavaScript Highlighting + call X("javaScriptBraces", s:foreground, "", "") + call X("javaScriptFunction", s:purple, "", "") + call X("javaScriptConditional", s:purple, "", "") + call X("javaScriptRepeat", s:purple, "", "") + call X("javaScriptNumber", s:orange, "", "") + call X("javaScriptMember", s:orange, "", "") + + " HTML Highlighting + call X("htmlTag", s:red, "", "") + call X("htmlTagName", s:red, "", "") + call X("htmlArg", s:red, "", "") + call X("htmlScriptTag", s:red, "", "") + + " Diff Highlighting + call X("diffAdded", s:green, "", "") + call X("diffRemoved", s:red, "", "") + + " Delete Functions + delf X + delf rgb + delf colour + delf rgb_colour + delf rgb_level + delf rgb_number + delf grey_colour + delf grey_level + delf grey_number +endif diff --git a/vim/vim.symlink/colors/Tomorrow-Night-Eighties.vim b/vim/vim.symlink/colors/Tomorrow-Night-Eighties.vim new file mode 100644 index 0000000..7426924 --- /dev/null +++ b/vim/vim.symlink/colors/Tomorrow-Night-Eighties.vim @@ -0,0 +1,347 @@ +" Tomorrow Night Eighties - Full Colour and 256 Colour +" http://chriskempson.com +" +" Hex colour conversion functions borrowed from the theme "Desert256"" + +" Default GUI Colours +let s:foreground = "cccccc" +let s:background = "2d2d2d" +let s:selection = "515151" +let s:line = "393939" +let s:comment = "999999" +let s:red = "f2777a" +let s:orange = "f99157" +let s:yellow = "ffcc66" +let s:green = "99cc99" +let s:aqua = "009999" +let s:blue = "99cccc" +let s:purple = "cc99cc" +let s:window = "4d5057" + +set background=dark +hi clear +syntax reset + +let g:colors_name = "Tomorrow-Night-Eighties" + +if has("gui_running") || &t_Co == 88 || &t_Co == 256 + " Returns an approximate grey index for the given grey level + fun grey_number(x) + if &t_Co == 88 + if a:x < 23 + return 0 + elseif a:x < 69 + return 1 + elseif a:x < 103 + return 2 + elseif a:x < 127 + return 3 + elseif a:x < 150 + return 4 + elseif a:x < 173 + return 5 + elseif a:x < 196 + return 6 + elseif a:x < 219 + return 7 + elseif a:x < 243 + return 8 + else + return 9 + endif + else + if a:x < 14 + return 0 + else + let l:n = (a:x - 8) / 10 + let l:m = (a:x - 8) % 10 + if l:m < 5 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual grey level represented by the grey index + fun grey_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 46 + elseif a:n == 2 + return 92 + elseif a:n == 3 + return 115 + elseif a:n == 4 + return 139 + elseif a:n == 5 + return 162 + elseif a:n == 6 + return 185 + elseif a:n == 7 + return 208 + elseif a:n == 8 + return 231 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 8 + (a:n * 10) + endif + endif + endfun + + " Returns the palette index for the given grey index + fun grey_colour(n) + if &t_Co == 88 + if a:n == 0 + return 16 + elseif a:n == 9 + return 79 + else + return 79 + a:n + endif + else + if a:n == 0 + return 16 + elseif a:n == 25 + return 231 + else + return 231 + a:n + endif + endif + endfun + + " Returns an approximate colour index for the given colour level + fun rgb_number(x) + if &t_Co == 88 + if a:x < 69 + return 0 + elseif a:x < 172 + return 1 + elseif a:x < 230 + return 2 + else + return 3 + endif + else + if a:x < 75 + return 0 + else + let l:n = (a:x - 55) / 40 + let l:m = (a:x - 55) % 40 + if l:m < 20 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual colour level for the given colour index + fun rgb_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 139 + elseif a:n == 2 + return 205 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 55 + (a:n * 40) + endif + endif + endfun + + " Returns the palette index for the given R/G/B colour indices + fun rgb_colour(x, y, z) + if &t_Co == 88 + return 16 + (a:x * 16) + (a:y * 4) + a:z + else + return 16 + (a:x * 36) + (a:y * 6) + a:z + endif + endfun + + " Returns the palette index to approximate the given R/G/B colour levels + fun colour(r, g, b) + " Get the closest grey + let l:gx = grey_number(a:r) + let l:gy = grey_number(a:g) + let l:gz = grey_number(a:b) + + " Get the closest colour + let l:x = rgb_number(a:r) + let l:y = rgb_number(a:g) + let l:z = rgb_number(a:b) + + if l:gx == l:gy && l:gy == l:gz + " There are two possibilities + let l:dgr = grey_level(l:gx) - a:r + let l:dgg = grey_level(l:gy) - a:g + let l:dgb = grey_level(l:gz) - a:b + let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) + let l:dr = rgb_level(l:gx) - a:r + let l:dg = rgb_level(l:gy) - a:g + let l:db = rgb_level(l:gz) - a:b + let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) + if l:dgrey < l:drgb + " Use the grey + return grey_colour(l:gx) + else + " Use the colour + return rgb_colour(l:x, l:y, l:z) + endif + else + " Only one possibility + return rgb_colour(l:x, l:y, l:z) + endif + endfun + + " Returns the palette index to approximate the 'rrggbb' hex string + fun rgb(rgb) + let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 + let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 + let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 + + return colour(l:r, l:g, l:b) + endfun + + " Sets the highlighting for the given group + fun X(group, fg, bg, attr) + if a:fg != "" + exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) + endif + if a:bg != "" + exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) + endif + if a:attr != "" + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + endif + endfun + + " Vim Highlighting + call X("Normal", s:foreground, s:background, "") + call X("LineNr", s:selection, "", "") + call X("NonText", s:selection, "", "") + call X("SpecialKey", s:selection, "", "") + call X("Search", s:background, s:yellow, "") + call X("TabLine", s:foreground, s:background, "reverse") + call X("StatusLine", s:window, s:yellow, "reverse") + call X("StatusLineNC", s:window, s:foreground, "reverse") + call X("VertSplit", s:window, s:window, "none") + call X("Visual", "", s:selection, "") + call X("Directory", s:blue, "", "") + call X("ModeMsg", s:green, "", "") + call X("MoreMsg", s:green, "", "") + call X("Question", s:green, "", "") + call X("WarningMsg", s:red, "", "") + call X("MatchParen", "", s:selection, "") + call X("Folded", s:comment, s:background, "") + call X("FoldColumn", "", s:background, "") + if version >= 700 + call X("CursorLine", "", s:line, "none") + call X("CursorColumn", "", s:line, "none") + call X("PMenu", s:foreground, s:selection, "none") + call X("PMenuSel", s:foreground, s:selection, "reverse") + end + if version >= 703 + call X("ColorColumn", "", s:line, "none") + end + + " Standard Highlighting + call X("Comment", s:comment, "", "") + call X("Todo", s:comment, s:background, "") + call X("Title", s:comment, "", "") + call X("Identifier", s:red, "", "none") + call X("Statement", s:foreground, "", "") + call X("Conditional", s:foreground, "", "") + call X("Repeat", s:foreground, "", "") + call X("Structure", s:purple, "", "") + call X("Function", s:blue, "", "") + call X("Constant", s:orange, "", "") + call X("String", s:green, "", "") + call X("Special", s:foreground, "", "") + call X("PreProc", s:purple, "", "") + call X("Operator", s:aqua, "", "none") + call X("Type", s:blue, "", "none") + call X("Define", s:purple, "", "none") + call X("Include", s:blue, "", "") + "call X("Ignore", "666666", "", "") + + " Vim Highlighting + call X("vimCommand", s:red, "", "none") + + " C Highlighting + call X("cType", s:yellow, "", "") + call X("cStorageClass", s:purple, "", "") + call X("cConditional", s:purple, "", "") + call X("cRepeat", s:purple, "", "") + + " PHP Highlighting + call X("phpVarSelector", s:red, "", "") + call X("phpKeyword", s:purple, "", "") + call X("phpRepeat", s:purple, "", "") + call X("phpConditional", s:purple, "", "") + call X("phpStatement", s:purple, "", "") + call X("phpMemberSelector", s:foreground, "", "") + + " Ruby Highlighting + call X("rubySymbol", s:green, "", "") + call X("rubyConstant", s:yellow, "", "") + call X("rubyAttribute", s:blue, "", "") + call X("rubyInclude", s:blue, "", "") + call X("rubyLocalVariableOrMethod", s:orange, "", "") + call X("rubyCurlyBlock", s:orange, "", "") + call X("rubyStringDelimiter", s:green, "", "") + call X("rubyInterpolationDelimiter", s:orange, "", "") + call X("rubyConditional", s:purple, "", "") + call X("rubyRepeat", s:purple, "", "") + + " Python Highlighting + call X("pythonInclude", s:purple, "", "") + call X("pythonStatement", s:purple, "", "") + call X("pythonConditional", s:purple, "", "") + call X("pythonFunction", s:blue, "", "") + + " JavaScript Highlighting + call X("javaScriptBraces", s:foreground, "", "") + call X("javaScriptFunction", s:purple, "", "") + call X("javaScriptConditional", s:purple, "", "") + call X("javaScriptRepeat", s:purple, "", "") + call X("javaScriptNumber", s:orange, "", "") + call X("javaScriptMember", s:orange, "", "") + + " HTML Highlighting + call X("htmlTag", s:red, "", "") + call X("htmlTagName", s:red, "", "") + call X("htmlArg", s:red, "", "") + call X("htmlScriptTag", s:red, "", "") + + " Diff Highlighting + call X("diffAdded", s:green, "", "") + call X("diffRemoved", s:red, "", "") + + " Delete Functions + delf X + delf rgb + delf colour + delf rgb_colour + delf rgb_level + delf rgb_number + delf grey_colour + delf grey_level + delf grey_number +endif diff --git a/vim/vim.symlink/colors/Tomorrow-Night.vim b/vim/vim.symlink/colors/Tomorrow-Night.vim new file mode 100644 index 0000000..208b6d4 --- /dev/null +++ b/vim/vim.symlink/colors/Tomorrow-Night.vim @@ -0,0 +1,362 @@ +" Tomorrow Night - Full Colour and 256 Colour +" http://chriskempson.com +" +" Hex colour conversion functions borrowed from the theme "Desert256"" + +" Default GUI Colours +let s:foreground = "c5c8c6" +let s:background = "1d1f21" +let s:selection = "373b41" +let s:line = "282a2e" +let s:comment = "969896" +let s:red = "cc6666" +let s:orange = "de935f" +let s:yellow = "f0c674" +let s:green = "b5bd68" +let s:aqua = "8abeb7" +let s:blue = "81a2be" +let s:purple = "b294bb" +let s:window = "4d5057" + +" Console 256 Colours +if !has("gui_running") + let s:background = "303030" + let s:window = "5e5e5e" + let s:line = "3a3a3a" + let s:selection = "585858" +end + +set background=dark +hi clear +syntax reset + +let g:colors_name = "Tomorrow-Night" + +if has("gui_running") || &t_Co == 88 || &t_Co == 256 + " Returns an approximate grey index for the given grey level + fun grey_number(x) + if &t_Co == 88 + if a:x < 23 + return 0 + elseif a:x < 69 + return 1 + elseif a:x < 103 + return 2 + elseif a:x < 127 + return 3 + elseif a:x < 150 + return 4 + elseif a:x < 173 + return 5 + elseif a:x < 196 + return 6 + elseif a:x < 219 + return 7 + elseif a:x < 243 + return 8 + else + return 9 + endif + else + if a:x < 14 + return 0 + else + let l:n = (a:x - 8) / 10 + let l:m = (a:x - 8) % 10 + if l:m < 5 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual grey level represented by the grey index + fun grey_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 46 + elseif a:n == 2 + return 92 + elseif a:n == 3 + return 115 + elseif a:n == 4 + return 139 + elseif a:n == 5 + return 162 + elseif a:n == 6 + return 185 + elseif a:n == 7 + return 208 + elseif a:n == 8 + return 231 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 8 + (a:n * 10) + endif + endif + endfun + + " Returns the palette index for the given grey index + fun grey_colour(n) + if &t_Co == 88 + if a:n == 0 + return 16 + elseif a:n == 9 + return 79 + else + return 79 + a:n + endif + else + if a:n == 0 + return 16 + elseif a:n == 25 + return 231 + else + return 231 + a:n + endif + endif + endfun + + " Returns an approximate colour index for the given colour level + fun rgb_number(x) + if &t_Co == 88 + if a:x < 69 + return 0 + elseif a:x < 172 + return 1 + elseif a:x < 230 + return 2 + else + return 3 + endif + else + if a:x < 75 + return 0 + else + let l:n = (a:x - 55) / 40 + let l:m = (a:x - 55) % 40 + if l:m < 20 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual colour level for the given colour index + fun rgb_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 139 + elseif a:n == 2 + return 205 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 55 + (a:n * 40) + endif + endif + endfun + + " Returns the palette index for the given R/G/B colour indices + fun rgb_colour(x, y, z) + if &t_Co == 88 + return 16 + (a:x * 16) + (a:y * 4) + a:z + else + return 16 + (a:x * 36) + (a:y * 6) + a:z + endif + endfun + + " Returns the palette index to approximate the given R/G/B colour levels + fun colour(r, g, b) + " Get the closest grey + let l:gx = grey_number(a:r) + let l:gy = grey_number(a:g) + let l:gz = grey_number(a:b) + + " Get the closest colour + let l:x = rgb_number(a:r) + let l:y = rgb_number(a:g) + let l:z = rgb_number(a:b) + + if l:gx == l:gy && l:gy == l:gz + " There are two possibilities + let l:dgr = grey_level(l:gx) - a:r + let l:dgg = grey_level(l:gy) - a:g + let l:dgb = grey_level(l:gz) - a:b + let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) + let l:dr = rgb_level(l:gx) - a:r + let l:dg = rgb_level(l:gy) - a:g + let l:db = rgb_level(l:gz) - a:b + let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) + if l:dgrey < l:drgb + " Use the grey + return grey_colour(l:gx) + else + " Use the colour + return rgb_colour(l:x, l:y, l:z) + endif + else + " Only one possibility + return rgb_colour(l:x, l:y, l:z) + endif + endfun + + " Returns the palette index to approximate the 'rrggbb' hex string + fun rgb(rgb) + let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 + let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 + let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 + + return colour(l:r, l:g, l:b) + endfun + + " Sets the highlighting for the given group + fun X(group, fg, bg, attr) + if a:fg != "" + exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) + endif + if a:bg != "" + exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) + endif + if a:attr != "" + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + endif + endfun + + " Vim Highlighting + call X("Normal", s:foreground, s:background, "") + call X("LineNr", s:selection, "", "") + call X("NonText", s:selection, "", "") + call X("SpecialKey", s:selection, "", "") + call X("Search", s:background, s:yellow, "") + call X("TabLine", s:foreground, s:background, "reverse") + call X("StatusLine", s:window, s:yellow, "reverse") + call X("StatusLineNC", s:window, s:foreground, "reverse") + call X("VertSplit", s:window, s:window, "none") + call X("Visual", "", s:selection, "") + call X("Directory", s:blue, "", "") + call X("ModeMsg", s:green, "", "") + call X("MoreMsg", s:green, "", "") + call X("Question", s:green, "", "") + call X("WarningMsg", s:red, "", "") + call X("MatchParen", "", s:selection, "") + call X("Folded", s:comment, s:background, "") + call X("FoldColumn", "", s:background, "") + if version >= 700 + call X("CursorLine", "", s:line, "none") + call X("CursorColumn", "", s:line, "none") + call X("PMenu", s:foreground, s:selection, "none") + call X("PMenuSel", s:foreground, s:selection, "reverse") + call X("SignColumn", "", s:background, "none") + end + if version >= 703 + call X("ColorColumn", "", s:line, "none") + end + + " Standard Highlighting + call X("Comment", s:comment, "", "") + call X("Todo", s:comment, s:background, "") + call X("Title", s:comment, "", "") + call X("Identifier", s:red, "", "none") + call X("Statement", s:foreground, "", "") + call X("Conditional", s:foreground, "", "") + call X("Repeat", s:foreground, "", "") + call X("Structure", s:purple, "", "") + call X("Function", s:blue, "", "") + call X("Constant", s:orange, "", "") + call X("String", s:green, "", "") + call X("Special", s:foreground, "", "") + call X("PreProc", s:purple, "", "") + call X("Operator", s:aqua, "", "none") + call X("Type", s:blue, "", "none") + call X("Define", s:purple, "", "none") + call X("Include", s:blue, "", "") + "call X("Ignore", "666666", "", "") + + " Vim Highlighting + call X("vimCommand", s:red, "", "none") + + " C Highlighting + call X("cType", s:yellow, "", "") + call X("cStorageClass", s:purple, "", "") + call X("cConditional", s:purple, "", "") + call X("cRepeat", s:purple, "", "") + + " PHP Highlighting + call X("phpVarSelector", s:red, "", "") + call X("phpKeyword", s:purple, "", "") + call X("phpRepeat", s:purple, "", "") + call X("phpConditional", s:purple, "", "") + call X("phpStatement", s:purple, "", "") + call X("phpMemberSelector", s:foreground, "", "") + + " Ruby Highlighting + call X("rubySymbol", s:green, "", "") + call X("rubyConstant", s:yellow, "", "") + call X("rubyAttribute", s:blue, "", "") + call X("rubyInclude", s:blue, "", "") + call X("rubyLocalVariableOrMethod", s:orange, "", "") + call X("rubyCurlyBlock", s:orange, "", "") + call X("rubyStringDelimiter", s:green, "", "") + call X("rubyInterpolationDelimiter", s:orange, "", "") + call X("rubyConditional", s:purple, "", "") + call X("rubyRepeat", s:purple, "", "") + + " Python Highlighting + call X("pythonInclude", s:purple, "", "") + call X("pythonStatement", s:purple, "", "") + call X("pythonConditional", s:purple, "", "") + call X("pythonFunction", s:blue, "", "") + + " JavaScript Highlighting + call X("javaScriptBraces", s:foreground, "", "") + call X("javaScriptFunction", s:purple, "", "") + call X("javaScriptConditional", s:purple, "", "") + call X("javaScriptRepeat", s:purple, "", "") + call X("javaScriptNumber", s:orange, "", "") + call X("javaScriptMember", s:orange, "", "") + + " HTML Highlighting + call X("htmlTag", s:red, "", "") + call X("htmlTagName", s:red, "", "") + call X("htmlArg", s:red, "", "") + call X("htmlScriptTag", s:red, "", "") + + " Diff Highlighting + call X("diffAdded", s:green, "", "") + call X("diffRemoved", s:red, "", "") + + " ShowMarks Highlighting + call X("ShowMarksHLl", s:orange, s:background, "none") + call X("ShowMarksHLo", s:purple, s:background, "none") + call X("ShowMarksHLu", s:yellow, s:background, "none") + call X("ShowMarksHLm", s:aqua, s:background, "none") + + " Delete Functions + delf X + delf rgb + delf colour + delf rgb_colour + delf rgb_level + delf rgb_number + delf grey_colour + delf grey_level + delf grey_number +endif diff --git a/vim/vim.symlink/colors/Tomorrow.vim b/vim/vim.symlink/colors/Tomorrow.vim new file mode 100644 index 0000000..fb58c5f --- /dev/null +++ b/vim/vim.symlink/colors/Tomorrow.vim @@ -0,0 +1,347 @@ +" Tomorrow - Full Colour and 256 Colour +" http://chriskempson.com +" +" Hex colour conversion functions borrowed from the theme "Desert256"" + +" Default GUI Colours +let s:foreground = "4d4d4c" +let s:background = "fafafa" +let s:selection = "d6d6d6" +let s:line = "efefef" +let s:comment = "8e908c" +let s:red = "c82829" +let s:orange = "f5871f" +let s:yellow = "eab700" +let s:green = "718c00" +let s:aqua = "3e999f" +let s:blue = "4271ae" +let s:purple = "8959a8" +let s:window = "efefef" + +set background=light +hi clear +syntax reset + +let g:colors_name = "Tomorrow" + +if has("gui_running") || &t_Co == 88 || &t_Co == 256 + " Returns an approximate grey index for the given grey level + fun grey_number(x) + if &t_Co == 88 + if a:x < 23 + return 0 + elseif a:x < 69 + return 1 + elseif a:x < 103 + return 2 + elseif a:x < 127 + return 3 + elseif a:x < 150 + return 4 + elseif a:x < 173 + return 5 + elseif a:x < 196 + return 6 + elseif a:x < 219 + return 7 + elseif a:x < 243 + return 8 + else + return 9 + endif + else + if a:x < 14 + return 0 + else + let l:n = (a:x - 8) / 10 + let l:m = (a:x - 8) % 10 + if l:m < 5 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual grey level represented by the grey index + fun grey_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 46 + elseif a:n == 2 + return 92 + elseif a:n == 3 + return 115 + elseif a:n == 4 + return 139 + elseif a:n == 5 + return 162 + elseif a:n == 6 + return 185 + elseif a:n == 7 + return 208 + elseif a:n == 8 + return 231 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 8 + (a:n * 10) + endif + endif + endfun + + " Returns the palette index for the given grey index + fun grey_colour(n) + if &t_Co == 88 + if a:n == 0 + return 16 + elseif a:n == 9 + return 79 + else + return 79 + a:n + endif + else + if a:n == 0 + return 16 + elseif a:n == 25 + return 231 + else + return 231 + a:n + endif + endif + endfun + + " Returns an approximate colour index for the given colour level + fun rgb_number(x) + if &t_Co == 88 + if a:x < 69 + return 0 + elseif a:x < 172 + return 1 + elseif a:x < 230 + return 2 + else + return 3 + endif + else + if a:x < 75 + return 0 + else + let l:n = (a:x - 55) / 40 + let l:m = (a:x - 55) % 40 + if l:m < 20 + return l:n + else + return l:n + 1 + endif + endif + endif + endfun + + " Returns the actual colour level for the given colour index + fun rgb_level(n) + if &t_Co == 88 + if a:n == 0 + return 0 + elseif a:n == 1 + return 139 + elseif a:n == 2 + return 205 + else + return 255 + endif + else + if a:n == 0 + return 0 + else + return 55 + (a:n * 40) + endif + endif + endfun + + " Returns the palette index for the given R/G/B colour indices + fun rgb_colour(x, y, z) + if &t_Co == 88 + return 16 + (a:x * 16) + (a:y * 4) + a:z + else + return 16 + (a:x * 36) + (a:y * 6) + a:z + endif + endfun + + " Returns the palette index to approximate the given R/G/B colour levels + fun colour(r, g, b) + " Get the closest grey + let l:gx = grey_number(a:r) + let l:gy = grey_number(a:g) + let l:gz = grey_number(a:b) + + " Get the closest colour + let l:x = rgb_number(a:r) + let l:y = rgb_number(a:g) + let l:z = rgb_number(a:b) + + if l:gx == l:gy && l:gy == l:gz + " There are two possibilities + let l:dgr = grey_level(l:gx) - a:r + let l:dgg = grey_level(l:gy) - a:g + let l:dgb = grey_level(l:gz) - a:b + let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) + let l:dr = rgb_level(l:gx) - a:r + let l:dg = rgb_level(l:gy) - a:g + let l:db = rgb_level(l:gz) - a:b + let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) + if l:dgrey < l:drgb + " Use the grey + return grey_colour(l:gx) + else + " Use the colour + return rgb_colour(l:x, l:y, l:z) + endif + else + " Only one possibility + return rgb_colour(l:x, l:y, l:z) + endif + endfun + + " Returns the palette index to approximate the 'rrggbb' hex string + fun rgb(rgb) + let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 + let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 + let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 + + return colour(l:r, l:g, l:b) + endfun + + " Sets the highlighting for the given group + fun X(group, fg, bg, attr) + if a:fg != "" + exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) + endif + if a:bg != "" + exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) + endif + if a:attr != "" + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + endif + endfun + + " Vim Highlighting + call X("Normal", s:foreground, s:background, "") + highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE + call X("NonText", s:selection, "", "") + call X("SpecialKey", s:selection, "", "") + call X("Search", s:foreground, s:yellow, "") + call X("TabLine", s:foreground, s:background, "reverse") + call X("StatusLine", s:window, s:yellow, "reverse") + call X("StatusLineNC", s:window, s:foreground, "reverse") + call X("VertSplit", s:window, s:window, "none") + call X("Visual", "", s:selection, "") + call X("Directory", s:blue, "", "") + call X("ModeMsg", s:green, "", "") + call X("MoreMsg", s:green, "", "") + call X("Question", s:green, "", "") + call X("WarningMsg", s:red, "", "") + call X("MatchParen", "", s:selection, "") + call X("Folded", s:comment, s:background, "") + call X("FoldColumn", "", s:background, "") + if version >= 700 + call X("CursorLine", "", s:line, "none") + call X("CursorColumn", "", s:line, "none") + call X("PMenu", s:foreground, s:selection, "none") + call X("PMenuSel", s:foreground, s:selection, "reverse") + end + if version >= 703 + call X("ColorColumn", "", s:line, "none") + end + + " Standard Highlighting + call X("Comment", s:comment, "", "") + call X("Todo", s:comment, s:background, "") + call X("Title", s:comment, "", "") + call X("Identifier", s:red, "", "none") + call X("Statement", s:foreground, "", "") + call X("Conditional", s:foreground, "", "") + call X("Repeat", s:foreground, "", "") + call X("Structure", s:purple, "", "") + call X("Function", s:blue, "", "") + call X("Constant", s:orange, "", "") + call X("String", s:green, "", "") + call X("Special", s:foreground, "", "") + call X("PreProc", s:purple, "", "") + call X("Operator", s:aqua, "", "none") + call X("Type", s:blue, "", "none") + call X("Define", s:purple, "", "none") + call X("Include", s:blue, "", "") + "call X("Ignore", "666666", "", "") + + " Vim Highlighting + call X("vimCommand", s:red, "", "none") + + " C Highlighting + call X("cType", s:yellow, "", "") + call X("cStorageClass", s:purple, "", "") + call X("cConditional", s:purple, "", "") + call X("cRepeat", s:purple, "", "") + + " PHP Highlighting + call X("phpVarSelector", s:red, "", "") + call X("phpKeyword", s:purple, "", "") + call X("phpRepeat", s:purple, "", "") + call X("phpConditional", s:purple, "", "") + call X("phpStatement", s:purple, "", "") + call X("phpMemberSelector", s:foreground, "", "") + + " Ruby Highlighting + call X("rubySymbol", s:green, "", "") + call X("rubyConstant", s:yellow, "", "") + call X("rubyAttribute", s:blue, "", "") + call X("rubyInclude", s:blue, "", "") + call X("rubyLocalVariableOrMethod", s:orange, "", "") + call X("rubyCurlyBlock", s:orange, "", "") + call X("rubyStringDelimiter", s:green, "", "") + call X("rubyInterpolationDelimiter", s:orange, "", "") + call X("rubyConditional", s:purple, "", "") + call X("rubyRepeat", s:purple, "", "") + + " Python Highlighting + call X("pythonInclude", s:purple, "", "") + call X("pythonStatement", s:purple, "", "") + call X("pythonConditional", s:purple, "", "") + call X("pythonFunction", s:blue, "", "") + + " JavaScript Highlighting + call X("javaScriptBraces", s:foreground, "", "") + call X("javaScriptFunction", s:purple, "", "") + call X("javaScriptConditional", s:purple, "", "") + call X("javaScriptRepeat", s:purple, "", "") + call X("javaScriptNumber", s:orange, "", "") + call X("javaScriptMember", s:orange, "", "") + + " HTML Highlighting + call X("htmlTag", s:red, "", "") + call X("htmlTagName", s:red, "", "") + call X("htmlArg", s:red, "", "") + call X("htmlScriptTag", s:red, "", "") + + " Diff Highlighting + call X("diffAdded", s:green, "", "") + call X("diffRemoved", s:red, "", "") + + " Delete Functions + delf X + delf rgb + delf colour + delf rgb_colour + delf rgb_level + delf rgb_number + delf grey_colour + delf grey_level + delf grey_number +endif diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 7c01ab3..b5dc089 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -114,7 +114,7 @@ set tm=500 syntax on set background=dark -colorscheme ir-whack +colorscheme Tomorrow-Night-Bright " set number " show line numbers set relativenumber " show relative line numbers diff --git a/zsh/colors.zsh b/zsh/colors.zsh index 04882a0..d98307f 100644 --- a/zsh/colors.zsh +++ b/zsh/colors.zsh @@ -2,6 +2,7 @@ COLOR_BLACK="\e[0;30m" COLOR_BLUE="\e[0;34m" COLOR_GREEN="\e[0;32m" COLOR_CYAN="\e[0;36m" +COLOR_PINK="\e[0;35m" COLOR_RED="\e[0;31m" COLOR_PURPLE="\e[0;35m" COLOR_BROWN="\e[0;33m" diff --git a/zsh/aliases.zsh b/zsh/lib/aliases.zsh similarity index 100% rename from zsh/aliases.zsh rename to zsh/lib/aliases.zsh diff --git a/zsh/completion.zsh b/zsh/lib/completion.zsh similarity index 100% rename from zsh/completion.zsh rename to zsh/lib/completion.zsh diff --git a/zsh/lib/spectrum.zsh b/zsh/lib/spectrum.zsh new file mode 100644 index 0000000..2fdf537 --- /dev/null +++ b/zsh/lib/spectrum.zsh @@ -0,0 +1,28 @@ +#! /bin/zsh +# A script to make using 256 colors in zsh less painful. +# P.C. Shyamshankar +# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ + +typeset -Ag FX FG BG + +FX=( + reset "%{%}" + bold "%{%}" no-bold "%{%}" + italic "%{%}" no-italic "%{%}" + underline "%{%}" no-underline "%{%}" + blink "%{%}" no-blink "%{%}" + reverse "%{%}" no-reverse "%{%}" +) + +for color in {000..255}; do + FG[$color]="%{[38;5;${color}m%}" + BG[$color]="%{[48;5;${color}m%}" +done + +# Show all 256 colors with color number +function spectrum_ls() { + for code in {000..255}; do + print -P -- "$code: %F{$code}Test%f" + done +} + diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 95336ea..60db43b 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -42,5 +42,5 @@ directory_name(){ echo "%{$fg_bold[cyan]%}%1/%\/%{$reset_color%}" } -export PROMPT=$'%{$fg_bold[blue]%}%n%{$reset_color%}:$(directory_name) %{$fg_bold[cyan]%}➜%{$reset_color%} ' +export PROMPT=$'%{$FG[199]%}♥%{$reset_color%} $(directory_name) %{$fg_bold[magenta]%}➜%{$reset_color%} ' export RPROMPT=$'$(git_dirty)$(need_push)' From 6e612155ea1fb20ad36aa4aabfade6a2b14572eb Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Mon, 29 Oct 2012 18:47:32 -0500 Subject: [PATCH 02/17] Added indicator of suspended job to RPROMPT --- zsh/prompt.zsh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 60db43b..d030fe6 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -38,9 +38,18 @@ need_push() { fi } +suspended_jobs() { + sj=$(jobs 2>/dev/null | tail -n 1) + if [[ $sj == "" ]]; then + echo "" + else + echo "%{$FG[208]%}✱%{$reset_color%}" + fi +} + directory_name(){ echo "%{$fg_bold[cyan]%}%1/%\/%{$reset_color%}" } export PROMPT=$'%{$FG[199]%}♥%{$reset_color%} $(directory_name) %{$fg_bold[magenta]%}➜%{$reset_color%} ' -export RPROMPT=$'$(git_dirty)$(need_push)' +export RPROMPT=$'$(git_dirty)$(need_push)$(suspended_jobs)' From f6a980e6d40dc67792b15ccf4b0f592c3ccbc03e Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 30 Oct 2012 09:35:38 -0500 Subject: [PATCH 03/17] adding some more git aliases --- git/git.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/git/git.zsh b/git/git.zsh index 1859327..a2751f7 100644 --- a/git/git.zsh +++ b/git/git.zsh @@ -14,8 +14,16 @@ alias grm='git rm' alias grn='git-rename' alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" +alias git-amend='git commit --amend -C HEAD' +alias git-undo='git reset --soft HEAD~1' +alias git-count='git shortlog -sn' + alias sub-pull='git submodule foreach git pull origin master' +funciton get-credit() { + git commit --amend --author $1 <$2> -C HEAD +} + # a simple git rename file function # git does not track case-sensitive changes to a filename. function git-rename() { From b9ad32b1e9e0fe5a8236a476969b8f01f3306991 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 30 Oct 2012 11:43:05 -0500 Subject: [PATCH 04/17] added syntax-finding function for helping with colorscheme editing --- vim/vimrc.symlink | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index b5dc089..a33c885 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -255,6 +255,14 @@ endfunction nnoremap / :call ToggleNuMode() +nmap s :call SynStack() +function SynStack() + if !exists("*synstack") + return + endif + echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') +endfunction + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" From 4e36d9581e38202e108739a7dfec1f841f30d5a0 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 31 Oct 2012 16:34:45 -0500 Subject: [PATCH 05/17] Added pane resizing -- commented out for now --- vim/vimrc.symlink | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index a33c885..6e0c052 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -221,6 +221,11 @@ map :call WinMove('j') map :call WinMove('k') map :call WinMove('l') +" nnoremap :vertical resize -5 +" nnoremap :resize +5 +" nnoremap :resize -5 +" nnoremap :vertical resize +5 + map wc :wincmd q " equalize windows From 835380bd0aeb00b633ee4d87e62ed232a09a55be Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 31 Oct 2012 19:44:15 -0500 Subject: [PATCH 06/17] Added some gems from Paul Irish's dotfiles, Removed syntastic --- .gitmodules | 3 -- git/git.zsh | 5 +- vim/vim.symlink/bundle/syntastic | 1 - zsh/functions.zsh | 88 ++++++++++++++++++++++++++++++++ zsh/lib/aliases.zsh | 74 +++++++++++++++++++++++++-- 5 files changed, 161 insertions(+), 10 deletions(-) delete mode 160000 vim/vim.symlink/bundle/syntastic diff --git a/.gitmodules b/.gitmodules index 38afa20..61d37b3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -70,9 +70,6 @@ [submodule "vim/vim.symlink/bundle/vim-matchit"] path = vim/vim.symlink/bundle/vim-matchit url = https://github.com/tsaleh/vim-matchit.git -[submodule "vim/vim.symlink/bundle/syntastic"] - path = vim/vim.symlink/bundle/syntastic - url = https://github.com/scrooloose/syntastic.git [submodule "vim/vim.symlink/bundle/vim-surround"] path = vim/vim.symlink/bundle/vim-surround url = https://github.com/tpope/vim-surround.git diff --git a/git/git.zsh b/git/git.zsh index a2751f7..5096394 100644 --- a/git/git.zsh +++ b/git/git.zsh @@ -17,10 +17,13 @@ alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C alias git-amend='git commit --amend -C HEAD' alias git-undo='git reset --soft HEAD~1' alias git-count='git shortlog -sn' +alias undopush="git push -f origin HEAD^:master" +# git root +alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`' alias sub-pull='git submodule foreach git pull origin master' -funciton get-credit() { +funciton give-credit() { git commit --amend --author $1 <$2> -C HEAD } diff --git a/vim/vim.symlink/bundle/syntastic b/vim/vim.symlink/bundle/syntastic deleted file mode 160000 index 2e7d733..0000000 --- a/vim/vim.symlink/bundle/syntastic +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2e7d73305b70a456abb20b1754e094cccfefa3d3 diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 0a4c421..15f37c5 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -13,3 +13,91 @@ function colours() { fi done } + +# Create a new directory and enter it +function md() { + mkdir -p "$@" && cd "$@" +} + + +# find shorthand +function f() { + find . -name "$1" +} + + +# Start an HTTP server from a directory, optionally specifying the port +function server() { + local port="${1:-8000}" + open "http://localhost:${port}/" + # Set the default Content-Type to `text/plain` instead of `application/octet-stream` + # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) + python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" +} + +# git log with per-commit cmd-clickable GitHub URLs (iTerm) +# function gf() { +# local remote="$(git remote -v | awk '/^origin.*\(push\)$/ {print $2}')" +# [[ "$remote" ]] || return +# local user_repo="$(echo "$remote" | perl -pe 's/.*://;s/\.git$//')" +# git log $* --name-status --color | awk "$(cat < +# Credits to http://dotfiles.org/~pseup/.bashrc +function extract() { + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar xjf $1 ;; + *.tar.gz) tar xzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) rar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xf $1 ;; + *.tbz2) tar xjf $1 ;; + *.tgz) tar xzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *.7z) 7z x $1 ;; + *) echo "'$1' cannot be extracted via extract()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} diff --git a/zsh/lib/aliases.zsh b/zsh/lib/aliases.zsh index fcb83ca..a9c8cdb 100644 --- a/zsh/lib/aliases.zsh +++ b/zsh/lib/aliases.zsh @@ -1,14 +1,27 @@ # reload zsh config alias reload!='source ~/.zshrc' +# Detect which `ls` flavor is in use +if ls --color > /dev/null 2>&1; then # GNU `ls` + colorflag="--color" +else # OS X `ls` + colorflag="-G" +fi + # Filesystem aliases alias ..='cd ..' alias ...='cd ../..' -alias l='ls -lah' -alias la='ls -AF' -alias ll='ls -lFh' -alias lld='ls -l | grep ^d' -alias rmf='rm -rf' +alias ....="cd ../../.." +alias .....="cd ../../../.." + +alias l="ls -lah ${colorflag}" +alias la="ls -AF ${colorflag}" +alias ll="ls -lFh ${colorflag}" +alias lld="ls -l | grep ^d" +alias rmf="rm -rf" + +# shortcut to dotfiles +alias dot="cd ~/.dotfiles" # Helpers alias grep='grep --color=auto' @@ -22,3 +35,54 @@ alias rake="noglob rake" alias mou='open -a Mou.app' alias mark='open -a Marked.app' alias ios='open -a /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app' + +# be nice +alias please=sudo + +# IP addresses +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias localip="ipconfig getifaddr en1" +alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" + +# Enhanced WHOIS lookups +alias whois="whois -h whois-servers.net" + +# Flush Directory Service cache +alias flush="dscacheutil -flushcache" + +# View HTTP traffic +alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'" +alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" + +# Trim new lines and copy to clipboard +alias trimcopy="tr -d '\n' | pbcopy" + +# Recursively delete `.DS_Store` files +alias cleanup="find . -name '*.DS_Store' -type f -ls -delete" + +# File size +alias fs="stat -f \"%z bytes\"" + +# ROT13-encode text. Works for decoding, too! ;) +alias rot13='tr a-zA-Z n-za-mN-ZA-M' + +# Empty the Trash on all mounted volumes and the main HDD +alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; rm -rfv ~/.Trash" + +# Hide/show all desktop icons (useful when presenting) +alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" +alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" + + +# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it +alias plistbuddy="/usr/libexec/PlistBuddy" + +# One of @janmoesen’s ProTip™s +for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do + alias "$method"="lwp-request -m '$method'" +done + +# Stuff I never really use but cannot delete either because of http://xkcd.com/530/ +alias stfu="osascript -e 'set volume output muted true'" +alias pumpitup="osascript -e 'set volume 10'" +alias hax="growlnotify -a 'Activity Monitor' 'System error' -m 'WTF R U DOIN'" From 1468f9d974df134a7075e24584b4e2dda4264092 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 31 Oct 2012 19:45:49 -0500 Subject: [PATCH 07/17] removing syntastic shortcut in vimrc --- vim/vimrc.symlink | 3 --- 1 file changed, 3 deletions(-) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 6e0c052..759074c 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -304,9 +304,6 @@ nmap gc :Gcommit nmap gbr :Gbrowse nmap gd :Gdiff -" toggle syntastic syntax checking -nmap o :SyntasticToggleMode - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Local vimrc """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" From ea11c7db9b189eaa2769c93cea83aeef1d54acc9 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 7 Nov 2012 10:38:28 -0600 Subject: [PATCH 08/17] Updating git aliases, removing fugitive shortcuts Also updating prompt symbols --- git/git.zsh | 4 ++-- git/gitconfig.symlink | 6 ++++++ vim/vimrc.symlink | 8 -------- zsh/prompt.zsh | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/git/git.zsh b/git/git.zsh index 5096394..1a86fd8 100644 --- a/git/git.zsh +++ b/git/git.zsh @@ -17,13 +17,13 @@ alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C alias git-amend='git commit --amend -C HEAD' alias git-undo='git reset --soft HEAD~1' alias git-count='git shortlog -sn' -alias undopush="git push -f origin HEAD^:master" +alias git-undopush="git push -f origin HEAD^:master" # git root alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`' alias sub-pull='git submodule foreach git pull origin master' -funciton give-credit() { +function give-credit() { git commit --amend --author $1 <$2> -C HEAD } diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index 04d26a8..7fe5b53 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -27,6 +27,12 @@ si = submodule init su = submodule update + # show number of commits per contributer, sorted + count = shortlog -sn + + undo = reset --soft HEAD~1 + amend = git commit --amend -C HEAD + # grep commands # 'diff grep' diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 759074c..60b8e70 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -296,14 +296,6 @@ let g:ctrlp_custom_ignore = { " search the nearest ancestor that contains .git, .hg, .svn let g:ctrlp_working_path_mode = 2 -" vim-fugitive mappings -nmap gb :Gblame -nmap gw :Gwrite -nmap gr :Gread -nmap gc :Gcommit -nmap gbr :Gbrowse -nmap gd :Gdiff - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Local vimrc """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index d030fe6..ccd52e0 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -12,9 +12,9 @@ git_dirty() { else if [[ $st == "nothing to commit (working directory clean)" ]] then - echo "%{$fg_bold[green]%}☺ $(git_prompt_info)%{$reset_color%}" + echo "%{$fg_bold[green]%}✔ $(git_prompt_info)%{$reset_color%}" else - echo "%{$fg_bold[red]%}☠ $(git_prompt_info)%{$reset_color%}" + echo "%{$fg_bold[red]%}✗ $(git_prompt_info)%{$reset_color%}" fi fi } From 42c5eae49d7a02fa56cda9e6d22adf458d2618a3 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 8 Nov 2012 08:44:19 -0600 Subject: [PATCH 09/17] Updating loading of local vimrc files This is based on the reddit topic http://www.reddit.com/r/vim/comments/12tpf9/per_project_vim_settings/ --- vim/vimrc.symlink | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 60b8e70..efe653d 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -260,6 +260,7 @@ endfunction nnoremap / :call ToggleNuMode() +" find out what syntax stack a statement belongs to nmap s :call SynStack() function SynStack() if !exists("*synstack") @@ -268,6 +269,25 @@ function SynStack() echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') endfunction +function! ApplyLocalSettings(dirname) + " convert windows paths to unix style + let l:curDir = substitute(a:dirname, "\\", "/", "g") + + " walk to the top of the dir tree + let l:parentDir = strpart(l:curDir, 0, strridx(l:curDir, "/")) + if isdirectory(l:parentDir) + call ApplyLocalSettings(l:parentDir) + endif + + " now walk back down the path and source .vimsettings as you find them. + " child directories can inherit from their parents + let l:settingsFile = a:dirname . "/.vimrc.local" + if filereadable(l:settingsFile) + exec ":source" . l:settingsFile + endif +endfunction +autocmd! BufEnter * call ApplyLocalSettings(expand(":p:h")) + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -295,19 +315,3 @@ let g:ctrlp_custom_ignore = { " search the nearest ancestor that contains .git, .hg, .svn let g:ctrlp_working_path_mode = 2 - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Local vimrc -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" load a custom, per machine vimrc if available -if filereadable(glob("~/.vimrc.local")) - source ~/.vimrc.local -endif - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Local, Per Project vimrc -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -if filereadable(".vimrc.project") - source .vimrc.project -endif From 614cb0642b9fce1dc98ce7a33405cbe48ca79460 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 13 Nov 2012 07:46:05 -0600 Subject: [PATCH 10/17] Added smart mapping for tab-completion via http://vim.wikia.com/wiki/Smart_mapping_for_tab_completion --- vim/vimrc.symlink | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index efe653d..4ae0b18 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -288,6 +288,28 @@ function! ApplyLocalSettings(dirname) endfunction autocmd! BufEnter * call ApplyLocalSettings(expand(":p:h")) +" smart tab completion +function! Smart_TabComplete() + let line = getline('.') + let substr = strpart(line, -1, col('.')+1) + + let substr = matchstr(substr, "[^ \t]*$") + if (strlen(substr) == 0) + return "<\tab>" + endif + let has_period = match(substr, '\.') != -1 + let has_slash = match(substr, '\/') != -1 + if (!has_period && !has_slash) + return "\\" + elseif (has_slash) + return "\\" + else + return "\\" + endif +endfunction + +inoremap =Smart_TabComplete() + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" From 46f35b225b477a65ca1ec2b876cf5246c9410949 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 13 Nov 2012 08:08:38 -0600 Subject: [PATCH 11/17] Added .vimrc.local to global gitignore --- git/gitconfig.symlink | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index 7fe5b53..f8714cf 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -10,6 +10,8 @@ br = branch -v # show a pretty log graph lg = log --graph --pretty=oneline --abbrev-commit --decorate + # slight variation of pretty log graph + l = log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative # show files that have changed between two branches (git dbr master..branch) dbr = diff --name-status # show diff of cached files From d3d161011de238769f3c0fe4988ee95516cc11bb Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 13 Nov 2012 08:09:06 -0600 Subject: [PATCH 12/17] Added pretty git log (glog) alias to gitconfig as git l --- git/gitignore_global.symlink | 1 + 1 file changed, 1 insertion(+) diff --git a/git/gitignore_global.symlink b/git/gitignore_global.symlink index fafff2e..fdb5825 100644 --- a/git/gitignore_global.symlink +++ b/git/gitignore_global.symlink @@ -1,2 +1,3 @@ .DS_Store Thumbs.db +.vimrc.local From f2fb73da330fe544f1227bddec05a95a10f47169 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 15 Nov 2012 10:09:04 -0600 Subject: [PATCH 13/17] fixing smart tab completion --- vim/vimrc.symlink | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 4ae0b18..506c71f 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -290,26 +290,26 @@ autocmd! BufEnter * call ApplyLocalSettings(expand(":p:h")) " smart tab completion function! Smart_TabComplete() - let line = getline('.') - let substr = strpart(line, -1, col('.')+1) + let line = getline('.') " current line - let substr = matchstr(substr, "[^ \t]*$") - if (strlen(substr) == 0) - return "<\tab>" + let substr = strpart(line, -1, col('.')+1) " from the start of the current + " line to one character right + " of the cursor + let substr = matchstr(substr, "[^ \t]*$") " word till cursor + if (strlen(substr)==0) " nothing to match on empty string + return "\" endif - let has_period = match(substr, '\.') != -1 - let has_slash = match(substr, '\/') != -1 + let has_period = match(substr, '\.') != -1 " position of period, if any + let has_slash = match(substr, '\/') != -1 " position of slash, if any if (!has_period && !has_slash) - return "\\" - elseif (has_slash) - return "\\" + return "\\" " existing text matching + elseif ( has_slash ) + return "\\" " file matching else - return "\\" + return "\\" " plugin matching endif endfunction - inoremap =Smart_TabComplete() - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -331,9 +331,9 @@ nmap r :CtrlPBuffer " CtrlP ignore patterns let g:ctrlp_custom_ignore = { - \ 'dir': '\.git$\|node_modules$\|\.hg$\|\.svn$', - \ 'file': '\.exe$\|\.so$' -\ } + \ 'dir': '\.git$\|node_modules$\|\.hg$\|\.svn$', + \ 'file': '\.exe$\|\.so$' + \ } " search the nearest ancestor that contains .git, .hg, .svn let g:ctrlp_working_path_mode = 2 From 00e8245f77a5586a2b4431cb6a8406e5e67ae6b5 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 15 Nov 2012 10:11:22 -0600 Subject: [PATCH 14/17] removing unread mail count from tmux pane --- tmux/tmux.conf.symlink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink index 70650c4..7dd68e4 100644 --- a/tmux/tmux.conf.symlink +++ b/tmux/tmux.conf.symlink @@ -152,5 +152,5 @@ set -g window-status-format "#[fg=colour239,bg=colour232] #I #W " # set -g window-status-current-format "#[fg=colour232,bg=colour26]#[fg=colour16,bg=colour26,noreverse,bold] #I #W #[fg=colour26,bg=colour232,nobold]" set -g window-status-current-format "#[fg=colour232,bg=colour26]#[fg=colour16,bg=colour26,noreverse,bold] #I #W #[fg=colour26,bg=colour232,nobold]" set -g status-left $tm_session_name -set -g status-right $tm_itunes_track' '$tm_spotify_track' '$tm_mail' '$tm_date' '$tm_host +set -g status-right $tm_itunes_track' '$tm_spotify_track' '$tm_date' '$tm_host From b4f8fc3565f43b9e6b6fd6f03a2fcc21069dcbdc Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 27 Nov 2012 20:33:15 -0600 Subject: [PATCH 15/17] Swapping spotify for rdio --- tmux/tmux.conf.symlink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink index 7dd68e4..de3bd6a 100644 --- a/tmux/tmux.conf.symlink +++ b/tmux/tmux.conf.symlink @@ -152,5 +152,5 @@ set -g window-status-format "#[fg=colour239,bg=colour232] #I #W " # set -g window-status-current-format "#[fg=colour232,bg=colour26]#[fg=colour16,bg=colour26,noreverse,bold] #I #W #[fg=colour26,bg=colour232,nobold]" set -g window-status-current-format "#[fg=colour232,bg=colour26]#[fg=colour16,bg=colour26,noreverse,bold] #I #W #[fg=colour26,bg=colour232,nobold]" set -g status-left $tm_session_name -set -g status-right $tm_itunes_track' '$tm_spotify_track' '$tm_date' '$tm_host +set -g status-right $tm_itunes_track' '$tm_rdio_track' '$tm_date' '$tm_host From b77d95512194479d2c6df31d5395f4a8887a3d5f Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 5 Dec 2012 12:10:33 -0600 Subject: [PATCH 16/17] Added new Scratch vim plugin to enable a scratch pad --- .gitmodules | 3 + tmux/tmux.conf.symlink | 4 + vim/vim.symlink/bundle/scratch/README | 41 +++++++ .../bundle/scratch/plugin/scratch.vim | 110 ++++++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 vim/vim.symlink/bundle/scratch/README create mode 100644 vim/vim.symlink/bundle/scratch/plugin/scratch.vim diff --git a/.gitmodules b/.gitmodules index 61d37b3..73cfea8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -82,3 +82,6 @@ [submodule "vim/vim.symlink/bundle/ir-whack"] path = vim/vim.symlink/bundle/ir-whack url = git@github.com:nicknisi/ir-whack.git +[submodule "vim/vim.symlink/bundle/scratch"] + path = vim/vim.symlink/bundle/scratch + url = git://github.com/vim-scripts/scratch.vim.git diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink index de3bd6a..8fb8a22 100644 --- a/tmux/tmux.conf.symlink +++ b/tmux/tmux.conf.symlink @@ -36,6 +36,10 @@ bind ^A select-pane -t:.+ set -g base-index 1 setw -g pane-base-index 1 +# set-option -g set-titles on +# set-option -g set-titles-string "#T - #W" +# set-window-option -g automatic-rename on + ###################### #### Key Bindings #### ###################### diff --git a/vim/vim.symlink/bundle/scratch/README b/vim/vim.symlink/bundle/scratch/README new file mode 100644 index 0000000..b1512dd --- /dev/null +++ b/vim/vim.symlink/bundle/scratch/README @@ -0,0 +1,41 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=664 + +Overview + +You can use the scratch plugin to create a temporary scratch buffer to store +and edit text that will be discarded when you quit/exit vim. The contents +of the scratch buffer are not saved/stored in a file. + +Installation + +1. Copy the scratch.vim plugin to the $HOME/.vim/plugin directory. Refer to + the following Vim help topics for more information about Vim plugins: + + :help add-plugin + :help add-global-plugin + :help runtimepath + +2. Restart Vim. + +Usage + +You can use the following command to open/edit the scratch buffer: + + :Scratch + +To open the scratch buffer in a new split window, use the following command: + + :Sscratch + +When you close the scratch buffer window, the buffer will retain the +contents. You can again edit the scratch buffer by openeing it using one of +the above commands. There is no need to save the scatch buffer. + +When you quit/exit Vim, the contents of the scratch buffer will be lost. +You will not be prompted to save the contents of the modified scratch +buffer. + +You can have only one scratch buffer open in a single Vim instance. If the +current buffer has unsaved modifications, then the scratch buffer will be +opened in a new window + diff --git a/vim/vim.symlink/bundle/scratch/plugin/scratch.vim b/vim/vim.symlink/bundle/scratch/plugin/scratch.vim new file mode 100644 index 0000000..05b9018 --- /dev/null +++ b/vim/vim.symlink/bundle/scratch/plugin/scratch.vim @@ -0,0 +1,110 @@ +" File: scratch.vim +" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +" Version: 1.0 +" Last Modified: June 3, 2003 +" +" Overview +" -------- +" You can use the scratch plugin to create a temporary scratch buffer to store +" and edit text that will be discarded when you quit/exit vim. The contents +" of the scratch buffer are not saved/stored in a file. +" +" Installation +" ------------ +" 1. Copy the scratch.vim plugin to the $HOME/.vim/plugin directory. Refer to +" the following Vim help topics for more information about Vim plugins: +" +" :help add-plugin +" :help add-global-plugin +" :help runtimepath +" +" 2. Restart Vim. +" +" Usage +" ----- +" You can use the following command to open/edit the scratch buffer: +" +" :Scratch +" +" To open the scratch buffer in a new split window, use the following command: +" +" :Sscratch +" +" When you close the scratch buffer window, the buffer will retain the +" contents. You can again edit the scratch buffer by openeing it using one of +" the above commands. There is no need to save the scatch buffer. +" +" When you quit/exit Vim, the contents of the scratch buffer will be lost. +" You will not be prompted to save the contents of the modified scratch +" buffer. +" +" You can have only one scratch buffer open in a single Vim instance. If the +" current buffer has unsaved modifications, then the scratch buffer will be +" opened in a new window +" +" ****************** Do not modify after this line ************************ +if exists('loaded_scratch') || &cp + finish +endif +let loaded_scratch=1 + +" Scratch buffer name +let ScratchBufferName = "__Scratch__" + +" ScratchBufferOpen +" Open the scratch buffer +function! s:ScratchBufferOpen(new_win) + let split_win = a:new_win + + " If the current buffer is modified then open the scratch buffer in a new + " window + if !split_win && &modified + let split_win = 1 + endif + + " Check whether the scratch buffer is already created + let scr_bufnum = bufnr(g:ScratchBufferName) + if scr_bufnum == -1 + " open a new scratch buffer + if split_win + exe "new " . g:ScratchBufferName + else + exe "edit " . g:ScratchBufferName + endif + else + " Scratch buffer is already created. Check whether it is open + " in one of the windows + let scr_winnum = bufwinnr(scr_bufnum) + if scr_winnum != -1 + " Jump to the window which has the scratch buffer if we are not + " already in that window + if winnr() != scr_winnum + exe scr_winnum . "wincmd w" + endif + else + " Create a new scratch buffer + if split_win + exe "split +buffer" . scr_bufnum + else + exe "buffer " . scr_bufnum + endif + endif + endif +endfunction + +" ScratchMarkBuffer +" Mark a buffer as scratch +function! s:ScratchMarkBuffer() + setlocal buftype=nofile + setlocal bufhidden=hide + setlocal noswapfile + setlocal buflisted +endfunction + +autocmd BufNewFile __Scratch__ call s:ScratchMarkBuffer() + +" Command to edit the scratch buffer in the current window +command! -nargs=0 Scratch call s:ScratchBufferOpen(0) +" Command to open the scratch buffer in a new split window +command! -nargs=0 Sscratch call s:ScratchBufferOpen(1) + From dfcc4fc44823329f5d4d40b1a3199120787f033b Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 5 Dec 2012 15:39:55 -0600 Subject: [PATCH 17/17] added remap for . to work in vieual mode --- vim/vimrc.symlink | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 506c71f..8dd9313 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -201,6 +201,9 @@ nmap q :bd " close the current buffer " switch between current and last buffer nmap . +" enable . command in visual mode +vnoremap . :normal . + " Window movement shortcuts " move to the window in the direction shown, or create a new window function! WinMove(key) @@ -310,6 +313,7 @@ function! Smart_TabComplete() endif endfunction inoremap =Smart_TabComplete() + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """""""""""""""""""""""""""""""""""""""""""""""""""""""""""