From 2bf31fc1c05402ce8ca870c6ef11ef4512d9755e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 19:06:56 +0300 Subject: [PATCH 1/3] [zsh] don't crash when rustup isn't installed --- zsh/plugins.zsh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index b7fdafc..e28a17a 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -14,13 +14,16 @@ _plugin completions-rustc 'https://raw.githubusercontent.com/rust-lang/zsh-confi _plugin completions-cargo 'https://raw.githubusercontent.com/rust-lang/cargo/master/src/etc/_cargo' from=url \ after_load='plugin-cfg-path fpath prepend ""' -rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup" -if [[ "${commands[rustup]}" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then - _perf_timer_start "generate rustup completions" - rustup completions zsh >| "$rustup_comp_path" - _perf_timer_stop "generate rustup completions" +rustup_bin="${commands[rustup]}" +if [[ -n "$rustup_bin" ]]; then + rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup" + if [[ "$rustup_bin" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then + _perf_timer_start "generate rustup completions" + "$rustup_bin" completions zsh >| "$rustup_comp_path" + _perf_timer_stop "generate rustup completions" + fi + unset rustup_comp_path fi -unset rustup_comp_path # compinit {{{ _perf_timer_start "compinit" From 4c3f20a0ce2a14e86eef59255df5ac8268b5fbf3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 19:07:08 +0300 Subject: [PATCH 2/3] [zsh] use a proper theme for sharkdp/bat --- zsh/env.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsh/env.zsh b/zsh/env.zsh index 34e23a0..895a982 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -34,3 +34,6 @@ export HOMEBREW_NO_AUTO_UPDATE=1 # https://github.com/junegunn/fzf/blob/764316a53d0eb60b315f0bbcd513de58ed57a876/src/tui/tui.go#L496-L515 export FZF_DEFAULT_OPTS="--color=16 --height=40% --reverse" + +# +export BAT_THEME="base16-256" From 20c3f3b5240ad522e5d88b3623e3ea7eae66dc24 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 20:40:36 +0300 Subject: [PATCH 3/3] [nvim] redirect PutOutput into a preview window --- nvim/plugin/editing.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index f0af3ab..416d073 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -78,7 +78,13 @@ set commentstring=//%s nmap ] m'yygccp`'j nmap [ m'yygccP`'k - command! -nargs=+ -complete=command PutOutput execute 'put =execute(' . escape(string(), '|"') . ')' + function! PutOutput(cmd) + let output = execute(a:cmd) + execute "noswapfile pedit" "+" . fnameescape("setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile") fnameescape("preview://" . a:cmd) + wincmd P + call setline(1, split(output, "\n")) + endfunction + command! -nargs=+ -complete=command PutOutput silent call PutOutput() " ,c is easier to type than "+ because it doesn't require pressing Shift noremap c "+