diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..866fce7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +encrypt/* filter=encrypt diff=encrypt +[merge] + renormalize=true diff --git a/.gitignore b/.gitignore index e650f61..dc5f348 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ vim/plugged/ -vim/evernotetoken.vim vim/.netrwhist vim/view/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1ce5c11 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "dotbot"] + path = dotbot + url = https://github.com/anishathalye/dotbot diff --git a/.nvim/plug.vim b/.nvim/plug.vim deleted file mode 100644 index 0cb8435..0000000 --- a/.nvim/plug.vim +++ /dev/null @@ -1,2020 +0,0 @@ -" vim-plug: Vim plugin manager -" ============================ -" -" Download plug.vim and put it in ~/.vim/autoload -" -" mkdir -p ~/.vim/autoload -" curl -fLo ~/.vim/autoload/plug.vim \ -" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -" -" Edit your .vimrc -" -" call plug#begin('~/.vim/plugged') -" -" " Make sure you use single quotes -" Plug 'junegunn/seoul256.vim' -" Plug 'junegunn/vim-easy-align' -" -" " On-demand loading -" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } -" Plug 'tpope/vim-fireplace', { 'for': 'clojure' } -" -" " Using git URL -" Plug 'https://github.com/junegunn/vim-github-dashboard.git' -" -" " Plugin options -" Plug 'nsf/gocode', { 'tag': 'go.weekly.2012-03-13', 'rtp': 'vim' } -" -" " Plugin outside ~/.vim/plugged with post-update hook -" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } -" -" " Unmanaged plugin (manually installed and updated) -" Plug '~/my-prototype-plugin' -" -" call plug#end() -" -" Then reload .vimrc and :PlugInstall to install plugins. -" Visit https://github.com/junegunn/vim-plug for more information. -" -" -" Copyright (c) 2014 Junegunn Choi -" -" MIT License -" -" Permission is hereby granted, free of charge, to any person obtaining -" a copy of this software and associated documentation files (the -" "Software"), to deal in the Software without restriction, including -" without limitation the rights to use, copy, modify, merge, publish, -" distribute, sublicense, and/or sell copies of the Software, and to -" permit persons to whom the Software is furnished to do so, subject to -" the following conditions: -" -" The above copyright notice and this permission notice shall be -" included in all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -if exists('g:loaded_plug') - finish -endif -let g:loaded_plug = 1 - -let s:cpo_save = &cpo -set cpo&vim - -let s:plug_src = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' -let s:plug_tab = get(s:, 'plug_tab', -1) -let s:plug_buf = get(s:, 'plug_buf', -1) -let s:mac_gui = has('gui_macvim') && has('gui_running') -let s:is_win = has('win32') || has('win64') -let s:py2 = has('python') && !s:is_win -let s:ruby = has('ruby') && (v:version >= 703 || v:version == 702 && has('patch374')) -let s:nvim = has('nvim') && !s:is_win -let s:me = resolve(expand(':p')) -let s:base_spec = { 'branch': 'master', 'frozen': 0 } -let s:TYPE = { -\ 'string': type(''), -\ 'list': type([]), -\ 'dict': type({}), -\ 'funcref': type(function('call')) -\ } -let s:loaded = get(s:, 'loaded', {}) -let s:triggers = get(s:, 'triggers', {}) - -function! plug#begin(...) - if a:0 > 0 - let s:plug_home_org = a:1 - let home = s:path(fnamemodify(expand(a:1), ':p')) - elseif exists('g:plug_home') - let home = s:path(g:plug_home) - elseif !empty(&rtp) - let home = s:path(split(&rtp, ',')[0]) . '/plugged' - else - return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') - endif - - let g:plug_home = home - let g:plugs = {} - let g:plugs_order = [] - let s:triggers = {} - - call s:define_commands() - return 1 -endfunction - -function! s:define_commands() - command! -nargs=+ -bar Plug call s:add() - if !executable('git') - return s:err('`git` executable not found. vim-plug requires git.') - endif - command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('' == '!', []) - command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('' == '!', []) - command! -nargs=0 -bar -bang PlugClean call s:clean('' == '!') - command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif - command! -nargs=0 -bar PlugStatus call s:status() - command! -nargs=0 -bar PlugDiff call s:diff() - command! -nargs=? -bar PlugSnapshot call s:snapshot() -endfunction - -function! s:to_a(v) - return type(a:v) == s:TYPE.list ? a:v : [a:v] -endfunction - -function! s:to_s(v) - return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" -endfunction - -function! s:source(from, ...) - for pattern in a:000 - for vim in s:lines(globpath(a:from, pattern)) - execute 'source' s:esc(vim) - endfor - endfor -endfunction - -function! s:assoc(dict, key, val) - let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) -endfunction - -function! plug#end() - if !exists('g:plugs') - return s:err('Call plug#begin() first') - endif - - if exists('#PlugLOD') - augroup PlugLOD - autocmd! - augroup END - augroup! PlugLOD - endif - let lod = { 'ft': {}, 'map': {}, 'cmd': {} } - - filetype off - for name in g:plugs_order - let plug = g:plugs[name] - if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') - let s:loaded[name] = 1 - continue - endif - - if has_key(plug, 'on') - let s:triggers[name] = { 'map': [], 'cmd': [] } - for cmd in s:to_a(plug.on) - if cmd =~ '^.\+' - if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) - call s:assoc(lod.map, cmd, name) - endif - call add(s:triggers[name].map, cmd) - elseif cmd =~ '^[A-Z]' - if exists(':'.cmd) != 2 - call s:assoc(lod.cmd, cmd, name) - endif - call add(s:triggers[name].cmd, cmd) - endif - endfor - endif - - if has_key(plug, 'for') - let types = s:to_a(plug.for) - if !empty(types) - call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') - endif - for type in types - call s:assoc(lod.ft, type, name) - endfor - endif - endfor - - for [cmd, names] in items(lod.cmd) - execute printf( - \ 'command! -nargs=* -range -bang %s call s:lod_cmd(%s, "", , , , %s)', - \ cmd, string(cmd), string(names)) - endfor - - for [map, names] in items(lod.map) - for [mode, map_prefix, key_prefix] in - \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] - execute printf( - \ '%snoremap %s %s:call lod_map(%s, %s, "%s")', - \ mode, map, map_prefix, string(map), string(names), key_prefix) - endfor - endfor - - for [ft, names] in items(lod.ft) - augroup PlugLOD - execute printf('autocmd FileType %s call lod_ft(%s, %s)', - \ ft, string(ft), string(names)) - augroup END - endfor - - call s:reorg_rtp() - filetype plugin indent on - if has('vim_starting') - syntax enable - else - call s:reload() - endif -endfunction - -function! s:loaded_names() - return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') -endfunction - -function! s:reload() - for name in s:loaded_names() - call s:source(s:rtp(g:plugs[name]), 'plugin/**/*.vim', 'after/plugin/**/*.vim') - endfor -endfunction - -function! s:trim(str) - return substitute(a:str, '[\/]\+$', '', '') -endfunction - -function! s:version_requirement(val, min) - for idx in range(0, len(a:min) - 1) - let v = get(a:val, idx, 0) - if v < a:min[idx] | return 0 - elseif v > a:min[idx] | return 1 - endif - endfor - return 1 -endfunction - -function! s:git_version_requirement(...) - let s:git_version = get(s:, 'git_version', - \ map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)')) - return s:version_requirement(s:git_version, a:000) -endfunction - -function! s:progress_opt(base) - return a:base && !s:is_win && - \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' -endfunction - -if s:is_win - function! s:rtp(spec) - return s:path(a:spec.dir . get(a:spec, 'rtp', '')) - endfunction - - function! s:path(path) - return s:trim(substitute(a:path, '/', '\', 'g')) - endfunction - - function! s:dirpath(path) - return s:path(a:path) . '\' - endfunction - - function! s:is_local_plug(repo) - return a:repo =~? '^[a-z]:' - endfunction -else - function! s:rtp(spec) - return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) - endfunction - - function! s:path(path) - return s:trim(a:path) - endfunction - - function! s:dirpath(path) - return substitute(a:path, '[/\\]*$', '/', '') - endfunction - - function! s:is_local_plug(repo) - return a:repo[0] =~ '[/$~]' - endfunction -endif - -function! s:err(msg) - echohl ErrorMsg - echom a:msg - echohl None - return 0 -endfunction - -function! s:esc(path) - return escape(a:path, ' ') -endfunction - -function! s:escrtp(path) - return escape(a:path, ' ,') -endfunction - -function! s:remove_rtp() - for name in s:loaded_names() - let rtp = s:rtp(g:plugs[name]) - execute 'set rtp-='.s:escrtp(rtp) - let after = globpath(rtp, 'after') - if isdirectory(after) - execute 'set rtp-='.s:escrtp(after) - endif - endfor -endfunction - -function! s:reorg_rtp() - if !empty(s:first_rtp) - execute 'set rtp-='.s:first_rtp - execute 'set rtp-='.s:last_rtp - endif - - " &rtp is modified from outside - if exists('s:prtp') && s:prtp !=# &rtp - call s:remove_rtp() - unlet! s:middle - endif - - let s:middle = get(s:, 'middle', &rtp) - let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') - let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), 'isdirectory(v:val)') - let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') - \ . ','.s:middle.',' - \ . join(map(afters, 'escape(v:val, ",")'), ',') - let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') - let s:prtp = &rtp - - if !empty(s:first_rtp) - execute 'set rtp^='.s:first_rtp - execute 'set rtp+='.s:last_rtp - endif -endfunction - -function! plug#load(...) - if a:0 == 0 - return s:err('Argument missing: plugin name(s) required') - endif - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - let unknowns = filter(copy(a:000), '!has_key(g:plugs, v:val)') - if !empty(unknowns) - let s = len(unknowns) > 1 ? 's' : '' - return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) - end - for name in a:000 - call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - endfor - doautocmd BufRead - return 1 -endfunction - -function! s:remove_triggers(name) - if !has_key(s:triggers, a:name) - return - endif - for cmd in s:triggers[a:name].cmd - execute 'silent! delc' cmd - endfor - for map in s:triggers[a:name].map - execute 'silent! unmap' map - execute 'silent! iunmap' map - endfor - call remove(s:triggers, a:name) -endfunction - -function! s:lod(names, types) - for name in a:names - call s:remove_triggers(name) - let s:loaded[name] = 1 - endfor - call s:reorg_rtp() - - for name in a:names - let rtp = s:rtp(g:plugs[name]) - for dir in a:types - call s:source(rtp, dir.'/**/*.vim') - endfor - endfor -endfunction - -function! s:lod_ft(pat, names) - call s:lod(a:names, ['plugin', 'after/plugin']) - execute 'autocmd! PlugLOD FileType' a:pat - doautocmd filetypeplugin FileType - doautocmd filetypeindent FileType -endfunction - -function! s:lod_cmd(cmd, bang, l1, l2, args, names) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) -endfunction - -function! s:lod_map(map, names, prefix) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - let extra = '' - while 1 - let c = getchar(0) - if c == 0 - break - endif - let extra .= nr2char(c) - endwhile - call feedkeys(a:prefix . substitute(a:map, '^', "\", '') . extra) -endfunction - -function! s:add(repo, ...) - if a:0 > 1 - return s:err('Invalid number of arguments (1..2)') - endif - - try - let repo = s:trim(a:repo) - let name = fnamemodify(repo, ':t:s?\.git$??') - let spec = extend(s:infer_properties(name, repo), - \ a:0 == 1 ? s:parse_options(a:1) : s:base_spec) - if !has_key(g:plugs, name) - call add(g:plugs_order, name) - endif - let g:plugs[name] = spec - let s:loaded[name] = 0 - catch - return s:err(v:exception) - endtry -endfunction - -function! s:parse_options(arg) - let opts = copy(s:base_spec) - let type = type(a:arg) - if type == s:TYPE.string - let opts.tag = a:arg - elseif type == s:TYPE.dict - call extend(opts, a:arg) - if has_key(opts, 'dir') - let opts.dir = s:dirpath(expand(opts.dir)) - endif - else - throw 'Invalid argument type (expected: string or dictionary)' - endif - return opts -endfunction - -function! s:infer_properties(name, repo) - let repo = a:repo - if s:is_local_plug(repo) - return { 'dir': s:dirpath(expand(repo)) } - else - if repo =~ ':' - let uri = repo - else - if repo !~ '/' - let repo = 'vim-scripts/'. repo - endif - let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') - let uri = printf(fmt, repo) - endif - let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') ) - return { 'dir': dir, 'uri': uri } - endif -endfunction - -function! s:install(force, names) - call s:update_impl(0, a:force, a:names) -endfunction - -function! s:update(force, names) - call s:update_impl(1, a:force, a:names) -endfunction - -function! plug#helptags() - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - for spec in values(g:plugs) - let docd = join([spec.dir, 'doc'], '/') - if isdirectory(docd) - silent! execute 'helptags' s:esc(docd) - endif - endfor - return 1 -endfunction - -function! s:syntax() - syntax clear - syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber - syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX - syn match plugNumber /[0-9]\+[0-9.]*/ contained - syn match plugBracket /[[\]]/ contained - syn match plugX /x/ contained - syn match plugDash /^-/ - syn match plugPlus /^+/ - syn match plugStar /^*/ - syn match plugMessage /\(^- \)\@<=.*/ - syn match plugName /\(^- \)\@<=[^ ]*:/ - syn match plugInstall /\(^+ \)\@<=[^:]*/ - syn match plugUpdate /\(^* \)\@<=[^:]*/ - syn match plugCommit /^ [0-9a-z]\{7} .*/ contains=plugRelDate,plugSha - syn match plugSha /\(^ \)\@<=[0-9a-z]\{7}/ contained - syn match plugRelDate /([^)]*)$/ contained - syn match plugNotLoaded /(not loaded)$/ - syn match plugError /^x.*/ - syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean - hi def link plug1 Title - hi def link plug2 Repeat - hi def link plugX Exception - hi def link plugBracket Structure - hi def link plugNumber Number - - hi def link plugDash Special - hi def link plugPlus Constant - hi def link plugStar Boolean - - hi def link plugMessage Function - hi def link plugName Label - hi def link plugInstall Function - hi def link plugUpdate Type - - hi def link plugError Error - hi def link plugRelDate Comment - hi def link plugSha Identifier - - hi def link plugNotLoaded Comment -endfunction - -function! s:lpad(str, len) - return a:str . repeat(' ', a:len - len(a:str)) -endfunction - -function! s:lines(msg) - return split(a:msg, "[\r\n]") -endfunction - -function! s:lastline(msg) - return get(s:lines(a:msg), -1, '') -endfunction - -function! s:new_window() - execute get(g:, 'plug_window', 'vertical topleft new') -endfunction - -function! s:plug_window_exists() - let buflist = tabpagebuflist(s:plug_tab) - return !empty(buflist) && index(buflist, s:plug_buf) >= 0 -endfunction - -function! s:switch_in() - if !s:plug_window_exists() - return 0 - endif - - if winbufnr(0) != s:plug_buf - let s:pos = [tabpagenr(), winnr(), winsaveview()] - execute 'normal!' s:plug_tab.'gt' - let winnr = bufwinnr(s:plug_buf) - execute winnr.'wincmd w' - call add(s:pos, winsaveview()) - else - let s:pos = [winsaveview()] - endif - - setlocal modifiable - return 1 -endfunction - -function! s:switch_out(...) - call winrestview(s:pos[-1]) - setlocal nomodifiable - if a:0 > 0 - execute a:1 - endif - - if len(s:pos) > 1 - execute 'normal!' s:pos[0].'gt' - execute s:pos[1] 'wincmd w' - call winrestview(s:pos[2]) - endif -endfunction - -function! s:prepare() - call s:job_abort() - if s:switch_in() - silent %d _ - else - call s:new_window() - nnoremap q :if b:plug_preview==1pcendifechoq - nnoremap R :silent! call retry() - nnoremap D :PlugDiff - nnoremap S :PlugStatus - nnoremap U :call status_update() - xnoremap U :call status_update() - nnoremap ]] :silent! call section('') - nnoremap [[ :silent! call section('b') - let b:plug_preview = -1 - let s:plug_tab = tabpagenr() - let s:plug_buf = winbufnr(0) - call s:assign_name() - endif - silent! unmap - silent! unmap L - silent! unmap o - silent! unmap X - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable - setf vim-plug - call s:syntax() -endfunction - -function! s:assign_name() - " Assign buffer name - let prefix = '[Plugins]' - let name = prefix - let idx = 2 - while bufexists(name) - let name = printf('%s (%s)', prefix, idx) - let idx = idx + 1 - endwhile - silent! execute 'f' fnameescape(name) -endfunction - -function! s:do(pull, force, todo) - for [name, spec] in items(a:todo) - if !isdirectory(spec.dir) - continue - endif - let installed = has_key(s:update.new, name) - let updated = installed ? 0 : - \ (a:pull && !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', spec.dir))) - if a:force || installed || updated - execute 'cd' s:esc(spec.dir) - call append(3, '- Post-update hook for '. name .' ... ') - let type = type(spec.do) - if type == s:TYPE.string - try - " FIXME: Escaping is incomplete. We could use shellescape with eval, - " but it won't work on Windows. - let g:_plug_do = '!'.escape(spec.do, '#!%') - execute "normal! :execute g:_plug_do\\" - finally - let result = v:shell_error ? ('Exit status: '.v:shell_error) : 'Done!' - unlet g:_plug_do - endtry - elseif type == s:TYPE.funcref - try - let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') - call spec.do({ 'name': name, 'status': status, 'force': a:force }) - let result = 'Done!' - catch - let result = 'Error: ' . v:exception - endtry - else - let result = 'Error: Invalid type!' - endif - call setline(4, getline(4) . result) - cd - - endif - endfor -endfunction - -function! s:finish(pull) - let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) - if new_frozen - let s = new_frozen > 1 ? 's' : '' - call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) - endif - call append(3, '- Finishing ... ') - redraw - call plug#helptags() - call plug#end() - call setline(4, getline(4) . 'Done!') - redraw - let msgs = [] - if !empty(s:update.errors) - call add(msgs, "Press 'R' to retry.") - endif - if a:pull && len(s:update.new) < len(filter(getline(5, '$'), - \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) - call add(msgs, "Press 'D' to see the updated changes.") - endif - echo join(msgs, ' ') -endfunction - -function! s:retry() - if empty(s:update.errors) - return - endif - call s:update_impl(s:update.pull, s:update.force, - \ extend(copy(s:update.errors), [s:update.threads])) -endfunction - -function! s:is_managed(name) - return has_key(g:plugs[a:name], 'uri') -endfunction - -function! s:names(...) - return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) -endfunction - -function! s:update_impl(pull, force, args) abort - let args = copy(a:args) - let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? - \ remove(args, -1) : get(g:, 'plug_threads', 16) - - let managed = filter(copy(g:plugs), 's:is_managed(v:key)') - let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : - \ filter(managed, 'index(args, v:key) >= 0') - - if empty(todo) - echohl WarningMsg - echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.' - echohl None - return - endif - - if !s:is_win && s:git_version_requirement(2, 3) - let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' - let $GIT_TERMINAL_PROMPT = 0 - for plug in values(todo) - let plug.uri = substitute(plug.uri, - \ '^https://git::@github\.com', 'https://github.com', '') - endfor - endif - - if !isdirectory(g:plug_home) - try - call mkdir(g:plug_home, 'p') - catch - return s:err(printf('Invalid plug directory: %s. '. - \ 'Try to call plug#begin with a valid directory', g:plug_home)) - endtry - endif - - let s:update = { - \ 'start': reltime(), - \ 'all': todo, - \ 'todo': copy(todo), - \ 'errors': [], - \ 'pull': a:pull, - \ 'force': a:force, - \ 'new': {}, - \ 'threads': (s:py2 || s:ruby || s:nvim) ? min([len(todo), threads]) : 1, - \ 'bar': '', - \ 'fin': 0 - \ } - - call s:prepare() - call append(0, ['', '']) - normal! 2G - - " Python version requirement (>= 2.7) - if s:py2 && !s:ruby && !s:nvim && s:update.threads > 1 - redir => pyv - silent python import platform; print(platform.python_version()) - redir END - let s:py2 = s:version_requirement( - \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) - endif - if (s:py2 || s:ruby) && !s:nvim && s:update.threads > 1 - try - let imd = &imd - if s:mac_gui - set noimd - endif - if s:ruby - call s:update_ruby() - else - call s:update_python() - endif - catch - let lines = getline(4, '$') - let printed = {} - silent! 4,$d _ - for line in lines - let name = s:extract_name(line, '.', '') - if empty(name) || !has_key(printed, name) - call append('$', line) - if !empty(name) - let printed[name] = 1 - if line[0] == 'x' && index(s:update.errors, name) < 0 - call add(s:update.errors, name) - end - endif - endif - endfor - finally - let &imd = imd - call s:update_finish() - endtry - else - call s:update_vim() - endif -endfunction - -function! s:update_finish() - if exists('s:git_terminal_prompt') - let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt - endif - if s:switch_in() - call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'has_key(v:val, "do")')) - call s:finish(s:update.pull) - call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') - call s:switch_out('normal! gg') - endif -endfunction - -function! s:job_abort() - if !s:nvim || !exists('s:jobs') - return - endif - augroup PlugJobControl - autocmd! - augroup END - for [name, j] in items(s:jobs) - silent! call jobstop(j.jobid) - if j.new - call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) - endif - endfor - let s:jobs = {} -endfunction - -function! s:job_handler(name) abort - if !s:plug_window_exists() " plug window closed - return s:job_abort() - endif - - if !has_key(s:jobs, a:name) - return - endif - let job = s:jobs[a:name] - - if v:job_data[1] == 'exit' - let job.running = 0 - if s:lastline(job.result) ==# 'Error' - let job.error = 1 - let job.result = substitute(job.result, "Error[\r\n]$", '', '') - endif - call s:reap(a:name) - call s:tick() - else - let job.result .= s:to_s(v:job_data[2]) - " To reduce the number of buffer updates - let job.tick = get(job, 'tick', -1) + 1 - if job.tick % len(s:jobs) == 0 - call s:log(job.new ? '+' : '*', a:name, job.result) - endif - endif -endfunction - -function! s:spawn(name, cmd, opts) - let job = { 'running': 1, 'new': get(a:opts, 'new', 0), - \ 'error': 0, 'result': '' } - let s:jobs[a:name] = job - - if s:nvim - let x = jobstart(a:name, 'sh', ['-c', - \ (has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) - \ . ' || echo Error']) - if x > 0 - let job.jobid = x - augroup PlugJobControl - execute 'autocmd JobActivity' a:name printf('call s:job_handler(%s)', string(a:name)) - augroup END - else - let job.running = 0 - let job.error = 1 - let job.result = x < 0 ? 'sh is not executable' : - \ 'Invalid arguments (or job table is full)' - endif - else - let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd] - let job.result = call('s:system', params) - let job.error = v:shell_error != 0 - let job.running = 0 - endif -endfunction - -function! s:reap(name) - if s:nvim - silent! execute 'autocmd! PlugJobControl JobActivity' a:name - endif - - let job = s:jobs[a:name] - if job.error - call add(s:update.errors, a:name) - elseif get(job, 'new', 0) - let s:update.new[a:name] = 1 - endif - let s:update.bar .= job.error ? 'x' : '=' - - call s:log(job.error ? 'x' : '-', a:name, job.result) - call s:bar() - - call remove(s:jobs, a:name) -endfunction - -function! s:bar() - if s:switch_in() - let total = len(s:update.all) - call setline(1, (s:update.pull ? 'Updating' : 'Installing'). - \ ' plugins ('.len(s:update.bar).'/'.total.')') - call s:progress_bar(2, s:update.bar, total) - call s:switch_out() - endif -endfunction - -function! s:logpos(name) - for i in range(1, line('$')) - if getline(i) =~# '^[-+x*] '.a:name.':' - return i - endif - endfor - return 0 -endfunction - -function! s:log(bullet, name, lines) - if s:switch_in() - let pos = s:logpos(a:name) - if pos > 0 - execute pos 'd _' - if pos > winheight('.') - let pos = 4 - endif - else - let pos = 4 - endif - call append(pos - 1, s:format_message(a:bullet, a:name, a:lines)) - call s:switch_out() - endif -endfunction - -function! s:update_vim() - let s:jobs = {} - - call s:bar() - call s:tick() -endfunction - -function! s:tick() - let pull = s:update.pull - let prog = s:progress_opt(s:nvim) -while 1 " Without TCO, Vim stack is bound to explode - if empty(s:update.todo) - if empty(s:jobs) && !s:update.fin - let s:update.fin = 1 - call s:update_finish() - endif - return - endif - - let name = keys(s:update.todo)[0] - let spec = remove(s:update.todo, name) - let new = !isdirectory(spec.dir) - - call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') - redraw - - let checkout = s:shellesc(has_key(spec, 'tag') ? spec.tag : spec.branch) - let merge = s:shellesc(has_key(spec, 'tag') ? spec.tag : 'origin/'.spec.branch) - - if !new - let [valid, msg] = s:git_valid(spec, 0) - if valid - if pull - call s:spawn(name, - \ printf('(git fetch %s 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only %s 2>&1 && git submodule update --init --recursive 2>&1)', - \ prog, checkout, merge), { 'dir': spec.dir }) - else - let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } - endif - else - let s:jobs[name] = { 'running': 0, 'result': msg, 'error': 1 } - endif - else - call s:spawn(name, - \ printf('git clone %s --recursive %s -b %s %s 2>&1', - \ prog, - \ s:shellesc(spec.uri), - \ checkout, - \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) - endif - - if !s:jobs[name].running - call s:reap(name) - endif - if len(s:jobs) >= s:update.threads - break - endif -endwhile -endfunction - -function! s:update_python() -python << EOF -""" Due to use of signals this function is POSIX only. """ -import datetime -import functools -import os -import Queue -import random -import re -import shutil -import signal -import subprocess -import tempfile -import threading as thr -import time -import traceback -import vim - -G_PULL = vim.eval('s:update.pull') == '1' -G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 -G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) -G_PROGRESS = vim.eval('s:progress_opt(1)') -G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) -G_STOP = thr.Event() - -class CmdTimedOut(Exception): - pass -class CmdFailed(Exception): - pass -class InvalidURI(Exception): - pass -class Action(object): - INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] - -class GLog(object): - ON = None - LOGDIR = None - @classmethod - def write(cls, msg): - if cls.ON is None: - cls.ON = int(vim.eval('get(g:, "plug_log_on", 0)')) - cls.LOGDIR = os.path.expanduser(vim.eval('get(g:, "plug_logs", "~/plug_logs")')) - if cls.ON: - if not os.path.exists(cls.LOGDIR): - os.makedirs(cls.LOGDIR) - cls._write(msg) - @classmethod - def _write(cls, msg): - name = thr.current_thread().name - fname = cls.LOGDIR + os.path.sep + name - with open(fname, 'ab') as flog: - ltime = datetime.datetime.now().strftime("%H:%M:%S.%f") - msg = '[{0},{1}] {2}{3}'.format(name, ltime, msg, '\n') - flog.write(msg) - -class Buffer(object): - def __init__(self, lock, num_plugs): - self.bar = '' - self.event = 'Updating' if vim.eval('s:update.pull') == '1' else 'Installing' - self.is_win = vim.eval('s:is_win') == '1' - self.lock = lock - self.maxy = int(vim.eval('winheight(".")')) - self.num_plugs = num_plugs - - def _where(self, name): - """ Find first line with name in current buffer. Return line num. """ - found, lnum = False, 0 - matcher = re.compile('^[-+x*] {0}:'.format(name)) - for line in vim.current.buffer: - if matcher.search(line) is not None: - found = True - break - lnum += 1 - - if not found: - lnum = -1 - return lnum - - def header(self): - curbuf = vim.current.buffer - curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) - - num_spaces = self.num_plugs - len(self.bar) - curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') - - vim.command('normal! 2G') - if not self.is_win: - vim.command('redraw') - - def write(self, *args, **kwargs): - with self.lock: - self._write(*args, **kwargs) - - def _write(self, action, name, lines): - first, rest = lines[0], lines[1:] - msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] - padded_rest = [' ' + line for line in rest] - msg.extend(padded_rest) - - try: - if action == Action.ERROR: - self.bar += 'x' - vim.command("call add(s:update.errors, '{0}')".format(name)) - elif action == Action.DONE: - self.bar += '=' - - curbuf = vim.current.buffer - lnum = self._where(name) - if lnum != -1: # Found matching line num - del curbuf[lnum] - if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): - lnum = 3 - else: - lnum = 3 - curbuf.append(msg, lnum) - - self.header() - except vim.error: - GLog.write('Buffer Update FAILED.') - -class Command(object): - def __init__(self, cmd, cmd_dir=None, timeout=60, ntries=3, cb=None, clean=None): - self.cmd = cmd - self.cmd_dir = cmd_dir - self.timeout = timeout - self.ntries = ntries - self.callback = cb if cb else (lambda msg: None) - self.clean = clean - - def attempt_cmd(self): - """ Tries to run the command, returns result if no exceptions. """ - attempt = 0 - finished = False - limit = self.timeout - - while not finished: - try: - attempt += 1 - result = self.timeout_cmd() - finished = True - except CmdTimedOut: - if attempt != self.ntries: - for count in range(3, 0, -1): - if G_STOP.is_set(): - raise KeyboardInterrupt - msg = 'Timeout. Will retry in {0} second{1} ...'.format( - count, 's' if count != 1 else '') - self.callback([msg]) - time.sleep(1) - self.timeout += limit - self.callback(['Retrying ...']) - else: - raise - - return result - - def timeout_cmd(self): - """ Execute a cmd & poll for callback. Returns list of output. - Raises CmdFailed -> return code for Popen isn't 0 - Raises CmdTimedOut -> command exceeded timeout without new output - """ - proc = None - first_line = True - try: - tfile = tempfile.NamedTemporaryFile() - proc = subprocess.Popen(self.cmd, cwd=self.cmd_dir, stdout=tfile, - stderr=subprocess.STDOUT, shell=True, preexec_fn=os.setsid) - while proc.poll() is None: - # Yield this thread - time.sleep(0.2) - - if G_STOP.is_set(): - raise KeyboardInterrupt - - if first_line or random.random() < G_LOG_PROB: - first_line = False - line = nonblock_read(tfile.name) - if line: - self.callback([line]) - - time_diff = time.time() - os.path.getmtime(tfile.name) - if time_diff > self.timeout: - raise CmdTimedOut(['Timeout!']) - - tfile.seek(0) - result = [line.rstrip() for line in tfile] - - if proc.returncode != 0: - msg = [''] - msg.extend(result) - raise CmdFailed(msg) - except: - if proc and proc.poll() is None: - os.killpg(proc.pid, signal.SIGTERM) - if self.clean: - self.clean() - raise - - return result - -class Plugin(object): - def __init__(self, name, args, buf, lock): - self.name = name - self.args = args - self.buf = buf - self.lock = lock - tag = args.get('tag', 0) - self.checkout = esc(tag if tag else args['branch']) - self.merge = esc(tag if tag else 'origin/' + args['branch']) - - def manage(self): - try: - if os.path.exists(self.args['dir']): - self.update() - else: - self.install() - with self.lock: - vim.command("let s:update.new['{0}'] = 1".format(self.name)) - except (CmdTimedOut, CmdFailed, InvalidURI) as exc: - self.write(Action.ERROR, self.name, exc.message) - except KeyboardInterrupt: - G_STOP.set() - self.write(Action.ERROR, self.name, ['Interrupted!']) - except: - # Any exception except those above print stack trace - msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) - self.write(Action.ERROR, self.name, msg.split('\n')) - raise - - def install(self): - target = self.args['dir'] - - def clean(target): - def _clean(): - try: - shutil.rmtree(target) - except OSError: - pass - return _clean - - self.write(Action.INSTALL, self.name, ['Installing ...']) - callback = functools.partial(self.buf.write, Action.INSTALL, self.name) - cmd = 'git clone {0} --recursive {1} -b {2} {3} 2>&1'.format( - G_PROGRESS, self.args['uri'], self.checkout, esc(target)) - com = Command(cmd, None, G_TIMEOUT, G_RETRIES, callback, clean(target)) - result = com.attempt_cmd() - self.write(Action.DONE, self.name, result[-1:]) - - def update(self): - match = re.compile(r'git::?@') - actual_uri = re.sub(match, '', self.repo_uri()) - expect_uri = re.sub(match, '', self.args['uri']) - if actual_uri != expect_uri: - msg = ['', - 'Invalid URI: {0}'.format(actual_uri), - 'Expected {0}'.format(expect_uri), - 'PlugClean required.'] - raise InvalidURI(msg) - - if G_PULL: - self.write(Action.UPDATE, self.name, ['Updating ...']) - callback = functools.partial(self.buf.write, Action.UPDATE, self.name) - cmds = ['git fetch {0}'.format(G_PROGRESS), - 'git checkout -q {0}'.format(self.checkout), - 'git merge --ff-only {0}'.format(self.merge), - 'git submodule update --init --recursive'] - cmd = ' 2>&1 && '.join(cmds) - GLog.write(cmd) - com = Command(cmd, self.args['dir'], G_TIMEOUT, G_RETRIES, callback) - result = com.attempt_cmd() - GLog.write(result) - self.write(Action.DONE, self.name, result[-1:]) - else: - self.write(Action.DONE, self.name, ['Already installed']) - - def repo_uri(self): - cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url' - command = Command(cmd, self.args['dir'], G_TIMEOUT, G_RETRIES) - result = command.attempt_cmd() - return result[-1] - - def write(self, action, name, msg): - GLog.write('{0} {1}: {2}'.format(action, name, '\n'.join(msg))) - self.buf.write(action, name, msg) - -class PlugThread(thr.Thread): - def __init__(self, tname, args): - super(PlugThread, self).__init__() - self.tname = tname - self.args = args - - def run(self): - thr.current_thread().name = self.tname - work_q, lock, buf = self.args - - try: - while not G_STOP.is_set(): - name, args = work_q.get_nowait() - GLog.write('{0}: Dir {1}'.format(name, args['dir'])) - plug = Plugin(name, args, buf, lock) - plug.manage() - work_q.task_done() - except Queue.Empty: - GLog.write('Queue now empty.') - -class RefreshThread(thr.Thread): - def __init__(self, lock): - super(RefreshThread, self).__init__() - self.lock = lock - self.running = True - - def run(self): - while self.running: - with self.lock: - vim.command('noautocmd normal! a') - time.sleep(0.2) - - def stop(self): - self.running = False - -def esc(name): - return '"' + name.replace('"', '\"') + '"' - -def nonblock_read(fname): - """ Read a file with nonblock flag. Return the last line. """ - fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) - buf = os.read(fread, 100000) - os.close(fread) - - line = buf.rstrip('\r\n') - left = max(line.rfind('\r'), line.rfind('\n')) - if left != -1: - left += 1 - line = line[left:] - - return line - -def main(): - thr.current_thread().name = 'main' - GLog.write('') - if GLog.ON and os.path.exists(GLog.LOGDIR): - shutil.rmtree(GLog.LOGDIR) - - threads = [] - nthreads = int(vim.eval('s:update.threads')) - plugs = vim.eval('s:update.todo') - mac_gui = vim.eval('s:mac_gui') == '1' - is_win = vim.eval('s:is_win') == '1' - GLog.write('Plugs: {0}'.format(plugs)) - GLog.write('PULL: {0}, WIN: {1}, MAC: {2}'.format(G_PULL, is_win, mac_gui)) - GLog.write('Num Threads: {0}'.format(nthreads)) - - lock = thr.Lock() - buf = Buffer(lock, len(plugs)) - work_q = Queue.Queue() - for work in plugs.items(): - work_q.put(work) - - GLog.write('Starting Threads') - for num in range(nthreads): - tname = 'PlugT-{0:02}'.format(num) - thread = PlugThread(tname, (work_q, lock, buf)) - thread.start() - threads.append(thread) - if mac_gui: - rthread = RefreshThread(lock) - rthread.start() - - GLog.write('Joining Live Threads') - for thread in threads: - thread.join() - if mac_gui: - rthread.stop() - rthread.join() - GLog.write('Cleanly Exited Main') - -main() -EOF -endfunction - -function! s:update_ruby() - ruby << EOF - module PlugStream - SEP = ["\r", "\n", nil] - def get_line - buffer = '' - loop do - char = readchar rescue return - if SEP.include? char.chr - buffer << $/ - break - else - buffer << char - end - end - buffer - end - end unless defined?(PlugStream) - - def esc arg - %["#{arg.gsub('"', '\"')}"] - end - - def killall pid - pids = [pid] - unless `which pgrep 2> /dev/null`.empty? - children = pids - until children.empty? - children = children.map { |pid| - `pgrep -P #{pid}`.lines.map { |l| l.chomp } - }.flatten - pids += children - end - end - pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } - end - - require 'thread' - require 'fileutils' - require 'timeout' - running = true - iswin = VIM::evaluate('s:is_win').to_i == 1 - pull = VIM::evaluate('s:update.pull').to_i == 1 - base = VIM::evaluate('g:plug_home') - all = VIM::evaluate('s:update.todo') - limit = VIM::evaluate('get(g:, "plug_timeout", 60)') - tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 - nthr = VIM::evaluate('s:update.threads').to_i - maxy = VIM::evaluate('winheight(".")').to_i - cd = iswin ? 'cd /d' : 'cd' - tot = VIM::evaluate('len(s:update.todo)') || 0 - bar = '' - skip = 'Already installed' - mtx = Mutex.new - take1 = proc { mtx.synchronize { running && all.shift } } - logh = proc { - cnt = bar.length - $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" - $curbuf[2] = '[' + bar.ljust(tot) + ']' - VIM::command('normal! 2G') - VIM::command('redraw') unless iswin - } - where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } - log = proc { |name, result, type| - mtx.synchronize do - ing = ![true, false].include?(type) - bar += type ? '=' : 'x' unless ing - b = case type - when :install then '+' when :update then '*' - when true, nil then '-' else - VIM::command("call add(s:update.errors, '#{name}')") - 'x' - end - result = - if type || type.nil? - ["#{b} #{name}: #{result.lines.to_a.last}"] - elsif result =~ /^Interrupted|^Timeout/ - ["#{b} #{name}: #{result}"] - else - ["#{b} #{name}"] + result.lines.map { |l| " " << l } - end - if lnum = where.call(name) - $curbuf.delete lnum - lnum = 4 if ing && lnum > maxy - end - result.each_with_index do |line, offset| - $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) - end - logh.call - end - } - bt = proc { |cmd, name, type, cleanup| - tried = timeout = 0 - begin - tried += 1 - timeout += limit - fd = nil - data = '' - if iswin - Timeout::timeout(timeout) do - tmp = VIM::evaluate('tempname()') - system("(#{cmd}) > #{tmp}") - data = File.read(tmp).chomp - File.unlink tmp rescue nil - end - else - fd = IO.popen(cmd).extend(PlugStream) - first_line = true - log_prob = 1.0 / nthr - while line = Timeout::timeout(timeout) { fd.get_line } - data << line - log.call name, line.chomp, type if name && (first_line || rand < log_prob) - first_line = false - end - fd.close - end - [$? == 0, data.chomp] - rescue Timeout::Error, Interrupt => e - if fd && !fd.closed? - killall fd.pid - fd.close - end - cleanup.call if cleanup - if e.is_a?(Timeout::Error) && tried < tries - 3.downto(1) do |countdown| - s = countdown > 1 ? 's' : '' - log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type - sleep 1 - end - log.call name, 'Retrying ...', type - retry - end - [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] - end - } - main = Thread.current - threads = [] - watcher = Thread.new { - while VIM::evaluate('getchar(1)') - sleep 0.1 - end - mtx.synchronize do - running = false - threads.each { |t| t.raise Interrupt } - end - threads.each { |t| t.join rescue nil } - main.kill - } - refresh = Thread.new { - while true - mtx.synchronize do - break unless running - VIM::command('noautocmd normal! a') - end - sleep 0.2 - end - } if VIM::evaluate('s:mac_gui') == 1 - - progress = VIM::evaluate('s:progress_opt(1)') - nthr.times do - mtx.synchronize do - threads << Thread.new { - while pair = take1.call - name = pair.first - dir, uri, branch, tag = pair.last.values_at *%w[dir uri branch tag] - checkout = esc(tag ? tag : branch) - merge = esc(tag ? tag : "origin/#{branch}") - subm = "git submodule update --init --recursive 2>&1" - exists = File.directory? dir - ok, result = - if exists - dir = iswin ? dir : esc(dir) - ret, data = bt.call "#{cd} #{dir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url", nil, nil, nil - current_uri = data.lines.to_a.last - if !ret - if data =~ /^Interrupted|^Timeout/ - [false, data] - else - [false, [data.chomp, "PlugClean required."].join($/)] - end - elsif current_uri.sub(/git::?@/, '') != uri.sub(/git::?@/, '') - [false, ["Invalid URI: #{current_uri}", - "Expected: #{uri}", - "PlugClean required."].join($/)] - else - if pull - log.call name, 'Updating ...', :update - bt.call "#{cd} #{dir} && git fetch #{progress} 2>&1 && git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm}", name, :update, nil - else - [true, skip] - end - end - else - d = esc dir.sub(%r{[\\/]+$}, '') - log.call name, 'Installing ...', :install - bt.call "git clone #{progress} --recursive #{uri} -b #{checkout} #{d} 2>&1", name, :install, proc { - FileUtils.rm_rf dir - } - end - mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok - log.call name, result, ok - end - } if running - end - end - threads.each { |t| t.join rescue nil } - logh.call - refresh.kill if refresh - watcher.kill -EOF -endfunction - -function! s:shellesc(arg) - return '"'.escape(a:arg, '"').'"' -endfunction - -function! s:glob_dir(path) - return map(filter(s:lines(globpath(a:path, '**')), 'isdirectory(v:val)'), 's:dirpath(v:val)') -endfunction - -function! s:progress_bar(line, bar, total) - call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') -endfunction - -function! s:compare_git_uri(a, b) - let a = substitute(a:a, 'git:\{1,2}@', '', '') - let b = substitute(a:b, 'git:\{1,2}@', '', '') - return a ==# b -endfunction - -function! s:format_message(bullet, name, message) - if a:bullet != 'x' - return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] - else - let lines = map(s:lines(a:message), '" ".v:val') - return extend([printf('x %s:', a:name)], lines) - endif -endfunction - -function! s:with_cd(cmd, dir) - return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) -endfunction - -function! s:system(cmd, ...) - try - let sh = &shell - if !s:is_win - set shell=sh - endif - let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd - return system(s:is_win ? '('.cmd.')' : cmd) - finally - let &shell = sh - endtry -endfunction - -function! s:system_chomp(...) - let ret = call('s:system', a:000) - return v:shell_error ? '' : substitute(ret, '\n$', '', '') -endfunction - -function! s:git_valid(spec, check_branch) - let ret = 1 - let msg = 'OK' - if isdirectory(a:spec.dir) - let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url', a:spec.dir)) - let remote = result[-1] - if v:shell_error - let msg = join([remote, 'PlugClean required.'], "\n") - let ret = 0 - elseif !s:compare_git_uri(remote, a:spec.uri) - let msg = join(['Invalid URI: '.remote, - \ 'Expected: '.a:spec.uri, - \ 'PlugClean required.'], "\n") - let ret = 0 - elseif a:check_branch - let branch = result[0] - " Check tag - if has_key(a:spec, 'tag') - let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) - if a:spec.tag !=# tag - let msg = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', - \ (empty(tag) ? 'N/A' : tag), a:spec.tag) - let ret = 0 - endif - " Check branch - elseif a:spec.branch !=# branch - let msg = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', - \ branch, a:spec.branch) - let ret = 0 - endif - endif - else - let msg = 'Not found' - let ret = 0 - endif - return [ret, msg] -endfunction - -function! s:clean(force) - call s:prepare() - call append(0, 'Searching for unused plugins in '.g:plug_home) - call append(1, '') - - " List of valid directories - let dirs = [] - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if !s:is_managed(name) || s:git_valid(spec, 0)[0] - call add(dirs, spec.dir) - endif - let cnt += 1 - call s:progress_bar(2, repeat('=', cnt), total) - normal! 2G - redraw - endfor - - let allowed = {} - for dir in dirs - let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 - let allowed[dir] = 1 - for child in s:glob_dir(dir) - let allowed[child] = 1 - endfor - endfor - - let todo = [] - let found = sort(s:glob_dir(g:plug_home)) - while !empty(found) - let f = remove(found, 0) - if !has_key(allowed, f) && isdirectory(f) - call add(todo, f) - call append(line('$'), '- ' . f) - let found = filter(found, 'stridx(v:val, f) != 0') - end - endwhile - - normal! G - redraw - if empty(todo) - call append(line('$'), 'Already clean.') - else - call inputsave() - let yes = a:force || (input('Proceed? (y/N) ') =~? '^y') - call inputrestore() - if yes - for dir in todo - if isdirectory(dir) - call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(dir)) - endif - endfor - call append(line('$'), 'Removed.') - else - call append(line('$'), 'Cancelled.') - endif - endif - normal! G -endfunction - -function! s:upgrade() - let new = s:me . '.new' - echo 'Downloading '. s:plug_src - redraw - try - if executable('curl') - let output = s:system(printf('curl -fLo %s %s', s:shellesc(new), s:plug_src)) - if v:shell_error - throw get(s:lines(output), -1, v:shell_error) - endif - elseif s:ruby - call s:upgrade_using_ruby(new) - elseif s:py2 - call s:upgrade_using_python(new) - else - return s:err('Missing: curl executable, ruby support or python support') - endif - catch - return s:err('Error upgrading vim-plug: '. v:exception) - endtry - - if readfile(s:me) ==# readfile(new) - echo 'vim-plug is already up-to-date' - silent! call delete(new) - return 0 - else - call rename(s:me, s:me . '.old') - call rename(new, s:me) - unlet g:loaded_plug - echo 'vim-plug has been upgraded' - return 1 - endif -endfunction - -function! s:upgrade_using_ruby(new) - ruby << EOF - require 'open-uri' - File.open(VIM::evaluate('a:new'), 'w') do |f| - f << open(VIM::evaluate('s:plug_src')).read - end -EOF -endfunction - -function! s:upgrade_using_python(new) -python << EOF -import urllib -import vim -psrc, dest = vim.eval('s:plug_src'), vim.eval('a:new') -urllib.urlretrieve(psrc, dest) -EOF -endfunction - -function! s:upgrade_specs() - for spec in values(g:plugs) - let spec.frozen = get(spec, 'frozen', 0) - endfor -endfunction - -function! s:status() - call s:prepare() - call append(0, 'Checking plugins') - call append(1, '') - - let ecnt = 0 - let unloaded = 0 - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if has_key(spec, 'uri') - if isdirectory(spec.dir) - let [valid, msg] = s:git_valid(spec, 1) - else - let [valid, msg] = [0, 'Not found. Try PlugInstall.'] - endif - else - if isdirectory(spec.dir) - let [valid, msg] = [1, 'OK'] - else - let [valid, msg] = [0, 'Not found.'] - endif - endif - let cnt += 1 - let ecnt += !valid - " `s:loaded` entry can be missing if PlugUpgraded - if valid && get(s:loaded, name, -1) == 0 - let unloaded = 1 - let msg .= ' (not loaded)' - endif - call s:progress_bar(2, repeat('=', cnt), total) - call append(3, s:format_message(valid ? '-' : 'x', name, msg)) - normal! 2G - redraw - endfor - call setline(1, 'Finished. '.ecnt.' error(s).') - normal! gg - setlocal nomodifiable - if unloaded - echo "Press 'L' on each line to load plugin, or 'U' to update" - nnoremap L :call status_load(line('.')) - xnoremap L :call status_load(line('.')) - end -endfunction - -function! s:extract_name(str, prefix, suffix) - return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') -endfunction - -function! s:status_load(lnum) - let line = getline(a:lnum) - let name = s:extract_name(line, '-', '(not loaded)') - if !empty(name) - call plug#load(name) - setlocal modifiable - call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) - setlocal nomodifiable - endif -endfunction - -function! s:status_update() range - let lines = getline(a:firstline, a:lastline) - let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') - if !empty(names) - echo - execute 'PlugUpdate' join(names) - endif -endfunction - -function! s:is_preview_window_open() - silent! wincmd P - if &previewwindow - wincmd p - return 1 - endif - return 0 -endfunction - -function! s:find_name(lnum) - for lnum in reverse(range(1, a:lnum)) - let line = getline(lnum) - if empty(line) - return '' - endif - let name = s:extract_name(line, '-', '') - if !empty(name) - return name - endif - endfor - return '' -endfunction - -function! s:preview_commit() - if b:plug_preview < 0 - let b:plug_preview = !s:is_preview_window_open() - endif - - let sha = matchstr(getline('.'), '\(^ \)\@<=[0-9a-z]\{7}') - if empty(sha) - return - endif - - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) - return - endif - - execute 'pedit' sha - wincmd P - setlocal filetype=git buftype=nofile nobuflisted - execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show' sha - normal! gg"_dd - wincmd p -endfunction - -function! s:section(flags) - call search('\(^[x-] \)\@<=[^:]\+:', a:flags) -endfunction - -function! s:diff() - call s:prepare() - call append(0, 'Collecting updated changes ...') - normal! gg - redraw - - let cnt = 0 - for [k, v] in items(g:plugs) - if !isdirectory(v.dir) || !s:is_managed(k) - continue - endif - - let diff = s:system_chomp('git log --pretty=format:"%h %s (%cr)" "HEAD...HEAD@{1}"', v.dir) - if !empty(diff) - call append(1, '') - call append(2, '- '.k.':') - call append(3, map(s:lines(diff), '" ". v:val')) - let cnt += 1 - normal! gg - redraw - endif - endfor - - call setline(1, cnt == 0 ? 'No updates.' : 'Last update:') - nnoremap :silent! call preview_commit() - nnoremap o :silent! call preview_commit() - nnoremap X :call revert() - normal! gg - setlocal nomodifiable - if cnt > 0 - echo "Press 'X' on each block to revert the update" - endif -endfunction - -function! s:revert() - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || - \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' - return - endif - - call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch), g:plugs[name].dir) - setlocal modifiable - normal! "_dap - setlocal nomodifiable - echo 'Reverted.' -endfunction - -function! s:snapshot(...) abort - let home = get(s:, 'plug_home_org', g:plug_home) - let [type, var, header] = s:is_win ? - \ ['dosbatch', '%PLUG_HOME%', - \ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '', - \ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.home]] : - \ ['sh', '$PLUG_HOME', - \ ['#!/bin/sh', '# Generated by vim-plug', '# '.strftime("%c"), '', - \ 'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]] - - call s:prepare() - execute 'setf' type - call append(0, header) - call append('$', '') - 1 - redraw - - let dirs = sort(map(values(filter(copy(g:plugs), - \'has_key(v:val, "uri") && isdirectory(v:val.dir)')), 'v:val.dir')) - let anchor = line('$') - 1 - for dir in reverse(dirs) - let sha = s:system_chomp('git rev-parse --short HEAD', dir) - if !empty(sha) - call append(anchor, printf('cd %s && git reset --hard %s', - \ substitute(dir, '^\V'.escape(g:plug_home, '\'), var, ''), sha)) - redraw - endif - endfor - - if a:0 > 0 - let fn = expand(a:1) - let fne = s:esc(fn) - call writefile(getline(1, '$'), fn) - if !s:is_win | call s:system('chmod +x ' . fne) | endif - echo 'Saved to '.a:1 - silent execute 'e' fne - endif -endfunction - -function! s:split_rtp() - return split(&rtp, '\\\@= 703 || v:version == 702 && has('patch374')) -let s:nvim = has('nvim') && !s:is_win -let s:me = resolve(expand(':p')) -let s:base_spec = { 'branch': 'master', 'frozen': 0 } -let s:TYPE = { -\ 'string': type(''), -\ 'list': type([]), -\ 'dict': type({}), -\ 'funcref': type(function('call')) -\ } -let s:loaded = get(s:, 'loaded', {}) -let s:triggers = get(s:, 'triggers', {}) - -function! plug#begin(...) - if a:0 > 0 - let s:plug_home_org = a:1 - let home = s:path(fnamemodify(expand(a:1), ':p')) - elseif exists('g:plug_home') - let home = s:path(g:plug_home) - elseif !empty(&rtp) - let home = s:path(split(&rtp, ',')[0]) . '/plugged' - else - return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') - endif - - let g:plug_home = home - let g:plugs = {} - let g:plugs_order = [] - let s:triggers = {} - - call s:define_commands() - return 1 -endfunction - -function! s:define_commands() - command! -nargs=+ -bar Plug call s:add() - if !executable('git') - return s:err('`git` executable not found. vim-plug requires git.') - endif - command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('' == '!', []) - command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('' == '!', []) - command! -nargs=0 -bar -bang PlugClean call s:clean('' == '!') - command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif - command! -nargs=0 -bar PlugStatus call s:status() - command! -nargs=0 -bar PlugDiff call s:diff() - command! -nargs=? -bar PlugSnapshot call s:snapshot() -endfunction - -function! s:to_a(v) - return type(a:v) == s:TYPE.list ? a:v : [a:v] -endfunction - -function! s:to_s(v) - return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" -endfunction - -function! s:source(from, ...) - for pattern in a:000 - for vim in s:lines(globpath(a:from, pattern)) - execute 'source' s:esc(vim) - endfor - endfor -endfunction - -function! s:assoc(dict, key, val) - let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) -endfunction - -function! plug#end() - if !exists('g:plugs') - return s:err('Call plug#begin() first') - endif - - if exists('#PlugLOD') - augroup PlugLOD - autocmd! - augroup END - augroup! PlugLOD - endif - let lod = { 'ft': {}, 'map': {}, 'cmd': {} } - - filetype off - for name in g:plugs_order - let plug = g:plugs[name] - if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') - let s:loaded[name] = 1 - continue - endif - - if has_key(plug, 'on') - let s:triggers[name] = { 'map': [], 'cmd': [] } - for cmd in s:to_a(plug.on) - if cmd =~ '^.\+' - if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) - call s:assoc(lod.map, cmd, name) - endif - call add(s:triggers[name].map, cmd) - elseif cmd =~ '^[A-Z]' - if exists(':'.cmd) != 2 - call s:assoc(lod.cmd, cmd, name) - endif - call add(s:triggers[name].cmd, cmd) - endif - endfor - endif - - if has_key(plug, 'for') - let types = s:to_a(plug.for) - if !empty(types) - call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') - endif - for type in types - call s:assoc(lod.ft, type, name) - endfor - endif - endfor - - for [cmd, names] in items(lod.cmd) - execute printf( - \ 'command! -nargs=* -range -bang %s call s:lod_cmd(%s, "", , , , %s)', - \ cmd, string(cmd), string(names)) - endfor - - for [map, names] in items(lod.map) - for [mode, map_prefix, key_prefix] in - \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] - execute printf( - \ '%snoremap %s %s:call lod_map(%s, %s, "%s")', - \ mode, map, map_prefix, string(map), string(names), key_prefix) - endfor - endfor - - for [ft, names] in items(lod.ft) - augroup PlugLOD - execute printf('autocmd FileType %s call lod_ft(%s, %s)', - \ ft, string(ft), string(names)) - augroup END - endfor - - call s:reorg_rtp() - filetype plugin indent on - if has('vim_starting') - syntax enable - else - call s:reload() - endif -endfunction - -function! s:loaded_names() - return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') -endfunction - -function! s:reload() - for name in s:loaded_names() - call s:source(s:rtp(g:plugs[name]), 'plugin/**/*.vim', 'after/plugin/**/*.vim') - endfor -endfunction - -function! s:trim(str) - return substitute(a:str, '[\/]\+$', '', '') -endfunction - -function! s:version_requirement(val, min) - for idx in range(0, len(a:min) - 1) - let v = get(a:val, idx, 0) - if v < a:min[idx] | return 0 - elseif v > a:min[idx] | return 1 - endif - endfor - return 1 -endfunction - -function! s:git_version_requirement(...) - let s:git_version = get(s:, 'git_version', - \ map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)')) - return s:version_requirement(s:git_version, a:000) -endfunction - -function! s:progress_opt(base) - return a:base && !s:is_win && - \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' -endfunction - -if s:is_win - function! s:rtp(spec) - return s:path(a:spec.dir . get(a:spec, 'rtp', '')) - endfunction - - function! s:path(path) - return s:trim(substitute(a:path, '/', '\', 'g')) - endfunction - - function! s:dirpath(path) - return s:path(a:path) . '\' - endfunction - - function! s:is_local_plug(repo) - return a:repo =~? '^[a-z]:' - endfunction -else - function! s:rtp(spec) - return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) - endfunction - - function! s:path(path) - return s:trim(a:path) - endfunction - - function! s:dirpath(path) - return substitute(a:path, '[/\\]*$', '/', '') - endfunction - - function! s:is_local_plug(repo) - return a:repo[0] =~ '[/$~]' - endfunction -endif - -function! s:err(msg) - echohl ErrorMsg - echom a:msg - echohl None - return 0 -endfunction - -function! s:esc(path) - return escape(a:path, ' ') -endfunction - -function! s:escrtp(path) - return escape(a:path, ' ,') -endfunction - -function! s:remove_rtp() - for name in s:loaded_names() - let rtp = s:rtp(g:plugs[name]) - execute 'set rtp-='.s:escrtp(rtp) - let after = globpath(rtp, 'after') - if isdirectory(after) - execute 'set rtp-='.s:escrtp(after) - endif - endfor -endfunction - -function! s:reorg_rtp() - if !empty(s:first_rtp) - execute 'set rtp-='.s:first_rtp - execute 'set rtp-='.s:last_rtp - endif - - " &rtp is modified from outside - if exists('s:prtp') && s:prtp !=# &rtp - call s:remove_rtp() - unlet! s:middle - endif - - let s:middle = get(s:, 'middle', &rtp) - let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') - let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), 'isdirectory(v:val)') - let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') - \ . ','.s:middle.',' - \ . join(map(afters, 'escape(v:val, ",")'), ',') - let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') - let s:prtp = &rtp - - if !empty(s:first_rtp) - execute 'set rtp^='.s:first_rtp - execute 'set rtp+='.s:last_rtp - endif -endfunction - -function! plug#load(...) - if a:0 == 0 - return s:err('Argument missing: plugin name(s) required') - endif - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - let unknowns = filter(copy(a:000), '!has_key(g:plugs, v:val)') - if !empty(unknowns) - let s = len(unknowns) > 1 ? 's' : '' - return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) - end - for name in a:000 - call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - endfor - doautocmd BufRead - return 1 -endfunction - -function! s:remove_triggers(name) - if !has_key(s:triggers, a:name) - return - endif - for cmd in s:triggers[a:name].cmd - execute 'silent! delc' cmd - endfor - for map in s:triggers[a:name].map - execute 'silent! unmap' map - execute 'silent! iunmap' map - endfor - call remove(s:triggers, a:name) -endfunction - -function! s:lod(names, types) - for name in a:names - call s:remove_triggers(name) - let s:loaded[name] = 1 - endfor - call s:reorg_rtp() - - for name in a:names - let rtp = s:rtp(g:plugs[name]) - for dir in a:types - call s:source(rtp, dir.'/**/*.vim') - endfor - endfor -endfunction - -function! s:lod_ft(pat, names) - call s:lod(a:names, ['plugin', 'after/plugin']) - execute 'autocmd! PlugLOD FileType' a:pat - doautocmd filetypeplugin FileType - doautocmd filetypeindent FileType -endfunction - -function! s:lod_cmd(cmd, bang, l1, l2, args, names) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) -endfunction - -function! s:lod_map(map, names, prefix) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - let extra = '' - while 1 - let c = getchar(0) - if c == 0 - break - endif - let extra .= nr2char(c) - endwhile - call feedkeys(a:prefix . substitute(a:map, '^', "\", '') . extra) -endfunction - -function! s:add(repo, ...) - if a:0 > 1 - return s:err('Invalid number of arguments (1..2)') - endif - - try - let repo = s:trim(a:repo) - let name = fnamemodify(repo, ':t:s?\.git$??') - let spec = extend(s:infer_properties(name, repo), - \ a:0 == 1 ? s:parse_options(a:1) : s:base_spec) - if !has_key(g:plugs, name) - call add(g:plugs_order, name) - endif - let g:plugs[name] = spec - let s:loaded[name] = 0 - catch - return s:err(v:exception) - endtry -endfunction - -function! s:parse_options(arg) - let opts = copy(s:base_spec) - let type = type(a:arg) - if type == s:TYPE.string - let opts.tag = a:arg - elseif type == s:TYPE.dict - call extend(opts, a:arg) - if has_key(opts, 'dir') - let opts.dir = s:dirpath(expand(opts.dir)) - endif - else - throw 'Invalid argument type (expected: string or dictionary)' - endif - return opts -endfunction - -function! s:infer_properties(name, repo) - let repo = a:repo - if s:is_local_plug(repo) - return { 'dir': s:dirpath(expand(repo)) } - else - if repo =~ ':' - let uri = repo - else - if repo !~ '/' - let repo = 'vim-scripts/'. repo - endif - let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') - let uri = printf(fmt, repo) - endif - let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') ) - return { 'dir': dir, 'uri': uri } - endif -endfunction - -function! s:install(force, names) - call s:update_impl(0, a:force, a:names) -endfunction - -function! s:update(force, names) - call s:update_impl(1, a:force, a:names) -endfunction - -function! plug#helptags() - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - for spec in values(g:plugs) - let docd = join([spec.dir, 'doc'], '/') - if isdirectory(docd) - silent! execute 'helptags' s:esc(docd) - endif - endfor - return 1 -endfunction - -function! s:syntax() - syntax clear - syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber - syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX - syn match plugNumber /[0-9]\+[0-9.]*/ contained - syn match plugBracket /[[\]]/ contained - syn match plugX /x/ contained - syn match plugDash /^-/ - syn match plugPlus /^+/ - syn match plugStar /^*/ - syn match plugMessage /\(^- \)\@<=.*/ - syn match plugName /\(^- \)\@<=[^ ]*:/ - syn match plugInstall /\(^+ \)\@<=[^:]*/ - syn match plugUpdate /\(^* \)\@<=[^:]*/ - syn match plugCommit /^ [0-9a-z]\{7} .*/ contains=plugRelDate,plugSha - syn match plugSha /\(^ \)\@<=[0-9a-z]\{7}/ contained - syn match plugRelDate /([^)]*)$/ contained - syn match plugNotLoaded /(not loaded)$/ - syn match plugError /^x.*/ - syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean - hi def link plug1 Title - hi def link plug2 Repeat - hi def link plugX Exception - hi def link plugBracket Structure - hi def link plugNumber Number - - hi def link plugDash Special - hi def link plugPlus Constant - hi def link plugStar Boolean - - hi def link plugMessage Function - hi def link plugName Label - hi def link plugInstall Function - hi def link plugUpdate Type - - hi def link plugError Error - hi def link plugRelDate Comment - hi def link plugSha Identifier - - hi def link plugNotLoaded Comment -endfunction - -function! s:lpad(str, len) - return a:str . repeat(' ', a:len - len(a:str)) -endfunction - -function! s:lines(msg) - return split(a:msg, "[\r\n]") -endfunction - -function! s:lastline(msg) - return get(s:lines(a:msg), -1, '') -endfunction - -function! s:new_window() - execute get(g:, 'plug_window', 'vertical topleft new') -endfunction - -function! s:plug_window_exists() - let buflist = tabpagebuflist(s:plug_tab) - return !empty(buflist) && index(buflist, s:plug_buf) >= 0 -endfunction - -function! s:switch_in() - if !s:plug_window_exists() - return 0 - endif - - if winbufnr(0) != s:plug_buf - let s:pos = [tabpagenr(), winnr(), winsaveview()] - execute 'normal!' s:plug_tab.'gt' - let winnr = bufwinnr(s:plug_buf) - execute winnr.'wincmd w' - call add(s:pos, winsaveview()) - else - let s:pos = [winsaveview()] - endif - - setlocal modifiable - return 1 -endfunction - -function! s:switch_out(...) - call winrestview(s:pos[-1]) - setlocal nomodifiable - if a:0 > 0 - execute a:1 - endif - - if len(s:pos) > 1 - execute 'normal!' s:pos[0].'gt' - execute s:pos[1] 'wincmd w' - call winrestview(s:pos[2]) - endif -endfunction - -function! s:prepare() - call s:job_abort() - if s:switch_in() - silent %d _ - else - call s:new_window() - nnoremap q :if b:plug_preview==1pcendifechoq - nnoremap R :silent! call retry() - nnoremap D :PlugDiff - nnoremap S :PlugStatus - nnoremap U :call status_update() - xnoremap U :call status_update() - nnoremap ]] :silent! call section('') - nnoremap [[ :silent! call section('b') - let b:plug_preview = -1 - let s:plug_tab = tabpagenr() - let s:plug_buf = winbufnr(0) - call s:assign_name() - endif - silent! unmap - silent! unmap L - silent! unmap o - silent! unmap X - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable - setf vim-plug - call s:syntax() -endfunction - -function! s:assign_name() - " Assign buffer name - let prefix = '[Plugins]' - let name = prefix - let idx = 2 - while bufexists(name) - let name = printf('%s (%s)', prefix, idx) - let idx = idx + 1 - endwhile - silent! execute 'f' fnameescape(name) -endfunction - -function! s:do(pull, force, todo) - for [name, spec] in items(a:todo) - if !isdirectory(spec.dir) - continue - endif - let installed = has_key(s:update.new, name) - let updated = installed ? 0 : - \ (a:pull && !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', spec.dir))) - if a:force || installed || updated - execute 'cd' s:esc(spec.dir) - call append(3, '- Post-update hook for '. name .' ... ') - let type = type(spec.do) - if type == s:TYPE.string - try - " FIXME: Escaping is incomplete. We could use shellescape with eval, - " but it won't work on Windows. - let g:_plug_do = '!'.escape(spec.do, '#!%') - execute "normal! :execute g:_plug_do\\" - finally - let result = v:shell_error ? ('Exit status: '.v:shell_error) : 'Done!' - unlet g:_plug_do - endtry - elseif type == s:TYPE.funcref - try - let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') - call spec.do({ 'name': name, 'status': status, 'force': a:force }) - let result = 'Done!' - catch - let result = 'Error: ' . v:exception - endtry - else - let result = 'Error: Invalid type!' - endif - call setline(4, getline(4) . result) - cd - - endif - endfor -endfunction - -function! s:finish(pull) - let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) - if new_frozen - let s = new_frozen > 1 ? 's' : '' - call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) - endif - call append(3, '- Finishing ... ') - redraw - call plug#helptags() - call plug#end() - call setline(4, getline(4) . 'Done!') - redraw - let msgs = [] - if !empty(s:update.errors) - call add(msgs, "Press 'R' to retry.") - endif - if a:pull && len(s:update.new) < len(filter(getline(5, '$'), - \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) - call add(msgs, "Press 'D' to see the updated changes.") - endif - echo join(msgs, ' ') -endfunction - -function! s:retry() - if empty(s:update.errors) - return - endif - call s:update_impl(s:update.pull, s:update.force, - \ extend(copy(s:update.errors), [s:update.threads])) -endfunction - -function! s:is_managed(name) - return has_key(g:plugs[a:name], 'uri') -endfunction - -function! s:names(...) - return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) -endfunction - -function! s:update_impl(pull, force, args) abort - let args = copy(a:args) - let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? - \ remove(args, -1) : get(g:, 'plug_threads', 16) - - let managed = filter(copy(g:plugs), 's:is_managed(v:key)') - let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : - \ filter(managed, 'index(args, v:key) >= 0') - - if empty(todo) - echohl WarningMsg - echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.' - echohl None - return - endif - - if !s:is_win && s:git_version_requirement(2, 3) - let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' - let $GIT_TERMINAL_PROMPT = 0 - for plug in values(todo) - let plug.uri = substitute(plug.uri, - \ '^https://git::@github\.com', 'https://github.com', '') - endfor - endif - - if !isdirectory(g:plug_home) - try - call mkdir(g:plug_home, 'p') - catch - return s:err(printf('Invalid plug directory: %s. '. - \ 'Try to call plug#begin with a valid directory', g:plug_home)) - endtry - endif - - let s:update = { - \ 'start': reltime(), - \ 'all': todo, - \ 'todo': copy(todo), - \ 'errors': [], - \ 'pull': a:pull, - \ 'force': a:force, - \ 'new': {}, - \ 'threads': (s:py2 || s:ruby || s:nvim) ? min([len(todo), threads]) : 1, - \ 'bar': '', - \ 'fin': 0 - \ } - - call s:prepare() - call append(0, ['', '']) - normal! 2G - - " Python version requirement (>= 2.7) - if s:py2 && !s:ruby && !s:nvim && s:update.threads > 1 - redir => pyv - silent python import platform; print(platform.python_version()) - redir END - let s:py2 = s:version_requirement( - \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 7]) - endif - if (s:py2 || s:ruby) && !s:nvim && s:update.threads > 1 - try - let imd = &imd - if s:mac_gui - set noimd - endif - if s:ruby - call s:update_ruby() - else - call s:update_python() - endif - catch - let lines = getline(4, '$') - let printed = {} - silent! 4,$d _ - for line in lines - let name = s:extract_name(line, '.', '') - if empty(name) || !has_key(printed, name) - call append('$', line) - if !empty(name) - let printed[name] = 1 - if line[0] == 'x' && index(s:update.errors, name) < 0 - call add(s:update.errors, name) - end - endif - endif - endfor - finally - let &imd = imd - call s:update_finish() - endtry - else - call s:update_vim() - endif -endfunction - -function! s:update_finish() - if exists('s:git_terminal_prompt') - let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt - endif - if s:switch_in() - call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'has_key(v:val, "do")')) - call s:finish(s:update.pull) - call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') - call s:switch_out('normal! gg') - endif -endfunction - -function! s:job_abort() - if !s:nvim || !exists('s:jobs') - return - endif - augroup PlugJobControl - autocmd! - augroup END - for [name, j] in items(s:jobs) - silent! call jobstop(j.jobid) - if j.new - call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) - endif - endfor - let s:jobs = {} -endfunction - -function! s:job_handler(name) abort - if !s:plug_window_exists() " plug window closed - return s:job_abort() - endif - - if !has_key(s:jobs, a:name) - return - endif - let job = s:jobs[a:name] - - if v:job_data[1] == 'exit' - let job.running = 0 - if s:lastline(job.result) ==# 'Error' - let job.error = 1 - let job.result = substitute(job.result, "Error[\r\n]$", '', '') - endif - call s:reap(a:name) - call s:tick() - else - let job.result .= s:to_s(v:job_data[2]) - " To reduce the number of buffer updates - let job.tick = get(job, 'tick', -1) + 1 - if job.tick % len(s:jobs) == 0 - call s:log(job.new ? '+' : '*', a:name, job.result) - endif - endif -endfunction - -function! s:spawn(name, cmd, opts) - let job = { 'running': 1, 'new': get(a:opts, 'new', 0), - \ 'error': 0, 'result': '' } - let s:jobs[a:name] = job - - if s:nvim - let x = jobstart(a:name, 'sh', ['-c', - \ (has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) - \ . ' || echo Error']) - if x > 0 - let job.jobid = x - augroup PlugJobControl - execute 'autocmd JobActivity' a:name printf('call s:job_handler(%s)', string(a:name)) - augroup END - else - let job.running = 0 - let job.error = 1 - let job.result = x < 0 ? 'sh is not executable' : - \ 'Invalid arguments (or job table is full)' - endif - else - let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd] - let job.result = call('s:system', params) - let job.error = v:shell_error != 0 - let job.running = 0 - endif -endfunction - -function! s:reap(name) - if s:nvim - silent! execute 'autocmd! PlugJobControl JobActivity' a:name - endif - - let job = s:jobs[a:name] - if job.error - call add(s:update.errors, a:name) - elseif get(job, 'new', 0) - let s:update.new[a:name] = 1 - endif - let s:update.bar .= job.error ? 'x' : '=' - - call s:log(job.error ? 'x' : '-', a:name, job.result) - call s:bar() - - call remove(s:jobs, a:name) -endfunction - -function! s:bar() - if s:switch_in() - let total = len(s:update.all) - call setline(1, (s:update.pull ? 'Updating' : 'Installing'). - \ ' plugins ('.len(s:update.bar).'/'.total.')') - call s:progress_bar(2, s:update.bar, total) - call s:switch_out() - endif -endfunction - -function! s:logpos(name) - for i in range(1, line('$')) - if getline(i) =~# '^[-+x*] '.a:name.':' - return i - endif - endfor - return 0 -endfunction - -function! s:log(bullet, name, lines) - if s:switch_in() - let pos = s:logpos(a:name) - if pos > 0 - execute pos 'd _' - if pos > winheight('.') - let pos = 4 - endif - else - let pos = 4 - endif - call append(pos - 1, s:format_message(a:bullet, a:name, a:lines)) - call s:switch_out() - endif -endfunction - -function! s:update_vim() - let s:jobs = {} - - call s:bar() - call s:tick() -endfunction - -function! s:tick() - let pull = s:update.pull - let prog = s:progress_opt(s:nvim) -while 1 " Without TCO, Vim stack is bound to explode - if empty(s:update.todo) - if empty(s:jobs) && !s:update.fin - let s:update.fin = 1 - call s:update_finish() - endif - return - endif - - let name = keys(s:update.todo)[0] - let spec = remove(s:update.todo, name) - let new = !isdirectory(spec.dir) - - call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') - redraw - - let checkout = s:shellesc(has_key(spec, 'tag') ? spec.tag : spec.branch) - let merge = s:shellesc(has_key(spec, 'tag') ? spec.tag : 'origin/'.spec.branch) - - if !new - let [valid, msg] = s:git_valid(spec, 0) - if valid - if pull - call s:spawn(name, - \ printf('(git fetch %s 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only %s 2>&1 && git submodule update --init --recursive 2>&1)', - \ prog, checkout, merge), { 'dir': spec.dir }) - else - let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } - endif - else - let s:jobs[name] = { 'running': 0, 'result': msg, 'error': 1 } - endif - else - call s:spawn(name, - \ printf('git clone %s --recursive %s -b %s %s 2>&1', - \ prog, - \ s:shellesc(spec.uri), - \ checkout, - \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) - endif - - if !s:jobs[name].running - call s:reap(name) - endif - if len(s:jobs) >= s:update.threads - break - endif -endwhile -endfunction - -function! s:update_python() -python << EOF -""" Due to use of signals this function is POSIX only. """ -import datetime -import functools -import os -import Queue -import random -import re -import shutil -import signal -import subprocess -import tempfile -import threading as thr -import time -import traceback -import vim - -G_PULL = vim.eval('s:update.pull') == '1' -G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 -G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) -G_PROGRESS = vim.eval('s:progress_opt(1)') -G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) -G_STOP = thr.Event() - -class CmdTimedOut(Exception): - pass -class CmdFailed(Exception): - pass -class InvalidURI(Exception): - pass -class Action(object): - INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] - -class GLog(object): - ON = None - LOGDIR = None - @classmethod - def write(cls, msg): - if cls.ON is None: - cls.ON = int(vim.eval('get(g:, "plug_log_on", 0)')) - cls.LOGDIR = os.path.expanduser(vim.eval('get(g:, "plug_logs", "~/plug_logs")')) - if cls.ON: - if not os.path.exists(cls.LOGDIR): - os.makedirs(cls.LOGDIR) - cls._write(msg) - @classmethod - def _write(cls, msg): - name = thr.current_thread().name - fname = cls.LOGDIR + os.path.sep + name - with open(fname, 'ab') as flog: - ltime = datetime.datetime.now().strftime("%H:%M:%S.%f") - msg = '[{},{}] {}{}'.format(name, ltime, msg, '\n') - flog.write(msg) - -class Buffer(object): - def __init__(self, lock, num_plugs): - self.bar = '' - self.event = 'Updating' if vim.eval('s:update.pull') == '1' else 'Installing' - self.is_win = vim.eval('s:is_win') == '1' - self.lock = lock - self.maxy = int(vim.eval('winheight(".")')) - self.num_plugs = num_plugs - - def _where(self, name): - """ Find first line with name in current buffer. Return line num. """ - found, lnum = False, 0 - matcher = re.compile('^[-+x*] {}:'.format(name)) - for line in vim.current.buffer: - if matcher.search(line) is not None: - found = True - break - lnum += 1 - - if not found: - lnum = -1 - return lnum - - def header(self): - curbuf = vim.current.buffer - curbuf[0] = self.event + ' plugins ({}/{})'.format(len(self.bar), self.num_plugs) - - num_spaces = self.num_plugs - len(self.bar) - curbuf[1] = '[{}{}]'.format(self.bar, num_spaces * ' ') - - vim.command('normal! 2G') - if not self.is_win: - vim.command('redraw') - - def write(self, *args, **kwargs): - with self.lock: - self._write(*args, **kwargs) - - def _write(self, action, name, lines): - first, rest = lines[0], lines[1:] - msg = ['{} {}{}{}'.format(action, name, ': ' if first else '', first)] - padded_rest = [' ' + line for line in rest] - msg.extend(padded_rest) - - try: - if action == Action.ERROR: - self.bar += 'x' - vim.command("call add(s:update.errors, '{}')".format(name)) - elif action == Action.DONE: - self.bar += '=' - - curbuf = vim.current.buffer - lnum = self._where(name) - if lnum != -1: # Found matching line num - del curbuf[lnum] - if lnum > self.maxy and action in {Action.INSTALL, Action.UPDATE}: - lnum = 3 - else: - lnum = 3 - curbuf.append(msg, lnum) - - self.header() - except vim.error: - GLog.write('Buffer Update FAILED.') - -class Command(object): - def __init__(self, cmd, cmd_dir=None, timeout=60, ntries=3, cb=None, clean=None): - self.cmd = cmd - self.cmd_dir = cmd_dir - self.timeout = timeout - self.ntries = ntries - self.callback = cb if cb else (lambda msg: None) - self.clean = clean - - def attempt_cmd(self): - """ Tries to run the command, returns result if no exceptions. """ - attempt = 0 - finished = False - limit = self.timeout - - while not finished: - try: - attempt += 1 - result = self.timeout_cmd() - finished = True - except CmdTimedOut: - if attempt != self.ntries: - for count in range(3, 0, -1): - if G_STOP.is_set(): - raise KeyboardInterrupt - msg = 'Timeout. Will retry in {} second{} ...'.format( - count, 's' if count != 1 else '') - self.callback([msg]) - time.sleep(1) - self.timeout += limit - self.callback(['Retrying ...']) - else: - raise - - return result - - def timeout_cmd(self): - """ Execute a cmd & poll for callback. Returns list of output. - Raises CmdFailed -> return code for Popen isn't 0 - Raises CmdTimedOut -> command exceeded timeout without new output - """ - proc = None - first_line = True - try: - tfile = tempfile.NamedTemporaryFile() - proc = subprocess.Popen(self.cmd, cwd=self.cmd_dir, stdout=tfile, - stderr=subprocess.STDOUT, shell=True, preexec_fn=os.setsid) - while proc.poll() is None: - # Yield this thread - time.sleep(0.2) - - if G_STOP.is_set(): - raise KeyboardInterrupt - - if first_line or random.random() < G_LOG_PROB: - first_line = False - line = nonblock_read(tfile.name) - if line: - self.callback([line]) - - time_diff = time.time() - os.path.getmtime(tfile.name) - if time_diff > self.timeout: - raise CmdTimedOut(['Timeout!']) - - tfile.seek(0) - result = [line.rstrip() for line in tfile] - - if proc.returncode != 0: - msg = [''] - msg.extend(result) - raise CmdFailed(msg) - except: - if proc and proc.poll() is None: - os.killpg(proc.pid, signal.SIGTERM) - if self.clean: - self.clean() - raise - - return result - -class Plugin(object): - def __init__(self, name, args, buf, lock): - self.name = name - self.args = args - self.buf = buf - self.lock = lock - tag = args.get('tag', 0) - self.checkout = esc(tag if tag else args['branch']) - self.merge = esc(tag if tag else 'origin/' + args['branch']) - - def manage(self): - try: - if os.path.exists(self.args['dir']): - self.update() - else: - self.install() - with self.lock: - vim.command("let s:update.new['{}'] = 1".format(self.name)) - except (CmdTimedOut, CmdFailed, InvalidURI) as exc: - self.write(Action.ERROR, self.name, exc.message) - except KeyboardInterrupt: - G_STOP.set() - self.write(Action.ERROR, self.name, ['Interrupted!']) - except: - # Any exception except those above print stack trace - msg = 'Trace:\n{}'.format(traceback.format_exc().rstrip()) - self.write(Action.ERROR, self.name, msg.split('\n')) - raise - - def install(self): - target = self.args['dir'] - - def clean(target): - def _clean(): - try: - shutil.rmtree(target) - except OSError: - pass - return _clean - - self.write(Action.INSTALL, self.name, ['Installing ...']) - callback = functools.partial(self.buf.write, Action.INSTALL, self.name) - cmd = 'git clone {} --recursive {} -b {} {} 2>&1'.format( - G_PROGRESS, self.args['uri'], self.checkout, esc(target)) - com = Command(cmd, None, G_TIMEOUT, G_RETRIES, callback, clean(target)) - result = com.attempt_cmd() - self.write(Action.DONE, self.name, result[-1:]) - - def update(self): - match = re.compile(r'git::?@') - actual_uri = re.sub(match, '', self.repo_uri()) - expect_uri = re.sub(match, '', self.args['uri']) - if actual_uri != expect_uri: - msg = ['', - 'Invalid URI: {}'.format(actual_uri), - 'Expected {}'.format(expect_uri), - 'PlugClean required.'] - raise InvalidURI(msg) - - if G_PULL: - self.write(Action.UPDATE, self.name, ['Updating ...']) - callback = functools.partial(self.buf.write, Action.UPDATE, self.name) - cmds = ['git fetch {}'.format(G_PROGRESS), - 'git checkout -q {}'.format(self.checkout), - 'git merge --ff-only {}'.format(self.merge), - 'git submodule update --init --recursive'] - cmd = ' 2>&1 && '.join(cmds) - GLog.write(cmd) - com = Command(cmd, self.args['dir'], G_TIMEOUT, G_RETRIES, callback) - result = com.attempt_cmd() - GLog.write(result) - self.write(Action.DONE, self.name, result[-1:]) - else: - self.write(Action.DONE, self.name, ['Already installed']) - - def repo_uri(self): - cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url' - command = Command(cmd, self.args['dir'], G_TIMEOUT, G_RETRIES) - result = command.attempt_cmd() - return result[-1] - - def write(self, action, name, msg): - GLog.write('{} {}: {}'.format(action, name, '\n'.join(msg))) - self.buf.write(action, name, msg) - -class PlugThread(thr.Thread): - def __init__(self, tname, args): - super(PlugThread, self).__init__() - self.tname = tname - self.args = args - - def run(self): - thr.current_thread().name = self.tname - work_q, lock, buf = self.args - - try: - while not G_STOP.is_set(): - name, args = work_q.get_nowait() - GLog.write('{}: Dir {}'.format(name, args['dir'])) - plug = Plugin(name, args, buf, lock) - plug.manage() - work_q.task_done() - except Queue.Empty: - GLog.write('Queue now empty.') - -class RefreshThread(thr.Thread): - def __init__(self, lock): - super(RefreshThread, self).__init__() - self.lock = lock - self.running = True - - def run(self): - while self.running: - with self.lock: - vim.command('noautocmd normal! a') - time.sleep(0.2) - - def stop(self): - self.running = False - -def esc(name): - return '"' + name.replace('"', '\"') + '"' - -def nonblock_read(fname): - """ Read a file with nonblock flag. Return the last line. """ - fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) - buf = os.read(fread, 100000) - os.close(fread) - - line = buf.rstrip('\r\n') - left = max(line.rfind('\r'), line.rfind('\n')) - if left != -1: - left += 1 - line = line[left:] - - return line - -def main(): - thr.current_thread().name = 'main' - GLog.write('') - if GLog.ON and os.path.exists(GLog.LOGDIR): - shutil.rmtree(GLog.LOGDIR) - - threads = [] - nthreads = int(vim.eval('s:update.threads')) - plugs = vim.eval('s:update.todo') - mac_gui = vim.eval('s:mac_gui') == '1' - is_win = vim.eval('s:is_win') == '1' - GLog.write('Plugs: {}'.format(plugs)) - GLog.write('PULL: {}, WIN: {}, MAC: {}'.format(G_PULL, is_win, mac_gui)) - GLog.write('Num Threads: {}'.format(nthreads)) - - lock = thr.Lock() - buf = Buffer(lock, len(plugs)) - work_q = Queue.Queue() - for work in plugs.items(): - work_q.put(work) - - GLog.write('Starting Threads') - for num in range(nthreads): - tname = 'PlugT-{0:02}'.format(num) - thread = PlugThread(tname, (work_q, lock, buf)) - thread.start() - threads.append(thread) - if mac_gui: - rthread = RefreshThread(lock) - rthread.start() - - GLog.write('Joining Live Threads') - for thread in threads: - thread.join() - if mac_gui: - rthread.stop() - rthread.join() - GLog.write('Cleanly Exited Main') - -main() -EOF -endfunction - -function! s:update_ruby() - ruby << EOF - module PlugStream - SEP = ["\r", "\n", nil] - def get_line - buffer = '' - loop do - char = readchar rescue return - if SEP.include? char.chr - buffer << $/ - break - else - buffer << char - end - end - buffer - end - end unless defined?(PlugStream) - - def esc arg - %["#{arg.gsub('"', '\"')}"] - end - - def killall pid - pids = [pid] - unless `which pgrep 2> /dev/null`.empty? - children = pids - until children.empty? - children = children.map { |pid| - `pgrep -P #{pid}`.lines.map { |l| l.chomp } - }.flatten - pids += children - end - end - pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } - end - - require 'thread' - require 'fileutils' - require 'timeout' - running = true - iswin = VIM::evaluate('s:is_win').to_i == 1 - pull = VIM::evaluate('s:update.pull').to_i == 1 - base = VIM::evaluate('g:plug_home') - all = VIM::evaluate('s:update.todo') - limit = VIM::evaluate('get(g:, "plug_timeout", 60)') - tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 - nthr = VIM::evaluate('s:update.threads').to_i - maxy = VIM::evaluate('winheight(".")').to_i - cd = iswin ? 'cd /d' : 'cd' - tot = VIM::evaluate('len(s:update.todo)') || 0 - bar = '' - skip = 'Already installed' - mtx = Mutex.new - take1 = proc { mtx.synchronize { running && all.shift } } - logh = proc { - cnt = bar.length - $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" - $curbuf[2] = '[' + bar.ljust(tot) + ']' - VIM::command('normal! 2G') - VIM::command('redraw') unless iswin - } - where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } - log = proc { |name, result, type| - mtx.synchronize do - ing = ![true, false].include?(type) - bar += type ? '=' : 'x' unless ing - b = case type - when :install then '+' when :update then '*' - when true, nil then '-' else - VIM::command("call add(s:update.errors, '#{name}')") - 'x' - end - result = - if type || type.nil? - ["#{b} #{name}: #{result.lines.to_a.last}"] - elsif result =~ /^Interrupted|^Timeout/ - ["#{b} #{name}: #{result}"] - else - ["#{b} #{name}"] + result.lines.map { |l| " " << l } - end - if lnum = where.call(name) - $curbuf.delete lnum - lnum = 4 if ing && lnum > maxy - end - result.each_with_index do |line, offset| - $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) - end - logh.call - end - } - bt = proc { |cmd, name, type, cleanup| - tried = timeout = 0 - begin - tried += 1 - timeout += limit - fd = nil - data = '' - if iswin - Timeout::timeout(timeout) do - tmp = VIM::evaluate('tempname()') - system("(#{cmd}) > #{tmp}") - data = File.read(tmp).chomp - File.unlink tmp rescue nil - end - else - fd = IO.popen(cmd).extend(PlugStream) - first_line = true - log_prob = 1.0 / nthr - while line = Timeout::timeout(timeout) { fd.get_line } - data << line - log.call name, line.chomp, type if name && (first_line || rand < log_prob) - first_line = false - end - fd.close - end - [$? == 0, data.chomp] - rescue Timeout::Error, Interrupt => e - if fd && !fd.closed? - killall fd.pid - fd.close - end - cleanup.call if cleanup - if e.is_a?(Timeout::Error) && tried < tries - 3.downto(1) do |countdown| - s = countdown > 1 ? 's' : '' - log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type - sleep 1 - end - log.call name, 'Retrying ...', type - retry - end - [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] - end - } - main = Thread.current - threads = [] - watcher = Thread.new { - while VIM::evaluate('getchar(1)') - sleep 0.1 - end - mtx.synchronize do - running = false - threads.each { |t| t.raise Interrupt } - end - threads.each { |t| t.join rescue nil } - main.kill - } - refresh = Thread.new { - while true - mtx.synchronize do - break unless running - VIM::command('noautocmd normal! a') - end - sleep 0.2 - end - } if VIM::evaluate('s:mac_gui') == 1 - - progress = VIM::evaluate('s:progress_opt(1)') - nthr.times do - mtx.synchronize do - threads << Thread.new { - while pair = take1.call - name = pair.first - dir, uri, branch, tag = pair.last.values_at *%w[dir uri branch tag] - checkout = esc(tag ? tag : branch) - merge = esc(tag ? tag : "origin/#{branch}") - subm = "git submodule update --init --recursive 2>&1" - exists = File.directory? dir - ok, result = - if exists - dir = iswin ? dir : esc(dir) - ret, data = bt.call "#{cd} #{dir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url", nil, nil, nil - current_uri = data.lines.to_a.last - if !ret - if data =~ /^Interrupted|^Timeout/ - [false, data] - else - [false, [data.chomp, "PlugClean required."].join($/)] - end - elsif current_uri.sub(/git::?@/, '') != uri.sub(/git::?@/, '') - [false, ["Invalid URI: #{current_uri}", - "Expected: #{uri}", - "PlugClean required."].join($/)] - else - if pull - log.call name, 'Updating ...', :update - bt.call "#{cd} #{dir} && git fetch #{progress} 2>&1 && git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm}", name, :update, nil - else - [true, skip] - end - end - else - d = esc dir.sub(%r{[\\/]+$}, '') - log.call name, 'Installing ...', :install - bt.call "git clone #{progress} --recursive #{uri} -b #{checkout} #{d} 2>&1", name, :install, proc { - FileUtils.rm_rf dir - } - end - mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok - log.call name, result, ok - end - } if running - end - end - threads.each { |t| t.join rescue nil } - logh.call - refresh.kill if refresh - watcher.kill -EOF -endfunction - -function! s:shellesc(arg) - return '"'.escape(a:arg, '"').'"' -endfunction - -function! s:glob_dir(path) - return map(filter(s:lines(globpath(a:path, '**')), 'isdirectory(v:val)'), 's:dirpath(v:val)') -endfunction - -function! s:progress_bar(line, bar, total) - call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') -endfunction - -function! s:compare_git_uri(a, b) - let a = substitute(a:a, 'git:\{1,2}@', '', '') - let b = substitute(a:b, 'git:\{1,2}@', '', '') - return a ==# b -endfunction - -function! s:format_message(bullet, name, message) - if a:bullet != 'x' - return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] - else - let lines = map(s:lines(a:message), '" ".v:val') - return extend([printf('x %s:', a:name)], lines) - endif -endfunction - -function! s:with_cd(cmd, dir) - return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) -endfunction - -function! s:system(cmd, ...) - try - let sh = &shell - if !s:is_win - set shell=sh - endif - let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd - return system(s:is_win ? '('.cmd.')' : cmd) - finally - let &shell = sh - endtry -endfunction - -function! s:system_chomp(...) - let ret = call('s:system', a:000) - return v:shell_error ? '' : substitute(ret, '\n$', '', '') -endfunction - -function! s:git_valid(spec, check_branch) - let ret = 1 - let msg = 'OK' - if isdirectory(a:spec.dir) - let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url', a:spec.dir)) - let remote = result[-1] - if v:shell_error - let msg = join([remote, 'PlugClean required.'], "\n") - let ret = 0 - elseif !s:compare_git_uri(remote, a:spec.uri) - let msg = join(['Invalid URI: '.remote, - \ 'Expected: '.a:spec.uri, - \ 'PlugClean required.'], "\n") - let ret = 0 - elseif a:check_branch - let branch = result[0] - " Check tag - if has_key(a:spec, 'tag') - let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) - if a:spec.tag !=# tag - let msg = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', - \ (empty(tag) ? 'N/A' : tag), a:spec.tag) - let ret = 0 - endif - " Check branch - elseif a:spec.branch !=# branch - let msg = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', - \ branch, a:spec.branch) - let ret = 0 - endif - endif - else - let msg = 'Not found' - let ret = 0 - endif - return [ret, msg] -endfunction - -function! s:clean(force) - call s:prepare() - call append(0, 'Searching for unused plugins in '.g:plug_home) - call append(1, '') - - " List of valid directories - let dirs = [] - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if !s:is_managed(name) || s:git_valid(spec, 0)[0] - call add(dirs, spec.dir) - endif - let cnt += 1 - call s:progress_bar(2, repeat('=', cnt), total) - normal! 2G - redraw - endfor - - let allowed = {} - for dir in dirs - let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 - let allowed[dir] = 1 - for child in s:glob_dir(dir) - let allowed[child] = 1 - endfor - endfor - - let todo = [] - let found = sort(s:glob_dir(g:plug_home)) - while !empty(found) - let f = remove(found, 0) - if !has_key(allowed, f) && isdirectory(f) - call add(todo, f) - call append(line('$'), '- ' . f) - let found = filter(found, 'stridx(v:val, f) != 0') - end - endwhile - - normal! G - redraw - if empty(todo) - call append(line('$'), 'Already clean.') - else - call inputsave() - let yes = a:force || (input('Proceed? (y/N) ') =~? '^y') - call inputrestore() - if yes - for dir in todo - if isdirectory(dir) - call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(dir)) - endif - endfor - call append(line('$'), 'Removed.') - else - call append(line('$'), 'Cancelled.') - endif - endif - normal! G -endfunction - -function! s:upgrade() - let new = s:me . '.new' - echo 'Downloading '. s:plug_src - redraw - try - if executable('curl') - let output = s:system(printf('curl -fLo %s %s', s:shellesc(new), s:plug_src)) - if v:shell_error - throw get(s:lines(output), -1, v:shell_error) - endif - elseif s:ruby - call s:upgrade_using_ruby(new) - elseif s:py2 - call s:upgrade_using_python(new) - else - return s:err('Missing: curl executable, ruby support or python support') - endif - catch - return s:err('Error upgrading vim-plug: '. v:exception) - endtry - - if readfile(s:me) ==# readfile(new) - echo 'vim-plug is already up-to-date' - silent! call delete(new) - return 0 - else - call rename(s:me, s:me . '.old') - call rename(new, s:me) - unlet g:loaded_plug - echo 'vim-plug has been upgraded' - return 1 - endif -endfunction - -function! s:upgrade_using_ruby(new) - ruby << EOF - require 'open-uri' - File.open(VIM::evaluate('a:new'), 'w') do |f| - f << open(VIM::evaluate('s:plug_src')).read - end -EOF -endfunction - -function! s:upgrade_using_python(new) -python << EOF -import urllib -import vim -psrc, dest = vim.eval('s:plug_src'), vim.eval('a:new') -urllib.urlretrieve(psrc, dest) -EOF -endfunction - -function! s:upgrade_specs() - for spec in values(g:plugs) - let spec.frozen = get(spec, 'frozen', 0) - endfor -endfunction - -function! s:status() - call s:prepare() - call append(0, 'Checking plugins') - call append(1, '') - - let ecnt = 0 - let unloaded = 0 - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if has_key(spec, 'uri') - if isdirectory(spec.dir) - let [valid, msg] = s:git_valid(spec, 1) - else - let [valid, msg] = [0, 'Not found. Try PlugInstall.'] - endif - else - if isdirectory(spec.dir) - let [valid, msg] = [1, 'OK'] - else - let [valid, msg] = [0, 'Not found.'] - endif - endif - let cnt += 1 - let ecnt += !valid - " `s:loaded` entry can be missing if PlugUpgraded - if valid && get(s:loaded, name, -1) == 0 - let unloaded = 1 - let msg .= ' (not loaded)' - endif - call s:progress_bar(2, repeat('=', cnt), total) - call append(3, s:format_message(valid ? '-' : 'x', name, msg)) - normal! 2G - redraw - endfor - call setline(1, 'Finished. '.ecnt.' error(s).') - normal! gg - setlocal nomodifiable - if unloaded - echo "Press 'L' on each line to load plugin, or 'U' to update" - nnoremap L :call status_load(line('.')) - xnoremap L :call status_load(line('.')) - end -endfunction - -function! s:extract_name(str, prefix, suffix) - return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') -endfunction - -function! s:status_load(lnum) - let line = getline(a:lnum) - let name = s:extract_name(line, '-', '(not loaded)') - if !empty(name) - call plug#load(name) - setlocal modifiable - call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) - setlocal nomodifiable - endif -endfunction - -function! s:status_update() range - let lines = getline(a:firstline, a:lastline) - let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') - if !empty(names) - echo - execute 'PlugUpdate' join(names) - endif -endfunction - -function! s:is_preview_window_open() - silent! wincmd P - if &previewwindow - wincmd p - return 1 - endif - return 0 -endfunction - -function! s:find_name(lnum) - for lnum in reverse(range(1, a:lnum)) - let line = getline(lnum) - if empty(line) - return '' - endif - let name = s:extract_name(line, '-', '') - if !empty(name) - return name - endif - endfor - return '' -endfunction - -function! s:preview_commit() - if b:plug_preview < 0 - let b:plug_preview = !s:is_preview_window_open() - endif - - let sha = matchstr(getline('.'), '\(^ \)\@<=[0-9a-z]\{7}') - if empty(sha) - return - endif - - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) - return - endif - - execute 'pedit' sha - wincmd P - setlocal filetype=git buftype=nofile nobuflisted - execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show' sha - normal! gg"_dd - wincmd p -endfunction - -function! s:section(flags) - call search('\(^[x-] \)\@<=[^:]\+:', a:flags) -endfunction - -function! s:diff() - call s:prepare() - call append(0, 'Collecting updated changes ...') - normal! gg - redraw - - let cnt = 0 - for [k, v] in items(g:plugs) - if !isdirectory(v.dir) || !s:is_managed(k) - continue - endif - - let diff = s:system_chomp('git log --pretty=format:"%h %s (%cr)" "HEAD...HEAD@{1}"', v.dir) - if !empty(diff) - call append(1, '') - call append(2, '- '.k.':') - call append(3, map(s:lines(diff), '" ". v:val')) - let cnt += 1 - normal! gg - redraw - endif - endfor - - call setline(1, cnt == 0 ? 'No updates.' : 'Last update:') - nnoremap :silent! call preview_commit() - nnoremap o :silent! call preview_commit() - nnoremap X :call revert() - normal! gg - setlocal nomodifiable - if cnt > 0 - echo "Press 'X' on each block to revert the update" - endif -endfunction - -function! s:revert() - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || - \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' - return - endif - - call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch), g:plugs[name].dir) - setlocal modifiable - normal! "_dap - setlocal nomodifiable - echo 'Reverted.' -endfunction - -function! s:snapshot(...) abort - let home = get(s:, 'plug_home_org', g:plug_home) - let [type, var, header] = s:is_win ? - \ ['dosbatch', '%PLUG_HOME%', - \ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '', - \ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.home]] : - \ ['sh', '$PLUG_HOME', - \ ['#!/bin/sh', '# Generated by vim-plug', '# '.strftime("%c"), '', - \ 'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]] - - call s:prepare() - execute 'setf' type - call append(0, header) - call append('$', '') - 1 - redraw - - let dirs = sort(map(values(filter(copy(g:plugs), - \'has_key(v:val, "uri") && isdirectory(v:val.dir)')), 'v:val.dir')) - let anchor = line('$') - 1 - for dir in reverse(dirs) - let sha = s:system_chomp('git rev-parse --short HEAD', dir) - if !empty(sha) - call append(anchor, printf('cd %s && git reset --hard %s', - \ substitute(dir, '^\V'.escape(g:plug_home, '\'), var, ''), sha)) - redraw - endif - endfor - - if a:0 > 0 - let fn = expand(a:1) - let fne = s:esc(fn) - call writefile(getline(1, '$'), fn) - if !s:is_win | call s:system('chmod +x ' . fne) | endif - echo 'Saved to '.a:1 - silent execute 'e' fne - endif -endfunction - -function! s:split_rtp() - return split(&rtp, '\\\@ -My personal configuration files repository +# szaghi's dotfiles -## Description +> *dotfiles* are your virtual home... this is my home -A repository where to backup my personal configuration files. +|App | My choice | +|-------------|----------------------------------------------------------------| +|os | [Arch Linux](www.archlinux.org) | +|wm | [i3-gaps](https://github.com/Airblader/i3) | +|shell | [bash]( http://www.gnu.org/software/bash) | +|terminal | [terminlogy](https://www.enlightenment.org/about-terminology) | +|editor | [vim](http://www.vim.org) | +|music player | [cmus](https://cmus.github.io) | +|email | [vmail](https://github.com/danchoi/vmail) | +|chat | [wheechat](https://weechat.org/) | +|theme | [solarized (everywhere)](http://ethanschoonover.com/solarized) | -Note that some files have been encrypted for protect my privacy. +> A dotfiles repository is not intended to be forked, commonly it is a backup, this is my home not your... -### For Whom? +> However, my settings can inspire yours and viceversa, sharing our configs is great! -Obviously this repo is mainly intended for personal usage, however some settings can be helpful templates for others. +## What? -#### Bash and Vim +##### This repository is -My `bashrc` contains a 2-lines prompt with many informations. Moreover, my `vimrc` contains many settings tailored for programmers as well as my `bundle` directory contains many useful vim's plugins. ++ a place where to backup my personal configuration files; ++ a place for sharing my idea; ++ a place where I hope others can inspire me. + +![preview](screenshots/preview.png) + +For my *buggy* memory and for your *inspiration*, in the following I give some details about my dotfiles. + +> Your help is very appreciated: share with me your dotfiles (and idea), **open an issue** in this repository! + +## Table of contents + +- [Bootstrap](#bootstrap) +- [dotfiles Tree](#dotfiles-tree) + - [i3](#i3) + - [bash](#bash) + - [vim](#vim) +- [Copyrights](#copyrights) + +## Bootstrap + +> you are your dotfiles, this is me... you should **not** bootstrap from here! + +> ok, you are advised, follow this bootstrap can **destroy** your home! + +During my *pernigration* into the web I found [dotbot](https://github.com/anishathalye/dotbot), that is (in short) a smart tool for managing dotfiles. + +My managing approach is: + ++ store dotfiles into one directory (I named *dotfiles* but it does not matter) thus that I can: + + easy version control dotfiles by means of git; + + keep clean the repository: + + exploit a tree organization based on nested directory; + + easy bootstrapping for fresh installation; ++ my home must contain only *sym links* to the actual dotfiles: + + dotbot do this job for me greatly. + +Bootstrapping is very simple: + +##### Bootstrapping +```shell +git clone https://github.com/szaghi/dotfiles your-dotfiles +cd your-dotfiles +./install +``` +No matter you call your dotfiles root directory: dotbot (`install` is its wrapper) will create symbolic links from your dotfiles root directory into your home (but not just this: it will check for previous invalid sym links, cleaning your home if necessary). + +The *automagical* bootstrap is done by the [install.conf.yaml](https://github.com/szaghi/dotfiles/blob/master/install.conf.yaml) dotfile where (in a very simple syntax) are defined which (and how) configuration files (and directories) must be symbolically linked into your home. + +For example, the **vim** bootstrapping is done by (extracted from my [install.conf.yaml](https://github.com/szaghi/dotfiles/blob/master/install.conf.yaml)): + +```yaml +- link: + ~/.vim: + path: vim/ + relink: true + force: true + + ~/.vimrc: + path: vim/vimrc + relink: true + force: true +``` + +For more details see dotbot [documentation](https://github.com/anishathalye/dotbot). + +Go to [Top](#top) or [TOC](#table-of-contents) + +## Dotfiles Tree + +Presently my tree organization is the following: + ++ **bash**: contains my shell (bash obviously) settings, aliases, exports, ecc...; ++ **dotbot**: is the git submodule repository containing the dotbot bootstrapper; ++ **encrypt**: is where I place my encrypted files... stay away; ++ **git**: contains git configurations; ++ **i3**: contains i3 wm configurations and scripts; ++ **icons**: contains my preferred (mouse) icons; ++ **miscellanea**: contains dotfiles for various stuff that do not necessity more than one config file thus that do not need a dedicated directory; ++ **terminal**: contains configurations (IO and colors) for the terminal; ++ **vim**: no explanation is necessary... vim rocks! ++ **weechat**: colors and configurations of weechat. + +I will not give you details about each of them. In the following there are some screenshots of my dotfiles application result. + +### i3 + +[i3-gaps](https://github.com/Airblader/i3) is **great**, but it has a big cons... it creates addiction, be careful! + +I do not use the main branch of i3: I prefer to have a small gap between each window: my settings refers to the [i3-gaps](https://github.com/Airblader/i3) fork. + +![preview](screenshots/preview.png) + +The status bar is slightly hacked for showing the title of the window currently active. + +### Bash + +I use a 2-lines bash prompt providing many useful informations. + +##### Prompt + +![preview](screenshots/bash-prompt.png) + +In particular, when dealing with git repositories, my prompt is like the *liquid* one (google it for more details) providing contextual informations about the current status of the repository where you are. + +##### Git branches + +![preview](screenshots/bash-git-branches.png) + +##### Git status + +![preview](screenshots/bash-git-status.png) + +### Vim + +To be written. + +Go to [Top](#top) or [TOC](#table-of-contents) + +## Copyrights + +My dotfiles come from a long time usage of GNU/Linux boxes. I take inspiration from a lot of people sharing their dotfiles into the web, I cannot precisely say from where and who. Anyhow, my dotfiles are distributed under the terms of [*WTFPL, Do What the Fuck You Want to*](http://www.wtfpl.net/) Public License without any warranty. + +Go to [Top](#top) or [TOC](#table-of-contents) diff --git a/Xdefaults b/Xdefaults deleted file mode 100644 index 7b1fbd1..0000000 --- a/Xdefaults +++ /dev/null @@ -1 +0,0 @@ -Xcursor.theme: ComixCursors-Slim-White diff --git a/bash/bash_aliases b/bash/bash_aliases new file mode 100644 index 0000000..cba6073 --- /dev/null +++ b/bash/bash_aliases @@ -0,0 +1,82 @@ +# ~/.bash_aliases + +alias ls='ls --color=auto' +alias ll='ls -lh' +alias lt='ls -rtlh' +alias lS='ls -rtlhS' +alias la='ls -A' +alias l="ls -lF --color=auto" +alias lsUUID='sudo blkid' +alias dir='ls --format=vertical' +alias vdir='ls --format=long' +alias cp='cp -iv' +alias rm='rm -iv' +alias mv='mv -iv' +alias cd..='cd ..' +alias ..='cd ..' +alias grep="grep --color=auto" + +# pacman/yaourt +alias pacman-clean='sudo pacman -Rns $(pacman -Qqtd)' +alias yaourt-update='yaourt -Syu ; yaourt -Su --aur' +alias yaourt-all='yaourt -Syu --aur' + +# make +alias make='make -j 10' + +# okular +alias okular='okular > /dev/null 2>&1' + +# evince +alias evince='evince > /dev/null 2>&1' + +# gimp +alias gimp='gimp > /dev/null 2>&1' + +# eog +alias eog='eog > /dev/null 2>&1' + +# latexmk +alias latexmk='latexmk -pdf' + +# pdflatex +alias pdflatex='pdflatex -interaction=nonstopmode -halt-on-error' + +# git +alias pushgithub-master='git push -u origin master --tags' +alias pushgithub-AMR='git push -u origin AMR --tags' +alias pushgithub-gh-pages='git push -u origin gh-pages' +alias pushgithub-testing='git push -u origin testing --tags' +alias pushgithub-master-local='git push -u zaghi-local master --tags' + +# acroread +alias acroread='acroread > /dev/null 2>&1' + +# vim SuperMan! +vman() { + vim -c "SuperMan $*" + + if [ "$?" != "0" ]; then + echo "No manual entry for $*" + fi +} + +# yapf +alias yapf='python -m yapf --style=/home/stefano/python/yapf-style.ini' + +#Aliases for CRESCO connections +alias n.por='ssh nunzio@cresco1-f1.portici.enea.it' +alias n.por3='ssh nunzio@cresco3x001.portici.enea.it' +alias n.por4='ssh nunzio@cresco4x001.portici.enea.it' +alias n.cas='ssh nunzio@crescoc1.casaccia.enea.it' +alias r.por='ssh picchia@cresco1-f1.portici.enea.it' +alias r.por3='ssh picchia@cresco3x001.portici.enea.it' +alias r.por4='ssh picchia@cresco4x001.portici.enea.it' +alias r.cas='ssh picchia@crescoc1.casaccia.enea.it' +alias e.por='ssh eugenio@cresco1-f1.portici.enea.it' +alias e.por3='ssh eugenio@cresco3x001.portici.enea.it' +alias e.por4='ssh eugenio@cresco4x001.portici.enea.it' +alias e.cas='ssh eugenio@crescoc1.casaccia.enea.it' + +#Miscellanea +alias hist='history -a && hist.py' diff --git a/bash/bash_compilers b/bash/bash_compilers new file mode 100644 index 0000000..e84a9aa --- /dev/null +++ b/bash/bash_compilers @@ -0,0 +1,23 @@ +source /usr/local/Modules/3.2.10/init/bash + +# intel parallel studio +source /opt/intel/vtune_amplifier_xe_2016/amplxe-vars.sh > /dev/null 2>&1 +source /opt/intel/inspector_xe_2016/inspxe-vars.sh > /dev/null 2>&1 +source /opt/intel/advisor_xe_2016/advixe-vars.sh > /dev/null 2>&1 +source /opt/intel/bin/compilervars.sh intel64 + +#Open64 +export PATH=$PATH:/opt/open64-5.0/bin + +#Ekopath +export PATH=$PATH:/opt/ekopath-5.0.1/bin + +# OpenMP +OMP_NUM_THREADS=6 +export OMP_NUM_THREADS + +# mpi +LD_LIBRARY_PATH=/usr/lib/openmpi/lib:$LD_LIBRARY_PATH +LD_RUN_PATH=/usr/lib/openmpi/lib:$LD_RUN_PATH + +export MANPATH LD_LIBRARY_PATH LD_RUN_PATH diff --git a/bash/bash_exports b/bash/bash_exports new file mode 100644 index 0000000..c05db4a --- /dev/null +++ b/bash/bash_exports @@ -0,0 +1,33 @@ +#!/bin/bash +# Make vim the default editor. +export EDITOR='vim'; + +# Increase Bash history size. Allow 32³ entries; the default is 500. +export HISTSIZE='32768'; +export HISTFILESIZE="${HISTSIZE}"; +# Omit duplicates and commands that begin with a space from history. +export HISTCONTROL='ignoreboth'; + +# Prefer US English and use UTF-8. +export LANG='en_US.UTF-8'; +export LC_ALL='en_US.UTF-8'; + +# Highlight section titles in manual pages. +export LESS_TERMCAP_md="${yellow}"; + +# Don’t clear the screen after quitting a manual page. +export MANPAGER='less -X'; + +# Colors +if [ -e /lib/terminfo/x/xterm-256color ]; then + export TERM='xterm-256color' +else + export TERM='xterm-color' +fi +eval "$(dircolors ~/.dircolors.256dark)" + +# Vmail hyperlinks +export VMAIL_HTML_PART_READER='elinks -dump' + +# Some sane exports +export PATH SHOST CPU HOSTNAME HOSTTYPE OSTYPE MACHTYPE SHELL INDEXSTYLE diff --git a/bash/bash_functions b/bash/bash_functions new file mode 100644 index 0000000..8cc5cca --- /dev/null +++ b/bash/bash_functions @@ -0,0 +1,67 @@ +#!/bin/bash +# Add paths to PATH +pathmunge () { + if test -d $1 && ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then + if [ "$2" = "after" ] ; then + PATH=$PATH:$1 + else + PATH=$1:$PATH + fi + fi +} + +# Simple calculator +function calc() { + local result=""; + result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')"; + # └─ default (when `--mathlib` is used) is 20 + # + if [[ "$result" == *.* ]]; then + # improve the output for decimal numbers + printf "$result" | + sed -e 's/^\./0./' `# add "0" for cases like ".5"` \ + -e 's/^-\./-0./' `# add "0" for cases like "-.5"`\ + -e 's/0*$//;s/\.$//'; # remove trailing zeros + else + printf "$result"; + fi; + printf "\n"; +} + +# Determine size of a file or total size of a directory +function fs() { + if du -b /dev/null > /dev/null 2>&1; then + local arg=-sbh; + else + local arg=-sh; + fi + if [[ -n "$@" ]]; then + du $arg -- "$@"; + else + du $arg .[^.]* *; + fi; +} + +# Extra many types of compressed packages +extract () { + if [ -f $1 ]; then + case $1 in + *.tar.bz2) tar -jxvf $1 ;; + *.tar.gz) tar -zxvf $1 ;; + *.bz2) bunzip2 $1 ;; + *.dmg) hdiutil mount $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar -xvf $1 ;; + *.tbz2) tar -jxvf $1 ;; + *.tgz) tar -zxvf $1 ;; + *.zip) unzip $1 ;; + *.ZIP) unzip $1 ;; + *.pax) cat $1 | pax -r ;; + *.pax.Z) uncompress $1 —stdout | pax -r ;; + *.Z) uncompress $1 ;; + *) echo "'$1' cannot be extracted/mounted via extract()";; + esac + else + echo "'$1' is not a valid file to extract" + fi +} diff --git a/bash/bash_optprogs b/bash/bash_optprogs new file mode 100644 index 0000000..71a4abd --- /dev/null +++ b/bash/bash_optprogs @@ -0,0 +1,14 @@ +# ~/.bash_optprogs +source ~/.bash_functions + +# paraview +pathmunge /opt/arch/paraview/4.3.1/bin after + +# acroread +pathmunge /opt/arch/Adobe/Reader9/bin after +export GTK_PATH=/usr/lib/gtk-2.0 + +# tecplot +pathmunge /opt/Tec360/bin after +TECPHYFILE=~/.Trash/tecplot.phy +export TECPHYFILE diff --git a/bash/bash_paths b/bash/bash_paths new file mode 100644 index 0000000..ed83af9 --- /dev/null +++ b/bash/bash_paths @@ -0,0 +1,11 @@ +# ~/.bash_paths +#source ~/scripts/pathmunge.sh + +# local path +#pathmunge . after + +# bin +#pathmunge ~/bin after + +# scripts +#pathmunge ~/scripts after diff --git a/bash/bash_profile b/bash/bash_profile new file mode 100644 index 0000000..5545f00 --- /dev/null +++ b/bash/bash_profile @@ -0,0 +1,5 @@ +# +# ~/.bash_profile +# + +[[ -f ~/.bashrc ]] && . ~/.bashrc diff --git a/bash/bash_prompt b/bash/bash_prompt new file mode 100644 index 0000000..b601f9e --- /dev/null +++ b/bash/bash_prompt @@ -0,0 +1,76 @@ +#!/bin/bash +prompt_git() { + local s=''; + local branchName=''; + + # Check if the current directory is in a Git repository. + if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then + + # check if the current directory is in .git before running git checks + if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then + + # Ensure the index is up to date. + git update-index --really-refresh -q &>/dev/null; + + # Check for uncommitted changes in the index. + if ! $(git diff --quiet --ignore-submodules --cached); then + s+='+'; + fi; + + # Check for unstaged changes. + if ! $(git diff-files --quiet --ignore-submodules --); then + s+='!'; + fi; + + # Check for untracked files. + if [ -n "$(git ls-files --others --exclude-standard)" ]; then + s+='?'; + fi; + + # Check for stashed files. + if $(git rev-parse --verify refs/stash &>/dev/null); then + s+='$'; + fi; + + fi; + + # Get the short symbolic ref. + # If HEAD isn’t a symbolic ref, get the short SHA for the latest commit + # Otherwise, just give up. + branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \ + git rev-parse --short HEAD 2> /dev/null || \ + echo '(unknown)')"; + + [ -n "${s}" ] && s=" [${s}]"; + + echo -e "${1}${branchName}${orange}${s}"; + else + return; + fi; +} +tput sgr0; +bold=$(tput bold); +reset=$(tput sgr0); +black=$(tput setaf 0); +blue=$(tput setaf 33); +cyan=$(tput setaf 37); +green=$(tput setaf 64); +orange=$(tput setaf 166); +purple=$(tput setaf 125); +red=$(tput setaf 124); +violet=$(tput setaf 61); +white=$(tput setaf 15); +yellow=$(tput setaf 136); +smerald=$(tput setaf 6); +if [[ "${USER}" == "root" ]]; then + userStyle="${red}"; +else + userStyle="${orange}"; +fi; +if [[ "${SSH_TTY}" ]]; then + hostStyle="${bold}${red}"; +else + hostStyle="${yellow}"; +fi; +PS1="\n\[\e[30;1m\]\[\016\]l\[\017\](\[\e[38;5;220m\]\u@\h\[\e[30;1m\])-(\[\e[38;5;220m\]\j\[\e[30;1m\])-(\[\e[38;5;220m\]\t \d\[\e[30;1m\])->\[\e[30;1m\]\n\[\016\]m\[\017\]-(\[\[\e[38;5;208m\]\w\[\e[30;1m\])-(\[\e[38;5;110m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\])--> \[\e[0m\]" +PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME}\007"' diff --git a/bash/bash_welcome b/bash/bash_welcome new file mode 100644 index 0000000..8ed28d3 --- /dev/null +++ b/bash/bash_welcome @@ -0,0 +1,78 @@ +# ~/.bash_welcome + +cp="\e[0;31m" +cb="\e[0;34m" +#cb="\e[38;5;208m" +cy="\e[38;5;220m" +#cc="\e[m" + +os=`lsb_release -a 2>/dev/null | grep -i 'Description' | cut -f2` +kernel=`uname -r` +arch=`uname -m` +#ip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'` +ip=`host -d ironman | awk -F "A" '{print $2}' | grep '192.168'` +ds_size=$(df -x fuse.gvfs-fuse-daemon -h --block-size=1024 | awk '{sum += $2;} END {print sum;}'); +ds_size_gb=$(echo "scale=2; $ds_size/(1024^2)" | bc) +ds_avail=$(df -x fuse.gvfs-fuse-daemon -h --block-size=1024 | awk '{sum += $4;} END {print sum;}') +ds_avail_gb=$(echo "scale=2; $ds_avail/(1024^2)" | bc) +ds_avail_pc=$(echo "scale=3; $ds_avail/$ds_size*100" | bc) +ds_used=$(df -x fuse.gvfs-fuse-daemon -h --block-size=1024 | awk '{sum += $3;} END {print sum;}'); +ds_used_gb=$(echo "scale=2; $ds_used/(1024^2)" | bc) +ds_used_pc=$(echo "scale=3; $ds_used/$ds_size*100" | bc) +cpu_model=`cat /proc/cpuinfo | grep -i "model name" | tail -n 1 | awk -F : '{print $2}' | sed 's/ */ /g' | sed 's/^ //'` +cpus=`cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l` +cores=`cat /proc/cpuinfo | grep "siblings" | tail -n 1 | awk '{print $3}'` +mem=`grep MemTotal /proc/meminfo | awk '{print $2}'` +mem_gb=$(echo "scale=2; $mem/(1024^2)" | bc) +mem_free=`cat /proc/meminfo | grep MemFree | awk '{print $2}'` +mem_free_gb=$(echo "scale=2; $mem_free/(1024^2)" | bc) +mem_used_gb=$(echo "scale=2; $mem_gb - $mem_free_gb" | bc) +uptime=$(uptime) + + +echo -e +echo -e +echo -e "${cp}"' _____________ '"${cc}""${co}"' OS: '"${cy}"$os"${cc}" +echo -e "${cp}"' ,ad8PP"""""""""YY8ba, '"${cc}""${co}"' Kernel: '"${cy}"$kernel"${cc}" +echo -e "${cp}"' ad8P" `"Y8b, '"${cc}""${co}"' Architecture: '"${cy}"$arch"${cc}" +echo -e "${cp}"' ,d8P `Y8b, '"${cc}""${co}"' Disk size: '"${cy}"$ds_size_gb' [GB]'"${cc}" +echo -e "${cp}"' ______________ ,d8P `Y8b, '"${cc}""${co}"' Disk used: '"${cy}"$ds_used_gb' [GB] '$ds_used_pc'%'"${cc}" +echo -e "${cp}"' ,ad8PPP"""""""""YYY888ba, "8b, '"${cc}""${co}"' Disk available: '"${cy}"$ds_avail_gb' [GB] '$ds_avail_pc'%'"${cc}" +echo -e "${cp}"' ,adP"" `""Y8ba `8b, '"${cc}""${co}"' Processor: '"${cy}"$cpu_model"${cc}" +echo -e "${cp}"' ,d8P" `"Yb, `8b '"${co}"' #CPUs: '"${cy}"$cpus"${cc}${co}"' #COREs/CPU: '"${cc}${cy}"$cores"${cc}" +echo -e "${cp}"' ,dP" `Y8a ____ `8, '"${co}"' RAM: '"${cy}"$mem_gb' [GB]'"${cc}${co}"' Free: '"${cc}${cy}"$mem_free_gb' [GB]'"${cc}${co}"' Used: '"${cc}${cy}"$mem_used_gb' [GB]'"${cc}" +echo -e "${cp}"' ,dP" `Y8bdP""Yb, 8I '"${co}"' IP: '"${cy}"$ip"${cc}" +echo -e "${cp}"' ,8P "Y8, `8b Ib '"${co}"' Uptime: '"${cy}"$uptime"${cc}" +echo -e "${cp}"' ,8P "8b I8 8I' +echo -e "${cp}"' ,dP ______ `8b d8 I8' +echo -e "${cp}"' d8 ,ad8P"""""Yba, `8b8I 8I' +echo -e "${cp}"' ,8I ,dP"IP "Yb, d8 I8' +echo -e "${cp}"' I8 dP" ,8 `Yb, d8 dI' +echo -e "${cp}"' I8 dP dP d8b, ,8P 8' +echo -e "${cp}"' I8 ,8I ,8 ,8"`Yb d8" dP' +echo -e "${cp}"' I8 I8 dP I8 `Yb ,8P j8' +echo -e "${cp}"' I8 I8 8I 8P `Yb, ,d8" jP' +echo -e "${cp}"' I8 I8 8I 8I `Y8a8" j8' +echo -e "${cp}"' I8, Y8, 8I 8I ,d8" jP' +echo -e "${cp}"' `8I `Yb, 8I 8I ,d8" j8' +echo -e "${cp}"' Y8, "8b8I I8ad8" ,dP' +echo -e "${cp}"' `8b "8I 88P ,d88' +echo -e "${cp}"' `Yb, Y8 Yb ,dP" Yb' +echo -e "${cp}"' `Yb, I8, `8, ,dP `8,' +echo -e "${cp}"' `Y8, `8I Yb, ,dP Ib' +echo -e "${cp}"' `Y8, Yb, `Yb, ,dP 8I' +echo -e "${cp}"' "8b, `8I `Yb, ,dP I8' +echo -e "${cp}"' `Y8b, Yb, `Yb, ,d88 8I' +echo -e "${cp}"' `Y8ba, `8a `Y8a,,dP" I8 I8' +echo -e "${cp}"' `"Y8ba, I8, "Y8P dI f8' +echo -e "${cp}"' ""Y8baa,8b, `Y8a,,d8 dP' +echo -e "${cp}"' `""Y88b, `"YYP 8' +echo -e "${cp}"' "Y8, dP' +echo -e "${cp}"' `Y8, j8' +echo -e "${cp}"' `Y8, j8' +echo -e "${cp}"' `Y8b, j8' +echo -e "${cp}"' `Y8b, ,d8' +echo -e "${cp}"' `"Yba, ,dP' +echo -e "${cp}"' `"Yba, ,adP' +echo -e "${cp}"' `"Y8bbaaaaaadd8P' +echo -e "${cp}"' `"""""""' diff --git a/bash/bashrc b/bash/bashrc new file mode 100644 index 0000000..187b888 --- /dev/null +++ b/bash/bashrc @@ -0,0 +1,49 @@ +# ~/.bashrc + +# if not running interactively, don't do anything +[ -z "$PS1" ] && return; + +# load the bash dotfiles +for file in ~/.{bash_welcome,bash_aliases,bash_compilers,bash_exports,bash_functions,bash_optprogs,bash_paths,bash_prompt}; do + [ -r "$file" ] && [ -f "$file" ] && source "$file"; +done; +unset file; + +# don't put duplicate lines in the history +export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups + +# append to the history file, don't overwrite it +shopt -s histappend + +# check the window size after each command and, if necessary update the values of LINES and COLUMNS +shopt -s checkwinsize + +# case-insensitive globbing (used in pathname expansion) +shopt -s nocaseglob; + +# autocorrect typos in path names when using `cd` +shopt -s cdspell; + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"; + +# enable some Bash 4 features when possible: +for option in autocd globstar; do + shopt -s "$option" 2> /dev/null; +done; + +# add tab completion for many Bash commands +if [ -f /etc/bash_completion ]; then + source /etc/bash_completion; +fi; + +# enable tab completion for `g` by marking it as an alias for `git` +if type _git &> /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then + complete -o default -o nospace -F _git g; +fi; + +# add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards +[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh; + +#set vim mode +set -o vi diff --git a/bash_aliases b/bash_aliases deleted file mode 100644 index daa3045..0000000 --- a/bash_aliases +++ /dev/null @@ -1,70 +0,0 @@ -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 diff --git a/bash_compilers b/bash_compilers deleted file mode 100644 index 77f2a69..0000000 --- a/bash_compilers +++ /dev/null @@ -1,12 +0,0 @@ -U2FsdGVkX1+dmhxmWkg3ZjbuBIc19rYc4LJCJsSyhlxsgDTzV3IB9U3RoxN5NTN7 -nOZ9CI9ZEExW52fibuUGakPlGkGDpSxY0ROLVSMdKbXE9c6aTE0M5F0P9hPwdNSP -T2qhau1BuG1Tuz1hrZ/+BO0PAnufkcZX/yaS87VxfSUVBJdoT1yzcWJY4hhz2R+C -I2BnnxPUFvQN9gbbuQfw9ZeyRYBk4LYc0PxYzgwyegVARevxvYCBk6MN5GwsvKy0 -cNEZls6l8RU8oZJ0UW6UMwradcxgLm5DAFtejEX49vmXskWAZOC2HND8WM4MMnoF -SrMbM3prprSBCUvnlYC5F043xYTtUWyfEVlR5Aj49LDShbMprXPZv8lVOVU2mLJb -o3Vqhg/gvQj+u4toaku8sjCSd0W6SGkj0cagtGE7caOmBPpkU4hfzupSWXWhyFzB -/8pj3YeDxJp6z+/sLA0vkV9OceXYzbZwbEoxID9IkWqhpIP1QyUrykMAVKBw5BuD -kC0Yc6EBQcoJNxVDR0GCxzHYfCum7ibiQqtVfsG8ngtWAmBuG7kq3r9r/pO+PF4F -r/P1UL1jbqeqXozx236ryoB7pBwIMxTFsfrGQ09QnPH54cvLQAzm2XfqdtrIq4nm -DpBHh+p3/TW+8Tef6fiewraJ5QO3aRQ9F+9l0oFHyjoHH4th45uCRfMhhYCTrP5J -94gs3PZl0aOMuB/SvrVGp5uonDY/RSxEKpGIMlpwLLc= diff --git a/bash_optprogs b/bash_optprogs deleted file mode 100644 index 8212e23..0000000 --- a/bash_optprogs +++ /dev/null @@ -1,13 +0,0 @@ -U2FsdGVkX1+dmhxmWkg3ZhhRrUF6Ol+tr13goDQMy4GJR40ViUPMosXQidn4SMnX -C9DAud3XHmStjC6pp/vS9NbHypD64NIf5HuanNJiB2/axm9Nim7QWGiBNxRWBwxz -4Yp3vUn5fDusC0xR74T9/10RIOnxPMMoZhg4nH27zABOE14L2M7QscuDapeCj3zi -eBQxBwsYTi0N+dNR1HMq+JBwYG6tW7sogn303jJoL9vQGpf+KWcPOPTNMEBJaIr+ -pVv3vqk44tMQyWveqJQUYWzAUFu059Ldzqc4+dFklpUuwnqAGFHWfysfdFg0jz9s -eZ3t1QG63LFfQX2HqxPuD3VHR9rxzmy0O3+wWLXSiMwhG13k4DnGWzmqmhf2OG7i -IyoF7qN/Qsz3n28ci8sRZdAKTdfg6cxYrTBanFoXIxx2ryuXN/6YfeTkqhOO7/AH -Ynp14OApMg9I1uvyqZole0d1Y/qX6GcHuSFk1aG4ZytNDb+DjI39qzMXQ1pGXAE2 -YNE4LWy94TUXPRN2nR4P5i7CeoAYUdZ/Kx90WDSPP2y643zgBVvB08VlGH8bMOMe -PpwEU4GxDiXdltOb6OCj1hEe/t37B+CzW2v2HpsnrXS+nqQAwBC0CJFSTVKKtpz4 -NRI2q7VZxUp3ePn3216S9q2wHCU1NX9/F8reIiZCK8xqeuIeMA9a16ghiAgGOQGR -HdWjGg5dSVeQobrcslmf9rzUxRkjvVVt3xqDNzUL8WF9WgPztEKhTqKPuglX+FzX -FHn9ES2hxhSkOStLQLcCoISSfk/bp6T1WjJVHPXv1Qc= diff --git a/bash_paths b/bash_paths deleted file mode 100644 index b7797a9..0000000 --- a/bash_paths +++ /dev/null @@ -1,9 +0,0 @@ -U2FsdGVkX1+dmhxmWkg3Zjieh3HI7j8VpB1G1dDrdiY9ciV3RyVdtJmBylSoGrLY -ROu3zQrfQjKPwuk5k2G3rxf5ApDcWwUcw5M8rV4xWlEHxPhjx/8G02AisraOx3Ei -qK52GnJLMPANTZAxnmNT+WoOJYslvB8J7ajR5Gz/0cUxJbZl717B9eQ0KGvGZbJ1 -QvC+/8+8B1oY21wbWZOisC60gukEr6XeuyaoZlM9loCUx6C1EfBD/feJTe4uLAH7 -nxFFrchva7FIclpNQR/3WWhlt4V4ETF19YVMQyHo+S4kHqNCTa3dY3xUrBu9w7rz -FE13OhSESODzB8IVZPmMBp6AM9GLsBDGu8SVi11SSVIMPwdgsE4EMrYQgM2OnUk1 -YxdfEADGDCPqr6p1n+NQXN2OB+Pue5SRjc41wN6PEI0/e1TE0whs+mHCMcF/+ZsV -d5uXRaxpY4aXZ+sr6jJwRoPTmrM/kR+6e3b3s4RIMaK1APbfT0d88IbHtGKuocJK -gj2790gO7LtvutEWhUSR5w== diff --git a/bash_profile b/bash_profile deleted file mode 100644 index f857f54..0000000 --- a/bash_profile +++ /dev/null @@ -1,2 +0,0 @@ -U2FsdGVkX1+dmhxmWkg3Zp+hpDdI0puStLsQ1jkkW9GyykzzVsIrBUjfaw9Rl/dL -vqjmyafGHQUdL+rEVc69KH8gT1DnQ0R8wi3uok7qGHc= diff --git a/bash_welcome b/bash_welcome deleted file mode 100644 index 80cb223..0000000 --- a/bash_welcome +++ /dev/null @@ -1,99 +0,0 @@ -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 diff --git a/bashrc b/bashrc deleted file mode 100644 index 592e242..0000000 --- a/bashrc +++ /dev/null @@ -1,147 +0,0 @@ -# ~/.bashrc - -# if not running interactively, don't do anything -[ -z "$PS1" ] && return - -# don't put duplicate lines in the history -export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups - -# append to the history file, don't overwrite it -shopt -s histappend - -# check the window size after each command and, if necessary update the values of LINES and COLUMNS -shopt -s checkwinsize - -# make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# colors and prompt -if [ -e /lib/terminfo/x/xterm-256color ]; then - export TERM='xterm-256color' -else - export TERM='xterm-color' -fi -prompt_git() { - local s=''; - local branchName=''; - - # Check if the current directory is in a Git repository. - if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then - - # check if the current directory is in .git before running git checks - if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then - - # Ensure the index is up to date. - git update-index --really-refresh -q &>/dev/null; - - # Check for uncommitted changes in the index. - if ! $(git diff --quiet --ignore-submodules --cached); then - s+='+'; - fi; - - # Check for unstaged changes. - if ! $(git diff-files --quiet --ignore-submodules --); then - s+='!'; - fi; - - # Check for untracked files. - if [ -n "$(git ls-files --others --exclude-standard)" ]; then - s+='?'; - fi; - - # Check for stashed files. - if $(git rev-parse --verify refs/stash &>/dev/null); then - s+='$'; - fi; - - fi; - - # Get the short symbolic ref. - # If HEAD isn’t a symbolic ref, get the short SHA for the latest commit - # Otherwise, just give up. - branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \ - git rev-parse --short HEAD 2> /dev/null || \ - echo '(unknown)')"; - - [ -n "${s}" ] && s=" [${s}]"; - - echo -e "${1}${branchName}${blue}${s}"; - else - return; - fi; -} -tput sgr0; -bold=$(tput bold); -reset=$(tput sgr0); -black=$(tput setaf 0); -blue=$(tput setaf 33); -cyan=$(tput setaf 37); -green=$(tput setaf 64); -orange=$(tput setaf 166); -purple=$(tput setaf 125); -red=$(tput setaf 124); -violet=$(tput setaf 61); -white=$(tput setaf 15); -yellow=$(tput setaf 136); -smerald=$(tput setaf 6); -if [[ "${USER}" == "root" ]]; then - userStyle="${red}"; -else - userStyle="${orange}"; -fi; -if [[ "${SSH_TTY}" ]]; then - hostStyle="${bold}${red}"; -else - hostStyle="${yellow}"; -fi; -PS1="\[\033]0;\w\007\]"; -PS1+="\[${bold}\]\n"; -PS1+="\[${userStyle}\]\u"; -PS1+="\[${smerald}\]@"; -PS1+="\[${hostStyle}\]\h"; -PS1+="\[${smerald}\](\@ \d)" -PS1+="\$(prompt_git \"${white} on ${violet}\")"; # Git repository details -PS1+="\n"; -PS1+="\[${smerald}\]\w "; -PS1+="\[${smerald}\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b"; -PS1+="\n"; -PS1+="\[${yellow}\]→ \[${reset}\]"; -export PS1; - -# welcome -# if [ -f ~/.bash_welcome ]; then -# . ~/.bash_welcome -# fi - -# enable programmable completion features -if [ -f /etc/bash_completion ]; then - . /etc/bash_completion -fi - -# alias definitions -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -# paths inclusions -if [ -f ~/.bash_paths ]; then - . ~/.bash_paths -fi - -# opt programs inclusions -if [ -f ~/.bash_optprogs ]; then - . ~/.bash_optprogs -fi - -# compilers definitions -if [ -f ~/.bash_compilers ]; then - . ~/.bash_compilers -fi - -# xhost + >/dev/null - -# variables exporting -export EDITOR="vim" -export PYLINTRC=~/.pylint.d/pylintrc -export LESS_TERMCAP_md="${yellow}"; -export PATH SHOST CPU HOSTNAME HOSTTYPE OSTYPE MACHTYPE SHELL INDEXSTYLE diff --git a/dotbot b/dotbot new file mode 160000 index 0000000..9c1af76 --- /dev/null +++ b/dotbot @@ -0,0 +1 @@ +Subproject commit 9c1af76e9ef1c1c9f78615d88af7de39f157e341 diff --git a/encrypt/pypirc b/encrypt/pypirc new file mode 100644 index 0000000..58ed547 --- /dev/null +++ b/encrypt/pypirc @@ -0,0 +1,6 @@ +U2FsdGVkX1+dmhxmWkg3ZnuN3WCy+disS788Uh6XORWp0wkZILv1iRbq77lseUnh +fGTi+9HSV8Kuwf8MNETev/+gj+3Xpkas4Obk6GlDMKDdfQdIZZlMiLmctclISrO1 +zCx7T3qrGAEdQkF0DKfV8CA82VIZpW+QWQIH2IXN28a/C9xiQU/g5aLof+oWsYjY +52DZ4mjvI7cPOPaKcK5NxdmA+XzfU5qfROpNqnj+ZoA+WVSVxB9vhjRxrEW4BL7E +OVSqiod/jAA0nZeSiqDrZRb5bsoqypSzbHT6TjlJu5ghklfJWILHimrrSDBWOa8W +tQwWz6DCVIALwW2nUPLNjyf3f/IMELMRHHNYjMltU9TNRBMT9SJ+9by/5voKyY64 diff --git a/encrypt/vmailrc b/encrypt/vmailrc new file mode 100644 index 0000000..9b75409 --- /dev/null +++ b/encrypt/vmailrc @@ -0,0 +1,28 @@ +U2FsdGVkX1+dmhxmWkg3ZvDHK4Ub68Bu8cAYGSJngICKuXZuKM1fLeKbdK0kbHzp +jBAOkAIiAD3to8u45YQKIMNYcj8pubKIuYgj6Mn+Q56x6MXQwiY4Hy52ACG1vsdw +fAy9A0dYLFGqUy+Xb/ieUMpU19Hb7SMrKT11Y/ofU7bxv2A+ojtBlnsy+WBLwtx7 +mnTcF4k1olSZsuuC1ndmi/LJ3oO80G/iyzWtfCxpcRkzAMSn83ETI/fuDTXH1SOU +TSMaC2RQwjtb/DC9cWOU4B+CKu/plOTGShUJIUCJNpSi7fGaZT318R0+CfXG4dJJ +M8bpQ/EWaav8C4rovqleypS/U/MHcPauDxtAZqrSoxglTdoBzS4pbD5YUWCOO015 +m2ji0VoSlTIT1BNw34uhUGfpjzmgaqD6Kaw5G5CdmyxtcsnH+my8Cd1kKri4GZUM +rf9DMbb/uvJDfeVZweXL32ZBr+yophHx1Nxj1t51ztzb5ci7qyASEmtcZ0Tgy5vJ +yaL1IVdSmpdUGdTvN+9f04kLirqR19DKC4jXPjao0oC10hU35WNCZCqPuIloErqH +T/7rRHoT9mHHKLqsXMq2mszDvTGWG7uSLieEbVFdXynw+OVX0kaV9+uZdNBx9oC2 +rx/+/GBnB69WoUtkn8XbWG/w/0oMS+szpDgNal4FfrROqUvdyu9BIZWnjrp9ZMEN +T/7rRHoT9mHHKLqsXMq2mpkQV3WxtS5/Jk/Bdj+b0VZP8uQ4ZCqM1Cmpm904Ax3J +y7CeI4D5I+2eJH2ozBYev29bx+sKUfxlwQGbOvKS4+QQS+zw/fmiio30HhC0hTcw +ViFO1b225vtQkA2r4zr13B+QMyjL04YmvIQ/HptZG1CbRrWaVwDZ5AZKJ0ZsEpbl +ze9TyzZHB3264KbpsljbAebwOTieFUmIDjmgn+5432YjNNJ90sLe4x+TpHdQgthm +Z64eFOVy35MINVKo6Q4m/YmA9J2zubIQaoNm/rDKBXfnq5gFLzXZps+M0GYdbEaZ +RHC+6w72GibqXI/vCkkjH/Of7Ah6cXnHZKWt3bsu0cDq/axfBjsDAESqIDcpTo4R +XgOwXYRMval+4cIntHC+bwnlV6mt5Ou67tk24Ei0Kw+ZyjhNjqXW1JltmQblic6i +yabJEbnf+BoMa/Fh9G5tJKcqxnqyBxMCK1+35X24Tht/gXMfSdf6M+FJtS7nerbu +cscpweUP122KR/ktrZjVxhplQAydtvERYMFXdXtrsS1JrSVI5536xp6gk+jjktgJ +AaUovoxT8u9u9n7rDGAXXZc06H6f6euN56dQUFnSZ6K9/v+G89nW6OoM2PZWwgyx +4L7yLFFaKnbWA3Q+HuEDxpAwD1LLHUsRCsqfPmhGFR9jGbmnls2P6EILdb+i0hTq +6K7+XFJVh5aXfKgRkxGJG5nKOE2OpdbUmW2ZBuWJzqKM2dSN3OLPQar8JclnybvK +M9N8jFrdXKQhkFpKEK8CDzOKs3eNLcoo1BDUnvfLpjcaWekvOKC5ywi3O7PCaidX +Yp0eQcGXSJwtCt48OdOnlM7zj1okS9fsOgRgweNQYOvX/iMbb2t/Odc2ekB0YYXr +ET+XQtROT6IN6GbJg1jXoZFoa8OwY1uaoco3btl/p5ADzpy8KAXdkp1mQBIXqHTX +fdm3UsGWKlaCaY1HIOR6wl3fE5m15QYS5GlW7ewcPjYuXpQAz3oT7/l5EdD0tt7j +8D+5NpgRbXK1rZvPQlcceQIRxQ/jvw2KWsqZeCI8YLo= diff --git a/gitconfig b/git/gitconfig similarity index 100% rename from gitconfig rename to git/gitconfig diff --git a/i3/config b/i3/config index ad1053e..7587508 100644 --- a/i3/config +++ b/i3/config @@ -1,42 +1,62 @@ -# This file has been auto-generated by i3-config-wizard(1). -# It will not be overwritten, so edit it as you like. +# i3 config file # -# Should you change your keyboard layout some time, delete -# this file and re-run i3-config-wizard(1). -# -# i3 config file (v4) -# -# Please see http://i3wm.org/docs/userguide.html for a complete reference! +# depencies and autostarts: +# i3-gaps(next) +# clipit +# setxkbmap +# unclutter +# dunst +# feh +# devmon +# blueman-applet +# bitlbee + +# Special mod key set $mod Mod4 + +# Workspaces +bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: ' +# switch to workspace +bindsym $mod+1 workspace 1 +bindsym $mod+2 workspace 2 +bindsym $mod+3 workspace 3 +bindsym $mod+4 workspace 4 +bindsym $mod+5 workspace 5 +bindsym $mod+6 workspace 6 +bindsym $mod+7 workspace 7 +bindsym $mod+8 workspace 8 +bindsym $mod+9 workspace 9 +bindsym $mod+0 workspace 10 +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace 1 +bindsym $mod+Shift+2 move container to workspace 2 +bindsym $mod+Shift+3 move container to workspace 3 +bindsym $mod+Shift+4 move container to workspace 4 +bindsym $mod+Shift+5 move container to workspace 5 +bindsym $mod+Shift+6 move container to workspace 6 +bindsym $mod+Shift+7 move container to workspace 7 +bindsym $mod+Shift+8 move container to workspace 8 +bindsym $mod+Shift+9 move container to workspace 9 +bindsym $mod+Shift+0 move container to workspace 10 + # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). font pango:DejaVu Sans Mono 10 -# Before i3 v4.8, we used to recommend this one as the default: -# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -# The font above is very space-efficient, that is, it looks good, sharp and -# clear in small sizes. However, its unicode glyph coverage is limited, the old -# X core fonts rendering does not support right-to-left and this being a bitmap -# font, it doesn’t scale on retina/hidpi displays. + # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod -# new window default border + +# Windows new_window pixel 1 new_float pixel 1 +gaps inner 10 +gaps outer 0 # windows pop-ups for_window [window_role="pop-up"] floating enable,move absolute center -# start a terminal -bindsym $mod+Return exec terminology -d `xcwd` # kill focused window bindsym $mod+Shift+q kill -# start dmenu (a program launcher) -# bindsym $mod+d exec dmenu_run -# There also is the (new) i3-dmenu-desktop which only displays applications -# shipping a .desktop file. It is a wrapper around dmenu, so you need that -# installed. -# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -bindsym $mod+d exec j4-dmenu-desktop # change focus bindsym $mod+j focus left bindsym $mod+k focus down @@ -73,58 +93,10 @@ bindsym $mod+Shift+space floating toggle bindsym $mod+space focus mode_toggle # focus the parent container bindsym $mod+a focus parent -# focus the child container -#bindsym $mod+d focus child -# switch to workspace -bindsym $mod+1 workspace 1 -bindsym $mod+2 workspace 2 -bindsym $mod+3 workspace 3 -bindsym $mod+4 workspace 4 -bindsym $mod+5 workspace 5 -bindsym $mod+6 workspace 6 -bindsym $mod+7 workspace 7 -bindsym $mod+8 workspace 8 -bindsym $mod+9 workspace 9 -bindsym $mod+0 workspace 10 -# move focused container to workspace -bindsym $mod+Shift+1 move container to workspace 1 -bindsym $mod+Shift+2 move container to workspace 2 -bindsym $mod+Shift+3 move container to workspace 3 -bindsym $mod+Shift+4 move container to workspace 4 -bindsym $mod+Shift+5 move container to workspace 5 -bindsym $mod+Shift+6 move container to workspace 6 -bindsym $mod+Shift+7 move container to workspace 7 -bindsym $mod+Shift+8 move container to workspace 8 -bindsym $mod+Shift+9 move container to workspace 9 -bindsym $mod+Shift+0 move container to workspace 10 -# Make the currently focused window a scratchpad +# make the currently focused window a scratchpad bindsym $mod+Shift+minus move scratchpad -# Show the first scratchpad window +# show the first scratchpad window bindsym $mod+minus scratchpad show -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart - -# logout, reboot, shutdown -set $Locker i3lock -i ~/pictures/Wallpapers/The_Incredulity_of_Saint_Thomas_by_Caravaggio.png && sleep 1 - -set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown -mode "$mode_system" { - bindsym l exec --no-startup-id $Locker, mode "default" - bindsym e exec --no-startup-id i3-msg exit, mode "default" - bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default" - bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default" - bindsym r exec --no-startup-id systemctl reboot, mode "default" - bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default" - - # back to normal: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" -} - -bindsym $mod+Pause mode "$mode_system" - # resize window (you can also use the mouse for that) mode "resize" { # These bindings trigger as soon as you enter the resize mode @@ -151,45 +123,78 @@ mode "resize" { bindsym $mod+r mode "resize" -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) +# Start a terminal +bindsym $mod+Return exec terminology -d `xcwd` + +# Start dmenu (a program launcher) +bindsym $mod+d exec j4-dmenu-desktop + +# Reload the configuration file +bindsym $mod+Shift+c reload + +# Restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart + +# Logout, reboot, shutdown +set $Locker i3lock -i ~/pictures/Wallpapers/The_Incredulity_of_Saint_Thomas_by_Caravaggio.png && sleep 1 + +set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown +mode "$mode_system" { + bindsym l exec --no-startup-id $Locker, mode "default" + bindsym e exec --no-startup-id i3-msg exit, mode "default" + bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default" + bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default" + bindsym r exec --no-startup-id systemctl reboot, mode "default" + bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default" + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+Pause mode "$mode_system" + +# status bar bar { position top - # status_command i3status -c ~/.i3/i3status.conf + # status_command i3status -c ~/.i3/i3status.conf | ~/.i3/i3status-wrapper.py + status_command i3status -c ~/.i3/i3status.conf # status_command py3status -c ~/.i3/i3status.conf - status_command ~/.i3/conky.sh + # status_command ~/.i3/conky.sh workspace_buttons yes colors { - statusline #999999 - background #252525 - # class border backgrd text - focused_workspace #292929 #292929 #cccccc - active_workspace #252525 #252525 #696f89 - inactive_workspace #252525 #252525 #6b6b6b - urgent_workspace #252525 #252525 #c7a551 - } + background #073642 + statusline #839496 + separator #b58900 + # class border backgrd text + focused_workspace #cb4b16 #cb4b16 #ffffff + active_workspace #cb4b16 #cb4b16 #ffffff + inactive_workspace #252525 #252525 #6b6b6b + urgent_workspace #252525 #252525 #c7a551 + } } -# class border backgr text -client.focused #0088CC #0088CC #ffffff #dddddd +# class border backgr text separator +client.focused #cb4b16 #cb4b16 #ffffff #b58900 client.focused_inactive #333333 #333333 #888888 #292d2e client.unfocused #333333 #333333 #888888 #292d2e client.urgent #2f343a #900000 #ffffff #900000 -# Autostart +# Autostarts exec --no-startup-id clipit exec --no-startup-id setxkbmap it exec --no-startup-id unclutter -idle 2 exec --no-startup-id dunst -config ~/.i3/dunstrc -exec --no-startup-id feh --bg-scale ~/pictures/Wallpapers/The_Incredulity_of_Saint_Thomas_by_Caravaggio.jpg +exec --no-startup-id feh --bg-fill /media/dati/NY.jpg exec --no-startup-id devmon -exec --no-startup-id blueman-applet -exec --no-startup-id bitlbee -F +exec --no-startup-id dropbox +exec --no-startup-id nm-applet -# Most used -bindsym $mod+Print exec scrot 'screenshot-%Y-%m-%d-%H-%M-%S_$wx$h.png' -e 'mv $f ~/pictures/' +# Shortcuts +bindsym $mod+Print exec scrot 'screenshot-%Y-%m-%d-%H-%M-%S_$wx$h.png' -e 'mv $f /media/dati/Documenti/Immagini/' +bindsym $mod+g exec google-chrome-stable bindsym $mod+c exec chromium -bindsym $mod+g exec chromium --app=https://mail.google.com/mail/u/0/#inbox -bindsym $mod+i exec ~/scripts/icemcfd11 -bindsym $mod+p exec /opt/arch/paraview/4.3.1/bin/paraview -bindsym $mod+t exec /opt/arch/tecplot/2008/bin/tec360 +bindsym $mod+x exec firefox +bindsym $mod+p exec paraview +bindsym $mod+q exec java -jar /opt/JDownloader/JDownloader.jar +bindsym $mod+t exec /opt/tec360/bin/tec360 -mesa diff --git a/i3/conky b/i3/conky deleted file mode 100644 index 5ecd5a2..0000000 --- a/i3/conky +++ /dev/null @@ -1,39 +0,0 @@ -out_to_x no -own_window no -out_to_console yes -background no -max_text_width 0 -update_interval 3.0 -total_run_times 0 -short_units yes -if_up_strictness address -#use_spacer left -override_utf8_locale yes -# set to 1 to disable averaging -cpu_avg_samples 4 -border_inner_margin 0 -border_outer_margin 0 -pad_percents 3 - -TEXT -[ -{"full_text":"hd","color":"\#888888","separator":false,"separator_block_width":3},\ -{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\ -{"full_text":"${fs_free /home}","color":"\#eeeeee","separator":false,"separator_block_width":10},\ -\ -{"full_text":"ram","color":"\#888888","separator":false,"separator_block_width":3},\ -{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\ -{"full_text":"${memperc}%","color":${if_match ${memperc}>20}"\#cc5555"${else}"\#eeeeee"${endif},"separator":false,"separator_block_width":10 },\ -\ -{"full_text":"cpu","color":"\#888888","separator":false,"separator_block_width":3},\ -{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\ -{"full_text":"${cpu}%","color":${if_match ${cpu}>10}"\#cc5555"${else}"\#eeeeee"${endif},"separator":false,"separator_block_width":10},\ -\ -{"full_text":"net","color":"\#888888","separator":false,"separator_block_width":3},\ -{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\ -{"full_text":"${if_up wlan0}w ${wireless_bitrate wlan0}${else}${if_up eth0}e ${upspeedf eth0} up ${downspeedf eth0} dwn${else}{null}${endif}${endif}","color":"\#eeeeee","separator":false,"separator_block_width":10},\ -{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\ -\ -{"full_text":"${time %a %d.%m}","color":"\#eeeeee","separator":false,"separator_block_width":10},\ -{"full_text":"${time %H:%M}","color":"\#eeeeee"}\ -], diff --git a/i3/conky.sh b/i3/conky.sh deleted file mode 100755 index 3cd7f5c..0000000 --- a/i3/conky.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -echo "{\"version\":1}" -echo "[[] ," -conky -c ~/.i3/conky diff --git a/i3/dzen2.sh b/i3/dzen2.sh deleted file mode 100755 index de8b455..0000000 --- a/i3/dzen2.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -HEIGHT=12 -WIDTH=0 -RESOLUTION=$(xrandr | grep " connected" | cut -d" " -f 3) -RESOLUTIONW=$(echo $RESOLUTION | cut -d"x" -f1) -RESOLUTIONH=$(echo $RESOLUTION | cut -d"x" -f2 | cut -d'+' -f 1) -X=$(($RESOLUTIONW-$WIDTH)) -Y=$(($RESOLUTIONH-$HEIGHT-1)) diff --git a/i3/get_focused_win_title.sh b/i3/get_focused_win_title.sh new file mode 100755 index 0000000..53155cb --- /dev/null +++ b/i3/get_focused_win_title.sh @@ -0,0 +1,4 @@ +#!/bin/bash +win_id=`xdotool getactivewindow` +win_title=`xdotool getwindowname $win_id` +echo $win_title diff --git a/i3/i3status-wrapper.py b/i3/i3status-wrapper.py new file mode 100755 index 0000000..b76e950 --- /dev/null +++ b/i3/i3status-wrapper.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +import json +import subprocess +import sys + +def get_focused_win_title(): + """ Get the current focused window title. """ + return subprocess.check_output("~/.i3/get_focused_win_title.sh", shell=True).strip('\n') + +def print_line(message): + """ Non-buffered printing to stdout. """ + sys.stdout.write(message + '\n') + sys.stdout.flush() + +def read_line(): + """ Interrupted respecting reader for stdin. """ + # try reading a line, removing any extra whitespace + try: + line = sys.stdin.readline().strip() + # i3status sends EOF, or an empty line + if not line: + sys.exit(3) + return line + # exit on ctrl-c + except KeyboardInterrupt: + sys.exit() + +if __name__ == '__main__': + # Skip the first line which contains the version header. + print_line(read_line()) + + # The second line contains the start of the infinite array. + print_line(read_line()) + + while True: + line, prefix = read_line(), '' + # ignore comma at start of lines + if line.startswith(','): + line, prefix = line[1:], ',' + + j = json.loads(line) + # insert information into the start of the json, but could be anywhere + # CHANGE THIS LINE TO INSERT SOMETHING ELSE + j.insert(0, {'full_text' : '%s' % get_focused_win_title(), 'name' : 'wtitle', 'color' : '#cb4b16'}) + # and echo back new encoded json + print_line(prefix+json.dumps(j)) diff --git a/i3/i3status.conf b/i3/i3status.conf index 3dce580..56c7261 100644 --- a/i3/i3status.conf +++ b/i3/i3status.conf @@ -10,27 +10,43 @@ general { output_format = "i3bar" colors = true interval = 5 + color_good = "#268bd2" + color_bad = "#cb4b16" + color_degraded = "#b58900" } -order += "online_status" -order += "keyboard_layout" +order += "volume master" order += "disk /" order += "disk /home" +order += "ethernet enp2s0" order += "cpu_usage" order += "tztime local" +volume master { + format = "♪: %volume" + format_muted = "♪: muted (%volume)" + device = "default" + mixer = "Master" + mixer_idx = 0 +} + disk "/" { - format = "/ %free" + format = "/ %free" } disk "/home" { - format = "~/ %free" + format = "~/ %free" +} + +ethernet enp2s0 { + format_up = "E: %ip" + format_down = "E: down" } cpu_usage { - format = "CPU %usage " + format = "CPU %usage " } tztime local { - format = " %Y-%m-%d %H:%M:%S " + format = "%Y-%m-%d %H:%M:%S" } diff --git a/icons/bridge/cursors/.directory b/icons/bridge/cursors/.directory new file mode 100644 index 0000000..9fea84a --- /dev/null +++ b/icons/bridge/cursors/.directory @@ -0,0 +1,5 @@ +[Dolphin] +AdditionalInfoV2=Details_Size,Details_Date,CustomizedDetails +Timestamp=2011,9,4,15,13,34 +Version=2 +ViewMode=1 diff --git a/icons/bridge/cursors/00000000000000020006000e7e9ffc3f b/icons/bridge/cursors/00000000000000020006000e7e9ffc3f new file mode 120000 index 0000000..a305d5c --- /dev/null +++ b/icons/bridge/cursors/00000000000000020006000e7e9ffc3f @@ -0,0 +1 @@ +progress \ No newline at end of file diff --git a/icons/bridge/cursors/00008160000006810000408080010102 b/icons/bridge/cursors/00008160000006810000408080010102 new file mode 120000 index 0000000..fb54fee --- /dev/null +++ b/icons/bridge/cursors/00008160000006810000408080010102 @@ -0,0 +1 @@ +size_ver \ No newline at end of file diff --git a/icons/bridge/cursors/03b6e0fcb3499374a867c041f52298f0 b/icons/bridge/cursors/03b6e0fcb3499374a867c041f52298f0 new file mode 120000 index 0000000..031757c --- /dev/null +++ b/icons/bridge/cursors/03b6e0fcb3499374a867c041f52298f0 @@ -0,0 +1 @@ +circle \ No newline at end of file diff --git a/icons/bridge/cursors/08e8e1c95fe2fc01f976f1e063a24ccd b/icons/bridge/cursors/08e8e1c95fe2fc01f976f1e063a24ccd new file mode 120000 index 0000000..a305d5c --- /dev/null +++ b/icons/bridge/cursors/08e8e1c95fe2fc01f976f1e063a24ccd @@ -0,0 +1 @@ +progress \ No newline at end of file diff --git a/icons/bridge/cursors/1081e37283d90000800003c07f3ef6bf b/icons/bridge/cursors/1081e37283d90000800003c07f3ef6bf new file mode 120000 index 0000000..88740b2 --- /dev/null +++ b/icons/bridge/cursors/1081e37283d90000800003c07f3ef6bf @@ -0,0 +1 @@ +copy \ No newline at end of file diff --git a/icons/bridge/cursors/3085a0e285430894940527032f8b26df b/icons/bridge/cursors/3085a0e285430894940527032f8b26df new file mode 120000 index 0000000..c150ede --- /dev/null +++ b/icons/bridge/cursors/3085a0e285430894940527032f8b26df @@ -0,0 +1 @@ +link \ No newline at end of file diff --git a/icons/bridge/cursors/3ecb610c1bf2410f44200f48c40d3599 b/icons/bridge/cursors/3ecb610c1bf2410f44200f48c40d3599 new file mode 120000 index 0000000..a305d5c --- /dev/null +++ b/icons/bridge/cursors/3ecb610c1bf2410f44200f48c40d3599 @@ -0,0 +1 @@ +progress \ No newline at end of file diff --git a/icons/bridge/cursors/4498f0e0c1937ffe01fd06f973665830 b/icons/bridge/cursors/4498f0e0c1937ffe01fd06f973665830 new file mode 120000 index 0000000..3e94178 --- /dev/null +++ b/icons/bridge/cursors/4498f0e0c1937ffe01fd06f973665830 @@ -0,0 +1 @@ +closedhand \ No newline at end of file diff --git a/icons/bridge/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408 b/icons/bridge/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408 new file mode 120000 index 0000000..4cea3ac --- /dev/null +++ b/icons/bridge/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408 @@ -0,0 +1 @@ +help \ No newline at end of file diff --git a/icons/bridge/cursors/6407b0e94181790501fd1e167b474872 b/icons/bridge/cursors/6407b0e94181790501fd1e167b474872 new file mode 120000 index 0000000..88740b2 --- /dev/null +++ b/icons/bridge/cursors/6407b0e94181790501fd1e167b474872 @@ -0,0 +1 @@ +copy \ No newline at end of file diff --git a/icons/bridge/cursors/640fb0e74195791501fd1ed57b41487f b/icons/bridge/cursors/640fb0e74195791501fd1ed57b41487f new file mode 120000 index 0000000..c150ede --- /dev/null +++ b/icons/bridge/cursors/640fb0e74195791501fd1ed57b41487f @@ -0,0 +1 @@ +link \ No newline at end of file diff --git a/icons/bridge/cursors/9081237383d90e509aa00f00170e968f b/icons/bridge/cursors/9081237383d90e509aa00f00170e968f new file mode 120000 index 0000000..3e94178 --- /dev/null +++ b/icons/bridge/cursors/9081237383d90e509aa00f00170e968f @@ -0,0 +1 @@ +closedhand \ No newline at end of file diff --git a/icons/bridge/cursors/9d800788f1b08800ae810202380a0822 b/icons/bridge/cursors/9d800788f1b08800ae810202380a0822 new file mode 120000 index 0000000..5ba3f42 --- /dev/null +++ b/icons/bridge/cursors/9d800788f1b08800ae810202380a0822 @@ -0,0 +1 @@ +pointer \ No newline at end of file diff --git a/icons/bridge/cursors/a2a266d0498c3104214a47bd64ab0fc8 b/icons/bridge/cursors/a2a266d0498c3104214a47bd64ab0fc8 new file mode 120000 index 0000000..c150ede --- /dev/null +++ b/icons/bridge/cursors/a2a266d0498c3104214a47bd64ab0fc8 @@ -0,0 +1 @@ +link \ No newline at end of file diff --git a/icons/bridge/cursors/alias b/icons/bridge/cursors/alias new file mode 100755 index 0000000..33be5b2 Binary files /dev/null and b/icons/bridge/cursors/alias differ diff --git a/icons/bridge/cursors/all-scroll b/icons/bridge/cursors/all-scroll new file mode 100755 index 0000000..3281108 Binary files /dev/null and b/icons/bridge/cursors/all-scroll differ diff --git a/icons/bridge/cursors/b66166c04f8c3109214a4fbd64a50fc8 b/icons/bridge/cursors/b66166c04f8c3109214a4fbd64a50fc8 new file mode 120000 index 0000000..88740b2 --- /dev/null +++ b/icons/bridge/cursors/b66166c04f8c3109214a4fbd64a50fc8 @@ -0,0 +1 @@ +copy \ No newline at end of file diff --git a/icons/bridge/cursors/bottom_left_corner b/icons/bridge/cursors/bottom_left_corner new file mode 120000 index 0000000..e0935e6 --- /dev/null +++ b/icons/bridge/cursors/bottom_left_corner @@ -0,0 +1 @@ +size_bdiag \ No newline at end of file diff --git a/icons/bridge/cursors/bottom_right_corner b/icons/bridge/cursors/bottom_right_corner new file mode 120000 index 0000000..913bbc3 --- /dev/null +++ b/icons/bridge/cursors/bottom_right_corner @@ -0,0 +1 @@ +size_fdiag \ No newline at end of file diff --git a/icons/bridge/cursors/bottom_side b/icons/bridge/cursors/bottom_side new file mode 100755 index 0000000..b806455 Binary files /dev/null and b/icons/bridge/cursors/bottom_side differ diff --git a/icons/bridge/cursors/cell b/icons/bridge/cursors/cell new file mode 100755 index 0000000..170fc27 Binary files /dev/null and b/icons/bridge/cursors/cell differ diff --git a/icons/bridge/cursors/center-ptr b/icons/bridge/cursors/center-ptr new file mode 100755 index 0000000..1404858 Binary files /dev/null and b/icons/bridge/cursors/center-ptr differ diff --git a/icons/bridge/cursors/circle b/icons/bridge/cursors/circle new file mode 120000 index 0000000..23bfed6 --- /dev/null +++ b/icons/bridge/cursors/circle @@ -0,0 +1 @@ +not-allowed \ No newline at end of file diff --git a/icons/bridge/cursors/closedhand b/icons/bridge/cursors/closedhand new file mode 100755 index 0000000..c770397 Binary files /dev/null and b/icons/bridge/cursors/closedhand differ diff --git a/icons/bridge/cursors/col-resize b/icons/bridge/cursors/col-resize new file mode 100755 index 0000000..e0cc54a Binary files /dev/null and b/icons/bridge/cursors/col-resize differ diff --git a/icons/bridge/cursors/color-picker b/icons/bridge/cursors/color-picker new file mode 100755 index 0000000..b8a31af Binary files /dev/null and b/icons/bridge/cursors/color-picker differ diff --git a/icons/bridge/cursors/context-menu b/icons/bridge/cursors/context-menu new file mode 100755 index 0000000..26a0b2e Binary files /dev/null and b/icons/bridge/cursors/context-menu differ diff --git a/icons/bridge/cursors/copy b/icons/bridge/cursors/copy new file mode 100755 index 0000000..69fdafe Binary files /dev/null and b/icons/bridge/cursors/copy differ diff --git a/icons/bridge/cursors/cross b/icons/bridge/cursors/cross new file mode 120000 index 0000000..67580a7 --- /dev/null +++ b/icons/bridge/cursors/cross @@ -0,0 +1 @@ +crosshair \ No newline at end of file diff --git a/icons/bridge/cursors/crossed_circle b/icons/bridge/cursors/crossed_circle new file mode 120000 index 0000000..23bfed6 --- /dev/null +++ b/icons/bridge/cursors/crossed_circle @@ -0,0 +1 @@ +not-allowed \ No newline at end of file diff --git a/icons/bridge/cursors/crosshair b/icons/bridge/cursors/crosshair new file mode 100755 index 0000000..6c0cd51 Binary files /dev/null and b/icons/bridge/cursors/crosshair differ diff --git a/icons/bridge/cursors/d9ce0ab605698f320427677b458ad60b b/icons/bridge/cursors/d9ce0ab605698f320427677b458ad60b new file mode 120000 index 0000000..4cea3ac --- /dev/null +++ b/icons/bridge/cursors/d9ce0ab605698f320427677b458ad60b @@ -0,0 +1 @@ +help \ No newline at end of file diff --git a/icons/bridge/cursors/default b/icons/bridge/cursors/default new file mode 100755 index 0000000..0160b85 Binary files /dev/null and b/icons/bridge/cursors/default differ diff --git a/icons/bridge/cursors/dnd-copy b/icons/bridge/cursors/dnd-copy new file mode 100755 index 0000000..69fdafe Binary files /dev/null and b/icons/bridge/cursors/dnd-copy differ diff --git a/icons/bridge/cursors/dnd-link b/icons/bridge/cursors/dnd-link new file mode 120000 index 0000000..c4ad821 --- /dev/null +++ b/icons/bridge/cursors/dnd-link @@ -0,0 +1 @@ +alias \ No newline at end of file diff --git a/icons/bridge/cursors/dnd-move b/icons/bridge/cursors/dnd-move new file mode 100755 index 0000000..a0ade7c Binary files /dev/null and b/icons/bridge/cursors/dnd-move differ diff --git a/icons/bridge/cursors/dnd-no-drop b/icons/bridge/cursors/dnd-no-drop new file mode 100755 index 0000000..2bfb3f8 Binary files /dev/null and b/icons/bridge/cursors/dnd-no-drop differ diff --git a/icons/bridge/cursors/dnd-none b/icons/bridge/cursors/dnd-none new file mode 100755 index 0000000..c770397 Binary files /dev/null and b/icons/bridge/cursors/dnd-none differ diff --git a/icons/bridge/cursors/down-arrow b/icons/bridge/cursors/down-arrow new file mode 100755 index 0000000..fe00343 Binary files /dev/null and b/icons/bridge/cursors/down-arrow differ diff --git a/icons/bridge/cursors/draft b/icons/bridge/cursors/draft new file mode 100755 index 0000000..fe7b363 Binary files /dev/null and b/icons/bridge/cursors/draft differ diff --git a/icons/bridge/cursors/e-resize b/icons/bridge/cursors/e-resize new file mode 120000 index 0000000..e0da659 --- /dev/null +++ b/icons/bridge/cursors/e-resize @@ -0,0 +1 @@ +size_hor \ No newline at end of file diff --git a/icons/bridge/cursors/e29285e634086352946a0e7090d73106 b/icons/bridge/cursors/e29285e634086352946a0e7090d73106 new file mode 120000 index 0000000..5ba3f42 --- /dev/null +++ b/icons/bridge/cursors/e29285e634086352946a0e7090d73106 @@ -0,0 +1 @@ +pointer \ No newline at end of file diff --git a/icons/bridge/cursors/fcf21c00b30f7e3f83fe0dfd12e71cff b/icons/bridge/cursors/fcf21c00b30f7e3f83fe0dfd12e71cff new file mode 120000 index 0000000..3e94178 --- /dev/null +++ b/icons/bridge/cursors/fcf21c00b30f7e3f83fe0dfd12e71cff @@ -0,0 +1 @@ +closedhand \ No newline at end of file diff --git a/icons/bridge/cursors/fleur b/icons/bridge/cursors/fleur new file mode 100755 index 0000000..3281108 Binary files /dev/null and b/icons/bridge/cursors/fleur differ diff --git a/icons/bridge/cursors/forbidden b/icons/bridge/cursors/forbidden new file mode 120000 index 0000000..226af18 --- /dev/null +++ b/icons/bridge/cursors/forbidden @@ -0,0 +1 @@ +no-drop \ No newline at end of file diff --git a/icons/bridge/cursors/h_double_arrow b/icons/bridge/cursors/h_double_arrow new file mode 120000 index 0000000..e0da659 --- /dev/null +++ b/icons/bridge/cursors/h_double_arrow @@ -0,0 +1 @@ +size_hor \ No newline at end of file diff --git a/icons/bridge/cursors/half-busy b/icons/bridge/cursors/half-busy new file mode 120000 index 0000000..a305d5c --- /dev/null +++ b/icons/bridge/cursors/half-busy @@ -0,0 +1 @@ +progress \ No newline at end of file diff --git a/icons/bridge/cursors/hand1 b/icons/bridge/cursors/hand1 new file mode 120000 index 0000000..5ba3f42 --- /dev/null +++ b/icons/bridge/cursors/hand1 @@ -0,0 +1 @@ +pointer \ No newline at end of file diff --git a/icons/bridge/cursors/hand2 b/icons/bridge/cursors/hand2 new file mode 120000 index 0000000..5ba3f42 --- /dev/null +++ b/icons/bridge/cursors/hand2 @@ -0,0 +1 @@ +pointer \ No newline at end of file diff --git a/icons/bridge/cursors/help b/icons/bridge/cursors/help new file mode 100755 index 0000000..fb899a2 Binary files /dev/null and b/icons/bridge/cursors/help differ diff --git a/icons/bridge/cursors/ibeam b/icons/bridge/cursors/ibeam new file mode 120000 index 0000000..f3a3485 --- /dev/null +++ b/icons/bridge/cursors/ibeam @@ -0,0 +1 @@ +text \ No newline at end of file diff --git a/icons/bridge/cursors/left_ptr b/icons/bridge/cursors/left_ptr new file mode 120000 index 0000000..331d858 --- /dev/null +++ b/icons/bridge/cursors/left_ptr @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/icons/bridge/cursors/left_ptr_help b/icons/bridge/cursors/left_ptr_help new file mode 120000 index 0000000..4cea3ac --- /dev/null +++ b/icons/bridge/cursors/left_ptr_help @@ -0,0 +1 @@ +help \ No newline at end of file diff --git a/icons/bridge/cursors/left_ptr_watch b/icons/bridge/cursors/left_ptr_watch new file mode 120000 index 0000000..a305d5c --- /dev/null +++ b/icons/bridge/cursors/left_ptr_watch @@ -0,0 +1 @@ +progress \ No newline at end of file diff --git a/icons/bridge/cursors/left_side b/icons/bridge/cursors/left_side new file mode 100644 index 0000000..36da673 Binary files /dev/null and b/icons/bridge/cursors/left_side differ diff --git a/icons/bridge/cursors/link b/icons/bridge/cursors/link new file mode 120000 index 0000000..c4ad821 --- /dev/null +++ b/icons/bridge/cursors/link @@ -0,0 +1 @@ +alias \ No newline at end of file diff --git a/icons/bridge/cursors/move b/icons/bridge/cursors/move new file mode 100755 index 0000000..c770397 Binary files /dev/null and b/icons/bridge/cursors/move differ diff --git a/icons/bridge/cursors/n-resize b/icons/bridge/cursors/n-resize new file mode 120000 index 0000000..fb54fee --- /dev/null +++ b/icons/bridge/cursors/n-resize @@ -0,0 +1 @@ +size_ver \ No newline at end of file diff --git a/icons/bridge/cursors/no-drop b/icons/bridge/cursors/no-drop new file mode 100755 index 0000000..8e3e472 Binary files /dev/null and b/icons/bridge/cursors/no-drop differ diff --git a/icons/bridge/cursors/not-allowed b/icons/bridge/cursors/not-allowed new file mode 100755 index 0000000..2e07f24 Binary files /dev/null and b/icons/bridge/cursors/not-allowed differ diff --git a/icons/bridge/cursors/openhand b/icons/bridge/cursors/openhand new file mode 100755 index 0000000..3600deb Binary files /dev/null and b/icons/bridge/cursors/openhand differ diff --git a/icons/bridge/cursors/pencil b/icons/bridge/cursors/pencil new file mode 100755 index 0000000..1383d73 Binary files /dev/null and b/icons/bridge/cursors/pencil differ diff --git a/icons/bridge/cursors/pirate b/icons/bridge/cursors/pirate new file mode 100755 index 0000000..16b4338 Binary files /dev/null and b/icons/bridge/cursors/pirate differ diff --git a/icons/bridge/cursors/plus b/icons/bridge/cursors/plus new file mode 120000 index 0000000..d1b147b --- /dev/null +++ b/icons/bridge/cursors/plus @@ -0,0 +1 @@ +cell \ No newline at end of file diff --git a/icons/bridge/cursors/pointer b/icons/bridge/cursors/pointer new file mode 100755 index 0000000..141b171 Binary files /dev/null and b/icons/bridge/cursors/pointer differ diff --git a/icons/bridge/cursors/pointing_hand b/icons/bridge/cursors/pointing_hand new file mode 120000 index 0000000..5ba3f42 --- /dev/null +++ b/icons/bridge/cursors/pointing_hand @@ -0,0 +1 @@ +pointer \ No newline at end of file diff --git a/icons/bridge/cursors/progress b/icons/bridge/cursors/progress new file mode 100755 index 0000000..38e5e0c Binary files /dev/null and b/icons/bridge/cursors/progress differ diff --git a/icons/bridge/cursors/question_arrow b/icons/bridge/cursors/question_arrow new file mode 120000 index 0000000..4cea3ac --- /dev/null +++ b/icons/bridge/cursors/question_arrow @@ -0,0 +1 @@ +help \ No newline at end of file diff --git a/icons/bridge/cursors/right-arrow b/icons/bridge/cursors/right-arrow new file mode 100755 index 0000000..f61d1c4 Binary files /dev/null and b/icons/bridge/cursors/right-arrow differ diff --git a/icons/bridge/cursors/right_ptr b/icons/bridge/cursors/right_ptr new file mode 100755 index 0000000..2f69ea0 Binary files /dev/null and b/icons/bridge/cursors/right_ptr differ diff --git a/icons/bridge/cursors/right_side b/icons/bridge/cursors/right_side new file mode 100755 index 0000000..6441929 Binary files /dev/null and b/icons/bridge/cursors/right_side differ diff --git a/icons/bridge/cursors/row-resize b/icons/bridge/cursors/row-resize new file mode 100755 index 0000000..cf4e2d6 Binary files /dev/null and b/icons/bridge/cursors/row-resize differ diff --git a/icons/bridge/cursors/s-resize b/icons/bridge/cursors/s-resize new file mode 120000 index 0000000..fb54fee --- /dev/null +++ b/icons/bridge/cursors/s-resize @@ -0,0 +1 @@ +size_ver \ No newline at end of file diff --git a/icons/bridge/cursors/sb_h_double_arrow b/icons/bridge/cursors/sb_h_double_arrow new file mode 120000 index 0000000..e0da659 --- /dev/null +++ b/icons/bridge/cursors/sb_h_double_arrow @@ -0,0 +1 @@ +size_hor \ No newline at end of file diff --git a/icons/bridge/cursors/sb_v_double_arrow b/icons/bridge/cursors/sb_v_double_arrow new file mode 120000 index 0000000..fb54fee --- /dev/null +++ b/icons/bridge/cursors/sb_v_double_arrow @@ -0,0 +1 @@ +size_ver \ No newline at end of file diff --git a/icons/bridge/cursors/size_all b/icons/bridge/cursors/size_all new file mode 120000 index 0000000..147f744 --- /dev/null +++ b/icons/bridge/cursors/size_all @@ -0,0 +1 @@ +fleur \ No newline at end of file diff --git a/icons/bridge/cursors/size_bdiag b/icons/bridge/cursors/size_bdiag new file mode 100755 index 0000000..1d94456 Binary files /dev/null and b/icons/bridge/cursors/size_bdiag differ diff --git a/icons/bridge/cursors/size_fdiag b/icons/bridge/cursors/size_fdiag new file mode 100755 index 0000000..31b2383 Binary files /dev/null and b/icons/bridge/cursors/size_fdiag differ diff --git a/icons/bridge/cursors/size_hor b/icons/bridge/cursors/size_hor new file mode 100755 index 0000000..20d23de Binary files /dev/null and b/icons/bridge/cursors/size_hor differ diff --git a/icons/bridge/cursors/size_ver b/icons/bridge/cursors/size_ver new file mode 100755 index 0000000..47172c2 Binary files /dev/null and b/icons/bridge/cursors/size_ver differ diff --git a/icons/bridge/cursors/split_h b/icons/bridge/cursors/split_h new file mode 120000 index 0000000..93d9c89 --- /dev/null +++ b/icons/bridge/cursors/split_h @@ -0,0 +1 @@ +row-resize \ No newline at end of file diff --git a/icons/bridge/cursors/split_v b/icons/bridge/cursors/split_v new file mode 120000 index 0000000..3ce0e22 --- /dev/null +++ b/icons/bridge/cursors/split_v @@ -0,0 +1 @@ +col-resize \ No newline at end of file diff --git a/icons/bridge/cursors/text b/icons/bridge/cursors/text new file mode 100755 index 0000000..5bf93cb Binary files /dev/null and b/icons/bridge/cursors/text differ diff --git a/icons/bridge/cursors/top_left_corner b/icons/bridge/cursors/top_left_corner new file mode 120000 index 0000000..913bbc3 --- /dev/null +++ b/icons/bridge/cursors/top_left_corner @@ -0,0 +1 @@ +size_fdiag \ No newline at end of file diff --git a/icons/bridge/cursors/top_right_corner b/icons/bridge/cursors/top_right_corner new file mode 120000 index 0000000..e0935e6 --- /dev/null +++ b/icons/bridge/cursors/top_right_corner @@ -0,0 +1 @@ +size_bdiag \ No newline at end of file diff --git a/icons/bridge/cursors/top_side b/icons/bridge/cursors/top_side new file mode 100755 index 0000000..09db4fa Binary files /dev/null and b/icons/bridge/cursors/top_side differ diff --git a/icons/bridge/cursors/up-arrow b/icons/bridge/cursors/up-arrow new file mode 100755 index 0000000..dce3b28 Binary files /dev/null and b/icons/bridge/cursors/up-arrow differ diff --git a/icons/bridge/cursors/v_double_arrow b/icons/bridge/cursors/v_double_arrow new file mode 120000 index 0000000..fb54fee --- /dev/null +++ b/icons/bridge/cursors/v_double_arrow @@ -0,0 +1 @@ +size_ver \ No newline at end of file diff --git a/icons/bridge/cursors/vertical-text b/icons/bridge/cursors/vertical-text new file mode 100755 index 0000000..46d618d Binary files /dev/null and b/icons/bridge/cursors/vertical-text differ diff --git a/icons/bridge/cursors/w-resize b/icons/bridge/cursors/w-resize new file mode 120000 index 0000000..e0da659 --- /dev/null +++ b/icons/bridge/cursors/w-resize @@ -0,0 +1 @@ +size_hor \ No newline at end of file diff --git a/icons/bridge/cursors/wait b/icons/bridge/cursors/wait new file mode 100755 index 0000000..aaeab1c Binary files /dev/null and b/icons/bridge/cursors/wait differ diff --git a/icons/bridge/cursors/watch b/icons/bridge/cursors/watch new file mode 120000 index 0000000..fd80437 --- /dev/null +++ b/icons/bridge/cursors/watch @@ -0,0 +1 @@ +wait \ No newline at end of file diff --git a/icons/bridge/cursors/wayland-cursor b/icons/bridge/cursors/wayland-cursor new file mode 100755 index 0000000..3bd3b52 Binary files /dev/null and b/icons/bridge/cursors/wayland-cursor differ diff --git a/icons/bridge/cursors/whats_this b/icons/bridge/cursors/whats_this new file mode 120000 index 0000000..4cea3ac --- /dev/null +++ b/icons/bridge/cursors/whats_this @@ -0,0 +1 @@ +help \ No newline at end of file diff --git a/icons/bridge/cursors/x-cursor b/icons/bridge/cursors/x-cursor new file mode 100755 index 0000000..497f8a2 Binary files /dev/null and b/icons/bridge/cursors/x-cursor differ diff --git a/icons/bridge/cursors/xterm b/icons/bridge/cursors/xterm new file mode 120000 index 0000000..f3a3485 --- /dev/null +++ b/icons/bridge/cursors/xterm @@ -0,0 +1 @@ +text \ No newline at end of file diff --git a/icons/bridge/cursors/zoom-in b/icons/bridge/cursors/zoom-in new file mode 100755 index 0000000..3af334f Binary files /dev/null and b/icons/bridge/cursors/zoom-in differ diff --git a/icons/bridge/cursors/zoom-out b/icons/bridge/cursors/zoom-out new file mode 100755 index 0000000..b6946fc Binary files /dev/null and b/icons/bridge/cursors/zoom-out differ diff --git a/icons/bridge/index.theme b/icons/bridge/index.theme new file mode 100644 index 0000000..22956e4 --- /dev/null +++ b/icons/bridge/index.theme @@ -0,0 +1,3 @@ +[Icon Theme] +Name = Bridge +Comment = Spanning the gap between history and future diff --git a/inputrc b/inputrc deleted file mode 100644 index 7cedff9..0000000 --- a/inputrc +++ /dev/null @@ -1,15 +0,0 @@ -set bell-style none -set mark-directories on -set mark-symlinked-directories on -set match-hidden-files off -set completion-ignore-case on -set show-all-if-ambiguous on -set page-completions off -set visible-stats on -set input-meta on -set output-meta on -set convert-meta off -"\C-b":backward-word -"\C-f":forward-word -"\C-p":history-search-backward -"\M-'":possible-completions diff --git a/install b/install new file mode 100755 index 0000000..b1baa33 --- /dev/null +++ b/install @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e + +CONFIG="install.conf.yaml" +DOTBOT_DIR="dotbot" + +DOTBOT_BIN="bin/dotbot" +BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +cd "${BASEDIR}" +git submodule update --init --recursive "${DOTBOT_DIR}" + +"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}" diff --git a/install.conf.yaml b/install.conf.yaml new file mode 100644 index 0000000..69c704b --- /dev/null +++ b/install.conf.yaml @@ -0,0 +1,109 @@ +- clean: ['~'] + +- shell: + - [mkdir -p ~/.icons, Creating icons config directory] + - [mkdir -p ~/.vmail, Creating vmail config directory] + - [mkdir -p ~/.weechat, Creating weechat config directory] + +- link: + ~/.bash_aliases: + path: bash/bash_aliases + relink: true + force: true + ~/.bash_compilers: + path: bash/bash_compilers + relink: true + force: true + ~/.bash_exports: + path: bash/bash_exports + relink: true + force: true + ~/.bash_functions: + path: bash/bash_functions + relink: true + force: true + ~/.bash_optprogs: + path: bash/bash_optprogs + relink: true + force: true + ~/.bash_paths: + path: bash/bash_paths + relink: true + force: true + ~/.bash_prompt: + path: bash/bash_prompt + relink: true + force: true + ~/.bashrc: + path: bash/bashrc + relink: true + force: true + ~/.bash_welcome: + path: bash/bash_welcome + relink: true + force: true + + ~/.pypirc: + path: encrypt/pypirc + relink: true + force: true + + ~/.gitconfig: + path: git/gitconfig + relink: true + force: true + + ~/.i3: + path: i3 + relink: true + force: true + + ~/.icons/bridge: + path: icons/bridge + relink: true + force: true + + ~/.latexmkrc: + path: miscellanea/latexmkrc + relink: true + force: true + + ~/.Xresources: + path: miscellanea/Xresources + relink: true + force: true + + ~/.yaourtrc: + path: miscellanea/yaourtrc + relink: true + force: true + + ~/.dircolors.256dark: + path: terminal/dircolors.256dark + relink: true + force: true + + ~/.inputrc: + path: terminal/inputrc + relink: true + force: true + + ~/.vim: + path: vim/ + relink: true + force: true + + ~/.vimrc: + path: vim/vimrc + relink: true + force: true + + ~/.vmailrc: + path: encrypt/vmailrc + relink: true + force: true + + ~/.weechat/weechat.conf: + path: weechat/weechat.conf + relink: true + force: true diff --git a/miscellanea/Xresources b/miscellanea/Xresources new file mode 100644 index 0000000..c6f0ed4 --- /dev/null +++ b/miscellanea/Xresources @@ -0,0 +1 @@ +Xcursor.theme: bridge diff --git a/latexmkrc b/miscellanea/latexmkrc similarity index 100% rename from latexmkrc rename to miscellanea/latexmkrc diff --git a/yaourtrc b/miscellanea/yaourtrc similarity index 100% rename from yaourtrc rename to miscellanea/yaourtrc diff --git a/screenshots/bash-git-branches.png b/screenshots/bash-git-branches.png new file mode 100644 index 0000000..5e7c498 Binary files /dev/null and b/screenshots/bash-git-branches.png differ diff --git a/screenshots/bash-git-status.png b/screenshots/bash-git-status.png new file mode 100644 index 0000000..ad7c074 Binary files /dev/null and b/screenshots/bash-git-status.png differ diff --git a/screenshots/bash-prompt.png b/screenshots/bash-prompt.png new file mode 100644 index 0000000..d42c22d Binary files /dev/null and b/screenshots/bash-prompt.png differ diff --git a/screenshots/preview.png b/screenshots/preview.png new file mode 100644 index 0000000..0c0e4d3 Binary files /dev/null and b/screenshots/preview.png differ diff --git a/screenshots/screenshot-2015-06-12-11-17-24_1920x1200.png b/screenshots/screenshot-2015-06-12-11-17-24_1920x1200.png new file mode 100644 index 0000000..53c7bc7 Binary files /dev/null and b/screenshots/screenshot-2015-06-12-11-17-24_1920x1200.png differ diff --git a/dircolors.256dark b/terminal/dircolors.256dark similarity index 100% rename from dircolors.256dark rename to terminal/dircolors.256dark diff --git a/terminal/inputrc b/terminal/inputrc new file mode 100644 index 0000000..b8b6f79 --- /dev/null +++ b/terminal/inputrc @@ -0,0 +1,31 @@ +# Make Tab autocomplete regardless of filename case +set completion-ignore-case on +# List all matches in case multiple possible completions are possible +set show-all-if-ambiguous on +# Immediately add a trailing slash when autocompleting symlinks to directories +set mark-symlinked-directories on +# Avoid match hidden files +set match-hidden-files off +# Mark directories +set mark-directories on +# Bell off +set bell-style none +# Show all autocomplete results at once +set page-completions off +# If there are more than 200 possible completions for a word, ask to show them all +set completion-query-items 200 +# Show extra file information when completing, like `ls -F` does +set visible-stats on +# Be more intelligent when autocompleting by also looking at the text after +set skip-completed-text on +# Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' +set input-meta on +set output-meta on +set convert-meta off +# Flip through autocompletion matches with Shift-Tab. +"\e[Z": menu-complete +# Filtered history search +"\C-p":history-search-backward +# Flip through words +"\C-b":backward-word +"\C-f":forward-word diff --git a/vim/autoload/plug.vim b/vim/autoload/plug.vim index 3005dc2..87a8036 100644 --- a/vim/autoload/plug.vim +++ b/vim/autoload/plug.vim @@ -440,7 +440,7 @@ function! s:add(repo, ...) call add(g:plugs_order, name) endif let g:plugs[name] = spec - let s:loaded[name] = 0 + let s:loaded[name] = get(s:loaded, name, 0) catch return s:err(v:exception) endtry diff --git a/vim/autoload/plug.vim.old b/vim/autoload/plug.vim.old index a2e057f..3005dc2 100644 --- a/vim/autoload/plug.vim.old +++ b/vim/autoload/plug.vim.old @@ -14,6 +14,9 @@ " Plug 'junegunn/seoul256.vim' " Plug 'junegunn/vim-easy-align' " +" " Group dependencies, vim-snippets depends on ultisnips +" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" " " On-demand loading " Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " Plug 'tpope/vim-fireplace', { 'for': 'clojure' } @@ -22,7 +25,7 @@ " Plug 'https://github.com/junegunn/vim-github-dashboard.git' " " " Plugin options -" Plug 'nsf/gocode', { 'tag': 'go.weekly.2012-03-13', 'rtp': 'vim' } +" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } " " " Plugin outside ~/.vim/plugged with post-update hook " Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } @@ -72,8 +75,6 @@ let s:plug_tab = get(s:, 'plug_tab', -1) let s:plug_buf = get(s:, 'plug_buf', -1) let s:mac_gui = has('gui_macvim') && has('gui_running') let s:is_win = has('win32') || has('win64') -let s:py2 = has('python') && !has('nvim') && !s:is_win && !has('win32unix') -let s:ruby = has('ruby') && !has('nvim') && (v:version >= 703 || v:version == 702 && has('patch374')) let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win let s:me = resolve(expand(':p')) let s:base_spec = { 'branch': 'master', 'frozen': 0 } @@ -358,7 +359,9 @@ function! plug#load(...) for name in a:000 call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) endfor - doautocmd BufRead + if exists('#BufRead') + doautocmd BufRead + endif return 1 endfunction @@ -388,14 +391,21 @@ function! s:lod(names, types) for dir in a:types call s:source(rtp, dir.'/**/*.vim') endfor + if exists('#User#'.name) + execute 'doautocmd User' name + endif endfor endfunction function! s:lod_ft(pat, names) call s:lod(a:names, ['plugin', 'after/plugin']) execute 'autocmd! PlugLOD FileType' a:pat - doautocmd filetypeplugin FileType - doautocmd filetypeindent FileType + if exists('#filetypeplugin#FileType') + doautocmd filetypeplugin FileType + endif + if exists('#filetypeindent#FileType') + doautocmd filetypeindent FileType + endif endfunction function! s:lod_cmd(cmd, bang, l1, l2, args, names) @@ -746,6 +756,10 @@ function! s:update_impl(pull, force, args) abort echohl None endif + let python = (has('python') || has('python3')) && !s:is_win && !has('win32unix') + \ && (!s:nvim || has('vim_starting')) + let ruby = has('ruby') && !s:nvim && (v:version >= 703 || v:version == 702 && has('patch374')) + let s:update = { \ 'start': reltime(), \ 'all': todo, @@ -754,7 +768,7 @@ function! s:update_impl(pull, force, args) abort \ 'pull': a:pull, \ 'force': a:force, \ 'new': {}, - \ 'threads': (s:py2 || s:ruby || s:nvim) ? min([len(todo), threads]) : 1, + \ 'threads': (python || ruby || s:nvim) ? min([len(todo), threads]) : 1, \ 'bar': '', \ 'fin': 0 \ } @@ -762,22 +776,27 @@ function! s:update_impl(pull, force, args) abort call s:prepare() call append(0, ['', '']) normal! 2G + silent! redraw + + let s:clone_opt = get(g:, 'plug_shallow', 1) ? + \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' " Python version requirement (>= 2.7) - if s:py2 && !s:ruby && !s:nvim && s:update.threads > 1 + if python && !has('python3') && !ruby && !s:nvim && s:update.threads > 1 redir => pyv silent python import platform; print(platform.python_version()) redir END - let s:py2 = s:version_requirement( + let python = s:version_requirement( \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) endif - if (s:py2 || s:ruby) && !s:nvim && s:update.threads > 1 + + if (python || ruby) && s:update.threads > 1 try let imd = &imd if s:mac_gui set noimd endif - if s:ruby + if ruby call s:update_ruby() else call s:update_python() @@ -961,16 +980,18 @@ while 1 " Without TCO, Vim stack is bound to explode call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') redraw - let checkout = s:shellesc(has_key(spec, 'tag') ? spec.tag : spec.branch) - let merge = s:shellesc(has_key(spec, 'tag') ? spec.tag : 'origin/'.spec.branch) + let has_tag = has_key(spec, 'tag') + let checkout = s:shellesc(has_tag ? spec.tag : spec.branch) + let merge = s:shellesc(has_tag ? spec.tag : 'origin/'.spec.branch) if !new let [valid, msg] = s:git_valid(spec, 0) if valid if pull + let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' call s:spawn(name, - \ printf('(git fetch %s 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only %s 2>&1 && git submodule update --init --recursive 2>&1)', - \ prog, checkout, merge), { 'dir': spec.dir }) + \ printf('(git fetch %s %s 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only %s 2>&1 && git submodule update --init --recursive 2>&1)', + \ fetch_opt, prog, checkout, merge), { 'dir': spec.dir }) else let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } endif @@ -979,7 +1000,8 @@ while 1 " Without TCO, Vim stack is bound to explode endif else call s:spawn(name, - \ printf('git clone %s --recursive %s -b %s %s 2>&1', + \ printf('git clone %s %s --recursive %s -b %s %s 2>&1', + \ has_tag ? '' : s:clone_opt, \ prog, \ s:shellesc(spec.uri), \ checkout, @@ -996,12 +1018,16 @@ endwhile endfunction function! s:update_python() -python << EOF +let py_exe = has('python3') ? 'python3' : 'python' +execute py_exe "<< EOF" """ Due to use of signals this function is POSIX only. """ import datetime import functools import os -import Queue +try: + import queue +except ImportError: + import Queue as queue import random import re import shutil @@ -1013,18 +1039,27 @@ import time import traceback import vim +G_NVIM = vim.eval("has('nvim')") == '1' G_PULL = vim.eval('s:update.pull') == '1' G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) +G_CLONE_OPT = vim.eval('s:clone_opt') G_PROGRESS = vim.eval('s:progress_opt(1)') G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) G_STOP = thr.Event() - -class CmdTimedOut(Exception): +G_THREADS = {} + +class BaseExc(Exception): + def __init__(self, msg): + self._msg = msg + @property + def msg(self): + return self._msg +class CmdTimedOut(BaseExc): pass -class CmdFailed(Exception): +class CmdFailed(BaseExc): pass -class InvalidURI(Exception): +class InvalidURI(BaseExc): pass class Action(object): INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] @@ -1048,13 +1083,13 @@ class GLog(object): with open(fname, 'ab') as flog: ltime = datetime.datetime.now().strftime("%H:%M:%S.%f") msg = '[{0},{1}] {2}{3}'.format(name, ltime, msg, '\n') - flog.write(msg) + flog.write(msg.encode()) class Buffer(object): - def __init__(self, lock, num_plugs): + def __init__(self, lock, num_plugs, is_pull, is_win): self.bar = '' - self.event = 'Updating' if vim.eval('s:update.pull') == '1' else 'Installing' - self.is_win = vim.eval('s:is_win') == '1' + self.event = 'Updating' if is_pull else 'Installing' + self.is_win = is_win self.lock = lock self.maxy = int(vim.eval('winheight(".")')) self.num_plugs = num_plugs @@ -1080,15 +1115,12 @@ class Buffer(object): num_spaces = self.num_plugs - len(self.bar) curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') - vim.command('normal! 2G') - if not self.is_win: - vim.command('redraw') - - def write(self, *args, **kwargs): with self.lock: - self._write(*args, **kwargs) + vim.command('normal! 2G') + if not self.is_win: + vim.command('redraw') - def _write(self, action, name, lines): + def write(self, action, name, lines): first, rest = lines[0], lines[1:] msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] padded_rest = [' ' + line for line in rest] @@ -1159,7 +1191,7 @@ class Command(object): proc = None first_line = True try: - tfile = tempfile.NamedTemporaryFile() + tfile = tempfile.NamedTemporaryFile(mode='w+b', delete=False) proc = subprocess.Popen(self.cmd, cwd=self.cmd_dir, stdout=tfile, stderr=subprocess.STDOUT, shell=True, preexec_fn=os.setsid) while proc.poll() is None: @@ -1180,7 +1212,7 @@ class Command(object): raise CmdTimedOut(['Timeout!']) tfile.seek(0) - result = [line.rstrip() for line in tfile] + result = [line.decode().rstrip() for line in tfile] if proc.returncode != 0: msg = [''] @@ -1192,18 +1224,21 @@ class Command(object): if self.clean: self.clean() raise + finally: + os.remove(tfile.name) return result class Plugin(object): - def __init__(self, name, args, buf, lock): + def __init__(self, name, args, buf_q, lock): self.name = name self.args = args - self.buf = buf + self.buf_q = buf_q self.lock = lock tag = args.get('tag', 0) self.checkout = esc(tag if tag else args['branch']) self.merge = esc(tag if tag else 'origin/' + args['branch']) + self.tag = tag def manage(self): try: @@ -1212,9 +1247,9 @@ class Plugin(object): else: self.install() with self.lock: - vim.command("let s:update.new['{0}'] = 1".format(self.name)) + thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) except (CmdTimedOut, CmdFailed, InvalidURI) as exc: - self.write(Action.ERROR, self.name, exc.message) + self.write(Action.ERROR, self.name, exc.msg) except KeyboardInterrupt: G_STOP.set() self.write(Action.ERROR, self.name, ['Interrupted!']) @@ -1236,9 +1271,9 @@ class Plugin(object): return _clean self.write(Action.INSTALL, self.name, ['Installing ...']) - callback = functools.partial(self.buf.write, Action.INSTALL, self.name) - cmd = 'git clone {0} --recursive {1} -b {2} {3} 2>&1'.format( - G_PROGRESS, self.args['uri'], self.checkout, esc(target)) + callback = functools.partial(self.write, Action.INSTALL, self.name) + cmd = 'git clone {0} {1} --recursive {2} -b {3} {4} 2>&1'.format( + '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], self.checkout, esc(target)) com = Command(cmd, None, G_TIMEOUT, G_RETRIES, callback, clean(target)) result = com.attempt_cmd() self.write(Action.DONE, self.name, result[-1:]) @@ -1256,8 +1291,9 @@ class Plugin(object): if G_PULL: self.write(Action.UPDATE, self.name, ['Updating ...']) - callback = functools.partial(self.buf.write, Action.UPDATE, self.name) - cmds = ['git fetch {0}'.format(G_PROGRESS), + callback = functools.partial(self.write, Action.UPDATE, self.name) + fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' + cmds = ['git fetch {0} {1}'.format(fetch_opt, G_PROGRESS), 'git checkout -q {0}'.format(self.checkout), 'git merge --ff-only {0}'.format(self.merge), 'git submodule update --init --recursive'] @@ -1278,7 +1314,7 @@ class Plugin(object): def write(self, action, name, msg): GLog.write('{0} {1}: {2}'.format(action, name, '\n'.join(msg))) - self.buf.write(action, name, msg) + self.buf_q.put((action, name, msg)) class PlugThread(thr.Thread): def __init__(self, tname, args): @@ -1288,17 +1324,21 @@ class PlugThread(thr.Thread): def run(self): thr.current_thread().name = self.tname - work_q, lock, buf = self.args + buf_q, work_q, lock = self.args try: while not G_STOP.is_set(): name, args = work_q.get_nowait() GLog.write('{0}: Dir {1}'.format(name, args['dir'])) - plug = Plugin(name, args, buf, lock) + plug = Plugin(name, args, buf_q, lock) plug.manage() work_q.task_done() - except Queue.Empty: + except queue.Empty: GLog.write('Queue now empty.') + finally: + global G_THREADS + with lock: + del G_THREADS[thr.current_thread().name] class RefreshThread(thr.Thread): def __init__(self, lock): @@ -1309,19 +1349,26 @@ class RefreshThread(thr.Thread): def run(self): while self.running: with self.lock: - vim.command('noautocmd normal! a') + thread_vim_command('noautocmd normal! a') time.sleep(0.2) def stop(self): self.running = False +if G_NVIM: + def thread_vim_command(cmd): + vim.session.threadsafe_call(lambda: vim.command(cmd)) +else: + def thread_vim_command(cmd): + vim.command(cmd) + def esc(name): return '"' + name.replace('"', '\"') + '"' def nonblock_read(fname): """ Read a file with nonblock flag. Return the last line. """ fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) - buf = os.read(fread, 100000) + buf = os.read(fread, 100000).decode() os.close(fread) line = buf.rstrip('\r\n') @@ -1338,7 +1385,6 @@ def main(): if GLog.ON and os.path.exists(GLog.LOGDIR): shutil.rmtree(GLog.LOGDIR) - threads = [] nthreads = int(vim.eval('s:update.threads')) plugs = vim.eval('s:update.todo') mac_gui = vim.eval('s:mac_gui') == '1' @@ -1348,24 +1394,33 @@ def main(): GLog.write('Num Threads: {0}'.format(nthreads)) lock = thr.Lock() - buf = Buffer(lock, len(plugs)) - work_q = Queue.Queue() + buf = Buffer(lock, len(plugs), G_PULL, is_win) + buf_q, work_q = queue.Queue(), queue.Queue() for work in plugs.items(): work_q.put(work) GLog.write('Starting Threads') + global G_THREADS for num in range(nthreads): tname = 'PlugT-{0:02}'.format(num) - thread = PlugThread(tname, (work_q, lock, buf)) + thread = PlugThread(tname, (buf_q, work_q, lock)) thread.start() - threads.append(thread) + G_THREADS[tname] = thread if mac_gui: rthread = RefreshThread(lock) rthread.start() - GLog.write('Joining Live Threads') - for thread in threads: - thread.join() + GLog.write('Buffer Writing Loop') + while not buf_q.empty() or len(G_THREADS) != 0: + try: + action, name, msg = buf_q.get(True, 0.25) + buf.write(action, name, msg) + buf_q.task_done() + except queue.Empty: + pass + except KeyboardInterrupt: + G_STOP.set() + if mac_gui: rthread.stop() rthread.join() @@ -1533,6 +1588,7 @@ function! s:update_ruby() end } if VIM::evaluate('s:mac_gui') == 1 + clone_opt = VIM::evaluate('s:clone_opt') progress = VIM::evaluate('s:progress_opt(1)') nthr.times do mtx.synchronize do @@ -1562,7 +1618,8 @@ function! s:update_ruby() else if pull log.call name, 'Updating ...', :update - bt.call "#{cd} #{dir} && git fetch #{progress} 2>&1 && git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm}", name, :update, nil + fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' + bt.call "#{cd} #{dir} && git fetch #{fetch_opt} #{progress} 2>&1 && git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm}", name, :update, nil else [true, skip] end @@ -1570,7 +1627,7 @@ function! s:update_ruby() else d = esc dir.sub(%r{[\\/]+$}, '') log.call name, 'Installing ...', :install - bt.call "git clone #{progress} --recursive #{uri} -b #{checkout} #{d} 2>&1", name, :install, proc { + bt.call "git clone #{clone_opt unless tag} #{progress} --recursive #{uri} -b #{checkout} #{d} 2>&1", name, :install, proc { FileUtils.rm_rf dir } end @@ -1620,14 +1677,14 @@ endfunction function! s:system(cmd, ...) try - let sh = &shell + let [sh, shrd] = [&shell, &shellredir] if !s:is_win - set shell=sh + set shell=sh shellredir=>%s\ 2>&1 endif let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd return system(s:is_win ? '('.cmd.')' : cmd) finally - let &shell = sh + let [&shell, &shellredir] = [sh, shrd] endtry endfunction @@ -1880,7 +1937,7 @@ function! s:preview_commit() execute 'pedit' sha wincmd P setlocal filetype=git buftype=nofile nobuflisted - execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show' sha + execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show --pretty=medium' sha normal! gg"_dd wincmd p endfunction diff --git a/ctags b/vim/ctags similarity index 100% rename from ctags rename to vim/ctags diff --git a/vim/plugconf/evervim b/vim/plugconf/evervim deleted file mode 100644 index 3bd5dc7..0000000 --- a/vim/plugconf/evervim +++ /dev/null @@ -1 +0,0 @@ -source ~/.vim/evernotetoken.vim diff --git a/vim/vimrc b/vim/vimrc index 1597b08..72e3101 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -28,6 +28,7 @@ Plug 'pelodelfuego/vim-swoop' Plug 'gcmt/wildfire.vim' " spell check and languages Plug 'scrooloose/syntastic', { 'for': ['python', 'tex', 'latex'] } +Plug 'https://github.com/nvie/vim-flake8', { 'for': 'python' } Plug 'vim-scripts/LanguageTool' Plug 'beloglazov/vim-online-thesaurus', { 'on': ['OnlineThesaurusCurrentWord','Thesaurus'] } Plug 'maksimr/vim-translator', { 'on': 'Translate' } @@ -69,7 +70,6 @@ Plug 'farseer90718/unite-workflow' Plug 'mhinz/vim-startify' Plug 'wakatime/vim-wakatime' Plug 'kopischke/vim-fetch' -Plug 'kakkyz81/evervim' Plug 'KabbAmine/vCoolor.vim' Plug 'sk1418/HowMuch', { 'on': 'HowMuch' } Plug 'chrisbra/vim-diff-enhanced' @@ -220,6 +220,8 @@ endfunction noremap :call ToggleVirtualedit() " Maps Ctrl-J to insert line break (like the opposite of J) nnoremap i +" Set NumberToggle ON/OFF +nnoremap :NumbersToggle " markdown preview " nnoremap G :Start! github-markdown-preview % " nnoremap G :Start! greadme % diff --git a/weechat/weechat.conf b/weechat/weechat.conf index 01edd11..06f98a3 100644 --- a/weechat/weechat.conf +++ b/weechat/weechat.conf @@ -538,7 +538,9 @@ title.type = root [layout] default.buffer = "core;weechat;1" default.buffer = "irc;server.im;1" -default.window = "1;0;0;0;irc;server.im" +default.buffer = "irc;im.&bitlbee;2" +default.buffer = "irc;im.rossigiacomo82;3" +default.window = "1;0;0;0;irc;im.rossigiacomo82" default.current = on [notify]