Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk
b1f3fe131f7ecee1799f8566755dbdc38df184c2
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: 5f1fd02dbfef · Diff against parent 1
- Parent 2: 63d26b0946a7 · Showing diff
bugabingas dorkfiles
b1f3fe131f7ecee1799f8566755dbdc38df184c2
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
+234 / −124 text lines
+1 / −1 text lines
+1 / −0 text lines
+179 / −108 text lines
local download_plugin_into = function ( plugin_tarball_url, plugin_install_path ) assert(vim.fn.executable 'curl', 'curl not found') assert(vim.fn.executable 'tar', 'tar not found') vim.fn.mkdir( plugin_install_path, 'p' ) local tarball_data_stream = vim.uv.new_pipe(true) local error_stream = vim.uv.new_pipe() vim.uv.read_start(error_stream, function(err, data) assert(not err, err) if data then vim.notify(data, vim.log.levels.ERROR) end end) local curl_handle, curl_pid = vim.uv.spawn( 'curl', { args = { '--silent', '--location', plugin_tarball_url }, cwd = plugin_install_path, stdio = {nil, tarball_data_stream, error_stream}, hide = true, }, function(code, signal) vim.print('curl done', code, signal) end ) local tar_handle, tar_pid = vim.uv.spawn( 'tar', { args = { '--extract','--gzip', '--file', '-' }, cwd = plugin_install_path, stdio = { tarball_data_stream, nil, error_stream}, hide = true, }, function(code, signal) vim.print('tar done', code, signal) end ) print(curl_handle, curl_handle, tar_handle, tar_pid) vim.uv.shutdown(tarball_data_stream, function() vim.uv.close(curl_handle, function() vim.print("curl closed") end) vim.uv.close(tar_handle, function() vim.print("tar closed") end) end)local delete_directory_recursive = function(path) local stat = vim.uv.fs_stat(path) if stat and stat.type == "directory" then local dir = vim.uv.fs_scandir(path) if dir then while true do local name, type = vim.uv.fs_scandir_next(dir) if not name then break end local full_path = vim.fs.joinpath(path, name) if type == "directory" then return delete_directory_recursive(full_path) else return vim.uv.fs_unlink(full_path) end endlocal install_plugin = function(puck_root, plugin_type, plugin_coords, plugin_rev) local plugin_name = as_name(plugin_coords) local plugin_install_path = vim.fs.normalize(vim.fs.joinpath(puck_root, plugin_name)) local plugin_install_path_stat = vim.uv.fs_stat(plugin_install_path) local plugin_already_exists = plugin_install_path_stat and plugin_install_path_stat.type == 'directory' local plugin_install_rev_path = vim.fs.normalize(puck_root, plugin_name .. '.rev') -- either do nothing or update/fresh install if(vim.uv.fs_access(plugin_install_rev_path,'R') then local current_rev = io:open(plugin_install_rev_path, 'r'):read() if current_rev == plugin_rev then return end end -- rev is different, must be update (we don`t care if up or down) or fresh install local removed = delete_directory_recursive(plugin_install_path) local plugin_tarball_url = gh_format:format(plugin_coords, plugin_rev) local ok = xpcall(download_plugin_into,plugin_tarball_url, plugin_install_path) if ok then io.open(plugin_install_rev_path, 'w+'):write(plugin_rev) if removed then vim.notify('Plugin ' .. plugin_coords .. '@' .. plugin_rev .. ' updated!', vim.log.levels.INFO) else vim.notify('Plugin ' .. plugin_coords .. '@' .. plugin_rev .. ' installed!', vim.log.levels.INFO) end else vim.notify('Failed to download tarball for plugin ' .. plugin_coords .. '@' .. plugin_rev ..'!', vim.log.levels.ERROR) end error('unknown plugin type '..plugin_type..' given.')local delete_unused_plugins = function(puck_root) endlocal install_plugin = function ( puck_root, plugin_type, plugin_coords, plugin_rev ) local plugin_name = as_name( plugin_coords ) local plugin_install_path = vim.fs.normalize( vim.fs.joinpath( puck_root, plugin_name ) ) --TODO unused? local plugin_install_path_stat = vim.uv.fs_stat( plugin_install_path ) local plugin_already_exists = plugin_install_path_stat and plugin_install_path_stat.type == 'directory'local register_local_plugin = function(plugin_coords) local plugin_path = vim.fs.normalize(plugin_coords) local plugin_path_stat = vim.uv.fs_stat(plugin_path) local plugin_install_rev_path = vim.fs.normalize( vim.fs.joinpath(puck_root, plugin_name .. '.rev' )) if( plugin_path_stat and plugin_path_stat.type == 'directory') then vim.opt.runtimepath:prepend(plugin_path) else vim.notify('Failed to load local plugin ' .. plugin_path .. '!',vim.log.levels.ERROR) end -- either do nothing or update/fresh install if (vim.uv.fs_access( plugin_install_rev_path, 'R' )) then local plugin_install_rev_file = io.open( plugin_install_rev_path, 'r' ) if not plugin_install_rev_file then vim.notify('Unable to read rev file ' .. plugin_install_rev_path, vim.log.levels.ERROR) end local current_rev = plugin_install_rev_file:read() plugin_install_rev_file:close() if current_rev == plugin_rev then return end end -- rev is different, must be update (we don`t care if up or down) or fresh install local removed = delete_directory_recursive( plugin_install_path ) local url_format = as_url_format(plugin_type) local plugin_tarball_url = url_format:format( plugin_coords, plugin_rev ) local ok = pcall( download_plugin_into, plugin_tarball_url, puck_root ) if ok then local mode = vim.uv.fs_access(plugin_install_rev_path, 'W') and 'w+' or 'w' local plugin_install_rev_file = io.open( plugin_install_rev_path, mode) if not plugin_install_rev_file then vim.notify('Unable to write rev file ' .. plugin_install_rev_path, vim.log.levels.ERROR) end plugin_install_rev_file:write( plugin_rev ) plugin_install_rev_file:close() if removed then vim.notify( 'Plugin ' .. plugin_coords .. '@' .. plugin_rev .. ' updated!', vim.log.levels.INFO ) else vim.notify( 'Plugin ' .. plugin_coords .. '@' .. plugin_rev .. ' installed!', vim.log.levels.INFO ) end else vim.notify( 'Failed to download tarball for plugin ' .. plugin_coords .. '@' .. plugin_rev .. '!', vim.log.levels.ERROR ) endlocal load_local_plugin = function(plugin_coords) local plugin_name = as_name(plugin_coords) local plugin_init = {} vim.tbl_extend('keep',plugin_init, vim.api.nvim_get_runtime_file('plugin/' .. plugin_name .. '.vim', false )) vim.tbl_extend('keep',plugin_init, vim.api.nvim_get_runtime_file('plugin/' .. plugin_name .. '.lua', false )) for _, init in pairs(plugin_init) do vim.cmd.source(init) endlocal delete_unused_plugins = function ( puck_root ) endlocal register_local_plugin = function ( workspace, plugin_coords ) local plugin_path = vim.fs.normalize( vim.fs.joinpath(workspace, vim.fs.basename(plugin_coords) ) ) local plugin_path_stat = vim.uv.fs_stat( plugin_path ) if (plugin_path_stat and plugin_path_stat.type == 'directory') then vim.opt.runtimepath:prepend( plugin_path ) else vim.notify( 'Failed to load local plugin ' .. plugin_path .. '!', vim.log.levels.ERROR ) endlocal load_local_plugin = function ( plugin_coords ) local plugin_name = as_name( plugin_coords ) local plugin_init = {} vim.tbl_extend( 'keep', plugin_init, vim.api.nvim_get_runtime_file( 'plugin/' .. plugin_name .. '.vim', false ) ) vim.tbl_extend( 'keep', plugin_init, vim.api.nvim_get_runtime_file( 'plugin/' .. plugin_name .. '.lua', false ) ) for _, init in pairs( plugin_init ) do vim.cmd.source( init ) end delete_unused_plugins(puck_root) -- manually load builtin plugins, that we disabled earlier -- loads only a subset of builtins, that i find useful. load_local_plugin 'plugin/shada.vim' load_local_plugin 'plugin/tutor.vim' load_local_plugin 'plugin/spellfile.vim' load_local_plugin 'plugin/osc52.lua' -- can this be useful on win32? -- load_local_plugin 'plugin/man.lua' load_local_plugin 'plugin/editorconfig.lua' for _, plugin in pairs( plugins ) do local plugin_type = plugin[1] local plugin_coords = plugin[2] local plugin_rev = plugin[3] if plugin_type == dev then register_local_plugin(options.workspace, plugin_coords ) else install_plugin( puck_root, plugin_type, plugin_coords, plugin_rev ) end end delete_unused_plugins( puck_root ) -- manually load builtin plugins, that we disabled earlier -- loads only a subset of builtins, that i find useful. load_local_plugin 'plugin/shada.vim' load_local_plugin 'plugin/tutor.vim' load_local_plugin 'plugin/spellfile.vim' load_local_plugin 'plugin/osc52.lua' -- can this be useful on win32? -- load_local_plugin 'plugin/man.lua' load_local_plugin 'plugin/editorconfig.lua' { dev , '~\\Workspaces\\venn.nvim' }, { gh, 'nyoom-engineering/oxocarbon.nvim', 'c5846d10cbe4131cc5e32c6d00beaf59cb60f6a2' }, { dev, 'bugabinga/venn.nvim', }, { gh, 'nyoom-engineering/oxocarbon.nvim', 'c5846d10cbe4131cc5e32c6d00beaf59cb60f6a2', }, { srht, '~adigitoleo/haunt.nvim', 'e3e3c8f45663fed8225ba5efb0af00a2df14a736', }, { cb, 'jthvai/lavender.nvim', 'a5187e6f4afe4b1f2fbcd0fe0bad34c40002ba48', }, { dev, 'bugabinga/auto-dark-mode.nvim', nil, },new file mode 100644+20 / −0 text lines
#!/usr/bin/env nulet file = $"($nu.default-config-dir)/aliases.nu"def save-alias [...args: string] { $"alias ($args | str join ' ')\n" | save -a $file}'' | save -f $file######################################### Start defining your aliases hereif not (which bat | is-empty) { save-alias cat = bat}if not (which bsdtar | is-empty) { save-alias tar = bsdtar}+20 / −5 text lines
{ key = '+', mods = 'SHIFT', action = wez.action.IncreaseFontSize }, { key = '+', action = wez.action.IncreaseFontSize }, { key = 'r', action = wez.action.ActivateKeyTable { name = resize_pane_mode, one_shot = false } }, { key = '=', action = wez.action.ActivateKeyTable { name = resize_pane_mode, one_shot = false } }, { key = 'q', action = wez.action.CloseCurrentPane { confirm = true } }, { key = 'q', action = wez.action.CloseCurrentPane { confirm = false } }, key = 'c', mods = 'LEADER', action = wez.action.SwitchToWorkspace { name = 'code' }, }, { key = 'k', mods = 'LEADER', action = wez.action.SwitchToWorkspace { name = 'dorkfiles editing' }, }, { key = 'd', mods = 'LEADER', action = wez.action.SwitchToWorkspace { name = 'default' }, }, { key = 'r', mods = 'LEADER',+9 / −9 text lines
+4 / −1 text lines