├── README ├── mariadb ├── Dockerfile └── start ├── metaclient ├── Dockerfile ├── profile ├── startit ├── vimrc ├── vimsettings │ ├── .netrwhist │ ├── autoload │ │ └── pathogen.vim │ └── colors │ │ ├── molokai.vim │ │ └── solarized.vim └── wrapdocker ├── nginx └── Dockerfile ├── rails └── Dockerfile └── static_web ├── Dockerfile └── index.html /README: -------------------------------------------------------------------------------- 1 | A few dockerfiles for my projects. 2 | -------------------------------------------------------------------------------- /mariadb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM vallard/nginx 2 | MAINTAINER Vallard Benincosa "vallard@benincosa.com" 3 | # install MariaDB 4 | 5 | #RUN debconf-set-selections << "mariadb-server mysql-server/root_password password $SECRET_PASSWORD" 6 | #RUN debconf-set-selections << "mysql-server mysql-server/root_password_again password $SECRET_PASSWORD" 7 | RUN apt-get update \ 8 | && apt-get install -y mariadb-server mariadb-client libmariadbclient-dev \ 9 | && rm -rf /var/lib/mysql/mysql \ 10 | && rm -rf /var/lib/apt/lists/* # as seen in sameersbn/docker-mysql 11 | 12 | ADD start /start 13 | RUN chmod 755 /start 14 | 15 | EXPOSE 3306 16 | 17 | VOLUME ["/var/lib/mysql"] 18 | VOLUME ["/run/mysqld"] 19 | 20 | CMD ["/start"] 21 | -------------------------------------------------------------------------------- /mariadb/start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # stolen from https://github.com/sameersbn/docker-mysql/blob/master/start 3 | set -e 4 | 5 | DB_NAME=${DB_NAME:-} 6 | DB_USER=${DB_USER:-} 7 | DB_PASS=${DB_PASS:-} 8 | 9 | # disable error log 10 | sed 's/^log_error/# log_error/' -i /etc/mysql/my.cnf 11 | 12 | # listen on all interfaces 13 | cat > /etc/mysql/conf.d/mysql-listen.cnf < /etc/mysql/conf.d/mysql-skip-name-resolv.cnf </dev/null 2>&1 46 | 47 | # start mysql server 48 | echo "Starting MySQL server..." 49 | /usr/bin/mysqld_safe >/dev/null 2>&1 & 50 | 51 | # wait for mysql server to start (max 30 seconds) 52 | timeout=30 53 | while ! /usr/bin/mysqladmin -u root status >/dev/null 2>&1 54 | do 55 | timeout=$(($timeout - 1)) 56 | if [ $timeout -eq 0 ]; then 57 | echo "Could not connect to mysql server. Aborting..." 58 | exit 1 59 | fi 60 | echo "Waiting for database server to accept connections..." 61 | sleep 1 62 | done 63 | 64 | ## create a localhost only, debian-sys-maint user 65 | ## the debian-sys-maint is used while creating users and database 66 | ## as well as to shut down or starting up the mysql server via mysqladmin 67 | echo "Creating debian-sys-maint user..." 68 | mysql -uroot -e "GRANT ALL PRIVILEGES on *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '' WITH GRANT OPTION;" 69 | 70 | /usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf shutdown 71 | fi 72 | 73 | # create new user / database 74 | if [ -n "${DB_USER}" -o -n "${DB_NAME}" ]; then 75 | /usr/bin/mysqld_safe >/dev/null 2>&1 & 76 | 77 | # wait for mysql server to start (max 30 seconds) 78 | timeout=30 79 | while ! /usr/bin/mysqladmin -u root status >/dev/null 2>&1 80 | do 81 | timeout=$(($timeout - 1)) 82 | if [ $timeout -eq 0 ]; then 83 | echo "Could not connect to mysql server. Aborting..." 84 | exit 1 85 | fi 86 | sleep 1 87 | done 88 | 89 | if [ -n "${DB_NAME}" ]; then 90 | echo "Creating database \"${DB_NAME}\"..." 91 | mysql --defaults-file=/etc/mysql/debian.cnf \ 92 | -e "CREATE DATABASE IF NOT EXISTS \`${DB_NAME}\` DEFAULT CHARACTER SET \`utf8\` COLLATE \`utf8_unicode_ci\`;" 93 | if [ -n "${DB_USER}" ]; then 94 | echo "Granting access to database \"${DB_NAME}\" for user \"${DB_USER}\"..." 95 | mysql --defaults-file=/etc/mysql/debian.cnf \ 96 | -e "GRANT ALL PRIVILEGES ON \`${DB_NAME}\`.* TO '${DB_USER}' IDENTIFIED BY '${DB_PASS}';" 97 | fi 98 | fi 99 | /usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf shutdown 100 | fi 101 | 102 | exec /usr/bin/mysqld_safe 103 | -------------------------------------------------------------------------------- /metaclient/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | MAINTAINER Vallard Benincosa "vallard@benincosa.com" 3 | RUN apt-get update 4 | # install the software 5 | RUN apt-get install -y python vim python-pip python-dev ssh nano curl ansible bash-completion 6 | RUN apt-get update 7 | RUN apt-get install -y lxc docker docker.io iptables 8 | 9 | # Install OpenStack Clients 10 | RUN pip install python-novaclient python-keystoneclient python-cinderclient python-heatclient python-glanceclient 11 | 12 | # make the .profile look awesome 13 | ADD profile /etc/skel/.profile 14 | 15 | # Add the users 16 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user01 17 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user02 18 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user03 19 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user04 20 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user05 21 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user06 22 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user07 23 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user08 24 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user09 25 | RUN useradd -m -G sudo -p $(openssl passwd -1 Cisco.123) -s /bin/bash user10 26 | 27 | 28 | # make VIM awesome. 29 | ADD vimrc /root/.vimrc 30 | ADD vimsettings /root/.vim 31 | 32 | 33 | # add priv directory. 34 | RUN mkdir -p /var/run/sshd 35 | RUN chmod 0755 /var/run/sshd 36 | 37 | # add Jerome's docker magic 38 | ADD ./wrapdocker /usr/local/bin/wrapdocker 39 | RUN chmod +x /usr/local/bin/wrapdocker 40 | 41 | # add the stuff 42 | ADD ./startit /usr/local/bin/ 43 | RUN chmod +x /usr/local/bin/startit 44 | 45 | VOLUME /var/lib/docker 46 | EXPOSE 22 47 | CMD ["/usr/local/bin/startit"] 48 | -------------------------------------------------------------------------------- /metaclient/profile: -------------------------------------------------------------------------------- 1 | # ~/.profile: executed by the command interpreter for login shells. 2 | # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 3 | # exists. 4 | # see /usr/share/doc/bash/examples/startup-files for examples. 5 | # the files are located in the bash-doc package. 6 | 7 | # the default umask is set in /etc/profile; for setting the umask 8 | # for ssh logins, install and configure the libpam-umask package. 9 | #umask 022 10 | 11 | # if running bash 12 | if [ -n "$BASH_VERSION" ]; then 13 | # include .bashrc if it exists 14 | if [ -f "$HOME/.bashrc" ]; then 15 | . "$HOME/.bashrc" 16 | fi 17 | fi 18 | 19 | # set PATH so it includes user's private bin if it exists 20 | if [ -d "$HOME/bin" ] ; then 21 | PATH="$HOME/bin:$PATH" 22 | fi 23 | 24 | export OS_AUTH_URL="" 25 | export OS_TENANT_ID="" 26 | export OS_TENANT_NAME="" 27 | export OS_USERNAME="" 28 | export OS_PASSWORD="" 29 | export OS_REGION_NAME="RegionOne" 30 | -------------------------------------------------------------------------------- /metaclient/startit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/local/bin/wrapdocker & 4 | /usr/sbin/sshd -D 5 | -------------------------------------------------------------------------------- /metaclient/vimrc: -------------------------------------------------------------------------------- 1 | call pathogen#infect() 2 | Helptags 3 | set nocompatible 4 | " format 5 | set autoindent 6 | set nu 7 | "set smartindent 8 | set showmatch 9 | " set textwidth=80 10 | set title 11 | set tabstop=2 12 | set shiftwidth=2 13 | set softtabstop=2 14 | set expandtab 15 | " syntax 16 | syntax on 17 | syntax enable 18 | " support 256 colors in Lion terminal 19 | set t_Co=256 20 | " files 21 | filetype on 22 | filetype indent on 23 | filetype plugin on 24 | " always show file name 25 | set modeline 26 | set ls=2 27 | " colorscheme 28 | colorscheme molokai 29 | " format with goimports instead of gofmt on save 30 | let g:go_fmt_command = "goimports" 31 | " enable fmt on save 32 | let g:go_fmt_autosave = 1 33 | " add the closing braces 34 | inoremap { {} 35 | inoremap { {}O 36 | inoremap {{ { 37 | inoremap {} {} 38 | -------------------------------------------------------------------------------- /metaclient/vimsettings/.netrwhist: -------------------------------------------------------------------------------- 1 | let g:netrw_dirhistmax =10 2 | let g:netrw_dirhist_cnt =3 3 | let g:netrw_dirhist_1='/Users/vallard/Desktop/gotraining/04-packaging_exporting/exercises/template1/toy' 4 | let g:netrw_dirhist_2='/Users/vallard/Code/Go/src/github.com/vallard/twitter-client/twitstream' 5 | let g:netrw_dirhist_3='/Users/vallard/Code/Go/src/github.com/vallard/stickypipe-receiver/app' 6 | -------------------------------------------------------------------------------- /metaclient/vimsettings/autoload/pathogen.vim: -------------------------------------------------------------------------------- 1 | " pathogen.vim - path option manipulation 2 | " Maintainer: Tim Pope 3 | " Version: 2.3 4 | 5 | " Install in ~/.vim/autoload (or ~\vimfiles\autoload). 6 | " 7 | " For management of individually installed plugins in ~/.vim/bundle (or 8 | " ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your 9 | " .vimrc is the only other setup necessary. 10 | " 11 | " The API is documented inline below. For maximum ease of reading, 12 | " :set foldmethod=marker 13 | 14 | if exists("g:loaded_pathogen") || &cp 15 | finish 16 | endif 17 | let g:loaded_pathogen = 1 18 | 19 | " Point of entry for basic default usage. Give a relative path to invoke 20 | " pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke 21 | " pathogen#surround(). For backwards compatibility purposes, a full path that 22 | " does not end in {} or * is given to pathogen#runtime_prepend_subdirectories() 23 | " instead. 24 | function! pathogen#infect(...) abort " {{{1 25 | for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] 26 | if path =~# '^[^\\/]\+$' 27 | call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') 28 | call pathogen#interpose(path . '/{}') 29 | elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$' 30 | call pathogen#interpose(path) 31 | elseif path =~# '[\\/]\%({}\|\*\)$' 32 | call pathogen#surround(path) 33 | else 34 | call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') 35 | call pathogen#surround(path . '/{}') 36 | endif 37 | endfor 38 | call pathogen#cycle_filetype() 39 | return '' 40 | endfunction " }}}1 41 | 42 | " Split a path into a list. 43 | function! pathogen#split(path) abort " {{{1 44 | if type(a:path) == type([]) | return a:path | endif 45 | let split = split(a:path,'\\\@]','\\&','') 223 | endif 224 | endfunction " }}}1 225 | 226 | " Like findfile(), but hardcoded to use the runtimepath. 227 | function! pathogen#runtime_findfile(file,count) abort "{{{1 228 | let rtp = pathogen#join(1,pathogen#split(&rtp)) 229 | let file = findfile(a:file,rtp,a:count) 230 | if file ==# '' 231 | return '' 232 | else 233 | return fnamemodify(file,':p') 234 | endif 235 | endfunction " }}}1 236 | 237 | " Section: Deprecated 238 | 239 | function! s:warn(msg) 240 | echohl WarningMsg 241 | echomsg a:msg 242 | echohl NONE 243 | endfunction 244 | 245 | " Prepend all subdirectories of path to the rtp, and append all 'after' 246 | " directories in those subdirectories. Deprecated. 247 | function! pathogen#runtime_prepend_subdirectories(path) " {{{1 248 | call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')') 249 | return pathogen#surround(a:path . pathogen#slash() . '{}') 250 | endfunction " }}}1 251 | 252 | function! pathogen#incubate(...) abort " {{{1 253 | let name = a:0 ? a:1 : 'bundle/{}' 254 | call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')') 255 | return pathogen#interpose(name) 256 | endfunction " }}}1 257 | 258 | " Deprecated alias for pathogen#interpose(). 259 | function! pathogen#runtime_append_all_bundles(...) abort " {{{1 260 | if a:0 261 | call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')') 262 | else 263 | call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()') 264 | endif 265 | return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') 266 | endfunction " }}}1 267 | 268 | if exists(':Vedit') 269 | finish 270 | endif 271 | 272 | let s:vopen_warning = 0 273 | 274 | function! s:find(count,cmd,file,lcd) " {{{1 275 | let rtp = pathogen#join(1,pathogen#split(&runtimepath)) 276 | let file = pathogen#runtime_findfile(a:file,a:count) 277 | if file ==# '' 278 | return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" 279 | endif 280 | if !s:vopen_warning 281 | let s:vopen_warning = 1 282 | let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' 283 | else 284 | let warning = '' 285 | endif 286 | if a:lcd 287 | let path = file[0:-strlen(a:file)-2] 288 | execute 'lcd `=path`' 289 | return a:cmd.' '.pathogen#fnameescape(a:file) . warning 290 | else 291 | return a:cmd.' '.pathogen#fnameescape(file) . warning 292 | endif 293 | endfunction " }}}1 294 | 295 | function! s:Findcomplete(A,L,P) " {{{1 296 | let sep = pathogen#slash() 297 | let cheats = { 298 | \'a': 'autoload', 299 | \'d': 'doc', 300 | \'f': 'ftplugin', 301 | \'i': 'indent', 302 | \'p': 'plugin', 303 | \'s': 'syntax'} 304 | if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) 305 | let request = cheats[a:A[0]].a:A[1:-1] 306 | else 307 | let request = a:A 308 | endif 309 | let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' 310 | let found = {} 311 | for path in pathogen#split(&runtimepath) 312 | let path = expand(path, ':p') 313 | let matches = split(glob(path.sep.pattern),"\n") 314 | call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') 315 | call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') 316 | for match in matches 317 | let found[match] = 1 318 | endfor 319 | endfor 320 | return sort(keys(found)) 321 | endfunction " }}}1 322 | 323 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0) 324 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) 325 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) 326 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) 327 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) 328 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) 329 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) 330 | command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) 331 | 332 | " vim:set et sw=2: 333 | -------------------------------------------------------------------------------- /metaclient/vimsettings/colors/molokai.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " 3 | " Author: Tomas Restrepo 4 | " https://github.com/tomasr/molokai 5 | " 6 | " Note: Based on the Monokai theme for TextMate 7 | " by Wimer Hazenberg and its darker variant 8 | " by Hamish Stuart Macpherson 9 | " 10 | 11 | hi clear 12 | 13 | if version > 580 14 | " no guarantees for version 5.8 and below, but this makes it stop 15 | " complaining 16 | hi clear 17 | if exists("syntax_on") 18 | syntax reset 19 | endif 20 | endif 21 | let g:colors_name="molokai" 22 | 23 | if exists("g:molokai_original") 24 | let s:molokai_original = g:molokai_original 25 | else 26 | let s:molokai_original = 0 27 | endif 28 | 29 | 30 | hi Boolean guifg=#AE81FF 31 | hi Character guifg=#E6DB74 32 | hi Number guifg=#AE81FF 33 | hi String guifg=#E6DB74 34 | hi Conditional guifg=#F92672 gui=bold 35 | hi Constant guifg=#AE81FF gui=bold 36 | hi Cursor guifg=#000000 guibg=#F8F8F0 37 | hi iCursor guifg=#000000 guibg=#F8F8F0 38 | hi Debug guifg=#BCA3A3 gui=bold 39 | hi Define guifg=#66D9EF 40 | hi Delimiter guifg=#8F8F8F 41 | hi DiffAdd guibg=#13354A 42 | hi DiffChange guifg=#89807D guibg=#4C4745 43 | hi DiffDelete guifg=#960050 guibg=#1E0010 44 | hi DiffText guibg=#4C4745 gui=italic,bold 45 | 46 | hi Directory guifg=#A6E22E gui=bold 47 | hi Error guifg=#E6DB74 guibg=#1E0010 48 | hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold 49 | hi Exception guifg=#A6E22E gui=bold 50 | hi Float guifg=#AE81FF 51 | hi FoldColumn guifg=#465457 guibg=#000000 52 | hi Folded guifg=#465457 guibg=#000000 53 | hi Function guifg=#A6E22E 54 | hi Identifier guifg=#FD971F 55 | hi Ignore guifg=#808080 guibg=bg 56 | hi IncSearch guifg=#C4BE89 guibg=#000000 57 | 58 | hi Keyword guifg=#F92672 gui=bold 59 | hi Label guifg=#E6DB74 gui=none 60 | hi Macro guifg=#C4BE89 gui=italic 61 | hi SpecialKey guifg=#66D9EF gui=italic 62 | 63 | hi MatchParen guifg=#000000 guibg=#FD971F gui=bold 64 | hi ModeMsg guifg=#E6DB74 65 | hi MoreMsg guifg=#E6DB74 66 | hi Operator guifg=#F92672 67 | 68 | " complete menu 69 | hi Pmenu guifg=#66D9EF guibg=#000000 70 | hi PmenuSel guibg=#808080 71 | hi PmenuSbar guibg=#080808 72 | hi PmenuThumb guifg=#66D9EF 73 | 74 | hi PreCondit guifg=#A6E22E gui=bold 75 | hi PreProc guifg=#A6E22E 76 | hi Question guifg=#66D9EF 77 | hi Repeat guifg=#F92672 gui=bold 78 | hi Search guifg=#000000 guibg=#FFE792 79 | " marks 80 | hi SignColumn guifg=#A6E22E guibg=#232526 81 | hi SpecialChar guifg=#F92672 gui=bold 82 | hi SpecialComment guifg=#7E8E91 gui=bold 83 | hi Special guifg=#66D9EF guibg=bg gui=italic 84 | if has("spell") 85 | hi SpellBad guisp=#FF0000 gui=undercurl 86 | hi SpellCap guisp=#7070F0 gui=undercurl 87 | hi SpellLocal guisp=#70F0F0 gui=undercurl 88 | hi SpellRare guisp=#FFFFFF gui=undercurl 89 | endif 90 | hi Statement guifg=#F92672 gui=bold 91 | hi StatusLine guifg=#455354 guibg=fg 92 | hi StatusLineNC guifg=#808080 guibg=#080808 93 | hi StorageClass guifg=#FD971F gui=italic 94 | hi Structure guifg=#66D9EF 95 | hi Tag guifg=#F92672 gui=italic 96 | hi Title guifg=#ef5939 97 | hi Todo guifg=#FFFFFF guibg=bg gui=bold 98 | 99 | hi Typedef guifg=#66D9EF 100 | hi Type guifg=#66D9EF gui=none 101 | hi Underlined guifg=#808080 gui=underline 102 | 103 | hi VertSplit guifg=#808080 guibg=#080808 gui=bold 104 | hi VisualNOS guibg=#403D3D 105 | hi Visual guibg=#403D3D 106 | hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold 107 | hi WildMenu guifg=#66D9EF guibg=#000000 108 | 109 | hi TabLineFill guifg=#1B1D1E guibg=#1B1D1E 110 | hi TabLine guibg=#1B1D1E guifg=#808080 gui=none 111 | 112 | if s:molokai_original == 1 113 | hi Normal guifg=#F8F8F2 guibg=#272822 114 | hi Comment guifg=#75715E 115 | hi CursorLine guibg=#3E3D32 116 | hi CursorLineNr guifg=#FD971F gui=none 117 | hi CursorColumn guibg=#3E3D32 118 | hi ColorColumn guibg=#3B3A32 119 | hi LineNr guifg=#8F908A guibg=#272822 120 | hi NonText guifg=#75715E 121 | hi SpecialKey guifg=#75715E 122 | else 123 | hi Normal guifg=#F8F8F2 guibg=#1B1D1E 124 | hi Comment guifg=#7E8E91 125 | hi CursorLine guibg=#293739 126 | hi CursorLineNr guifg=#FD971F gui=none 127 | hi CursorColumn guibg=#293739 128 | hi ColorColumn guibg=#232526 129 | hi LineNr guifg=#465457 guibg=#232526 130 | hi NonText guifg=#465457 131 | hi SpecialKey guifg=#465457 132 | end 133 | 134 | " 135 | " Support for 256-color terminal 136 | " 137 | if &t_Co > 255 138 | if s:molokai_original == 1 139 | hi Normal ctermbg=234 140 | hi CursorLine ctermbg=235 cterm=none 141 | hi CursorLineNr ctermfg=208 cterm=none 142 | else 143 | hi Normal ctermfg=252 ctermbg=233 144 | hi CursorLine ctermbg=234 cterm=none 145 | hi CursorLineNr ctermfg=208 cterm=none 146 | endif 147 | hi Boolean ctermfg=135 148 | hi Character ctermfg=144 149 | hi Number ctermfg=135 150 | hi String ctermfg=144 151 | hi Conditional ctermfg=161 cterm=bold 152 | hi Constant ctermfg=135 cterm=bold 153 | hi Cursor ctermfg=16 ctermbg=253 154 | hi Debug ctermfg=225 cterm=bold 155 | hi Define ctermfg=81 156 | hi Delimiter ctermfg=241 157 | 158 | hi DiffAdd ctermbg=24 159 | hi DiffChange ctermfg=181 ctermbg=239 160 | hi DiffDelete ctermfg=162 ctermbg=53 161 | hi DiffText ctermbg=102 cterm=bold 162 | 163 | hi Directory ctermfg=118 cterm=bold 164 | hi Error ctermfg=219 ctermbg=89 165 | hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold 166 | hi Exception ctermfg=118 cterm=bold 167 | hi Float ctermfg=135 168 | hi FoldColumn ctermfg=67 ctermbg=16 169 | hi Folded ctermfg=67 ctermbg=16 170 | hi Function ctermfg=118 171 | hi Identifier ctermfg=208 cterm=none 172 | hi Ignore ctermfg=244 ctermbg=232 173 | hi IncSearch ctermfg=193 ctermbg=16 174 | 175 | hi keyword ctermfg=161 cterm=bold 176 | hi Label ctermfg=229 cterm=none 177 | hi Macro ctermfg=193 178 | hi SpecialKey ctermfg=81 179 | 180 | hi MatchParen ctermfg=233 ctermbg=208 cterm=bold 181 | hi ModeMsg ctermfg=229 182 | hi MoreMsg ctermfg=229 183 | hi Operator ctermfg=161 184 | 185 | " complete menu 186 | hi Pmenu ctermfg=81 ctermbg=16 187 | hi PmenuSel ctermfg=255 ctermbg=242 188 | hi PmenuSbar ctermbg=232 189 | hi PmenuThumb ctermfg=81 190 | 191 | hi PreCondit ctermfg=118 cterm=bold 192 | hi PreProc ctermfg=118 193 | hi Question ctermfg=81 194 | hi Repeat ctermfg=161 cterm=bold 195 | hi Search ctermfg=0 ctermbg=222 cterm=NONE 196 | 197 | " marks column 198 | hi SignColumn ctermfg=118 ctermbg=235 199 | hi SpecialChar ctermfg=161 cterm=bold 200 | hi SpecialComment ctermfg=245 cterm=bold 201 | hi Special ctermfg=81 202 | if has("spell") 203 | hi SpellBad ctermbg=52 204 | hi SpellCap ctermbg=17 205 | hi SpellLocal ctermbg=17 206 | hi SpellRare ctermfg=none ctermbg=none cterm=reverse 207 | endif 208 | hi Statement ctermfg=161 cterm=bold 209 | hi StatusLine ctermfg=238 ctermbg=253 210 | hi StatusLineNC ctermfg=244 ctermbg=232 211 | hi StorageClass ctermfg=208 212 | hi Structure ctermfg=81 213 | hi Tag ctermfg=161 214 | hi Title ctermfg=166 215 | hi Todo ctermfg=231 ctermbg=232 cterm=bold 216 | 217 | hi Typedef ctermfg=81 218 | hi Type ctermfg=81 cterm=none 219 | hi Underlined ctermfg=244 cterm=underline 220 | 221 | hi VertSplit ctermfg=244 ctermbg=232 cterm=bold 222 | hi VisualNOS ctermbg=238 223 | hi Visual ctermbg=235 224 | hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold 225 | hi WildMenu ctermfg=81 ctermbg=16 226 | 227 | hi Comment ctermfg=59 228 | hi CursorColumn ctermbg=236 229 | hi ColorColumn ctermbg=236 230 | hi LineNr ctermfg=250 ctermbg=236 231 | hi NonText ctermfg=59 232 | 233 | hi SpecialKey ctermfg=59 234 | 235 | if exists("g:rehash256") && g:rehash256 == 1 236 | hi Normal ctermfg=252 ctermbg=234 237 | hi CursorLine ctermbg=236 cterm=none 238 | hi CursorLineNr ctermfg=208 cterm=none 239 | 240 | hi Boolean ctermfg=141 241 | hi Character ctermfg=222 242 | hi Number ctermfg=141 243 | hi String ctermfg=222 244 | hi Conditional ctermfg=197 cterm=bold 245 | hi Constant ctermfg=141 cterm=bold 246 | 247 | hi DiffDelete ctermfg=125 ctermbg=233 248 | 249 | hi Directory ctermfg=154 cterm=bold 250 | hi Error ctermfg=222 ctermbg=233 251 | hi Exception ctermfg=154 cterm=bold 252 | hi Float ctermfg=141 253 | hi Function ctermfg=154 254 | hi Identifier ctermfg=208 255 | 256 | hi Keyword ctermfg=197 cterm=bold 257 | hi Operator ctermfg=197 258 | hi PreCondit ctermfg=154 cterm=bold 259 | hi PreProc ctermfg=154 260 | hi Repeat ctermfg=197 cterm=bold 261 | 262 | hi Statement ctermfg=197 cterm=bold 263 | hi Tag ctermfg=197 264 | hi Title ctermfg=203 265 | hi Visual ctermbg=238 266 | 267 | hi Comment ctermfg=244 268 | hi LineNr ctermfg=239 ctermbg=235 269 | hi NonText ctermfg=239 270 | hi SpecialKey ctermfg=239 271 | endif 272 | end 273 | 274 | " Must be at the end, because of ctermbg=234 bug. 275 | " https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ 276 | set background=dark 277 | -------------------------------------------------------------------------------- /metaclient/vimsettings/colors/solarized.vim: -------------------------------------------------------------------------------- 1 | " Name: Solarized vim colorscheme 2 | " Author: Ethan Schoonover 3 | " URL: http://ethanschoonover.com/solarized 4 | " (see this url for latest release & screenshots) 5 | " License: OSI approved MIT license (see end of this file) 6 | " Created: In the middle of the night 7 | " Modified: 2011 May 05 8 | " 9 | " Usage "{{{ 10 | " 11 | " --------------------------------------------------------------------- 12 | " ABOUT: 13 | " --------------------------------------------------------------------- 14 | " Solarized is a carefully designed selective contrast colorscheme with dual 15 | " light and dark modes that runs in both GUI, 256 and 16 color modes. 16 | " 17 | " See the homepage above for screenshots and details. 18 | " 19 | " --------------------------------------------------------------------- 20 | " OPTIONS: 21 | " --------------------------------------------------------------------- 22 | " See the "solarized.txt" help file included with this colorscheme (in the 23 | " "doc" subdirectory) for information on options, usage, the Toggle Background 24 | " function and more. If you have already installed Solarized, this is available 25 | " from the Solarized menu and command line as ":help solarized" 26 | " 27 | " --------------------------------------------------------------------- 28 | " INSTALLATION: 29 | " --------------------------------------------------------------------- 30 | " Two options for installation: manual or pathogen 31 | " 32 | " MANUAL INSTALLATION OPTION: 33 | " --------------------------------------------------------------------- 34 | " 35 | " 1. Download the solarized distribution (available on the homepage above) 36 | " and unarchive the file. 37 | " 2. Move `solarized.vim` to your `.vim/colors` directory. 38 | " 3. Move each of the files in each subdirectories to the corresponding .vim 39 | " subdirectory (e.g. autoload/togglebg.vim goes into your .vim/autoload 40 | " directory as .vim/autoload/togglebg.vim). 41 | " 42 | " RECOMMENDED PATHOGEN INSTALLATION OPTION: 43 | " --------------------------------------------------------------------- 44 | " 45 | " 1. Download and install Tim Pope's Pathogen from: 46 | " https://github.com/tpope/vim-pathogen 47 | " 48 | " 2. Next, move or clone the `vim-colors-solarized` directory so that it is 49 | " a subdirectory of the `.vim/bundle` directory. 50 | " 51 | " a. **clone with git:** 52 | " 53 | " $ cd ~/.vim/bundle 54 | " $ git clone git://github.com/altercation/vim-colors-solarized.git 55 | " 56 | " b. **or move manually into the pathogen bundle directory:** 57 | " In the parent directory of vim-colors-solarized: 58 | " 59 | " $ mv vim-colors-solarized ~/.vim/bundle/ 60 | " 61 | " MODIFY VIMRC: 62 | " 63 | " After either Option 1 or Option 2 above, put the following two lines in your 64 | " .vimrc: 65 | " 66 | " syntax enable 67 | " set background=dark 68 | " colorscheme solarized 69 | " 70 | " or, for the light background mode of Solarized: 71 | " 72 | " syntax enable 73 | " set background=light 74 | " colorscheme solarized 75 | " 76 | " I like to have a different background in GUI and terminal modes, so I can use 77 | " the following if-then. However, I find vim's background autodetection to be 78 | " pretty good and, at least with MacVim, I can leave this background value 79 | " assignment out entirely and get the same results. 80 | " 81 | " if has('gui_running') 82 | " set background=light 83 | " else 84 | " set background=dark 85 | " endif 86 | " 87 | " See the Solarized homepage at http://ethanschoonover.com/solarized for 88 | " screenshots which will help you select either the light or dark background. 89 | " 90 | " --------------------------------------------------------------------- 91 | " COLOR VALUES 92 | " --------------------------------------------------------------------- 93 | " Download palettes and files from: http://ethanschoonover.com/solarized 94 | " 95 | " L\*a\*b values are canonical (White D65, Reference D50), other values are 96 | " matched in sRGB space. 97 | " 98 | " SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB 99 | " --------- ------- ---- ------- ----------- ---------- ----------- ----------- 100 | " base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21 101 | " base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26 102 | " base01 #586e75 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46 103 | " base00 #657b83 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51 104 | " base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59 105 | " base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63 106 | " base2 #eee8d5 7/7 white 254 #d7d7af 92 -00 10 238 232 213 44 11 93 107 | " base3 #fdf6e3 15/7 brwhite 230 #ffffd7 97 00 10 253 246 227 44 10 99 108 | " yellow #b58900 3/3 yellow 136 #af8700 60 10 65 181 137 0 45 100 71 109 | " orange #cb4b16 9/3 brred 166 #d75f00 50 50 55 203 75 22 18 89 80 110 | " red #dc322f 1/1 red 160 #d70000 50 65 45 220 50 47 1 79 86 111 | " magenta #d33682 5/5 magenta 125 #af005f 50 65 -05 211 54 130 331 74 83 112 | " violet #6c71c4 13/5 brmagenta 61 #5f5faf 50 15 -45 108 113 196 237 45 77 113 | " blue #268bd2 4/4 blue 33 #0087ff 55 -10 -45 38 139 210 205 82 82 114 | " cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63 115 | " green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60 116 | " 117 | " --------------------------------------------------------------------- 118 | " COLORSCHEME HACKING 119 | " --------------------------------------------------------------------- 120 | " 121 | " Useful commands for testing colorschemes: 122 | " :source $VIMRUNTIME/syntax/hitest.vim 123 | " :help highlight-groups 124 | " :help cterm-colors 125 | " :help group-name 126 | " 127 | " Useful links for developing colorschemes: 128 | " http://www.vim.org/scripts/script.php?script_id=2937 129 | " http://vimcasts.org/episodes/creating-colorschemes-for-vim/ 130 | " http://www.frexx.de/xterm-256-notes/" 131 | " 132 | " }}} 133 | " Environment Specific Overrides "{{{ 134 | " Allow or disallow certain features based on current terminal emulator or 135 | " environment. 136 | 137 | " Terminals that support italics 138 | let s:terms_italic=[ 139 | \"rxvt", 140 | \"gnome-terminal" 141 | \] 142 | " For reference only, terminals are known to be incomptible. 143 | " Terminals that are in neither list need to be tested. 144 | let s:terms_noitalic=[ 145 | \"iTerm.app", 146 | \"Apple_Terminal" 147 | \] 148 | if has("gui_running") 149 | let s:terminal_italic=1 " TODO: could refactor to not require this at all 150 | else 151 | let s:terminal_italic=0 " terminals will be guilty until proven compatible 152 | for term in s:terms_italic 153 | if $TERM_PROGRAM =~ term 154 | let s:terminal_italic=1 155 | endif 156 | endfor 157 | endif 158 | 159 | " }}} 160 | " Default option values"{{{ 161 | " --------------------------------------------------------------------- 162 | " s:options_list is used to autogenerate a list of all non-default options 163 | " using "call SolarizedOptions()" or with the "Generate .vimrc commands" 164 | " Solarized menu option. See the "Menus" section below for the function itself. 165 | let s:options_list=[ 166 | \'" this block of commands has been autogenerated by solarized.vim and', 167 | \'" includes the current, non-default Solarized option values.', 168 | \'" To use, place these commands in your .vimrc file (replacing any', 169 | \'" existing colorscheme commands). See also ":help solarized"', 170 | \'', 171 | \'" ------------------------------------------------------------------', 172 | \'" Solarized Colorscheme Config', 173 | \'" ------------------------------------------------------------------', 174 | \] 175 | let s:colorscheme_list=[ 176 | \'syntax enable', 177 | \'set background='.&background, 178 | \'colorscheme solarized', 179 | \] 180 | let s:defaults_list=[ 181 | \'" ------------------------------------------------------------------', 182 | \'', 183 | \'" The following items are available options, but do not need to be', 184 | \'" included in your .vimrc as they are currently set to their defaults.', 185 | \'' 186 | \] 187 | let s:lazycat_list=[ 188 | \'" lazy method of appending this onto your .vimrc ":w! >> ~/.vimrc"', 189 | \'" ------------------------------------------------------------------', 190 | \] 191 | 192 | function! s:SetOption(name,default) 193 | if type(a:default) == type(0) 194 | let l:wrap='' 195 | let l:ewrap='' 196 | else 197 | let l:wrap='"' 198 | let l:ewrap='\"' 199 | endif 200 | if !exists("g:solarized_".a:name) || g:solarized_{a:name}==a:default 201 | exe 'let g:solarized_'.a:name.'='.l:wrap.a:default.l:wrap.'"' 202 | exe 'call add(s:defaults_list, "\" let g:solarized_'.a:name.'='.l:ewrap.g:solarized_{a:name}.l:ewrap.'")' 203 | else 204 | exe 'call add(s:options_list, "let g:solarized_'.a:name.'='.l:ewrap.g:solarized_{a:name}.l:ewrap.' \"default value is '.a:default.'")' 205 | endif 206 | endfunction 207 | 208 | if ($TERM_PROGRAM ==? "apple_terminal" && &t_Co < 256) 209 | let s:solarized_termtrans_default = 1 210 | else 211 | let s:solarized_termtrans_default = 0 212 | endif 213 | call s:SetOption("termtrans",s:solarized_termtrans_default) 214 | call s:SetOption("degrade",0) 215 | call s:SetOption("bold",1) 216 | call s:SetOption("underline",1) 217 | call s:SetOption("italic",1) " note that we need to override this later if the terminal doesn't support 218 | call s:SetOption("termcolors",16) 219 | call s:SetOption("contrast","normal") 220 | call s:SetOption("visibility","normal") 221 | call s:SetOption("diffmode","normal") 222 | call s:SetOption("hitrail",0) 223 | call s:SetOption("menu",1) 224 | 225 | "}}} 226 | " Colorscheme initialization "{{{ 227 | " --------------------------------------------------------------------- 228 | hi clear 229 | if exists("syntax_on") 230 | syntax reset 231 | endif 232 | let colors_name = "solarized" 233 | 234 | "}}} 235 | " GUI & CSApprox hexadecimal palettes"{{{ 236 | " --------------------------------------------------------------------- 237 | " 238 | " Set both gui and terminal color values in separate conditional statements 239 | " Due to possibility that CSApprox is running (though I suppose we could just 240 | " leave the hex values out entirely in that case and include only cterm colors) 241 | " We also check to see if user has set solarized (force use of the 242 | " neutral gray monotone palette component) 243 | if (has("gui_running") && g:solarized_degrade == 0) 244 | let s:vmode = "gui" 245 | let s:base03 = "#002b36" 246 | let s:base02 = "#073642" 247 | let s:base01 = "#586e75" 248 | let s:base00 = "#657b83" 249 | let s:base0 = "#839496" 250 | let s:base1 = "#93a1a1" 251 | let s:base2 = "#eee8d5" 252 | let s:base3 = "#fdf6e3" 253 | let s:yellow = "#b58900" 254 | let s:orange = "#cb4b16" 255 | let s:red = "#dc322f" 256 | let s:magenta = "#d33682" 257 | let s:violet = "#6c71c4" 258 | let s:blue = "#268bd2" 259 | let s:cyan = "#2aa198" 260 | "let s:green = "#859900" "original 261 | let s:green = "#719e07" "experimental 262 | elseif (has("gui_running") && g:solarized_degrade == 1) 263 | " These colors are identical to the 256 color mode. They may be viewed 264 | " while in gui mode via "let g:solarized_degrade=1", though this is not 265 | " recommened and is for testing only. 266 | let s:vmode = "gui" 267 | let s:base03 = "#1c1c1c" 268 | let s:base02 = "#262626" 269 | let s:base01 = "#4e4e4e" 270 | let s:base00 = "#585858" 271 | let s:base0 = "#808080" 272 | let s:base1 = "#8a8a8a" 273 | let s:base2 = "#d7d7af" 274 | let s:base3 = "#ffffd7" 275 | let s:yellow = "#af8700" 276 | let s:orange = "#d75f00" 277 | let s:red = "#af0000" 278 | let s:magenta = "#af005f" 279 | let s:violet = "#5f5faf" 280 | let s:blue = "#0087ff" 281 | let s:cyan = "#00afaf" 282 | let s:green = "#5f8700" 283 | elseif g:solarized_termcolors != 256 && &t_Co >= 16 284 | let s:vmode = "cterm" 285 | let s:base03 = "8" 286 | let s:base02 = "0" 287 | let s:base01 = "10" 288 | let s:base00 = "11" 289 | let s:base0 = "12" 290 | let s:base1 = "14" 291 | let s:base2 = "7" 292 | let s:base3 = "15" 293 | let s:yellow = "3" 294 | let s:orange = "9" 295 | let s:red = "1" 296 | let s:magenta = "5" 297 | let s:violet = "13" 298 | let s:blue = "4" 299 | let s:cyan = "6" 300 | let s:green = "2" 301 | elseif g:solarized_termcolors == 256 302 | let s:vmode = "cterm" 303 | let s:base03 = "234" 304 | let s:base02 = "235" 305 | let s:base01 = "239" 306 | let s:base00 = "240" 307 | let s:base0 = "244" 308 | let s:base1 = "245" 309 | let s:base2 = "187" 310 | let s:base3 = "230" 311 | let s:yellow = "136" 312 | let s:orange = "166" 313 | let s:red = "124" 314 | let s:magenta = "125" 315 | let s:violet = "61" 316 | let s:blue = "33" 317 | let s:cyan = "37" 318 | let s:green = "64" 319 | else 320 | let s:vmode = "cterm" 321 | let s:bright = "* term=bold cterm=bold" 322 | " let s:base03 = "0".s:bright 323 | " let s:base02 = "0" 324 | " let s:base01 = "2".s:bright 325 | " let s:base00 = "3".s:bright 326 | " let s:base0 = "4".s:bright 327 | " let s:base1 = "6".s:bright 328 | " let s:base2 = "7" 329 | " let s:base3 = "7".s:bright 330 | " let s:yellow = "3" 331 | " let s:orange = "1".s:bright 332 | " let s:red = "1" 333 | " let s:magenta = "5" 334 | " let s:violet = "5".s:bright 335 | " let s:blue = "4" 336 | " let s:cyan = "6" 337 | " let s:green = "2" 338 | let s:base03 = "DarkGray" " 0* 339 | let s:base02 = "Black" " 0 340 | let s:base01 = "LightGreen" " 2* 341 | let s:base00 = "LightYellow" " 3* 342 | let s:base0 = "LightBlue" " 4* 343 | let s:base1 = "LightCyan" " 6* 344 | let s:base2 = "LightGray" " 7 345 | let s:base3 = "White" " 7* 346 | let s:yellow = "DarkYellow" " 3 347 | let s:orange = "LightRed" " 1* 348 | let s:red = "DarkRed" " 1 349 | let s:magenta = "DarkMagenta" " 5 350 | let s:violet = "LightMagenta" " 5* 351 | let s:blue = "DarkBlue" " 4 352 | let s:cyan = "DarkCyan" " 6 353 | let s:green = "DarkGreen" " 2 354 | 355 | endif 356 | "}}} 357 | " Formatting options and null values for passthrough effect "{{{ 358 | " --------------------------------------------------------------------- 359 | let s:none = "NONE" 360 | let s:none = "NONE" 361 | let s:t_none = "NONE" 362 | let s:n = "NONE" 363 | let s:c = ",undercurl" 364 | let s:r = ",reverse" 365 | let s:s = ",standout" 366 | let s:ou = "" 367 | let s:ob = "" 368 | "}}} 369 | " Background value based on termtrans setting "{{{ 370 | " --------------------------------------------------------------------- 371 | if (has("gui_running") || g:solarized_termtrans == 0) 372 | let s:back = s:base03 373 | else 374 | let s:back = "NONE" 375 | endif 376 | "}}} 377 | " Alternate light scheme "{{{ 378 | " --------------------------------------------------------------------- 379 | if &background == "light" 380 | let s:temp03 = s:base03 381 | let s:temp02 = s:base02 382 | let s:temp01 = s:base01 383 | let s:temp00 = s:base00 384 | let s:base03 = s:base3 385 | let s:base02 = s:base2 386 | let s:base01 = s:base1 387 | let s:base00 = s:base0 388 | let s:base0 = s:temp00 389 | let s:base1 = s:temp01 390 | let s:base2 = s:temp02 391 | let s:base3 = s:temp03 392 | if (s:back != "NONE") 393 | let s:back = s:base03 394 | endif 395 | endif 396 | "}}} 397 | " Optional contrast schemes "{{{ 398 | " --------------------------------------------------------------------- 399 | if g:solarized_contrast == "high" 400 | let s:base01 = s:base00 401 | let s:base00 = s:base0 402 | let s:base0 = s:base1 403 | let s:base1 = s:base2 404 | let s:base2 = s:base3 405 | let s:back = s:back 406 | endif 407 | if g:solarized_contrast == "low" 408 | let s:back = s:base02 409 | let s:ou = ",underline" 410 | endif 411 | "}}} 412 | " Overrides dependent on user specified values and environment "{{{ 413 | " --------------------------------------------------------------------- 414 | if (g:solarized_bold == 0 || &t_Co == 8 ) 415 | let s:b = "" 416 | let s:bb = ",bold" 417 | else 418 | let s:b = ",bold" 419 | let s:bb = "" 420 | endif 421 | 422 | if g:solarized_underline == 0 423 | let s:u = "" 424 | else 425 | let s:u = ",underline" 426 | endif 427 | 428 | if g:solarized_italic == 0 || s:terminal_italic == 0 429 | let s:i = "" 430 | else 431 | let s:i = ",italic" 432 | endif 433 | "}}} 434 | " Highlighting primitives"{{{ 435 | " --------------------------------------------------------------------- 436 | 437 | exe "let s:bg_none = ' ".s:vmode."bg=".s:none ."'" 438 | exe "let s:bg_back = ' ".s:vmode."bg=".s:back ."'" 439 | exe "let s:bg_base03 = ' ".s:vmode."bg=".s:base03 ."'" 440 | exe "let s:bg_base02 = ' ".s:vmode."bg=".s:base02 ."'" 441 | exe "let s:bg_base01 = ' ".s:vmode."bg=".s:base01 ."'" 442 | exe "let s:bg_base00 = ' ".s:vmode."bg=".s:base00 ."'" 443 | exe "let s:bg_base0 = ' ".s:vmode."bg=".s:base0 ."'" 444 | exe "let s:bg_base1 = ' ".s:vmode."bg=".s:base1 ."'" 445 | exe "let s:bg_base2 = ' ".s:vmode."bg=".s:base2 ."'" 446 | exe "let s:bg_base3 = ' ".s:vmode."bg=".s:base3 ."'" 447 | exe "let s:bg_green = ' ".s:vmode."bg=".s:green ."'" 448 | exe "let s:bg_yellow = ' ".s:vmode."bg=".s:yellow ."'" 449 | exe "let s:bg_orange = ' ".s:vmode."bg=".s:orange ."'" 450 | exe "let s:bg_red = ' ".s:vmode."bg=".s:red ."'" 451 | exe "let s:bg_magenta = ' ".s:vmode."bg=".s:magenta."'" 452 | exe "let s:bg_violet = ' ".s:vmode."bg=".s:violet ."'" 453 | exe "let s:bg_blue = ' ".s:vmode."bg=".s:blue ."'" 454 | exe "let s:bg_cyan = ' ".s:vmode."bg=".s:cyan ."'" 455 | 456 | exe "let s:fg_none = ' ".s:vmode."fg=".s:none ."'" 457 | exe "let s:fg_back = ' ".s:vmode."fg=".s:back ."'" 458 | exe "let s:fg_base03 = ' ".s:vmode."fg=".s:base03 ."'" 459 | exe "let s:fg_base02 = ' ".s:vmode."fg=".s:base02 ."'" 460 | exe "let s:fg_base01 = ' ".s:vmode."fg=".s:base01 ."'" 461 | exe "let s:fg_base00 = ' ".s:vmode."fg=".s:base00 ."'" 462 | exe "let s:fg_base0 = ' ".s:vmode."fg=".s:base0 ."'" 463 | exe "let s:fg_base1 = ' ".s:vmode."fg=".s:base1 ."'" 464 | exe "let s:fg_base2 = ' ".s:vmode."fg=".s:base2 ."'" 465 | exe "let s:fg_base3 = ' ".s:vmode."fg=".s:base3 ."'" 466 | exe "let s:fg_green = ' ".s:vmode."fg=".s:green ."'" 467 | exe "let s:fg_yellow = ' ".s:vmode."fg=".s:yellow ."'" 468 | exe "let s:fg_orange = ' ".s:vmode."fg=".s:orange ."'" 469 | exe "let s:fg_red = ' ".s:vmode."fg=".s:red ."'" 470 | exe "let s:fg_magenta = ' ".s:vmode."fg=".s:magenta."'" 471 | exe "let s:fg_violet = ' ".s:vmode."fg=".s:violet ."'" 472 | exe "let s:fg_blue = ' ".s:vmode."fg=".s:blue ."'" 473 | exe "let s:fg_cyan = ' ".s:vmode."fg=".s:cyan ."'" 474 | 475 | exe "let s:fmt_none = ' ".s:vmode."=NONE". " term=NONE". "'" 476 | exe "let s:fmt_bold = ' ".s:vmode."=NONE".s:b. " term=NONE".s:b."'" 477 | exe "let s:fmt_bldi = ' ".s:vmode."=NONE".s:b. " term=NONE".s:b."'" 478 | exe "let s:fmt_undr = ' ".s:vmode."=NONE".s:u. " term=NONE".s:u."'" 479 | exe "let s:fmt_undb = ' ".s:vmode."=NONE".s:u.s:b. " term=NONE".s:u.s:b."'" 480 | exe "let s:fmt_undi = ' ".s:vmode."=NONE".s:u. " term=NONE".s:u."'" 481 | exe "let s:fmt_uopt = ' ".s:vmode."=NONE".s:ou. " term=NONE".s:ou."'" 482 | exe "let s:fmt_curl = ' ".s:vmode."=NONE".s:c. " term=NONE".s:c."'" 483 | exe "let s:fmt_ital = ' ".s:vmode."=NONE".s:i. " term=NONE".s:i."'" 484 | exe "let s:fmt_stnd = ' ".s:vmode."=NONE".s:s. " term=NONE".s:s."'" 485 | exe "let s:fmt_revr = ' ".s:vmode."=NONE".s:r. " term=NONE".s:r."'" 486 | exe "let s:fmt_revb = ' ".s:vmode."=NONE".s:r.s:b. " term=NONE".s:r.s:b."'" 487 | " revbb (reverse bold for bright colors) is only set to actual bold in low 488 | " color terminals (t_co=8, such as OS X Terminal.app) and should only be used 489 | " with colors 8-15. 490 | exe "let s:fmt_revbb = ' ".s:vmode."=NONE".s:r.s:bb. " term=NONE".s:r.s:bb."'" 491 | exe "let s:fmt_revbbu = ' ".s:vmode."=NONE".s:r.s:bb.s:u." term=NONE".s:r.s:bb.s:u."'" 492 | 493 | if has("gui_running") 494 | exe "let s:sp_none = ' guisp=".s:none ."'" 495 | exe "let s:sp_back = ' guisp=".s:back ."'" 496 | exe "let s:sp_base03 = ' guisp=".s:base03 ."'" 497 | exe "let s:sp_base02 = ' guisp=".s:base02 ."'" 498 | exe "let s:sp_base01 = ' guisp=".s:base01 ."'" 499 | exe "let s:sp_base00 = ' guisp=".s:base00 ."'" 500 | exe "let s:sp_base0 = ' guisp=".s:base0 ."'" 501 | exe "let s:sp_base1 = ' guisp=".s:base1 ."'" 502 | exe "let s:sp_base2 = ' guisp=".s:base2 ."'" 503 | exe "let s:sp_base3 = ' guisp=".s:base3 ."'" 504 | exe "let s:sp_green = ' guisp=".s:green ."'" 505 | exe "let s:sp_yellow = ' guisp=".s:yellow ."'" 506 | exe "let s:sp_orange = ' guisp=".s:orange ."'" 507 | exe "let s:sp_red = ' guisp=".s:red ."'" 508 | exe "let s:sp_magenta = ' guisp=".s:magenta."'" 509 | exe "let s:sp_violet = ' guisp=".s:violet ."'" 510 | exe "let s:sp_blue = ' guisp=".s:blue ."'" 511 | exe "let s:sp_cyan = ' guisp=".s:cyan ."'" 512 | else 513 | let s:sp_none = "" 514 | let s:sp_back = "" 515 | let s:sp_base03 = "" 516 | let s:sp_base02 = "" 517 | let s:sp_base01 = "" 518 | let s:sp_base00 = "" 519 | let s:sp_base0 = "" 520 | let s:sp_base1 = "" 521 | let s:sp_base2 = "" 522 | let s:sp_base3 = "" 523 | let s:sp_green = "" 524 | let s:sp_yellow = "" 525 | let s:sp_orange = "" 526 | let s:sp_red = "" 527 | let s:sp_magenta = "" 528 | let s:sp_violet = "" 529 | let s:sp_blue = "" 530 | let s:sp_cyan = "" 531 | endif 532 | 533 | "}}} 534 | " Basic highlighting"{{{ 535 | " --------------------------------------------------------------------- 536 | " note that link syntax to avoid duplicate configuration doesn't work with the 537 | " exe compiled formats 538 | 539 | exe "hi! Normal" .s:fmt_none .s:fg_base0 .s:bg_back 540 | 541 | exe "hi! Comment" .s:fmt_ital .s:fg_base01 .s:bg_none 542 | " *Comment any comment 543 | 544 | exe "hi! Constant" .s:fmt_none .s:fg_cyan .s:bg_none 545 | " *Constant any constant 546 | " String a string constant: "this is a string" 547 | " Character a character constant: 'c', '\n' 548 | " Number a number constant: 234, 0xff 549 | " Boolean a boolean constant: TRUE, false 550 | " Float a floating point constant: 2.3e10 551 | 552 | exe "hi! Identifier" .s:fmt_none .s:fg_blue .s:bg_none 553 | " *Identifier any variable name 554 | " Function function name (also: methods for classes) 555 | " 556 | exe "hi! Statement" .s:fmt_none .s:fg_green .s:bg_none 557 | " *Statement any statement 558 | " Conditional if, then, else, endif, switch, etc. 559 | " Repeat for, do, while, etc. 560 | " Label case, default, etc. 561 | " Operator "sizeof", "+", "*", etc. 562 | " Keyword any other keyword 563 | " Exception try, catch, throw 564 | 565 | exe "hi! PreProc" .s:fmt_none .s:fg_orange .s:bg_none 566 | " *PreProc generic Preprocessor 567 | " Include preprocessor #include 568 | " Define preprocessor #define 569 | " Macro same as Define 570 | " PreCondit preprocessor #if, #else, #endif, etc. 571 | 572 | exe "hi! Type" .s:fmt_none .s:fg_yellow .s:bg_none 573 | " *Type int, long, char, etc. 574 | " StorageClass static, register, volatile, etc. 575 | " Structure struct, union, enum, etc. 576 | " Typedef A typedef 577 | 578 | exe "hi! Special" .s:fmt_none .s:fg_red .s:bg_none 579 | " *Special any special symbol 580 | " SpecialChar special character in a constant 581 | " Tag you can use CTRL-] on this 582 | " Delimiter character that needs attention 583 | " SpecialComment special things inside a comment 584 | " Debug debugging statements 585 | 586 | exe "hi! Underlined" .s:fmt_none .s:fg_violet .s:bg_none 587 | " *Underlined text that stands out, HTML links 588 | 589 | exe "hi! Ignore" .s:fmt_none .s:fg_none .s:bg_none 590 | " *Ignore left blank, hidden |hl-Ignore| 591 | 592 | exe "hi! Error" .s:fmt_bold .s:fg_red .s:bg_none 593 | " *Error any erroneous construct 594 | 595 | exe "hi! Todo" .s:fmt_bold .s:fg_magenta.s:bg_none 596 | " *Todo anything that needs extra attention; mostly the 597 | " keywords TODO FIXME and XXX 598 | " 599 | "}}} 600 | " Extended highlighting "{{{ 601 | " --------------------------------------------------------------------- 602 | if (g:solarized_visibility=="high") 603 | exe "hi! SpecialKey" .s:fmt_revr .s:fg_red .s:bg_none 604 | exe "hi! NonText" .s:fmt_bold .s:fg_red .s:bg_none 605 | elseif (g:solarized_visibility=="low") 606 | exe "hi! SpecialKey" .s:fmt_bold .s:fg_base02 .s:bg_none 607 | exe "hi! NonText" .s:fmt_bold .s:fg_base02 .s:bg_none 608 | else 609 | exe "hi! SpecialKey" .s:fmt_bold .s:fg_base00 .s:bg_base02 610 | exe "hi! NonText" .s:fmt_bold .s:fg_base00 .s:bg_none 611 | endif 612 | exe "hi! StatusLine" .s:fmt_none .s:fg_base1 .s:bg_base02 .s:fmt_revbb 613 | exe "hi! StatusLineNC" .s:fmt_none .s:fg_base00 .s:bg_base02 .s:fmt_revbb 614 | exe "hi! Visual" .s:fmt_none .s:fg_base01 .s:bg_base03 .s:fmt_revbb 615 | exe "hi! Directory" .s:fmt_none .s:fg_blue .s:bg_none 616 | exe "hi! ErrorMsg" .s:fmt_revr .s:fg_red .s:bg_none 617 | exe "hi! IncSearch" .s:fmt_stnd .s:fg_orange .s:bg_none 618 | exe "hi! Search" .s:fmt_revr .s:fg_yellow .s:bg_none 619 | exe "hi! MoreMsg" .s:fmt_none .s:fg_blue .s:bg_none 620 | exe "hi! ModeMsg" .s:fmt_none .s:fg_blue .s:bg_none 621 | exe "hi! LineNr" .s:fmt_none .s:fg_base01 .s:bg_base02 622 | exe "hi! Question" .s:fmt_bold .s:fg_cyan .s:bg_none 623 | if ( has("gui_running") || &t_Co > 8 ) 624 | exe "hi! VertSplit" .s:fmt_none .s:fg_base00 .s:bg_base00 625 | else 626 | exe "hi! VertSplit" .s:fmt_revbb .s:fg_base00 .s:bg_base02 627 | endif 628 | exe "hi! Title" .s:fmt_bold .s:fg_orange .s:bg_none 629 | exe "hi! VisualNOS" .s:fmt_stnd .s:fg_none .s:bg_base02 .s:fmt_revbb 630 | exe "hi! WarningMsg" .s:fmt_bold .s:fg_red .s:bg_none 631 | exe "hi! WildMenu" .s:fmt_none .s:fg_base2 .s:bg_base02 .s:fmt_revbb 632 | exe "hi! Folded" .s:fmt_undb .s:fg_base0 .s:bg_base02 .s:sp_base03 633 | exe "hi! FoldColumn" .s:fmt_none .s:fg_base0 .s:bg_base02 634 | if (g:solarized_diffmode=="high") 635 | exe "hi! DiffAdd" .s:fmt_revr .s:fg_green .s:bg_none 636 | exe "hi! DiffChange" .s:fmt_revr .s:fg_yellow .s:bg_none 637 | exe "hi! DiffDelete" .s:fmt_revr .s:fg_red .s:bg_none 638 | exe "hi! DiffText" .s:fmt_revr .s:fg_blue .s:bg_none 639 | elseif (g:solarized_diffmode=="low") 640 | exe "hi! DiffAdd" .s:fmt_undr .s:fg_green .s:bg_none .s:sp_green 641 | exe "hi! DiffChange" .s:fmt_undr .s:fg_yellow .s:bg_none .s:sp_yellow 642 | exe "hi! DiffDelete" .s:fmt_bold .s:fg_red .s:bg_none 643 | exe "hi! DiffText" .s:fmt_undr .s:fg_blue .s:bg_none .s:sp_blue 644 | else " normal 645 | if has("gui_running") 646 | exe "hi! DiffAdd" .s:fmt_bold .s:fg_green .s:bg_base02 .s:sp_green 647 | exe "hi! DiffChange" .s:fmt_bold .s:fg_yellow .s:bg_base02 .s:sp_yellow 648 | exe "hi! DiffDelete" .s:fmt_bold .s:fg_red .s:bg_base02 649 | exe "hi! DiffText" .s:fmt_bold .s:fg_blue .s:bg_base02 .s:sp_blue 650 | else 651 | exe "hi! DiffAdd" .s:fmt_none .s:fg_green .s:bg_base02 .s:sp_green 652 | exe "hi! DiffChange" .s:fmt_none .s:fg_yellow .s:bg_base02 .s:sp_yellow 653 | exe "hi! DiffDelete" .s:fmt_none .s:fg_red .s:bg_base02 654 | exe "hi! DiffText" .s:fmt_none .s:fg_blue .s:bg_base02 .s:sp_blue 655 | endif 656 | endif 657 | exe "hi! SignColumn" .s:fmt_none .s:fg_base0 658 | exe "hi! Conceal" .s:fmt_none .s:fg_blue .s:bg_none 659 | exe "hi! SpellBad" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_red 660 | exe "hi! SpellCap" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_violet 661 | exe "hi! SpellRare" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_cyan 662 | exe "hi! SpellLocal" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_yellow 663 | exe "hi! Pmenu" .s:fmt_none .s:fg_base0 .s:bg_base02 .s:fmt_revbb 664 | exe "hi! PmenuSel" .s:fmt_none .s:fg_base01 .s:bg_base2 .s:fmt_revbb 665 | exe "hi! PmenuSbar" .s:fmt_none .s:fg_base2 .s:bg_base0 .s:fmt_revbb 666 | exe "hi! PmenuThumb" .s:fmt_none .s:fg_base0 .s:bg_base03 .s:fmt_revbb 667 | exe "hi! TabLine" .s:fmt_undr .s:fg_base0 .s:bg_base02 .s:sp_base0 668 | exe "hi! TabLineFill" .s:fmt_undr .s:fg_base0 .s:bg_base02 .s:sp_base0 669 | exe "hi! TabLineSel" .s:fmt_undr .s:fg_base01 .s:bg_base2 .s:sp_base0 .s:fmt_revbbu 670 | exe "hi! CursorColumn" .s:fmt_none .s:fg_none .s:bg_base02 671 | exe "hi! CursorLine" .s:fmt_uopt .s:fg_none .s:bg_base02 .s:sp_base1 672 | exe "hi! ColorColumn" .s:fmt_none .s:fg_none .s:bg_base02 673 | exe "hi! Cursor" .s:fmt_none .s:fg_base03 .s:bg_base0 674 | hi! link lCursor Cursor 675 | exe "hi! MatchParen" .s:fmt_bold .s:fg_red .s:bg_base01 676 | 677 | "}}} 678 | " vim syntax highlighting "{{{ 679 | " --------------------------------------------------------------------- 680 | "exe "hi! vimLineComment" . s:fg_base01 .s:bg_none .s:fmt_ital 681 | "hi! link vimComment Comment 682 | "hi! link vimLineComment Comment 683 | hi! link vimVar Identifier 684 | hi! link vimFunc Function 685 | hi! link vimUserFunc Function 686 | hi! link helpSpecial Special 687 | hi! link vimSet Normal 688 | hi! link vimSetEqual Normal 689 | exe "hi! vimCommentString" .s:fmt_none .s:fg_violet .s:bg_none 690 | exe "hi! vimCommand" .s:fmt_none .s:fg_yellow .s:bg_none 691 | exe "hi! vimCmdSep" .s:fmt_bold .s:fg_blue .s:bg_none 692 | exe "hi! helpExample" .s:fmt_none .s:fg_base1 .s:bg_none 693 | exe "hi! helpOption" .s:fmt_none .s:fg_cyan .s:bg_none 694 | exe "hi! helpNote" .s:fmt_none .s:fg_magenta.s:bg_none 695 | exe "hi! helpVim" .s:fmt_none .s:fg_magenta.s:bg_none 696 | exe "hi! helpHyperTextJump" .s:fmt_undr .s:fg_blue .s:bg_none 697 | exe "hi! helpHyperTextEntry".s:fmt_none .s:fg_green .s:bg_none 698 | exe "hi! vimIsCommand" .s:fmt_none .s:fg_base00 .s:bg_none 699 | exe "hi! vimSynMtchOpt" .s:fmt_none .s:fg_yellow .s:bg_none 700 | exe "hi! vimSynType" .s:fmt_none .s:fg_cyan .s:bg_none 701 | exe "hi! vimHiLink" .s:fmt_none .s:fg_blue .s:bg_none 702 | exe "hi! vimHiGroup" .s:fmt_none .s:fg_blue .s:bg_none 703 | exe "hi! vimGroup" .s:fmt_undb .s:fg_blue .s:bg_none 704 | "}}} 705 | " diff highlighting "{{{ 706 | " --------------------------------------------------------------------- 707 | hi! link diffAdded Statement 708 | hi! link diffLine Identifier 709 | "}}} 710 | " git & gitcommit highlighting "{{{ 711 | "git 712 | "exe "hi! gitDateHeader" 713 | "exe "hi! gitIdentityHeader" 714 | "exe "hi! gitIdentityKeyword" 715 | "exe "hi! gitNotesHeader" 716 | "exe "hi! gitReflogHeader" 717 | "exe "hi! gitKeyword" 718 | "exe "hi! gitIdentity" 719 | "exe "hi! gitEmailDelimiter" 720 | "exe "hi! gitEmail" 721 | "exe "hi! gitDate" 722 | "exe "hi! gitMode" 723 | "exe "hi! gitHashAbbrev" 724 | "exe "hi! gitHash" 725 | "exe "hi! gitReflogMiddle" 726 | "exe "hi! gitReference" 727 | "exe "hi! gitStage" 728 | "exe "hi! gitType" 729 | "exe "hi! gitDiffAdded" 730 | "exe "hi! gitDiffRemoved" 731 | "gitcommit 732 | "exe "hi! gitcommitSummary" 733 | exe "hi! gitcommitComment" .s:fmt_ital .s:fg_base01 .s:bg_none 734 | hi! link gitcommitUntracked gitcommitComment 735 | hi! link gitcommitDiscarded gitcommitComment 736 | hi! link gitcommitSelected gitcommitComment 737 | exe "hi! gitcommitUnmerged" .s:fmt_bold .s:fg_green .s:bg_none 738 | exe "hi! gitcommitOnBranch" .s:fmt_bold .s:fg_base01 .s:bg_none 739 | exe "hi! gitcommitBranch" .s:fmt_bold .s:fg_magenta .s:bg_none 740 | hi! link gitcommitNoBranch gitcommitBranch 741 | exe "hi! gitcommitDiscardedType".s:fmt_none .s:fg_red .s:bg_none 742 | exe "hi! gitcommitSelectedType" .s:fmt_none .s:fg_green .s:bg_none 743 | "exe "hi! gitcommitUnmergedType" 744 | "exe "hi! gitcommitType" 745 | "exe "hi! gitcommitNoChanges" 746 | "exe "hi! gitcommitHeader" 747 | exe "hi! gitcommitHeader" .s:fmt_none .s:fg_base01 .s:bg_none 748 | exe "hi! gitcommitUntrackedFile".s:fmt_bold .s:fg_cyan .s:bg_none 749 | exe "hi! gitcommitDiscardedFile".s:fmt_bold .s:fg_red .s:bg_none 750 | exe "hi! gitcommitSelectedFile" .s:fmt_bold .s:fg_green .s:bg_none 751 | exe "hi! gitcommitUnmergedFile" .s:fmt_bold .s:fg_yellow .s:bg_none 752 | exe "hi! gitcommitFile" .s:fmt_bold .s:fg_base0 .s:bg_none 753 | hi! link gitcommitDiscardedArrow gitcommitDiscardedFile 754 | hi! link gitcommitSelectedArrow gitcommitSelectedFile 755 | hi! link gitcommitUnmergedArrow gitcommitUnmergedFile 756 | "exe "hi! gitcommitArrow" 757 | "exe "hi! gitcommitOverflow" 758 | "exe "hi! gitcommitBlank" 759 | " }}} 760 | " html highlighting "{{{ 761 | " --------------------------------------------------------------------- 762 | exe "hi! htmlTag" .s:fmt_none .s:fg_base01 .s:bg_none 763 | exe "hi! htmlEndTag" .s:fmt_none .s:fg_base01 .s:bg_none 764 | exe "hi! htmlTagN" .s:fmt_bold .s:fg_base1 .s:bg_none 765 | exe "hi! htmlTagName" .s:fmt_bold .s:fg_blue .s:bg_none 766 | exe "hi! htmlSpecialTagName".s:fmt_ital .s:fg_blue .s:bg_none 767 | exe "hi! htmlArg" .s:fmt_none .s:fg_base00 .s:bg_none 768 | exe "hi! javaScript" .s:fmt_none .s:fg_yellow .s:bg_none 769 | "}}} 770 | " perl highlighting "{{{ 771 | " --------------------------------------------------------------------- 772 | exe "hi! perlHereDoc" . s:fg_base1 .s:bg_back .s:fmt_none 773 | exe "hi! perlVarPlain" . s:fg_yellow .s:bg_back .s:fmt_none 774 | exe "hi! perlStatementFileDesc". s:fg_cyan.s:bg_back.s:fmt_none 775 | 776 | "}}} 777 | " tex highlighting "{{{ 778 | " --------------------------------------------------------------------- 779 | exe "hi! texStatement" . s:fg_cyan .s:bg_back .s:fmt_none 780 | exe "hi! texMathZoneX" . s:fg_yellow .s:bg_back .s:fmt_none 781 | exe "hi! texMathMatcher" . s:fg_yellow .s:bg_back .s:fmt_none 782 | exe "hi! texMathMatcher" . s:fg_yellow .s:bg_back .s:fmt_none 783 | exe "hi! texRefLabel" . s:fg_yellow .s:bg_back .s:fmt_none 784 | "}}} 785 | " ruby highlighting "{{{ 786 | " --------------------------------------------------------------------- 787 | exe "hi! rubyDefine" . s:fg_base1 .s:bg_back .s:fmt_bold 788 | "rubyInclude 789 | "rubySharpBang 790 | "rubyAccess 791 | "rubyPredefinedVariable 792 | "rubyBoolean 793 | "rubyClassVariable 794 | "rubyBeginEnd 795 | "rubyRepeatModifier 796 | "hi! link rubyArrayDelimiter Special " [ , , ] 797 | "rubyCurlyBlock { , , } 798 | 799 | "hi! link rubyClass Keyword 800 | "hi! link rubyModule Keyword 801 | "hi! link rubyKeyword Keyword 802 | "hi! link rubyOperator Operator 803 | "hi! link rubyIdentifier Identifier 804 | "hi! link rubyInstanceVariable Identifier 805 | "hi! link rubyGlobalVariable Identifier 806 | "hi! link rubyClassVariable Identifier 807 | "hi! link rubyConstant Type 808 | "}}} 809 | " haskell syntax highlighting"{{{ 810 | " --------------------------------------------------------------------- 811 | " For use with syntax/haskell.vim : Haskell Syntax File 812 | " http://www.vim.org/scripts/script.php?script_id=3034 813 | " See also Steffen Siering's github repository: 814 | " http://github.com/urso/dotrc/blob/master/vim/syntax/haskell.vim 815 | " --------------------------------------------------------------------- 816 | " 817 | " Treat True and False specially, see the plugin referenced above 818 | let hs_highlight_boolean=1 819 | " highlight delims, see the plugin referenced above 820 | let hs_highlight_delimiters=1 821 | 822 | exe "hi! cPreCondit". s:fg_orange.s:bg_none .s:fmt_none 823 | 824 | exe "hi! VarId" . s:fg_blue .s:bg_none .s:fmt_none 825 | exe "hi! ConId" . s:fg_yellow .s:bg_none .s:fmt_none 826 | exe "hi! hsImport" . s:fg_magenta.s:bg_none .s:fmt_none 827 | exe "hi! hsString" . s:fg_base00 .s:bg_none .s:fmt_none 828 | 829 | exe "hi! hsStructure" . s:fg_cyan .s:bg_none .s:fmt_none 830 | exe "hi! hs_hlFunctionName" . s:fg_blue .s:bg_none 831 | exe "hi! hsStatement" . s:fg_cyan .s:bg_none .s:fmt_none 832 | exe "hi! hsImportLabel" . s:fg_cyan .s:bg_none .s:fmt_none 833 | exe "hi! hs_OpFunctionName" . s:fg_yellow .s:bg_none .s:fmt_none 834 | exe "hi! hs_DeclareFunction" . s:fg_orange .s:bg_none .s:fmt_none 835 | exe "hi! hsVarSym" . s:fg_cyan .s:bg_none .s:fmt_none 836 | exe "hi! hsType" . s:fg_yellow .s:bg_none .s:fmt_none 837 | exe "hi! hsTypedef" . s:fg_cyan .s:bg_none .s:fmt_none 838 | exe "hi! hsModuleName" . s:fg_green .s:bg_none .s:fmt_undr 839 | exe "hi! hsModuleStartLabel" . s:fg_magenta.s:bg_none .s:fmt_none 840 | hi! link hsImportParams Delimiter 841 | hi! link hsDelimTypeExport Delimiter 842 | hi! link hsModuleStartLabel hsStructure 843 | hi! link hsModuleWhereLabel hsModuleStartLabel 844 | 845 | " following is for the haskell-conceal plugin 846 | " the first two items don't have an impact, but better safe 847 | exe "hi! hsNiceOperator" . s:fg_cyan .s:bg_none .s:fmt_none 848 | exe "hi! hsniceoperator" . s:fg_cyan .s:bg_none .s:fmt_none 849 | 850 | "}}} 851 | " pandoc markdown syntax highlighting "{{{ 852 | " --------------------------------------------------------------------- 853 | 854 | "PandocHiLink pandocNormalBlock 855 | exe "hi! pandocTitleBlock" .s:fg_blue .s:bg_none .s:fmt_none 856 | exe "hi! pandocTitleBlockTitle" .s:fg_blue .s:bg_none .s:fmt_bold 857 | exe "hi! pandocTitleComment" .s:fg_blue .s:bg_none .s:fmt_bold 858 | exe "hi! pandocComment" .s:fg_base01 .s:bg_none .s:fmt_ital 859 | exe "hi! pandocVerbatimBlock" .s:fg_yellow .s:bg_none .s:fmt_none 860 | hi! link pandocVerbatimBlockDeep pandocVerbatimBlock 861 | hi! link pandocCodeBlock pandocVerbatimBlock 862 | hi! link pandocCodeBlockDelim pandocVerbatimBlock 863 | exe "hi! pandocBlockQuote" .s:fg_blue .s:bg_none .s:fmt_none 864 | exe "hi! pandocBlockQuoteLeader1" .s:fg_blue .s:bg_none .s:fmt_none 865 | exe "hi! pandocBlockQuoteLeader2" .s:fg_cyan .s:bg_none .s:fmt_none 866 | exe "hi! pandocBlockQuoteLeader3" .s:fg_yellow .s:bg_none .s:fmt_none 867 | exe "hi! pandocBlockQuoteLeader4" .s:fg_red .s:bg_none .s:fmt_none 868 | exe "hi! pandocBlockQuoteLeader5" .s:fg_base0 .s:bg_none .s:fmt_none 869 | exe "hi! pandocBlockQuoteLeader6" .s:fg_base01 .s:bg_none .s:fmt_none 870 | exe "hi! pandocListMarker" .s:fg_magenta.s:bg_none .s:fmt_none 871 | exe "hi! pandocListReference" .s:fg_magenta.s:bg_none .s:fmt_undr 872 | 873 | " Definitions 874 | " --------------------------------------------------------------------- 875 | let s:fg_pdef = s:fg_violet 876 | exe "hi! pandocDefinitionBlock" .s:fg_pdef .s:bg_none .s:fmt_none 877 | exe "hi! pandocDefinitionTerm" .s:fg_pdef .s:bg_none .s:fmt_stnd 878 | exe "hi! pandocDefinitionIndctr" .s:fg_pdef .s:bg_none .s:fmt_bold 879 | exe "hi! pandocEmphasisDefinition" .s:fg_pdef .s:bg_none .s:fmt_ital 880 | exe "hi! pandocEmphasisNestedDefinition" .s:fg_pdef .s:bg_none .s:fmt_bldi 881 | exe "hi! pandocStrongEmphasisDefinition" .s:fg_pdef .s:bg_none .s:fmt_bold 882 | exe "hi! pandocStrongEmphasisNestedDefinition" .s:fg_pdef.s:bg_none.s:fmt_bldi 883 | exe "hi! pandocStrongEmphasisEmphasisDefinition" .s:fg_pdef.s:bg_none.s:fmt_bldi 884 | exe "hi! pandocStrikeoutDefinition" .s:fg_pdef .s:bg_none .s:fmt_revr 885 | exe "hi! pandocVerbatimInlineDefinition" .s:fg_pdef .s:bg_none .s:fmt_none 886 | exe "hi! pandocSuperscriptDefinition" .s:fg_pdef .s:bg_none .s:fmt_none 887 | exe "hi! pandocSubscriptDefinition" .s:fg_pdef .s:bg_none .s:fmt_none 888 | 889 | " Tables 890 | " --------------------------------------------------------------------- 891 | let s:fg_ptable = s:fg_blue 892 | exe "hi! pandocTable" .s:fg_ptable.s:bg_none .s:fmt_none 893 | exe "hi! pandocTableStructure" .s:fg_ptable.s:bg_none .s:fmt_none 894 | hi! link pandocTableStructureTop pandocTableStructre 895 | hi! link pandocTableStructureEnd pandocTableStructre 896 | exe "hi! pandocTableZebraLight" .s:fg_ptable.s:bg_base03.s:fmt_none 897 | exe "hi! pandocTableZebraDark" .s:fg_ptable.s:bg_base02.s:fmt_none 898 | exe "hi! pandocEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_ital 899 | exe "hi! pandocEmphasisNestedTable" .s:fg_ptable.s:bg_none .s:fmt_bldi 900 | exe "hi! pandocStrongEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_bold 901 | exe "hi! pandocStrongEmphasisNestedTable" .s:fg_ptable.s:bg_none .s:fmt_bldi 902 | exe "hi! pandocStrongEmphasisEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_bldi 903 | exe "hi! pandocStrikeoutTable" .s:fg_ptable.s:bg_none .s:fmt_revr 904 | exe "hi! pandocVerbatimInlineTable" .s:fg_ptable.s:bg_none .s:fmt_none 905 | exe "hi! pandocSuperscriptTable" .s:fg_ptable.s:bg_none .s:fmt_none 906 | exe "hi! pandocSubscriptTable" .s:fg_ptable.s:bg_none .s:fmt_none 907 | 908 | " Headings 909 | " --------------------------------------------------------------------- 910 | let s:fg_phead = s:fg_orange 911 | exe "hi! pandocHeading" .s:fg_phead .s:bg_none.s:fmt_bold 912 | exe "hi! pandocHeadingMarker" .s:fg_yellow.s:bg_none.s:fmt_bold 913 | exe "hi! pandocEmphasisHeading" .s:fg_phead .s:bg_none.s:fmt_bldi 914 | exe "hi! pandocEmphasisNestedHeading" .s:fg_phead .s:bg_none.s:fmt_bldi 915 | exe "hi! pandocStrongEmphasisHeading" .s:fg_phead .s:bg_none.s:fmt_bold 916 | exe "hi! pandocStrongEmphasisNestedHeading" .s:fg_phead .s:bg_none.s:fmt_bldi 917 | exe "hi! pandocStrongEmphasisEmphasisHeading".s:fg_phead .s:bg_none.s:fmt_bldi 918 | exe "hi! pandocStrikeoutHeading" .s:fg_phead .s:bg_none.s:fmt_revr 919 | exe "hi! pandocVerbatimInlineHeading" .s:fg_phead .s:bg_none.s:fmt_bold 920 | exe "hi! pandocSuperscriptHeading" .s:fg_phead .s:bg_none.s:fmt_bold 921 | exe "hi! pandocSubscriptHeading" .s:fg_phead .s:bg_none.s:fmt_bold 922 | 923 | " Links 924 | " --------------------------------------------------------------------- 925 | exe "hi! pandocLinkDelim" .s:fg_base01 .s:bg_none .s:fmt_none 926 | exe "hi! pandocLinkLabel" .s:fg_blue .s:bg_none .s:fmt_undr 927 | exe "hi! pandocLinkText" .s:fg_blue .s:bg_none .s:fmt_undb 928 | exe "hi! pandocLinkURL" .s:fg_base00 .s:bg_none .s:fmt_undr 929 | exe "hi! pandocLinkTitle" .s:fg_base00 .s:bg_none .s:fmt_undi 930 | exe "hi! pandocLinkTitleDelim" .s:fg_base01 .s:bg_none .s:fmt_undi .s:sp_base00 931 | exe "hi! pandocLinkDefinition" .s:fg_cyan .s:bg_none .s:fmt_undr .s:sp_base00 932 | exe "hi! pandocLinkDefinitionID" .s:fg_blue .s:bg_none .s:fmt_bold 933 | exe "hi! pandocImageCaption" .s:fg_violet .s:bg_none .s:fmt_undb 934 | exe "hi! pandocFootnoteLink" .s:fg_green .s:bg_none .s:fmt_undr 935 | exe "hi! pandocFootnoteDefLink" .s:fg_green .s:bg_none .s:fmt_bold 936 | exe "hi! pandocFootnoteInline" .s:fg_green .s:bg_none .s:fmt_undb 937 | exe "hi! pandocFootnote" .s:fg_green .s:bg_none .s:fmt_none 938 | exe "hi! pandocCitationDelim" .s:fg_magenta.s:bg_none .s:fmt_none 939 | exe "hi! pandocCitation" .s:fg_magenta.s:bg_none .s:fmt_none 940 | exe "hi! pandocCitationID" .s:fg_magenta.s:bg_none .s:fmt_undr 941 | exe "hi! pandocCitationRef" .s:fg_magenta.s:bg_none .s:fmt_none 942 | 943 | " Main Styles 944 | " --------------------------------------------------------------------- 945 | exe "hi! pandocStyleDelim" .s:fg_base01 .s:bg_none .s:fmt_none 946 | exe "hi! pandocEmphasis" .s:fg_base0 .s:bg_none .s:fmt_ital 947 | exe "hi! pandocEmphasisNested" .s:fg_base0 .s:bg_none .s:fmt_bldi 948 | exe "hi! pandocStrongEmphasis" .s:fg_base0 .s:bg_none .s:fmt_bold 949 | exe "hi! pandocStrongEmphasisNested" .s:fg_base0 .s:bg_none .s:fmt_bldi 950 | exe "hi! pandocStrongEmphasisEmphasis" .s:fg_base0 .s:bg_none .s:fmt_bldi 951 | exe "hi! pandocStrikeout" .s:fg_base01 .s:bg_none .s:fmt_revr 952 | exe "hi! pandocVerbatimInline" .s:fg_yellow .s:bg_none .s:fmt_none 953 | exe "hi! pandocSuperscript" .s:fg_violet .s:bg_none .s:fmt_none 954 | exe "hi! pandocSubscript" .s:fg_violet .s:bg_none .s:fmt_none 955 | 956 | exe "hi! pandocRule" .s:fg_blue .s:bg_none .s:fmt_bold 957 | exe "hi! pandocRuleLine" .s:fg_blue .s:bg_none .s:fmt_bold 958 | exe "hi! pandocEscapePair" .s:fg_red .s:bg_none .s:fmt_bold 959 | exe "hi! pandocCitationRef" .s:fg_magenta.s:bg_none .s:fmt_none 960 | exe "hi! pandocNonBreakingSpace" . s:fg_red .s:bg_none .s:fmt_revr 961 | hi! link pandocEscapedCharacter pandocEscapePair 962 | hi! link pandocLineBreak pandocEscapePair 963 | 964 | " Embedded Code 965 | " --------------------------------------------------------------------- 966 | exe "hi! pandocMetadataDelim" .s:fg_base01 .s:bg_none .s:fmt_none 967 | exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_none 968 | exe "hi! pandocMetadataKey" .s:fg_blue .s:bg_none .s:fmt_none 969 | exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_bold 970 | hi! link pandocMetadataTitle pandocMetadata 971 | 972 | "}}} 973 | " Utility autocommand "{{{ 974 | " --------------------------------------------------------------------- 975 | " In cases where Solarized is initialized inside a terminal vim session and 976 | " then transferred to a gui session via the command `:gui`, the gui vim process 977 | " does not re-read the colorscheme (or .vimrc for that matter) so any `has_gui` 978 | " related code that sets gui specific values isn't executed. 979 | " 980 | " Currently, Solarized sets only the cterm or gui values for the colorscheme 981 | " depending on gui or terminal mode. It's possible that, if the following 982 | " autocommand method is deemed excessively poor form, that approach will be 983 | " used again and the autocommand below will be dropped. 984 | " 985 | " However it seems relatively benign in this case to include the autocommand 986 | " here. It fires only in cases where vim is transferring from terminal to gui 987 | " mode (detected with the script scope s:vmode variable). It also allows for 988 | " other potential terminal customizations that might make gui mode suboptimal. 989 | " 990 | autocmd GUIEnter * if (s:vmode != "gui") | exe "colorscheme " . g:colors_name | endif 991 | "}}} 992 | " Highlight Trailing Space {{{ 993 | " Experimental: Different highlight when on cursorline 994 | function! s:SolarizedHiTrail() 995 | if g:solarized_hitrail==0 996 | hi! clear solarizedTrailingSpace 997 | else 998 | syn match solarizedTrailingSpace "\s*$" 999 | exe "hi! solarizedTrailingSpace " .s:fmt_undr .s:fg_red .s:bg_none .s:sp_red 1000 | endif 1001 | endfunction 1002 | augroup SolarizedHiTrail 1003 | autocmd! 1004 | if g:solarized_hitrail==1 1005 | autocmd! Syntax * call s:SolarizedHiTrail() 1006 | autocmd! ColorScheme * if g:colors_name == "solarized" | call s:SolarizedHiTrail() | else | augroup! s:SolarizedHiTrail | endif 1007 | endif 1008 | augroup END 1009 | " }}} 1010 | " Menus "{{{ 1011 | " --------------------------------------------------------------------- 1012 | " Turn off Solarized menu by including the following assignment in your .vimrc: 1013 | " 1014 | " let g:solarized_menu=0 1015 | 1016 | function! s:SolarizedOptions() 1017 | new "new buffer 1018 | setf vim "vim filetype 1019 | let failed = append(0, s:defaults_list) 1020 | let failed = append(0, s:colorscheme_list) 1021 | let failed = append(0, s:options_list) 1022 | let failed = append(0, s:lazycat_list) 1023 | 0 "jump back to the top 1024 | endfunction 1025 | if !exists(":SolarizedOptions") 1026 | command SolarizedOptions :call s:SolarizedOptions() 1027 | endif 1028 | 1029 | function! SolarizedMenu() 1030 | if exists("g:loaded_solarized_menu") 1031 | try 1032 | silent! aunmenu Solarized 1033 | endtry 1034 | endif 1035 | let g:loaded_solarized_menu = 1 1036 | 1037 | if g:colors_name == "solarized" && g:solarized_menu != 0 1038 | 1039 | amenu &Solarized.&Contrast.&Low\ Contrast :let g:solarized_contrast="low" \| colorscheme solarized 1040 | amenu &Solarized.&Contrast.&Normal\ Contrast :let g:solarized_contrast="normal" \| colorscheme solarized 1041 | amenu &Solarized.&Contrast.&High\ Contrast :let g:solarized_contrast="high" \| colorscheme solarized 1042 | an &Solarized.&Contrast.-sep- 1043 | amenu &Solarized.&Contrast.&Help:\ Contrast :help 'solarized_contrast' 1044 | 1045 | amenu &Solarized.&Visibility.&Low\ Visibility :let g:solarized_visibility="low" \| colorscheme solarized 1046 | amenu &Solarized.&Visibility.&Normal\ Visibility :let g:solarized_visibility="normal" \| colorscheme solarized 1047 | amenu &Solarized.&Visibility.&High\ Visibility :let g:solarized_visibility="high" \| colorscheme solarized 1048 | an &Solarized.&Visibility.-sep- 1049 | amenu &Solarized.&Visibility.&Help:\ Visibility :help 'solarized_visibility' 1050 | 1051 | amenu &Solarized.&Background.&Toggle\ Background :ToggleBG 1052 | amenu &Solarized.&Background.&Dark\ Background :set background=dark \| colorscheme solarized 1053 | amenu &Solarized.&Background.&Light\ Background :set background=light \| colorscheme solarized 1054 | an &Solarized.&Background.-sep- 1055 | amenu &Solarized.&Background.&Help:\ ToggleBG :help togglebg 1056 | 1057 | if g:solarized_bold==0 | let l:boldswitch="On" | else | let l:boldswitch="Off" | endif 1058 | exe "amenu &Solarized.&Styling.&Turn\\ Bold\\ ".l:boldswitch." :let g:solarized_bold=(abs(g:solarized_bold-1)) \\| colorscheme solarized" 1059 | if g:solarized_italic==0 | let l:italicswitch="On" | else | let l:italicswitch="Off" | endif 1060 | exe "amenu &Solarized.&Styling.&Turn\\ Italic\\ ".l:italicswitch." :let g:solarized_italic=(abs(g:solarized_italic-1)) \\| colorscheme solarized" 1061 | if g:solarized_underline==0 | let l:underlineswitch="On" | else | let l:underlineswitch="Off" | endif 1062 | exe "amenu &Solarized.&Styling.&Turn\\ Underline\\ ".l:underlineswitch." :let g:solarized_underline=(abs(g:solarized_underline-1)) \\| colorscheme solarized" 1063 | 1064 | amenu &Solarized.&Diff\ Mode.&Low\ Diff\ Mode :let g:solarized_diffmode="low" \| colorscheme solarized 1065 | amenu &Solarized.&Diff\ Mode.&Normal\ Diff\ Mode :let g:solarized_diffmode="normal" \| colorscheme solarized 1066 | amenu &Solarized.&Diff\ Mode.&High\ Diff\ Mode :let g:solarized_diffmode="high" \| colorscheme solarized 1067 | 1068 | if g:solarized_hitrail==0 | let l:hitrailswitch="On" | else | let l:hitrailswitch="Off" | endif 1069 | exe "amenu &Solarized.&Experimental.&Turn\\ Highlight\\ Trailing\\ Spaces\\ ".l:hitrailswitch." :let g:solarized_hitrail=(abs(g:solarized_hitrail-1)) \\| colorscheme solarized" 1070 | an &Solarized.&Experimental.-sep- 1071 | amenu &Solarized.&Experimental.&Help:\ HiTrail :help 'solarized_hitrail' 1072 | 1073 | an &Solarized.-sep1- 1074 | 1075 | amenu &Solarized.&Autogenerate\ options :SolarizedOptions 1076 | 1077 | an &Solarized.-sep2- 1078 | 1079 | amenu &Solarized.&Help.&Solarized\ Help :help solarized 1080 | amenu &Solarized.&Help.&Toggle\ Background\ Help :help togglebg 1081 | amenu &Solarized.&Help.&Removing\ This\ Menu :help solarized-menu 1082 | 1083 | an 9999.77 &Help.&Solarized\ Colorscheme :help solarized 1084 | an 9999.78 &Help.&Toggle\ Background :help togglebg 1085 | an 9999.79 &Help.-sep3- 1086 | 1087 | endif 1088 | endfunction 1089 | 1090 | autocmd ColorScheme * if g:colors_name != "solarized" | silent! aunmenu Solarized | else | call SolarizedMenu() | endif 1091 | 1092 | "}}} 1093 | " License "{{{ 1094 | " --------------------------------------------------------------------- 1095 | " 1096 | " Copyright (c) 2011 Ethan Schoonover 1097 | " 1098 | " Permission is hereby granted, free of charge, to any person obtaining a copy 1099 | " of this software and associated documentation files (the "Software"), to deal 1100 | " in the Software without restriction, including without limitation the rights 1101 | " to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1102 | " copies of the Software, and to permit persons to whom the Software is 1103 | " furnished to do so, subject to the following conditions: 1104 | " 1105 | " The above copyright notice and this permission notice shall be included in 1106 | " all copies or substantial portions of the Software. 1107 | " 1108 | " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1109 | " IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1110 | " FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1111 | " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1112 | " LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1113 | " OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1114 | " THE SOFTWARE. 1115 | " 1116 | " vim:foldmethod=marker:foldlevel=0 1117 | "}}} 1118 | -------------------------------------------------------------------------------- /metaclient/wrapdocker: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Ensure that all nodes in /dev/mapper correspond to mapped devices currently loaded by the device-mapper kernel driver 4 | dmsetup mknodes 5 | 6 | # First, make sure that cgroups are mounted correctly. 7 | CGROUP=/sys/fs/cgroup 8 | : {LOG:=stdio} 9 | 10 | [ -d $CGROUP ] || 11 | mkdir $CGROUP 12 | 13 | mountpoint -q $CGROUP || 14 | mount -n -t tmpfs -o uid=0,gid=0,mode=0755 cgroup $CGROUP || { 15 | echo "Could not make a tmpfs mount. Did you use --privileged?" 16 | exit 1 17 | } 18 | 19 | if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security 20 | then 21 | mount -t securityfs none /sys/kernel/security || { 22 | echo "Could not mount /sys/kernel/security." 23 | echo "AppArmor detection and --privileged mode might break." 24 | } 25 | fi 26 | 27 | # Mount the cgroup hierarchies exactly as they are in the parent system. 28 | for SUBSYS in $(cut -d: -f2 /proc/1/cgroup) 29 | do 30 | [ -d $CGROUP/$SUBSYS ] || mkdir $CGROUP/$SUBSYS 31 | mountpoint -q $CGROUP/$SUBSYS || 32 | mount -n -t cgroup -o $SUBSYS cgroup $CGROUP/$SUBSYS 33 | 34 | # The two following sections address a bug which manifests itself 35 | # by a cryptic "lxc-start: no ns_cgroup option specified" when 36 | # trying to start containers withina container. 37 | # The bug seems to appear when the cgroup hierarchies are not 38 | # mounted on the exact same directories in the host, and in the 39 | # container. 40 | 41 | # Named, control-less cgroups are mounted with "-o name=foo" 42 | # (and appear as such under /proc//cgroup) but are usually 43 | # mounted on a directory named "foo" (without the "name=" prefix). 44 | # Systemd and OpenRC (and possibly others) both create such a 45 | # cgroup. To avoid the aforementioned bug, we symlink "foo" to 46 | # "name=foo". This shouldn't have any adverse effect. 47 | echo $SUBSYS | grep -q ^name= && { 48 | NAME=$(echo $SUBSYS | sed s/^name=//) 49 | ln -s $SUBSYS $CGROUP/$NAME 50 | } 51 | 52 | # Likewise, on at least one system, it has been reported that 53 | # systemd would mount the CPU and CPU accounting controllers 54 | # (respectively "cpu" and "cpuacct") with "-o cpuacct,cpu" 55 | # but on a directory called "cpu,cpuacct" (note the inversion 56 | # in the order of the groups). This tries to work around it. 57 | [ $SUBSYS = cpuacct,cpu ] && ln -s $SUBSYS $CGROUP/cpu,cpuacct 58 | done 59 | 60 | # Note: as I write those lines, the LXC userland tools cannot setup 61 | # a "sub-container" properly if the "devices" cgroup is not in its 62 | # own hierarchy. Let's detect this and issue a warning. 63 | grep -q :devices: /proc/1/cgroup || 64 | echo "WARNING: the 'devices' cgroup should be in its own hierarchy." 65 | grep -qw devices /proc/1/cgroup || 66 | echo "WARNING: it looks like the 'devices' cgroup is not mounted." 67 | 68 | # Now, close extraneous file descriptors. 69 | pushd /proc/self/fd >/dev/null 70 | for FD in * 71 | do 72 | case "$FD" in 73 | # Keep stdin/stdout/stderr 74 | [012]) 75 | ;; 76 | # Nuke everything else 77 | *) 78 | eval exec "$FD>&-" 79 | ;; 80 | esac 81 | done 82 | popd >/dev/null 83 | 84 | 85 | # If a pidfile is still around (for example after a container restart), 86 | # delete it so that docker can start. 87 | rm -rf /var/run/docker.pid 88 | 89 | # If we were given a PORT environment variable, start as a simple daemon; 90 | # otherwise, spawn a shell as well 91 | if [ "$PORT" ] 92 | then 93 | exec docker -d -H 0.0.0.0:$PORT -H unix:///var/run/docker.sock \ 94 | $DOCKER_DAEMON_ARGS 95 | else 96 | if [ "$LOG" == "file" ] 97 | then 98 | docker -d $DOCKER_DAEMON_ARGS &>/var/log/docker.log & 99 | else 100 | docker -d $DOCKER_DAEMON_ARGS & 101 | fi 102 | (( timeout = 60 + SECONDS )) 103 | until docker info >/dev/null 2>&1 104 | do 105 | if (( SECONDS >= timeout )); then 106 | echo 'Timed out trying to connect to internal docker host.' >&2 107 | break 108 | fi 109 | sleep 1 110 | done 111 | [[ $1 ]] && exec "$@" 112 | exec bash --login 113 | fi 114 | -------------------------------------------------------------------------------- /nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | # Version: 0.0.1 2 | FROM nginx 3 | MAINTAINER Vallard Benincosa "vallard@benincosa.com" 4 | 5 | VOLUME ["/var/cache/nginx"] 6 | 7 | EXPOSE 80 443 8 | 9 | CMD ["nginx", "-g", "daemon off;"] 10 | -------------------------------------------------------------------------------- /rails/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM vallard/nginx 2 | MAINTAINER Vallard Benincosa "vallard@benincosa.com" 3 | RUN apt-get update 4 | # install the prerequisite patches here so that rvm will install under non-root account. 5 | RUN apt-get install -y curl patch gawk g++ gcc make libc6-dev patch libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev 6 | RUN useradd -ms /bin/bash app 7 | USER app 8 | RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 9 | RUN /bin/bash -l -c "curl -L get.rvm.io | bash -s stable --rails" 10 | RUN /bin/bash -l -c "rvm install 2.1" 11 | RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" 12 | RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" 13 | -------------------------------------------------------------------------------- /static_web/Dockerfile: -------------------------------------------------------------------------------- 1 | # Version: 0.0.1 2 | FROM vallard/nginx 3 | MAINTAINER Vallard Benincosa "vallard@benincosa.com" 4 | ADD index.html /usr/share/nginx/html/ 5 | -------------------------------------------------------------------------------- /static_web/index.html: -------------------------------------------------------------------------------- 1 | 2 | Hi there 3 | 4 |

Hello from this container

5 | 6 | 7 | --------------------------------------------------------------------------------